<?php

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

$order_id = $args['p_id'] ?? '';
if ( ! $order_id ) {
	return;
}

?>
<div id="gn-job-order-complete-request" class="gn-modal-wrapper gn-order-complete-modal">
	<div class="gn-modal-dialog">
		<div class="gn-modal-content">
			<div class="gn-modal-info">
				<div class="gn-modal-header">
					<h4 class="gn-title"><?php echo esc_html__( 'Complete order', 'gigneo' ); ?></h4>
					<p class="gn-description"><?php echo esc_html__( 'Submit your reason for completing this order.', 'gigneo' ); ?></p>
					<button type="button" data-gn-modal-close="gn-job-order-complete-request" class="gn-modal-close">
						<i class="hi hi-x-mark" aria-hidden="true"></i>
					</button>
				</div>
				<div id="gn-job-order-complete-request-form" class="gn-theme-form">
					<div class="gn-modal-body gn-custom-scrollbar">
						<fieldset class="gn-form-fields">
							<div class="row g-4">
								<div class="col-md-12">
									<div class="gn-form-field">
										<label class="gn-required-field-label" for="gn-order-complete-reason"><?php echo esc_html__( 'Reason', 'gigneo' ); ?></label>
										<input  class="gn-required-field" type="text" id="gn-order-complete-reason" name="order_complete_reason" placeholder="<?php echo esc_attr__( 'Enter Reason', 'gigneo' ); ?>" >
									</div>
								</div>
								<div class="col-md-12">
									<div class="gn-form-field gn-wysiwyg-editor-two">
										<label for="gn-order-complete-description" class="gn-required-field-label"><?php echo esc_html__( 'Description', 'gigneo' ); ?></label>
										<?php
										wp_editor(
											'',
											'gn-order-complete-description',
											array(
												'textarea_name' => 'order_complete_description',
												'media_buttons' => false,
												'quicktags' => false,
												'textarea_rows' => 7,
												'editor_class' => 'gn-wp-editor gn-required-field',
												'tinymce' => array(
													'toolbar1' => 'bold italic bullist numlist link unlink',
													'toolbar2' => '',
													'plugins'  => 'lists link',
													'directionality' => is_rtl() ? 'rtl' : 'ltr',
													'forced_root_block' => false,
													'force_br_newlines' => true,
													'force_p_newlines' => false,
													'convert_newlines_to_brs' => true,
													'valid_elements' => 'strong/b,em/i,ul,ol,li,a[href|target],br,hr',
													'invalid_elements' => 'p,pre,h1,h2,h3,h4,h5,h6,img',
													'content_style' => 'body { font-size: 14px; background-color: transparent; font-family: var(--gigneo-primary-font,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji) }',
												),
											)
										);
										?>
									</div>
								</div>
							</div>
						</fieldset>
					</div>
					<div class="gn-modal-footer">
						<input type="hidden" id ="gn-order-id" name="gn-order-id" value="<?php echo esc_attr( $order_id ); ?>"/>
						<button type="button" class="gn-btn gn-btn-outline-grey" data-gn-modal-close="gn-job-order-complete-request"><?php echo esc_html__( 'Close', 'gigneo' ); ?></button>
						<button type="button"  id="job-order-complete-request" class="gn-btn gn-btn-primary"><?php echo esc_html__( 'Submit', 'gigneo' ); ?></button>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>