<?php if ( ! defined( 'ABSPATH' ) ) {
exit;} ?>
<div class="bg-dark bg-opacity-25 elex-multi-vendor-for-woocommerce-popup row override-credentials-popup">

			

				<div
					class="col-md-9 col-lg-6 bg-white h-100 ms-auto overflow-auto position-relative elex-multi-vendor-for-woocommerce-popup-content ">
					<div class="py-2 px-4 text-center position-sticky top-0 start-0 bg-white pt-5" style="z-index: 9;">
						<div class="fs-5 fw-semi-bold mb-1">Enter Your Credentials</div>
						<button
							class="btn rounded-circle position-absolute top-0 end-0  override-credentials-close-btn mt-5">
							<i class="fa-solid fa-xmark"></i>
						</button>

					</div>

					<div class="py-2 px-4">
						<div class="d-flex gap-3 align-items-center">
							<div class="d-flex gap-3 align-items-center">
								<div class="fs-6 fw-semi-bold text-nowrap">Use My Account</div>
								<div>
									<label class="elex-enable-disable-switch override-credential-switch"  >
										<input type="checkbox" class="override-credential-check" data-store-id = "<?php echo esc_html( $store->get_id() ); ?>" data-shipping-method="<?php echo esc_html( $shipping_data['slug'] ); ?>"
										<?php    
										if ( isset( $override_credentials_for_shipping_method[ $shipping_data['slug'] ] ) && 'true' === $override_credentials_for_shipping_method[ $shipping_data['slug'] ] ) {
											echo 'checked';
										}
										?>
											 
											>
										<div class="switch round"></div>
									</label>
								</div>
							</div>

							<div class="fs-6  mb-1 text-secondary">
								<small>Turn On, if you want to use your own shipping carrier & override admin`s shipping
									services</small>
							</div>
						</div>
						<div class="override-credentials-form" 
						<?php    
						if ( isset( $override_credentials_for_shipping_method[ $shipping_data['slug'] ] ) && 'true' === $override_credentials_for_shipping_method[ $shipping_data['slug'] ] ) {
							echo 'style="display:block;"';
						} else {
							echo 'style="display:none;"';
						}
						?>
										>
							<form class="mv-override-credentials-form">
							<?php     
							
					

							foreach ( $shipping_data['credentials'] as $override_field_value ) {
								$field_value = '';
								if ( isset( $override_field_value['value'] ) ) {
									$field_value = $override_field_value['value'];

								} elseif ( isset( $override_field_value['default'] ) ) {
									$field_value = $override_field_value['default'];

								}

								woocommerce_form_field(
									$override_field_value['id'],
									array(
										'type'        => $override_field_value['type'],
										'required'    => $override_field_value['required'],
										'label'       => $override_field_value['label'],
										'placeholder' => $override_field_value['placeholder'],
										'options'     => isset( $override_field_value['options'] ) ? $override_field_value['options'] : '',
										'default'     => isset( $override_field_value['default'] ) ? $override_field_value['default'] : '',

									), 
									$field_value
								);
							}
							?>
							<input type="hidden" name="store_id" value="<?php echo esc_html( $store->get_id() ); ?>" >
							<input type="hidden" name="shipping_plugin" value="<?php echo esc_html( $shipping_data['slug'] ); ?>" >

							</form>
						</div>


						<button class="btn btn-primary w-100 override-credentials-valid elex-multi-vendor-for-woocommerce-validate-credential elex-multi-vendor-for-woocommerce-override-cred-function" data-store-id = "<?php echo esc_html( $store->get_id() ); ?>" 
						<?php    
						if ( isset( $override_credentials_for_shipping_method[ $shipping_data['slug'] ] ) && 'true' === $override_credentials_for_shipping_method[ $shipping_data['slug'] ] ) {
							echo 'enabled';
						} else {
							echo 'disabled';
						}
						?>

						>Validate & Save</button>
					</div>
				</div>
			</div>

			
