<?php
namespace PHPMaker2020\hostelmgr20;

// Session
if (session_status() !== PHP_SESSION_ACTIVE)
	session_start(); // Init session data

// Output buffering
ob_start();

// Autoload
include_once "autoload.php";
?>
<?php

// Write header
WriteHeader(FALSE);

// Create page object
$abscount_edit = new abscount_edit();

// Run the page
$abscount_edit->run();

// Setup login status
SetupLoginStatus();
SetClientVar("login", LoginStatus());

// Global Page Rendering event (in userfn*.php)
Page_Rendering();

// Page Rendering event
$abscount_edit->Page_Render();
?>
<?php include_once "header.php"; ?>
<script>
var fabscountedit, currentPageID;
loadjs.ready("head", function() {

	// Form object
	currentPageID = ew.PAGE_ID = "edit";
	fabscountedit = currentForm = new ew.Form("fabscountedit", "edit");

	// Validate form
	fabscountedit.validate = function() {
		if (!this.validateRequired)
			return true; // Ignore validation
		var $ = jQuery, fobj = this.getForm(), $fobj = $(fobj);
		if ($fobj.find("#confirm").val() == "F")
			return true;
		var elm, felm, uelm, addcnt = 0;
		var $k = $fobj.find("#" + this.formKeyCountName); // Get key_count
		var rowcnt = ($k[0]) ? parseInt($k.val(), 10) : 1;
		var startcnt = (rowcnt == 0) ? 0 : 1; // Check rowcnt == 0 => Inline-Add
		var gridinsert = ["insert", "gridinsert"].includes($fobj.find("#action").val()) && $k[0];
		for (var i = startcnt; i <= rowcnt; i++) {
			var infix = ($k[0]) ? String(i) : "";
			$fobj.data("rowindex", infix);
			<?php if ($abscount_edit->id->Required) { ?>
				elm = this.getElements("x" + infix + "_id");
				if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
					return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $abscount_edit->id->caption(), $abscount_edit->id->RequiredErrorMessage)) ?>");
			<?php } ?>
			<?php if ($abscount_edit->Date->Required) { ?>
				elm = this.getElements("x" + infix + "_Date");
				if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
					return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $abscount_edit->Date->caption(), $abscount_edit->Date->RequiredErrorMessage)) ?>");
			<?php } ?>
				elm = this.getElements("x" + infix + "_Date");
				if (elm && !ew.checkDateDef(elm.value))
					return this.onError(elm, "<?php echo JsEncode($abscount_edit->Date->errorMessage()) ?>");
			<?php if ($abscount_edit->Hostel->Required) { ?>
				elm = this.getElements("x" + infix + "_Hostel");
				if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
					return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $abscount_edit->Hostel->caption(), $abscount_edit->Hostel->RequiredErrorMessage)) ?>");
			<?php } ?>
			<?php if ($abscount_edit->Floor->Required) { ?>
				elm = this.getElements("x" + infix + "_Floor");
				if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
					return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $abscount_edit->Floor->caption(), $abscount_edit->Floor->RequiredErrorMessage)) ?>");
			<?php } ?>
			<?php if ($abscount_edit->_RS->Required) { ?>
				elm = this.getElements("x" + infix + "__RS");
				if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
					return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $abscount_edit->_RS->caption(), $abscount_edit->_RS->RequiredErrorMessage)) ?>");
			<?php } ?>
			<?php if ($abscount_edit->Absent->Required) { ?>
				elm = this.getElements("x" + infix + "_Absent");
				if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
					return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $abscount_edit->Absent->caption(), $abscount_edit->Absent->RequiredErrorMessage)) ?>");
			<?php } ?>
				elm = this.getElements("x" + infix + "_Absent");
				if (elm && !ew.checkInteger(elm.value))
					return this.onError(elm, "<?php echo JsEncode($abscount_edit->Absent->errorMessage()) ?>");
			<?php if ($abscount_edit->Postedby->Required) { ?>
				elm = this.getElements("x" + infix + "_Postedby");
				if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
					return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $abscount_edit->Postedby->caption(), $abscount_edit->Postedby->RequiredErrorMessage)) ?>");
			<?php } ?>
			<?php if ($abscount_edit->Updated_Date->Required) { ?>
				elm = this.getElements("x" + infix + "_Updated_Date");
				if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
					return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $abscount_edit->Updated_Date->caption(), $abscount_edit->Updated_Date->RequiredErrorMessage)) ?>");
			<?php } ?>

				// Call Form_CustomValidate event
				if (!this.Form_CustomValidate(fobj))
					return false;
		}

		// Process detail forms
		var dfs = $fobj.find("input[name='detailpage']").get();
		for (var i = 0; i < dfs.length; i++) {
			var df = dfs[i], val = df.value;
			if (val && ew.forms[val])
				if (!ew.forms[val].validate())
					return false;
		}
		return true;
	}

	// Form_CustomValidate
	fabscountedit.Form_CustomValidate = function(fobj) { // DO NOT CHANGE THIS LINE!

		// Your custom validation code here, return false if invalid.
		return true;
	}

	// Use JavaScript validation or not
	fabscountedit.validateRequired = <?php echo Config("CLIENT_VALIDATE") ? "true" : "false" ?>;

	// Dynamic selection lists
	fabscountedit.lists["x_Hostel"] = <?php echo $abscount_edit->Hostel->Lookup->toClientList($abscount_edit) ?>;
	fabscountedit.lists["x_Hostel"].options = <?php echo JsonEncode($abscount_edit->Hostel->lookupOptions()) ?>;
	fabscountedit.lists["x_Floor"] = <?php echo $abscount_edit->Floor->Lookup->toClientList($abscount_edit) ?>;
	fabscountedit.lists["x_Floor"].options = <?php echo JsonEncode($abscount_edit->Floor->lookupOptions()) ?>;
	fabscountedit.lists["x__RS"] = <?php echo $abscount_edit->_RS->Lookup->toClientList($abscount_edit) ?>;
	fabscountedit.lists["x__RS"].options = <?php echo JsonEncode($abscount_edit->_RS->lookupOptions()) ?>;
	loadjs.done("fabscountedit");
});
</script>
<script>
loadjs.ready("head", function() {

	// Client script
	// Write your client script here, no need to add script tags.

});
</script>
<?php $abscount_edit->showPageHeader(); ?>
<?php
$abscount_edit->showMessage();
?>
<form name="fabscountedit" id="fabscountedit" class="<?php echo $abscount_edit->FormClassName ?>" action="<?php echo CurrentPageName() ?>" method="post">
<?php if ($Page->CheckToken) { ?>
<input type="hidden" name="<?php echo Config("TOKEN_NAME") ?>" value="<?php echo $Page->Token ?>">
<?php } ?>
<input type="hidden" name="t" value="abscount">
<input type="hidden" name="action" id="action" value="update">
<input type="hidden" name="modal" value="<?php echo (int)$abscount_edit->IsModal ?>">
<div class="ew-edit-div"><!-- page* -->
<?php if ($abscount_edit->id->Visible) { // id ?>
	<div id="r_id" class="form-group row">
		<label id="elh_abscount_id" class="<?php echo $abscount_edit->LeftColumnClass ?>"><?php echo $abscount_edit->id->caption() ?><?php echo $abscount_edit->id->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $abscount_edit->RightColumnClass ?>"><div <?php echo $abscount_edit->id->cellAttributes() ?>>
<span id="el_abscount_id">
<span<?php echo $abscount_edit->id->viewAttributes() ?>><input type="text" readonly class="form-control-plaintext" value="<?php echo HtmlEncode(RemoveHtml($abscount_edit->id->EditValue)) ?>"></span>
</span>
<input type="hidden" data-table="abscount" data-field="x_id" name="x_id" id="x_id" value="<?php echo HtmlEncode($abscount_edit->id->CurrentValue) ?>">
<?php echo $abscount_edit->id->CustomMsg ?></div></div>
	</div>
<?php } ?>
<?php if ($abscount_edit->Date->Visible) { // Date ?>
	<div id="r_Date" class="form-group row">
		<label id="elh_abscount_Date" for="x_Date" class="<?php echo $abscount_edit->LeftColumnClass ?>"><?php echo $abscount_edit->Date->caption() ?><?php echo $abscount_edit->Date->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $abscount_edit->RightColumnClass ?>"><div <?php echo $abscount_edit->Date->cellAttributes() ?>>
<span id="el_abscount_Date">
<input type="text" data-table="abscount" data-field="x_Date" name="x_Date" id="x_Date" placeholder="<?php echo HtmlEncode($abscount_edit->Date->getPlaceHolder()) ?>" value="<?php echo $abscount_edit->Date->EditValue ?>"<?php echo $abscount_edit->Date->editAttributes() ?>>
<?php if (!$abscount_edit->Date->ReadOnly && !$abscount_edit->Date->Disabled && !isset($abscount_edit->Date->EditAttrs["readonly"]) && !isset($abscount_edit->Date->EditAttrs["disabled"])) { ?>
<script>
loadjs.ready(["fabscountedit", "datetimepicker"], function() {
	ew.createDateTimePicker("fabscountedit", "x_Date", {"ignoreReadonly":true,"useCurrent":false,"format":0});
});
</script>
<?php } ?>
</span>
<?php echo $abscount_edit->Date->CustomMsg ?></div></div>
	</div>
<?php } ?>
<?php if ($abscount_edit->Hostel->Visible) { // Hostel ?>
	<div id="r_Hostel" class="form-group row">
		<label id="elh_abscount_Hostel" for="x_Hostel" class="<?php echo $abscount_edit->LeftColumnClass ?>"><?php echo $abscount_edit->Hostel->caption() ?><?php echo $abscount_edit->Hostel->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $abscount_edit->RightColumnClass ?>"><div <?php echo $abscount_edit->Hostel->cellAttributes() ?>>
<span id="el_abscount_Hostel">
<?php $abscount_edit->Hostel->EditAttrs->prepend("onchange", "ew.updateOptions.call(this);"); ?>
<div class="input-group">
	<select class="custom-select ew-custom-select" data-table="abscount" data-field="x_Hostel" data-value-separator="<?php echo $abscount_edit->Hostel->displayValueSeparatorAttribute() ?>" id="x_Hostel" name="x_Hostel"<?php echo $abscount_edit->Hostel->editAttributes() ?>>
			<?php echo $abscount_edit->Hostel->selectOptionListHtml("x_Hostel") ?>
		</select>
</div>
<?php echo $abscount_edit->Hostel->Lookup->getParamTag($abscount_edit, "p_x_Hostel") ?>
</span>
<?php echo $abscount_edit->Hostel->CustomMsg ?></div></div>
	</div>
<?php } ?>
<?php if ($abscount_edit->Floor->Visible) { // Floor ?>
	<div id="r_Floor" class="form-group row">
		<label id="elh_abscount_Floor" for="x_Floor" class="<?php echo $abscount_edit->LeftColumnClass ?>"><?php echo $abscount_edit->Floor->caption() ?><?php echo $abscount_edit->Floor->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $abscount_edit->RightColumnClass ?>"><div <?php echo $abscount_edit->Floor->cellAttributes() ?>>
<span id="el_abscount_Floor">
<?php $abscount_edit->Floor->EditAttrs->prepend("onchange", "ew.updateOptions.call(this);"); ?>
<div class="input-group">
	<select class="custom-select ew-custom-select" data-table="abscount" data-field="x_Floor" data-value-separator="<?php echo $abscount_edit->Floor->displayValueSeparatorAttribute() ?>" id="x_Floor" name="x_Floor"<?php echo $abscount_edit->Floor->editAttributes() ?>>
			<?php echo $abscount_edit->Floor->selectOptionListHtml("x_Floor") ?>
		</select>
</div>
<?php echo $abscount_edit->Floor->Lookup->getParamTag($abscount_edit, "p_x_Floor") ?>
</span>
<?php echo $abscount_edit->Floor->CustomMsg ?></div></div>
	</div>
<?php } ?>
<?php if ($abscount_edit->_RS->Visible) { // RS ?>
	<div id="r__RS" class="form-group row">
		<label id="elh_abscount__RS" for="x__RS" class="<?php echo $abscount_edit->LeftColumnClass ?>"><?php echo $abscount_edit->_RS->caption() ?><?php echo $abscount_edit->_RS->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $abscount_edit->RightColumnClass ?>"><div <?php echo $abscount_edit->_RS->cellAttributes() ?>>
<span id="el_abscount__RS">
<div class="input-group">
	<select class="custom-select ew-custom-select" data-table="abscount" data-field="x__RS" data-value-separator="<?php echo $abscount_edit->_RS->displayValueSeparatorAttribute() ?>" id="x__RS" name="x__RS"<?php echo $abscount_edit->_RS->editAttributes() ?>>
			<?php echo $abscount_edit->_RS->selectOptionListHtml("x__RS") ?>
		</select>
</div>
<?php echo $abscount_edit->_RS->Lookup->getParamTag($abscount_edit, "p_x__RS") ?>
</span>
<?php echo $abscount_edit->_RS->CustomMsg ?></div></div>
	</div>
<?php } ?>
<?php if ($abscount_edit->Absent->Visible) { // Absent ?>
	<div id="r_Absent" class="form-group row">
		<label id="elh_abscount_Absent" for="x_Absent" class="<?php echo $abscount_edit->LeftColumnClass ?>"><?php echo $abscount_edit->Absent->caption() ?><?php echo $abscount_edit->Absent->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $abscount_edit->RightColumnClass ?>"><div <?php echo $abscount_edit->Absent->cellAttributes() ?>>
<span id="el_abscount_Absent">
<input type="text" data-table="abscount" data-field="x_Absent" name="x_Absent" id="x_Absent" size="30" placeholder="<?php echo HtmlEncode($abscount_edit->Absent->getPlaceHolder()) ?>" value="<?php echo $abscount_edit->Absent->EditValue ?>"<?php echo $abscount_edit->Absent->editAttributes() ?>>
</span>
<?php echo $abscount_edit->Absent->CustomMsg ?></div></div>
	</div>
<?php } ?>
</div><!-- /page* -->
<?php if (!$abscount_edit->IsModal) { ?>
<div class="form-group row"><!-- buttons .form-group -->
	<div class="<?php echo $abscount_edit->OffsetColumnClass ?>"><!-- buttons offset -->
<button class="btn btn-primary ew-btn" name="btn-action" id="btn-action" type="submit"><?php echo $Language->phrase("SaveBtn") ?></button>
<button class="btn btn-default ew-btn" name="btn-cancel" id="btn-cancel" type="button" data-href="<?php echo $abscount_edit->getReturnUrl() ?>"><?php echo $Language->phrase("CancelBtn") ?></button>
	</div><!-- /buttons offset -->
</div><!-- /buttons .form-group -->
<?php } ?>
</form>
<?php
$abscount_edit->showPageFooter();
if (Config("DEBUG"))
	echo GetDebugMessage();
?>
<script>
loadjs.ready("load", function() {

	// Startup script
	// Write your table-specific startup script here
	// console.log("page loaded");

});
</script>
<?php include_once "footer.php"; ?>
<?php
$abscount_edit->terminate();
?>