<?php
namespace PHPMaker2019\project_germanos;

// Write header
WriteHeader(FALSE);

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

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

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

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

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

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

// Validate form
fclientcontactgrid.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 ($clientcontact_grid->ClientID->Required) { ?>
			elm = this.getElements("x" + infix + "_ClientID");
			if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
				return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $clientcontact->ClientID->caption(), $clientcontact->ClientID->RequiredErrorMessage)) ?>");
		<?php } ?>
		<?php if ($clientcontact_grid->ContactTypeID->Required) { ?>
			elm = this.getElements("x" + infix + "_ContactTypeID");
			if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
				return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $clientcontact->ContactTypeID->caption(), $clientcontact->ContactTypeID->RequiredErrorMessage)) ?>");
		<?php } ?>
		<?php if ($clientcontact_grid->Contact->Required) { ?>
			elm = this.getElements("x" + infix + "_Contact");
			if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
				return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $clientcontact->Contact->caption(), $clientcontact->Contact->RequiredErrorMessage)) ?>");
		<?php } ?>
		<?php if ($clientcontact_grid->Notes->Required) { ?>
			elm = this.getElements("x" + infix + "_Notes");
			if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
				return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $clientcontact->Notes->caption(), $clientcontact->Notes->RequiredErrorMessage)) ?>");
		<?php } ?>
		<?php if ($clientcontact_grid->Primary->Required) { ?>
			elm = this.getElements("x" + infix + "_Primary[]");
			if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
				return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $clientcontact->Primary->caption(), $clientcontact->Primary->RequiredErrorMessage)) ?>");
		<?php } ?>

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

// Check empty row
fclientcontactgrid.emptyRow = function(infix) {
	var fobj = this._form;
	if (ew.valueChanged(fobj, infix, "ClientID", false)) return false;
	if (ew.valueChanged(fobj, infix, "ContactTypeID", false)) return false;
	if (ew.valueChanged(fobj, infix, "Contact", false)) return false;
	if (ew.valueChanged(fobj, infix, "Notes", false)) return false;
	if (ew.valueChanged(fobj, infix, "Primary[]", true)) return false;
	return true;
}

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

// Dynamic selection lists
fclientcontactgrid.lists["x_ClientID"] = <?php echo $clientcontact_grid->ClientID->Lookup->toClientList() ?>;
fclientcontactgrid.lists["x_ClientID"].options = <?php echo JsonEncode($clientcontact_grid->ClientID->lookupOptions()) ?>;
fclientcontactgrid.lists["x_ContactTypeID"] = <?php echo $clientcontact_grid->ContactTypeID->Lookup->toClientList() ?>;
fclientcontactgrid.lists["x_ContactTypeID"].options = <?php echo JsonEncode($clientcontact_grid->ContactTypeID->lookupOptions()) ?>;
fclientcontactgrid.lists["x_Primary[]"] = <?php echo $clientcontact_grid->Primary->Lookup->toClientList() ?>;
fclientcontactgrid.lists["x_Primary[]"].options = <?php echo JsonEncode($clientcontact_grid->Primary->options(FALSE, TRUE)) ?>;

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

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

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

// Render list options (header, left)
$clientcontact_grid->ListOptions->render("header", "left");
?>
<?php if ($clientcontact->ClientID->Visible) { // ClientID ?>
	<?php if ($clientcontact->sortUrl($clientcontact->ClientID) == "") { ?>
		<th data-name="ClientID" class="<?php echo $clientcontact->ClientID->headerCellClass() ?>"><div id="elh_clientcontact_ClientID" class="clientcontact_ClientID"><div class="ew-table-header-caption"><?php echo $clientcontact->ClientID->caption() ?></div></div></th>
	<?php } else { ?>
		<th data-name="ClientID" class="<?php echo $clientcontact->ClientID->headerCellClass() ?>"><div><div id="elh_clientcontact_ClientID" class="clientcontact_ClientID">
			<div class="ew-table-header-btn"><span class="ew-table-header-caption"><?php echo $clientcontact->ClientID->caption() ?></span><span class="ew-table-header-sort"><?php if ($clientcontact->ClientID->getSort() == "ASC") { ?><i class="fa fa-sort-up"></i><?php } elseif ($clientcontact->ClientID->getSort() == "DESC") { ?><i class="fa fa-sort-down"></i><?php } ?></span></div>
		</div></div></th>
	<?php } ?>
<?php } ?>
<?php if ($clientcontact->ContactTypeID->Visible) { // ContactTypeID ?>
	<?php if ($clientcontact->sortUrl($clientcontact->ContactTypeID) == "") { ?>
		<th data-name="ContactTypeID" class="<?php echo $clientcontact->ContactTypeID->headerCellClass() ?>"><div id="elh_clientcontact_ContactTypeID" class="clientcontact_ContactTypeID"><div class="ew-table-header-caption"><?php echo $clientcontact->ContactTypeID->caption() ?></div></div></th>
	<?php } else { ?>
		<th data-name="ContactTypeID" class="<?php echo $clientcontact->ContactTypeID->headerCellClass() ?>"><div><div id="elh_clientcontact_ContactTypeID" class="clientcontact_ContactTypeID">
			<div class="ew-table-header-btn"><span class="ew-table-header-caption"><?php echo $clientcontact->ContactTypeID->caption() ?></span><span class="ew-table-header-sort"><?php if ($clientcontact->ContactTypeID->getSort() == "ASC") { ?><i class="fa fa-sort-up"></i><?php } elseif ($clientcontact->ContactTypeID->getSort() == "DESC") { ?><i class="fa fa-sort-down"></i><?php } ?></span></div>
		</div></div></th>
	<?php } ?>
<?php } ?>
<?php if ($clientcontact->Contact->Visible) { // Contact ?>
	<?php if ($clientcontact->sortUrl($clientcontact->Contact) == "") { ?>
		<th data-name="Contact" class="<?php echo $clientcontact->Contact->headerCellClass() ?>"><div id="elh_clientcontact_Contact" class="clientcontact_Contact"><div class="ew-table-header-caption"><?php echo $clientcontact->Contact->caption() ?></div></div></th>
	<?php } else { ?>
		<th data-name="Contact" class="<?php echo $clientcontact->Contact->headerCellClass() ?>"><div><div id="elh_clientcontact_Contact" class="clientcontact_Contact">
			<div class="ew-table-header-btn"><span class="ew-table-header-caption"><?php echo $clientcontact->Contact->caption() ?></span><span class="ew-table-header-sort"><?php if ($clientcontact->Contact->getSort() == "ASC") { ?><i class="fa fa-sort-up"></i><?php } elseif ($clientcontact->Contact->getSort() == "DESC") { ?><i class="fa fa-sort-down"></i><?php } ?></span></div>
		</div></div></th>
	<?php } ?>
<?php } ?>
<?php if ($clientcontact->Notes->Visible) { // Notes ?>
	<?php if ($clientcontact->sortUrl($clientcontact->Notes) == "") { ?>
		<th data-name="Notes" class="<?php echo $clientcontact->Notes->headerCellClass() ?>"><div id="elh_clientcontact_Notes" class="clientcontact_Notes"><div class="ew-table-header-caption"><?php echo $clientcontact->Notes->caption() ?></div></div></th>
	<?php } else { ?>
		<th data-name="Notes" class="<?php echo $clientcontact->Notes->headerCellClass() ?>"><div><div id="elh_clientcontact_Notes" class="clientcontact_Notes">
			<div class="ew-table-header-btn"><span class="ew-table-header-caption"><?php echo $clientcontact->Notes->caption() ?></span><span class="ew-table-header-sort"><?php if ($clientcontact->Notes->getSort() == "ASC") { ?><i class="fa fa-sort-up"></i><?php } elseif ($clientcontact->Notes->getSort() == "DESC") { ?><i class="fa fa-sort-down"></i><?php } ?></span></div>
		</div></div></th>
	<?php } ?>
<?php } ?>
<?php if ($clientcontact->Primary->Visible) { // Primary ?>
	<?php if ($clientcontact->sortUrl($clientcontact->Primary) == "") { ?>
		<th data-name="Primary" class="<?php echo $clientcontact->Primary->headerCellClass() ?>"><div id="elh_clientcontact_Primary" class="clientcontact_Primary"><div class="ew-table-header-caption"><?php echo $clientcontact->Primary->caption() ?></div></div></th>
	<?php } else { ?>
		<th data-name="Primary" class="<?php echo $clientcontact->Primary->headerCellClass() ?>"><div><div id="elh_clientcontact_Primary" class="clientcontact_Primary">
			<div class="ew-table-header-btn"><span class="ew-table-header-caption"><?php echo $clientcontact->Primary->caption() ?></span><span class="ew-table-header-sort"><?php if ($clientcontact->Primary->getSort() == "ASC") { ?><i class="fa fa-sort-up"></i><?php } elseif ($clientcontact->Primary->getSort() == "DESC") { ?><i class="fa fa-sort-down"></i><?php } ?></span></div>
		</div></div></th>
	<?php } ?>
<?php } ?>
<?php

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

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

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

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

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

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

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

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

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

// Render list options (body, left)
$clientcontact_grid->ListOptions->render("body", "left", $clientcontact_grid->RowCnt);
?>
	<?php if ($clientcontact->ClientID->Visible) { // ClientID ?>
		<td data-name="ClientID"<?php echo $clientcontact->ClientID->cellAttributes() ?>>
<?php if ($clientcontact->RowType == ROWTYPE_ADD) { // Add record ?>
<?php if ($clientcontact->ClientID->getSessionValue() <> "") { ?>
<span id="el<?php echo $clientcontact_grid->RowCnt ?>_clientcontact_ClientID" class="form-group clientcontact_ClientID">
<span<?php echo $clientcontact->ClientID->viewAttributes() ?>>
<input type="text" readonly class="form-control-plaintext" value="<?php echo RemoveHtml($clientcontact->ClientID->ViewValue) ?>"></span>
</span>
<input type="hidden" id="x<?php echo $clientcontact_grid->RowIndex ?>_ClientID" name="x<?php echo $clientcontact_grid->RowIndex ?>_ClientID" value="<?php echo HtmlEncode($clientcontact->ClientID->CurrentValue) ?>">
<?php } else { ?>
<span id="el<?php echo $clientcontact_grid->RowCnt ?>_clientcontact_ClientID" class="form-group clientcontact_ClientID">
<div class="input-group">
	<select class="custom-select ew-custom-select" data-table="clientcontact" data-field="x_ClientID" data-value-separator="<?php echo $clientcontact->ClientID->displayValueSeparatorAttribute() ?>" id="x<?php echo $clientcontact_grid->RowIndex ?>_ClientID" name="x<?php echo $clientcontact_grid->RowIndex ?>_ClientID"<?php echo $clientcontact->ClientID->editAttributes() ?>>
		<?php echo $clientcontact->ClientID->selectOptionListHtml("x<?php echo $clientcontact_grid->RowIndex ?>_ClientID") ?>
	</select>
</div>
<?php echo $clientcontact->ClientID->Lookup->getParamTag("p_x" . $clientcontact_grid->RowIndex . "_ClientID") ?>
</span>
<?php } ?>
<input type="hidden" data-table="clientcontact" data-field="x_ClientID" name="o<?php echo $clientcontact_grid->RowIndex ?>_ClientID" id="o<?php echo $clientcontact_grid->RowIndex ?>_ClientID" value="<?php echo HtmlEncode($clientcontact->ClientID->OldValue) ?>">
<?php } ?>
<?php if ($clientcontact->RowType == ROWTYPE_EDIT) { // Edit record ?>
<?php if ($clientcontact->ClientID->getSessionValue() <> "") { ?>
<span id="el<?php echo $clientcontact_grid->RowCnt ?>_clientcontact_ClientID" class="form-group clientcontact_ClientID">
<span<?php echo $clientcontact->ClientID->viewAttributes() ?>>
<input type="text" readonly class="form-control-plaintext" value="<?php echo RemoveHtml($clientcontact->ClientID->ViewValue) ?>"></span>
</span>
<input type="hidden" id="x<?php echo $clientcontact_grid->RowIndex ?>_ClientID" name="x<?php echo $clientcontact_grid->RowIndex ?>_ClientID" value="<?php echo HtmlEncode($clientcontact->ClientID->CurrentValue) ?>">
<?php } else { ?>
<span id="el<?php echo $clientcontact_grid->RowCnt ?>_clientcontact_ClientID" class="form-group clientcontact_ClientID">
<div class="input-group">
	<select class="custom-select ew-custom-select" data-table="clientcontact" data-field="x_ClientID" data-value-separator="<?php echo $clientcontact->ClientID->displayValueSeparatorAttribute() ?>" id="x<?php echo $clientcontact_grid->RowIndex ?>_ClientID" name="x<?php echo $clientcontact_grid->RowIndex ?>_ClientID"<?php echo $clientcontact->ClientID->editAttributes() ?>>
		<?php echo $clientcontact->ClientID->selectOptionListHtml("x<?php echo $clientcontact_grid->RowIndex ?>_ClientID") ?>
	</select>
</div>
<?php echo $clientcontact->ClientID->Lookup->getParamTag("p_x" . $clientcontact_grid->RowIndex . "_ClientID") ?>
</span>
<?php } ?>
<?php } ?>
<?php if ($clientcontact->RowType == ROWTYPE_VIEW) { // View record ?>
<span id="el<?php echo $clientcontact_grid->RowCnt ?>_clientcontact_ClientID" class="clientcontact_ClientID">
<span<?php echo $clientcontact->ClientID->viewAttributes() ?>>
<?php echo $clientcontact->ClientID->getViewValue() ?></span>
</span>
<?php if (!$clientcontact->isConfirm()) { ?>
<input type="hidden" data-table="clientcontact" data-field="x_ClientID" name="x<?php echo $clientcontact_grid->RowIndex ?>_ClientID" id="x<?php echo $clientcontact_grid->RowIndex ?>_ClientID" value="<?php echo HtmlEncode($clientcontact->ClientID->FormValue) ?>">
<input type="hidden" data-table="clientcontact" data-field="x_ClientID" name="o<?php echo $clientcontact_grid->RowIndex ?>_ClientID" id="o<?php echo $clientcontact_grid->RowIndex ?>_ClientID" value="<?php echo HtmlEncode($clientcontact->ClientID->OldValue) ?>">
<?php } else { ?>
<input type="hidden" data-table="clientcontact" data-field="x_ClientID" name="fclientcontactgrid$x<?php echo $clientcontact_grid->RowIndex ?>_ClientID" id="fclientcontactgrid$x<?php echo $clientcontact_grid->RowIndex ?>_ClientID" value="<?php echo HtmlEncode($clientcontact->ClientID->FormValue) ?>">
<input type="hidden" data-table="clientcontact" data-field="x_ClientID" name="fclientcontactgrid$o<?php echo $clientcontact_grid->RowIndex ?>_ClientID" id="fclientcontactgrid$o<?php echo $clientcontact_grid->RowIndex ?>_ClientID" value="<?php echo HtmlEncode($clientcontact->ClientID->OldValue) ?>">
<?php } ?>
<?php } ?>
</td>
	<?php } ?>
<?php if ($clientcontact->RowType == ROWTYPE_ADD) { // Add record ?>
<input type="hidden" data-table="clientcontact" data-field="x_ContactID" name="x<?php echo $clientcontact_grid->RowIndex ?>_ContactID" id="x<?php echo $clientcontact_grid->RowIndex ?>_ContactID" value="<?php echo HtmlEncode($clientcontact->ContactID->CurrentValue) ?>">
<input type="hidden" data-table="clientcontact" data-field="x_ContactID" name="o<?php echo $clientcontact_grid->RowIndex ?>_ContactID" id="o<?php echo $clientcontact_grid->RowIndex ?>_ContactID" value="<?php echo HtmlEncode($clientcontact->ContactID->OldValue) ?>">
<?php } ?>
<?php if ($clientcontact->RowType == ROWTYPE_EDIT || $clientcontact->CurrentMode == "edit") { ?>
<input type="hidden" data-table="clientcontact" data-field="x_ContactID" name="x<?php echo $clientcontact_grid->RowIndex ?>_ContactID" id="x<?php echo $clientcontact_grid->RowIndex ?>_ContactID" value="<?php echo HtmlEncode($clientcontact->ContactID->CurrentValue) ?>">
<?php } ?>
	<?php if ($clientcontact->ContactTypeID->Visible) { // ContactTypeID ?>
		<td data-name="ContactTypeID"<?php echo $clientcontact->ContactTypeID->cellAttributes() ?>>
<?php if ($clientcontact->RowType == ROWTYPE_ADD) { // Add record ?>
<span id="el<?php echo $clientcontact_grid->RowCnt ?>_clientcontact_ContactTypeID" class="form-group clientcontact_ContactTypeID">
<div class="input-group">
	<select class="custom-select ew-custom-select" data-table="clientcontact" data-field="x_ContactTypeID" data-value-separator="<?php echo $clientcontact->ContactTypeID->displayValueSeparatorAttribute() ?>" id="x<?php echo $clientcontact_grid->RowIndex ?>_ContactTypeID" name="x<?php echo $clientcontact_grid->RowIndex ?>_ContactTypeID"<?php echo $clientcontact->ContactTypeID->editAttributes() ?>>
		<?php echo $clientcontact->ContactTypeID->selectOptionListHtml("x<?php echo $clientcontact_grid->RowIndex ?>_ContactTypeID") ?>
	</select>
</div>
<?php echo $clientcontact->ContactTypeID->Lookup->getParamTag("p_x" . $clientcontact_grid->RowIndex . "_ContactTypeID") ?>
</span>
<input type="hidden" data-table="clientcontact" data-field="x_ContactTypeID" name="o<?php echo $clientcontact_grid->RowIndex ?>_ContactTypeID" id="o<?php echo $clientcontact_grid->RowIndex ?>_ContactTypeID" value="<?php echo HtmlEncode($clientcontact->ContactTypeID->OldValue) ?>">
<?php } ?>
<?php if ($clientcontact->RowType == ROWTYPE_EDIT) { // Edit record ?>
<span id="el<?php echo $clientcontact_grid->RowCnt ?>_clientcontact_ContactTypeID" class="form-group clientcontact_ContactTypeID">
<div class="input-group">
	<select class="custom-select ew-custom-select" data-table="clientcontact" data-field="x_ContactTypeID" data-value-separator="<?php echo $clientcontact->ContactTypeID->displayValueSeparatorAttribute() ?>" id="x<?php echo $clientcontact_grid->RowIndex ?>_ContactTypeID" name="x<?php echo $clientcontact_grid->RowIndex ?>_ContactTypeID"<?php echo $clientcontact->ContactTypeID->editAttributes() ?>>
		<?php echo $clientcontact->ContactTypeID->selectOptionListHtml("x<?php echo $clientcontact_grid->RowIndex ?>_ContactTypeID") ?>
	</select>
</div>
<?php echo $clientcontact->ContactTypeID->Lookup->getParamTag("p_x" . $clientcontact_grid->RowIndex . "_ContactTypeID") ?>
</span>
<?php } ?>
<?php if ($clientcontact->RowType == ROWTYPE_VIEW) { // View record ?>
<span id="el<?php echo $clientcontact_grid->RowCnt ?>_clientcontact_ContactTypeID" class="clientcontact_ContactTypeID">
<span<?php echo $clientcontact->ContactTypeID->viewAttributes() ?>>
<?php echo $clientcontact->ContactTypeID->getViewValue() ?></span>
</span>
<?php if (!$clientcontact->isConfirm()) { ?>
<input type="hidden" data-table="clientcontact" data-field="x_ContactTypeID" name="x<?php echo $clientcontact_grid->RowIndex ?>_ContactTypeID" id="x<?php echo $clientcontact_grid->RowIndex ?>_ContactTypeID" value="<?php echo HtmlEncode($clientcontact->ContactTypeID->FormValue) ?>">
<input type="hidden" data-table="clientcontact" data-field="x_ContactTypeID" name="o<?php echo $clientcontact_grid->RowIndex ?>_ContactTypeID" id="o<?php echo $clientcontact_grid->RowIndex ?>_ContactTypeID" value="<?php echo HtmlEncode($clientcontact->ContactTypeID->OldValue) ?>">
<?php } else { ?>
<input type="hidden" data-table="clientcontact" data-field="x_ContactTypeID" name="fclientcontactgrid$x<?php echo $clientcontact_grid->RowIndex ?>_ContactTypeID" id="fclientcontactgrid$x<?php echo $clientcontact_grid->RowIndex ?>_ContactTypeID" value="<?php echo HtmlEncode($clientcontact->ContactTypeID->FormValue) ?>">
<input type="hidden" data-table="clientcontact" data-field="x_ContactTypeID" name="fclientcontactgrid$o<?php echo $clientcontact_grid->RowIndex ?>_ContactTypeID" id="fclientcontactgrid$o<?php echo $clientcontact_grid->RowIndex ?>_ContactTypeID" value="<?php echo HtmlEncode($clientcontact->ContactTypeID->OldValue) ?>">
<?php } ?>
<?php } ?>
</td>
	<?php } ?>
	<?php if ($clientcontact->Contact->Visible) { // Contact ?>
		<td data-name="Contact"<?php echo $clientcontact->Contact->cellAttributes() ?>>
<?php if ($clientcontact->RowType == ROWTYPE_ADD) { // Add record ?>
<span id="el<?php echo $clientcontact_grid->RowCnt ?>_clientcontact_Contact" class="form-group clientcontact_Contact">
<input type="text" data-table="clientcontact" data-field="x_Contact" name="x<?php echo $clientcontact_grid->RowIndex ?>_Contact" id="x<?php echo $clientcontact_grid->RowIndex ?>_Contact" size="30" maxlength="50" placeholder="<?php echo HtmlEncode($clientcontact->Contact->getPlaceHolder()) ?>" value="<?php echo $clientcontact->Contact->EditValue ?>"<?php echo $clientcontact->Contact->editAttributes() ?>>
</span>
<input type="hidden" data-table="clientcontact" data-field="x_Contact" name="o<?php echo $clientcontact_grid->RowIndex ?>_Contact" id="o<?php echo $clientcontact_grid->RowIndex ?>_Contact" value="<?php echo HtmlEncode($clientcontact->Contact->OldValue) ?>">
<?php } ?>
<?php if ($clientcontact->RowType == ROWTYPE_EDIT) { // Edit record ?>
<span id="el<?php echo $clientcontact_grid->RowCnt ?>_clientcontact_Contact" class="form-group clientcontact_Contact">
<input type="text" data-table="clientcontact" data-field="x_Contact" name="x<?php echo $clientcontact_grid->RowIndex ?>_Contact" id="x<?php echo $clientcontact_grid->RowIndex ?>_Contact" size="30" maxlength="50" placeholder="<?php echo HtmlEncode($clientcontact->Contact->getPlaceHolder()) ?>" value="<?php echo $clientcontact->Contact->EditValue ?>"<?php echo $clientcontact->Contact->editAttributes() ?>>
</span>
<?php } ?>
<?php if ($clientcontact->RowType == ROWTYPE_VIEW) { // View record ?>
<span id="el<?php echo $clientcontact_grid->RowCnt ?>_clientcontact_Contact" class="clientcontact_Contact">
<span<?php echo $clientcontact->Contact->viewAttributes() ?>>
<?php if ((!EmptyString($clientcontact->Contact->getViewValue())) && $clientcontact->Contact->linkAttributes() <> "") { ?>
<a<?php echo $clientcontact->Contact->linkAttributes() ?>><?php echo $clientcontact->Contact->getViewValue() ?></a>
<?php } else { ?>
<?php echo $clientcontact->Contact->getViewValue() ?>
<?php } ?>
</span>
</span>
<?php if (!$clientcontact->isConfirm()) { ?>
<input type="hidden" data-table="clientcontact" data-field="x_Contact" name="x<?php echo $clientcontact_grid->RowIndex ?>_Contact" id="x<?php echo $clientcontact_grid->RowIndex ?>_Contact" value="<?php echo HtmlEncode($clientcontact->Contact->FormValue) ?>">
<input type="hidden" data-table="clientcontact" data-field="x_Contact" name="o<?php echo $clientcontact_grid->RowIndex ?>_Contact" id="o<?php echo $clientcontact_grid->RowIndex ?>_Contact" value="<?php echo HtmlEncode($clientcontact->Contact->OldValue) ?>">
<?php } else { ?>
<input type="hidden" data-table="clientcontact" data-field="x_Contact" name="fclientcontactgrid$x<?php echo $clientcontact_grid->RowIndex ?>_Contact" id="fclientcontactgrid$x<?php echo $clientcontact_grid->RowIndex ?>_Contact" value="<?php echo HtmlEncode($clientcontact->Contact->FormValue) ?>">
<input type="hidden" data-table="clientcontact" data-field="x_Contact" name="fclientcontactgrid$o<?php echo $clientcontact_grid->RowIndex ?>_Contact" id="fclientcontactgrid$o<?php echo $clientcontact_grid->RowIndex ?>_Contact" value="<?php echo HtmlEncode($clientcontact->Contact->OldValue) ?>">
<?php } ?>
<?php } ?>
</td>
	<?php } ?>
	<?php if ($clientcontact->Notes->Visible) { // Notes ?>
		<td data-name="Notes"<?php echo $clientcontact->Notes->cellAttributes() ?>>
<?php if ($clientcontact->RowType == ROWTYPE_ADD) { // Add record ?>
<span id="el<?php echo $clientcontact_grid->RowCnt ?>_clientcontact_Notes" class="form-group clientcontact_Notes">
<input type="text" data-table="clientcontact" data-field="x_Notes" name="x<?php echo $clientcontact_grid->RowIndex ?>_Notes" id="x<?php echo $clientcontact_grid->RowIndex ?>_Notes" size="30" maxlength="100" placeholder="<?php echo HtmlEncode($clientcontact->Notes->getPlaceHolder()) ?>" value="<?php echo $clientcontact->Notes->EditValue ?>"<?php echo $clientcontact->Notes->editAttributes() ?>>
</span>
<input type="hidden" data-table="clientcontact" data-field="x_Notes" name="o<?php echo $clientcontact_grid->RowIndex ?>_Notes" id="o<?php echo $clientcontact_grid->RowIndex ?>_Notes" value="<?php echo HtmlEncode($clientcontact->Notes->OldValue) ?>">
<?php } ?>
<?php if ($clientcontact->RowType == ROWTYPE_EDIT) { // Edit record ?>
<span id="el<?php echo $clientcontact_grid->RowCnt ?>_clientcontact_Notes" class="form-group clientcontact_Notes">
<input type="text" data-table="clientcontact" data-field="x_Notes" name="x<?php echo $clientcontact_grid->RowIndex ?>_Notes" id="x<?php echo $clientcontact_grid->RowIndex ?>_Notes" size="30" maxlength="100" placeholder="<?php echo HtmlEncode($clientcontact->Notes->getPlaceHolder()) ?>" value="<?php echo $clientcontact->Notes->EditValue ?>"<?php echo $clientcontact->Notes->editAttributes() ?>>
</span>
<?php } ?>
<?php if ($clientcontact->RowType == ROWTYPE_VIEW) { // View record ?>
<span id="el<?php echo $clientcontact_grid->RowCnt ?>_clientcontact_Notes" class="clientcontact_Notes">
<span<?php echo $clientcontact->Notes->viewAttributes() ?>>
<?php echo $clientcontact->Notes->getViewValue() ?></span>
</span>
<?php if (!$clientcontact->isConfirm()) { ?>
<input type="hidden" data-table="clientcontact" data-field="x_Notes" name="x<?php echo $clientcontact_grid->RowIndex ?>_Notes" id="x<?php echo $clientcontact_grid->RowIndex ?>_Notes" value="<?php echo HtmlEncode($clientcontact->Notes->FormValue) ?>">
<input type="hidden" data-table="clientcontact" data-field="x_Notes" name="o<?php echo $clientcontact_grid->RowIndex ?>_Notes" id="o<?php echo $clientcontact_grid->RowIndex ?>_Notes" value="<?php echo HtmlEncode($clientcontact->Notes->OldValue) ?>">
<?php } else { ?>
<input type="hidden" data-table="clientcontact" data-field="x_Notes" name="fclientcontactgrid$x<?php echo $clientcontact_grid->RowIndex ?>_Notes" id="fclientcontactgrid$x<?php echo $clientcontact_grid->RowIndex ?>_Notes" value="<?php echo HtmlEncode($clientcontact->Notes->FormValue) ?>">
<input type="hidden" data-table="clientcontact" data-field="x_Notes" name="fclientcontactgrid$o<?php echo $clientcontact_grid->RowIndex ?>_Notes" id="fclientcontactgrid$o<?php echo $clientcontact_grid->RowIndex ?>_Notes" value="<?php echo HtmlEncode($clientcontact->Notes->OldValue) ?>">
<?php } ?>
<?php } ?>
</td>
	<?php } ?>
	<?php if ($clientcontact->Primary->Visible) { // Primary ?>
		<td data-name="Primary"<?php echo $clientcontact->Primary->cellAttributes() ?>>
<?php if ($clientcontact->RowType == ROWTYPE_ADD) { // Add record ?>
<span id="el<?php echo $clientcontact_grid->RowCnt ?>_clientcontact_Primary" class="form-group clientcontact_Primary">
<?php
$selwrk = (ConvertToBool($clientcontact->Primary->CurrentValue)) ? " checked" : "";
?>
<input type="checkbox" data-table="clientcontact" data-field="x_Primary" name="x<?php echo $clientcontact_grid->RowIndex ?>_Primary[]" id="x<?php echo $clientcontact_grid->RowIndex ?>_Primary[]" value="1"<?php echo $selwrk ?><?php echo $clientcontact->Primary->editAttributes() ?>>
</span>
<input type="hidden" data-table="clientcontact" data-field="x_Primary" name="o<?php echo $clientcontact_grid->RowIndex ?>_Primary[]" id="o<?php echo $clientcontact_grid->RowIndex ?>_Primary[]" value="<?php echo HtmlEncode($clientcontact->Primary->OldValue) ?>">
<?php } ?>
<?php if ($clientcontact->RowType == ROWTYPE_EDIT) { // Edit record ?>
<span id="el<?php echo $clientcontact_grid->RowCnt ?>_clientcontact_Primary" class="form-group clientcontact_Primary">
<?php
$selwrk = (ConvertToBool($clientcontact->Primary->CurrentValue)) ? " checked" : "";
?>
<input type="checkbox" data-table="clientcontact" data-field="x_Primary" name="x<?php echo $clientcontact_grid->RowIndex ?>_Primary[]" id="x<?php echo $clientcontact_grid->RowIndex ?>_Primary[]" value="1"<?php echo $selwrk ?><?php echo $clientcontact->Primary->editAttributes() ?>>
</span>
<?php } ?>
<?php if ($clientcontact->RowType == ROWTYPE_VIEW) { // View record ?>
<span id="el<?php echo $clientcontact_grid->RowCnt ?>_clientcontact_Primary" class="clientcontact_Primary">
<span<?php echo $clientcontact->Primary->viewAttributes() ?>>
<?php if (ConvertToBool($clientcontact->Primary->CurrentValue)) { ?>
<input type="checkbox" value="<?php echo $clientcontact->Primary->getViewValue() ?>" disabled checked>
<?php } else { ?>
<input type="checkbox" value="<?php echo $clientcontact->Primary->getViewValue() ?>" disabled>
<?php } ?>
</span>
</span>
<?php if (!$clientcontact->isConfirm()) { ?>
<input type="hidden" data-table="clientcontact" data-field="x_Primary" name="x<?php echo $clientcontact_grid->RowIndex ?>_Primary" id="x<?php echo $clientcontact_grid->RowIndex ?>_Primary" value="<?php echo HtmlEncode($clientcontact->Primary->FormValue) ?>">
<input type="hidden" data-table="clientcontact" data-field="x_Primary" name="o<?php echo $clientcontact_grid->RowIndex ?>_Primary[]" id="o<?php echo $clientcontact_grid->RowIndex ?>_Primary[]" value="<?php echo HtmlEncode($clientcontact->Primary->OldValue) ?>">
<?php } else { ?>
<input type="hidden" data-table="clientcontact" data-field="x_Primary" name="fclientcontactgrid$x<?php echo $clientcontact_grid->RowIndex ?>_Primary" id="fclientcontactgrid$x<?php echo $clientcontact_grid->RowIndex ?>_Primary" value="<?php echo HtmlEncode($clientcontact->Primary->FormValue) ?>">
<input type="hidden" data-table="clientcontact" data-field="x_Primary" name="fclientcontactgrid$o<?php echo $clientcontact_grid->RowIndex ?>_Primary[]" id="fclientcontactgrid$o<?php echo $clientcontact_grid->RowIndex ?>_Primary[]" value="<?php echo HtmlEncode($clientcontact->Primary->OldValue) ?>">
<?php } ?>
<?php } ?>
</td>
	<?php } ?>
<?php

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

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

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

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

// Render list options (body, left)
$clientcontact_grid->ListOptions->render("body", "left", $clientcontact_grid->RowIndex);
?>
	<?php if ($clientcontact->ClientID->Visible) { // ClientID ?>
		<td data-name="ClientID">
<?php if (!$clientcontact->isConfirm()) { ?>
<?php if ($clientcontact->ClientID->getSessionValue() <> "") { ?>
<span id="el$rowindex$_clientcontact_ClientID" class="form-group clientcontact_ClientID">
<span<?php echo $clientcontact->ClientID->viewAttributes() ?>>
<input type="text" readonly class="form-control-plaintext" value="<?php echo RemoveHtml($clientcontact->ClientID->ViewValue) ?>"></span>
</span>
<input type="hidden" id="x<?php echo $clientcontact_grid->RowIndex ?>_ClientID" name="x<?php echo $clientcontact_grid->RowIndex ?>_ClientID" value="<?php echo HtmlEncode($clientcontact->ClientID->CurrentValue) ?>">
<?php } else { ?>
<span id="el$rowindex$_clientcontact_ClientID" class="form-group clientcontact_ClientID">
<div class="input-group">
	<select class="custom-select ew-custom-select" data-table="clientcontact" data-field="x_ClientID" data-value-separator="<?php echo $clientcontact->ClientID->displayValueSeparatorAttribute() ?>" id="x<?php echo $clientcontact_grid->RowIndex ?>_ClientID" name="x<?php echo $clientcontact_grid->RowIndex ?>_ClientID"<?php echo $clientcontact->ClientID->editAttributes() ?>>
		<?php echo $clientcontact->ClientID->selectOptionListHtml("x<?php echo $clientcontact_grid->RowIndex ?>_ClientID") ?>
	</select>
</div>
<?php echo $clientcontact->ClientID->Lookup->getParamTag("p_x" . $clientcontact_grid->RowIndex . "_ClientID") ?>
</span>
<?php } ?>
<?php } else { ?>
<span id="el$rowindex$_clientcontact_ClientID" class="form-group clientcontact_ClientID">
<span<?php echo $clientcontact->ClientID->viewAttributes() ?>>
<input type="text" readonly class="form-control-plaintext" value="<?php echo RemoveHtml($clientcontact->ClientID->ViewValue) ?>"></span>
</span>
<input type="hidden" data-table="clientcontact" data-field="x_ClientID" name="x<?php echo $clientcontact_grid->RowIndex ?>_ClientID" id="x<?php echo $clientcontact_grid->RowIndex ?>_ClientID" value="<?php echo HtmlEncode($clientcontact->ClientID->FormValue) ?>">
<?php } ?>
<input type="hidden" data-table="clientcontact" data-field="x_ClientID" name="o<?php echo $clientcontact_grid->RowIndex ?>_ClientID" id="o<?php echo $clientcontact_grid->RowIndex ?>_ClientID" value="<?php echo HtmlEncode($clientcontact->ClientID->OldValue) ?>">
</td>
	<?php } ?>
	<?php if ($clientcontact->ContactTypeID->Visible) { // ContactTypeID ?>
		<td data-name="ContactTypeID">
<?php if (!$clientcontact->isConfirm()) { ?>
<span id="el$rowindex$_clientcontact_ContactTypeID" class="form-group clientcontact_ContactTypeID">
<div class="input-group">
	<select class="custom-select ew-custom-select" data-table="clientcontact" data-field="x_ContactTypeID" data-value-separator="<?php echo $clientcontact->ContactTypeID->displayValueSeparatorAttribute() ?>" id="x<?php echo $clientcontact_grid->RowIndex ?>_ContactTypeID" name="x<?php echo $clientcontact_grid->RowIndex ?>_ContactTypeID"<?php echo $clientcontact->ContactTypeID->editAttributes() ?>>
		<?php echo $clientcontact->ContactTypeID->selectOptionListHtml("x<?php echo $clientcontact_grid->RowIndex ?>_ContactTypeID") ?>
	</select>
</div>
<?php echo $clientcontact->ContactTypeID->Lookup->getParamTag("p_x" . $clientcontact_grid->RowIndex . "_ContactTypeID") ?>
</span>
<?php } else { ?>
<span id="el$rowindex$_clientcontact_ContactTypeID" class="form-group clientcontact_ContactTypeID">
<span<?php echo $clientcontact->ContactTypeID->viewAttributes() ?>>
<input type="text" readonly class="form-control-plaintext" value="<?php echo RemoveHtml($clientcontact->ContactTypeID->ViewValue) ?>"></span>
</span>
<input type="hidden" data-table="clientcontact" data-field="x_ContactTypeID" name="x<?php echo $clientcontact_grid->RowIndex ?>_ContactTypeID" id="x<?php echo $clientcontact_grid->RowIndex ?>_ContactTypeID" value="<?php echo HtmlEncode($clientcontact->ContactTypeID->FormValue) ?>">
<?php } ?>
<input type="hidden" data-table="clientcontact" data-field="x_ContactTypeID" name="o<?php echo $clientcontact_grid->RowIndex ?>_ContactTypeID" id="o<?php echo $clientcontact_grid->RowIndex ?>_ContactTypeID" value="<?php echo HtmlEncode($clientcontact->ContactTypeID->OldValue) ?>">
</td>
	<?php } ?>
	<?php if ($clientcontact->Contact->Visible) { // Contact ?>
		<td data-name="Contact">
<?php if (!$clientcontact->isConfirm()) { ?>
<span id="el$rowindex$_clientcontact_Contact" class="form-group clientcontact_Contact">
<input type="text" data-table="clientcontact" data-field="x_Contact" name="x<?php echo $clientcontact_grid->RowIndex ?>_Contact" id="x<?php echo $clientcontact_grid->RowIndex ?>_Contact" size="30" maxlength="50" placeholder="<?php echo HtmlEncode($clientcontact->Contact->getPlaceHolder()) ?>" value="<?php echo $clientcontact->Contact->EditValue ?>"<?php echo $clientcontact->Contact->editAttributes() ?>>
</span>
<?php } else { ?>
<span id="el$rowindex$_clientcontact_Contact" class="form-group clientcontact_Contact">
<span<?php echo $clientcontact->Contact->viewAttributes() ?>>
<?php if ((!EmptyString($clientcontact->Contact->ViewValue)) && $clientcontact->Contact->linkAttributes() <> "") { ?>
<a<?php echo $clientcontact->Contact->linkAttributes() ?>><input type="text" readonly class="form-control-plaintext" value="<?php echo RemoveHtml($clientcontact->Contact->ViewValue) ?>"></a>
<?php } else { ?>
<input type="text" readonly class="form-control-plaintext" value="<?php echo RemoveHtml($clientcontact->Contact->ViewValue) ?>">
<?php } ?>
</span>
</span>
<input type="hidden" data-table="clientcontact" data-field="x_Contact" name="x<?php echo $clientcontact_grid->RowIndex ?>_Contact" id="x<?php echo $clientcontact_grid->RowIndex ?>_Contact" value="<?php echo HtmlEncode($clientcontact->Contact->FormValue) ?>">
<?php } ?>
<input type="hidden" data-table="clientcontact" data-field="x_Contact" name="o<?php echo $clientcontact_grid->RowIndex ?>_Contact" id="o<?php echo $clientcontact_grid->RowIndex ?>_Contact" value="<?php echo HtmlEncode($clientcontact->Contact->OldValue) ?>">
</td>
	<?php } ?>
	<?php if ($clientcontact->Notes->Visible) { // Notes ?>
		<td data-name="Notes">
<?php if (!$clientcontact->isConfirm()) { ?>
<span id="el$rowindex$_clientcontact_Notes" class="form-group clientcontact_Notes">
<input type="text" data-table="clientcontact" data-field="x_Notes" name="x<?php echo $clientcontact_grid->RowIndex ?>_Notes" id="x<?php echo $clientcontact_grid->RowIndex ?>_Notes" size="30" maxlength="100" placeholder="<?php echo HtmlEncode($clientcontact->Notes->getPlaceHolder()) ?>" value="<?php echo $clientcontact->Notes->EditValue ?>"<?php echo $clientcontact->Notes->editAttributes() ?>>
</span>
<?php } else { ?>
<span id="el$rowindex$_clientcontact_Notes" class="form-group clientcontact_Notes">
<span<?php echo $clientcontact->Notes->viewAttributes() ?>>
<input type="text" readonly class="form-control-plaintext" value="<?php echo RemoveHtml($clientcontact->Notes->ViewValue) ?>"></span>
</span>
<input type="hidden" data-table="clientcontact" data-field="x_Notes" name="x<?php echo $clientcontact_grid->RowIndex ?>_Notes" id="x<?php echo $clientcontact_grid->RowIndex ?>_Notes" value="<?php echo HtmlEncode($clientcontact->Notes->FormValue) ?>">
<?php } ?>
<input type="hidden" data-table="clientcontact" data-field="x_Notes" name="o<?php echo $clientcontact_grid->RowIndex ?>_Notes" id="o<?php echo $clientcontact_grid->RowIndex ?>_Notes" value="<?php echo HtmlEncode($clientcontact->Notes->OldValue) ?>">
</td>
	<?php } ?>
	<?php if ($clientcontact->Primary->Visible) { // Primary ?>
		<td data-name="Primary">
<?php if (!$clientcontact->isConfirm()) { ?>
<span id="el$rowindex$_clientcontact_Primary" class="form-group clientcontact_Primary">
<?php
$selwrk = (ConvertToBool($clientcontact->Primary->CurrentValue)) ? " checked" : "";
?>
<input type="checkbox" data-table="clientcontact" data-field="x_Primary" name="x<?php echo $clientcontact_grid->RowIndex ?>_Primary[]" id="x<?php echo $clientcontact_grid->RowIndex ?>_Primary[]" value="1"<?php echo $selwrk ?><?php echo $clientcontact->Primary->editAttributes() ?>>
</span>
<?php } else { ?>
<span id="el$rowindex$_clientcontact_Primary" class="form-group clientcontact_Primary">
<span<?php echo $clientcontact->Primary->viewAttributes() ?>>
<?php if (ConvertToBool($clientcontact->Primary->CurrentValue)) { ?>
<input type="checkbox" value="<?php echo $clientcontact->Primary->ViewValue ?>" disabled checked>
<?php } else { ?>
<input type="checkbox" value="<?php echo $clientcontact->Primary->ViewValue ?>" disabled>
<?php } ?>
</span>
</span>
<input type="hidden" data-table="clientcontact" data-field="x_Primary" name="x<?php echo $clientcontact_grid->RowIndex ?>_Primary" id="x<?php echo $clientcontact_grid->RowIndex ?>_Primary" value="<?php echo HtmlEncode($clientcontact->Primary->FormValue) ?>">
<?php } ?>
<input type="hidden" data-table="clientcontact" data-field="x_Primary" name="o<?php echo $clientcontact_grid->RowIndex ?>_Primary[]" id="o<?php echo $clientcontact_grid->RowIndex ?>_Primary[]" value="<?php echo HtmlEncode($clientcontact->Primary->OldValue) ?>">
</td>
	<?php } ?>
<?php

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

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