<?php

namespace PHPMaker2024\laundrytech;

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

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

        // Add fields
        .setFields([
            ["siteId", [fields.siteId.visible && fields.siteId.required ? ew.Validators.required(fields.siteId.caption) : null], fields.siteId.isInvalid],
            ["SiteName", [fields.SiteName.visible && fields.SiteName.required ? ew.Validators.required(fields.SiteName.caption) : null], fields.SiteName.isInvalid],
            ["customerId", [fields.customerId.visible && fields.customerId.required ? ew.Validators.required(fields.customerId.caption) : null, ew.Validators.integer], fields.customerId.isInvalid],
            ["address", [fields.address.visible && fields.address.required ? ew.Validators.required(fields.address.caption) : null], fields.address.isInvalid],
            ["city", [fields.city.visible && fields.city.required ? ew.Validators.required(fields.city.caption) : null], fields.city.isInvalid],
            ["postcode", [fields.postcode.visible && fields.postcode.required ? ew.Validators.required(fields.postcode.caption) : null], fields.postcode.isInvalid],
            ["country", [fields.country.visible && fields.country.required ? ew.Validators.required(fields.country.caption) : null], fields.country.isInvalid],
            ["phone1", [fields.phone1.visible && fields.phone1.required ? ew.Validators.required(fields.phone1.caption) : null], fields.phone1.isInvalid],
            ["phone2", [fields.phone2.visible && fields.phone2.required ? ew.Validators.required(fields.phone2.caption) : null], fields.phone2.isInvalid],
            ["emailaddress", [fields.emailaddress.visible && fields.emailaddress.required ? ew.Validators.required(fields.emailaddress.caption) : null], fields.emailaddress.isInvalid],
            ["notes", [fields.notes.visible && fields.notes.required ? ew.Validators.fileRequired(fields.notes.caption) : null], fields.notes.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="customersites">
<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->siteId->Visible) { // siteId ?>
    <div id="r_siteId"<?= $Page->siteId->rowAttributes() ?>>
        <label id="elh_customersites_siteId" class="<?= $Page->LeftColumnClass ?>"><?= $Page->siteId->caption() ?><?= $Page->siteId->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
        <div class="<?= $Page->RightColumnClass ?>"><div<?= $Page->siteId->cellAttributes() ?>>
<span id="el_customersites_siteId">
<span<?= $Page->siteId->viewAttributes() ?>>
<input type="text" readonly class="form-control-plaintext" value="<?= HtmlEncode(RemoveHtml($Page->siteId->getDisplayValue($Page->siteId->EditValue))) ?>"></span>
<input type="hidden" data-table="customersites" data-field="x_siteId" data-hidden="1" name="x_siteId" id="x_siteId" value="<?= HtmlEncode($Page->siteId->CurrentValue) ?>">
</span>
</div></div>
    </div>
<?php } ?>
<?php if ($Page->SiteName->Visible) { // SiteName ?>
    <div id="r_SiteName"<?= $Page->SiteName->rowAttributes() ?>>
        <label id="elh_customersites_SiteName" for="x_SiteName" class="<?= $Page->LeftColumnClass ?>"><?= $Page->SiteName->caption() ?><?= $Page->SiteName->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
        <div class="<?= $Page->RightColumnClass ?>"><div<?= $Page->SiteName->cellAttributes() ?>>
<span id="el_customersites_SiteName">
<input type="<?= $Page->SiteName->getInputTextType() ?>" name="x_SiteName" id="x_SiteName" data-table="customersites" data-field="x_SiteName" value="<?= $Page->SiteName->EditValue ?>" size="30" maxlength="255" placeholder="<?= HtmlEncode($Page->SiteName->getPlaceHolder()) ?>" data-format-pattern="<?= HtmlEncode($Page->SiteName->formatPattern()) ?>"<?= $Page->SiteName->editAttributes() ?> aria-describedby="x_SiteName_help">
<?= $Page->SiteName->getCustomMessage() ?>
<div class="invalid-feedback"><?= $Page->SiteName->getErrorMessage() ?></div>
</span>
</div></div>
    </div>
<?php } ?>
<?php if ($Page->customerId->Visible) { // customerId ?>
    <div id="r_customerId"<?= $Page->customerId->rowAttributes() ?>>
        <label id="elh_customersites_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_customersites_customerId">
<input type="<?= $Page->customerId->getInputTextType() ?>" name="x_customerId" id="x_customerId" data-table="customersites" 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 } ?>
<?php if ($Page->address->Visible) { // address ?>
    <div id="r_address"<?= $Page->address->rowAttributes() ?>>
        <label id="elh_customersites_address" for="x_address" class="<?= $Page->LeftColumnClass ?>"><?= $Page->address->caption() ?><?= $Page->address->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
        <div class="<?= $Page->RightColumnClass ?>"><div<?= $Page->address->cellAttributes() ?>>
<span id="el_customersites_address">
<input type="<?= $Page->address->getInputTextType() ?>" name="x_address" id="x_address" data-table="customersites" data-field="x_address" value="<?= $Page->address->EditValue ?>" size="30" maxlength="255" placeholder="<?= HtmlEncode($Page->address->getPlaceHolder()) ?>" data-format-pattern="<?= HtmlEncode($Page->address->formatPattern()) ?>"<?= $Page->address->editAttributes() ?> aria-describedby="x_address_help">
<?= $Page->address->getCustomMessage() ?>
<div class="invalid-feedback"><?= $Page->address->getErrorMessage() ?></div>
</span>
</div></div>
    </div>
<?php } ?>
<?php if ($Page->city->Visible) { // city ?>
    <div id="r_city"<?= $Page->city->rowAttributes() ?>>
        <label id="elh_customersites_city" for="x_city" class="<?= $Page->LeftColumnClass ?>"><?= $Page->city->caption() ?><?= $Page->city->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
        <div class="<?= $Page->RightColumnClass ?>"><div<?= $Page->city->cellAttributes() ?>>
<span id="el_customersites_city">
<input type="<?= $Page->city->getInputTextType() ?>" name="x_city" id="x_city" data-table="customersites" data-field="x_city" value="<?= $Page->city->EditValue ?>" size="30" maxlength="255" placeholder="<?= HtmlEncode($Page->city->getPlaceHolder()) ?>" data-format-pattern="<?= HtmlEncode($Page->city->formatPattern()) ?>"<?= $Page->city->editAttributes() ?> aria-describedby="x_city_help">
<?= $Page->city->getCustomMessage() ?>
<div class="invalid-feedback"><?= $Page->city->getErrorMessage() ?></div>
</span>
</div></div>
    </div>
<?php } ?>
<?php if ($Page->postcode->Visible) { // postcode ?>
    <div id="r_postcode"<?= $Page->postcode->rowAttributes() ?>>
        <label id="elh_customersites_postcode" for="x_postcode" class="<?= $Page->LeftColumnClass ?>"><?= $Page->postcode->caption() ?><?= $Page->postcode->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
        <div class="<?= $Page->RightColumnClass ?>"><div<?= $Page->postcode->cellAttributes() ?>>
<span id="el_customersites_postcode">
<input type="<?= $Page->postcode->getInputTextType() ?>" name="x_postcode" id="x_postcode" data-table="customersites" data-field="x_postcode" value="<?= $Page->postcode->EditValue ?>" size="30" maxlength="255" placeholder="<?= HtmlEncode($Page->postcode->getPlaceHolder()) ?>" data-format-pattern="<?= HtmlEncode($Page->postcode->formatPattern()) ?>"<?= $Page->postcode->editAttributes() ?> aria-describedby="x_postcode_help">
<?= $Page->postcode->getCustomMessage() ?>
<div class="invalid-feedback"><?= $Page->postcode->getErrorMessage() ?></div>
</span>
</div></div>
    </div>
<?php } ?>
<?php if ($Page->country->Visible) { // country ?>
    <div id="r_country"<?= $Page->country->rowAttributes() ?>>
        <label id="elh_customersites_country" for="x_country" class="<?= $Page->LeftColumnClass ?>"><?= $Page->country->caption() ?><?= $Page->country->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
        <div class="<?= $Page->RightColumnClass ?>"><div<?= $Page->country->cellAttributes() ?>>
<span id="el_customersites_country">
<input type="<?= $Page->country->getInputTextType() ?>" name="x_country" id="x_country" data-table="customersites" data-field="x_country" value="<?= $Page->country->EditValue ?>" size="30" maxlength="255" placeholder="<?= HtmlEncode($Page->country->getPlaceHolder()) ?>" data-format-pattern="<?= HtmlEncode($Page->country->formatPattern()) ?>"<?= $Page->country->editAttributes() ?> aria-describedby="x_country_help">
<?= $Page->country->getCustomMessage() ?>
<div class="invalid-feedback"><?= $Page->country->getErrorMessage() ?></div>
</span>
</div></div>
    </div>
<?php } ?>
<?php if ($Page->phone1->Visible) { // phone1 ?>
    <div id="r_phone1"<?= $Page->phone1->rowAttributes() ?>>
        <label id="elh_customersites_phone1" for="x_phone1" class="<?= $Page->LeftColumnClass ?>"><?= $Page->phone1->caption() ?><?= $Page->phone1->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
        <div class="<?= $Page->RightColumnClass ?>"><div<?= $Page->phone1->cellAttributes() ?>>
<span id="el_customersites_phone1">
<input type="<?= $Page->phone1->getInputTextType() ?>" name="x_phone1" id="x_phone1" data-table="customersites" data-field="x_phone1" value="<?= $Page->phone1->EditValue ?>" size="30" maxlength="255" placeholder="<?= HtmlEncode($Page->phone1->getPlaceHolder()) ?>" data-format-pattern="<?= HtmlEncode($Page->phone1->formatPattern()) ?>"<?= $Page->phone1->editAttributes() ?> aria-describedby="x_phone1_help">
<?= $Page->phone1->getCustomMessage() ?>
<div class="invalid-feedback"><?= $Page->phone1->getErrorMessage() ?></div>
</span>
</div></div>
    </div>
<?php } ?>
<?php if ($Page->phone2->Visible) { // phone2 ?>
    <div id="r_phone2"<?= $Page->phone2->rowAttributes() ?>>
        <label id="elh_customersites_phone2" for="x_phone2" class="<?= $Page->LeftColumnClass ?>"><?= $Page->phone2->caption() ?><?= $Page->phone2->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
        <div class="<?= $Page->RightColumnClass ?>"><div<?= $Page->phone2->cellAttributes() ?>>
<span id="el_customersites_phone2">
<input type="<?= $Page->phone2->getInputTextType() ?>" name="x_phone2" id="x_phone2" data-table="customersites" data-field="x_phone2" value="<?= $Page->phone2->EditValue ?>" size="30" maxlength="255" placeholder="<?= HtmlEncode($Page->phone2->getPlaceHolder()) ?>" data-format-pattern="<?= HtmlEncode($Page->phone2->formatPattern()) ?>"<?= $Page->phone2->editAttributes() ?> aria-describedby="x_phone2_help">
<?= $Page->phone2->getCustomMessage() ?>
<div class="invalid-feedback"><?= $Page->phone2->getErrorMessage() ?></div>
</span>
</div></div>
    </div>
<?php } ?>
<?php if ($Page->emailaddress->Visible) { // emailaddress ?>
    <div id="r_emailaddress"<?= $Page->emailaddress->rowAttributes() ?>>
        <label id="elh_customersites_emailaddress" for="x_emailaddress" class="<?= $Page->LeftColumnClass ?>"><?= $Page->emailaddress->caption() ?><?= $Page->emailaddress->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
        <div class="<?= $Page->RightColumnClass ?>"><div<?= $Page->emailaddress->cellAttributes() ?>>
<span id="el_customersites_emailaddress">
<input type="<?= $Page->emailaddress->getInputTextType() ?>" name="x_emailaddress" id="x_emailaddress" data-table="customersites" data-field="x_emailaddress" value="<?= $Page->emailaddress->EditValue ?>" size="30" maxlength="255" placeholder="<?= HtmlEncode($Page->emailaddress->getPlaceHolder()) ?>" data-format-pattern="<?= HtmlEncode($Page->emailaddress->formatPattern()) ?>"<?= $Page->emailaddress->editAttributes() ?> aria-describedby="x_emailaddress_help">
<?= $Page->emailaddress->getCustomMessage() ?>
<div class="invalid-feedback"><?= $Page->emailaddress->getErrorMessage() ?></div>
</span>
</div></div>
    </div>
<?php } ?>
<?php if ($Page->notes->Visible) { // notes ?>
    <div id="r_notes"<?= $Page->notes->rowAttributes() ?>>
        <label id="elh_customersites_notes" class="<?= $Page->LeftColumnClass ?>"><?= $Page->notes->caption() ?><?= $Page->notes->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
        <div class="<?= $Page->RightColumnClass ?>"><div<?= $Page->notes->cellAttributes() ?>>
<span id="el_customersites_notes">
<div id="fd_x_notes" class="fileinput-button ew-file-drop-zone">
    <input
        type="file"
        id="x_notes"
        name="x_notes"
        class="form-control ew-file-input"
        title="<?= $Page->notes->title() ?>"
        lang="<?= CurrentLanguageID() ?>"
        data-table="customersites"
        data-field="x_notes"
        data-size="65535"
        data-accept-file-types="<?= $Page->notes->acceptFileTypes() ?>"
        data-max-file-size="<?= $Page->notes->UploadMaxFileSize ?>"
        data-max-number-of-files="null"
        data-disable-image-crop="<?= $Page->notes->ImageCropper ? 0 : 1 ?>"
        aria-describedby="x_notes_help"
        <?= ($Page->notes->ReadOnly || $Page->notes->Disabled) ? " disabled" : "" ?>
        <?= $Page->notes->editAttributes() ?>
    >
    <div class="text-body-secondary ew-file-text"><?= $Language->phrase("ChooseFile") ?></div>
    <?= $Page->notes->getCustomMessage() ?>
    <div class="invalid-feedback"><?= $Page->notes->getErrorMessage() ?></div>
</div>
<input type="hidden" name="fn_x_notes" id= "fn_x_notes" value="<?= $Page->notes->Upload->FileName ?>">
<input type="hidden" name="fa_x_notes" id= "fa_x_notes" value="<?= (Post("fa_x_notes") == "0") ? "0" : "1" ?>">
<table id="ft_x_notes" class="table table-sm float-start ew-upload-table"><tbody class="files"></tbody></table>
</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="fcustomersitesedit"><?= $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="fcustomersitesedit" 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("customersites");
});
</script>
<script>
loadjs.ready("load", function () {
    // Write your table-specific startup script here, no need to add script tags.
});
</script>
