<?php
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

$avail_labels = eh_crm_get_settings(
	array(
		'type' => 'label',
		//'filter' => 'yes',
	),
	array( 'slug', 'title', 'settings_id' )
);
?>
<center>
	<div>
		<div class="success_archive" style="color:green;display: none"><h4><?php esc_html_e( 'Ticket(s) Data is Archived Successfully!', 'wsdesk' ); ?></h4></div>
		<br>
		<h3><?php esc_html_e( 'Archive Ticket', 'wsdesk' ); ?></h3>
		<div class="crm-form-element">
			<div class="col-md-12">
				<span class="help-block"><?php esc_html_e( 'Specify a date range to archive ticket data.', 'wsdesk' ); ?></span>
				<input type="text" disabled name="archive_start_date" style=" width: 25%;height: 35px;
  padding: 12px 20px;
  margin: 8px 0;
  display: inline-block;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;" id="archive_start_date" placeholder="Start Date" > -
				<input type="text" disabled="true" name="archive_end_date" style=" width: 25%;height: 35px;
  padding: 12px 20px;
  margin: 8px 0;
  display: inline-block;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;" id="archive_end_date" placeholder="End Date" >
				<br>
				<span class="help-block"><?php esc_html_e( 'Select the ticket status.', 'wsdesk' ); ?></span>
				<select disabled="true" class="form-control show_archive" multiple="multiple" id="show_archive" aria-describedby="helpBlock">
				</select>
				<br>
				<span class="help-block"><?php esc_html_e( 'Leave this field empty to select all tickets.', 'wsdesk' ); ?></span>

			</div>
		</div>
		<div class="crm-form-element">
			<div class="col-md-12" id="archive_button">
				<span class="help-block" style="text-align: center"><?php esc_html_e( 'Archive may take a few minutes.', 'wsdesk' ); ?></span>
				<button type="submit" id="archive_data" data-loading-text="<?php esc_html_e( 'Preparing Data...', 'wsdesk' ); ?>" class="btn btn-primary btn-lg archive_data"><?php esc_html_e( 'Start Archive', 'wsdesk' ); ?></button>
			</div>
		</div>
	</div>
	<span class="crm-divider"></span>
	<div>
		<div class="success_unarchive" style="color:green;display: none"><h4><?php esc_html_e( 'Ticket Data is Restored Successfully!', 'wsdesk' ); ?></h4></div>
		<br>
		<h3><?php esc_html_e( 'Restore Ticket', 'wsdesk' ); ?></h3>
		<div class="crm-form-element">
			<div class="col-md-12">
				<span class="help-block"><?php esc_html_e( 'Specify  a date range to move archived ticket data to active tickets section.', 'wsdesk' ); ?></span>
				<input type="text" style=" width: 25%;height: 35px;
  padding: 12px 20px;
  margin: 8px 0;
  display: inline-block;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;" name="archive_start_date_restored"  id="archive_start_date_restored" placeholder="Start Date" > -
				<input disabled="true" type="text" name="archive_end_date_restored" style=" width: 25%;height: 35px;
  padding: 12px 20px;
  margin: 8px 0;
  display: inline-block;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;" id="archive_end_date_restored" placeholder="End Date" >
			<br>
				<span class="help-block"><?php esc_html_e( 'Select the ticket status.', 'wsdesk' ); ?></span>
				<select class="form-control show_unarchive" multiple="multiple" id="show_unarchive" aria-describedby="helpBlock">
				<?php
				for ( $j = 0;$j < count( $avail_labels );$j++ ) {
					echo '<option value="' . esc_attr( $avail_labels[ $j ]['slug'] ) . '">' . esc_html( $avail_labels[ $j ]['title'] ) . '</option>';
				}
				?>
				</select>
				<br>
				<span class="help-block"><?php esc_html_e( 'Leave this field empty to select all tickets.', 'wsdesk' ); ?></span>
			</div>
		</div>
		<div class="crm-form-element">
			<div class="col-md-12" id="unarchive_button">
				<span class="help-block" style="text-align: center"><?php esc_html_e( 'Restore may take a few minutes.', 'wsdesk' ); ?></span>
				<button type="submit" id="archive_data_restored" data-loading-text="<?php esc_html_e( 'Preparing Data...', 'wsdesk' ); ?>" class="btn btn-primary btn-lg archive_data_restored"><?php esc_html_e( 'Restore', 'wsdesk' ); ?></button>
			</div>
		</div>
	</div>
</center>
