<?php

namespace PHPMaker2024\laundrytech;

// Page object
$OrdercontainersAdd = &$Page;
?>
<script>
var currentTable = <?= JsonEncode($Page->toClientVar()) ?>;
ew.deepAssign(ew.vars, { tables: { ordercontainers: currentTable } });
var currentPageID = ew.PAGE_ID = "add";
var currentForm;
var fordercontainersadd;
loadjs.ready(["wrapper", "head"], function () {
    let $ = jQuery;
    let fields = currentTable.fields;

    // Form object
    let form = new ew.FormBuilder()
        .setId("fordercontainersadd")
        .setPageId("add")

        // Add fields
        .setFields([
            ["orderId", [fields.orderId.visible && fields.orderId.required ? ew.Validators.required(fields.orderId.caption) : null, ew.Validators.integer], fields.orderId.isInvalid],
            ["ContainerType", [fields.ContainerType.visible && fields.ContainerType.required ? ew.Validators.required(fields.ContainerType.caption) : null, ew.Validators.integer], fields.ContainerType.isInvalid],
            ["NoOfContainers", [fields.NoOfContainers.visible && fields.NoOfContainers.required ? ew.Validators.required(fields.NoOfContainers.caption) : null, ew.Validators.integer], fields.NoOfContainers.isInvalid],
            ["containerPhoto", [fields.containerPhoto.visible && fields.containerPhoto.required ? ew.Validators.required(fields.containerPhoto.caption) : null], fields.containerPhoto.isInvalid],
            ["containerId", [fields.containerId.visible && fields.containerId.required ? ew.Validators.required(fields.containerId.caption) : null, ew.Validators.integer], fields.containerId.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({
            "ContainerType": <?= $Page->ContainerType->toClientList($Page) ?>,
        })
        .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 $Page->showPageHeader(); ?>
<?php
$Page->showMessage();
?>
<form name="fordercontainersadd" id="fordercontainersadd" class="<?= $Page->FormClassName ?>" action="<?= CurrentPageUrl(false) ?>" method="post" novalidate autocomplete="off">
<?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="ordercontainers">
<input type="hidden" name="action" id="action" value="insert">
<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-add-div"><!-- page* -->
<?php if ($Page->orderId->Visible) { // orderId ?>
    <div id="r_orderId"<?= $Page->orderId->rowAttributes() ?>>
        <label id="elh_ordercontainers_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_ordercontainers_orderId">
<input type="<?= $Page->orderId->getInputTextType() ?>" name="x_orderId" id="x_orderId" data-table="ordercontainers" 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->ContainerType->Visible) { // ContainerType ?>
    <div id="r_ContainerType"<?= $Page->ContainerType->rowAttributes() ?>>
        <label id="elh_ordercontainers_ContainerType" class="<?= $Page->LeftColumnClass ?>"><?= $Page->ContainerType->caption() ?><?= $Page->ContainerType->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
        <div class="<?= $Page->RightColumnClass ?>"><div<?= $Page->ContainerType->cellAttributes() ?>>
<span id="el_ordercontainers_ContainerType">
<?php
if (IsRTL()) {
    $Page->ContainerType->EditAttrs["dir"] = "rtl";
}
?>
<span id="as_x_ContainerType" class="ew-auto-suggest">
    <input type="<?= $Page->ContainerType->getInputTextType() ?>" class="form-control" name="sv_x_ContainerType" id="sv_x_ContainerType" value="<?= RemoveHtml($Page->ContainerType->EditValue) ?>" autocomplete="off" size="30" placeholder="<?= HtmlEncode($Page->ContainerType->getPlaceHolder()) ?>" data-placeholder="<?= HtmlEncode($Page->ContainerType->getPlaceHolder()) ?>" data-format-pattern="<?= HtmlEncode($Page->ContainerType->formatPattern()) ?>"<?= $Page->ContainerType->editAttributes() ?> aria-describedby="x_ContainerType_help">
</span>
<selection-list hidden class="form-control" data-table="ordercontainers" data-field="x_ContainerType" data-input="sv_x_ContainerType" data-value-separator="<?= $Page->ContainerType->displayValueSeparatorAttribute() ?>" name="x_ContainerType" id="x_ContainerType" value="<?= HtmlEncode($Page->ContainerType->CurrentValue) ?>"></selection-list>
<?= $Page->ContainerType->getCustomMessage() ?>
<div class="invalid-feedback"><?= $Page->ContainerType->getErrorMessage() ?></div>
<script>
loadjs.ready("fordercontainersadd", function() {
    fordercontainersadd.createAutoSuggest(Object.assign({"id":"x_ContainerType","forceSelect":false}, { lookupAllDisplayFields: <?= $Page->ContainerType->Lookup->LookupAllDisplayFields ? "true" : "false" ?> }, ew.vars.tables.ordercontainers.fields.ContainerType.autoSuggestOptions));
});
</script>
<?= $Page->ContainerType->Lookup->getParamTag($Page, "p_x_ContainerType") ?>
</span>
</div></div>
    </div>
<?php } ?>
<?php if ($Page->NoOfContainers->Visible) { // NoOfContainers ?>
    <div id="r_NoOfContainers"<?= $Page->NoOfContainers->rowAttributes() ?>>
        <label id="elh_ordercontainers_NoOfContainers" for="x_NoOfContainers" class="<?= $Page->LeftColumnClass ?>"><?= $Page->NoOfContainers->caption() ?><?= $Page->NoOfContainers->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
        <div class="<?= $Page->RightColumnClass ?>"><div<?= $Page->NoOfContainers->cellAttributes() ?>>
<span id="el_ordercontainers_NoOfContainers">
<input type="<?= $Page->NoOfContainers->getInputTextType() ?>" name="x_NoOfContainers" id="x_NoOfContainers" data-table="ordercontainers" data-field="x_NoOfContainers" value="<?= $Page->NoOfContainers->EditValue ?>" size="30" placeholder="<?= HtmlEncode($Page->NoOfContainers->getPlaceHolder()) ?>" data-format-pattern="<?= HtmlEncode($Page->NoOfContainers->formatPattern()) ?>"<?= $Page->NoOfContainers->editAttributes() ?> aria-describedby="x_NoOfContainers_help">
<?= $Page->NoOfContainers->getCustomMessage() ?>
<div class="invalid-feedback"><?= $Page->NoOfContainers->getErrorMessage() ?></div>
</span>
</div></div>
    </div>
<?php } ?>
<?php if ($Page->containerPhoto->Visible) { // containerPhoto ?>
    <div id="r_containerPhoto"<?= $Page->containerPhoto->rowAttributes() ?>>
        <label id="elh_ordercontainers_containerPhoto" for="x_containerPhoto" class="<?= $Page->LeftColumnClass ?>"><?= $Page->containerPhoto->caption() ?><?= $Page->containerPhoto->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
        <div class="<?= $Page->RightColumnClass ?>"><div<?= $Page->containerPhoto->cellAttributes() ?>>
<span id="el_ordercontainers_containerPhoto">
<input type="<?= $Page->containerPhoto->getInputTextType() ?>" name="x_containerPhoto" id="x_containerPhoto" data-table="ordercontainers" data-field="x_containerPhoto" value="<?= $Page->containerPhoto->EditValue ?>" size="30" maxlength="255" placeholder="<?= HtmlEncode($Page->containerPhoto->getPlaceHolder()) ?>" data-format-pattern="<?= HtmlEncode($Page->containerPhoto->formatPattern()) ?>"<?= $Page->containerPhoto->editAttributes() ?> aria-describedby="x_containerPhoto_help">
<?= $Page->containerPhoto->getCustomMessage() ?>
<div class="invalid-feedback"><?= $Page->containerPhoto->getErrorMessage() ?></div>
</span>
</div></div>
    </div>
<?php } ?>
<?php if ($Page->containerId->Visible) { // containerId ?>
    <div id="r_containerId"<?= $Page->containerId->rowAttributes() ?>>
        <label id="elh_ordercontainers_containerId" for="x_containerId" class="<?= $Page->LeftColumnClass ?>"><?= $Page->containerId->caption() ?><?= $Page->containerId->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
        <div class="<?= $Page->RightColumnClass ?>"><div<?= $Page->containerId->cellAttributes() ?>>
<span id="el_ordercontainers_containerId">
<input type="<?= $Page->containerId->getInputTextType() ?>" name="x_containerId" id="x_containerId" data-table="ordercontainers" data-field="x_containerId" value="<?= $Page->containerId->EditValue ?>" size="30" placeholder="<?= HtmlEncode($Page->containerId->getPlaceHolder()) ?>" data-format-pattern="<?= HtmlEncode($Page->containerId->formatPattern()) ?>"<?= $Page->containerId->editAttributes() ?> aria-describedby="x_containerId_help">
<?= $Page->containerId->getCustomMessage() ?>
<div class="invalid-feedback"><?= $Page->containerId->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="fordercontainersadd"><?= $Language->phrase("AddBtn") ?></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="fordercontainersadd" data-href="<?= HtmlEncode(GetUrl($Page->getReturnUrl())) ?>"><?= $Language->phrase("CancelBtn") ?></button>
<?php } ?>
    </div><!-- /buttons offset -->
<?= $Page->IsModal ? "</template>" : "</div>" ?><!-- /buttons .row -->
</form>
<?php
$Page->showPageFooter();
echo GetDebugMessage();
?>
<script>
// Field event handlers
loadjs.ready("head", function() {
    ew.addEventHandlers("ordercontainers");
});
</script>
<script>
loadjs.ready("load", function () {
    // Write your table-specific startup script here, no need to add script tags.
});
</script>
