<?php

namespace PHPMaker2023\Jack_Jill_school;

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

    // Form object
    let form = new ew.FormBuilder()
        .setId("fpassword_reset_otpsdelete")
        .setPageId("delete")
        .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="fpassword_reset_otpsdelete" id="fpassword_reset_otpsdelete" class="ew-form ew-delete-form" action="<?= CurrentPageUrl(false) ?>" method="post" novalidate autocomplete="on">
<?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="password_reset_otps">
<input type="hidden" name="action" id="action" value="delete">
<?php foreach ($Page->RecKeys as $key) { ?>
<?php $keyvalue = is_array($key) ? implode(Config("COMPOSITE_KEY_SEPARATOR"), $key) : $key; ?>
<input type="hidden" name="key_m[]" value="<?= HtmlEncode($keyvalue) ?>">
<?php } ?>
<div class="card ew-card ew-grid <?= $Page->TableGridClass ?>">
<div class="card-body ew-grid-middle-panel <?= $Page->TableContainerClass ?>" style="<?= $Page->TableContainerStyle ?>">
<table class="<?= $Page->TableClass ?>">
    <thead>
    <tr class="ew-table-header">
<?php if ($Page->id->Visible) { // id ?>
        <th class="<?= $Page->id->headerCellClass() ?>"><span id="elh_password_reset_otps_id" class="password_reset_otps_id"><?= $Page->id->caption() ?></span></th>
<?php } ?>
<?php if ($Page->employee_id->Visible) { // employee_id ?>
        <th class="<?= $Page->employee_id->headerCellClass() ?>"><span id="elh_password_reset_otps_employee_id" class="password_reset_otps_employee_id"><?= $Page->employee_id->caption() ?></span></th>
<?php } ?>
<?php if ($Page->otp->Visible) { // otp ?>
        <th class="<?= $Page->otp->headerCellClass() ?>"><span id="elh_password_reset_otps_otp" class="password_reset_otps_otp"><?= $Page->otp->caption() ?></span></th>
<?php } ?>
<?php if ($Page->expires_at->Visible) { // expires_at ?>
        <th class="<?= $Page->expires_at->headerCellClass() ?>"><span id="elh_password_reset_otps_expires_at" class="password_reset_otps_expires_at"><?= $Page->expires_at->caption() ?></span></th>
<?php } ?>
<?php if ($Page->created_at->Visible) { // created_at ?>
        <th class="<?= $Page->created_at->headerCellClass() ?>"><span id="elh_password_reset_otps_created_at" class="password_reset_otps_created_at"><?= $Page->created_at->caption() ?></span></th>
<?php } ?>
<?php if ($Page->is_used->Visible) { // is_used ?>
        <th class="<?= $Page->is_used->headerCellClass() ?>"><span id="elh_password_reset_otps_is_used" class="password_reset_otps_is_used"><?= $Page->is_used->caption() ?></span></th>
<?php } ?>
    </tr>
    </thead>
    <tbody>
<?php
$Page->RecordCount = 0;
$i = 0;
while (!$Page->Recordset->EOF) {
    $Page->RecordCount++;
    $Page->RowCount++;

    // Set row properties
    $Page->resetAttributes();
    $Page->RowType = ROWTYPE_VIEW; // View

    // Get the field contents
    $Page->loadRowValues($Page->Recordset);

    // Render row
    $Page->renderRow();
?>
    <tr <?= $Page->rowAttributes() ?>>
<?php if ($Page->id->Visible) { // id ?>
        <td<?= $Page->id->cellAttributes() ?>>
<span id="el<?= $Page->RowCount ?>_password_reset_otps_id" class="el_password_reset_otps_id">
<span<?= $Page->id->viewAttributes() ?>>
<?= $Page->id->getViewValue() ?></span>
</span>
</td>
<?php } ?>
<?php if ($Page->employee_id->Visible) { // employee_id ?>
        <td<?= $Page->employee_id->cellAttributes() ?>>
<span id="el<?= $Page->RowCount ?>_password_reset_otps_employee_id" class="el_password_reset_otps_employee_id">
<span<?= $Page->employee_id->viewAttributes() ?>>
<?= $Page->employee_id->getViewValue() ?></span>
</span>
</td>
<?php } ?>
<?php if ($Page->otp->Visible) { // otp ?>
        <td<?= $Page->otp->cellAttributes() ?>>
<span id="el<?= $Page->RowCount ?>_password_reset_otps_otp" class="el_password_reset_otps_otp">
<span<?= $Page->otp->viewAttributes() ?>>
<?= $Page->otp->getViewValue() ?></span>
</span>
</td>
<?php } ?>
<?php if ($Page->expires_at->Visible) { // expires_at ?>
        <td<?= $Page->expires_at->cellAttributes() ?>>
<span id="el<?= $Page->RowCount ?>_password_reset_otps_expires_at" class="el_password_reset_otps_expires_at">
<span<?= $Page->expires_at->viewAttributes() ?>>
<?= $Page->expires_at->getViewValue() ?></span>
</span>
</td>
<?php } ?>
<?php if ($Page->created_at->Visible) { // created_at ?>
        <td<?= $Page->created_at->cellAttributes() ?>>
<span id="el<?= $Page->RowCount ?>_password_reset_otps_created_at" class="el_password_reset_otps_created_at">
<span<?= $Page->created_at->viewAttributes() ?>>
<?= $Page->created_at->getViewValue() ?></span>
</span>
</td>
<?php } ?>
<?php if ($Page->is_used->Visible) { // is_used ?>
        <td<?= $Page->is_used->cellAttributes() ?>>
<span id="el<?= $Page->RowCount ?>_password_reset_otps_is_used" class="el_password_reset_otps_is_used">
<span<?= $Page->is_used->viewAttributes() ?>>
<div class="form-check form-switch d-inline-block">
    <input type="checkbox" id="x_is_used_<?= $Page->RowCount ?>" class="form-check-input" value="<?= $Page->is_used->getViewValue() ?>" disabled<?php if (ConvertToBool($Page->is_used->CurrentValue)) { ?> checked<?php } ?>>
    <label class="form-check-label" for="x_is_used_<?= $Page->RowCount ?>"></label>
</div></span>
</span>
</td>
<?php } ?>
    </tr>
<?php
    $Page->Recordset->moveNext();
}
$Page->Recordset->close();
?>
</tbody>
</table>
</div>
</div>
<div class="ew-buttons ew-desktop-buttons">
<button class="btn btn-primary ew-btn" name="btn-action" id="btn-action" type="submit"><?= $Language->phrase("DeleteBtn") ?></button>
<button class="btn btn-default ew-btn" name="btn-cancel" id="btn-cancel" type="button" data-href="<?= HtmlEncode(GetUrl($Page->getReturnUrl())) ?>"><?= $Language->phrase("CancelBtn") ?></button>
</div>
</form>
<?php
$Page->showPageFooter();
echo GetDebugMessage();
?>
<script>
loadjs.ready("load", function () {
    // Write your table-specific startup script here, no need to add script tags.
});
</script>
<?php if (!$Page->IsModal && !$Page->isExport()) { ?>
<script>
loadjs.ready(["wrapper", "head", "swal"],function(){$('#btn-action').on('click',function(){if(fpassword_reset_otpsdelete.validateFields()){ew.prompt({title: ew.language.phrase("MessageDeleteConfirm"),icon:'question',showCancelButton:true},result=>{if(result) $("#fpassword_reset_otpsdelete").submit();});return false;} else { ew.prompt({title: ew.language.phrase("MessageInvalidForm"), icon: 'warning', showCancelButton:false}); }});});
</script>
<?php } ?>
