<?php

namespace PHPMaker2024\laundrytech;

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

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

        // Add fields
        .setFields([
            ["packageTypeId", [fields.packageTypeId.visible && fields.packageTypeId.required ? ew.Validators.required(fields.packageTypeId.caption) : null], fields.packageTypeId.isInvalid],
            ["packageTypeName", [fields.packageTypeName.visible && fields.packageTypeName.required ? ew.Validators.required(fields.packageTypeName.caption) : null], fields.packageTypeName.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="packagetypes">
<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->packageTypeId->Visible) { // packageTypeId ?>
    <div id="r_packageTypeId"<?= $Page->packageTypeId->rowAttributes() ?>>
        <label id="elh_packagetypes_packageTypeId" class="<?= $Page->LeftColumnClass ?>"><?= $Page->packageTypeId->caption() ?><?= $Page->packageTypeId->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
        <div class="<?= $Page->RightColumnClass ?>"><div<?= $Page->packageTypeId->cellAttributes() ?>>
<span id="el_packagetypes_packageTypeId">
<span<?= $Page->packageTypeId->viewAttributes() ?>>
<input type="text" readonly class="form-control-plaintext" value="<?= HtmlEncode(RemoveHtml($Page->packageTypeId->getDisplayValue($Page->packageTypeId->EditValue))) ?>"></span>
<input type="hidden" data-table="packagetypes" data-field="x_packageTypeId" data-hidden="1" name="x_packageTypeId" id="x_packageTypeId" value="<?= HtmlEncode($Page->packageTypeId->CurrentValue) ?>">
</span>
</div></div>
    </div>
<?php } ?>
<?php if ($Page->packageTypeName->Visible) { // packageTypeName ?>
    <div id="r_packageTypeName"<?= $Page->packageTypeName->rowAttributes() ?>>
        <label id="elh_packagetypes_packageTypeName" for="x_packageTypeName" class="<?= $Page->LeftColumnClass ?>"><?= $Page->packageTypeName->caption() ?><?= $Page->packageTypeName->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
        <div class="<?= $Page->RightColumnClass ?>"><div<?= $Page->packageTypeName->cellAttributes() ?>>
<span id="el_packagetypes_packageTypeName">
<input type="<?= $Page->packageTypeName->getInputTextType() ?>" name="x_packageTypeName" id="x_packageTypeName" data-table="packagetypes" data-field="x_packageTypeName" value="<?= $Page->packageTypeName->EditValue ?>" size="30" maxlength="255" placeholder="<?= HtmlEncode($Page->packageTypeName->getPlaceHolder()) ?>" data-format-pattern="<?= HtmlEncode($Page->packageTypeName->formatPattern()) ?>"<?= $Page->packageTypeName->editAttributes() ?> aria-describedby="x_packageTypeName_help">
<?= $Page->packageTypeName->getCustomMessage() ?>
<div class="invalid-feedback"><?= $Page->packageTypeName->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="fpackagetypesedit"><?= $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="fpackagetypesedit" 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("packagetypes");
});
</script>
<script>
loadjs.ready("load", function () {
    // Write your table-specific startup script here, no need to add script tags.
});
</script>
