<?php
namespace PHPMaker2020\project2;

// 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
$kp_logs_edit = new kp_logs_edit();

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

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

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

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

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

	// Validate form
	fkp_logsedit.validate = function() {
		if (!this.validateRequired)
			return true; // Ignore validation
		var $ = jQuery, fobj = this.getForm(), $fobj = $(fobj);
		if ($fobj.find("#confirm").val() == "F")
			return true;
		var elm, felm, uelm, addcnt = 0;
		var $k = $fobj.find("#" + this.formKeyCountName); // Get key_count
		var rowcnt = ($k[0]) ? parseInt($k.val(), 10) : 1;
		var startcnt = (rowcnt == 0) ? 0 : 1; // Check rowcnt == 0 => Inline-Add
		var gridinsert = ["insert", "gridinsert"].includes($fobj.find("#action").val()) && $k[0];
		for (var i = startcnt; i <= rowcnt; i++) {
			var infix = ($k[0]) ? String(i) : "";
			$fobj.data("rowindex", infix);
			<?php if ($kp_logs_edit->id->Required) { ?>
				elm = this.getElements("x" + infix + "_id");
				if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
					return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $kp_logs_edit->id->caption(), $kp_logs_edit->id->RequiredErrorMessage)) ?>");
			<?php } ?>
			<?php if ($kp_logs_edit->tipo->Required) { ?>
				elm = this.getElements("x" + infix + "_tipo");
				if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
					return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $kp_logs_edit->tipo->caption(), $kp_logs_edit->tipo->RequiredErrorMessage)) ?>");
			<?php } ?>
			<?php if ($kp_logs_edit->detalle->Required) { ?>
				elm = this.getElements("x" + infix + "_detalle");
				if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
					return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $kp_logs_edit->detalle->caption(), $kp_logs_edit->detalle->RequiredErrorMessage)) ?>");
			<?php } ?>
			<?php if ($kp_logs_edit->codlogin->Required) { ?>
				elm = this.getElements("x" + infix + "_codlogin");
				if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
					return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $kp_logs_edit->codlogin->caption(), $kp_logs_edit->codlogin->RequiredErrorMessage)) ?>");
			<?php } ?>
			<?php if ($kp_logs_edit->ip->Required) { ?>
				elm = this.getElements("x" + infix + "_ip");
				if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
					return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $kp_logs_edit->ip->caption(), $kp_logs_edit->ip->RequiredErrorMessage)) ?>");
			<?php } ?>
			<?php if ($kp_logs_edit->alerta->Required) { ?>
				elm = this.getElements("x" + infix + "_alerta[]");
				if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
					return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $kp_logs_edit->alerta->caption(), $kp_logs_edit->alerta->RequiredErrorMessage)) ?>");
			<?php } ?>
			<?php if ($kp_logs_edit->valoranterior->Required) { ?>
				elm = this.getElements("x" + infix + "_valoranterior");
				if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
					return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $kp_logs_edit->valoranterior->caption(), $kp_logs_edit->valoranterior->RequiredErrorMessage)) ?>");
			<?php } ?>
			<?php if ($kp_logs_edit->valoractual->Required) { ?>
				elm = this.getElements("x" + infix + "_valoractual");
				if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
					return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $kp_logs_edit->valoractual->caption(), $kp_logs_edit->valoractual->RequiredErrorMessage)) ?>");
			<?php } ?>

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

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

	// Form_CustomValidate
	fkp_logsedit.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
	fkp_logsedit.validateRequired = <?php echo Config("CLIENT_VALIDATE") ? "true" : "false" ?>;

	// Dynamic selection lists
	fkp_logsedit.lists["x_alerta[]"] = <?php echo $kp_logs_edit->alerta->Lookup->toClientList($kp_logs_edit) ?>;
	fkp_logsedit.lists["x_alerta[]"].options = <?php echo JsonEncode($kp_logs_edit->alerta->options(FALSE, TRUE)) ?>;
	loadjs.done("fkp_logsedit");
});
</script>
<script>
loadjs.ready("head", function() {

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

});
</script>
<?php $kp_logs_edit->showPageHeader(); ?>
<?php
$kp_logs_edit->showMessage();
?>
<form name="fkp_logsedit" id="fkp_logsedit" class="<?php echo $kp_logs_edit->FormClassName ?>" action="<?php echo CurrentPageName() ?>" method="post">
<?php if ($Page->CheckToken) { ?>
<input type="hidden" name="<?php echo Config("TOKEN_NAME") ?>" value="<?php echo $Page->Token ?>">
<?php } ?>
<input type="hidden" name="t" value="kp_logs">
<input type="hidden" name="action" id="action" value="update">
<input type="hidden" name="modal" value="<?php echo (int)$kp_logs_edit->IsModal ?>">
<div class="ew-edit-div"><!-- page* -->
<?php if ($kp_logs_edit->id->Visible) { // id ?>
	<div id="r_id" class="form-group row">
		<label id="elh_kp_logs_id" class="<?php echo $kp_logs_edit->LeftColumnClass ?>"><?php echo $kp_logs_edit->id->caption() ?><?php echo $kp_logs_edit->id->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $kp_logs_edit->RightColumnClass ?>"><div <?php echo $kp_logs_edit->id->cellAttributes() ?>>
<span id="el_kp_logs_id">
<span<?php echo $kp_logs_edit->id->viewAttributes() ?>><input type="text" readonly class="form-control-plaintext" value="<?php echo HtmlEncode(RemoveHtml($kp_logs_edit->id->EditValue)) ?>"></span>
</span>
<input type="hidden" data-table="kp_logs" data-field="x_id" name="x_id" id="x_id" value="<?php echo HtmlEncode($kp_logs_edit->id->CurrentValue) ?>">
<?php echo $kp_logs_edit->id->CustomMsg ?></div></div>
	</div>
<?php } ?>
<?php if ($kp_logs_edit->tipo->Visible) { // tipo ?>
	<div id="r_tipo" class="form-group row">
		<label id="elh_kp_logs_tipo" for="x_tipo" class="<?php echo $kp_logs_edit->LeftColumnClass ?>"><?php echo $kp_logs_edit->tipo->caption() ?><?php echo $kp_logs_edit->tipo->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $kp_logs_edit->RightColumnClass ?>"><div <?php echo $kp_logs_edit->tipo->cellAttributes() ?>>
<span id="el_kp_logs_tipo">
<input type="text" data-table="kp_logs" data-field="x_tipo" name="x_tipo" id="x_tipo" size="30" maxlength="50" placeholder="<?php echo HtmlEncode($kp_logs_edit->tipo->getPlaceHolder()) ?>" value="<?php echo $kp_logs_edit->tipo->EditValue ?>"<?php echo $kp_logs_edit->tipo->editAttributes() ?>>
</span>
<?php echo $kp_logs_edit->tipo->CustomMsg ?></div></div>
	</div>
<?php } ?>
<?php if ($kp_logs_edit->detalle->Visible) { // detalle ?>
	<div id="r_detalle" class="form-group row">
		<label id="elh_kp_logs_detalle" for="x_detalle" class="<?php echo $kp_logs_edit->LeftColumnClass ?>"><?php echo $kp_logs_edit->detalle->caption() ?><?php echo $kp_logs_edit->detalle->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $kp_logs_edit->RightColumnClass ?>"><div <?php echo $kp_logs_edit->detalle->cellAttributes() ?>>
<span id="el_kp_logs_detalle">
<textarea data-table="kp_logs" data-field="x_detalle" name="x_detalle" id="x_detalle" cols="35" rows="4" placeholder="<?php echo HtmlEncode($kp_logs_edit->detalle->getPlaceHolder()) ?>"<?php echo $kp_logs_edit->detalle->editAttributes() ?>><?php echo $kp_logs_edit->detalle->EditValue ?></textarea>
</span>
<?php echo $kp_logs_edit->detalle->CustomMsg ?></div></div>
	</div>
<?php } ?>
<?php if ($kp_logs_edit->codlogin->Visible) { // codlogin ?>
	<div id="r_codlogin" class="form-group row">
		<label id="elh_kp_logs_codlogin" for="x_codlogin" class="<?php echo $kp_logs_edit->LeftColumnClass ?>"><?php echo $kp_logs_edit->codlogin->caption() ?><?php echo $kp_logs_edit->codlogin->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $kp_logs_edit->RightColumnClass ?>"><div <?php echo $kp_logs_edit->codlogin->cellAttributes() ?>>
<span id="el_kp_logs_codlogin">
<input type="text" data-table="kp_logs" data-field="x_codlogin" name="x_codlogin" id="x_codlogin" size="30" maxlength="12" placeholder="<?php echo HtmlEncode($kp_logs_edit->codlogin->getPlaceHolder()) ?>" value="<?php echo $kp_logs_edit->codlogin->EditValue ?>"<?php echo $kp_logs_edit->codlogin->editAttributes() ?>>
</span>
<?php echo $kp_logs_edit->codlogin->CustomMsg ?></div></div>
	</div>
<?php } ?>
<?php if ($kp_logs_edit->ip->Visible) { // ip ?>
	<div id="r_ip" class="form-group row">
		<label id="elh_kp_logs_ip" for="x_ip" class="<?php echo $kp_logs_edit->LeftColumnClass ?>"><?php echo $kp_logs_edit->ip->caption() ?><?php echo $kp_logs_edit->ip->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $kp_logs_edit->RightColumnClass ?>"><div <?php echo $kp_logs_edit->ip->cellAttributes() ?>>
<span id="el_kp_logs_ip">
<input type="text" data-table="kp_logs" data-field="x_ip" name="x_ip" id="x_ip" size="30" maxlength="40" placeholder="<?php echo HtmlEncode($kp_logs_edit->ip->getPlaceHolder()) ?>" value="<?php echo $kp_logs_edit->ip->EditValue ?>"<?php echo $kp_logs_edit->ip->editAttributes() ?>>
</span>
<?php echo $kp_logs_edit->ip->CustomMsg ?></div></div>
	</div>
<?php } ?>
<?php if ($kp_logs_edit->alerta->Visible) { // alerta ?>
	<div id="r_alerta" class="form-group row">
		<label id="elh_kp_logs_alerta" class="<?php echo $kp_logs_edit->LeftColumnClass ?>"><?php echo $kp_logs_edit->alerta->caption() ?><?php echo $kp_logs_edit->alerta->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $kp_logs_edit->RightColumnClass ?>"><div <?php echo $kp_logs_edit->alerta->cellAttributes() ?>>
<span id="el_kp_logs_alerta">
<?php
$selwrk = ConvertToBool($kp_logs_edit->alerta->CurrentValue) ? " checked" : "";
?>
<div class="custom-control custom-checkbox d-inline-block">
	<input type="checkbox" class="custom-control-input" data-table="kp_logs" data-field="x_alerta" name="x_alerta[]" id="x_alerta[]" value="1"<?php echo $selwrk ?><?php echo $kp_logs_edit->alerta->editAttributes() ?>>
	<label class="custom-control-label" for="x_alerta[]"></label>
</div>
</span>
<?php echo $kp_logs_edit->alerta->CustomMsg ?></div></div>
	</div>
<?php } ?>
<?php if ($kp_logs_edit->valoranterior->Visible) { // valoranterior ?>
	<div id="r_valoranterior" class="form-group row">
		<label id="elh_kp_logs_valoranterior" for="x_valoranterior" class="<?php echo $kp_logs_edit->LeftColumnClass ?>"><?php echo $kp_logs_edit->valoranterior->caption() ?><?php echo $kp_logs_edit->valoranterior->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $kp_logs_edit->RightColumnClass ?>"><div <?php echo $kp_logs_edit->valoranterior->cellAttributes() ?>>
<span id="el_kp_logs_valoranterior">
<textarea data-table="kp_logs" data-field="x_valoranterior" name="x_valoranterior" id="x_valoranterior" cols="35" rows="4" placeholder="<?php echo HtmlEncode($kp_logs_edit->valoranterior->getPlaceHolder()) ?>"<?php echo $kp_logs_edit->valoranterior->editAttributes() ?>><?php echo $kp_logs_edit->valoranterior->EditValue ?></textarea>
</span>
<?php echo $kp_logs_edit->valoranterior->CustomMsg ?></div></div>
	</div>
<?php } ?>
<?php if ($kp_logs_edit->valoractual->Visible) { // valoractual ?>
	<div id="r_valoractual" class="form-group row">
		<label id="elh_kp_logs_valoractual" for="x_valoractual" class="<?php echo $kp_logs_edit->LeftColumnClass ?>"><?php echo $kp_logs_edit->valoractual->caption() ?><?php echo $kp_logs_edit->valoractual->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $kp_logs_edit->RightColumnClass ?>"><div <?php echo $kp_logs_edit->valoractual->cellAttributes() ?>>
<span id="el_kp_logs_valoractual">
<textarea data-table="kp_logs" data-field="x_valoractual" name="x_valoractual" id="x_valoractual" cols="35" rows="4" placeholder="<?php echo HtmlEncode($kp_logs_edit->valoractual->getPlaceHolder()) ?>"<?php echo $kp_logs_edit->valoractual->editAttributes() ?>><?php echo $kp_logs_edit->valoractual->EditValue ?></textarea>
</span>
<?php echo $kp_logs_edit->valoractual->CustomMsg ?></div></div>
	</div>
<?php } ?>
</div><!-- /page* -->
<?php if (!$kp_logs_edit->IsModal) { ?>
<div class="form-group row"><!-- buttons .form-group -->
	<div class="<?php echo $kp_logs_edit->OffsetColumnClass ?>"><!-- buttons offset -->
<button class="btn btn-primary ew-btn" name="btn-action" id="btn-action" type="submit"><?php echo $Language->phrase("SaveBtn") ?></button>
<button class="btn btn-default ew-btn" name="btn-cancel" id="btn-cancel" type="button" data-href="<?php echo $kp_logs_edit->getReturnUrl() ?>"><?php echo $Language->phrase("CancelBtn") ?></button>
	</div><!-- /buttons offset -->
</div><!-- /buttons .form-group -->
<?php } ?>
</form>
<?php
$kp_logs_edit->showPageFooter();
if (Config("DEBUG"))
	echo GetDebugMessage();
?>
<script>
loadjs.ready("load", function() {

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

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