<?php
namespace PHPMaker2020\recetarios_2021;

// Autoload
include_once "autoload.php";

// Session
if (session_status() !== PHP_SESSION_ACTIVE)
	\Delight\Cookie\Session::start(Config("COOKIE_SAMESITE")); // Init session data

// Output buffering
ob_start();
?>
<?php

// Write header
WriteHeader(FALSE);

// Create page object
$salidas_add = new salidas_add();

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

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

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

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

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

	// Validate form
	fsalidasadd.validate = function() {
		if (!this.validateRequired)
			return true; // Ignore validation
		var $ = jQuery, fobj = this.getForm(), $fobj = $(fobj);
		if ($fobj.find("#confirm").val() == "confirm")
			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 ($salidas_add->Fecha_Hora->Required) { ?>
				elm = this.getElements("x" + infix + "_Fecha_Hora");
				if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
					return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $salidas_add->Fecha_Hora->caption(), $salidas_add->Fecha_Hora->RequiredErrorMessage)) ?>");
			<?php } ?>
				elm = this.getElements("x" + infix + "_Fecha_Hora");
				if (elm && !ew.checkDateDef(elm.value))
					return this.onError(elm, "<?php echo JsEncode($salidas_add->Fecha_Hora->errorMessage()) ?>");
			<?php if ($salidas_add->Referencia->Required) { ?>
				elm = this.getElements("x" + infix + "_Referencia");
				if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
					return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $salidas_add->Referencia->caption(), $salidas_add->Referencia->RequiredErrorMessage)) ?>");
			<?php } ?>
			<?php if ($salidas_add->id_remitente->Required) { ?>
				elm = this.getElements("x" + infix + "_id_remitente");
				if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
					return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $salidas_add->id_remitente->caption(), $salidas_add->id_remitente->RequiredErrorMessage)) ?>");
			<?php } ?>
				elm = this.getElements("x" + infix + "_id_remitente");
				if (elm && !ew.checkInteger(elm.value))
					return this.onError(elm, "<?php echo JsEncode($salidas_add->id_remitente->errorMessage()) ?>");
			<?php if ($salidas_add->Nota->Required) { ?>
				elm = this.getElements("x" + infix + "_Nota");
				if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
					return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $salidas_add->Nota->caption(), $salidas_add->Nota->RequiredErrorMessage)) ?>");
			<?php } ?>
			<?php if ($salidas_add->id_Usuario->Required) { ?>
				elm = this.getElements("x" + infix + "_id_Usuario");
				if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
					return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $salidas_add->id_Usuario->caption(), $salidas_add->id_Usuario->RequiredErrorMessage)) ?>");
			<?php } ?>
				elm = this.getElements("x" + infix + "_id_Usuario");
				if (elm && !ew.checkInteger(elm.value))
					return this.onError(elm, "<?php echo JsEncode($salidas_add->id_Usuario->errorMessage()) ?>");
			<?php if ($salidas_add->Mes->Required) { ?>
				elm = this.getElements("x" + infix + "_Mes");
				if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
					return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $salidas_add->Mes->caption(), $salidas_add->Mes->RequiredErrorMessage)) ?>");
			<?php } ?>
				elm = this.getElements("x" + infix + "_Mes");
				if (elm && !ew.checkInteger(elm.value))
					return this.onError(elm, "<?php echo JsEncode($salidas_add->Mes->errorMessage()) ?>");
			<?php if ($salidas_add->Anio->Required) { ?>
				elm = this.getElements("x" + infix + "_Anio");
				if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
					return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $salidas_add->Anio->caption(), $salidas_add->Anio->RequiredErrorMessage)) ?>");
			<?php } ?>
				elm = this.getElements("x" + infix + "_Anio");
				if (elm && !ew.checkInteger(elm.value))
					return this.onError(elm, "<?php echo JsEncode($salidas_add->Anio->errorMessage()) ?>");
			<?php if ($salidas_add->Remitente->Required) { ?>
				elm = this.getElements("x" + infix + "_Remitente");
				if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
					return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $salidas_add->Remitente->caption(), $salidas_add->Remitente->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
	fsalidasadd.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
	fsalidasadd.validateRequired = <?php echo Config("CLIENT_VALIDATE") ? "true" : "false" ?>;

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

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

});
</script>
<?php $salidas_add->showPageHeader(); ?>
<?php
$salidas_add->showMessage();
?>
<form name="fsalidasadd" id="fsalidasadd" class="<?php echo $salidas_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="salidas">
<input type="hidden" name="action" id="action" value="insert">
<input type="hidden" name="modal" value="<?php echo (int)$salidas_add->IsModal ?>">
<div class="ew-add-div"><!-- page* -->
<?php if ($salidas_add->Fecha_Hora->Visible) { // Fecha_Hora ?>
	<div id="r_Fecha_Hora" class="form-group row">
		<label id="elh_salidas_Fecha_Hora" for="x_Fecha_Hora" class="<?php echo $salidas_add->LeftColumnClass ?>"><?php echo $salidas_add->Fecha_Hora->caption() ?><?php echo $salidas_add->Fecha_Hora->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $salidas_add->RightColumnClass ?>"><div <?php echo $salidas_add->Fecha_Hora->cellAttributes() ?>>
<span id="el_salidas_Fecha_Hora">
<input type="text" data-table="salidas" data-field="x_Fecha_Hora" name="x_Fecha_Hora" id="x_Fecha_Hora" maxlength="19" placeholder="<?php echo HtmlEncode($salidas_add->Fecha_Hora->getPlaceHolder()) ?>" value="<?php echo $salidas_add->Fecha_Hora->EditValue ?>"<?php echo $salidas_add->Fecha_Hora->editAttributes() ?>>
<?php if (!$salidas_add->Fecha_Hora->ReadOnly && !$salidas_add->Fecha_Hora->Disabled && !isset($salidas_add->Fecha_Hora->EditAttrs["readonly"]) && !isset($salidas_add->Fecha_Hora->EditAttrs["disabled"])) { ?>
<script>
loadjs.ready(["fsalidasadd", "datetimepicker"], function() {
	ew.createDateTimePicker("fsalidasadd", "x_Fecha_Hora", {"ignoreReadonly":true,"useCurrent":false,"format":0});
});
</script>
<?php } ?>
</span>
<?php echo $salidas_add->Fecha_Hora->CustomMsg ?></div></div>
	</div>
<?php } ?>
<?php if ($salidas_add->Referencia->Visible) { // Referencia ?>
	<div id="r_Referencia" class="form-group row">
		<label id="elh_salidas_Referencia" for="x_Referencia" class="<?php echo $salidas_add->LeftColumnClass ?>"><?php echo $salidas_add->Referencia->caption() ?><?php echo $salidas_add->Referencia->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $salidas_add->RightColumnClass ?>"><div <?php echo $salidas_add->Referencia->cellAttributes() ?>>
<span id="el_salidas_Referencia">
<input type="text" data-table="salidas" data-field="x_Referencia" name="x_Referencia" id="x_Referencia" size="30" maxlength="50" placeholder="<?php echo HtmlEncode($salidas_add->Referencia->getPlaceHolder()) ?>" value="<?php echo $salidas_add->Referencia->EditValue ?>"<?php echo $salidas_add->Referencia->editAttributes() ?>>
</span>
<?php echo $salidas_add->Referencia->CustomMsg ?></div></div>
	</div>
<?php } ?>
<?php if ($salidas_add->id_remitente->Visible) { // id_remitente ?>
	<div id="r_id_remitente" class="form-group row">
		<label id="elh_salidas_id_remitente" for="x_id_remitente" class="<?php echo $salidas_add->LeftColumnClass ?>"><?php echo $salidas_add->id_remitente->caption() ?><?php echo $salidas_add->id_remitente->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $salidas_add->RightColumnClass ?>"><div <?php echo $salidas_add->id_remitente->cellAttributes() ?>>
<span id="el_salidas_id_remitente">
<input type="text" data-table="salidas" data-field="x_id_remitente" name="x_id_remitente" id="x_id_remitente" size="30" maxlength="11" placeholder="<?php echo HtmlEncode($salidas_add->id_remitente->getPlaceHolder()) ?>" value="<?php echo $salidas_add->id_remitente->EditValue ?>"<?php echo $salidas_add->id_remitente->editAttributes() ?>>
</span>
<?php echo $salidas_add->id_remitente->CustomMsg ?></div></div>
	</div>
<?php } ?>
<?php if ($salidas_add->Nota->Visible) { // Nota ?>
	<div id="r_Nota" class="form-group row">
		<label id="elh_salidas_Nota" for="x_Nota" class="<?php echo $salidas_add->LeftColumnClass ?>"><?php echo $salidas_add->Nota->caption() ?><?php echo $salidas_add->Nota->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $salidas_add->RightColumnClass ?>"><div <?php echo $salidas_add->Nota->cellAttributes() ?>>
<span id="el_salidas_Nota">
<textarea data-table="salidas" data-field="x_Nota" name="x_Nota" id="x_Nota" cols="35" rows="4" placeholder="<?php echo HtmlEncode($salidas_add->Nota->getPlaceHolder()) ?>"<?php echo $salidas_add->Nota->editAttributes() ?>><?php echo $salidas_add->Nota->EditValue ?></textarea>
</span>
<?php echo $salidas_add->Nota->CustomMsg ?></div></div>
	</div>
<?php } ?>
<?php if ($salidas_add->id_Usuario->Visible) { // id_Usuario ?>
	<div id="r_id_Usuario" class="form-group row">
		<label id="elh_salidas_id_Usuario" for="x_id_Usuario" class="<?php echo $salidas_add->LeftColumnClass ?>"><?php echo $salidas_add->id_Usuario->caption() ?><?php echo $salidas_add->id_Usuario->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $salidas_add->RightColumnClass ?>"><div <?php echo $salidas_add->id_Usuario->cellAttributes() ?>>
<span id="el_salidas_id_Usuario">
<input type="text" data-table="salidas" data-field="x_id_Usuario" name="x_id_Usuario" id="x_id_Usuario" size="30" maxlength="11" placeholder="<?php echo HtmlEncode($salidas_add->id_Usuario->getPlaceHolder()) ?>" value="<?php echo $salidas_add->id_Usuario->EditValue ?>"<?php echo $salidas_add->id_Usuario->editAttributes() ?>>
</span>
<?php echo $salidas_add->id_Usuario->CustomMsg ?></div></div>
	</div>
<?php } ?>
<?php if ($salidas_add->Mes->Visible) { // Mes ?>
	<div id="r_Mes" class="form-group row">
		<label id="elh_salidas_Mes" for="x_Mes" class="<?php echo $salidas_add->LeftColumnClass ?>"><?php echo $salidas_add->Mes->caption() ?><?php echo $salidas_add->Mes->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $salidas_add->RightColumnClass ?>"><div <?php echo $salidas_add->Mes->cellAttributes() ?>>
<span id="el_salidas_Mes">
<input type="text" data-table="salidas" data-field="x_Mes" name="x_Mes" id="x_Mes" size="30" maxlength="11" placeholder="<?php echo HtmlEncode($salidas_add->Mes->getPlaceHolder()) ?>" value="<?php echo $salidas_add->Mes->EditValue ?>"<?php echo $salidas_add->Mes->editAttributes() ?>>
</span>
<?php echo $salidas_add->Mes->CustomMsg ?></div></div>
	</div>
<?php } ?>
<?php if ($salidas_add->Anio->Visible) { // Anio ?>
	<div id="r_Anio" class="form-group row">
		<label id="elh_salidas_Anio" for="x_Anio" class="<?php echo $salidas_add->LeftColumnClass ?>"><?php echo $salidas_add->Anio->caption() ?><?php echo $salidas_add->Anio->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $salidas_add->RightColumnClass ?>"><div <?php echo $salidas_add->Anio->cellAttributes() ?>>
<span id="el_salidas_Anio">
<input type="text" data-table="salidas" data-field="x_Anio" name="x_Anio" id="x_Anio" size="30" maxlength="11" placeholder="<?php echo HtmlEncode($salidas_add->Anio->getPlaceHolder()) ?>" value="<?php echo $salidas_add->Anio->EditValue ?>"<?php echo $salidas_add->Anio->editAttributes() ?>>
</span>
<?php echo $salidas_add->Anio->CustomMsg ?></div></div>
	</div>
<?php } ?>
<?php if ($salidas_add->Remitente->Visible) { // Remitente ?>
	<div id="r_Remitente" class="form-group row">
		<label id="elh_salidas_Remitente" for="x_Remitente" class="<?php echo $salidas_add->LeftColumnClass ?>"><?php echo $salidas_add->Remitente->caption() ?><?php echo $salidas_add->Remitente->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $salidas_add->RightColumnClass ?>"><div <?php echo $salidas_add->Remitente->cellAttributes() ?>>
<span id="el_salidas_Remitente">
<input type="text" data-table="salidas" data-field="x_Remitente" name="x_Remitente" id="x_Remitente" size="30" maxlength="150" placeholder="<?php echo HtmlEncode($salidas_add->Remitente->getPlaceHolder()) ?>" value="<?php echo $salidas_add->Remitente->EditValue ?>"<?php echo $salidas_add->Remitente->editAttributes() ?>>
</span>
<?php echo $salidas_add->Remitente->CustomMsg ?></div></div>
	</div>
<?php } ?>
</div><!-- /page* -->
<?php if (!$salidas_add->IsModal) { ?>
<div class="form-group row"><!-- buttons .form-group -->
	<div class="<?php echo $salidas_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 $salidas_add->getReturnUrl() ?>"><?php echo $Language->phrase("CancelBtn") ?></button>
	</div><!-- /buttons offset -->
</div><!-- /buttons .form-group -->
<?php } ?>
</form>
<?php
$salidas_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
$salidas_add->terminate();
?>