<?php
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}
// ob_start();
$input_width            = eh_crm_get_settingsmeta( '0', 'input_width' );
$main_ticket_form_title = eh_crm_get_settingsmeta( '0', 'main_ticket_form_title' );
$new_ticket_form_title  = eh_crm_get_settingsmeta( '0', 'new_ticket_form_title' );
$existing_ticket_title  = eh_crm_get_settingsmeta( '0', 'existing_ticket_title' );
$submit_ticket_button   = eh_crm_get_settingsmeta( '0', 'submit_ticket_button' );
$reset_ticket_button    = eh_crm_get_settingsmeta( '0', 'reset_ticket_button' );
$existing_ticket_button = eh_crm_get_settingsmeta( '0', 'existing_ticket_button' );
if ( ! $submit_ticket_button ) {
	$submit_ticket_button = 'Submit Request';
}
if ( ! $reset_ticket_button ) {
	$reset_ticket_button = 'Reset Request';
}
if ( ! $existing_ticket_button ) {
	$existing_ticket_button = 'Check your Existing Request';
}

?>
<div class="crm-form-element">
	<div class="col-md-9">
		<span class="help-block"><?php esc_html_e( 'Set custom width for form elements', 'wsdesk' ); ?></span>
		<div class="input-group">
			<input type="number" oninput="this.value = !!this.value && Math.abs(this.value) >= 0 ? Math.abs(this.value) : null" class="form-control" min="0" id="input_elements_width" style="height: 32px;" value="<?php echo esc_html( $input_width ); ?>" placeholder="100" aria-describedby="basic-addon2">
			<span class="input-group-addon" id="basic-addon2">%</span>
		</div>
	</div>
</div>
<h4 style="padding-left: 15px;"><?php esc_html_e( 'Existing Tickets Page Labels', 'wsdesk' ); ?></h4>
<div class="crm-form-element">
	<div class="col-md-8">
		<span class="help-block"><?php esc_html_e( 'You can set the labels displayed to unregistered users when they visit exisiting tickets page here.', 'wsdesk' ); ?></span>
		<span style="vertical-align: middle;">
			<?php
				$exisiting_tickets_login_label = eh_crm_get_settingsmeta( '0', 'exisiting_tickets_login_label' );
			if ( empty( $exisiting_tickets_login_label ) ) {
				$exisiting_tickets_login_label = esc_html__( 'You must Login to Check your Existing Ticket', 'wsdesk' );
			}
				$exisiting_tickets_register_label = eh_crm_get_settingsmeta( '0', 'exisiting_tickets_register_label' );
			if ( empty( $exisiting_tickets_register_label ) ) {
				$exisiting_tickets_register_label = esc_html__( 'Need an Account?', 'wsdesk' );
			}
			?>
			<span class="help-block"><?php esc_html_e( 'Login Label', 'wsdesk' ); ?></span>
			<input type="text" id="exisiting_tickets_login_label" class="form-control crm-form-element-input" value="<?php echo esc_html( $exisiting_tickets_login_label ); ?>">
			<span class="help-block"><?php esc_html_e( 'Register Label', 'wsdesk' ); ?></span>
			<input type="text" id="exisiting_tickets_register_label" class="form-control crm-form-element-input" value="<?php echo esc_html( $exisiting_tickets_register_label ); ?>">
		</span>
	</div>
</div>
<h4 style="padding-left: 15px;"><?php esc_html_e( 'Support Form Title', 'wsdesk' ); ?></h4>
<span class="crm-divider"></span>
<div class="crm-form-element">
	<div class="col-md-8">
		<span class="help-block"><?php esc_html_e( 'Set custom title for the main support form', 'wsdesk' ); ?>&nbsp; <span class="glyphicon glyphicon-info-sign" style="color:lightgray;font-size:x-small;vertical-align:baseline;" data-toggle="wsdesk_tooltip" title="<?php esc_html_e( 'This title would appear in the page with the short code [wsdesk_support].', 'wsdesk' ); ?>" data-container="body"></span></span>

		<input type="text" class="form-control" id="main_ticket_form_title" value="<?php echo esc_html( $main_ticket_form_title ); ?>" placeholder="<?php esc_html_e( 'Contact Support', 'wsdesk' ); ?>">
	</div>
</div>
<div class="crm-form-element">
	<div class="col-md-8">
		<span class="help-block"><?php esc_html_e( 'Set custom title for new support form', 'wsdesk' ); ?>&nbsp; <span class="glyphicon glyphicon-info-sign" style="color:lightgray;font-size:x-small;vertical-align:baseline;" data-toggle="wsdesk_tooltip" title="<?php esc_html_e( 'This title would appear for any new form for both the short codes [wsdesk_support] and [wsdesk_support display=form].', 'wsdesk' ); ?>" data-container="body"></span></span>
		<input type="text" class="form-control" id="new_ticket_form_title" value="<?php echo esc_html( $new_ticket_form_title ); ?>" placeholder="Report Issue">
	</div>
</div>
<div class="crm-form-element">
	<div class="col-md-8">
		<span class="help-block"><?php esc_html_e( 'Set custom title for the existing tickets', 'wsdesk' ); ?>&nbsp; <span class="glyphicon glyphicon-info-sign" style="color:lightgray;font-size:x-small;vertical-align:baseline;" data-toggle="wsdesk_tooltip" title="<?php esc_html_e( 'This title would appear when you wish to display tickets in a separate page using the shortcode [wsdesk_support display=check_request].', 'wsdesk' ); ?>" data-container="body"></span></span>
		<input type="text" class="form-control" id="existing_ticket_title" value="<?php echo esc_html( $existing_ticket_title ); ?>" placeholder="Your Tickets">
	</div>
</div>
<h4 style="padding-left: 15px;"><?php esc_html_e( 'Support Form Button', 'wsdesk' ); ?></h4>
<span class="crm-divider"></span>
<div class="crm-form-element">
	<div class="col-md-8">
		<span class="help-block"><?php esc_html_e( 'Set custom text for the Submit Request button', 'wsdesk' ); ?></span>
		<input type="text" class="form-control" id="submit_ticket_button" value="<?php echo esc_html( $submit_ticket_button ); ?>" placeholder="<?php echo esc_html( $submit_ticket_button ); ?>">
	</div>
</div>
<div class="crm-form-element">
	<div class="col-md-8">
		<span class="help-block"><?php esc_html_e( 'Set custom text for the Reset Request button', 'wsdesk' ); ?></span>
		<input type="text" class="form-control" id="reset_ticket_button" value="<?php echo esc_html( $reset_ticket_button ); ?>" placeholder="<?php echo esc_html( $reset_ticket_button ); ?>">
	</div>
</div>
<div class="crm-form-element">
	<div class="col-md-8">
		<span class="help-block"><?php esc_html_e( 'Set custom text for the Check Existing Ticket button', 'wsdesk' ); ?></span>
		<input type="text" class="form-control" id="existing_ticket_button" value="<?php echo esc_html( $existing_ticket_button ); ?>" placeholder="<?php echo esc_html( $existing_ticket_button ); ?>">
	</div>
</div>
<h4 style="padding-left: 15px;"><?php esc_html_e( 'Redirection URL', 'wsdesk' ); ?></h4>
<span class="crm-divider"></span>
<div class="crm-form-element">
	<div class="col-md-8">
		<span><?php esc_html_e( 'Redirect users to a particular URL after submitting a ticket or logging in or registering or logging out from WSDesk Support Page.', 'wsdesk' ); ?></span>
		<span style="vertical-align: middle;">
			<?php
				$login_redirect_url           = eh_crm_get_settingsmeta( '0', 'login_redirect_url' );
				$purchase_credit_redirect_url = eh_crm_get_settingsmeta( '0', 'purchase_credit_redirect_url' );
				$logout_redirect_url          = eh_crm_get_settingsmeta( '0', 'logout_redirect_url' );
				$register_redirect_url        = eh_crm_get_settingsmeta( '0', 'register_redirect_url' );
				$submit_ticket_redirect_url   = eh_crm_get_settingsmeta( '0', 'submit_ticket_redirect_url' );
				$set_credit_limit             = eh_crm_get_settingsmeta( '0', 'set_credit_limit' );
				$login_url                    = eh_crm_get_settingsmeta( '0', 'login_url' );
				$reg_url                      = eh_crm_get_settingsmeta( '0', 'reg_url' );
			?>
			<span class="help-block"><?php esc_html_e( 'Login  URL', 'wsdesk' ); ?></span>
			<input type="text" id="login_url" class="form-control crm-form-element-input" value="<?php echo esc_url( $login_url ); ?>">
			<span class="help-block"><?php esc_html_e( 'Register URL', 'wsdesk' ); ?></span>
			<input type="text" id="reg_url" class="form-control crm-form-element-input" value="<?php echo esc_url( $reg_url ); ?>">

			<span class="help-block"><?php esc_html_e( 'Login Redirect URL', 'wsdesk' ); ?></span>
			<input type="text" id="login_redirect_url" class="form-control crm-form-element-input" value="<?php echo esc_url( $login_redirect_url ); ?>">
			<span class="help-block"><?php esc_html_e( 'Logout Redirect URL', 'wsdesk' ); ?></span>
			<input type="text" id="logout_redirect_url" class="form-control crm-form-element-input" value="<?php echo esc_url( $logout_redirect_url ); ?>">
			<span class="help-block"><?php esc_html_e( 'Register Redirect URL', 'wsdesk' ); ?></span>
			<input type="text" id="register_redirect_url" class="form-control crm-form-element-input" value="<?php echo esc_url( $register_redirect_url ); ?>">
			 <span class="help-block"><?php esc_html_e( 'Submit Ticket Redirect URL', 'wsdesk' ); ?></span>
			<input type="text" id="submit_ticket_redirect_url" class="form-control crm-form-element-input" value="<?php echo esc_url( $submit_ticket_redirect_url ); ?>">
		</span>
	</div>
</div>
<span class="crm-divider"></span>
<h4 style="padding-left: 15px;"><?php esc_html_e( 'Pay For Support Add-on', 'wsdesk' ); ?></h4>
<div class="crm-form-element">
	<div class="col-md-8">
		<span class="help-block"><?php esc_html_e( 'Purchase Credits Redirect URL', 'wsdesk' ); ?></span>
		<input type="text" id="purchase_credit_redirect_url" class="form-control crm-form-element-input" value="<?php echo esc_url( $purchase_credit_redirect_url ); ?>">
		<span class="help-block"><?php esc_html_e( 'Set Credit Limit to raise a ticket', 'wsdesk' ); ?></span>
		<input type="text" id="set_credit_limit" class="form-control crm-form-element-input" value="<?php echo esc_html( $set_credit_limit ); ?>">
	</div>
</div>
<div class="crm-form-element">
	<div class="col-md-12">
	<button type="button" id="save_appearance" class="btn btn-primary btn-sm"> <span class="glyphicon glyphicon-ok"></span> <?php esc_html_e( 'Save Changes', 'wsdesk' ); ?></button>
	</div>
</div>
<?php
// return ob_get_clean();
