<?php

namespace PHPMaker2024\laundrytech;

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

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

        // Add fields
        .setFields([
            ["orderArticleID", [fields.orderArticleID.visible && fields.orderArticleID.required ? ew.Validators.required(fields.orderArticleID.caption) : null], fields.orderArticleID.isInvalid],
            ["orderId", [fields.orderId.visible && fields.orderId.required ? ew.Validators.required(fields.orderId.caption) : null, ew.Validators.integer], fields.orderId.isInvalid],
            ["articleId", [fields.articleId.visible && fields.articleId.required ? ew.Validators.required(fields.articleId.caption) : null, ew.Validators.integer], fields.articleId.isInvalid],
            ["qty", [fields.qty.visible && fields.qty.required ? ew.Validators.required(fields.qty.caption) : null, ew.Validators.integer], fields.qty.isInvalid],
            ["rate", [fields.rate.visible && fields.rate.required ? ew.Validators.required(fields.rate.caption) : null, ew.Validators.float], fields.rate.isInvalid],
            ["disc", [fields.disc.visible && fields.disc.required ? ew.Validators.required(fields.disc.caption) : null, ew.Validators.float], fields.disc.isInvalid],
            ["calcamount", [fields.calcamount.visible && fields.calcamount.required ? ew.Validators.required(fields.calcamount.caption) : null, ew.Validators.float], fields.calcamount.isInvalid],
            ["remarks", [fields.remarks.visible && fields.remarks.required ? ew.Validators.required(fields.remarks.caption) : null], fields.remarks.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="orderarticles">
<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->orderArticleID->Visible) { // orderArticleID ?>
    <div id="r_orderArticleID"<?= $Page->orderArticleID->rowAttributes() ?>>
        <label id="elh_orderarticles_orderArticleID" class="<?= $Page->LeftColumnClass ?>"><?= $Page->orderArticleID->caption() ?><?= $Page->orderArticleID->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
        <div class="<?= $Page->RightColumnClass ?>"><div<?= $Page->orderArticleID->cellAttributes() ?>>
<span id="el_orderarticles_orderArticleID">
<span<?= $Page->orderArticleID->viewAttributes() ?>>
<input type="text" readonly class="form-control-plaintext" value="<?= HtmlEncode(RemoveHtml($Page->orderArticleID->getDisplayValue($Page->orderArticleID->EditValue))) ?>"></span>
<input type="hidden" data-table="orderarticles" data-field="x_orderArticleID" data-hidden="1" name="x_orderArticleID" id="x_orderArticleID" value="<?= HtmlEncode($Page->orderArticleID->CurrentValue) ?>">
</span>
</div></div>
    </div>
<?php } ?>
<?php if ($Page->orderId->Visible) { // orderId ?>
    <div id="r_orderId"<?= $Page->orderId->rowAttributes() ?>>
        <label id="elh_orderarticles_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_orderarticles_orderId">
<input type="<?= $Page->orderId->getInputTextType() ?>" name="x_orderId" id="x_orderId" data-table="orderarticles" 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->articleId->Visible) { // articleId ?>
    <div id="r_articleId"<?= $Page->articleId->rowAttributes() ?>>
        <label id="elh_orderarticles_articleId" for="x_articleId" class="<?= $Page->LeftColumnClass ?>"><?= $Page->articleId->caption() ?><?= $Page->articleId->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
        <div class="<?= $Page->RightColumnClass ?>"><div<?= $Page->articleId->cellAttributes() ?>>
<span id="el_orderarticles_articleId">
<input type="<?= $Page->articleId->getInputTextType() ?>" name="x_articleId" id="x_articleId" data-table="orderarticles" data-field="x_articleId" value="<?= $Page->articleId->EditValue ?>" size="30" placeholder="<?= HtmlEncode($Page->articleId->getPlaceHolder()) ?>" data-format-pattern="<?= HtmlEncode($Page->articleId->formatPattern()) ?>"<?= $Page->articleId->editAttributes() ?> aria-describedby="x_articleId_help">
<?= $Page->articleId->getCustomMessage() ?>
<div class="invalid-feedback"><?= $Page->articleId->getErrorMessage() ?></div>
</span>
</div></div>
    </div>
<?php } ?>
<?php if ($Page->qty->Visible) { // qty ?>
    <div id="r_qty"<?= $Page->qty->rowAttributes() ?>>
        <label id="elh_orderarticles_qty" for="x_qty" class="<?= $Page->LeftColumnClass ?>"><?= $Page->qty->caption() ?><?= $Page->qty->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
        <div class="<?= $Page->RightColumnClass ?>"><div<?= $Page->qty->cellAttributes() ?>>
<span id="el_orderarticles_qty">
<input type="<?= $Page->qty->getInputTextType() ?>" name="x_qty" id="x_qty" data-table="orderarticles" data-field="x_qty" value="<?= $Page->qty->EditValue ?>" size="30" placeholder="<?= HtmlEncode($Page->qty->getPlaceHolder()) ?>" data-format-pattern="<?= HtmlEncode($Page->qty->formatPattern()) ?>"<?= $Page->qty->editAttributes() ?> aria-describedby="x_qty_help">
<?= $Page->qty->getCustomMessage() ?>
<div class="invalid-feedback"><?= $Page->qty->getErrorMessage() ?></div>
</span>
</div></div>
    </div>
<?php } ?>
<?php if ($Page->rate->Visible) { // rate ?>
    <div id="r_rate"<?= $Page->rate->rowAttributes() ?>>
        <label id="elh_orderarticles_rate" for="x_rate" class="<?= $Page->LeftColumnClass ?>"><?= $Page->rate->caption() ?><?= $Page->rate->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
        <div class="<?= $Page->RightColumnClass ?>"><div<?= $Page->rate->cellAttributes() ?>>
<span id="el_orderarticles_rate">
<input type="<?= $Page->rate->getInputTextType() ?>" name="x_rate" id="x_rate" data-table="orderarticles" data-field="x_rate" value="<?= $Page->rate->EditValue ?>" size="30" placeholder="<?= HtmlEncode($Page->rate->getPlaceHolder()) ?>" data-format-pattern="<?= HtmlEncode($Page->rate->formatPattern()) ?>"<?= $Page->rate->editAttributes() ?> aria-describedby="x_rate_help">
<?= $Page->rate->getCustomMessage() ?>
<div class="invalid-feedback"><?= $Page->rate->getErrorMessage() ?></div>
</span>
</div></div>
    </div>
<?php } ?>
<?php if ($Page->disc->Visible) { // disc ?>
    <div id="r_disc"<?= $Page->disc->rowAttributes() ?>>
        <label id="elh_orderarticles_disc" for="x_disc" class="<?= $Page->LeftColumnClass ?>"><?= $Page->disc->caption() ?><?= $Page->disc->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
        <div class="<?= $Page->RightColumnClass ?>"><div<?= $Page->disc->cellAttributes() ?>>
<span id="el_orderarticles_disc">
<input type="<?= $Page->disc->getInputTextType() ?>" name="x_disc" id="x_disc" data-table="orderarticles" data-field="x_disc" value="<?= $Page->disc->EditValue ?>" size="30" placeholder="<?= HtmlEncode($Page->disc->getPlaceHolder()) ?>" data-format-pattern="<?= HtmlEncode($Page->disc->formatPattern()) ?>"<?= $Page->disc->editAttributes() ?> aria-describedby="x_disc_help">
<?= $Page->disc->getCustomMessage() ?>
<div class="invalid-feedback"><?= $Page->disc->getErrorMessage() ?></div>
</span>
</div></div>
    </div>
<?php } ?>
<?php if ($Page->calcamount->Visible) { // calcamount ?>
    <div id="r_calcamount"<?= $Page->calcamount->rowAttributes() ?>>
        <label id="elh_orderarticles_calcamount" for="x_calcamount" class="<?= $Page->LeftColumnClass ?>"><?= $Page->calcamount->caption() ?><?= $Page->calcamount->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
        <div class="<?= $Page->RightColumnClass ?>"><div<?= $Page->calcamount->cellAttributes() ?>>
<span id="el_orderarticles_calcamount">
<input type="<?= $Page->calcamount->getInputTextType() ?>" name="x_calcamount" id="x_calcamount" data-table="orderarticles" data-field="x_calcamount" value="<?= $Page->calcamount->EditValue ?>" size="30" placeholder="<?= HtmlEncode($Page->calcamount->getPlaceHolder()) ?>" data-format-pattern="<?= HtmlEncode($Page->calcamount->formatPattern()) ?>"<?= $Page->calcamount->editAttributes() ?> aria-describedby="x_calcamount_help">
<?= $Page->calcamount->getCustomMessage() ?>
<div class="invalid-feedback"><?= $Page->calcamount->getErrorMessage() ?></div>
</span>
</div></div>
    </div>
<?php } ?>
<?php if ($Page->remarks->Visible) { // remarks ?>
    <div id="r_remarks"<?= $Page->remarks->rowAttributes() ?>>
        <label id="elh_orderarticles_remarks" for="x_remarks" class="<?= $Page->LeftColumnClass ?>"><?= $Page->remarks->caption() ?><?= $Page->remarks->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
        <div class="<?= $Page->RightColumnClass ?>"><div<?= $Page->remarks->cellAttributes() ?>>
<span id="el_orderarticles_remarks">
<input type="<?= $Page->remarks->getInputTextType() ?>" name="x_remarks" id="x_remarks" data-table="orderarticles" data-field="x_remarks" value="<?= $Page->remarks->EditValue ?>" size="30" maxlength="255" placeholder="<?= HtmlEncode($Page->remarks->getPlaceHolder()) ?>" data-format-pattern="<?= HtmlEncode($Page->remarks->formatPattern()) ?>"<?= $Page->remarks->editAttributes() ?> aria-describedby="x_remarks_help">
<?= $Page->remarks->getCustomMessage() ?>
<div class="invalid-feedback"><?= $Page->remarks->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="forderarticlesedit"><?= $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="forderarticlesedit" 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("orderarticles");
});
</script>
<script>
loadjs.ready("load", function () {
    // Write your table-specific startup script here, no need to add script tags.
});
</script>
