<?php

namespace PHPMaker2024\laundrytech;

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

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

        // Add fields
        .setFields([
            ["stageId", [fields.stageId.visible && fields.stageId.required ? ew.Validators.required(fields.stageId.caption) : null, ew.Validators.integer], fields.stageId.isInvalid],
            ["groupId", [fields.groupId.visible && fields.groupId.required ? ew.Validators.required(fields.groupId.caption) : null, ew.Validators.integer], fields.groupId.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="fstagegroupassignmentadd" id="fstagegroupassignmentadd" 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="stagegroupassignment">
<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->stageId->Visible) { // stageId ?>
    <div id="r_stageId"<?= $Page->stageId->rowAttributes() ?>>
        <label id="elh_stagegroupassignment_stageId" for="x_stageId" class="<?= $Page->LeftColumnClass ?>"><?= $Page->stageId->caption() ?><?= $Page->stageId->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
        <div class="<?= $Page->RightColumnClass ?>"><div<?= $Page->stageId->cellAttributes() ?>>
<span id="el_stagegroupassignment_stageId">
<input type="<?= $Page->stageId->getInputTextType() ?>" name="x_stageId" id="x_stageId" data-table="stagegroupassignment" data-field="x_stageId" value="<?= $Page->stageId->EditValue ?>" size="30" placeholder="<?= HtmlEncode($Page->stageId->getPlaceHolder()) ?>" data-format-pattern="<?= HtmlEncode($Page->stageId->formatPattern()) ?>"<?= $Page->stageId->editAttributes() ?> aria-describedby="x_stageId_help">
<?= $Page->stageId->getCustomMessage() ?>
<div class="invalid-feedback"><?= $Page->stageId->getErrorMessage() ?></div>
</span>
</div></div>
    </div>
<?php } ?>
<?php if ($Page->groupId->Visible) { // groupId ?>
    <div id="r_groupId"<?= $Page->groupId->rowAttributes() ?>>
        <label id="elh_stagegroupassignment_groupId" for="x_groupId" class="<?= $Page->LeftColumnClass ?>"><?= $Page->groupId->caption() ?><?= $Page->groupId->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
        <div class="<?= $Page->RightColumnClass ?>"><div<?= $Page->groupId->cellAttributes() ?>>
<span id="el_stagegroupassignment_groupId">
<input type="<?= $Page->groupId->getInputTextType() ?>" name="x_groupId" id="x_groupId" data-table="stagegroupassignment" data-field="x_groupId" value="<?= $Page->groupId->EditValue ?>" size="30" placeholder="<?= HtmlEncode($Page->groupId->getPlaceHolder()) ?>" data-format-pattern="<?= HtmlEncode($Page->groupId->formatPattern()) ?>"<?= $Page->groupId->editAttributes() ?> aria-describedby="x_groupId_help">
<?= $Page->groupId->getCustomMessage() ?>
<div class="invalid-feedback"><?= $Page->groupId->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="fstagegroupassignmentadd"><?= $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="fstagegroupassignmentadd" 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("stagegroupassignment");
});
</script>
<script>
loadjs.ready("load", function () {
    // Write your table-specific startup script here, no need to add script tags.
});
</script>
