<?php

namespace PHPMaker2024\laundrytech;

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

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

        // Add fields
        .setFields([
            ["pricelistName", [fields.pricelistName.visible && fields.pricelistName.required ? ew.Validators.required(fields.pricelistName.caption) : null], fields.pricelistName.isInvalid],
            ["priceListNotes", [fields.priceListNotes.visible && fields.priceListNotes.required ? ew.Validators.required(fields.priceListNotes.caption) : null], fields.priceListNotes.isInvalid],
            ["customerId", [fields.customerId.visible && fields.customerId.required ? ew.Validators.required(fields.customerId.caption) : null, ew.Validators.integer], fields.customerId.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 $Page->showPageHeader(); ?>
<?php
$Page->showMessage();
?>
<form name="fpricelistmasteradd" id="fpricelistmasteradd" 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="pricelistmaster">
<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 ?>">
<div class="ew-add-div"><!-- page* -->
<?php if ($Page->pricelistName->Visible) { // pricelistName ?>
    <div id="r_pricelistName"<?= $Page->pricelistName->rowAttributes() ?>>
        <label id="elh_pricelistmaster_pricelistName" for="x_pricelistName" class="<?= $Page->LeftColumnClass ?>"><?= $Page->pricelistName->caption() ?><?= $Page->pricelistName->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
        <div class="<?= $Page->RightColumnClass ?>"><div<?= $Page->pricelistName->cellAttributes() ?>>
<span id="el_pricelistmaster_pricelistName">
<input type="<?= $Page->pricelistName->getInputTextType() ?>" name="x_pricelistName" id="x_pricelistName" data-table="pricelistmaster" data-field="x_pricelistName" value="<?= $Page->pricelistName->EditValue ?>" size="30" maxlength="255" placeholder="<?= HtmlEncode($Page->pricelistName->getPlaceHolder()) ?>" data-format-pattern="<?= HtmlEncode($Page->pricelistName->formatPattern()) ?>"<?= $Page->pricelistName->editAttributes() ?> aria-describedby="x_pricelistName_help">
<?= $Page->pricelistName->getCustomMessage() ?>
<div class="invalid-feedback"><?= $Page->pricelistName->getErrorMessage() ?></div>
</span>
</div></div>
    </div>
<?php } ?>
<?php if ($Page->priceListNotes->Visible) { // priceListNotes ?>
    <div id="r_priceListNotes"<?= $Page->priceListNotes->rowAttributes() ?>>
        <label id="elh_pricelistmaster_priceListNotes" for="x_priceListNotes" class="<?= $Page->LeftColumnClass ?>"><?= $Page->priceListNotes->caption() ?><?= $Page->priceListNotes->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
        <div class="<?= $Page->RightColumnClass ?>"><div<?= $Page->priceListNotes->cellAttributes() ?>>
<span id="el_pricelistmaster_priceListNotes">
<input type="<?= $Page->priceListNotes->getInputTextType() ?>" name="x_priceListNotes" id="x_priceListNotes" data-table="pricelistmaster" data-field="x_priceListNotes" value="<?= $Page->priceListNotes->EditValue ?>" size="30" maxlength="255" placeholder="<?= HtmlEncode($Page->priceListNotes->getPlaceHolder()) ?>" data-format-pattern="<?= HtmlEncode($Page->priceListNotes->formatPattern()) ?>"<?= $Page->priceListNotes->editAttributes() ?> aria-describedby="x_priceListNotes_help">
<?= $Page->priceListNotes->getCustomMessage() ?>
<div class="invalid-feedback"><?= $Page->priceListNotes->getErrorMessage() ?></div>
</span>
</div></div>
    </div>
<?php } ?>
<?php if ($Page->customerId->Visible) { // customerId ?>
    <div id="r_customerId"<?= $Page->customerId->rowAttributes() ?>>
        <label id="elh_pricelistmaster_customerId" for="x_customerId" class="<?= $Page->LeftColumnClass ?>"><?= $Page->customerId->caption() ?><?= $Page->customerId->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
        <div class="<?= $Page->RightColumnClass ?>"><div<?= $Page->customerId->cellAttributes() ?>>
<span id="el_pricelistmaster_customerId">
<input type="<?= $Page->customerId->getInputTextType() ?>" name="x_customerId" id="x_customerId" data-table="pricelistmaster" data-field="x_customerId" value="<?= $Page->customerId->EditValue ?>" size="30" placeholder="<?= HtmlEncode($Page->customerId->getPlaceHolder()) ?>" data-format-pattern="<?= HtmlEncode($Page->customerId->formatPattern()) ?>"<?= $Page->customerId->editAttributes() ?> aria-describedby="x_customerId_help">
<?= $Page->customerId->getCustomMessage() ?>
<div class="invalid-feedback"><?= $Page->customerId->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="fpricelistmasteradd"><?= $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="fpricelistmasteradd" 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("pricelistmaster");
});
</script>
<script>
loadjs.ready("load", function () {
    // Write your table-specific startup script here, no need to add script tags.
});
</script>
