<?php

namespace PHPMaker2023\Jack_Jill_school;

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

    // Form object
    let form = new ew.FormBuilder()
        .setId("fstudentdelete")
        .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="fstudentdelete" id="fstudentdelete" 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="student">
<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->studentID->Visible) { // studentID ?>
        <th class="<?= $Page->studentID->headerCellClass() ?>"><span id="elh_student_studentID" class="student_studentID"><?= $Page->studentID->caption() ?></span></th>
<?php } ?>
<?php if ($Page->PIN->Visible) { // PIN ?>
        <th class="<?= $Page->PIN->headerCellClass() ?>"><span id="elh_student_PIN" class="student_PIN"><?= $Page->PIN->caption() ?></span></th>
<?php } ?>
<?php if ($Page->First_Name->Visible) { // First_Name ?>
        <th class="<?= $Page->First_Name->headerCellClass() ?>"><span id="elh_student_First_Name" class="student_First_Name"><?= $Page->First_Name->caption() ?></span></th>
<?php } ?>
<?php if ($Page->Gender->Visible) { // Gender ?>
        <th class="<?= $Page->Gender->headerCellClass() ?>"><span id="elh_student_Gender" class="student_Gender"><?= $Page->Gender->caption() ?></span></th>
<?php } ?>
<?php if ($Page->Date_Of_Birth->Visible) { // Date_Of_Birth ?>
        <th class="<?= $Page->Date_Of_Birth->headerCellClass() ?>"><span id="elh_student_Date_Of_Birth" class="student_Date_Of_Birth"><?= $Page->Date_Of_Birth->caption() ?></span></th>
<?php } ?>
<?php if ($Page->Place_Of_Birth->Visible) { // Place_Of_Birth ?>
        <th class="<?= $Page->Place_Of_Birth->headerCellClass() ?>"><span id="elh_student_Place_Of_Birth" class="student_Place_Of_Birth"><?= $Page->Place_Of_Birth->caption() ?></span></th>
<?php } ?>
<?php if ($Page->Card_No->Visible) { // Card_No ?>
        <th class="<?= $Page->Card_No->headerCellClass() ?>"><span id="elh_student_Card_No" class="student_Card_No"><?= $Page->Card_No->caption() ?></span></th>
<?php } ?>
<?php if ($Page->Unique_QR->Visible) { // Unique_QR ?>
        <th class="<?= $Page->Unique_QR->headerCellClass() ?>"><span id="elh_student_Unique_QR" class="student_Unique_QR"><?= $Page->Unique_QR->caption() ?></span></th>
<?php } ?>
<?php if ($Page->Photo->Visible) { // Photo ?>
        <th class="<?= $Page->Photo->headerCellClass() ?>"><span id="elh_student_Photo" class="student_Photo"><?= $Page->Photo->caption() ?></span></th>
<?php } ?>
<?php if ($Page->Address->Visible) { // Address ?>
        <th class="<?= $Page->Address->headerCellClass() ?>"><span id="elh_student_Address" class="student_Address"><?= $Page->Address->caption() ?></span></th>
<?php } ?>
<?php if ($Page->Start_Date->Visible) { // Start_Date ?>
        <th class="<?= $Page->Start_Date->headerCellClass() ?>"><span id="elh_student_Start_Date" class="student_Start_Date"><?= $Page->Start_Date->caption() ?></span></th>
<?php } ?>
<?php if ($Page->Expiry_Date->Visible) { // Expiry_Date ?>
        <th class="<?= $Page->Expiry_Date->headerCellClass() ?>"><span id="elh_student_Expiry_Date" class="student_Expiry_Date"><?= $Page->Expiry_Date->caption() ?></span></th>
<?php } ?>
<?php if ($Page->SClass->Visible) { // SClass ?>
        <th class="<?= $Page->SClass->headerCellClass() ?>"><span id="elh_student_SClass" class="student_SClass"><?= $Page->SClass->caption() ?></span></th>
<?php } ?>
<?php if ($Page->Contact_Incase->Visible) { // Contact_Incase ?>
        <th class="<?= $Page->Contact_Incase->headerCellClass() ?>"><span id="elh_student_Contact_Incase" class="student_Contact_Incase"><?= $Page->Contact_Incase->caption() ?></span></th>
<?php } ?>
<?php if ($Page->Contact_Tel->Visible) { // Contact_Tel ?>
        <th class="<?= $Page->Contact_Tel->headerCellClass() ?>"><span id="elh_student_Contact_Tel" class="student_Contact_Tel"><?= $Page->Contact_Tel->caption() ?></span></th>
<?php } ?>
<?php if ($Page->Reference->Visible) { // Reference ?>
        <th class="<?= $Page->Reference->headerCellClass() ?>"><span id="elh_student_Reference" class="student_Reference"><?= $Page->Reference->caption() ?></span></th>
<?php } ?>
<?php if ($Page->EmployeeID->Visible) { // EmployeeID ?>
        <th class="<?= $Page->EmployeeID->headerCellClass() ?>"><span id="elh_student_EmployeeID" class="student_EmployeeID"><?= $Page->EmployeeID->caption() ?></span></th>
<?php } ?>
<?php if ($Page->Status->Visible) { // Status ?>
        <th class="<?= $Page->Status->headerCellClass() ?>"><span id="elh_student_Status" class="student_Status"><?= $Page->Status->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->studentID->Visible) { // studentID ?>
        <td<?= $Page->studentID->cellAttributes() ?>>
<span id="el<?= $Page->RowCount ?>_student_studentID" class="el_student_studentID">
<span<?= $Page->studentID->viewAttributes() ?>>
<?= $Page->studentID->getViewValue() ?></span>
</span>
</td>
<?php } ?>
<?php if ($Page->PIN->Visible) { // PIN ?>
        <td<?= $Page->PIN->cellAttributes() ?>>
<span id="el<?= $Page->RowCount ?>_student_PIN" class="el_student_PIN">
<span<?= $Page->PIN->viewAttributes() ?>>
<?= $Page->PIN->getViewValue() ?></span>
</span>
</td>
<?php } ?>
<?php if ($Page->First_Name->Visible) { // First_Name ?>
        <td<?= $Page->First_Name->cellAttributes() ?>>
<span id="el<?= $Page->RowCount ?>_student_First_Name" class="el_student_First_Name">
<span<?= $Page->First_Name->viewAttributes() ?>>
<?= $Page->First_Name->getViewValue() ?></span>
</span>
</td>
<?php } ?>
<?php if ($Page->Gender->Visible) { // Gender ?>
        <td<?= $Page->Gender->cellAttributes() ?>>
<span id="el<?= $Page->RowCount ?>_student_Gender" class="el_student_Gender">
<span<?= $Page->Gender->viewAttributes() ?>>
<?= $Page->Gender->getViewValue() ?></span>
</span>
</td>
<?php } ?>
<?php if ($Page->Date_Of_Birth->Visible) { // Date_Of_Birth ?>
        <td<?= $Page->Date_Of_Birth->cellAttributes() ?>>
<span id="el<?= $Page->RowCount ?>_student_Date_Of_Birth" class="el_student_Date_Of_Birth">
<span<?= $Page->Date_Of_Birth->viewAttributes() ?>>
<?= $Page->Date_Of_Birth->getViewValue() ?></span>
</span>
</td>
<?php } ?>
<?php if ($Page->Place_Of_Birth->Visible) { // Place_Of_Birth ?>
        <td<?= $Page->Place_Of_Birth->cellAttributes() ?>>
<span id="el<?= $Page->RowCount ?>_student_Place_Of_Birth" class="el_student_Place_Of_Birth">
<span<?= $Page->Place_Of_Birth->viewAttributes() ?>>
<?= $Page->Place_Of_Birth->getViewValue() ?></span>
</span>
</td>
<?php } ?>
<?php if ($Page->Card_No->Visible) { // Card_No ?>
        <td<?= $Page->Card_No->cellAttributes() ?>>
<span id="el<?= $Page->RowCount ?>_student_Card_No" class="el_student_Card_No">
<span<?= $Page->Card_No->viewAttributes() ?>>
<?= $Page->Card_No->getViewValue() ?></span>
</span>
</td>
<?php } ?>
<?php if ($Page->Unique_QR->Visible) { // Unique_QR ?>
        <td<?= $Page->Unique_QR->cellAttributes() ?>>
<span id="el<?= $Page->RowCount ?>_student_Unique_QR" class="el_student_Unique_QR">
<span<?= $Page->Unique_QR->viewAttributes() ?>><?= PhpBarcode::barcode(true)->show($Page->Unique_QR->CurrentValue, 'QRCODE', 60) ?></span>
</span>
</td>
<?php } ?>
<?php if ($Page->Photo->Visible) { // Photo ?>
        <td<?= $Page->Photo->cellAttributes() ?>>
<span id="el<?= $Page->RowCount ?>_student_Photo" class="el_student_Photo">
<span>
<?= GetFileViewTag($Page->Photo, $Page->Photo->getViewValue(), false) ?>
</span>
</span>
</td>
<?php } ?>
<?php if ($Page->Address->Visible) { // Address ?>
        <td<?= $Page->Address->cellAttributes() ?>>
<span id="el<?= $Page->RowCount ?>_student_Address" class="el_student_Address">
<span<?= $Page->Address->viewAttributes() ?>>
<?= $Page->Address->getViewValue() ?></span>
</span>
</td>
<?php } ?>
<?php if ($Page->Start_Date->Visible) { // Start_Date ?>
        <td<?= $Page->Start_Date->cellAttributes() ?>>
<span id="el<?= $Page->RowCount ?>_student_Start_Date" class="el_student_Start_Date">
<span<?= $Page->Start_Date->viewAttributes() ?>>
<?= $Page->Start_Date->getViewValue() ?></span>
</span>
</td>
<?php } ?>
<?php if ($Page->Expiry_Date->Visible) { // Expiry_Date ?>
        <td<?= $Page->Expiry_Date->cellAttributes() ?>>
<span id="el<?= $Page->RowCount ?>_student_Expiry_Date" class="el_student_Expiry_Date">
<span<?= $Page->Expiry_Date->viewAttributes() ?>>
<?= $Page->Expiry_Date->getViewValue() ?></span>
</span>
</td>
<?php } ?>
<?php if ($Page->SClass->Visible) { // SClass ?>
        <td<?= $Page->SClass->cellAttributes() ?>>
<span id="el<?= $Page->RowCount ?>_student_SClass" class="el_student_SClass">
<span<?= $Page->SClass->viewAttributes() ?>>
<?= $Page->SClass->getViewValue() ?></span>
</span>
</td>
<?php } ?>
<?php if ($Page->Contact_Incase->Visible) { // Contact_Incase ?>
        <td<?= $Page->Contact_Incase->cellAttributes() ?>>
<span id="el<?= $Page->RowCount ?>_student_Contact_Incase" class="el_student_Contact_Incase">
<span<?= $Page->Contact_Incase->viewAttributes() ?>>
<?= $Page->Contact_Incase->getViewValue() ?></span>
</span>
</td>
<?php } ?>
<?php if ($Page->Contact_Tel->Visible) { // Contact_Tel ?>
        <td<?= $Page->Contact_Tel->cellAttributes() ?>>
<span id="el<?= $Page->RowCount ?>_student_Contact_Tel" class="el_student_Contact_Tel">
<span<?= $Page->Contact_Tel->viewAttributes() ?>>
<?= $Page->Contact_Tel->getViewValue() ?></span>
</span>
</td>
<?php } ?>
<?php if ($Page->Reference->Visible) { // Reference ?>
        <td<?= $Page->Reference->cellAttributes() ?>>
<span id="el<?= $Page->RowCount ?>_student_Reference" class="el_student_Reference">
<span<?= $Page->Reference->viewAttributes() ?>>
<?= $Page->Reference->getViewValue() ?></span>
</span>
</td>
<?php } ?>
<?php if ($Page->EmployeeID->Visible) { // EmployeeID ?>
        <td<?= $Page->EmployeeID->cellAttributes() ?>>
<span id="el<?= $Page->RowCount ?>_student_EmployeeID" class="el_student_EmployeeID">
<span<?= $Page->EmployeeID->viewAttributes() ?>>
<?= $Page->EmployeeID->getViewValue() ?></span>
</span>
</td>
<?php } ?>
<?php if ($Page->Status->Visible) { // Status ?>
        <td<?= $Page->Status->cellAttributes() ?>>
<span id="el<?= $Page->RowCount ?>_student_Status" class="el_student_Status">
<span<?= $Page->Status->viewAttributes() ?>>
<?= $Page->Status->getViewValue() ?></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(fstudentdelete.validateFields()){ew.prompt({title: ew.language.phrase("MessageDeleteConfirm"),icon:'question',showCancelButton:true},result=>{if(result) $("#fstudentdelete").submit();});return false;} else { ew.prompt({title: ew.language.phrase("MessageInvalidForm"), icon: 'warning', showCancelButton:false}); }});});
</script>
<?php } ?>
