<?php 

defined( 'ROOT_DIR' ) OR DIE;

# HTML SETTINGS FORM

events::addListener('uadmin:pages/settings/users@form', function() { 
	
	$checked = $this->enabled() ? 'checked' : null;
	
?>
	
	<div class='mb-5 row '>
		<div class='col-4 col-sm-2'>
			<div class='form-check form-switch toggle-switch'>
				<input type='hidden' name='helpdesk[enabled]' value='0'>
				<input type='checkbox' class='form-check-input' name='helpdesk[enabled]' value='1' <?php echo $checked; ?>>
			</div>
		</div>
		<p class='col-8 col-sm-10'>
			<big class=''>Enable Support Ticket.</big> 
			<span class='d-block mt-2 text-muted'>
				<i class='bi bi-exclamation-circle me-1'></i> Permit users to create support ticket
			</span>
		</p>
	</div>
	
<?php }, 'enable-helpdesk');

# RESET FORM

events::addListener('uadmin:pages/settings/users.submit', function() {
	
	$this->enabled( $_POST['helpdesk']['enabled'] );
	
}, 'enable-helpdesk');


