<?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_disciplina_edit = new kp_disciplina_edit();

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

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

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

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

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

	// Validate form
	fkp_disciplinaedit.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_disciplina_edit->iddisciplina->Required) { ?>
				elm = this.getElements("x" + infix + "_iddisciplina");
				if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
					return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $kp_disciplina_edit->iddisciplina->caption(), $kp_disciplina_edit->iddisciplina->RequiredErrorMessage)) ?>");
			<?php } ?>
			<?php if ($kp_disciplina_edit->nomdisciplina->Required) { ?>
				elm = this.getElements("x" + infix + "_nomdisciplina");
				if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
					return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $kp_disciplina_edit->nomdisciplina->caption(), $kp_disciplina_edit->nomdisciplina->RequiredErrorMessage)) ?>");
			<?php } ?>
			<?php if ($kp_disciplina_edit->obsdisciplina->Required) { ?>
				elm = this.getElements("x" + infix + "_obsdisciplina");
				if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
					return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $kp_disciplina_edit->obsdisciplina->caption(), $kp_disciplina_edit->obsdisciplina->RequiredErrorMessage)) ?>");
			<?php } ?>
			<?php if ($kp_disciplina_edit->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_disciplina_edit->estado->caption(), $kp_disciplina_edit->estado->RequiredErrorMessage)) ?>");
			<?php } ?>
				elm = this.getElements("x" + infix + "_estado");
				if (elm && !ew.checkInteger(elm.value))
					return this.onError(elm, "<?php echo JsEncode($kp_disciplina_edit->estado->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_disciplinaedit.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_disciplinaedit.validateRequired = <?php echo Config("CLIENT_VALIDATE") ? "true" : "false" ?>;

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

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

});
</script>
<?php $kp_disciplina_edit->showPageHeader(); ?>
<?php
$kp_disciplina_edit->showMessage();
?>
<form name="fkp_disciplinaedit" id="fkp_disciplinaedit" class="<?php echo $kp_disciplina_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_disciplina">
<input type="hidden" name="action" id="action" value="update">
<input type="hidden" name="modal" value="<?php echo (int)$kp_disciplina_edit->IsModal ?>">
<div class="ew-edit-div"><!-- page* -->
<?php if ($kp_disciplina_edit->iddisciplina->Visible) { // iddisciplina ?>
	<div id="r_iddisciplina" class="form-group row">
		<label id="elh_kp_disciplina_iddisciplina" class="<?php echo $kp_disciplina_edit->LeftColumnClass ?>"><?php echo $kp_disciplina_edit->iddisciplina->caption() ?><?php echo $kp_disciplina_edit->iddisciplina->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $kp_disciplina_edit->RightColumnClass ?>"><div <?php echo $kp_disciplina_edit->iddisciplina->cellAttributes() ?>>
<span id="el_kp_disciplina_iddisciplina">
<span<?php echo $kp_disciplina_edit->iddisciplina->viewAttributes() ?>><input type="text" readonly class="form-control-plaintext" value="<?php echo HtmlEncode(RemoveHtml($kp_disciplina_edit->iddisciplina->EditValue)) ?>"></span>
</span>
<input type="hidden" data-table="kp_disciplina" data-field="x_iddisciplina" name="x_iddisciplina" id="x_iddisciplina" value="<?php echo HtmlEncode($kp_disciplina_edit->iddisciplina->CurrentValue) ?>">
<?php echo $kp_disciplina_edit->iddisciplina->CustomMsg ?></div></div>
	</div>
<?php } ?>
<?php if ($kp_disciplina_edit->nomdisciplina->Visible) { // nomdisciplina ?>
	<div id="r_nomdisciplina" class="form-group row">
		<label id="elh_kp_disciplina_nomdisciplina" for="x_nomdisciplina" class="<?php echo $kp_disciplina_edit->LeftColumnClass ?>"><?php echo $kp_disciplina_edit->nomdisciplina->caption() ?><?php echo $kp_disciplina_edit->nomdisciplina->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $kp_disciplina_edit->RightColumnClass ?>"><div <?php echo $kp_disciplina_edit->nomdisciplina->cellAttributes() ?>>
<span id="el_kp_disciplina_nomdisciplina">
<input type="text" data-table="kp_disciplina" data-field="x_nomdisciplina" name="x_nomdisciplina" id="x_nomdisciplina" size="30" maxlength="50" placeholder="<?php echo HtmlEncode($kp_disciplina_edit->nomdisciplina->getPlaceHolder()) ?>" value="<?php echo $kp_disciplina_edit->nomdisciplina->EditValue ?>"<?php echo $kp_disciplina_edit->nomdisciplina->editAttributes() ?>>
</span>
<?php echo $kp_disciplina_edit->nomdisciplina->CustomMsg ?></div></div>
	</div>
<?php } ?>
<?php if ($kp_disciplina_edit->obsdisciplina->Visible) { // obsdisciplina ?>
	<div id="r_obsdisciplina" class="form-group row">
		<label id="elh_kp_disciplina_obsdisciplina" for="x_obsdisciplina" class="<?php echo $kp_disciplina_edit->LeftColumnClass ?>"><?php echo $kp_disciplina_edit->obsdisciplina->caption() ?><?php echo $kp_disciplina_edit->obsdisciplina->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $kp_disciplina_edit->RightColumnClass ?>"><div <?php echo $kp_disciplina_edit->obsdisciplina->cellAttributes() ?>>
<span id="el_kp_disciplina_obsdisciplina">
<textarea data-table="kp_disciplina" data-field="x_obsdisciplina" name="x_obsdisciplina" id="x_obsdisciplina" cols="35" rows="4" placeholder="<?php echo HtmlEncode($kp_disciplina_edit->obsdisciplina->getPlaceHolder()) ?>"<?php echo $kp_disciplina_edit->obsdisciplina->editAttributes() ?>><?php echo $kp_disciplina_edit->obsdisciplina->EditValue ?></textarea>
</span>
<?php echo $kp_disciplina_edit->obsdisciplina->CustomMsg ?></div></div>
	</div>
<?php } ?>
<?php if ($kp_disciplina_edit->estado->Visible) { // estado ?>
	<div id="r_estado" class="form-group row">
		<label id="elh_kp_disciplina_estado" for="x_estado" class="<?php echo $kp_disciplina_edit->LeftColumnClass ?>"><?php echo $kp_disciplina_edit->estado->caption() ?><?php echo $kp_disciplina_edit->estado->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $kp_disciplina_edit->RightColumnClass ?>"><div <?php echo $kp_disciplina_edit->estado->cellAttributes() ?>>
<span id="el_kp_disciplina_estado">
<input type="text" data-table="kp_disciplina" data-field="x_estado" name="x_estado" id="x_estado" size="30" maxlength="11" placeholder="<?php echo HtmlEncode($kp_disciplina_edit->estado->getPlaceHolder()) ?>" value="<?php echo $kp_disciplina_edit->estado->EditValue ?>"<?php echo $kp_disciplina_edit->estado->editAttributes() ?>>
</span>
<?php echo $kp_disciplina_edit->estado->CustomMsg ?></div></div>
	</div>
<?php } ?>
</div><!-- /page* -->
<?php if (!$kp_disciplina_edit->IsModal) { ?>
<div class="form-group row"><!-- buttons .form-group -->
	<div class="<?php echo $kp_disciplina_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_disciplina_edit->getReturnUrl() ?>"><?php echo $Language->phrase("CancelBtn") ?></button>
	</div><!-- /buttons offset -->
</div><!-- /buttons .form-group -->
<?php } ?>
</form>
<?php
$kp_disciplina_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_disciplina_edit->terminate();
?>