<?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_categoria_add = new kp_categoria_add();

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

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

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

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

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

	// Validate form
	fkp_categoriaadd.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_categoria_add->titulo->Required) { ?>
				elm = this.getElements("x" + infix + "_titulo");
				if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
					return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $kp_categoria_add->titulo->caption(), $kp_categoria_add->titulo->RequiredErrorMessage)) ?>");
			<?php } ?>
			<?php if ($kp_categoria_add->nombre->Required) { ?>
				elm = this.getElements("x" + infix + "_nombre");
				if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
					return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $kp_categoria_add->nombre->caption(), $kp_categoria_add->nombre->RequiredErrorMessage)) ?>");
			<?php } ?>
			<?php if ($kp_categoria_add->desccategoria->Required) { ?>
				elm = this.getElements("x" + infix + "_desccategoria");
				if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
					return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $kp_categoria_add->desccategoria->caption(), $kp_categoria_add->desccategoria->RequiredErrorMessage)) ?>");
			<?php } ?>
			<?php if ($kp_categoria_add->estado->Required) { ?>
				elm = this.getElements("x" + infix + "_estado");
				if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
					return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $kp_categoria_add->estado->caption(), $kp_categoria_add->estado->RequiredErrorMessage)) ?>");
			<?php } ?>
				elm = this.getElements("x" + infix + "_estado");
				if (elm && !ew.checkInteger(elm.value))
					return this.onError(elm, "<?php echo JsEncode($kp_categoria_add->estado->errorMessage()) ?>");
			<?php if ($kp_categoria_add->acciones->Required) { ?>
				elm = this.getElements("x" + infix + "_acciones");
				if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
					return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $kp_categoria_add->acciones->caption(), $kp_categoria_add->acciones->RequiredErrorMessage)) ?>");
			<?php } ?>
				elm = this.getElements("x" + infix + "_acciones");
				if (elm && !ew.checkInteger(elm.value))
					return this.onError(elm, "<?php echo JsEncode($kp_categoria_add->acciones->errorMessage()) ?>");
			<?php if ($kp_categoria_add->video->Required) { ?>
				elm = this.getElements("x" + infix + "_video");
				if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
					return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $kp_categoria_add->video->caption(), $kp_categoria_add->video->RequiredErrorMessage)) ?>");
			<?php } ?>
			<?php if ($kp_categoria_add->foto->Required) { ?>
				elm = this.getElements("x" + infix + "_foto");
				if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
					return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $kp_categoria_add->foto->caption(), $kp_categoria_add->foto->RequiredErrorMessage)) ?>");
			<?php } ?>
			<?php if ($kp_categoria_add->url->Required) { ?>
				elm = this.getElements("x" + infix + "_url");
				if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
					return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $kp_categoria_add->url->caption(), $kp_categoria_add->url->RequiredErrorMessage)) ?>");
			<?php } ?>
			<?php if ($kp_categoria_add->status->Required) { ?>
				elm = this.getElements("x" + infix + "_status");
				if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
					return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $kp_categoria_add->status->caption(), $kp_categoria_add->status->RequiredErrorMessage)) ?>");
			<?php } ?>
				elm = this.getElements("x" + infix + "_status");
				if (elm && !ew.checkInteger(elm.value))
					return this.onError(elm, "<?php echo JsEncode($kp_categoria_add->status->errorMessage()) ?>");

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

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

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

});
</script>
<?php $kp_categoria_add->showPageHeader(); ?>
<?php
$kp_categoria_add->showMessage();
?>
<form name="fkp_categoriaadd" id="fkp_categoriaadd" class="<?php echo $kp_categoria_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_categoria">
<input type="hidden" name="action" id="action" value="insert">
<input type="hidden" name="modal" value="<?php echo (int)$kp_categoria_add->IsModal ?>">
<div class="ew-add-div"><!-- page* -->
<?php if ($kp_categoria_add->titulo->Visible) { // titulo ?>
	<div id="r_titulo" class="form-group row">
		<label id="elh_kp_categoria_titulo" for="x_titulo" class="<?php echo $kp_categoria_add->LeftColumnClass ?>"><?php echo $kp_categoria_add->titulo->caption() ?><?php echo $kp_categoria_add->titulo->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $kp_categoria_add->RightColumnClass ?>"><div <?php echo $kp_categoria_add->titulo->cellAttributes() ?>>
<span id="el_kp_categoria_titulo">
<input type="text" data-table="kp_categoria" data-field="x_titulo" name="x_titulo" id="x_titulo" size="30" maxlength="250" placeholder="<?php echo HtmlEncode($kp_categoria_add->titulo->getPlaceHolder()) ?>" value="<?php echo $kp_categoria_add->titulo->EditValue ?>"<?php echo $kp_categoria_add->titulo->editAttributes() ?>>
</span>
<?php echo $kp_categoria_add->titulo->CustomMsg ?></div></div>
	</div>
<?php } ?>
<?php if ($kp_categoria_add->nombre->Visible) { // nombre ?>
	<div id="r_nombre" class="form-group row">
		<label id="elh_kp_categoria_nombre" for="x_nombre" class="<?php echo $kp_categoria_add->LeftColumnClass ?>"><?php echo $kp_categoria_add->nombre->caption() ?><?php echo $kp_categoria_add->nombre->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $kp_categoria_add->RightColumnClass ?>"><div <?php echo $kp_categoria_add->nombre->cellAttributes() ?>>
<span id="el_kp_categoria_nombre">
<input type="text" data-table="kp_categoria" data-field="x_nombre" name="x_nombre" id="x_nombre" size="30" maxlength="250" placeholder="<?php echo HtmlEncode($kp_categoria_add->nombre->getPlaceHolder()) ?>" value="<?php echo $kp_categoria_add->nombre->EditValue ?>"<?php echo $kp_categoria_add->nombre->editAttributes() ?>>
</span>
<?php echo $kp_categoria_add->nombre->CustomMsg ?></div></div>
	</div>
<?php } ?>
<?php if ($kp_categoria_add->desccategoria->Visible) { // desccategoria ?>
	<div id="r_desccategoria" class="form-group row">
		<label id="elh_kp_categoria_desccategoria" for="x_desccategoria" class="<?php echo $kp_categoria_add->LeftColumnClass ?>"><?php echo $kp_categoria_add->desccategoria->caption() ?><?php echo $kp_categoria_add->desccategoria->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $kp_categoria_add->RightColumnClass ?>"><div <?php echo $kp_categoria_add->desccategoria->cellAttributes() ?>>
<span id="el_kp_categoria_desccategoria">
<textarea data-table="kp_categoria" data-field="x_desccategoria" name="x_desccategoria" id="x_desccategoria" cols="35" rows="4" placeholder="<?php echo HtmlEncode($kp_categoria_add->desccategoria->getPlaceHolder()) ?>"<?php echo $kp_categoria_add->desccategoria->editAttributes() ?>><?php echo $kp_categoria_add->desccategoria->EditValue ?></textarea>
</span>
<?php echo $kp_categoria_add->desccategoria->CustomMsg ?></div></div>
	</div>
<?php } ?>
<?php if ($kp_categoria_add->estado->Visible) { // estado ?>
	<div id="r_estado" class="form-group row">
		<label id="elh_kp_categoria_estado" for="x_estado" class="<?php echo $kp_categoria_add->LeftColumnClass ?>"><?php echo $kp_categoria_add->estado->caption() ?><?php echo $kp_categoria_add->estado->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $kp_categoria_add->RightColumnClass ?>"><div <?php echo $kp_categoria_add->estado->cellAttributes() ?>>
<span id="el_kp_categoria_estado">
<input type="text" data-table="kp_categoria" data-field="x_estado" name="x_estado" id="x_estado" size="30" maxlength="11" placeholder="<?php echo HtmlEncode($kp_categoria_add->estado->getPlaceHolder()) ?>" value="<?php echo $kp_categoria_add->estado->EditValue ?>"<?php echo $kp_categoria_add->estado->editAttributes() ?>>
</span>
<?php echo $kp_categoria_add->estado->CustomMsg ?></div></div>
	</div>
<?php } ?>
<?php if ($kp_categoria_add->acciones->Visible) { // acciones ?>
	<div id="r_acciones" class="form-group row">
		<label id="elh_kp_categoria_acciones" for="x_acciones" class="<?php echo $kp_categoria_add->LeftColumnClass ?>"><?php echo $kp_categoria_add->acciones->caption() ?><?php echo $kp_categoria_add->acciones->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $kp_categoria_add->RightColumnClass ?>"><div <?php echo $kp_categoria_add->acciones->cellAttributes() ?>>
<span id="el_kp_categoria_acciones">
<input type="text" data-table="kp_categoria" data-field="x_acciones" name="x_acciones" id="x_acciones" size="30" maxlength="11" placeholder="<?php echo HtmlEncode($kp_categoria_add->acciones->getPlaceHolder()) ?>" value="<?php echo $kp_categoria_add->acciones->EditValue ?>"<?php echo $kp_categoria_add->acciones->editAttributes() ?>>
</span>
<?php echo $kp_categoria_add->acciones->CustomMsg ?></div></div>
	</div>
<?php } ?>
<?php if ($kp_categoria_add->video->Visible) { // video ?>
	<div id="r_video" class="form-group row">
		<label id="elh_kp_categoria_video" for="x_video" class="<?php echo $kp_categoria_add->LeftColumnClass ?>"><?php echo $kp_categoria_add->video->caption() ?><?php echo $kp_categoria_add->video->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $kp_categoria_add->RightColumnClass ?>"><div <?php echo $kp_categoria_add->video->cellAttributes() ?>>
<span id="el_kp_categoria_video">
<input type="text" data-table="kp_categoria" data-field="x_video" name="x_video" id="x_video" size="30" maxlength="255" placeholder="<?php echo HtmlEncode($kp_categoria_add->video->getPlaceHolder()) ?>" value="<?php echo $kp_categoria_add->video->EditValue ?>"<?php echo $kp_categoria_add->video->editAttributes() ?>>
</span>
<?php echo $kp_categoria_add->video->CustomMsg ?></div></div>
	</div>
<?php } ?>
<?php if ($kp_categoria_add->foto->Visible) { // foto ?>
	<div id="r_foto" class="form-group row">
		<label id="elh_kp_categoria_foto" for="x_foto" class="<?php echo $kp_categoria_add->LeftColumnClass ?>"><?php echo $kp_categoria_add->foto->caption() ?><?php echo $kp_categoria_add->foto->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $kp_categoria_add->RightColumnClass ?>"><div <?php echo $kp_categoria_add->foto->cellAttributes() ?>>
<span id="el_kp_categoria_foto">
<input type="text" data-table="kp_categoria" data-field="x_foto" name="x_foto" id="x_foto" size="30" maxlength="255" placeholder="<?php echo HtmlEncode($kp_categoria_add->foto->getPlaceHolder()) ?>" value="<?php echo $kp_categoria_add->foto->EditValue ?>"<?php echo $kp_categoria_add->foto->editAttributes() ?>>
</span>
<?php echo $kp_categoria_add->foto->CustomMsg ?></div></div>
	</div>
<?php } ?>
<?php if ($kp_categoria_add->url->Visible) { // url ?>
	<div id="r_url" class="form-group row">
		<label id="elh_kp_categoria_url" for="x_url" class="<?php echo $kp_categoria_add->LeftColumnClass ?>"><?php echo $kp_categoria_add->url->caption() ?><?php echo $kp_categoria_add->url->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $kp_categoria_add->RightColumnClass ?>"><div <?php echo $kp_categoria_add->url->cellAttributes() ?>>
<span id="el_kp_categoria_url">
<input type="text" data-table="kp_categoria" data-field="x_url" name="x_url" id="x_url" size="30" maxlength="250" placeholder="<?php echo HtmlEncode($kp_categoria_add->url->getPlaceHolder()) ?>" value="<?php echo $kp_categoria_add->url->EditValue ?>"<?php echo $kp_categoria_add->url->editAttributes() ?>>
</span>
<?php echo $kp_categoria_add->url->CustomMsg ?></div></div>
	</div>
<?php } ?>
<?php if ($kp_categoria_add->status->Visible) { // status ?>
	<div id="r_status" class="form-group row">
		<label id="elh_kp_categoria_status" for="x_status" class="<?php echo $kp_categoria_add->LeftColumnClass ?>"><?php echo $kp_categoria_add->status->caption() ?><?php echo $kp_categoria_add->status->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $kp_categoria_add->RightColumnClass ?>"><div <?php echo $kp_categoria_add->status->cellAttributes() ?>>
<span id="el_kp_categoria_status">
<input type="text" data-table="kp_categoria" data-field="x_status" name="x_status" id="x_status" size="30" maxlength="11" placeholder="<?php echo HtmlEncode($kp_categoria_add->status->getPlaceHolder()) ?>" value="<?php echo $kp_categoria_add->status->EditValue ?>"<?php echo $kp_categoria_add->status->editAttributes() ?>>
</span>
<?php echo $kp_categoria_add->status->CustomMsg ?></div></div>
	</div>
<?php } ?>
</div><!-- /page* -->
<?php if (!$kp_categoria_add->IsModal) { ?>
<div class="form-group row"><!-- buttons .form-group -->
	<div class="<?php echo $kp_categoria_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_categoria_add->getReturnUrl() ?>"><?php echo $Language->phrase("CancelBtn") ?></button>
	</div><!-- /buttons offset -->
</div><!-- /buttons .form-group -->
<?php } ?>
</form>
<?php
$kp_categoria_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_categoria_add->terminate();
?>