<?php

namespace PHPMaker2024\laundrytech;

// Page object
$OrderstagesEdit = &$Page;
?>
<?php $Page->showPageHeader(); ?>
<?php
$Page->showMessage();
?>
<main class="edit">
<form name="forderstagesedit" id="forderstagesedit" class="<?= $Page->FormClassName ?>" action="<?= CurrentPageUrl(false) ?>" method="post" novalidate autocomplete="off">
<script>
var currentTable = <?= JsonEncode($Page->toClientVar()) ?>;
ew.deepAssign(ew.vars, { tables: { orderstages: currentTable } });
var currentPageID = ew.PAGE_ID = "edit";
var currentForm;
var forderstagesedit;
loadjs.ready(["wrapper", "head"], function () {
    let $ = jQuery;
    let fields = currentTable.fields;

    // Form object
    let form = new ew.FormBuilder()
        .setId("forderstagesedit")
        .setPageId("edit")

        // Add fields
        .setFields([
            ["orderstageid", [fields.orderstageid.visible && fields.orderstageid.required ? ew.Validators.required(fields.orderstageid.caption) : null], fields.orderstageid.isInvalid],
            ["orderid", [fields.orderid.visible && fields.orderid.required ? ew.Validators.required(fields.orderid.caption) : null, ew.Validators.integer], fields.orderid.isInvalid],
            ["stageid", [fields.stageid.visible && fields.stageid.required ? ew.Validators.required(fields.stageid.caption) : null, ew.Validators.integer], fields.stageid.isInvalid],
            ["_userid", [fields._userid.visible && fields._userid.required ? ew.Validators.required(fields._userid.caption) : null, ew.Validators.integer], fields._userid.isInvalid],
            ["orderdatetime", [fields.orderdatetime.visible && fields.orderdatetime.required ? ew.Validators.required(fields.orderdatetime.caption) : null, ew.Validators.datetime(fields.orderdatetime.clientFormatPattern)], fields.orderdatetime.isInvalid],
            ["processedBy", [fields.processedBy.visible && fields.processedBy.required ? ew.Validators.required(fields.processedBy.caption) : null, ew.Validators.integer], fields.processedBy.isInvalid],
            ["stationId", [fields.stationId.visible && fields.stationId.required ? ew.Validators.required(fields.stationId.caption) : null, ew.Validators.integer], fields.stationId.isInvalid]
        ])

        // Form_CustomValidate
        .setCustomValidate(
            function (fobj) { // DO NOT CHANGE THIS LINE! (except for adding "async" keyword)!
                    // Your custom validation code here, return false if invalid.
                    return true;
                }
        )

        // Use JavaScript validation or not
        .setValidateRequired(ew.CLIENT_VALIDATE)

        // Dynamic selection lists
        .setLists({
        })
        .build();
    window[form.id] = form;
    currentForm = form;
    loadjs.done(form.id);
});
</script>
<script>
loadjs.ready("head", function () {
    // Write your table-specific client script here, no need to add script tags.
});
</script>
<?php if (Config("CHECK_TOKEN")) { ?>
<input type="hidden" name="<?= $TokenNameKey ?>" value="<?= $TokenName ?>"><!-- CSRF token name -->
<input type="hidden" name="<?= $TokenValueKey ?>" value="<?= $TokenValue ?>"><!-- CSRF token value -->
<?php } ?>
<input type="hidden" name="t" value="orderstages">
<input type="hidden" name="action" id="action" value="update">
<input type="hidden" name="modal" value="<?= (int)$Page->IsModal ?>">
<?php if (IsJsonResponse()) { ?>
<input type="hidden" name="json" value="1">
<?php } ?>
<input type="hidden" name="<?= $Page->OldKeyName ?>" value="<?= $Page->OldKey ?>">
<?php if ($Page->getCurrentMasterTable() == "orders") { ?>
<input type="hidden" name="<?= Config("TABLE_SHOW_MASTER") ?>" value="orders">
<input type="hidden" name="fk_orderid" value="<?= HtmlEncode($Page->orderid->getSessionValue()) ?>">
<?php } ?>
<div class="ew-edit-div"><!-- page* -->
<?php if ($Page->orderstageid->Visible) { // orderstageid ?>
    <div id="r_orderstageid"<?= $Page->orderstageid->rowAttributes() ?>>
        <label id="elh_orderstages_orderstageid" class="<?= $Page->LeftColumnClass ?>"><?= $Page->orderstageid->caption() ?><?= $Page->orderstageid->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
        <div class="<?= $Page->RightColumnClass ?>"><div<?= $Page->orderstageid->cellAttributes() ?>>
<span id="el_orderstages_orderstageid">
<span<?= $Page->orderstageid->viewAttributes() ?>>
<input type="text" readonly class="form-control-plaintext" value="<?= HtmlEncode(RemoveHtml($Page->orderstageid->getDisplayValue($Page->orderstageid->EditValue))) ?>"></span>
<input type="hidden" data-table="orderstages" data-field="x_orderstageid" data-hidden="1" name="x_orderstageid" id="x_orderstageid" value="<?= HtmlEncode($Page->orderstageid->CurrentValue) ?>">
</span>
</div></div>
    </div>
<?php } ?>
<?php if ($Page->orderid->Visible) { // orderid ?>
    <div id="r_orderid"<?= $Page->orderid->rowAttributes() ?>>
        <label id="elh_orderstages_orderid" for="x_orderid" class="<?= $Page->LeftColumnClass ?>"><?= $Page->orderid->caption() ?><?= $Page->orderid->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
        <div class="<?= $Page->RightColumnClass ?>"><div<?= $Page->orderid->cellAttributes() ?>>
<?php if ($Page->orderid->getSessionValue() != "") { ?>
<span<?= $Page->orderid->viewAttributes() ?>>
<input type="text" readonly class="form-control-plaintext" value="<?= HtmlEncode(RemoveHtml($Page->orderid->getDisplayValue($Page->orderid->ViewValue))) ?>"></span>
<input type="hidden" id="x_orderid" name="x_orderid" value="<?= HtmlEncode($Page->orderid->CurrentValue) ?>" data-hidden="1">
<?php } else { ?>
<span id="el_orderstages_orderid">
<input type="<?= $Page->orderid->getInputTextType() ?>" name="x_orderid" id="x_orderid" data-table="orderstages" data-field="x_orderid" value="<?= $Page->orderid->EditValue ?>" size="30" placeholder="<?= HtmlEncode($Page->orderid->getPlaceHolder()) ?>" data-format-pattern="<?= HtmlEncode($Page->orderid->formatPattern()) ?>"<?= $Page->orderid->editAttributes() ?> aria-describedby="x_orderid_help">
<?= $Page->orderid->getCustomMessage() ?>
<div class="invalid-feedback"><?= $Page->orderid->getErrorMessage() ?></div>
</span>
<?php } ?>
</div></div>
    </div>
<?php } ?>
<?php if ($Page->stageid->Visible) { // stageid ?>
    <div id="r_stageid"<?= $Page->stageid->rowAttributes() ?>>
        <label id="elh_orderstages_stageid" for="x_stageid" class="<?= $Page->LeftColumnClass ?>"><?= $Page->stageid->caption() ?><?= $Page->stageid->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
        <div class="<?= $Page->RightColumnClass ?>"><div<?= $Page->stageid->cellAttributes() ?>>
<span id="el_orderstages_stageid">
<input type="<?= $Page->stageid->getInputTextType() ?>" name="x_stageid" id="x_stageid" data-table="orderstages" data-field="x_stageid" value="<?= $Page->stageid->EditValue ?>" size="30" placeholder="<?= HtmlEncode($Page->stageid->getPlaceHolder()) ?>" data-format-pattern="<?= HtmlEncode($Page->stageid->formatPattern()) ?>"<?= $Page->stageid->editAttributes() ?> aria-describedby="x_stageid_help">
<?= $Page->stageid->getCustomMessage() ?>
<div class="invalid-feedback"><?= $Page->stageid->getErrorMessage() ?></div>
</span>
</div></div>
    </div>
<?php } ?>
<?php if ($Page->_userid->Visible) { // userid ?>
    <div id="r__userid"<?= $Page->_userid->rowAttributes() ?>>
        <label id="elh_orderstages__userid" for="x__userid" class="<?= $Page->LeftColumnClass ?>"><?= $Page->_userid->caption() ?><?= $Page->_userid->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
        <div class="<?= $Page->RightColumnClass ?>"><div<?= $Page->_userid->cellAttributes() ?>>
<span id="el_orderstages__userid">
<input type="<?= $Page->_userid->getInputTextType() ?>" name="x__userid" id="x__userid" data-table="orderstages" data-field="x__userid" value="<?= $Page->_userid->EditValue ?>" size="30" placeholder="<?= HtmlEncode($Page->_userid->getPlaceHolder()) ?>" data-format-pattern="<?= HtmlEncode($Page->_userid->formatPattern()) ?>"<?= $Page->_userid->editAttributes() ?> aria-describedby="x__userid_help">
<?= $Page->_userid->getCustomMessage() ?>
<div class="invalid-feedback"><?= $Page->_userid->getErrorMessage() ?></div>
</span>
</div></div>
    </div>
<?php } ?>
<?php if ($Page->orderdatetime->Visible) { // orderdatetime ?>
    <div id="r_orderdatetime"<?= $Page->orderdatetime->rowAttributes() ?>>
        <label id="elh_orderstages_orderdatetime" for="x_orderdatetime" class="<?= $Page->LeftColumnClass ?>"><?= $Page->orderdatetime->caption() ?><?= $Page->orderdatetime->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
        <div class="<?= $Page->RightColumnClass ?>"><div<?= $Page->orderdatetime->cellAttributes() ?>>
<span id="el_orderstages_orderdatetime">
<input type="<?= $Page->orderdatetime->getInputTextType() ?>" name="x_orderdatetime" id="x_orderdatetime" data-table="orderstages" data-field="x_orderdatetime" value="<?= $Page->orderdatetime->EditValue ?>" placeholder="<?= HtmlEncode($Page->orderdatetime->getPlaceHolder()) ?>" data-format-pattern="<?= HtmlEncode($Page->orderdatetime->formatPattern()) ?>"<?= $Page->orderdatetime->editAttributes() ?> aria-describedby="x_orderdatetime_help">
<?= $Page->orderdatetime->getCustomMessage() ?>
<div class="invalid-feedback"><?= $Page->orderdatetime->getErrorMessage() ?></div>
<?php if (!$Page->orderdatetime->ReadOnly && !$Page->orderdatetime->Disabled && !isset($Page->orderdatetime->EditAttrs["readonly"]) && !isset($Page->orderdatetime->EditAttrs["disabled"])) { ?>
<script>
loadjs.ready(["forderstagesedit", "datetimepicker"], function () {
    let format = "<?= DateFormat(0) ?>",
        options = {
            localization: {
                locale: ew.LANGUAGE_ID + "-u-nu-" + ew.getNumberingSystem(),
                hourCycle: format.match(/H/) ? "h24" : "h12",
                format,
                ...ew.language.phrase("datetimepicker")
            },
            display: {
                icons: {
                    previous: ew.IS_RTL ? "fa-solid fa-chevron-right" : "fa-solid fa-chevron-left",
                    next: ew.IS_RTL ? "fa-solid fa-chevron-left" : "fa-solid fa-chevron-right"
                },
                components: {
                    hours: !!format.match(/h/i),
                    minutes: !!format.match(/m/),
                    seconds: !!format.match(/s/i)
                },
                theme: ew.getPreferredTheme()
            }
        };
    ew.createDateTimePicker("forderstagesedit", "x_orderdatetime", ew.deepAssign({"useCurrent":false,"display":{"sideBySide":false}}, options));
});
</script>
<?php } ?>
</span>
</div></div>
    </div>
<?php } ?>
<?php if ($Page->processedBy->Visible) { // processedBy ?>
    <div id="r_processedBy"<?= $Page->processedBy->rowAttributes() ?>>
        <label id="elh_orderstages_processedBy" for="x_processedBy" class="<?= $Page->LeftColumnClass ?>"><?= $Page->processedBy->caption() ?><?= $Page->processedBy->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
        <div class="<?= $Page->RightColumnClass ?>"><div<?= $Page->processedBy->cellAttributes() ?>>
<span id="el_orderstages_processedBy">
<input type="<?= $Page->processedBy->getInputTextType() ?>" name="x_processedBy" id="x_processedBy" data-table="orderstages" data-field="x_processedBy" value="<?= $Page->processedBy->EditValue ?>" size="30" placeholder="<?= HtmlEncode($Page->processedBy->getPlaceHolder()) ?>" data-format-pattern="<?= HtmlEncode($Page->processedBy->formatPattern()) ?>"<?= $Page->processedBy->editAttributes() ?> aria-describedby="x_processedBy_help">
<?= $Page->processedBy->getCustomMessage() ?>
<div class="invalid-feedback"><?= $Page->processedBy->getErrorMessage() ?></div>
</span>
</div></div>
    </div>
<?php } ?>
<?php if ($Page->stationId->Visible) { // stationId ?>
    <div id="r_stationId"<?= $Page->stationId->rowAttributes() ?>>
        <label id="elh_orderstages_stationId" for="x_stationId" class="<?= $Page->LeftColumnClass ?>"><?= $Page->stationId->caption() ?><?= $Page->stationId->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
        <div class="<?= $Page->RightColumnClass ?>"><div<?= $Page->stationId->cellAttributes() ?>>
<span id="el_orderstages_stationId">
<input type="<?= $Page->stationId->getInputTextType() ?>" name="x_stationId" id="x_stationId" data-table="orderstages" data-field="x_stationId" value="<?= $Page->stationId->EditValue ?>" size="30" placeholder="<?= HtmlEncode($Page->stationId->getPlaceHolder()) ?>" data-format-pattern="<?= HtmlEncode($Page->stationId->formatPattern()) ?>"<?= $Page->stationId->editAttributes() ?> aria-describedby="x_stationId_help">
<?= $Page->stationId->getCustomMessage() ?>
<div class="invalid-feedback"><?= $Page->stationId->getErrorMessage() ?></div>
</span>
</div></div>
    </div>
<?php } ?>
</div><!-- /page* -->
<?= $Page->IsModal ? '<template class="ew-modal-buttons">' : '<div class="row ew-buttons">' ?><!-- buttons .row -->
    <div class="<?= $Page->OffsetColumnClass ?>"><!-- buttons offset -->
<button class="btn btn-primary ew-btn" name="btn-action" id="btn-action" type="submit" form="forderstagesedit"><?= $Language->phrase("SaveBtn") ?></button>
<?php if (IsJsonResponse()) { ?>
<button class="btn btn-default ew-btn" name="btn-cancel" id="btn-cancel" type="button" data-bs-dismiss="modal"><?= $Language->phrase("CancelBtn") ?></button>
<?php } else { ?>
<button class="btn btn-default ew-btn" name="btn-cancel" id="btn-cancel" type="button" form="forderstagesedit" data-href="<?= HtmlEncode(GetUrl($Page->getReturnUrl())) ?>"><?= $Language->phrase("CancelBtn") ?></button>
<?php } ?>
    </div><!-- /buttons offset -->
<?= $Page->IsModal ? "</template>" : "</div>" ?><!-- /buttons .row -->
</form>
</main>
<?php
$Page->showPageFooter();
echo GetDebugMessage();
?>
<script>
// Field event handlers
loadjs.ready("head", function() {
    ew.addEventHandlers("orderstages");
});
</script>
<script>
loadjs.ready("load", function () {
    // Write your table-specific startup script here, no need to add script tags.
});
</script>
