<?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_edit = new salidas_edit();

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

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

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

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

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

	// Validate form
	fsalidasedit.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_edit->id->Required) { ?>
				elm = this.getElements("x" + infix + "_id");
				if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
					return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $salidas_edit->id->caption(), $salidas_edit->id->RequiredErrorMessage)) ?>");
			<?php } ?>
			<?php if ($salidas_edit->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_edit->Fecha_Hora->caption(), $salidas_edit->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_edit->Fecha_Hora->errorMessage()) ?>");
			<?php if ($salidas_edit->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_edit->Referencia->caption(), $salidas_edit->Referencia->RequiredErrorMessage)) ?>");
			<?php } ?>
			<?php if ($salidas_edit->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_edit->id_remitente->caption(), $salidas_edit->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_edit->id_remitente->errorMessage()) ?>");
			<?php if ($salidas_edit->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_edit->Nota->caption(), $salidas_edit->Nota->RequiredErrorMessage)) ?>");
			<?php } ?>
			<?php if ($salidas_edit->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_edit->id_Usuario->caption(), $salidas_edit->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_edit->id_Usuario->errorMessage()) ?>");
			<?php if ($salidas_edit->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_edit->Mes->caption(), $salidas_edit->Mes->RequiredErrorMessage)) ?>");
			<?php } ?>
				elm = this.getElements("x" + infix + "_Mes");
				if (elm && !ew.checkInteger(elm.value))
					return this.onError(elm, "<?php echo JsEncode($salidas_edit->Mes->errorMessage()) ?>");
			<?php if ($salidas_edit->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_edit->Anio->caption(), $salidas_edit->Anio->RequiredErrorMessage)) ?>");
			<?php } ?>
				elm = this.getElements("x" + infix + "_Anio");
				if (elm && !ew.checkInteger(elm.value))
					return this.onError(elm, "<?php echo JsEncode($salidas_edit->Anio->errorMessage()) ?>");
			<?php if ($salidas_edit->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_edit->Remitente->caption(), $salidas_edit->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
	fsalidasedit.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
	fsalidasedit.validateRequired = <?php echo Config("CLIENT_VALIDATE") ? "true" : "false" ?>;

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

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

});
</script>
<?php $salidas_edit->showPageHeader(); ?>
<?php
$salidas_edit->showMessage();
?>
<form name="fsalidasedit" id="fsalidasedit" class="<?php echo $salidas_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="salidas">
<input type="hidden" name="action" id="action" value="update">
<input type="hidden" name="modal" value="<?php echo (int)$salidas_edit->IsModal ?>">
<div class="ew-edit-div"><!-- page* -->
<?php if ($salidas_edit->id->Visible) { // id ?>
	<div id="r_id" class="form-group row">
		<label id="elh_salidas_id" class="<?php echo $salidas_edit->LeftColumnClass ?>"><?php echo $salidas_edit->id->caption() ?><?php echo $salidas_edit->id->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $salidas_edit->RightColumnClass ?>"><div <?php echo $salidas_edit->id->cellAttributes() ?>>
<span id="el_salidas_id">
<span<?php echo $salidas_edit->id->viewAttributes() ?>><input type="text" readonly class="form-control-plaintext" value="<?php echo HtmlEncode(RemoveHtml($salidas_edit->id->EditValue)) ?>"></span>
</span>
<input type="hidden" data-table="salidas" data-field="x_id" name="x_id" id="x_id" value="<?php echo HtmlEncode($salidas_edit->id->CurrentValue) ?>">
<?php echo $salidas_edit->id->CustomMsg ?></div></div>
	</div>
<?php } ?>
<?php if ($salidas_edit->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_edit->LeftColumnClass ?>"><?php echo $salidas_edit->Fecha_Hora->caption() ?><?php echo $salidas_edit->Fecha_Hora->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $salidas_edit->RightColumnClass ?>"><div <?php echo $salidas_edit->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_edit->Fecha_Hora->getPlaceHolder()) ?>" value="<?php echo $salidas_edit->Fecha_Hora->EditValue ?>"<?php echo $salidas_edit->Fecha_Hora->editAttributes() ?>>
<?php if (!$salidas_edit->Fecha_Hora->ReadOnly && !$salidas_edit->Fecha_Hora->Disabled && !isset($salidas_edit->Fecha_Hora->EditAttrs["readonly"]) && !isset($salidas_edit->Fecha_Hora->EditAttrs["disabled"])) { ?>
<script>
loadjs.ready(["fsalidasedit", "datetimepicker"], function() {
	ew.createDateTimePicker("fsalidasedit", "x_Fecha_Hora", {"ignoreReadonly":true,"useCurrent":false,"format":0});
});
</script>
<?php } ?>
</span>
<?php echo $salidas_edit->Fecha_Hora->CustomMsg ?></div></div>
	</div>
<?php } ?>
<?php if ($salidas_edit->Referencia->Visible) { // Referencia ?>
	<div id="r_Referencia" class="form-group row">
		<label id="elh_salidas_Referencia" for="x_Referencia" class="<?php echo $salidas_edit->LeftColumnClass ?>"><?php echo $salidas_edit->Referencia->caption() ?><?php echo $salidas_edit->Referencia->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $salidas_edit->RightColumnClass ?>"><div <?php echo $salidas_edit->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_edit->Referencia->getPlaceHolder()) ?>" value="<?php echo $salidas_edit->Referencia->EditValue ?>"<?php echo $salidas_edit->Referencia->editAttributes() ?>>
</span>
<?php echo $salidas_edit->Referencia->CustomMsg ?></div></div>
	</div>
<?php } ?>
<?php if ($salidas_edit->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_edit->LeftColumnClass ?>"><?php echo $salidas_edit->id_remitente->caption() ?><?php echo $salidas_edit->id_remitente->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $salidas_edit->RightColumnClass ?>"><div <?php echo $salidas_edit->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_edit->id_remitente->getPlaceHolder()) ?>" value="<?php echo $salidas_edit->id_remitente->EditValue ?>"<?php echo $salidas_edit->id_remitente->editAttributes() ?>>
</span>
<?php echo $salidas_edit->id_remitente->CustomMsg ?></div></div>
	</div>
<?php } ?>
<?php if ($salidas_edit->Nota->Visible) { // Nota ?>
	<div id="r_Nota" class="form-group row">
		<label id="elh_salidas_Nota" for="x_Nota" class="<?php echo $salidas_edit->LeftColumnClass ?>"><?php echo $salidas_edit->Nota->caption() ?><?php echo $salidas_edit->Nota->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $salidas_edit->RightColumnClass ?>"><div <?php echo $salidas_edit->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_edit->Nota->getPlaceHolder()) ?>"<?php echo $salidas_edit->Nota->editAttributes() ?>><?php echo $salidas_edit->Nota->EditValue ?></textarea>
</span>
<?php echo $salidas_edit->Nota->CustomMsg ?></div></div>
	</div>
<?php } ?>
<?php if ($salidas_edit->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_edit->LeftColumnClass ?>"><?php echo $salidas_edit->id_Usuario->caption() ?><?php echo $salidas_edit->id_Usuario->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $salidas_edit->RightColumnClass ?>"><div <?php echo $salidas_edit->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_edit->id_Usuario->getPlaceHolder()) ?>" value="<?php echo $salidas_edit->id_Usuario->EditValue ?>"<?php echo $salidas_edit->id_Usuario->editAttributes() ?>>
</span>
<?php echo $salidas_edit->id_Usuario->CustomMsg ?></div></div>
	</div>
<?php } ?>
<?php if ($salidas_edit->Mes->Visible) { // Mes ?>
	<div id="r_Mes" class="form-group row">
		<label id="elh_salidas_Mes" for="x_Mes" class="<?php echo $salidas_edit->LeftColumnClass ?>"><?php echo $salidas_edit->Mes->caption() ?><?php echo $salidas_edit->Mes->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $salidas_edit->RightColumnClass ?>"><div <?php echo $salidas_edit->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_edit->Mes->getPlaceHolder()) ?>" value="<?php echo $salidas_edit->Mes->EditValue ?>"<?php echo $salidas_edit->Mes->editAttributes() ?>>
</span>
<?php echo $salidas_edit->Mes->CustomMsg ?></div></div>
	</div>
<?php } ?>
<?php if ($salidas_edit->Anio->Visible) { // Anio ?>
	<div id="r_Anio" class="form-group row">
		<label id="elh_salidas_Anio" for="x_Anio" class="<?php echo $salidas_edit->LeftColumnClass ?>"><?php echo $salidas_edit->Anio->caption() ?><?php echo $salidas_edit->Anio->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $salidas_edit->RightColumnClass ?>"><div <?php echo $salidas_edit->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_edit->Anio->getPlaceHolder()) ?>" value="<?php echo $salidas_edit->Anio->EditValue ?>"<?php echo $salidas_edit->Anio->editAttributes() ?>>
</span>
<?php echo $salidas_edit->Anio->CustomMsg ?></div></div>
	</div>
<?php } ?>
<?php if ($salidas_edit->Remitente->Visible) { // Remitente ?>
	<div id="r_Remitente" class="form-group row">
		<label id="elh_salidas_Remitente" for="x_Remitente" class="<?php echo $salidas_edit->LeftColumnClass ?>"><?php echo $salidas_edit->Remitente->caption() ?><?php echo $salidas_edit->Remitente->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $salidas_edit->RightColumnClass ?>"><div <?php echo $salidas_edit->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_edit->Remitente->getPlaceHolder()) ?>" value="<?php echo $salidas_edit->Remitente->EditValue ?>"<?php echo $salidas_edit->Remitente->editAttributes() ?>>
</span>
<?php echo $salidas_edit->Remitente->CustomMsg ?></div></div>
	</div>
<?php } ?>
</div><!-- /page* -->
<?php if (!$salidas_edit->IsModal) { ?>
<div class="form-group row"><!-- buttons .form-group -->
	<div class="<?php echo $salidas_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 $salidas_edit->getReturnUrl() ?>"><?php echo $Language->phrase("CancelBtn") ?></button>
	</div><!-- /buttons offset -->
</div><!-- /buttons .form-group -->
<?php } ?>
</form>
<?php
$salidas_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
$salidas_edit->terminate();
?>