HEX
Server: Apache
System: Linux webd006.cluster128.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64
User: zwafgyp (177615)
PHP: 7.4.33
Disabled: _dyuweyrj4,_dyuweyrj4r,dl
Upload Files
File: /home/zwafgyp/locationdebateau/wp-content/themes/my-listing/templates/add-listing/submit-form.php
<?php
/**
 * Listing submission form template.
 *
 * @since 1.0
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

wp_enqueue_script( 'mylisting-listing-form' );
wp_enqueue_style( 'mylisting-add-listing' );
$can_post = is_user_logged_in() || ! mylisting_get_setting( 'submission_requires_account' );
?>

<div class="i-section">
	<div class="container">
		<div class="row section-title">
			<h2 class="case27-primary-text"><?php _ex( 'Your listing details', 'Add listing form', 'my-listing' ) ?></h2>
		</div>
		<form action="<?php echo esc_url( $action ); ?>" method="post" id="submit-job-form" class="job-manager-form light-forms c27-submit-listing-form" enctype="multipart/form-data">

			<?php
			/**
			 * Display login/register message at
			 * the top of the add-listing form.
			 *
			 * @since 1.0
			 */
			require locate_template( 'templates/add-listing/auth.php' ) ?>

			<?php if ( $can_post || \MyListing\Src\Listing::user_can_edit( $job_id ) ) : ?>
				<div class="form-section-wrapper" id="form-section-general">
					<div class="element form-section">
						<div class="pf-head round-icon">
							<div class="title-style-1">
								<i class="icon-pencil-2"></i>
								<h5><?php _ex( 'General', 'Add listing form', 'my-listing' ) ?></h5>
							</div>
						</div>
						<div class="pf-body">

						<?php do_action( 'mylisting/add-listing/form-fields/start' ) ?>

						<?php foreach ( $fields as $key => $field ) : ?>

						<?php if ( $field->get_type() === 'form-heading' ): ?>
						</div></div></div>
						<div class="form-section-wrapper" id="form-section-<?php echo esc_attr( ! empty( $key ) ? $key : \MyListing\Utils\Random_Id::generate(7) ) ?>">
							<div class="element form-section">
								<div class="pf-head round-icon">
									<div class="title-style-1">
										<i class="<?php echo esc_attr( $field->get_prop('icon') ?: 'icon-pencil-2' ) ?>"></i>
										<h5><?php echo esc_html( $field->get_label() ) ?></h5>
									</div>
								</div>
							<div class="pf-body">
							<?php else:
								$classes = [];
								if ( $field->get_type() === 'term-select' ) {
									$classes[] = 'term-type-'.$field->get_prop('terms-template');
								}
								?>
								<div class="fieldset-<?php echo esc_attr( $key ) ?> <?php echo esc_attr( 'field-type-'.$field->get_type() ) ?> form-group <?php echo join( ' ', array_map( 'esc_attr', $classes ) ) ?>">
									<div class="field-head">
										<label for="<?php echo esc_attr( $key ) ?>">
											<?php
												echo $field->get_label(); 
												 
												echo apply_filters(
													'mylisting/submission/required-field-label',
													! $field->is_required()
														? ' <small>'._x( '(optional)', 'Add listing form', 'my-listing' ).'</small>'
														: '',
													$field
												);
											 

											?>
										</label> 
										 
										<?php if ( ! empty( $field->get_description() ) ): ?>
											<small class="description"><?php echo $field->get_description() ?></small>
										<?php endif ?>
									</div> 

									
									<div class="field <?php echo $field->is_required() ? 'required-field' : ''; ?>">
										<?php mylisting_locate_template( 'templates/add-listing/form-fields/'.$field->get_type().'-field.php', [ 'key' => $key, 'field' => $field ] ); ?>
									</div>
								 
									 
								</div>
							<?php endif ?>
						<?php endforeach; ?>

						<?php do_action( 'mylisting/add-listing/form-fields/end' ) ?>

						</div>
					</div>
				</div>
				<div class="form-section-wrapper form-footer" id="form-section-submit">
					<div class="form-section">
						<div class="pf-body">
								<?php 
 										
										 $customer_orders = get_posts( array(
											'numberposts' => -1,
											'meta_key'    => '_customer_user',
											'meta_value'  => get_current_user_id(),
											'post_type'   => wc_get_order_types(),
												'post_status' => array_keys( wc_get_order_statuses() ),
										));

										$id_package = $_REQUEST['listing_package'];
										$listing_type = $_REQUEST['listing_type']; 

										foreach ($customer_orders as $order) {
											$order_id = $order->ID; 
											$order = wc_get_order( $order_id );
											$items = $order->get_items();
											foreach ( $items as $item ) {
												$item_id = $item->get_id();
												$product_name = $item->get_name();
												
												if ($product_name == "Captain & Services") {
													$cityCaptainService = get_post_meta(206, '_listing_city', true ); 
												}

												if ($product_name == "Captain & Services +") {
													$cityCaptainServicePlus = get_post_meta(207, '_listing_city', true ); 
												}

												if ($product_name == "Gold") {
													$cityGold = get_post_meta(214, '_listing_city', true ); 
												}	

												if ($product_name == "Senator") {
													$citySenator = get_post_meta(215, '_listing_city', true ); 
												}

												if ($product_name == "Centurion") {
													$cityCenturion = get_post_meta(216, '_listing_city', true ); 
												}													

												if ($product_name == "My Boat +") {
													$cityMyBoat = get_post_meta(213, '_listing_city', true ); 
												}

												if ($product_name == "My Boat") {
													$cityMyBoatPlus = get_post_meta(208, '_listing_city', true ); 
												}

												if ($product_name == "Boat Hôtel") {
													$cityBoatHotel = get_post_meta(1277, '_listing_city', true ); 
												}

											}
										}

 							?>

						 
							

								 
							<div class="hidden">
								<input type="hidden" name="job_manager_form" value="<?php echo esc_attr( $form ) ?>">
								<input type="hidden" name="job_id" value="<?php echo esc_attr( $job_id ) ?>">
								<input type="hidden" name="step" value="<?php echo esc_attr( $step ) ?>">
								<?php if ( ! empty( $_REQUEST['listing_type'] ) ): ?>
									<input type="hidden" name="listing_type" value="<?php echo esc_attr( $_REQUEST['listing_type'] ) ?>">
								<?php endif ?>
								<?php if ( ! empty( $_REQUEST['listing_package'] ) ): ?>
									<input type="hidden" name="listing_package" value="<?php echo esc_attr( $_REQUEST['listing_package'] ) ?>">
								<?php endif ?>
							</div>

							<div class="listing-form-submit-btn">
								<button  id="hello1" type="submit" name="submit_job" class="preview-btn button buttons button-2" value="submit">
									<?php echo esc_attr( $submit_button_text ) ?>
								</button>

								<?php if ( $form === 'submit-listing' ): ?>
									<button id="hello2" type="submit" name="submit_job" class="skip-preview-btn button buttons button-3" value="submit--no-preview">
										<?php echo esc_attr( _x( 'Skip preview and submit', 'Add listing form', 'my-listing' ) ) ?>
									</button>
								<?php endif ?>
							</div>
							<script>

const getCity = name => {
	let cityNumber = ""

	if (name === "Captain & Services") {
		cityNumber = "<?php echo $cityCaptainService; ?>"
	} else if (name === "Captain & Services +") {
		cityNumber = "<?php echo $cityCaptainServicePlus; ?>"
	} else if (name === "Gold") {
		cityNumber = "<?php echo $cityGold; ?>"
	} else if (name === "Senator") {
		cityNumber = "<?php echo $citySenator; ?>"
	} else if (name === "Centurion") {
		cityNumber = "<?php echo $cityCenturion; ?>"
	} else if (name === "My Boat +") {
		cityNumber = "<?php echo $cityMyBoat; ?>"
	} else if (name === "My Boat") {
		cityNumber = "<?php echo $cityMyBoatPlus; ?>"
	} else if (name === "Boat Hôtel") {
		cityNumber = "<?php echo $cityBoatHotel; ?>"
	}

	console.log(name, cityNumber)

	return cityNumber;
}

document.getElementById("hello1").addEventListener("click", (event) => {
	const opts = []
	const options = document.getElementById('region').selectedOptions;
	for (let i = 0; i < options.length; i++) { 
		opts.push(options[i].value); 
	}
	const myCity = opts.length;

	const urlSearch = new URLSearchParams(window.location.search);
	const city = urlSearch.get("package");
	let lrpd = ""

 
	if (city) {
		lrpd = city
	} else {
		lrpd = localStorage.getItem("lrpd")
	}

	console.log(parseInt(getCity(lrpd))) 
	if (myCity > parseInt(getCity(lrpd))) {
		alert("Nombre de ville maximum atteint"); 
		event.preventDefault();
	}
}); 


document.getElementById("hello2").addEventListener("click", (event) => {
   const opts = []
		   const options = document.getElementById('region').selectedOptions;
		   for (let i = 0; i < options.length; i++) { 
				 opts.push(options[i].value); 
		   }
		   const myCity = opts.length;
		   const urlSearch = new URLSearchParams(window.location.search);
	const city = urlSearch.get("package");
	let lrpd = ""

	if (city) {
		lrpd = city
	} else {
		lrpd = localStorage.getItem("lrpd")
	}

	console.log(parseInt(getCity(lrpd))) 
	if (myCity > parseInt(getCity(lrpd))) {
		alert("Nombre de ville maximum atteint"); 
		event.preventDefault();
	}
}); 

		

</script>

						</div>
					</div>
				</div>
			<?php endif; ?>
		</form>
	</div>
</div>

<div class="add-listing-nav">
	<ul></ul>
</div>

<div class="loader-bg main-loader add-listing-loader" style="background-color: #fff; display: none;">
	<?php c27()->get_partial( 'spinner', [ 'color' => '#000' ] ) ?>
	<p class="add-listing-loading-message"><?php _ex( 'Please wait while the request is being processed.', 'Add listing form', 'my-listing' ) ?></p>
</div>