<?php
if (isset($tpl['status']))
{
	$status = __('status', true);
	switch ($tpl['status'])
	{
		case 2:
			pjUtil::printNotice(NULL, $status[2]);
			break;
	}
} else {
	include_once PJ_VIEWS_PATH . 'pjLayouts/elements/optmenu.php';
	pjUtil::printNotice(__('infoUpdateDaysOffTitle', true), __('infoUpdateDaysOffDesc', true));
	
	$week_start = isset($tpl['option_arr']['o_week_start']) && in_array((int) $tpl['option_arr']['o_week_start'], range(0,6)) ? (int) $tpl['option_arr']['o_week_start'] : 0;
	$jqDateFormat = pjUtil::jqDateFormat($tpl['option_arr']['o_date_format']);
	?>
	<form action="<?php echo $_SERVER['PHP_SELF']; ?>?controller=pjAdminDates&amp;action=pjActionUpdate" method="post" id="frmUpdateDate" class="form pj-form" autocomplete="off">
		<input type="hidden" name="date_update" value="1" />
		<input type="hidden" name="id" value="<?php echo (int) $tpl['arr']['id']; ?>" />
		
		<p>
			<label class="title"><?php __('lblStartDate'); ?></label>
			<span class="inline_block">
				<span class="pj-form-field-custom pj-form-field-custom-after float_left r5">
					<input type="text" name="start_date" id="start_date" class="pj-form-field required pointer w80 datepicker" readonly="readonly" value="<?php echo date($tpl['option_arr']['o_date_format'], strtotime($tpl['arr']['start_date']));?>" data-msg-required="<?php __('pj_field_required');?>" rel="<?php echo $week_start; ?>" rev="<?php echo $jqDateFormat; ?>" value="" />
					<span class="pj-form-field-after"><abbr class="pj-form-field-icon-date"></abbr></span>
				</span>
			</span>
		</p>
		<p>
			<label class="title"><?php __('lblEndDate'); ?></label>
			<span class="inline_block">
				<span class="pj-form-field-custom pj-form-field-custom-after float_left r5">
					<input type="text" name="end_date" id="end_date" class="pj-form-field required pointer w80 datepicker" readonly="readonly" value="<?php echo date($tpl['option_arr']['o_date_format'], strtotime($tpl['arr']['end_date']));?>" data-msg-required="<?php __('pj_field_required');?>" rel="<?php echo $week_start; ?>" rev="<?php echo $jqDateFormat; ?>" value="" />
					<span class="pj-form-field-after"><abbr class="pj-form-field-icon-date"></abbr></span>
				</span>
			</span>
		</p>
		<p>
			<label class="title">&nbsp;</label>
			<input type="submit" value="<?php __('btnSave', false, true); ?>" class="pj-button" />
			<input type="button" value="<?php __('btnCancel'); ?>" class="pj-button" onclick="window.location.href='<?php echo PJ_INSTALL_URL; ?>index.php?controller=pjAdminDates&action=pjActionIndex';" />
		</p>
	</form>
	
	<?php
	$day_names = __('day_names', true);
	$months = __('months', true);
	ksort($day_names);
	ksort($months);
	?>
	<script type="text/javascript">
	var myLabel = myLabel || {};
	myLabel.monthNames = ["<?php echo join('","', $months); ?>"];
	myLabel.dayNamesMin = ["<?php echo join('","', $day_names); ?>"];
	</script>
	<?php
}
?>