<?php

namespace PHPMaker2024\laundrytech;

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

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

        // Add fields
        .setFields([
            ["custArticleId", [fields.custArticleId.visible && fields.custArticleId.required ? ew.Validators.required(fields.custArticleId.caption) : null], fields.custArticleId.isInvalid],
            ["customerId", [fields.customerId.visible && fields.customerId.required ? ew.Validators.required(fields.customerId.caption) : null, ew.Validators.integer], fields.customerId.isInvalid],
            ["articleId", [fields.articleId.visible && fields.articleId.required ? ew.Validators.required(fields.articleId.caption) : null, ew.Validators.integer], fields.articleId.isInvalid],
            ["rate", [fields.rate.visible && fields.rate.required ? ew.Validators.required(fields.rate.caption) : null, ew.Validators.float], fields.rate.isInvalid],
            ["discountper", [fields.discountper.visible && fields.discountper.required ? ew.Validators.required(fields.discountper.caption) : null, ew.Validators.float], fields.discountper.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="customerhasarticles">
<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() == "customers") { ?>
<input type="hidden" name="<?= Config("TABLE_SHOW_MASTER") ?>" value="customers">
<input type="hidden" name="fk_customerid" value="<?= HtmlEncode($Page->customerId->getSessionValue()) ?>">
<?php } ?>
<div class="ew-edit-div"><!-- page* -->
<?php if ($Page->custArticleId->Visible) { // custArticleId ?>
    <div id="r_custArticleId"<?= $Page->custArticleId->rowAttributes() ?>>
        <label id="elh_customerhasarticles_custArticleId" class="<?= $Page->LeftColumnClass ?>"><?= $Page->custArticleId->caption() ?><?= $Page->custArticleId->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
        <div class="<?= $Page->RightColumnClass ?>"><div<?= $Page->custArticleId->cellAttributes() ?>>
<span id="el_customerhasarticles_custArticleId">
<span<?= $Page->custArticleId->viewAttributes() ?>>
<input type="text" readonly class="form-control-plaintext" value="<?= HtmlEncode(RemoveHtml($Page->custArticleId->getDisplayValue($Page->custArticleId->EditValue))) ?>"></span>
<input type="hidden" data-table="customerhasarticles" data-field="x_custArticleId" data-hidden="1" name="x_custArticleId" id="x_custArticleId" value="<?= HtmlEncode($Page->custArticleId->CurrentValue) ?>">
</span>
</div></div>
    </div>
<?php } ?>
<?php if ($Page->customerId->Visible) { // customerId ?>
    <div id="r_customerId"<?= $Page->customerId->rowAttributes() ?>>
        <label id="elh_customerhasarticles_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() ?>>
<?php if ($Page->customerId->getSessionValue() != "") { ?>
<span<?= $Page->customerId->viewAttributes() ?>>
<input type="text" readonly class="form-control-plaintext" value="<?= HtmlEncode(RemoveHtml($Page->customerId->getDisplayValue($Page->customerId->ViewValue))) ?>"></span>
<input type="hidden" id="x_customerId" name="x_customerId" value="<?= HtmlEncode($Page->customerId->CurrentValue) ?>" data-hidden="1">
<?php } else { ?>
<span id="el_customerhasarticles_customerId">
<input type="<?= $Page->customerId->getInputTextType() ?>" name="x_customerId" id="x_customerId" data-table="customerhasarticles" 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>
<?php } ?>
</div></div>
    </div>
<?php } ?>
<?php if ($Page->articleId->Visible) { // articleId ?>
    <div id="r_articleId"<?= $Page->articleId->rowAttributes() ?>>
        <label id="elh_customerhasarticles_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_customerhasarticles_articleId">
<input type="<?= $Page->articleId->getInputTextType() ?>" name="x_articleId" id="x_articleId" data-table="customerhasarticles" 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->rate->Visible) { // rate ?>
    <div id="r_rate"<?= $Page->rate->rowAttributes() ?>>
        <label id="elh_customerhasarticles_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_customerhasarticles_rate">
<input type="<?= $Page->rate->getInputTextType() ?>" name="x_rate" id="x_rate" data-table="customerhasarticles" 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->discountper->Visible) { // discountper ?>
    <div id="r_discountper"<?= $Page->discountper->rowAttributes() ?>>
        <label id="elh_customerhasarticles_discountper" for="x_discountper" class="<?= $Page->LeftColumnClass ?>"><?= $Page->discountper->caption() ?><?= $Page->discountper->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
        <div class="<?= $Page->RightColumnClass ?>"><div<?= $Page->discountper->cellAttributes() ?>>
<span id="el_customerhasarticles_discountper">
<input type="<?= $Page->discountper->getInputTextType() ?>" name="x_discountper" id="x_discountper" data-table="customerhasarticles" data-field="x_discountper" value="<?= $Page->discountper->EditValue ?>" size="30" placeholder="<?= HtmlEncode($Page->discountper->getPlaceHolder()) ?>" data-format-pattern="<?= HtmlEncode($Page->discountper->formatPattern()) ?>"<?= $Page->discountper->editAttributes() ?> aria-describedby="x_discountper_help">
<?= $Page->discountper->getCustomMessage() ?>
<div class="invalid-feedback"><?= $Page->discountper->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="fcustomerhasarticlesedit"><?= $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="fcustomerhasarticlesedit" 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("customerhasarticles");
});
</script>
<script>
loadjs.ready("load", function () {
    // Write your table-specific startup script here, no need to add script tags.
});
</script>
