<?php

namespace PHPMaker2023\Jack_Jill_school;

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

    // Form object
    let form = new ew.FormBuilder()
        .setId("ftasksdelete")
        .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="ftasksdelete" id="ftasksdelete" 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="tasks">
<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->TaskID->Visible) { // TaskID ?>
        <th class="<?= $Page->TaskID->headerCellClass() ?>"><span id="elh_tasks_TaskID" class="tasks_TaskID"><?= $Page->TaskID->caption() ?></span></th>
<?php } ?>
<?php if ($Page->TaskName->Visible) { // TaskName ?>
        <th class="<?= $Page->TaskName->headerCellClass() ?>"><span id="elh_tasks_TaskName" class="tasks_TaskName"><?= $Page->TaskName->caption() ?></span></th>
<?php } ?>
<?php if ($Page->ResourceID->Visible) { // ResourceID ?>
        <th class="<?= $Page->ResourceID->headerCellClass() ?>"><span id="elh_tasks_ResourceID" class="tasks_ResourceID"><?= $Page->ResourceID->caption() ?></span></th>
<?php } ?>
<?php if ($Page->Start->Visible) { // Start ?>
        <th class="<?= $Page->Start->headerCellClass() ?>"><span id="elh_tasks_Start" class="tasks_Start"><?= $Page->Start->caption() ?></span></th>
<?php } ?>
<?php if ($Page->End->Visible) { // End ?>
        <th class="<?= $Page->End->headerCellClass() ?>"><span id="elh_tasks_End" class="tasks_End"><?= $Page->End->caption() ?></span></th>
<?php } ?>
<?php if ($Page->Description->Visible) { // Description ?>
        <th class="<?= $Page->Description->headerCellClass() ?>"><span id="elh_tasks_Description" class="tasks_Description"><?= $Page->Description->caption() ?></span></th>
<?php } ?>
<?php if ($Page->Milestone->Visible) { // Milestone ?>
        <th class="<?= $Page->Milestone->headerCellClass() ?>"><span id="elh_tasks_Milestone" class="tasks_Milestone"><?= $Page->Milestone->caption() ?></span></th>
<?php } ?>
<?php if ($Page->Duration->Visible) { // Duration ?>
        <th class="<?= $Page->Duration->headerCellClass() ?>"><span id="elh_tasks_Duration" class="tasks_Duration"><?= $Page->Duration->caption() ?></span></th>
<?php } ?>
<?php if ($Page->PercentComplete->Visible) { // PercentComplete ?>
        <th class="<?= $Page->PercentComplete->headerCellClass() ?>"><span id="elh_tasks_PercentComplete" class="tasks_PercentComplete"><?= $Page->PercentComplete->caption() ?></span></th>
<?php } ?>
<?php if ($Page->Dependencies->Visible) { // Dependencies ?>
        <th class="<?= $Page->Dependencies->headerCellClass() ?>"><span id="elh_tasks_Dependencies" class="tasks_Dependencies"><?= $Page->Dependencies->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->TaskID->Visible) { // TaskID ?>
        <td<?= $Page->TaskID->cellAttributes() ?>>
<span id="el<?= $Page->RowCount ?>_tasks_TaskID" class="el_tasks_TaskID">
<span<?= $Page->TaskID->viewAttributes() ?>>
<?= $Page->TaskID->getViewValue() ?></span>
</span>
</td>
<?php } ?>
<?php if ($Page->TaskName->Visible) { // TaskName ?>
        <td<?= $Page->TaskName->cellAttributes() ?>>
<span id="el<?= $Page->RowCount ?>_tasks_TaskName" class="el_tasks_TaskName">
<span<?= $Page->TaskName->viewAttributes() ?>>
<?= $Page->TaskName->getViewValue() ?></span>
</span>
</td>
<?php } ?>
<?php if ($Page->ResourceID->Visible) { // ResourceID ?>
        <td<?= $Page->ResourceID->cellAttributes() ?>>
<span id="el<?= $Page->RowCount ?>_tasks_ResourceID" class="el_tasks_ResourceID">
<span<?= $Page->ResourceID->viewAttributes() ?>>
<?= $Page->ResourceID->getViewValue() ?></span>
</span>
</td>
<?php } ?>
<?php if ($Page->Start->Visible) { // Start ?>
        <td<?= $Page->Start->cellAttributes() ?>>
<span id="el<?= $Page->RowCount ?>_tasks_Start" class="el_tasks_Start">
<span<?= $Page->Start->viewAttributes() ?>>
<?= $Page->Start->getViewValue() ?></span>
</span>
</td>
<?php } ?>
<?php if ($Page->End->Visible) { // End ?>
        <td<?= $Page->End->cellAttributes() ?>>
<span id="el<?= $Page->RowCount ?>_tasks_End" class="el_tasks_End">
<span<?= $Page->End->viewAttributes() ?>>
<?= $Page->End->getViewValue() ?></span>
</span>
</td>
<?php } ?>
<?php if ($Page->Description->Visible) { // Description ?>
        <td<?= $Page->Description->cellAttributes() ?>>
<span id="el<?= $Page->RowCount ?>_tasks_Description" class="el_tasks_Description">
<span<?= $Page->Description->viewAttributes() ?>>
<?= $Page->Description->getViewValue() ?></span>
</span>
</td>
<?php } ?>
<?php if ($Page->Milestone->Visible) { // Milestone ?>
        <td<?= $Page->Milestone->cellAttributes() ?>>
<span id="el<?= $Page->RowCount ?>_tasks_Milestone" class="el_tasks_Milestone">
<span<?= $Page->Milestone->viewAttributes() ?>>
<?= $Page->Milestone->getViewValue() ?></span>
</span>
</td>
<?php } ?>
<?php if ($Page->Duration->Visible) { // Duration ?>
        <td<?= $Page->Duration->cellAttributes() ?>>
<span id="el<?= $Page->RowCount ?>_tasks_Duration" class="el_tasks_Duration">
<span<?= $Page->Duration->viewAttributes() ?>>
<?= $Page->Duration->getViewValue() ?></span>
</span>
</td>
<?php } ?>
<?php if ($Page->PercentComplete->Visible) { // PercentComplete ?>
        <td<?= $Page->PercentComplete->cellAttributes() ?>>
<span id="el<?= $Page->RowCount ?>_tasks_PercentComplete" class="el_tasks_PercentComplete">
<span<?= $Page->PercentComplete->viewAttributes() ?>>
<?= $Page->PercentComplete->getViewValue() ?></span>
</span>
</td>
<?php } ?>
<?php if ($Page->Dependencies->Visible) { // Dependencies ?>
        <td<?= $Page->Dependencies->cellAttributes() ?>>
<span id="el<?= $Page->RowCount ?>_tasks_Dependencies" class="el_tasks_Dependencies">
<span<?= $Page->Dependencies->viewAttributes() ?>>
<?= $Page->Dependencies->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(ftasksdelete.validateFields()){ew.prompt({title: ew.language.phrase("MessageDeleteConfirm"),icon:'question',showCancelButton:true},result=>{if(result) $("#ftasksdelete").submit();});return false;} else { ew.prompt({title: ew.language.phrase("MessageInvalidForm"), icon: 'warning', showCancelButton:false}); }});});
</script>
<?php } ?>
