<?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_ubigeos_prov_edit = new kp_ubigeos_prov_edit();

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

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

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

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

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

	// Validate form
	fkp_ubigeos_provedit.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_ubigeos_prov_edit->id_reg->Required) { ?>
				elm = this.getElements("x" + infix + "_id_reg");
				if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
					return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $kp_ubigeos_prov_edit->id_reg->caption(), $kp_ubigeos_prov_edit->id_reg->RequiredErrorMessage)) ?>");
			<?php } ?>
			<?php if ($kp_ubigeos_prov_edit->codubigeodpto->Required) { ?>
				elm = this.getElements("x" + infix + "_codubigeodpto");
				if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
					return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $kp_ubigeos_prov_edit->codubigeodpto->caption(), $kp_ubigeos_prov_edit->codubigeodpto->RequiredErrorMessage)) ?>");
			<?php } ?>
			<?php if ($kp_ubigeos_prov_edit->codubigeoprov->Required) { ?>
				elm = this.getElements("x" + infix + "_codubigeoprov");
				if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
					return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $kp_ubigeos_prov_edit->codubigeoprov->caption(), $kp_ubigeos_prov_edit->codubigeoprov->RequiredErrorMessage)) ?>");
			<?php } ?>
			<?php if ($kp_ubigeos_prov_edit->nomprov->Required) { ?>
				elm = this.getElements("x" + infix + "_nomprov");
				if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
					return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $kp_ubigeos_prov_edit->nomprov->caption(), $kp_ubigeos_prov_edit->nomprov->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_ubigeos_provedit.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_ubigeos_provedit.validateRequired = <?php echo Config("CLIENT_VALIDATE") ? "true" : "false" ?>;

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

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

});
</script>
<?php $kp_ubigeos_prov_edit->showPageHeader(); ?>
<?php
$kp_ubigeos_prov_edit->showMessage();
?>
<form name="fkp_ubigeos_provedit" id="fkp_ubigeos_provedit" class="<?php echo $kp_ubigeos_prov_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_ubigeos_prov">
<input type="hidden" name="action" id="action" value="update">
<input type="hidden" name="modal" value="<?php echo (int)$kp_ubigeos_prov_edit->IsModal ?>">
<div class="ew-edit-div"><!-- page* -->
<?php if ($kp_ubigeos_prov_edit->id_reg->Visible) { // id_reg ?>
	<div id="r_id_reg" class="form-group row">
		<label id="elh_kp_ubigeos_prov_id_reg" class="<?php echo $kp_ubigeos_prov_edit->LeftColumnClass ?>"><?php echo $kp_ubigeos_prov_edit->id_reg->caption() ?><?php echo $kp_ubigeos_prov_edit->id_reg->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $kp_ubigeos_prov_edit->RightColumnClass ?>"><div <?php echo $kp_ubigeos_prov_edit->id_reg->cellAttributes() ?>>
<span id="el_kp_ubigeos_prov_id_reg">
<span<?php echo $kp_ubigeos_prov_edit->id_reg->viewAttributes() ?>><input type="text" readonly class="form-control-plaintext" value="<?php echo HtmlEncode(RemoveHtml($kp_ubigeos_prov_edit->id_reg->EditValue)) ?>"></span>
</span>
<input type="hidden" data-table="kp_ubigeos_prov" data-field="x_id_reg" name="x_id_reg" id="x_id_reg" value="<?php echo HtmlEncode($kp_ubigeos_prov_edit->id_reg->CurrentValue) ?>">
<?php echo $kp_ubigeos_prov_edit->id_reg->CustomMsg ?></div></div>
	</div>
<?php } ?>
<?php if ($kp_ubigeos_prov_edit->codubigeodpto->Visible) { // codubigeodpto ?>
	<div id="r_codubigeodpto" class="form-group row">
		<label id="elh_kp_ubigeos_prov_codubigeodpto" for="x_codubigeodpto" class="<?php echo $kp_ubigeos_prov_edit->LeftColumnClass ?>"><?php echo $kp_ubigeos_prov_edit->codubigeodpto->caption() ?><?php echo $kp_ubigeos_prov_edit->codubigeodpto->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $kp_ubigeos_prov_edit->RightColumnClass ?>"><div <?php echo $kp_ubigeos_prov_edit->codubigeodpto->cellAttributes() ?>>
<span id="el_kp_ubigeos_prov_codubigeodpto">
<input type="text" data-table="kp_ubigeos_prov" data-field="x_codubigeodpto" name="x_codubigeodpto" id="x_codubigeodpto" size="30" maxlength="5" placeholder="<?php echo HtmlEncode($kp_ubigeos_prov_edit->codubigeodpto->getPlaceHolder()) ?>" value="<?php echo $kp_ubigeos_prov_edit->codubigeodpto->EditValue ?>"<?php echo $kp_ubigeos_prov_edit->codubigeodpto->editAttributes() ?>>
</span>
<?php echo $kp_ubigeos_prov_edit->codubigeodpto->CustomMsg ?></div></div>
	</div>
<?php } ?>
<?php if ($kp_ubigeos_prov_edit->codubigeoprov->Visible) { // codubigeoprov ?>
	<div id="r_codubigeoprov" class="form-group row">
		<label id="elh_kp_ubigeos_prov_codubigeoprov" for="x_codubigeoprov" class="<?php echo $kp_ubigeos_prov_edit->LeftColumnClass ?>"><?php echo $kp_ubigeos_prov_edit->codubigeoprov->caption() ?><?php echo $kp_ubigeos_prov_edit->codubigeoprov->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $kp_ubigeos_prov_edit->RightColumnClass ?>"><div <?php echo $kp_ubigeos_prov_edit->codubigeoprov->cellAttributes() ?>>
<span id="el_kp_ubigeos_prov_codubigeoprov">
<input type="text" data-table="kp_ubigeos_prov" data-field="x_codubigeoprov" name="x_codubigeoprov" id="x_codubigeoprov" size="30" maxlength="5" placeholder="<?php echo HtmlEncode($kp_ubigeos_prov_edit->codubigeoprov->getPlaceHolder()) ?>" value="<?php echo $kp_ubigeos_prov_edit->codubigeoprov->EditValue ?>"<?php echo $kp_ubigeos_prov_edit->codubigeoprov->editAttributes() ?>>
</span>
<?php echo $kp_ubigeos_prov_edit->codubigeoprov->CustomMsg ?></div></div>
	</div>
<?php } ?>
<?php if ($kp_ubigeos_prov_edit->nomprov->Visible) { // nomprov ?>
	<div id="r_nomprov" class="form-group row">
		<label id="elh_kp_ubigeos_prov_nomprov" for="x_nomprov" class="<?php echo $kp_ubigeos_prov_edit->LeftColumnClass ?>"><?php echo $kp_ubigeos_prov_edit->nomprov->caption() ?><?php echo $kp_ubigeos_prov_edit->nomprov->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $kp_ubigeos_prov_edit->RightColumnClass ?>"><div <?php echo $kp_ubigeos_prov_edit->nomprov->cellAttributes() ?>>
<span id="el_kp_ubigeos_prov_nomprov">
<input type="text" data-table="kp_ubigeos_prov" data-field="x_nomprov" name="x_nomprov" id="x_nomprov" size="30" maxlength="25" placeholder="<?php echo HtmlEncode($kp_ubigeos_prov_edit->nomprov->getPlaceHolder()) ?>" value="<?php echo $kp_ubigeos_prov_edit->nomprov->EditValue ?>"<?php echo $kp_ubigeos_prov_edit->nomprov->editAttributes() ?>>
</span>
<?php echo $kp_ubigeos_prov_edit->nomprov->CustomMsg ?></div></div>
	</div>
<?php } ?>
</div><!-- /page* -->
<?php if (!$kp_ubigeos_prov_edit->IsModal) { ?>
<div class="form-group row"><!-- buttons .form-group -->
	<div class="<?php echo $kp_ubigeos_prov_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_ubigeos_prov_edit->getReturnUrl() ?>"><?php echo $Language->phrase("CancelBtn") ?></button>
	</div><!-- /buttons offset -->
</div><!-- /buttons .form-group -->
<?php } ?>
</form>
<?php
$kp_ubigeos_prov_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_ubigeos_prov_edit->terminate();
?>