<?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_proveedores_add = new kp_proveedores_add();

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

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

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

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

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

	// Validate form
	fkp_proveedoresadd.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_proveedores_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_proveedores_add->estado->caption(), $kp_proveedores_add->estado->RequiredErrorMessage)) ?>");
			<?php } ?>
				elm = this.getElements("x" + infix + "_estado");
				if (elm && !ew.checkInteger(elm.value))
					return this.onError(elm, "<?php echo JsEncode($kp_proveedores_add->estado->errorMessage()) ?>");
			<?php if ($kp_proveedores_add->idempresa->Required) { ?>
				elm = this.getElements("x" + infix + "_idempresa");
				if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
					return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $kp_proveedores_add->idempresa->caption(), $kp_proveedores_add->idempresa->RequiredErrorMessage)) ?>");
			<?php } ?>
				elm = this.getElements("x" + infix + "_idempresa");
				if (elm && !ew.checkInteger(elm.value))
					return this.onError(elm, "<?php echo JsEncode($kp_proveedores_add->idempresa->errorMessage()) ?>");
			<?php if ($kp_proveedores_add->idprovemp->Required) { ?>
				elm = this.getElements("x" + infix + "_idprovemp");
				if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
					return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $kp_proveedores_add->idprovemp->caption(), $kp_proveedores_add->idprovemp->RequiredErrorMessage)) ?>");
			<?php } ?>
			<?php if ($kp_proveedores_add->numruc->Required) { ?>
				elm = this.getElements("x" + infix + "_numruc");
				if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
					return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $kp_proveedores_add->numruc->caption(), $kp_proveedores_add->numruc->RequiredErrorMessage)) ?>");
			<?php } ?>
				elm = this.getElements("x" + infix + "_numruc");
				if (elm && !ew.checkInteger(elm.value))
					return this.onError(elm, "<?php echo JsEncode($kp_proveedores_add->numruc->errorMessage()) ?>");
			<?php if ($kp_proveedores_add->nomproveedor->Required) { ?>
				elm = this.getElements("x" + infix + "_nomproveedor");
				if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
					return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $kp_proveedores_add->nomproveedor->caption(), $kp_proveedores_add->nomproveedor->RequiredErrorMessage)) ?>");
			<?php } ?>
			<?php if ($kp_proveedores_add->dirproveedor->Required) { ?>
				elm = this.getElements("x" + infix + "_dirproveedor");
				if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
					return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $kp_proveedores_add->dirproveedor->caption(), $kp_proveedores_add->dirproveedor->RequiredErrorMessage)) ?>");
			<?php } ?>
			<?php if ($kp_proveedores_add->refproveedor->Required) { ?>
				elm = this.getElements("x" + infix + "_refproveedor");
				if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
					return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $kp_proveedores_add->refproveedor->caption(), $kp_proveedores_add->refproveedor->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_proveedoresadd.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_proveedoresadd.validateRequired = <?php echo Config("CLIENT_VALIDATE") ? "true" : "false" ?>;

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

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

});
</script>
<?php $kp_proveedores_add->showPageHeader(); ?>
<?php
$kp_proveedores_add->showMessage();
?>
<form name="fkp_proveedoresadd" id="fkp_proveedoresadd" class="<?php echo $kp_proveedores_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_proveedores">
<input type="hidden" name="action" id="action" value="insert">
<input type="hidden" name="modal" value="<?php echo (int)$kp_proveedores_add->IsModal ?>">
<div class="ew-add-div"><!-- page* -->
<?php if ($kp_proveedores_add->estado->Visible) { // estado ?>
	<div id="r_estado" class="form-group row">
		<label id="elh_kp_proveedores_estado" for="x_estado" class="<?php echo $kp_proveedores_add->LeftColumnClass ?>"><?php echo $kp_proveedores_add->estado->caption() ?><?php echo $kp_proveedores_add->estado->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $kp_proveedores_add->RightColumnClass ?>"><div <?php echo $kp_proveedores_add->estado->cellAttributes() ?>>
<span id="el_kp_proveedores_estado">
<input type="text" data-table="kp_proveedores" data-field="x_estado" name="x_estado" id="x_estado" size="30" maxlength="11" placeholder="<?php echo HtmlEncode($kp_proveedores_add->estado->getPlaceHolder()) ?>" value="<?php echo $kp_proveedores_add->estado->EditValue ?>"<?php echo $kp_proveedores_add->estado->editAttributes() ?>>
</span>
<?php echo $kp_proveedores_add->estado->CustomMsg ?></div></div>
	</div>
<?php } ?>
<?php if ($kp_proveedores_add->idempresa->Visible) { // idempresa ?>
	<div id="r_idempresa" class="form-group row">
		<label id="elh_kp_proveedores_idempresa" for="x_idempresa" class="<?php echo $kp_proveedores_add->LeftColumnClass ?>"><?php echo $kp_proveedores_add->idempresa->caption() ?><?php echo $kp_proveedores_add->idempresa->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $kp_proveedores_add->RightColumnClass ?>"><div <?php echo $kp_proveedores_add->idempresa->cellAttributes() ?>>
<span id="el_kp_proveedores_idempresa">
<input type="text" data-table="kp_proveedores" data-field="x_idempresa" name="x_idempresa" id="x_idempresa" size="30" maxlength="11" placeholder="<?php echo HtmlEncode($kp_proveedores_add->idempresa->getPlaceHolder()) ?>" value="<?php echo $kp_proveedores_add->idempresa->EditValue ?>"<?php echo $kp_proveedores_add->idempresa->editAttributes() ?>>
</span>
<?php echo $kp_proveedores_add->idempresa->CustomMsg ?></div></div>
	</div>
<?php } ?>
<?php if ($kp_proveedores_add->idprovemp->Visible) { // idprovemp ?>
	<div id="r_idprovemp" class="form-group row">
		<label id="elh_kp_proveedores_idprovemp" for="x_idprovemp" class="<?php echo $kp_proveedores_add->LeftColumnClass ?>"><?php echo $kp_proveedores_add->idprovemp->caption() ?><?php echo $kp_proveedores_add->idprovemp->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $kp_proveedores_add->RightColumnClass ?>"><div <?php echo $kp_proveedores_add->idprovemp->cellAttributes() ?>>
<span id="el_kp_proveedores_idprovemp">
<input type="text" data-table="kp_proveedores" data-field="x_idprovemp" name="x_idprovemp" id="x_idprovemp" size="30" maxlength="100" placeholder="<?php echo HtmlEncode($kp_proveedores_add->idprovemp->getPlaceHolder()) ?>" value="<?php echo $kp_proveedores_add->idprovemp->EditValue ?>"<?php echo $kp_proveedores_add->idprovemp->editAttributes() ?>>
</span>
<?php echo $kp_proveedores_add->idprovemp->CustomMsg ?></div></div>
	</div>
<?php } ?>
<?php if ($kp_proveedores_add->numruc->Visible) { // numruc ?>
	<div id="r_numruc" class="form-group row">
		<label id="elh_kp_proveedores_numruc" for="x_numruc" class="<?php echo $kp_proveedores_add->LeftColumnClass ?>"><?php echo $kp_proveedores_add->numruc->caption() ?><?php echo $kp_proveedores_add->numruc->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $kp_proveedores_add->RightColumnClass ?>"><div <?php echo $kp_proveedores_add->numruc->cellAttributes() ?>>
<span id="el_kp_proveedores_numruc">
<input type="text" data-table="kp_proveedores" data-field="x_numruc" name="x_numruc" id="x_numruc" size="30" maxlength="11" placeholder="<?php echo HtmlEncode($kp_proveedores_add->numruc->getPlaceHolder()) ?>" value="<?php echo $kp_proveedores_add->numruc->EditValue ?>"<?php echo $kp_proveedores_add->numruc->editAttributes() ?>>
</span>
<?php echo $kp_proveedores_add->numruc->CustomMsg ?></div></div>
	</div>
<?php } ?>
<?php if ($kp_proveedores_add->nomproveedor->Visible) { // nomproveedor ?>
	<div id="r_nomproveedor" class="form-group row">
		<label id="elh_kp_proveedores_nomproveedor" for="x_nomproveedor" class="<?php echo $kp_proveedores_add->LeftColumnClass ?>"><?php echo $kp_proveedores_add->nomproveedor->caption() ?><?php echo $kp_proveedores_add->nomproveedor->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $kp_proveedores_add->RightColumnClass ?>"><div <?php echo $kp_proveedores_add->nomproveedor->cellAttributes() ?>>
<span id="el_kp_proveedores_nomproveedor">
<input type="text" data-table="kp_proveedores" data-field="x_nomproveedor" name="x_nomproveedor" id="x_nomproveedor" size="30" maxlength="200" placeholder="<?php echo HtmlEncode($kp_proveedores_add->nomproveedor->getPlaceHolder()) ?>" value="<?php echo $kp_proveedores_add->nomproveedor->EditValue ?>"<?php echo $kp_proveedores_add->nomproveedor->editAttributes() ?>>
</span>
<?php echo $kp_proveedores_add->nomproveedor->CustomMsg ?></div></div>
	</div>
<?php } ?>
<?php if ($kp_proveedores_add->dirproveedor->Visible) { // dirproveedor ?>
	<div id="r_dirproveedor" class="form-group row">
		<label id="elh_kp_proveedores_dirproveedor" for="x_dirproveedor" class="<?php echo $kp_proveedores_add->LeftColumnClass ?>"><?php echo $kp_proveedores_add->dirproveedor->caption() ?><?php echo $kp_proveedores_add->dirproveedor->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $kp_proveedores_add->RightColumnClass ?>"><div <?php echo $kp_proveedores_add->dirproveedor->cellAttributes() ?>>
<span id="el_kp_proveedores_dirproveedor">
<textarea data-table="kp_proveedores" data-field="x_dirproveedor" name="x_dirproveedor" id="x_dirproveedor" cols="35" rows="4" placeholder="<?php echo HtmlEncode($kp_proveedores_add->dirproveedor->getPlaceHolder()) ?>"<?php echo $kp_proveedores_add->dirproveedor->editAttributes() ?>><?php echo $kp_proveedores_add->dirproveedor->EditValue ?></textarea>
</span>
<?php echo $kp_proveedores_add->dirproveedor->CustomMsg ?></div></div>
	</div>
<?php } ?>
<?php if ($kp_proveedores_add->refproveedor->Visible) { // refproveedor ?>
	<div id="r_refproveedor" class="form-group row">
		<label id="elh_kp_proveedores_refproveedor" for="x_refproveedor" class="<?php echo $kp_proveedores_add->LeftColumnClass ?>"><?php echo $kp_proveedores_add->refproveedor->caption() ?><?php echo $kp_proveedores_add->refproveedor->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $kp_proveedores_add->RightColumnClass ?>"><div <?php echo $kp_proveedores_add->refproveedor->cellAttributes() ?>>
<span id="el_kp_proveedores_refproveedor">
<input type="text" data-table="kp_proveedores" data-field="x_refproveedor" name="x_refproveedor" id="x_refproveedor" size="30" maxlength="200" placeholder="<?php echo HtmlEncode($kp_proveedores_add->refproveedor->getPlaceHolder()) ?>" value="<?php echo $kp_proveedores_add->refproveedor->EditValue ?>"<?php echo $kp_proveedores_add->refproveedor->editAttributes() ?>>
</span>
<?php echo $kp_proveedores_add->refproveedor->CustomMsg ?></div></div>
	</div>
<?php } ?>
</div><!-- /page* -->
<?php if (!$kp_proveedores_add->IsModal) { ?>
<div class="form-group row"><!-- buttons .form-group -->
	<div class="<?php echo $kp_proveedores_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_proveedores_add->getReturnUrl() ?>"><?php echo $Language->phrase("CancelBtn") ?></button>
	</div><!-- /buttons offset -->
</div><!-- /buttons .form-group -->
<?php } ?>
</form>
<?php
$kp_proveedores_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_proveedores_add->terminate();
?>