<div class="kt-subheader   kt-grid__item" id="kt_subheader" style="height:50px;margin-top:40px;">
	<div class="kt-container  kt-container--fluid ">
		<div class="kt-subheader__main">
			<h3 class="kt-subheader__title">
				System Setting
			</h3>
			<span class="kt-subheader__separator kt-subheader__separator--v"></span>
			<div class="kt-subheader__breadcrumbs">
				<span class="kt-subheader__breadcrumbs-home"><i class="flaticon2-shelter"></i></span>
				<span class="kt-subheader__breadcrumbs-separator"></span>
				<span class="kt-subheader__breadcrumbs-link">
					Admin </span>
				<span class="kt-subheader__breadcrumbs-separator"></span>
				<span class="kt-subheader__breadcrumbs-link">
					System Setting </span>
			</div>
		</div>
	</div>
</div>

<div class="kt-portlet kt-portlet--tabs" id="formUser">
	<div class="kt-portlet__head">
		<div class="kt-portlet__head-toolbar">
			<ul class="nav nav-tabs nav-tabs-space-xl nav-tabs-line nav-tabs-bold nav-tabs-line-3x nav-tabs-line-brand" role="tablist">
				<li class="nav-item">
					<a class="nav-link " data-toggle="tab" href="#setting-general" role="tab">
						<i class="la la-briefcase"></i> General
					</a>
				</li>
				<li class="nav-item">
					<a class="nav-link " data-toggle="tab" href="#setting-email" role="tab">
						<i class="flaticon-email"></i> Email
					</a>
				</li>
				<li class="nav-item">
					<a class="nav-link " data-toggle="tab" href="#setting-other" role="tab">
						<i class="flaticon-attachment"></i> Other
					</a>
				</li>
				<li class="nav-item">
					<a class="nav-link " data-toggle="tab" href="#setting-reminder" role="tab">
						<i class="flaticon-bell"></i> Email Notification Set Up
					</a>
				</li>
			</ul>
		</div>
	</div>

	<form class="kt-form kt-form--label-right" style="margin-bottom: 0px;">
		<div class="kt-portlet__body">
			<div class="tab-content">
				<div class="tab-pane active" id="setting-general" role="tabpanel">
					<div class="form-group row form-group-marginless">
						<label class="col-lg-1 col-form-label">Organization Name :</label>
						<div class="col-lg-3">
							<input type="text" id="txtSettingName1" maxlength="50" size="50" class="form-control" value="<?php echo $this->getName1() ;?>">
							<span id="setting_err_name1" style="color:Red;display:none">*</span>
						</div>
						<label class="col-lg-1 col-form-label">Ref No:</label>
						<div class="col-lg-3">
							<input type="text" id="txtSettingRefNo" maxlength="20" size="20" class="form-control" value="<?php echo $this->getRefNo() ;?>">
						</div>
						<label class="col-lg-1 col-form-label">Organization Code:</label>
						<div class="col-lg-1">
							<input type="text" id="txtSettingCode" maxlength="7" size="7" class="form-control" value="<?php echo $this->getCode() ;?>" >
							<span id="setting_err_code" style="color:Red;display:none">*</span>
						</div>
					</div>
					<div class="kt-separator kt-separator--border-dashed kt-separator--portlet-fit"></div>
					<div class="form-group row form-group-marginless">
						
						<label class="col-form-label col-lg-1 col-sm-12">Working Hour:</label>
						<div class="col-lg-1 col-md-9 col-sm-12">
							<select class="form-control kt-select2" id="txtSettingTime">
							<?php for ($i=0; $i <24 ; $i++) { ?>
									<option value="<?php echo $i ?>"><?php echo $i ?></option>
							<?php } ?>
							</select>
						</div>
						<label class="col-form-label">-</label>
						<div class="col-lg-1 col-md-9 col-sm-12">
							<select class="form-control kt-select2" id="txtSettingTimeEnd">
							
							<?php for ($i=1; $i <25 ; $i++) { ?>
									<option value="<?php echo $i ?>"><?php echo $i ?></option>
							<?php } ?>
								
							</select>
						</div>
					</div>
				</div>
				<div class="tab-pane" id="setting-email" role="tabpanel">
					<div class="form-group row form-group-marginless">
						<label class="col-lg-1 col-form-label">Mail Server :</label>
						<div class="col-lg-3">
							<input type="text" id="txtSettingMailserver" maxlength="50" size="50" class="form-control" value="<?php echo $this->getEmailServer() ;?>">
							<span id="setting_err_email_server" style="color:Red;display:none">*</span>
						</div>
						<label class="col-lg-1 col-form-label">Port:</label>
						<div class="col-lg-3">
							<input type="text" id="txtSettingMailPort" maxlength="6" size="6" class="form-control" value="<?php echo $this->getEmailPort() ;?>">
							<span id="setting_err_email_port" style="color:Red;display:none">*</span>
						</div>
						<label class="col-lg-1 col-form-label">Username:</label>
						<div class="col-lg-3">
							<input type="text" id="txtSettingMailUser" maxlength="30" size="30" class="form-control" value="<?php echo $this->getEmailUser() ;?>">
							<span id="setting_err_email_user" style="color:Red;display:none">*</span>
						</div>
					</div>
					<div class="kt-separator kt-separator--border-dashed kt-separator--portlet-fit"></div>
					<div class="form-group row form-group-marginless">
						<label class="col-lg-1 col-form-label">Password:</label>
						<div class="col-lg-3">
							<input type="text" id="txtSettingMailPwd" maxlength="30" size="30" class="form-control" value="<?php echo $this->getEmailPwd() ;?>">
							<span id="setting_err_email_pwd" style="color:Red;display:none">*</span>
						</div>
						<label class="col-lg-1 col-form-label"></label>
						<div class="col-lg-3">
							<label class="kt-checkbox kt-checkbox--success">
								<input type="checkbox" id="chkSettingMailEnableAuthentication" <?php echo $this->getEnableAuthentication() ;?>> Enable Authentication
								<span></span>
							</label>
						</div>
						<label class="col-lg-1 col-form-label"></label>
						<div class="col-lg-3">
							<label class="kt-checkbox kt-checkbox--success">
								<input type="checkbox" id="chkSettingMailSSL" <?php echo $this->getEmailSSL() ;?>> Use SSL
								<span></span>
							</label>
						</div>
					</div>	
				</div>
				<div class="tab-pane" id="setting-other" role="tabpanel">
					<div class="form-group row form-group-marginless">
						<label class="col-lg-2 col-form-label">Upload Size Limit :</label>
						<div class="col-lg-3">
							<input type="text" id="txtSettingOtherUploadSizeLimit" maxlength="15" size="15" class="form-control" value="<?php echo $this->getUploadSizeLimit() ;?>">
							<span id="setting_err_upload_size_limit" style="color:Red;display:none">*</span>
						</div>
						<div class="col-lg-1" style="margin-top: 10px;">
							<span>KB</span>
						</div>
						<label class="col-lg-1 col-form-label" style="display:none;">Base Currency:</label>
						<div class="col-lg-3" style="display:none;">
							<input type="text" id="txtSettingOtherBaseCurrency" maxlength="15" size="15" class="form-control" value="<?php echo $this->getBaseCurrency() ;?>">
							<span id="setting_err_base_currency" style="color:Red;display:none">*</span>
						</div>
						<label class="col-lg-1 col-form-label" style="display:none;">Emp. Code to Export:</label>
						<div class="col-lg-3" style="display:none;">
							<select class="form-control kt-select2" id="txtSettingOtherEmpCode">
								<?php echo $this->getEmpCodeToExportSelection() ; ?>
							</select>
							<span id="setting_err_upload_size_limit" style="color:Red;display:none">*</span>
						</div>
					</div>
					<div class="kt-separator kt-separator--border-dashed kt-separator--portlet-fit"></div>
					<div class="form-group row form-group-marginless">
						<label class="col-lg-1 col-form-label" <?php echo (Util::isModuleEnabled(ModuleInfo::ExpenseClaims) ? "" : "style='display:none'"); ?>>Show expenses from last :</label>
						<div class="col-lg-3" <?php echo (Util::isModuleEnabled(ModuleInfo::ExpenseClaims) ? "" : "style='display:none'"); ?>>
							<input type="text" id="txtSettingClaimDayLast" maxlength="15" size="15" class="form-control" value="<?php echo $this->getClaimDayLast() ;?>">
							<span id="setting_err_claims_day_last" style="color:Red;display:none">*</span>
						</div>
						<label class="col-lg-2 col-form-label"></label>
						<div class="col-lg-4">
							<label class="kt-checkbox kt-checkbox--success">
								<input type="checkbox" id="chkSettingOtherAllowDeleteMaster" <?php echo $this->getAllowDeleteMaster() ;?>> Allow deletion of master item even it's used in other tables
								<span></span>
							</label>
						</div>
						<label class="col-lg-1 col-form-label"></label>
						<div class="col-lg-1">
							<label class="kt-checkbox kt-checkbox--success">
								<input type="checkbox" id="chkSettingBu" class="form-control" <?php echo $this->getUseBu() ;?>> Use BU
								<span></span>
							</label>
						</div>
						<label class="col-lg-1 col-form-label" <?php echo (Util::isModuleEnabled(ModuleInfo::ExpenseClaims) ? "" : "style='display:none'"); ?>></label>
						<div class="col-lg-3" <?php echo (Util::isModuleEnabled(ModuleInfo::ExpenseClaims) ? "" : "style='display:none'"); ?>>
							<label class="kt-checkbox kt-checkbox--success">
								<input type="checkbox" id="chkSettingClaimUsePaymentReference" <?php echo $this->getClaimUsePaymentReference() ;?>> Use payment reference
								<span></span>
							</label>
						</div>
					</div>	
				</div>
				<div class="tab-pane" id="setting-reminder" role="tabpanel">
					<div class="form-group row form-group-marginless">
						<label class="col-lg-1 col-form-label"></label>
						<div class="col-lg-2">
							<label class="kt-checkbox kt-checkbox--success">
								<input type="checkbox" id="chkSettingReminder" class="form-control" <?php echo $this->getUseReminder() ;?> onchange="checkReminder();"> Use Reminder
								<span></span>
							</label>
						</div>
					</div>
					<div class="kt-separator kt-separator--border-dashed kt-separator--portlet-fit"></div>
					<div class="form-group row form-group-marginless">
						<label class="col-lg-1 col-form-label">Service Report Approval :</label>
						<div class="col-lg-3">
							<textarea id="txtReminderMessage1" rows="5" class="form-control"><?php echo $this->getReminderMessage1() ;?></textarea>
						</div>
						<label class="col-lg-2 col-form-label">Reminder :</label>
						<div class="col-lg-3">
							<textarea id="txtReminderMessage2" rows="5" class="form-control"><?php echo $this->getReminderMessage2() ;?></textarea>
						</div>
					</div>
					<div class="kt-separator kt-separator--border-dashed kt-separator--portlet-fit"></div>
					<div class="form-group row form-group-marginless">
						<label class="col-lg-1 col-form-label">Final Reminder :</label>
						<div class="col-lg-3">
							<textarea id="txtReminderMessage3" rows="5" class="form-control"><?php echo $this->getReminderMessage3() ;?></textarea>
						</div>
						<label class="col-lg-2 col-form-label">Auto-Approval Notification :</label>
						<div class="col-lg-3">
							<textarea id="txtReminderMessage4" rows="5" class="form-control"><?php echo $this->getReminderMessage4() ;?></textarea>
						</div>
					</div>
					<div class="kt-separator kt-separator--border-dashed kt-separator--portlet-fit"></div>
					<div class="form-group row form-group-marginless">
						<label class="col-lg-1 col-form-label">Auto Approval :</label> 
						<div class="col-lg-1">
							<input type="number" id="txtReminderAutoApproval" maxlength="6" size="6" class="form-control" value="<?php echo $this->getReminderIntervalApproval() ;?>">
						</div>
						<div class="col-lg-1 col-md-9 col-sm-12">
							<select class="form-control kt-select2" id="txtReminderIntervalAprrovalType">
								<option value="1">Minute</option>
								<option value="2">Day</option>
								<option value="3">Week</option>
								<option value="4">Month</option>
							</select>
						</div>

						<label class="col-lg-2 col-form-label">Interval Reminder:</label>
						<div class="col-lg-1">
							<input type="number" id="txtReminderInterval" maxlength="6" size="6" class="form-control" value="<?php echo $this->getReminderInterval() ;?>">
							
						</div>
						<div class="col-lg-1 col-md-9 col-sm-12">
							<select class="form-control kt-select2" id="txtReminderIntervalType">
								<option value="1">Minute</option>
								<option value="2">Day</option>
								<option value="3">Week</option>
								<option value="4">Month</option>
							</select>
						</div>

					</div>	

				</div>

			</div>
		</div>

		<div class="kt-portlet__foot">
			<div class="kt-form__actions ">
				<button type="button" id="btnSettingUpdate" class="btn btn-label-twitter"><i class="fa fa-edit"></i>Update</button>
			</div>
		</div>
	</form>
</div>
<!-- end:: Content -->

<script type="text/javascript">
var setting_url = "<?php echo Util::convertLink("Setting") ; ?>" ;
var empCodeToExportValue = "<?php echo $this->getEmpCodeToExportSelected(); ?>" ;


<?php include (PATH_CODE . "js/admin/setting.js") ; ?>

$('#txtReminderIntervalType').val("<?php echo $this->getReminderIntervalUnit() ;?>");
$('#txtReminderIntervalAprrovalType').val("<?php echo $this->getReminderIntervalApprovalUnit() ;?>");

checkReminder();
</script>

<!-- ============================================================================== -->

<!-- <div id="sbg-setting-entry" style="width:610px;margin: 5px 5px 5px 5px;">
	<div id="setting-tabs">
		<ul style="font-size: 0.8em;">
			<li><a href="#setting-general">General</a></li>
			<li style="display:none;"><a href="#setting-addr">Contact</a></li>
			<li style="display:none;"><a href="#setting-logo">Logo</a></li>
			<li><a href="#setting-email">Email</a></li>
			<li><a href="#setting-other">Other</a></li>
			<span class="sbg-tab-title">System Setting</span>
		</ul>
		<div id="setting-general" style="height:150px; display:none;">
			<table>
				<tr>
					<td style="text-align:right;"><span>Organization Name : </span></td>
					<td><input type="text" maxlength="50" size="50" id="txtSettingName1" value="<?php //echo $this->getName1() ;?>" />
					<span id="setting_err_name1" style="color:Red;display:none">*</span></td>
				</tr>
				<tr>
					<td style="text-align:right;"><span>Organization Code : </span></td>
					<td><input type="text" maxlength="10" size="10" id="txtSettingCode" value="<?php //echo $this->getCode() ;?>" />
					<span id="setting_err_code" style="color:Red;display:none">*</span></td>
				</tr>
				<tr>
					<td style="text-align:right;"><span>Ref No : </span></td>
					<td><input type="text" maxlength="20" size="20" id="txtSettingRefNo" value="<?php //echo $this->getRefNo() ;?>" /></td>
				</tr>
				<tr><td style="text-align:right;"></td>
					<td><input id="chkSettingBu" type="checkbox" <?php echo $this->getUseBu() ;?>/><label for="chkSettingBu">Use BU</label></td>
				</tr>
			</table>
		</div>
		<div id="setting-addr" style="height:150px;display:none;">
			<table>
				<tr>
					<td style="text-align:right;"><span>Address : </span></td>
					<td><input type="text" maxlength="40" size="50" id="txtSettingAddr1" value="<?php //echo $this->getAddr1() ;?>" /></td>
				</tr>
				<tr>
					<td></td>
					<td><input type="text" maxlength="40" size="50" id="txtSettingAddr2" value="<?php //echo $this->getAddr2() ;?>" /></td>
				</tr>
				<tr>
					<td></td>
					<td><input type="text" maxlength="40" size="50" id="txtSettingAddr3" value="<?php //echo $this->getAddr3() ;?>" /></td>
				</tr>
				<tr>
					<td></td>
					<td><input type="text" maxlength="40" size="50" id="txtSettingAddr4" value="<?php //echo $this->getAddr4() ;?>" /></td>
				</tr>
				<tr>
					<td></td>
					<td><input type="text" maxlength="40" size="50" id="txtSettingAddr5" value="<?php //echo $this->getAddr5() ;?>" /></td>
				</tr>
				<tr>
					<td style="text-align:right;"><span>Tel / Fax No : </span></td>
					<td>
						<input type="text" maxlength="20" size="20" id="txtSettingTelNo" value="<?php //echo $this->getTelNo() ;?>" />&nbsp;&nbsp;/&nbsp;&nbsp;
						<input type="text" maxlength="20" size="20" id="txtSettingFaxNo" value="<?php //echo $this->getFaxNo() ; ?>" />
					</td>
				</tr>
			</table>
		</div>
		 <div id="setting-logo" style="height:150px;display:none;">
			<table>
				<tr>
					<td colspan="2">Logo File :
						<input type="file" id="fileLogo" name="fileLogo" size="60"></input>
					</td>
				</tr>
				<tr>
					<td style="width:400px;" id="imgSettingLogo">
						<div style="margin-top:5px"><img id="imgLogo" width="200px" height="100px" border="1" src="<?php //echo $this->getLogo() ; ?>"></img></div>
						<div style="margin-top:5px">Size : 200(w) x 100(h). Format : png,jpg,jpeg</div>
					</td>
					<td style="width:200px;vertical-align:top">
						<div style="margin-top:10px;">
							<input id="btnSettingUpload" type="button" value="Upload">&nbsp;&nbsp;</input>
							<input id="btnSettingRemove" type="button" value="Remove"></input>
						</div>
						<div id="setting_upload" style="margin-top:10px;display:none;">
							<div><span id="setting_upload_mesg">Uploading file .....</span></div>
							<div style="margin-top:10px"><img src="image/uploading.gif"></div>
						</div>
					</td>
				</tr>
			</table>
		</div>
		<div id="setting-email" style="height:150px;">
			<table>
				<tr>
					<td style="text-align:right;"><span>Mail Server : </span></td>
					<td><input type="text" maxlength="50" size="50" id="txtSettingMailserver" value="<?php //echo $this->getEmailServer() ;?>" />
					<span id="setting_err_email_server" style="color:Red;display:none">*</span></td>
				</tr>
				<tr>
					<td style="text-align:right;"><span>Port : </span></td>
					<td><input type="text" maxlength="6" size="6" id="txtSettingMailPort" value="<?php //echo $this->getEmailPort() ;?>" />
					<span id="setting_err_email_port" style="color:Red;display:none">*</span></td>
				</tr>
				<tr>
					<td style="text-align:right;"><span>Username : </span></td>
					<td><input type="text" maxlength="30" size="30" id="txtSettingMailUser" value="<?php //echo $this->getEmailUser() ;?>" />
					<span id="setting_err_email_user" style="color:Red;display:none">*</span></td>
				</tr>
				<tr>
					<td style="text-align:right;"><span>Password : </span></td>
					<td><input type="password" maxlength="30" size="30" id="txtSettingMailPwd" value="<?php //echo $this->getEmailPwd() ;?>" /></td>
					<span id="setting_err_email_pwd" style="color:Red;display:none">*</span></td>
				</tr>
				<tr><td style="text-align:right;"></td>
					<td><input id="chkSettingMailEnableAuthentication" type="checkbox" <?php //echo $this->getEnableAuthentication() ;?>/><label for="chkSettingMailEnableAuthentication">Enable Authentication</label></td>
				</tr>
				<tr><td style="text-align:right;"></td>
					<td><input id="chkSettingMailSSL" type="checkbox" <?php //echo $this->getEmailSSL() ;?>/><label for="chkSettingMailSSL">Use SSL</label></td>
				</tr>
			</table>
		</div>
		<div id="setting-other" style="height:250px;">
			<table>
				<tr>
					<td style="text-align:right;width:180px; "><span>Upload Size Limit : </span></td>
					<td><input type="text" maxlength="15" size="15" id="txtSettingOtherUploadSizeLimit" value="<?php //echo $this->getUploadSizeLimit() ;?>" /> KB &nbsp;&nbsp;
					<span id="setting_err_upload_size_limit" style="color:Red;display:none">*</span></td>
				</tr>
				<tr style="display:none;">
					<td style="text-align:right;width:180px; "><span>Base Currency : </span></td>
					<td><input type="text" maxlength="15" size="15" id="txtSettingOtherBaseCurrency" value="<?php //echo $this->getBaseCurrency() ;?>" /> &nbsp;&nbsp;
					<span id="setting_err_base_currency" style="color:Red;display:none">*</span></td>
				</tr>
				<tr style="display:none;">
					<td style="text-align:right;"><span>Emp. Code to Export: </span></td>
                    <td><select id="txtSettingOtherEmpCode" > <?php //echo $this->getEmpCodeToExportSelection(); ?></select>
					<span id="setting_err_upload_size_limit" style="color:Red;display:none">*</span></td>
				</tr>
				<tr <?php //echo (Util::isModuleEnabled(ModuleInfo::ExpenseClaims) ? "" : "style='display:none'"); ?>>
					<td style="text-align:right;"><span>Show expenses from last : </span></td>
					<td><input type="text" maxlength="15" size="15" id="txtSettingClaimDayLast" value="<?php //echo $this->getClaimDayLast() ;?>" /> day(s) &nbsp;&nbsp;
					<span id="setting_err_claims_day_last" style="color:Red;display:none">*</span></td>
				</tr>
				<tr><td style="text-align:right;"></td>
					<td><input id="chkSettingOtherAllowDeleteMaster" type="checkbox" <?php //echo $this->getAllowDeleteMaster() ;?>/><label for="chkSettingOtherAllowDeleteMaster">Allow deletion of master item even it's used in other tables.</label></td>
				</tr>
				<tr <?php //echo (Util::isModuleEnabled(ModuleInfo::ExpenseClaims) ? "" : "style='display:none'"); ?>>
					<td style="text-align:right;"></td>
					<td><input id="chkSettingClaimUsePaymentReference" type="checkbox" <?php //echo $this->getClaimUsePaymentReference() ;?>/><label for="chkSettingClaimUsePaymentReference">Use payment reference</label></td>
				</tr>
			</table>
		</div>

	</div>
	<div class="ui-widget-content ui-corner-all" style="height:40px;margin-top:2px;">
		<div class="sbg-entry-error" style="width:300px;">
			<span id="setting_err_mesg" class="sbg-error"></span>
		</div>
		<div class="sbg-entry-command">
			<input id="btnSettingUpdate" type="button" value="Update"></input>
		</div>
	</div>
</div>

<script type="text/javascript">
var setting_url = "<?php //echo Util::convertLink("Setting") ; ?>" ;
var empCodeToExportValue = "<?php //echo $this->getEmpCodeToExportSelected(); ?>" ;
<?php //include (PATH_CODE . "js/admin/setting.js") ; ?>
</script> -->