<?php
/**
 * Load admin view for Form list.
 *
 * @package miniorange-sms-order-notification-otp-verification/views
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}

echo '<div class="mowc_registration_table_layout" id="selected_form_details">
					<table id="mo_forms" style="width: 100%;">
						<tr>
							<td>
								<h2>
									<i>' . esc_html( mowc_( 'FORM SETTINGS' ) ) . '</i>
									<span style="float:right;margin-top:-10px;">
									    <a  class="show_configured_forms button button-primary button-large" 
                                            href="' . esc_url( $mowc_moaction ) . '">
                                            ' . esc_html( mowc_( 'Show All Enabled Forms' ) ) . '
                                        </a>
									    <a class="show_form_list button button-primary button-large"
									        href="' . esc_url( $mowc_forms_list_page ) . '">
									        ' . esc_html( mowc_( 'Show Forms List' ) ) . '
                                        </a>
                                        <input  name="save" id="ov_settings_button" ' . esc_attr( $mowc_disabled ) . ' 
                                                class="button button-primary button-large" 
                                                value="' . esc_attr( mowc_( 'Save Settings' ) ) . '" type="submit">
                                        <span   class="mo-dashicons dashicons dashicons-arrow-up mowc-toggle-div" 
                                                data-show="false" 
                                                data-toggle="new_form_settings"></span>
                                    </span>									
								</h2><hr>
							</td>
						</tr>
						<tr>
							<td>
								<div id="new_form_settings">
									<div id="form_details">';
										// Extract class name (before #) and validate to prevent LFI
										$mowc_class_name    = strtolower( explode( '#', $mowc_form_name )[0] );
										$mowc_allowed_forms = array(
											'class-wcprofileform',
											'class-woocommercebilling',
											'class-woocommercecheckoutform',
											'class-woocommercecheckoutnew',
											'class-woocommerceproductvendors',
											'class-woocommerceregistrationform',
											'class-woocommercesocialloginform',
											'class-wploginform',
										);
										if ( ! in_array( $mowc_class_name, $mowc_allowed_forms, true ) ) {
											wp_die( esc_html__( 'Invalid form name.', 'miniorange-sms-order-notification-otp-verification' ) );
										}
										$mowc_form_file = $mowc_controller . 'forms/' . $mowc_class_name . '.php';
										if ( ! MoUtility::mo_require_file( $mowc_form_file, MOV_WC_DIR ) ) {
											echo '<p>' . esc_html__( 'Form file not found.', 'miniorange-sms-order-notification-otp-verification' ) . '</p>';
										} else {
											require $mowc_form_file;
										}

										echo '</div>
								</div>
							</td>
						</tr>
					</table>
				</div>';
