<?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_permiso_add = new kp_permiso_add();

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

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

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

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

	// Form object
	currentPageID = ew.PAGE_ID = "add";
	fkp_permisoadd = currentForm = new ew.Form("fkp_permisoadd", "add");

	// Validate form
	fkp_permisoadd.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_permiso_add->idperfil->Required) { ?>
				elm = this.getElements("x" + infix + "_idperfil");
				if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
					return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $kp_permiso_add->idperfil->caption(), $kp_permiso_add->idperfil->RequiredErrorMessage)) ?>");
			<?php } ?>
				elm = this.getElements("x" + infix + "_idperfil");
				if (elm && !ew.checkInteger(elm.value))
					return this.onError(elm, "<?php echo JsEncode($kp_permiso_add->idperfil->errorMessage()) ?>");
			<?php if ($kp_permiso_add->idmodulo->Required) { ?>
				elm = this.getElements("x" + infix + "_idmodulo");
				if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
					return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $kp_permiso_add->idmodulo->caption(), $kp_permiso_add->idmodulo->RequiredErrorMessage)) ?>");
			<?php } ?>
			<?php if ($kp_permiso_add->listarpermiso->Required) { ?>
				elm = this.getElements("x" + infix + "_listarpermiso");
				if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
					return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $kp_permiso_add->listarpermiso->caption(), $kp_permiso_add->listarpermiso->RequiredErrorMessage)) ?>");
			<?php } ?>
			<?php if ($kp_permiso_add->registrarpermiso->Required) { ?>
				elm = this.getElements("x" + infix + "_registrarpermiso");
				if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
					return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $kp_permiso_add->registrarpermiso->caption(), $kp_permiso_add->registrarpermiso->RequiredErrorMessage)) ?>");
			<?php } ?>
			<?php if ($kp_permiso_add->editarpermiso->Required) { ?>
				elm = this.getElements("x" + infix + "_editarpermiso");
				if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
					return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $kp_permiso_add->editarpermiso->caption(), $kp_permiso_add->editarpermiso->RequiredErrorMessage)) ?>");
			<?php } ?>
			<?php if ($kp_permiso_add->eliminarpermiso->Required) { ?>
				elm = this.getElements("x" + infix + "_eliminarpermiso");
				if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
					return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $kp_permiso_add->eliminarpermiso->caption(), $kp_permiso_add->eliminarpermiso->RequiredErrorMessage)) ?>");
			<?php } ?>
			<?php if ($kp_permiso_add->exportarpermiso->Required) { ?>
				elm = this.getElements("x" + infix + "_exportarpermiso");
				if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
					return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $kp_permiso_add->exportarpermiso->caption(), $kp_permiso_add->exportarpermiso->RequiredErrorMessage)) ?>");
			<?php } ?>
			<?php if ($kp_permiso_add->importarpermiso->Required) { ?>
				elm = this.getElements("x" + infix + "_importarpermiso");
				if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
					return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $kp_permiso_add->importarpermiso->caption(), $kp_permiso_add->importarpermiso->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_permisoadd.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_permisoadd.validateRequired = <?php echo Config("CLIENT_VALIDATE") ? "true" : "false" ?>;

	// Dynamic selection lists
	loadjs.done("fkp_permisoadd");
});
</script>
<script>
loadjs.ready("head", function() {

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

});
</script>
<?php $kp_permiso_add->showPageHeader(); ?>
<?php
$kp_permiso_add->showMessage();
?>
<form name="fkp_permisoadd" id="fkp_permisoadd" class="<?php echo $kp_permiso_add->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_permiso">
<input type="hidden" name="action" id="action" value="insert">
<input type="hidden" name="modal" value="<?php echo (int)$kp_permiso_add->IsModal ?>">
<div class="ew-add-div"><!-- page* -->
<?php if ($kp_permiso_add->idperfil->Visible) { // idperfil ?>
	<div id="r_idperfil" class="form-group row">
		<label id="elh_kp_permiso_idperfil" for="x_idperfil" class="<?php echo $kp_permiso_add->LeftColumnClass ?>"><?php echo $kp_permiso_add->idperfil->caption() ?><?php echo $kp_permiso_add->idperfil->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $kp_permiso_add->RightColumnClass ?>"><div <?php echo $kp_permiso_add->idperfil->cellAttributes() ?>>
<span id="el_kp_permiso_idperfil">
<input type="text" data-table="kp_permiso" data-field="x_idperfil" name="x_idperfil" id="x_idperfil" size="30" maxlength="11" placeholder="<?php echo HtmlEncode($kp_permiso_add->idperfil->getPlaceHolder()) ?>" value="<?php echo $kp_permiso_add->idperfil->EditValue ?>"<?php echo $kp_permiso_add->idperfil->editAttributes() ?>>
</span>
<?php echo $kp_permiso_add->idperfil->CustomMsg ?></div></div>
	</div>
<?php } ?>
<?php if ($kp_permiso_add->idmodulo->Visible) { // idmodulo ?>
	<div id="r_idmodulo" class="form-group row">
		<label id="elh_kp_permiso_idmodulo" for="x_idmodulo" class="<?php echo $kp_permiso_add->LeftColumnClass ?>"><?php echo $kp_permiso_add->idmodulo->caption() ?><?php echo $kp_permiso_add->idmodulo->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $kp_permiso_add->RightColumnClass ?>"><div <?php echo $kp_permiso_add->idmodulo->cellAttributes() ?>>
<span id="el_kp_permiso_idmodulo">
<input type="text" data-table="kp_permiso" data-field="x_idmodulo" name="x_idmodulo" id="x_idmodulo" size="30" maxlength="5" placeholder="<?php echo HtmlEncode($kp_permiso_add->idmodulo->getPlaceHolder()) ?>" value="<?php echo $kp_permiso_add->idmodulo->EditValue ?>"<?php echo $kp_permiso_add->idmodulo->editAttributes() ?>>
</span>
<?php echo $kp_permiso_add->idmodulo->CustomMsg ?></div></div>
	</div>
<?php } ?>
<?php if ($kp_permiso_add->listarpermiso->Visible) { // listarpermiso ?>
	<div id="r_listarpermiso" class="form-group row">
		<label id="elh_kp_permiso_listarpermiso" for="x_listarpermiso" class="<?php echo $kp_permiso_add->LeftColumnClass ?>"><?php echo $kp_permiso_add->listarpermiso->caption() ?><?php echo $kp_permiso_add->listarpermiso->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $kp_permiso_add->RightColumnClass ?>"><div <?php echo $kp_permiso_add->listarpermiso->cellAttributes() ?>>
<span id="el_kp_permiso_listarpermiso">
<input type="text" data-table="kp_permiso" data-field="x_listarpermiso" name="x_listarpermiso" id="x_listarpermiso" size="30" maxlength="1" placeholder="<?php echo HtmlEncode($kp_permiso_add->listarpermiso->getPlaceHolder()) ?>" value="<?php echo $kp_permiso_add->listarpermiso->EditValue ?>"<?php echo $kp_permiso_add->listarpermiso->editAttributes() ?>>
</span>
<?php echo $kp_permiso_add->listarpermiso->CustomMsg ?></div></div>
	</div>
<?php } ?>
<?php if ($kp_permiso_add->registrarpermiso->Visible) { // registrarpermiso ?>
	<div id="r_registrarpermiso" class="form-group row">
		<label id="elh_kp_permiso_registrarpermiso" for="x_registrarpermiso" class="<?php echo $kp_permiso_add->LeftColumnClass ?>"><?php echo $kp_permiso_add->registrarpermiso->caption() ?><?php echo $kp_permiso_add->registrarpermiso->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $kp_permiso_add->RightColumnClass ?>"><div <?php echo $kp_permiso_add->registrarpermiso->cellAttributes() ?>>
<span id="el_kp_permiso_registrarpermiso">
<input type="text" data-table="kp_permiso" data-field="x_registrarpermiso" name="x_registrarpermiso" id="x_registrarpermiso" size="30" maxlength="1" placeholder="<?php echo HtmlEncode($kp_permiso_add->registrarpermiso->getPlaceHolder()) ?>" value="<?php echo $kp_permiso_add->registrarpermiso->EditValue ?>"<?php echo $kp_permiso_add->registrarpermiso->editAttributes() ?>>
</span>
<?php echo $kp_permiso_add->registrarpermiso->CustomMsg ?></div></div>
	</div>
<?php } ?>
<?php if ($kp_permiso_add->editarpermiso->Visible) { // editarpermiso ?>
	<div id="r_editarpermiso" class="form-group row">
		<label id="elh_kp_permiso_editarpermiso" for="x_editarpermiso" class="<?php echo $kp_permiso_add->LeftColumnClass ?>"><?php echo $kp_permiso_add->editarpermiso->caption() ?><?php echo $kp_permiso_add->editarpermiso->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $kp_permiso_add->RightColumnClass ?>"><div <?php echo $kp_permiso_add->editarpermiso->cellAttributes() ?>>
<span id="el_kp_permiso_editarpermiso">
<input type="text" data-table="kp_permiso" data-field="x_editarpermiso" name="x_editarpermiso" id="x_editarpermiso" size="30" maxlength="1" placeholder="<?php echo HtmlEncode($kp_permiso_add->editarpermiso->getPlaceHolder()) ?>" value="<?php echo $kp_permiso_add->editarpermiso->EditValue ?>"<?php echo $kp_permiso_add->editarpermiso->editAttributes() ?>>
</span>
<?php echo $kp_permiso_add->editarpermiso->CustomMsg ?></div></div>
	</div>
<?php } ?>
<?php if ($kp_permiso_add->eliminarpermiso->Visible) { // eliminarpermiso ?>
	<div id="r_eliminarpermiso" class="form-group row">
		<label id="elh_kp_permiso_eliminarpermiso" for="x_eliminarpermiso" class="<?php echo $kp_permiso_add->LeftColumnClass ?>"><?php echo $kp_permiso_add->eliminarpermiso->caption() ?><?php echo $kp_permiso_add->eliminarpermiso->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $kp_permiso_add->RightColumnClass ?>"><div <?php echo $kp_permiso_add->eliminarpermiso->cellAttributes() ?>>
<span id="el_kp_permiso_eliminarpermiso">
<input type="text" data-table="kp_permiso" data-field="x_eliminarpermiso" name="x_eliminarpermiso" id="x_eliminarpermiso" size="30" maxlength="1" placeholder="<?php echo HtmlEncode($kp_permiso_add->eliminarpermiso->getPlaceHolder()) ?>" value="<?php echo $kp_permiso_add->eliminarpermiso->EditValue ?>"<?php echo $kp_permiso_add->eliminarpermiso->editAttributes() ?>>
</span>
<?php echo $kp_permiso_add->eliminarpermiso->CustomMsg ?></div></div>
	</div>
<?php } ?>
<?php if ($kp_permiso_add->exportarpermiso->Visible) { // exportarpermiso ?>
	<div id="r_exportarpermiso" class="form-group row">
		<label id="elh_kp_permiso_exportarpermiso" for="x_exportarpermiso" class="<?php echo $kp_permiso_add->LeftColumnClass ?>"><?php echo $kp_permiso_add->exportarpermiso->caption() ?><?php echo $kp_permiso_add->exportarpermiso->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $kp_permiso_add->RightColumnClass ?>"><div <?php echo $kp_permiso_add->exportarpermiso->cellAttributes() ?>>
<span id="el_kp_permiso_exportarpermiso">
<input type="text" data-table="kp_permiso" data-field="x_exportarpermiso" name="x_exportarpermiso" id="x_exportarpermiso" size="30" maxlength="1" placeholder="<?php echo HtmlEncode($kp_permiso_add->exportarpermiso->getPlaceHolder()) ?>" value="<?php echo $kp_permiso_add->exportarpermiso->EditValue ?>"<?php echo $kp_permiso_add->exportarpermiso->editAttributes() ?>>
</span>
<?php echo $kp_permiso_add->exportarpermiso->CustomMsg ?></div></div>
	</div>
<?php } ?>
<?php if ($kp_permiso_add->importarpermiso->Visible) { // importarpermiso ?>
	<div id="r_importarpermiso" class="form-group row">
		<label id="elh_kp_permiso_importarpermiso" for="x_importarpermiso" class="<?php echo $kp_permiso_add->LeftColumnClass ?>"><?php echo $kp_permiso_add->importarpermiso->caption() ?><?php echo $kp_permiso_add->importarpermiso->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $kp_permiso_add->RightColumnClass ?>"><div <?php echo $kp_permiso_add->importarpermiso->cellAttributes() ?>>
<span id="el_kp_permiso_importarpermiso">
<input type="text" data-table="kp_permiso" data-field="x_importarpermiso" name="x_importarpermiso" id="x_importarpermiso" size="30" maxlength="1" placeholder="<?php echo HtmlEncode($kp_permiso_add->importarpermiso->getPlaceHolder()) ?>" value="<?php echo $kp_permiso_add->importarpermiso->EditValue ?>"<?php echo $kp_permiso_add->importarpermiso->editAttributes() ?>>
</span>
<?php echo $kp_permiso_add->importarpermiso->CustomMsg ?></div></div>
	</div>
<?php } ?>
</div><!-- /page* -->
<?php if (!$kp_permiso_add->IsModal) { ?>
<div class="form-group row"><!-- buttons .form-group -->
	<div class="<?php echo $kp_permiso_add->OffsetColumnClass ?>"><!-- buttons offset -->
<button class="btn btn-primary ew-btn" name="btn-action" id="btn-action" type="submit"><?php echo $Language->phrase("AddBtn") ?></button>
<button class="btn btn-default ew-btn" name="btn-cancel" id="btn-cancel" type="button" data-href="<?php echo $kp_permiso_add->getReturnUrl() ?>"><?php echo $Language->phrase("CancelBtn") ?></button>
	</div><!-- /buttons offset -->
</div><!-- /buttons .form-group -->
<?php } ?>
</form>
<?php
$kp_permiso_add->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_permiso_add->terminate();
?>