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

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

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

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

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

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

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

	// Dynamic selection lists
	// Filters

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

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

});
</script>
<?php } ?>
<?php if (!$furnitures_list->isExport()) { ?>
<div class="btn-toolbar ew-toolbar">
<?php if ($furnitures_list->TotalRecords > 0 && $furnitures_list->ExportOptions->visible()) { ?>
<?php $furnitures_list->ExportOptions->render("body") ?>
<?php } ?>
<?php if ($furnitures_list->ImportOptions->visible()) { ?>
<?php $furnitures_list->ImportOptions->render("body") ?>
<?php } ?>
<?php if ($furnitures_list->SearchOptions->visible()) { ?>
<?php $furnitures_list->SearchOptions->render("body") ?>
<?php } ?>
<?php if ($furnitures_list->FilterOptions->visible()) { ?>
<?php $furnitures_list->FilterOptions->render("body") ?>
<?php } ?>
<div class="clearfix"></div>
</div>
<?php } ?>
<?php
$furnitures_list->renderOtherOptions();
?>
<?php if ($Security->CanSearch()) { ?>
<?php if (!$furnitures_list->isExport() && !$furnitures->CurrentAction) { ?>
<form name="ffurnitureslistsrch" id="ffurnitureslistsrch" class="form-inline ew-form ew-ext-search-form" action="<?php echo CurrentPageName() ?>">
<div id="ffurnitureslistsrch-search-panel" class="<?php echo $furnitures_list->SearchPanelClass ?>">
<input type="hidden" name="cmd" value="search">
<input type="hidden" name="t" value="furnitures">
	<div class="ew-extended-search">
<div id="xsr_<?php echo $furnitures_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($furnitures_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($furnitures_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 $furnitures_list->BasicSearch->getTypeNameShort() ?></span></button>
			<div class="dropdown-menu dropdown-menu-right">
				<a class="dropdown-item<?php if ($furnitures_list->BasicSearch->getType() == "") { ?> active<?php } ?>" href="#" onclick="return ew.setSearchType(this);"><?php echo $Language->phrase("QuickSearchAuto") ?></a>
				<a class="dropdown-item<?php if ($furnitures_list->BasicSearch->getType() == "=") { ?> active<?php } ?>" href="#" onclick="return ew.setSearchType(this, '=');"><?php echo $Language->phrase("QuickSearchExact") ?></a>
				<a class="dropdown-item<?php if ($furnitures_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 ($furnitures_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 $furnitures_list->showPageHeader(); ?>
<?php
$furnitures_list->showMessage();
?>
<?php if ($furnitures_list->TotalRecords > 0 || $furnitures->CurrentAction) { ?>
<div class="card ew-card ew-grid<?php if ($furnitures_list->isAddOrEdit()) { ?> ew-grid-add-edit<?php } ?> furnitures">
<?php if (!$furnitures_list->isExport()) { ?>
<div class="card-header ew-grid-upper-panel">
<?php if (!$furnitures_list->isGridAdd()) { ?>
<form name="ew-pager-form" class="form-inline ew-form ew-pager-form" action="<?php echo CurrentPageName() ?>">
<?php echo $furnitures_list->Pager->render() ?>
</form>
<?php } ?>
<div class="ew-list-other-options">
<?php $furnitures_list->OtherOptions->render("body") ?>
</div>
<div class="clearfix"></div>
</div>
<?php } ?>
<form name="ffurnitureslist" id="ffurnitureslist" 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="furnitures">
<div id="gmp_furnitures" class="<?php echo ResponsiveTableClass() ?>card-body ew-grid-middle-panel">
<?php if ($furnitures_list->TotalRecords > 0 || $furnitures_list->isGridEdit()) { ?>
<table id="tbl_furnitureslist" class="table ew-table"><!-- .ew-table -->
<thead>
	<tr class="ew-table-header">
<?php

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

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

// Render list options (header, left)
$furnitures_list->ListOptions->render("header", "left");
?>
<?php if ($furnitures_list->id->Visible) { // id ?>
	<?php if ($furnitures_list->SortUrl($furnitures_list->id) == "") { ?>
		<th data-name="id" class="<?php echo $furnitures_list->id->headerCellClass() ?>"><div id="elh_furnitures_id" class="furnitures_id"><div class="ew-table-header-caption"><?php echo $furnitures_list->id->caption() ?></div></div></th>
	<?php } else { ?>
		<th data-name="id" class="<?php echo $furnitures_list->id->headerCellClass() ?>"><div class="ew-pointer" onclick="ew.sort(event, '<?php echo $furnitures_list->SortUrl($furnitures_list->id) ?>', 1);"><div id="elh_furnitures_id" class="furnitures_id">
			<div class="ew-table-header-btn"><span class="ew-table-header-caption"><?php echo $furnitures_list->id->caption() ?></span><span class="ew-table-header-sort"><?php if ($furnitures_list->id->getSort() == "ASC") { ?><i class="fas fa-sort-up"></i><?php } elseif ($furnitures_list->id->getSort() == "DESC") { ?><i class="fas fa-sort-down"></i><?php } ?></span></div>
		</div></div></th>
	<?php } ?>
<?php } ?>
<?php if ($furnitures_list->Furniture->Visible) { // Furniture ?>
	<?php if ($furnitures_list->SortUrl($furnitures_list->Furniture) == "") { ?>
		<th data-name="Furniture" class="<?php echo $furnitures_list->Furniture->headerCellClass() ?>"><div id="elh_furnitures_Furniture" class="furnitures_Furniture"><div class="ew-table-header-caption"><?php echo $furnitures_list->Furniture->caption() ?></div></div></th>
	<?php } else { ?>
		<th data-name="Furniture" class="<?php echo $furnitures_list->Furniture->headerCellClass() ?>"><div class="ew-pointer" onclick="ew.sort(event, '<?php echo $furnitures_list->SortUrl($furnitures_list->Furniture) ?>', 1);"><div id="elh_furnitures_Furniture" class="furnitures_Furniture">
			<div class="ew-table-header-btn"><span class="ew-table-header-caption"><?php echo $furnitures_list->Furniture->caption() ?><?php echo $Language->phrase("SrchLegend") ?></span><span class="ew-table-header-sort"><?php if ($furnitures_list->Furniture->getSort() == "ASC") { ?><i class="fas fa-sort-up"></i><?php } elseif ($furnitures_list->Furniture->getSort() == "DESC") { ?><i class="fas fa-sort-down"></i><?php } ?></span></div>
		</div></div></th>
	<?php } ?>
<?php } ?>
<?php

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

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

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

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

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

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

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

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

// Render list options (body, left)
$furnitures_list->ListOptions->render("body", "left", $furnitures_list->RowCount);
?>
	<?php if ($furnitures_list->id->Visible) { // id ?>
		<td data-name="id" <?php echo $furnitures_list->id->cellAttributes() ?>>
<span id="el<?php echo $furnitures_list->RowCount ?>_furnitures_id">
<span<?php echo $furnitures_list->id->viewAttributes() ?>><?php echo $furnitures_list->id->getViewValue() ?></span>
</span>
</td>
	<?php } ?>
	<?php if ($furnitures_list->Furniture->Visible) { // Furniture ?>
		<td data-name="Furniture" <?php echo $furnitures_list->Furniture->cellAttributes() ?>>
<span id="el<?php echo $furnitures_list->RowCount ?>_furnitures_Furniture">
<span<?php echo $furnitures_list->Furniture->viewAttributes() ?>><?php echo $furnitures_list->Furniture->getViewValue() ?></span>
</span>
</td>
	<?php } ?>
<?php

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

// Close recordset
if ($furnitures_list->Recordset)
	$furnitures_list->Recordset->Close();
?>
<?php if (!$furnitures_list->isExport()) { ?>
<div class="card-footer ew-grid-lower-panel">
<?php if (!$furnitures_list->isGridAdd()) { ?>
<form name="ew-pager-form" class="form-inline ew-form ew-pager-form" action="<?php echo CurrentPageName() ?>">
<?php echo $furnitures_list->Pager->render() ?>
</form>
<?php } ?>
<div class="ew-list-other-options">
<?php $furnitures_list->OtherOptions->render("body", "bottom") ?>
</div>
<div class="clearfix"></div>
</div>
<?php } ?>
</div><!-- /.ew-grid -->
<?php } ?>
<?php if ($furnitures_list->TotalRecords == 0 && !$furnitures->CurrentAction) { // Show other options ?>
<div class="ew-list-other-options">
<?php $furnitures_list->OtherOptions->render("body") ?>
</div>
<div class="clearfix"></div>
<?php } ?>
<?php
$furnitures_list->showPageFooter();
if (Config("DEBUG"))
	echo GetDebugMessage();
?>
<?php if (!$furnitures_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
$furnitures_list->terminate();
?>