<?php

namespace PHPMaker2024\laundrytech;

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

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

        // Add fields
        .setFields([
            ["dnoteID", [fields.dnoteID.visible && fields.dnoteID.required ? ew.Validators.required(fields.dnoteID.caption) : null], fields.dnoteID.isInvalid],
            ["orderId", [fields.orderId.visible && fields.orderId.required ? ew.Validators.required(fields.orderId.caption) : null, ew.Validators.integer], fields.orderId.isInvalid],
            ["dnoteDate", [fields.dnoteDate.visible && fields.dnoteDate.required ? ew.Validators.required(fields.dnoteDate.caption) : null, ew.Validators.datetime(fields.dnoteDate.clientFormatPattern)], fields.dnoteDate.isInvalid],
            ["dnoteValue", [fields.dnoteValue.visible && fields.dnoteValue.required ? ew.Validators.required(fields.dnoteValue.caption) : null, ew.Validators.float], fields.dnoteValue.isInvalid],
            ["createdOn", [fields.createdOn.visible && fields.createdOn.required ? ew.Validators.required(fields.createdOn.caption) : null, ew.Validators.datetime(fields.createdOn.clientFormatPattern)], fields.createdOn.isInvalid],
            ["createdBy", [fields.createdBy.visible && fields.createdBy.required ? ew.Validators.required(fields.createdBy.caption) : null, ew.Validators.integer], fields.createdBy.isInvalid],
            ["driverId", [fields.driverId.visible && fields.driverId.required ? ew.Validators.required(fields.driverId.caption) : null, ew.Validators.integer], fields.driverId.isInvalid],
            ["delivered", [fields.delivered.visible && fields.delivered.required ? ew.Validators.required(fields.delivered.caption) : null, ew.Validators.integer], fields.delivered.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="deliverynote">
<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 ?>">
<div class="ew-edit-div"><!-- page* -->
<?php if ($Page->dnoteID->Visible) { // dnoteID ?>
    <div id="r_dnoteID"<?= $Page->dnoteID->rowAttributes() ?>>
        <label id="elh_deliverynote_dnoteID" class="<?= $Page->LeftColumnClass ?>"><?= $Page->dnoteID->caption() ?><?= $Page->dnoteID->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
        <div class="<?= $Page->RightColumnClass ?>"><div<?= $Page->dnoteID->cellAttributes() ?>>
<span id="el_deliverynote_dnoteID">
<span<?= $Page->dnoteID->viewAttributes() ?>>
<input type="text" readonly class="form-control-plaintext" value="<?= HtmlEncode(RemoveHtml($Page->dnoteID->getDisplayValue($Page->dnoteID->EditValue))) ?>"></span>
<input type="hidden" data-table="deliverynote" data-field="x_dnoteID" data-hidden="1" name="x_dnoteID" id="x_dnoteID" value="<?= HtmlEncode($Page->dnoteID->CurrentValue) ?>">
</span>
</div></div>
    </div>
<?php } ?>
<?php if ($Page->orderId->Visible) { // orderId ?>
    <div id="r_orderId"<?= $Page->orderId->rowAttributes() ?>>
        <label id="elh_deliverynote_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() ?>>
<span id="el_deliverynote_orderId">
<input type="<?= $Page->orderId->getInputTextType() ?>" name="x_orderId" id="x_orderId" data-table="deliverynote" 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>
</div></div>
    </div>
<?php } ?>
<?php if ($Page->dnoteDate->Visible) { // dnoteDate ?>
    <div id="r_dnoteDate"<?= $Page->dnoteDate->rowAttributes() ?>>
        <label id="elh_deliverynote_dnoteDate" for="x_dnoteDate" class="<?= $Page->LeftColumnClass ?>"><?= $Page->dnoteDate->caption() ?><?= $Page->dnoteDate->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
        <div class="<?= $Page->RightColumnClass ?>"><div<?= $Page->dnoteDate->cellAttributes() ?>>
<span id="el_deliverynote_dnoteDate">
<input type="<?= $Page->dnoteDate->getInputTextType() ?>" name="x_dnoteDate" id="x_dnoteDate" data-table="deliverynote" data-field="x_dnoteDate" value="<?= $Page->dnoteDate->EditValue ?>" placeholder="<?= HtmlEncode($Page->dnoteDate->getPlaceHolder()) ?>" data-format-pattern="<?= HtmlEncode($Page->dnoteDate->formatPattern()) ?>"<?= $Page->dnoteDate->editAttributes() ?> aria-describedby="x_dnoteDate_help">
<?= $Page->dnoteDate->getCustomMessage() ?>
<div class="invalid-feedback"><?= $Page->dnoteDate->getErrorMessage() ?></div>
<?php if (!$Page->dnoteDate->ReadOnly && !$Page->dnoteDate->Disabled && !isset($Page->dnoteDate->EditAttrs["readonly"]) && !isset($Page->dnoteDate->EditAttrs["disabled"])) { ?>
<script>
loadjs.ready(["fdeliverynoteedit", "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("fdeliverynoteedit", "x_dnoteDate", ew.deepAssign({"useCurrent":false,"display":{"sideBySide":false}}, options));
});
</script>
<?php } ?>
</span>
</div></div>
    </div>
<?php } ?>
<?php if ($Page->dnoteValue->Visible) { // dnoteValue ?>
    <div id="r_dnoteValue"<?= $Page->dnoteValue->rowAttributes() ?>>
        <label id="elh_deliverynote_dnoteValue" for="x_dnoteValue" class="<?= $Page->LeftColumnClass ?>"><?= $Page->dnoteValue->caption() ?><?= $Page->dnoteValue->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
        <div class="<?= $Page->RightColumnClass ?>"><div<?= $Page->dnoteValue->cellAttributes() ?>>
<span id="el_deliverynote_dnoteValue">
<input type="<?= $Page->dnoteValue->getInputTextType() ?>" name="x_dnoteValue" id="x_dnoteValue" data-table="deliverynote" data-field="x_dnoteValue" value="<?= $Page->dnoteValue->EditValue ?>" size="30" placeholder="<?= HtmlEncode($Page->dnoteValue->getPlaceHolder()) ?>" data-format-pattern="<?= HtmlEncode($Page->dnoteValue->formatPattern()) ?>"<?= $Page->dnoteValue->editAttributes() ?> aria-describedby="x_dnoteValue_help">
<?= $Page->dnoteValue->getCustomMessage() ?>
<div class="invalid-feedback"><?= $Page->dnoteValue->getErrorMessage() ?></div>
</span>
</div></div>
    </div>
<?php } ?>
<?php if ($Page->createdOn->Visible) { // createdOn ?>
    <div id="r_createdOn"<?= $Page->createdOn->rowAttributes() ?>>
        <label id="elh_deliverynote_createdOn" for="x_createdOn" class="<?= $Page->LeftColumnClass ?>"><?= $Page->createdOn->caption() ?><?= $Page->createdOn->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
        <div class="<?= $Page->RightColumnClass ?>"><div<?= $Page->createdOn->cellAttributes() ?>>
<span id="el_deliverynote_createdOn">
<input type="<?= $Page->createdOn->getInputTextType() ?>" name="x_createdOn" id="x_createdOn" data-table="deliverynote" data-field="x_createdOn" value="<?= $Page->createdOn->EditValue ?>" placeholder="<?= HtmlEncode($Page->createdOn->getPlaceHolder()) ?>" data-format-pattern="<?= HtmlEncode($Page->createdOn->formatPattern()) ?>"<?= $Page->createdOn->editAttributes() ?> aria-describedby="x_createdOn_help">
<?= $Page->createdOn->getCustomMessage() ?>
<div class="invalid-feedback"><?= $Page->createdOn->getErrorMessage() ?></div>
<?php if (!$Page->createdOn->ReadOnly && !$Page->createdOn->Disabled && !isset($Page->createdOn->EditAttrs["readonly"]) && !isset($Page->createdOn->EditAttrs["disabled"])) { ?>
<script>
loadjs.ready(["fdeliverynoteedit", "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("fdeliverynoteedit", "x_createdOn", ew.deepAssign({"useCurrent":false,"display":{"sideBySide":false}}, options));
});
</script>
<?php } ?>
</span>
</div></div>
    </div>
<?php } ?>
<?php if ($Page->createdBy->Visible) { // createdBy ?>
    <div id="r_createdBy"<?= $Page->createdBy->rowAttributes() ?>>
        <label id="elh_deliverynote_createdBy" for="x_createdBy" class="<?= $Page->LeftColumnClass ?>"><?= $Page->createdBy->caption() ?><?= $Page->createdBy->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
        <div class="<?= $Page->RightColumnClass ?>"><div<?= $Page->createdBy->cellAttributes() ?>>
<span id="el_deliverynote_createdBy">
<input type="<?= $Page->createdBy->getInputTextType() ?>" name="x_createdBy" id="x_createdBy" data-table="deliverynote" data-field="x_createdBy" value="<?= $Page->createdBy->EditValue ?>" size="30" placeholder="<?= HtmlEncode($Page->createdBy->getPlaceHolder()) ?>" data-format-pattern="<?= HtmlEncode($Page->createdBy->formatPattern()) ?>"<?= $Page->createdBy->editAttributes() ?> aria-describedby="x_createdBy_help">
<?= $Page->createdBy->getCustomMessage() ?>
<div class="invalid-feedback"><?= $Page->createdBy->getErrorMessage() ?></div>
</span>
</div></div>
    </div>
<?php } ?>
<?php if ($Page->driverId->Visible) { // driverId ?>
    <div id="r_driverId"<?= $Page->driverId->rowAttributes() ?>>
        <label id="elh_deliverynote_driverId" for="x_driverId" class="<?= $Page->LeftColumnClass ?>"><?= $Page->driverId->caption() ?><?= $Page->driverId->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
        <div class="<?= $Page->RightColumnClass ?>"><div<?= $Page->driverId->cellAttributes() ?>>
<span id="el_deliverynote_driverId">
<input type="<?= $Page->driverId->getInputTextType() ?>" name="x_driverId" id="x_driverId" data-table="deliverynote" data-field="x_driverId" value="<?= $Page->driverId->EditValue ?>" size="30" placeholder="<?= HtmlEncode($Page->driverId->getPlaceHolder()) ?>" data-format-pattern="<?= HtmlEncode($Page->driverId->formatPattern()) ?>"<?= $Page->driverId->editAttributes() ?> aria-describedby="x_driverId_help">
<?= $Page->driverId->getCustomMessage() ?>
<div class="invalid-feedback"><?= $Page->driverId->getErrorMessage() ?></div>
</span>
</div></div>
    </div>
<?php } ?>
<?php if ($Page->delivered->Visible) { // delivered ?>
    <div id="r_delivered"<?= $Page->delivered->rowAttributes() ?>>
        <label id="elh_deliverynote_delivered" for="x_delivered" class="<?= $Page->LeftColumnClass ?>"><?= $Page->delivered->caption() ?><?= $Page->delivered->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
        <div class="<?= $Page->RightColumnClass ?>"><div<?= $Page->delivered->cellAttributes() ?>>
<span id="el_deliverynote_delivered">
<input type="<?= $Page->delivered->getInputTextType() ?>" name="x_delivered" id="x_delivered" data-table="deliverynote" data-field="x_delivered" value="<?= $Page->delivered->EditValue ?>" size="30" placeholder="<?= HtmlEncode($Page->delivered->getPlaceHolder()) ?>" data-format-pattern="<?= HtmlEncode($Page->delivered->formatPattern()) ?>"<?= $Page->delivered->editAttributes() ?> aria-describedby="x_delivered_help">
<?= $Page->delivered->getCustomMessage() ?>
<div class="invalid-feedback"><?= $Page->delivered->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="fdeliverynoteedit"><?= $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="fdeliverynoteedit" 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("deliverynote");
});
</script>
<script>
loadjs.ready("load", function () {
    // Write your table-specific startup script here, no need to add script tags.
});
</script>
