<?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
$health_list = new health_list();

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

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

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

// Page Rendering event
$health_list->Page_Render();
?>
<?php include_once "header.php"; ?>
<?php if (!$health_list->isExport()) { ?>
<script>
var fhealthlist, currentPageID;
loadjs.ready("head", function() {

	// Form object
	currentPageID = ew.PAGE_ID = "list";
	fhealthlist = currentForm = new ew.Form("fhealthlist", "list");
	fhealthlist.formKeyCountName = '<?php echo $health_list->FormKeyCountName ?>';
	loadjs.done("fhealthlist");
});
var fhealthlistsrch;
loadjs.ready("head", function() {

	// Form object for search
	fhealthlistsrch = currentSearchForm = new ew.Form("fhealthlistsrch");

	// Dynamic selection lists
	// Filters

	fhealthlistsrch.filterList = <?php echo $health_list->getFilterList() ?>;
	loadjs.done("fhealthlistsrch");
});
</script>
<script>
loadjs.ready("head", function() {

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

});
</script>
<?php } ?>
<?php if (!$health_list->isExport()) { ?>
<div class="btn-toolbar ew-toolbar">
<?php if ($health_list->TotalRecords > 0 && $health_list->ExportOptions->visible()) { ?>
<?php $health_list->ExportOptions->render("body") ?>
<?php } ?>
<?php if ($health_list->ImportOptions->visible()) { ?>
<?php $health_list->ImportOptions->render("body") ?>
<?php } ?>
<?php if ($health_list->SearchOptions->visible()) { ?>
<?php $health_list->SearchOptions->render("body") ?>
<?php } ?>
<?php if ($health_list->FilterOptions->visible()) { ?>
<?php $health_list->FilterOptions->render("body") ?>
<?php } ?>
<div class="clearfix"></div>
</div>
<?php } ?>
<?php
$health_list->renderOtherOptions();
?>
<?php if ($Security->CanSearch()) { ?>
<?php if (!$health_list->isExport() && !$health->CurrentAction) { ?>
<form name="fhealthlistsrch" id="fhealthlistsrch" class="form-inline ew-form ew-ext-search-form" action="<?php echo CurrentPageName() ?>">
<div id="fhealthlistsrch-search-panel" class="<?php echo $health_list->SearchPanelClass ?>">
<input type="hidden" name="cmd" value="search">
<input type="hidden" name="t" value="health">
	<div class="ew-extended-search">
<div id="xsr_<?php echo $health_list->SearchRowCount + 1 ?>" class="ew-row d-sm-flex">
	<div class="ew-quick-search input-group">
		<input type="text" name="<?php echo Config("TABLE_BASIC_SEARCH") ?>" id="<?php echo Config("TABLE_BASIC_SEARCH") ?>" class="form-control" value="<?php echo HtmlEncode($health_list->BasicSearch->getKeyword()) ?>" placeholder="<?php echo HtmlEncode($Language->phrase("Search")) ?>">
		<input type="hidden" name="<?php echo Config("TABLE_BASIC_SEARCH_TYPE") ?>" id="<?php echo Config("TABLE_BASIC_SEARCH_TYPE") ?>" value="<?php echo HtmlEncode($health_list->BasicSearch->getType()) ?>">
		<div class="input-group-append">
			<button class="btn btn-primary" name="btn-submit" id="btn-submit" type="submit"><?php echo $Language->phrase("SearchBtn") ?></button>
			<button type="button" data-toggle="dropdown" class="btn btn-primary dropdown-toggle dropdown-toggle-split" aria-haspopup="true" aria-expanded="false"><span id="searchtype"><?php echo $health_list->BasicSearch->getTypeNameShort() ?></span></button>
			<div class="dropdown-menu dropdown-menu-right">
				<a class="dropdown-item<?php if ($health_list->BasicSearch->getType() == "") { ?> active<?php } ?>" href="#" onclick="return ew.setSearchType(this);"><?php echo $Language->phrase("QuickSearchAuto") ?></a>
				<a class="dropdown-item<?php if ($health_list->BasicSearch->getType() == "=") { ?> active<?php } ?>" href="#" onclick="return ew.setSearchType(this, '=');"><?php echo $Language->phrase("QuickSearchExact") ?></a>
				<a class="dropdown-item<?php if ($health_list->BasicSearch->getType() == "AND") { ?> active<?php } ?>" href="#" onclick="return ew.setSearchType(this, 'AND');"><?php echo $Language->phrase("QuickSearchAll") ?></a>
				<a class="dropdown-item<?php if ($health_list->BasicSearch->getType() == "OR") { ?> active<?php } ?>" href="#" onclick="return ew.setSearchType(this, 'OR');"><?php echo $Language->phrase("QuickSearchAny") ?></a>
			</div>
		</div>
	</div>
</div>
	</div><!-- /.ew-extended-search -->
</div><!-- /.ew-search-panel -->
</form>
<?php } ?>
<?php } ?>
<?php $health_list->showPageHeader(); ?>
<?php
$health_list->showMessage();
?>
<?php if ($health_list->TotalRecords > 0 || $health->CurrentAction) { ?>
<div class="card ew-card ew-grid<?php if ($health_list->isAddOrEdit()) { ?> ew-grid-add-edit<?php } ?> health">
<?php if (!$health_list->isExport()) { ?>
<div class="card-header ew-grid-upper-panel">
<?php if (!$health_list->isGridAdd()) { ?>
<form name="ew-pager-form" class="form-inline ew-form ew-pager-form" action="<?php echo CurrentPageName() ?>">
<?php echo $health_list->Pager->render() ?>
</form>
<?php } ?>
<div class="ew-list-other-options">
<?php $health_list->OtherOptions->render("body") ?>
</div>
<div class="clearfix"></div>
</div>
<?php } ?>
<form name="fhealthlist" id="fhealthlist" class="form-inline ew-form ew-list-form" 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="health">
<div id="gmp_health" class="<?php echo ResponsiveTableClass() ?>card-body ew-grid-middle-panel">
<?php if ($health_list->TotalRecords > 0 || $health_list->isGridEdit()) { ?>
<table id="tbl_healthlist" class="table ew-table"><!-- .ew-table -->
<thead>
	<tr class="ew-table-header">
<?php

// Header row
$health->RowType = ROWTYPE_HEADER;

// Render list options
$health_list->renderListOptions();

// Render list options (header, left)
$health_list->ListOptions->render("header", "left");
?>
<?php if ($health_list->id->Visible) { // id ?>
	<?php if ($health_list->SortUrl($health_list->id) == "") { ?>
		<th data-name="id" class="<?php echo $health_list->id->headerCellClass() ?>"><div id="elh_health_id" class="health_id"><div class="ew-table-header-caption"><?php echo $health_list->id->caption() ?></div></div></th>
	<?php } else { ?>
		<th data-name="id" class="<?php echo $health_list->id->headerCellClass() ?>"><div class="ew-pointer" onclick="ew.sort(event, '<?php echo $health_list->SortUrl($health_list->id) ?>', 1);"><div id="elh_health_id" class="health_id">
			<div class="ew-table-header-btn"><span class="ew-table-header-caption"><?php echo $health_list->id->caption() ?></span><span class="ew-table-header-sort"><?php if ($health_list->id->getSort() == "ASC") { ?><i class="fas fa-sort-up"></i><?php } elseif ($health_list->id->getSort() == "DESC") { ?><i class="fas fa-sort-down"></i><?php } ?></span></div>
		</div></div></th>
	<?php } ?>
<?php } ?>
<?php if ($health_list->Health_Issue->Visible) { // Health_Issue ?>
	<?php if ($health_list->SortUrl($health_list->Health_Issue) == "") { ?>
		<th data-name="Health_Issue" class="<?php echo $health_list->Health_Issue->headerCellClass() ?>"><div id="elh_health_Health_Issue" class="health_Health_Issue"><div class="ew-table-header-caption"><?php echo $health_list->Health_Issue->caption() ?></div></div></th>
	<?php } else { ?>
		<th data-name="Health_Issue" class="<?php echo $health_list->Health_Issue->headerCellClass() ?>"><div class="ew-pointer" onclick="ew.sort(event, '<?php echo $health_list->SortUrl($health_list->Health_Issue) ?>', 1);"><div id="elh_health_Health_Issue" class="health_Health_Issue">
			<div class="ew-table-header-btn"><span class="ew-table-header-caption"><?php echo $health_list->Health_Issue->caption() ?><?php echo $Language->phrase("SrchLegend") ?></span><span class="ew-table-header-sort"><?php if ($health_list->Health_Issue->getSort() == "ASC") { ?><i class="fas fa-sort-up"></i><?php } elseif ($health_list->Health_Issue->getSort() == "DESC") { ?><i class="fas fa-sort-down"></i><?php } ?></span></div>
		</div></div></th>
	<?php } ?>
<?php } ?>
<?php if ($health_list->Status->Visible) { // Status ?>
	<?php if ($health_list->SortUrl($health_list->Status) == "") { ?>
		<th data-name="Status" class="<?php echo $health_list->Status->headerCellClass() ?>"><div id="elh_health_Status" class="health_Status"><div class="ew-table-header-caption"><?php echo $health_list->Status->caption() ?></div></div></th>
	<?php } else { ?>
		<th data-name="Status" class="<?php echo $health_list->Status->headerCellClass() ?>"><div class="ew-pointer" onclick="ew.sort(event, '<?php echo $health_list->SortUrl($health_list->Status) ?>', 1);"><div id="elh_health_Status" class="health_Status">
			<div class="ew-table-header-btn"><span class="ew-table-header-caption"><?php echo $health_list->Status->caption() ?></span><span class="ew-table-header-sort"><?php if ($health_list->Status->getSort() == "ASC") { ?><i class="fas fa-sort-up"></i><?php } elseif ($health_list->Status->getSort() == "DESC") { ?><i class="fas fa-sort-down"></i><?php } ?></span></div>
		</div></div></th>
	<?php } ?>
<?php } ?>
<?php

// Render list options (header, right)
$health_list->ListOptions->render("header", "right");
?>
	</tr>
</thead>
<tbody>
<?php
if ($health_list->ExportAll && $health_list->isExport()) {
	$health_list->StopRecord = $health_list->TotalRecords;
} else {

	// Set the last record to display
	if ($health_list->TotalRecords > $health_list->StartRecord + $health_list->DisplayRecords - 1)
		$health_list->StopRecord = $health_list->StartRecord + $health_list->DisplayRecords - 1;
	else
		$health_list->StopRecord = $health_list->TotalRecords;
}
$health_list->RecordCount = $health_list->StartRecord - 1;
if ($health_list->Recordset && !$health_list->Recordset->EOF) {
	$health_list->Recordset->moveFirst();
	$selectLimit = $health_list->UseSelectLimit;
	if (!$selectLimit && $health_list->StartRecord > 1)
		$health_list->Recordset->move($health_list->StartRecord - 1);
} elseif (!$health->AllowAddDeleteRow && $health_list->StopRecord == 0) {
	$health_list->StopRecord = $health->GridAddRowCount;
}

// Initialize aggregate
$health->RowType = ROWTYPE_AGGREGATEINIT;
$health->resetAttributes();
$health_list->renderRow();
while ($health_list->RecordCount < $health_list->StopRecord) {
	$health_list->RecordCount++;
	if ($health_list->RecordCount >= $health_list->StartRecord) {
		$health_list->RowCount++;

		// Set up key count
		$health_list->KeyCount = $health_list->RowIndex;

		// Init row class and style
		$health->resetAttributes();
		$health->CssClass = "";
		if ($health_list->isGridAdd()) {
		} else {
			$health_list->loadRowValues($health_list->Recordset); // Load row values
		}
		$health->RowType = ROWTYPE_VIEW; // Render view

		// Set up row id / data-rowindex
		$health->RowAttrs->merge(["data-rowindex" => $health_list->RowCount, "id" => "r" . $health_list->RowCount . "_health", "data-rowtype" => $health->RowType]);

		// Render row
		$health_list->renderRow();

		// Render list options
		$health_list->renderListOptions();
?>
	<tr <?php echo $health->rowAttributes() ?>>
<?php

// Render list options (body, left)
$health_list->ListOptions->render("body", "left", $health_list->RowCount);
?>
	<?php if ($health_list->id->Visible) { // id ?>
		<td data-name="id" <?php echo $health_list->id->cellAttributes() ?>>
<span id="el<?php echo $health_list->RowCount ?>_health_id">
<span<?php echo $health_list->id->viewAttributes() ?>><?php echo $health_list->id->getViewValue() ?></span>
</span>
</td>
	<?php } ?>
	<?php if ($health_list->Health_Issue->Visible) { // Health_Issue ?>
		<td data-name="Health_Issue" <?php echo $health_list->Health_Issue->cellAttributes() ?>>
<span id="el<?php echo $health_list->RowCount ?>_health_Health_Issue">
<span<?php echo $health_list->Health_Issue->viewAttributes() ?>><?php echo $health_list->Health_Issue->getViewValue() ?></span>
</span>
</td>
	<?php } ?>
	<?php if ($health_list->Status->Visible) { // Status ?>
		<td data-name="Status" <?php echo $health_list->Status->cellAttributes() ?>>
<span id="el<?php echo $health_list->RowCount ?>_health_Status">
<span<?php echo $health_list->Status->viewAttributes() ?>><div class="custom-control custom-checkbox d-inline-block"><input type="checkbox" id="x_Status" class="custom-control-input" value="<?php echo $health_list->Status->getViewValue() ?>" disabled<?php if (ConvertToBool($health_list->Status->CurrentValue)) { ?> checked<?php } ?>><label class="custom-control-label" for="x_Status"></label></div></span>
</span>
</td>
	<?php } ?>
<?php

// Render list options (body, right)
$health_list->ListOptions->render("body", "right", $health_list->RowCount);
?>
	</tr>
<?php
	}
	if (!$health_list->isGridAdd())
		$health_list->Recordset->moveNext();
}
?>
</tbody>
</table><!-- /.ew-table -->
<?php } ?>
</div><!-- /.ew-grid-middle-panel -->
<?php if (!$health->CurrentAction) { ?>
<input type="hidden" name="action" id="action" value="">
<?php } ?>
</form><!-- /.ew-list-form -->
<?php

// Close recordset
if ($health_list->Recordset)
	$health_list->Recordset->Close();
?>
<?php if (!$health_list->isExport()) { ?>
<div class="card-footer ew-grid-lower-panel">
<?php if (!$health_list->isGridAdd()) { ?>
<form name="ew-pager-form" class="form-inline ew-form ew-pager-form" action="<?php echo CurrentPageName() ?>">
<?php echo $health_list->Pager->render() ?>
</form>
<?php } ?>
<div class="ew-list-other-options">
<?php $health_list->OtherOptions->render("body", "bottom") ?>
</div>
<div class="clearfix"></div>
</div>
<?php } ?>
</div><!-- /.ew-grid -->
<?php } ?>
<?php if ($health_list->TotalRecords == 0 && !$health->CurrentAction) { // Show other options ?>
<div class="ew-list-other-options">
<?php $health_list->OtherOptions->render("body") ?>
</div>
<div class="clearfix"></div>
<?php } ?>
<?php
$health_list->showPageFooter();
if (Config("DEBUG"))
	echo GetDebugMessage();
?>
<?php if (!$health_list->isExport()) { ?>
<script>
loadjs.ready("load", function() {

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

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