<?php
if ( ! defined( 'ABSPATH' ) ) exit;
$bingocr_extras_ok = BingoCR_License::can( 'extras' );
?>
<div class="wrap bingocr-admin-wrap">
	<h1><?php esc_html_e( 'Extras', 'bingocar' ); ?></h1>
	<p class="description"><?php esc_html_e( 'Optional add-ons customers can select during booking (GPS, child seat, insurance, etc.)', 'bingocar' ); ?></p>

	<?php if ( ! $bingocr_extras_ok ) :
		$bingocr_upsell_title = __( 'Extras are a Pro feature', 'bingocar' );
		$bingocr_upsell_desc  = __( 'Offer paid add-ons — GPS, child seats, insurance and more — that customers can select at checkout, priced per day or as a flat fee. Upgrade to Pro to create and sell extras.', 'bingocar' );
		include __DIR__ . '/partial-pro-upsell.php';
	else : ?>

	<div class="bingocr-toolbar">
		<button class="button button-primary" id="bingocr-add-extra"><?php esc_html_e( '+ Add Extra', 'bingocar' ); ?></button>
	</div>

	<div id="bingocr-extras-list"><p><?php esc_html_e( 'Loading…', 'bingocar' ); ?></p></div>

	<div id="bingocr-extra-form-wrap" class="bingocr-modal-wrap" style="display:none;">
		<div class="bingocr-modal">
			<h2 id="bingocr-extra-form-title"><?php esc_html_e( 'Add Extra', 'bingocar' ); ?></h2>
			<form id="bingocr-extra-form" novalidate>
				<input type="hidden" id="extra-id" value="">
				<div class="bingocr-form-row">
					<label><?php esc_html_e( 'Name *', 'bingocar' ); ?><br><input type="text" name="name" required class="regular-text"></label>
				</div>
				<div class="bingocr-form-row">
					<label><?php esc_html_e( 'Description', 'bingocar' ); ?><br><textarea name="description" rows="2" class="large-text"></textarea></label>
				</div>
				<div class="bingocr-form-row bingocr-three-col">
					<label><?php esc_html_e( 'Price *', 'bingocar' ); ?><br><input type="number" name="price" min="0" step="0.01" required class="small-text"></label>
					<label><?php esc_html_e( 'Price Type', 'bingocar' ); ?><br>
						<select name="price_type">
							<option value="per_day"><?php esc_html_e( 'Per Day', 'bingocar' ); ?></option>
							<option value="flat"><?php esc_html_e( 'Flat (one-time)', 'bingocar' ); ?></option>
						</select>
					</label>
					<label><?php esc_html_e( 'Status', 'bingocar' ); ?><br>
						<select name="status">
							<option value="active"><?php esc_html_e( 'Active', 'bingocar' ); ?></option>
							<option value="inactive"><?php esc_html_e( 'Inactive', 'bingocar' ); ?></option>
						</select>
					</label>
				</div>
				<div class="bingocr-form-actions">
					<button type="submit" class="button button-primary"><?php esc_html_e( 'Save Extra', 'bingocar' ); ?></button>
					<button type="button" class="button" id="bingocr-cancel-extra"><?php esc_html_e( 'Cancel', 'bingocar' ); ?></button>
					<span class="bingocr-form-message"></span>
				</div>
			</form>
		</div>
	</div>

	<?php endif; ?>
</div>
