<?php
namespace PHPMaker2019\project_germanos;

// Write header
WriteHeader(FALSE);

// Create page object
if (!isset($complaints_grid))
	$complaints_grid = new complaints_grid();

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

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

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

// Page Rendering event
$complaints_grid->Page_Render();
?>
<?php if (!$complaints->isExport()) { ?>
<script>

// Form object
var fcomplaintsgrid = new ew.Form("fcomplaintsgrid", "grid");
fcomplaintsgrid.formKeyCountName = '<?php echo $complaints_grid->FormKeyCountName ?>';

// Validate form
fcomplaintsgrid.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);
		var checkrow = (gridinsert) ? !this.emptyRow(infix) : true;
		if (checkrow) {
			addcnt++;
		<?php if ($complaints_grid->CaseNumber->Required) { ?>
			elm = this.getElements("x" + infix + "_CaseNumber");
			if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
				return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $complaints->CaseNumber->caption(), $complaints->CaseNumber->RequiredErrorMessage)) ?>");
		<?php } ?>
		<?php if ($complaints_grid->ComplaintDate->Required) { ?>
			elm = this.getElements("x" + infix + "_ComplaintDate");
			if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
				return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $complaints->ComplaintDate->caption(), $complaints->ComplaintDate->RequiredErrorMessage)) ?>");
		<?php } ?>
			elm = this.getElements("x" + infix + "_ComplaintDate");
			if (elm && !ew.checkEuroDate(elm.value))
				return this.onError(elm, "<?php echo JsEncode($complaints->ComplaintDate->errorMessage()) ?>");
		<?php if ($complaints_grid->Complaint->Required) { ?>
			elm = this.getElements("x" + infix + "_Complaint");
			if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
				return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $complaints->Complaint->caption(), $complaints->Complaint->RequiredErrorMessage)) ?>");
		<?php } ?>

			// Fire Form_CustomValidate event
			if (!this.Form_CustomValidate(fobj))
				return false;
		} // End Grid Add checking
	}
	return true;
}

// Check empty row
fcomplaintsgrid.emptyRow = function(infix) {
	var fobj = this._form;
	if (ew.valueChanged(fobj, infix, "CaseNumber", false)) return false;
	if (ew.valueChanged(fobj, infix, "ComplaintDate", false)) return false;
	if (ew.valueChanged(fobj, infix, "Complaint", false)) return false;
	return true;
}

// Form_CustomValidate event
fcomplaintsgrid.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
fcomplaintsgrid.validateRequired = <?php echo json_encode(CLIENT_VALIDATE) ?>;

// Dynamic selection lists
// Form object for search

</script>
<script src="phpjs/ewscrolltable.js"></script>
<?php } ?>
<?php
$complaints_grid->renderOtherOptions();
?>
<?php $complaints_grid->showPageHeader(); ?>
<?php
$complaints_grid->showMessage();
?>
<?php if ($complaints_grid->TotalRecs > 0 || $complaints->CurrentAction) { ?>
<div class="card ew-card ew-grid<?php if ($complaints_grid->isAddOrEdit()) { ?> ew-grid-add-edit<?php } ?> complaints">
<?php if ($complaints_grid->ShowOtherOptions) { ?>
<div class="card-header ew-grid-upper-panel">
<?php $complaints_grid->OtherOptions->render("body") ?>
</div>
<div class="clearfix"></div>
<?php } ?>
<div id="fcomplaintsgrid" class="ew-form ew-list-form form-inline">
<div id="gmp_complaints" class="<?php if (IsResponsiveLayout()) { ?>table-responsive <?php } ?>card-body ew-grid-middle-panel">
<table id="tbl_complaintsgrid" class="table ew-table"><!-- .ew-table ##-->
<thead>
	<tr class="ew-table-header">
<?php

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

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

// Render list options (header, left)
$complaints_grid->ListOptions->render("header", "left");
?>
<?php if ($complaints->CaseNumber->Visible) { // CaseNumber ?>
	<?php if ($complaints->sortUrl($complaints->CaseNumber) == "") { ?>
		<th data-name="CaseNumber" class="<?php echo $complaints->CaseNumber->headerCellClass() ?>" style="white-space: nowrap;"><div id="elh_complaints_CaseNumber" class="complaints_CaseNumber"><div class="ew-table-header-caption"><?php echo $complaints->CaseNumber->caption() ?></div></div></th>
	<?php } else { ?>
		<th data-name="CaseNumber" class="<?php echo $complaints->CaseNumber->headerCellClass() ?>" style="white-space: nowrap;"><div><div id="elh_complaints_CaseNumber" class="complaints_CaseNumber">
			<div class="ew-table-header-btn"><span class="ew-table-header-caption"><?php echo $complaints->CaseNumber->caption() ?></span><span class="ew-table-header-sort"><?php if ($complaints->CaseNumber->getSort() == "ASC") { ?><i class="fa fa-sort-up"></i><?php } elseif ($complaints->CaseNumber->getSort() == "DESC") { ?><i class="fa fa-sort-down"></i><?php } ?></span></div>
		</div></div></th>
	<?php } ?>
<?php } ?>
<?php if ($complaints->ComplaintDate->Visible) { // ComplaintDate ?>
	<?php if ($complaints->sortUrl($complaints->ComplaintDate) == "") { ?>
		<th data-name="ComplaintDate" class="<?php echo $complaints->ComplaintDate->headerCellClass() ?>"><div id="elh_complaints_ComplaintDate" class="complaints_ComplaintDate"><div class="ew-table-header-caption"><?php echo $complaints->ComplaintDate->caption() ?></div></div></th>
	<?php } else { ?>
		<th data-name="ComplaintDate" class="<?php echo $complaints->ComplaintDate->headerCellClass() ?>"><div><div id="elh_complaints_ComplaintDate" class="complaints_ComplaintDate">
			<div class="ew-table-header-btn"><span class="ew-table-header-caption"><?php echo $complaints->ComplaintDate->caption() ?></span><span class="ew-table-header-sort"><?php if ($complaints->ComplaintDate->getSort() == "ASC") { ?><i class="fa fa-sort-up"></i><?php } elseif ($complaints->ComplaintDate->getSort() == "DESC") { ?><i class="fa fa-sort-down"></i><?php } ?></span></div>
		</div></div></th>
	<?php } ?>
<?php } ?>
<?php if ($complaints->Complaint->Visible) { // Complaint ?>
	<?php if ($complaints->sortUrl($complaints->Complaint) == "") { ?>
		<th data-name="Complaint" class="<?php echo $complaints->Complaint->headerCellClass() ?>"><div id="elh_complaints_Complaint" class="complaints_Complaint"><div class="ew-table-header-caption"><?php echo $complaints->Complaint->caption() ?></div></div></th>
	<?php } else { ?>
		<th data-name="Complaint" class="<?php echo $complaints->Complaint->headerCellClass() ?>"><div><div id="elh_complaints_Complaint" class="complaints_Complaint">
			<div class="ew-table-header-btn"><span class="ew-table-header-caption"><?php echo $complaints->Complaint->caption() ?></span><span class="ew-table-header-sort"><?php if ($complaints->Complaint->getSort() == "ASC") { ?><i class="fa fa-sort-up"></i><?php } elseif ($complaints->Complaint->getSort() == "DESC") { ?><i class="fa fa-sort-down"></i><?php } ?></span></div>
		</div></div></th>
	<?php } ?>
<?php } ?>
<?php

// Render list options (header, right)
$complaints_grid->ListOptions->render("header", "right");
?>
	</tr>
</thead>
<tbody>
<?php
$complaints_grid->StartRec = 1;
$complaints_grid->StopRec = $complaints_grid->TotalRecs; // Show all records

// Restore number of post back records
if ($CurrentForm && $complaints_grid->EventCancelled) {
	$CurrentForm->Index = -1;
	if ($CurrentForm->hasValue($complaints_grid->FormKeyCountName) && ($complaints->isGridAdd() || $complaints->isGridEdit() || $complaints->isConfirm())) {
		$complaints_grid->KeyCount = $CurrentForm->getValue($complaints_grid->FormKeyCountName);
		$complaints_grid->StopRec = $complaints_grid->StartRec + $complaints_grid->KeyCount - 1;
	}
}
$complaints_grid->RecCnt = $complaints_grid->StartRec - 1;
if ($complaints_grid->Recordset && !$complaints_grid->Recordset->EOF) {
	$complaints_grid->Recordset->moveFirst();
	$selectLimit = $complaints_grid->UseSelectLimit;
	if (!$selectLimit && $complaints_grid->StartRec > 1)
		$complaints_grid->Recordset->move($complaints_grid->StartRec - 1);
} elseif (!$complaints->AllowAddDeleteRow && $complaints_grid->StopRec == 0) {
	$complaints_grid->StopRec = $complaints->GridAddRowCount;
}

// Initialize aggregate
$complaints->RowType = ROWTYPE_AGGREGATEINIT;
$complaints->resetAttributes();
$complaints_grid->renderRow();
if ($complaints->isGridAdd())
	$complaints_grid->RowIndex = 0;
if ($complaints->isGridEdit())
	$complaints_grid->RowIndex = 0;
while ($complaints_grid->RecCnt < $complaints_grid->StopRec) {
	$complaints_grid->RecCnt++;
	if ($complaints_grid->RecCnt >= $complaints_grid->StartRec) {
		$complaints_grid->RowCnt++;
		if ($complaints->isGridAdd() || $complaints->isGridEdit() || $complaints->isConfirm()) {
			$complaints_grid->RowIndex++;
			$CurrentForm->Index = $complaints_grid->RowIndex;
			if ($CurrentForm->hasValue($complaints_grid->FormActionName) && $complaints_grid->EventCancelled)
				$complaints_grid->RowAction = strval($CurrentForm->getValue($complaints_grid->FormActionName));
			elseif ($complaints->isGridAdd())
				$complaints_grid->RowAction = "insert";
			else
				$complaints_grid->RowAction = "";
		}

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

		// Init row class and style
		$complaints->resetAttributes();
		$complaints->CssClass = "";
		if ($complaints->isGridAdd()) {
			if ($complaints->CurrentMode == "copy") {
				$complaints_grid->loadRowValues($complaints_grid->Recordset); // Load row values
				$complaints_grid->setRecordKey($complaints_grid->RowOldKey, $complaints_grid->Recordset); // Set old record key
			} else {
				$complaints_grid->loadRowValues(); // Load default values
				$complaints_grid->RowOldKey = ""; // Clear old key value
			}
		} else {
			$complaints_grid->loadRowValues($complaints_grid->Recordset); // Load row values
		}
		$complaints->RowType = ROWTYPE_VIEW; // Render view
		if ($complaints->isGridAdd()) // Grid add
			$complaints->RowType = ROWTYPE_ADD; // Render add
		if ($complaints->isGridAdd() && $complaints->EventCancelled && !$CurrentForm->hasValue("k_blankrow")) // Insert failed
			$complaints_grid->restoreCurrentRowFormValues($complaints_grid->RowIndex); // Restore form values
		if ($complaints->isGridEdit()) { // Grid edit
			if ($complaints->EventCancelled)
				$complaints_grid->restoreCurrentRowFormValues($complaints_grid->RowIndex); // Restore form values
			if ($complaints_grid->RowAction == "insert")
				$complaints->RowType = ROWTYPE_ADD; // Render add
			else
				$complaints->RowType = ROWTYPE_EDIT; // Render edit
		}
		if ($complaints->isGridEdit() && ($complaints->RowType == ROWTYPE_EDIT || $complaints->RowType == ROWTYPE_ADD) && $complaints->EventCancelled) // Update failed
			$complaints_grid->restoreCurrentRowFormValues($complaints_grid->RowIndex); // Restore form values
		if ($complaints->RowType == ROWTYPE_EDIT) // Edit row
			$complaints_grid->EditRowCnt++;
		if ($complaints->isConfirm()) // Confirm row
			$complaints_grid->restoreCurrentRowFormValues($complaints_grid->RowIndex); // Restore form values

		// Set up row id / data-rowindex
		$complaints->RowAttrs = array_merge($complaints->RowAttrs, array('data-rowindex'=>$complaints_grid->RowCnt, 'id'=>'r' . $complaints_grid->RowCnt . '_complaints', 'data-rowtype'=>$complaints->RowType));

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

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

		// Skip delete row / empty row for confirm page
		if ($complaints_grid->RowAction <> "delete" && $complaints_grid->RowAction <> "insertdelete" && !($complaints_grid->RowAction == "insert" && $complaints->isConfirm() && $complaints_grid->emptyRow())) {
?>
	<tr<?php echo $complaints->rowAttributes() ?>>
<?php

// Render list options (body, left)
$complaints_grid->ListOptions->render("body", "left", $complaints_grid->RowCnt);
?>
	<?php if ($complaints->CaseNumber->Visible) { // CaseNumber ?>
		<td data-name="CaseNumber"<?php echo $complaints->CaseNumber->cellAttributes() ?>>
<?php if ($complaints->RowType == ROWTYPE_ADD) { // Add record ?>
<span id="el<?php echo $complaints_grid->RowCnt ?>_complaints_CaseNumber" class="form-group complaints_CaseNumber">
<input type="text" data-table="complaints" data-field="x_CaseNumber" name="x<?php echo $complaints_grid->RowIndex ?>_CaseNumber" id="x<?php echo $complaints_grid->RowIndex ?>_CaseNumber" size="30" maxlength="30" placeholder="<?php echo HtmlEncode($complaints->CaseNumber->getPlaceHolder()) ?>" value="<?php echo $complaints->CaseNumber->EditValue ?>"<?php echo $complaints->CaseNumber->editAttributes() ?>>
</span>
<input type="hidden" data-table="complaints" data-field="x_CaseNumber" name="o<?php echo $complaints_grid->RowIndex ?>_CaseNumber" id="o<?php echo $complaints_grid->RowIndex ?>_CaseNumber" value="<?php echo HtmlEncode($complaints->CaseNumber->OldValue) ?>">
<?php } ?>
<?php if ($complaints->RowType == ROWTYPE_EDIT) { // Edit record ?>
<span id="el<?php echo $complaints_grid->RowCnt ?>_complaints_CaseNumber" class="form-group complaints_CaseNumber">
<input type="text" data-table="complaints" data-field="x_CaseNumber" name="x<?php echo $complaints_grid->RowIndex ?>_CaseNumber" id="x<?php echo $complaints_grid->RowIndex ?>_CaseNumber" size="30" maxlength="30" placeholder="<?php echo HtmlEncode($complaints->CaseNumber->getPlaceHolder()) ?>" value="<?php echo $complaints->CaseNumber->EditValue ?>"<?php echo $complaints->CaseNumber->editAttributes() ?>>
</span>
<?php } ?>
<?php if ($complaints->RowType == ROWTYPE_VIEW) { // View record ?>
<span id="el<?php echo $complaints_grid->RowCnt ?>_complaints_CaseNumber" class="complaints_CaseNumber">
<span<?php echo $complaints->CaseNumber->viewAttributes() ?>>
<?php echo $complaints->CaseNumber->getViewValue() ?></span>
</span>
<?php if (!$complaints->isConfirm()) { ?>
<input type="hidden" data-table="complaints" data-field="x_CaseNumber" name="x<?php echo $complaints_grid->RowIndex ?>_CaseNumber" id="x<?php echo $complaints_grid->RowIndex ?>_CaseNumber" value="<?php echo HtmlEncode($complaints->CaseNumber->FormValue) ?>">
<input type="hidden" data-table="complaints" data-field="x_CaseNumber" name="o<?php echo $complaints_grid->RowIndex ?>_CaseNumber" id="o<?php echo $complaints_grid->RowIndex ?>_CaseNumber" value="<?php echo HtmlEncode($complaints->CaseNumber->OldValue) ?>">
<?php } else { ?>
<input type="hidden" data-table="complaints" data-field="x_CaseNumber" name="fcomplaintsgrid$x<?php echo $complaints_grid->RowIndex ?>_CaseNumber" id="fcomplaintsgrid$x<?php echo $complaints_grid->RowIndex ?>_CaseNumber" value="<?php echo HtmlEncode($complaints->CaseNumber->FormValue) ?>">
<input type="hidden" data-table="complaints" data-field="x_CaseNumber" name="fcomplaintsgrid$o<?php echo $complaints_grid->RowIndex ?>_CaseNumber" id="fcomplaintsgrid$o<?php echo $complaints_grid->RowIndex ?>_CaseNumber" value="<?php echo HtmlEncode($complaints->CaseNumber->OldValue) ?>">
<?php } ?>
<?php } ?>
</td>
	<?php } ?>
<?php if ($complaints->RowType == ROWTYPE_ADD) { // Add record ?>
<input type="hidden" data-table="complaints" data-field="x_ComplaintID" name="x<?php echo $complaints_grid->RowIndex ?>_ComplaintID" id="x<?php echo $complaints_grid->RowIndex ?>_ComplaintID" value="<?php echo HtmlEncode($complaints->ComplaintID->CurrentValue) ?>">
<input type="hidden" data-table="complaints" data-field="x_ComplaintID" name="o<?php echo $complaints_grid->RowIndex ?>_ComplaintID" id="o<?php echo $complaints_grid->RowIndex ?>_ComplaintID" value="<?php echo HtmlEncode($complaints->ComplaintID->OldValue) ?>">
<?php } ?>
<?php if ($complaints->RowType == ROWTYPE_EDIT || $complaints->CurrentMode == "edit") { ?>
<input type="hidden" data-table="complaints" data-field="x_ComplaintID" name="x<?php echo $complaints_grid->RowIndex ?>_ComplaintID" id="x<?php echo $complaints_grid->RowIndex ?>_ComplaintID" value="<?php echo HtmlEncode($complaints->ComplaintID->CurrentValue) ?>">
<?php } ?>
	<?php if ($complaints->ComplaintDate->Visible) { // ComplaintDate ?>
		<td data-name="ComplaintDate"<?php echo $complaints->ComplaintDate->cellAttributes() ?>>
<?php if ($complaints->RowType == ROWTYPE_ADD) { // Add record ?>
<span id="el<?php echo $complaints_grid->RowCnt ?>_complaints_ComplaintDate" class="form-group complaints_ComplaintDate">
<input type="text" data-table="complaints" data-field="x_ComplaintDate" data-format="7" name="x<?php echo $complaints_grid->RowIndex ?>_ComplaintDate" id="x<?php echo $complaints_grid->RowIndex ?>_ComplaintDate" placeholder="<?php echo HtmlEncode($complaints->ComplaintDate->getPlaceHolder()) ?>" value="<?php echo $complaints->ComplaintDate->EditValue ?>"<?php echo $complaints->ComplaintDate->editAttributes() ?>>
<?php if (!$complaints->ComplaintDate->ReadOnly && !$complaints->ComplaintDate->Disabled && !isset($complaints->ComplaintDate->EditAttrs["readonly"]) && !isset($complaints->ComplaintDate->EditAttrs["disabled"])) { ?>
<script>
ew.createDateTimePicker("fcomplaintsgrid", "x<?php echo $complaints_grid->RowIndex ?>_ComplaintDate", {"ignoreReadonly":true,"useCurrent":false,"format":7});
</script>
<?php } ?>
</span>
<input type="hidden" data-table="complaints" data-field="x_ComplaintDate" name="o<?php echo $complaints_grid->RowIndex ?>_ComplaintDate" id="o<?php echo $complaints_grid->RowIndex ?>_ComplaintDate" value="<?php echo HtmlEncode($complaints->ComplaintDate->OldValue) ?>">
<?php } ?>
<?php if ($complaints->RowType == ROWTYPE_EDIT) { // Edit record ?>
<span id="el<?php echo $complaints_grid->RowCnt ?>_complaints_ComplaintDate" class="form-group complaints_ComplaintDate">
<input type="text" data-table="complaints" data-field="x_ComplaintDate" data-format="7" name="x<?php echo $complaints_grid->RowIndex ?>_ComplaintDate" id="x<?php echo $complaints_grid->RowIndex ?>_ComplaintDate" placeholder="<?php echo HtmlEncode($complaints->ComplaintDate->getPlaceHolder()) ?>" value="<?php echo $complaints->ComplaintDate->EditValue ?>"<?php echo $complaints->ComplaintDate->editAttributes() ?>>
<?php if (!$complaints->ComplaintDate->ReadOnly && !$complaints->ComplaintDate->Disabled && !isset($complaints->ComplaintDate->EditAttrs["readonly"]) && !isset($complaints->ComplaintDate->EditAttrs["disabled"])) { ?>
<script>
ew.createDateTimePicker("fcomplaintsgrid", "x<?php echo $complaints_grid->RowIndex ?>_ComplaintDate", {"ignoreReadonly":true,"useCurrent":false,"format":7});
</script>
<?php } ?>
</span>
<?php } ?>
<?php if ($complaints->RowType == ROWTYPE_VIEW) { // View record ?>
<span id="el<?php echo $complaints_grid->RowCnt ?>_complaints_ComplaintDate" class="complaints_ComplaintDate">
<span<?php echo $complaints->ComplaintDate->viewAttributes() ?>>
<?php echo $complaints->ComplaintDate->getViewValue() ?></span>
</span>
<?php if (!$complaints->isConfirm()) { ?>
<input type="hidden" data-table="complaints" data-field="x_ComplaintDate" name="x<?php echo $complaints_grid->RowIndex ?>_ComplaintDate" id="x<?php echo $complaints_grid->RowIndex ?>_ComplaintDate" value="<?php echo HtmlEncode($complaints->ComplaintDate->FormValue) ?>">
<input type="hidden" data-table="complaints" data-field="x_ComplaintDate" name="o<?php echo $complaints_grid->RowIndex ?>_ComplaintDate" id="o<?php echo $complaints_grid->RowIndex ?>_ComplaintDate" value="<?php echo HtmlEncode($complaints->ComplaintDate->OldValue) ?>">
<?php } else { ?>
<input type="hidden" data-table="complaints" data-field="x_ComplaintDate" name="fcomplaintsgrid$x<?php echo $complaints_grid->RowIndex ?>_ComplaintDate" id="fcomplaintsgrid$x<?php echo $complaints_grid->RowIndex ?>_ComplaintDate" value="<?php echo HtmlEncode($complaints->ComplaintDate->FormValue) ?>">
<input type="hidden" data-table="complaints" data-field="x_ComplaintDate" name="fcomplaintsgrid$o<?php echo $complaints_grid->RowIndex ?>_ComplaintDate" id="fcomplaintsgrid$o<?php echo $complaints_grid->RowIndex ?>_ComplaintDate" value="<?php echo HtmlEncode($complaints->ComplaintDate->OldValue) ?>">
<?php } ?>
<?php } ?>
</td>
	<?php } ?>
	<?php if ($complaints->Complaint->Visible) { // Complaint ?>
		<td data-name="Complaint"<?php echo $complaints->Complaint->cellAttributes() ?>>
<?php if ($complaints->RowType == ROWTYPE_ADD) { // Add record ?>
<span id="el<?php echo $complaints_grid->RowCnt ?>_complaints_Complaint" class="form-group complaints_Complaint">
<textarea data-table="complaints" data-field="x_Complaint" name="x<?php echo $complaints_grid->RowIndex ?>_Complaint" id="x<?php echo $complaints_grid->RowIndex ?>_Complaint" cols="35" rows="2" placeholder="<?php echo HtmlEncode($complaints->Complaint->getPlaceHolder()) ?>"<?php echo $complaints->Complaint->editAttributes() ?>><?php echo $complaints->Complaint->EditValue ?></textarea>
</span>
<input type="hidden" data-table="complaints" data-field="x_Complaint" name="o<?php echo $complaints_grid->RowIndex ?>_Complaint" id="o<?php echo $complaints_grid->RowIndex ?>_Complaint" value="<?php echo HtmlEncode($complaints->Complaint->OldValue) ?>">
<?php } ?>
<?php if ($complaints->RowType == ROWTYPE_EDIT) { // Edit record ?>
<span id="el<?php echo $complaints_grid->RowCnt ?>_complaints_Complaint" class="form-group complaints_Complaint">
<textarea data-table="complaints" data-field="x_Complaint" name="x<?php echo $complaints_grid->RowIndex ?>_Complaint" id="x<?php echo $complaints_grid->RowIndex ?>_Complaint" cols="35" rows="2" placeholder="<?php echo HtmlEncode($complaints->Complaint->getPlaceHolder()) ?>"<?php echo $complaints->Complaint->editAttributes() ?>><?php echo $complaints->Complaint->EditValue ?></textarea>
</span>
<?php } ?>
<?php if ($complaints->RowType == ROWTYPE_VIEW) { // View record ?>
<span id="el<?php echo $complaints_grid->RowCnt ?>_complaints_Complaint" class="complaints_Complaint">
<span<?php echo $complaints->Complaint->viewAttributes() ?>>
<?php echo $complaints->Complaint->getViewValue() ?></span>
</span>
<?php if (!$complaints->isConfirm()) { ?>
<input type="hidden" data-table="complaints" data-field="x_Complaint" name="x<?php echo $complaints_grid->RowIndex ?>_Complaint" id="x<?php echo $complaints_grid->RowIndex ?>_Complaint" value="<?php echo HtmlEncode($complaints->Complaint->FormValue) ?>">
<input type="hidden" data-table="complaints" data-field="x_Complaint" name="o<?php echo $complaints_grid->RowIndex ?>_Complaint" id="o<?php echo $complaints_grid->RowIndex ?>_Complaint" value="<?php echo HtmlEncode($complaints->Complaint->OldValue) ?>">
<?php } else { ?>
<input type="hidden" data-table="complaints" data-field="x_Complaint" name="fcomplaintsgrid$x<?php echo $complaints_grid->RowIndex ?>_Complaint" id="fcomplaintsgrid$x<?php echo $complaints_grid->RowIndex ?>_Complaint" value="<?php echo HtmlEncode($complaints->Complaint->FormValue) ?>">
<input type="hidden" data-table="complaints" data-field="x_Complaint" name="fcomplaintsgrid$o<?php echo $complaints_grid->RowIndex ?>_Complaint" id="fcomplaintsgrid$o<?php echo $complaints_grid->RowIndex ?>_Complaint" value="<?php echo HtmlEncode($complaints->Complaint->OldValue) ?>">
<?php } ?>
<?php } ?>
</td>
	<?php } ?>
<?php

// Render list options (body, right)
$complaints_grid->ListOptions->render("body", "right", $complaints_grid->RowCnt);
?>
	</tr>
<?php if ($complaints->RowType == ROWTYPE_ADD || $complaints->RowType == ROWTYPE_EDIT) { ?>
<script>
fcomplaintsgrid.updateLists(<?php echo $complaints_grid->RowIndex ?>);
</script>
<?php } ?>
<?php
	}
	} // End delete row checking
	if (!$complaints->isGridAdd() || $complaints->CurrentMode == "copy")
		if (!$complaints_grid->Recordset->EOF)
			$complaints_grid->Recordset->moveNext();
}
?>
<?php
	if ($complaints->CurrentMode == "add" || $complaints->CurrentMode == "copy" || $complaints->CurrentMode == "edit") {
		$complaints_grid->RowIndex = '$rowindex$';
		$complaints_grid->loadRowValues();

		// Set row properties
		$complaints->resetAttributes();
		$complaints->RowAttrs = array_merge($complaints->RowAttrs, array('data-rowindex'=>$complaints_grid->RowIndex, 'id'=>'r0_complaints', 'data-rowtype'=>ROWTYPE_ADD));
		AppendClass($complaints->RowAttrs["class"], "ew-template");
		$complaints->RowType = ROWTYPE_ADD;

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

		// Render list options
		$complaints_grid->renderListOptions();
		$complaints_grid->StartRowCnt = 0;
?>
	<tr<?php echo $complaints->rowAttributes() ?>>
<?php

// Render list options (body, left)
$complaints_grid->ListOptions->render("body", "left", $complaints_grid->RowIndex);
?>
	<?php if ($complaints->CaseNumber->Visible) { // CaseNumber ?>
		<td data-name="CaseNumber">
<?php if (!$complaints->isConfirm()) { ?>
<span id="el$rowindex$_complaints_CaseNumber" class="form-group complaints_CaseNumber">
<input type="text" data-table="complaints" data-field="x_CaseNumber" name="x<?php echo $complaints_grid->RowIndex ?>_CaseNumber" id="x<?php echo $complaints_grid->RowIndex ?>_CaseNumber" size="30" maxlength="30" placeholder="<?php echo HtmlEncode($complaints->CaseNumber->getPlaceHolder()) ?>" value="<?php echo $complaints->CaseNumber->EditValue ?>"<?php echo $complaints->CaseNumber->editAttributes() ?>>
</span>
<?php } else { ?>
<span id="el$rowindex$_complaints_CaseNumber" class="form-group complaints_CaseNumber">
<span<?php echo $complaints->CaseNumber->viewAttributes() ?>>
<input type="text" readonly class="form-control-plaintext" value="<?php echo RemoveHtml($complaints->CaseNumber->ViewValue) ?>"></span>
</span>
<input type="hidden" data-table="complaints" data-field="x_CaseNumber" name="x<?php echo $complaints_grid->RowIndex ?>_CaseNumber" id="x<?php echo $complaints_grid->RowIndex ?>_CaseNumber" value="<?php echo HtmlEncode($complaints->CaseNumber->FormValue) ?>">
<?php } ?>
<input type="hidden" data-table="complaints" data-field="x_CaseNumber" name="o<?php echo $complaints_grid->RowIndex ?>_CaseNumber" id="o<?php echo $complaints_grid->RowIndex ?>_CaseNumber" value="<?php echo HtmlEncode($complaints->CaseNumber->OldValue) ?>">
</td>
	<?php } ?>
	<?php if ($complaints->ComplaintDate->Visible) { // ComplaintDate ?>
		<td data-name="ComplaintDate">
<?php if (!$complaints->isConfirm()) { ?>
<span id="el$rowindex$_complaints_ComplaintDate" class="form-group complaints_ComplaintDate">
<input type="text" data-table="complaints" data-field="x_ComplaintDate" data-format="7" name="x<?php echo $complaints_grid->RowIndex ?>_ComplaintDate" id="x<?php echo $complaints_grid->RowIndex ?>_ComplaintDate" placeholder="<?php echo HtmlEncode($complaints->ComplaintDate->getPlaceHolder()) ?>" value="<?php echo $complaints->ComplaintDate->EditValue ?>"<?php echo $complaints->ComplaintDate->editAttributes() ?>>
<?php if (!$complaints->ComplaintDate->ReadOnly && !$complaints->ComplaintDate->Disabled && !isset($complaints->ComplaintDate->EditAttrs["readonly"]) && !isset($complaints->ComplaintDate->EditAttrs["disabled"])) { ?>
<script>
ew.createDateTimePicker("fcomplaintsgrid", "x<?php echo $complaints_grid->RowIndex ?>_ComplaintDate", {"ignoreReadonly":true,"useCurrent":false,"format":7});
</script>
<?php } ?>
</span>
<?php } else { ?>
<span id="el$rowindex$_complaints_ComplaintDate" class="form-group complaints_ComplaintDate">
<span<?php echo $complaints->ComplaintDate->viewAttributes() ?>>
<input type="text" readonly class="form-control-plaintext" value="<?php echo RemoveHtml($complaints->ComplaintDate->ViewValue) ?>"></span>
</span>
<input type="hidden" data-table="complaints" data-field="x_ComplaintDate" name="x<?php echo $complaints_grid->RowIndex ?>_ComplaintDate" id="x<?php echo $complaints_grid->RowIndex ?>_ComplaintDate" value="<?php echo HtmlEncode($complaints->ComplaintDate->FormValue) ?>">
<?php } ?>
<input type="hidden" data-table="complaints" data-field="x_ComplaintDate" name="o<?php echo $complaints_grid->RowIndex ?>_ComplaintDate" id="o<?php echo $complaints_grid->RowIndex ?>_ComplaintDate" value="<?php echo HtmlEncode($complaints->ComplaintDate->OldValue) ?>">
</td>
	<?php } ?>
	<?php if ($complaints->Complaint->Visible) { // Complaint ?>
		<td data-name="Complaint">
<?php if (!$complaints->isConfirm()) { ?>
<span id="el$rowindex$_complaints_Complaint" class="form-group complaints_Complaint">
<textarea data-table="complaints" data-field="x_Complaint" name="x<?php echo $complaints_grid->RowIndex ?>_Complaint" id="x<?php echo $complaints_grid->RowIndex ?>_Complaint" cols="35" rows="2" placeholder="<?php echo HtmlEncode($complaints->Complaint->getPlaceHolder()) ?>"<?php echo $complaints->Complaint->editAttributes() ?>><?php echo $complaints->Complaint->EditValue ?></textarea>
</span>
<?php } else { ?>
<span id="el$rowindex$_complaints_Complaint" class="form-group complaints_Complaint">
<span<?php echo $complaints->Complaint->viewAttributes() ?>>
<input type="text" readonly class="form-control-plaintext" value="<?php echo RemoveHtml($complaints->Complaint->ViewValue) ?>"></span>
</span>
<input type="hidden" data-table="complaints" data-field="x_Complaint" name="x<?php echo $complaints_grid->RowIndex ?>_Complaint" id="x<?php echo $complaints_grid->RowIndex ?>_Complaint" value="<?php echo HtmlEncode($complaints->Complaint->FormValue) ?>">
<?php } ?>
<input type="hidden" data-table="complaints" data-field="x_Complaint" name="o<?php echo $complaints_grid->RowIndex ?>_Complaint" id="o<?php echo $complaints_grid->RowIndex ?>_Complaint" value="<?php echo HtmlEncode($complaints->Complaint->OldValue) ?>">
</td>
	<?php } ?>
<?php

// Render list options (body, right)
$complaints_grid->ListOptions->render("body", "right", $complaints_grid->RowIndex);
?>
<script>
fcomplaintsgrid.updateLists(<?php echo $complaints_grid->RowIndex ?>);
</script>
	</tr>
<?php
}
?>
</tbody>
</table><!-- /.ew-table -->
<?php if ($complaints->CurrentMode == "add" || $complaints->CurrentMode == "copy") { ?>
<input type="hidden" name="<?php echo $complaints_grid->FormKeyCountName ?>" id="<?php echo $complaints_grid->FormKeyCountName ?>" value="<?php echo $complaints_grid->KeyCount ?>">
<?php echo $complaints_grid->MultiSelectKey ?>
<?php } ?>
<?php if ($complaints->CurrentMode == "edit") { ?>
<input type="hidden" name="<?php echo $complaints_grid->FormKeyCountName ?>" id="<?php echo $complaints_grid->FormKeyCountName ?>" value="<?php echo $complaints_grid->KeyCount ?>">
<?php echo $complaints_grid->MultiSelectKey ?>
<?php } ?>
<?php if ($complaints->CurrentMode == "") { ?>
<input type="hidden" name="action" id="action" value="">
<?php } ?>
<input type="hidden" name="detailpage" value="fcomplaintsgrid">
</div><!-- /.ew-grid-middle-panel -->
<?php

// Close recordset
if ($complaints_grid->Recordset)
	$complaints_grid->Recordset->Close();
?>
</div>
<?php if ($complaints_grid->ShowOtherOptions) { ?>
<div class="card-footer ew-grid-lower-panel">
<?php $complaints_grid->OtherOptions->render("body", "bottom") ?>
</div>
<div class="clearfix"></div>
<?php } ?>
</div><!-- /.ew-grid -->
<?php } ?>
<?php if ($complaints_grid->TotalRecs == 0 && !$complaints->CurrentAction) { // Show other options ?>
<div class="ew-list-other-options">
<?php $complaints_grid->OtherOptions->render("body") ?>
</div>
<div class="clearfix"></div>
<?php } ?>
<?php
$complaints_grid->terminate();
?>
<?php if (!$complaints->isExport()) { ?>
<script>
ew.scrollableTable("gmp_complaints", "1250px", "");
</script>
<?php } ?>
