<?php

namespace PHPMaker2021\gudang_ubi;

// Page object
$KedatanganList = &$Page;
?>
<?php if (!$Page->isExport()) { ?>
<script>
var currentForm, currentPageID;
var fkedatanganlist;
loadjs.ready("head", function () {
    var $ = jQuery;
    // Form object
    currentPageID = ew.PAGE_ID = "list";
    fkedatanganlist = currentForm = new ew.Form("fkedatanganlist", "list");
    fkedatanganlist.formKeyCountName = '<?= $Page->FormKeyCountName ?>';
    loadjs.done("fkedatanganlist");
});
var fkedatanganlistsrch, currentSearchForm, currentAdvancedSearchForm;
loadjs.ready("head", function () {
    var $ = jQuery;
    // Form object for search
    fkedatanganlistsrch = currentSearchForm = new ew.Form("fkedatanganlistsrch");

    // Add fields
    var fields = ew.vars.tables.kedatangan.fields;
    fkedatanganlistsrch.addFields([
        ["datang_id", [], fields.datang_id.isInvalid],
        ["datang_petugas", [], fields.datang_petugas.isInvalid],
        ["datang_tanggal", [], fields.datang_tanggal.isInvalid],
        ["y_datang_tanggal", [ew.Validators.between], false],
        ["datang_varietas", [], fields.datang_varietas.isInvalid],
        ["datang_jumlah", [], fields.datang_jumlah.isInvalid],
        ["datang_sup", [], fields.datang_sup.isInvalid]
    ]);

    // Set invalid fields
    $(function() {
        fkedatanganlistsrch.setInvalid();
    });

    // Validate form
    fkedatanganlistsrch.validate = function () {
        if (!this.validateRequired)
            return true; // Ignore validation
        var fobj = this.getForm(),
            $fobj = $(fobj),
            rowIndex = "";
        $fobj.data("rowindex", rowIndex);

        // Validate fields
        if (!this.validateFields(rowIndex))
            return false;

        // Call Form_CustomValidate event
        if (!this.customValidate(fobj)) {
            this.focus();
            return false;
        }
        return true;
    }

    // Form_CustomValidate
    fkedatanganlistsrch.customValidate = function(fobj) { // DO NOT CHANGE THIS LINE!
        // Your custom validation code here, return false if invalid.
        return true;
    }

    // Use JavaScript validation or not
    fkedatanganlistsrch.validateRequired = <?= Config("CLIENT_VALIDATE") ? "true" : "false" ?>;

    // Dynamic selection lists
    fkedatanganlistsrch.lists.datang_varietas = <?= $Page->datang_varietas->toClientList($Page) ?>;
    fkedatanganlistsrch.lists.datang_sup = <?= $Page->datang_sup->toClientList($Page) ?>;

    // Filters
    fkedatanganlistsrch.filterList = <?= $Page->getFilterList() ?>;
    loadjs.done("fkedatanganlistsrch");
});
</script>
<script>
loadjs.ready("head", function () {
    // Write your table-specific client script here, no need to add script tags.
});
</script>
<?php } ?>
<?php if (!$Page->isExport()) { ?>
<div class="btn-toolbar ew-toolbar">
<?php if ($Page->TotalRecords > 0 && $Page->ExportOptions->visible()) { ?>
<?php $Page->ExportOptions->render("body") ?>
<?php } ?>
<?php if ($Page->ImportOptions->visible()) { ?>
<?php $Page->ImportOptions->render("body") ?>
<?php } ?>
<?php if ($Page->SearchOptions->visible()) { ?>
<?php $Page->SearchOptions->render("body") ?>
<?php } ?>
<?php if ($Page->FilterOptions->visible()) { ?>
<?php $Page->FilterOptions->render("body") ?>
<?php } ?>
<div class="clearfix"></div>
</div>
<?php } ?>
<?php
$Page->renderOtherOptions();
?>
<?php if ($Security->canSearch()) { ?>
<?php if (!$Page->isExport() && !$Page->CurrentAction) { ?>
<form name="fkedatanganlistsrch" id="fkedatanganlistsrch" class="form-inline ew-form ew-ext-search-form" action="<?= CurrentPageUrl() ?>">
<div id="fkedatanganlistsrch-search-panel" class="<?= $Page->SearchPanelClass ?>">
<input type="hidden" name="cmd" value="search">
<input type="hidden" name="t" value="kedatangan">
    <div class="ew-extended-search">
<?php
// Render search row
$Page->RowType = ROWTYPE_SEARCH;
$Page->resetAttributes();
$Page->renderRow();
?>
<?php if ($Page->datang_tanggal->Visible) { // datang_tanggal ?>
    <?php
        $Page->SearchColumnCount++;
        if (($Page->SearchColumnCount - 1) % $Page->SearchFieldsPerRow == 0) {
            $Page->SearchRowCount++;
    ?>
<div id="xsr_<?= $Page->SearchRowCount ?>" class="ew-row d-sm-flex">
    <?php
        }
     ?>
    <div id="xsc_datang_tanggal" class="ew-cell form-group">
        <label for="x_datang_tanggal" class="ew-search-caption ew-label"><?= $Page->datang_tanggal->caption() ?></label>
        <span class="ew-search-operator">
<select name="z_datang_tanggal" id="z_datang_tanggal" class="custom-select" onchange="ew.searchOperatorChanged(this);">
<option value="="<?= $Page->datang_tanggal->AdvancedSearch->SearchOperator == "=" ? " selected" : "" ?>><?= $Language->phrase("EQUAL") ?></option>
<option value="<>"<?= $Page->datang_tanggal->AdvancedSearch->SearchOperator == "<>" ? " selected" : "" ?>><?= $Language->phrase("<>") ?></option>
<option value="<"<?= $Page->datang_tanggal->AdvancedSearch->SearchOperator == "<" ? " selected" : "" ?>><?= $Language->phrase("<") ?></option>
<option value="<="<?= $Page->datang_tanggal->AdvancedSearch->SearchOperator == "<=" ? " selected" : "" ?>><?= $Language->phrase("<=") ?></option>
<option value=">"<?= $Page->datang_tanggal->AdvancedSearch->SearchOperator == ">" ? " selected" : "" ?>><?= $Language->phrase(">") ?></option>
<option value=">="<?= $Page->datang_tanggal->AdvancedSearch->SearchOperator == ">=" ? " selected" : "" ?>><?= $Language->phrase(">=") ?></option>
<option value="BETWEEN"<?= $Page->datang_tanggal->AdvancedSearch->SearchOperator == "BETWEEN" ? " selected" : "" ?>><?= $Language->phrase("BETWEEN") ?></option>
</select>
</span>
        <span id="el_kedatangan_datang_tanggal" class="ew-search-field">
<input type="<?= $Page->datang_tanggal->getInputTextType() ?>" data-table="kedatangan" data-field="x_datang_tanggal" name="x_datang_tanggal" id="x_datang_tanggal" placeholder="<?= HtmlEncode($Page->datang_tanggal->getPlaceHolder()) ?>" value="<?= $Page->datang_tanggal->EditValue ?>"<?= $Page->datang_tanggal->editAttributes() ?>>
<div class="invalid-feedback"><?= $Page->datang_tanggal->getErrorMessage(false) ?></div>
<?php if (!$Page->datang_tanggal->ReadOnly && !$Page->datang_tanggal->Disabled && !isset($Page->datang_tanggal->EditAttrs["readonly"]) && !isset($Page->datang_tanggal->EditAttrs["disabled"])) { ?>
<script>
loadjs.ready(["fkedatanganlistsrch", "datetimepicker"], function() {
    ew.createDateTimePicker("fkedatanganlistsrch", "x_datang_tanggal", {"ignoreReadonly":true,"useCurrent":false,"format":0});
});
</script>
<?php } ?>
</span>
        <span class="ew-search-and d-none"><label><?= $Language->phrase("AND") ?></label></span>
        <span id="el2_kedatangan_datang_tanggal" class="ew-search-field2 d-none">
<input type="<?= $Page->datang_tanggal->getInputTextType() ?>" data-table="kedatangan" data-field="x_datang_tanggal" name="y_datang_tanggal" id="y_datang_tanggal" placeholder="<?= HtmlEncode($Page->datang_tanggal->getPlaceHolder()) ?>" value="<?= $Page->datang_tanggal->EditValue2 ?>"<?= $Page->datang_tanggal->editAttributes() ?>>
<div class="invalid-feedback"><?= $Page->datang_tanggal->getErrorMessage(false) ?></div>
<?php if (!$Page->datang_tanggal->ReadOnly && !$Page->datang_tanggal->Disabled && !isset($Page->datang_tanggal->EditAttrs["readonly"]) && !isset($Page->datang_tanggal->EditAttrs["disabled"])) { ?>
<script>
loadjs.ready(["fkedatanganlistsrch", "datetimepicker"], function() {
    ew.createDateTimePicker("fkedatanganlistsrch", "y_datang_tanggal", {"ignoreReadonly":true,"useCurrent":false,"format":0});
});
</script>
<?php } ?>
</span>
    </div>
    <?php if ($Page->SearchColumnCount % $Page->SearchFieldsPerRow == 0) { ?>
</div>
    <?php } ?>
<?php } ?>
<?php if ($Page->datang_varietas->Visible) { // datang_varietas ?>
    <?php
        $Page->SearchColumnCount++;
        if (($Page->SearchColumnCount - 1) % $Page->SearchFieldsPerRow == 0) {
            $Page->SearchRowCount++;
    ?>
<div id="xsr_<?= $Page->SearchRowCount ?>" class="ew-row d-sm-flex">
    <?php
        }
     ?>
    <div id="xsc_datang_varietas" class="ew-cell form-group">
        <label for="x_datang_varietas" class="ew-search-caption ew-label"><?= $Page->datang_varietas->caption() ?></label>
        <span class="ew-search-operator">
<?= $Language->phrase("=") ?>
<input type="hidden" name="z_datang_varietas" id="z_datang_varietas" value="=">
</span>
        <span id="el_kedatangan_datang_varietas" class="ew-search-field">
    <select
        id="x_datang_varietas"
        name="x_datang_varietas"
        class="form-control ew-select<?= $Page->datang_varietas->isInvalidClass() ?>"
        data-select2-id="kedatangan_x_datang_varietas"
        data-table="kedatangan"
        data-field="x_datang_varietas"
        data-value-separator="<?= $Page->datang_varietas->displayValueSeparatorAttribute() ?>"
        data-placeholder="<?= HtmlEncode($Page->datang_varietas->getPlaceHolder()) ?>"
        <?= $Page->datang_varietas->editAttributes() ?>>
        <?= $Page->datang_varietas->selectOptionListHtml("x_datang_varietas") ?>
    </select>
    <div class="invalid-feedback"><?= $Page->datang_varietas->getErrorMessage(false) ?></div>
<?= $Page->datang_varietas->Lookup->getParamTag($Page, "p_x_datang_varietas") ?>
<script>
loadjs.ready("head", function() {
    var el = document.querySelector("select[data-select2-id='kedatangan_x_datang_varietas']"),
        options = { name: "x_datang_varietas", selectId: "kedatangan_x_datang_varietas", language: ew.LANGUAGE_ID, dir: ew.IS_RTL ? "rtl" : "ltr" };
    options.dropdownParent = $(el).closest("#ew-modal-dialog, #ew-add-opt-dialog")[0];
    Object.assign(options, ew.vars.tables.kedatangan.fields.datang_varietas.selectOptions);
    ew.createSelect(options);
});
</script>
</span>
    </div>
    <?php if ($Page->SearchColumnCount % $Page->SearchFieldsPerRow == 0) { ?>
</div>
    <?php } ?>
<?php } ?>
<?php if ($Page->datang_sup->Visible) { // datang_sup ?>
    <?php
        $Page->SearchColumnCount++;
        if (($Page->SearchColumnCount - 1) % $Page->SearchFieldsPerRow == 0) {
            $Page->SearchRowCount++;
    ?>
<div id="xsr_<?= $Page->SearchRowCount ?>" class="ew-row d-sm-flex">
    <?php
        }
     ?>
    <div id="xsc_datang_sup" class="ew-cell form-group">
        <label for="x_datang_sup" class="ew-search-caption ew-label"><?= $Page->datang_sup->caption() ?></label>
        <span class="ew-search-operator">
<?= $Language->phrase("=") ?>
<input type="hidden" name="z_datang_sup" id="z_datang_sup" value="=">
</span>
        <span id="el_kedatangan_datang_sup" class="ew-search-field">
    <select
        id="x_datang_sup"
        name="x_datang_sup"
        class="form-control ew-select<?= $Page->datang_sup->isInvalidClass() ?>"
        data-select2-id="kedatangan_x_datang_sup"
        data-table="kedatangan"
        data-field="x_datang_sup"
        data-value-separator="<?= $Page->datang_sup->displayValueSeparatorAttribute() ?>"
        data-placeholder="<?= HtmlEncode($Page->datang_sup->getPlaceHolder()) ?>"
        <?= $Page->datang_sup->editAttributes() ?>>
        <?= $Page->datang_sup->selectOptionListHtml("x_datang_sup") ?>
    </select>
    <div class="invalid-feedback"><?= $Page->datang_sup->getErrorMessage(false) ?></div>
<?= $Page->datang_sup->Lookup->getParamTag($Page, "p_x_datang_sup") ?>
<script>
loadjs.ready("head", function() {
    var el = document.querySelector("select[data-select2-id='kedatangan_x_datang_sup']"),
        options = { name: "x_datang_sup", selectId: "kedatangan_x_datang_sup", language: ew.LANGUAGE_ID, dir: ew.IS_RTL ? "rtl" : "ltr" };
    options.dropdownParent = $(el).closest("#ew-modal-dialog, #ew-add-opt-dialog")[0];
    Object.assign(options, ew.vars.tables.kedatangan.fields.datang_sup.selectOptions);
    ew.createSelect(options);
});
</script>
</span>
    </div>
    <?php if ($Page->SearchColumnCount % $Page->SearchFieldsPerRow == 0) { ?>
</div>
    <?php } ?>
<?php } ?>
    <?php if ($Page->SearchColumnCount % $Page->SearchFieldsPerRow > 0) { ?>
</div>
    <?php } ?>
<div id="xsr_<?= $Page->SearchRowCount + 1 ?>" class="ew-row d-sm-flex">
    <button class="btn btn-primary" name="btn-submit" id="btn-submit" type="submit"><?= $Language->phrase("SearchBtn") ?></button>
</div>
    </div><!-- /.ew-extended-search -->
</div><!-- /.ew-search-panel -->
</form>
<?php } ?>
<?php } ?>
<?php $Page->showPageHeader(); ?>
<?php
$Page->showMessage();
?>
<?php if ($Page->TotalRecords > 0 || $Page->CurrentAction) { ?>
<div class="card ew-card ew-grid<?php if ($Page->isAddOrEdit()) { ?> ew-grid-add-edit<?php } ?> kedatangan">
<form name="fkedatanganlist" id="fkedatanganlist" class="form-inline ew-form ew-list-form" action="<?= CurrentPageUrl() ?>" method="post">
<?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="kedatangan">
<div id="gmp_kedatangan" class="<?= ResponsiveTableClass() ?>card-body ew-grid-middle-panel">
<?php if ($Page->TotalRecords > 0 || $Page->isGridEdit()) { ?>
<table id="tbl_kedatanganlist" class="table ew-table"><!-- .ew-table -->
<thead>
    <tr class="ew-table-header">
<?php
// Header row
$Page->RowType = ROWTYPE_HEADER;

// Render list options
$Page->renderListOptions();

// Render list options (header, left)
$Page->ListOptions->render("header", "left");
?>
<?php if ($Page->datang_id->Visible) { // datang_id ?>
        <th data-name="datang_id" class="<?= $Page->datang_id->headerCellClass() ?>"><div id="elh_kedatangan_datang_id" class="kedatangan_datang_id"><?= $Page->renderSort($Page->datang_id) ?></div></th>
<?php } ?>
<?php if ($Page->datang_petugas->Visible) { // datang_petugas ?>
        <th data-name="datang_petugas" class="<?= $Page->datang_petugas->headerCellClass() ?>"><div id="elh_kedatangan_datang_petugas" class="kedatangan_datang_petugas"><?= $Page->renderSort($Page->datang_petugas) ?></div></th>
<?php } ?>
<?php if ($Page->datang_tanggal->Visible) { // datang_tanggal ?>
        <th data-name="datang_tanggal" class="<?= $Page->datang_tanggal->headerCellClass() ?>"><div id="elh_kedatangan_datang_tanggal" class="kedatangan_datang_tanggal"><?= $Page->renderSort($Page->datang_tanggal) ?></div></th>
<?php } ?>
<?php if ($Page->datang_varietas->Visible) { // datang_varietas ?>
        <th data-name="datang_varietas" class="<?= $Page->datang_varietas->headerCellClass() ?>"><div id="elh_kedatangan_datang_varietas" class="kedatangan_datang_varietas"><?= $Page->renderSort($Page->datang_varietas) ?></div></th>
<?php } ?>
<?php if ($Page->datang_jumlah->Visible) { // datang_jumlah ?>
        <th data-name="datang_jumlah" class="<?= $Page->datang_jumlah->headerCellClass() ?>"><div id="elh_kedatangan_datang_jumlah" class="kedatangan_datang_jumlah"><?= $Page->renderSort($Page->datang_jumlah) ?></div></th>
<?php } ?>
<?php if ($Page->datang_sup->Visible) { // datang_sup ?>
        <th data-name="datang_sup" class="<?= $Page->datang_sup->headerCellClass() ?>"><div id="elh_kedatangan_datang_sup" class="kedatangan_datang_sup"><?= $Page->renderSort($Page->datang_sup) ?></div></th>
<?php } ?>
<?php
// Render list options (header, right)
$Page->ListOptions->render("header", "right");
?>
    </tr>
</thead>
<tbody>
<?php
if ($Page->ExportAll && $Page->isExport()) {
    $Page->StopRecord = $Page->TotalRecords;
} else {
    // Set the last record to display
    if ($Page->TotalRecords > $Page->StartRecord + $Page->DisplayRecords - 1) {
        $Page->StopRecord = $Page->StartRecord + $Page->DisplayRecords - 1;
    } else {
        $Page->StopRecord = $Page->TotalRecords;
    }
}
$Page->RecordCount = $Page->StartRecord - 1;
if ($Page->Recordset && !$Page->Recordset->EOF) {
    // Nothing to do
} elseif (!$Page->AllowAddDeleteRow && $Page->StopRecord == 0) {
    $Page->StopRecord = $Page->GridAddRowCount;
}

// Initialize aggregate
$Page->RowType = ROWTYPE_AGGREGATEINIT;
$Page->resetAttributes();
$Page->renderRow();
while ($Page->RecordCount < $Page->StopRecord) {
    $Page->RecordCount++;
    if ($Page->RecordCount >= $Page->StartRecord) {
        $Page->RowCount++;

        // Set up key count
        $Page->KeyCount = $Page->RowIndex;

        // Init row class and style
        $Page->resetAttributes();
        $Page->CssClass = "";
        if ($Page->isGridAdd()) {
        } else {
            $Page->loadRowValues($Page->Recordset); // Load row values
        }
        $Page->RowType = ROWTYPE_VIEW; // Render view

        // Set up row id / data-rowindex
        $Page->RowAttrs->merge(["data-rowindex" => $Page->RowCount, "id" => "r" . $Page->RowCount . "_kedatangan", "data-rowtype" => $Page->RowType]);

        // Render row
        $Page->renderRow();

        // Render list options
        $Page->renderListOptions();
?>
    <tr <?= $Page->rowAttributes() ?>>
<?php
// Render list options (body, left)
$Page->ListOptions->render("body", "left", $Page->RowCount);
?>
    <?php if ($Page->datang_id->Visible) { // datang_id ?>
        <td data-name="datang_id" <?= $Page->datang_id->cellAttributes() ?>>
<span id="el<?= $Page->RowCount ?>_kedatangan_datang_id">
<span<?= $Page->datang_id->viewAttributes() ?>>
<?= $Page->datang_id->getViewValue() ?></span>
</span>
</td>
    <?php } ?>
    <?php if ($Page->datang_petugas->Visible) { // datang_petugas ?>
        <td data-name="datang_petugas" <?= $Page->datang_petugas->cellAttributes() ?>>
<span id="el<?= $Page->RowCount ?>_kedatangan_datang_petugas">
<span<?= $Page->datang_petugas->viewAttributes() ?>>
<?= $Page->datang_petugas->getViewValue() ?></span>
</span>
</td>
    <?php } ?>
    <?php if ($Page->datang_tanggal->Visible) { // datang_tanggal ?>
        <td data-name="datang_tanggal" <?= $Page->datang_tanggal->cellAttributes() ?>>
<span id="el<?= $Page->RowCount ?>_kedatangan_datang_tanggal">
<span<?= $Page->datang_tanggal->viewAttributes() ?>>
<?= $Page->datang_tanggal->getViewValue() ?></span>
</span>
</td>
    <?php } ?>
    <?php if ($Page->datang_varietas->Visible) { // datang_varietas ?>
        <td data-name="datang_varietas" <?= $Page->datang_varietas->cellAttributes() ?>>
<span id="el<?= $Page->RowCount ?>_kedatangan_datang_varietas">
<span<?= $Page->datang_varietas->viewAttributes() ?>>
<?= $Page->datang_varietas->getViewValue() ?></span>
</span>
</td>
    <?php } ?>
    <?php if ($Page->datang_jumlah->Visible) { // datang_jumlah ?>
        <td data-name="datang_jumlah" <?= $Page->datang_jumlah->cellAttributes() ?>>
<span id="el<?= $Page->RowCount ?>_kedatangan_datang_jumlah">
<span<?= $Page->datang_jumlah->viewAttributes() ?>>
<?= $Page->datang_jumlah->getViewValue() ?></span>
</span>
</td>
    <?php } ?>
    <?php if ($Page->datang_sup->Visible) { // datang_sup ?>
        <td data-name="datang_sup" <?= $Page->datang_sup->cellAttributes() ?>>
<span id="el<?= $Page->RowCount ?>_kedatangan_datang_sup">
<span<?= $Page->datang_sup->viewAttributes() ?>>
<?= $Page->datang_sup->getViewValue() ?></span>
</span>
</td>
    <?php } ?>
<?php
// Render list options (body, right)
$Page->ListOptions->render("body", "right", $Page->RowCount);
?>
    </tr>
<?php
    }
    if (!$Page->isGridAdd()) {
        $Page->Recordset->moveNext();
    }
}
?>
</tbody>
</table><!-- /.ew-table -->
<?php } ?>
</div><!-- /.ew-grid-middle-panel -->
<?php if (!$Page->CurrentAction) { ?>
<input type="hidden" name="action" id="action" value="">
<?php } ?>
</form><!-- /.ew-list-form -->
<?php
// Close recordset
if ($Page->Recordset) {
    $Page->Recordset->close();
}
?>
<?php if (!$Page->isExport()) { ?>
<div class="card-footer ew-grid-lower-panel">
<?php if (!$Page->isGridAdd()) { ?>
<form name="ew-pager-form" class="form-inline ew-form ew-pager-form" action="<?= CurrentPageUrl() ?>">
<?= $Page->Pager->render() ?>
</form>
<?php } ?>
<div class="ew-list-other-options">
<?php $Page->OtherOptions->render("body", "bottom") ?>
</div>
<div class="clearfix"></div>
</div>
<?php } ?>
</div><!-- /.ew-grid -->
<?php } ?>
<?php if ($Page->TotalRecords == 0 && !$Page->CurrentAction) { // Show other options ?>
<div class="ew-list-other-options">
<?php $Page->OtherOptions->render("body") ?>
</div>
<div class="clearfix"></div>
<?php } ?>
<?php
$Page->showPageFooter();
echo GetDebugMessage();
?>
<?php if (!$Page->isExport()) { ?>
<script>
// Field event handlers
loadjs.ready("head", function() {
    ew.addEventHandlers("kedatangan");
});
</script>
<script>
loadjs.ready("load", function () {
    // Write your table-specific startup script here, no need to add script tags.
});
</script>
<?php } ?>
