<?php

namespace PHPMaker2021\rdigital21;

// Set up and run Grid object
$Grid = Container("TujuanPembelajaranGrid");
$Grid->run();
?>
<?php if (!$Grid->isExport()) { ?>
<script>
var currentForm, currentPageID;
var ftujuan_pembelajarangrid;
loadjs.ready("head", function () {
    var $ = jQuery;
    // Form object
    ftujuan_pembelajarangrid = new ew.Form("ftujuan_pembelajarangrid", "grid");
    ftujuan_pembelajarangrid.formKeyCountName = '<?= $Grid->FormKeyCountName ?>';

    // Add fields
    var currentTable = <?= JsonEncode(GetClientVar("tables", "tujuan_pembelajaran")) ?>,
        fields = currentTable.fields;
    if (!ew.vars.tables.tujuan_pembelajaran)
        ew.vars.tables.tujuan_pembelajaran = currentTable;
    ftujuan_pembelajarangrid.addFields([
        ["materi_id", [fields.materi_id.visible && fields.materi_id.required ? ew.Validators.required(fields.materi_id.caption) : null], fields.materi_id.isInvalid],
        ["kode_mapel", [fields.kode_mapel.visible && fields.kode_mapel.required ? ew.Validators.required(fields.kode_mapel.caption) : null], fields.kode_mapel.isInvalid],
        ["tujuan_pembelajaran", [fields.tujuan_pembelajaran.visible && fields.tujuan_pembelajaran.required ? ew.Validators.required(fields.tujuan_pembelajaran.caption) : null], fields.tujuan_pembelajaran.isInvalid]
    ]);

    // Set invalid fields
    $(function() {
        var f = ftujuan_pembelajarangrid,
            fobj = f.getForm(),
            $fobj = $(fobj),
            $k = $fobj.find("#" + f.formKeyCountName), // Get key_count
            rowcnt = ($k[0]) ? parseInt($k.val(), 10) : 1,
            startcnt = (rowcnt == 0) ? 0 : 1; // Check rowcnt == 0 => Inline-Add
        for (var i = startcnt; i <= rowcnt; i++) {
            var rowIndex = ($k[0]) ? String(i) : "";
            f.setInvalid(rowIndex);
        }
    });

    // Validate form
    ftujuan_pembelajarangrid.validate = function () {
        if (!this.validateRequired)
            return true; // Ignore validation
        var fobj = this.getForm(),
            $fobj = $(fobj);
        if ($fobj.find("#confirm").val() == "confirm")
            return true;
        var addcnt = 0,
            $k = $fobj.find("#" + this.formKeyCountName), // Get key_count
            rowcnt = ($k[0]) ? parseInt($k.val(), 10) : 1,
            startcnt = (rowcnt == 0) ? 0 : 1, // Check rowcnt == 0 => Inline-Add
            gridinsert = ["insert", "gridinsert"].includes($fobj.find("#action").val()) && $k[0];
        for (var i = startcnt; i <= rowcnt; i++) {
            var rowIndex = ($k[0]) ? String(i) : "";
            $fobj.data("rowindex", rowIndex);
            var checkrow = (gridinsert) ? !this.emptyRow(rowIndex) : true;
            if (checkrow) {
                addcnt++;

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

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

    // Check empty row
    ftujuan_pembelajarangrid.emptyRow = function (rowIndex) {
        var fobj = this.getForm();
        if (ew.valueChanged(fobj, rowIndex, "materi_id", false))
            return false;
        if (ew.valueChanged(fobj, rowIndex, "kode_mapel", false))
            return false;
        if (ew.valueChanged(fobj, rowIndex, "tujuan_pembelajaran", false))
            return false;
        return true;
    }

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

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

    // Dynamic selection lists
    ftujuan_pembelajarangrid.lists.materi_id = <?= $Grid->materi_id->toClientList($Grid) ?>;
    loadjs.done("ftujuan_pembelajarangrid");
});
</script>
<?php } ?>
<?php
$Grid->renderOtherOptions();
?>
<?php if ($Grid->TotalRecords > 0 || $Grid->CurrentAction) { ?>
<div class="card ew-card ew-grid<?php if ($Grid->isAddOrEdit()) { ?> ew-grid-add-edit<?php } ?> tujuan_pembelajaran">
<?php if ($Grid->ShowOtherOptions) { ?>
<div class="card-header ew-grid-upper-panel">
<?php $Grid->OtherOptions->render("body") ?>
</div>
<div class="clearfix"></div>
<?php } ?>
<div id="ftujuan_pembelajarangrid" class="ew-form ew-list-form form-inline">
<div id="gmp_tujuan_pembelajaran" class="<?= ResponsiveTableClass() ?>card-body ew-grid-middle-panel">
<table id="tbl_tujuan_pembelajarangrid" class="table ew-table"><!-- .ew-table -->
<thead>
    <tr class="ew-table-header">
<?php
// Header row
$Grid->RowType = ROWTYPE_HEADER;

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

// Render list options (header, left)
$Grid->ListOptions->render("header", "left");
?>
<?php if ($Grid->materi_id->Visible) { // materi_id ?>
        <th data-name="materi_id" class="<?= $Grid->materi_id->headerCellClass() ?>"><div id="elh_tujuan_pembelajaran_materi_id" class="tujuan_pembelajaran_materi_id"><?= $Grid->renderSort($Grid->materi_id) ?></div></th>
<?php } ?>
<?php if ($Grid->kode_mapel->Visible) { // kode_mapel ?>
        <th data-name="kode_mapel" class="<?= $Grid->kode_mapel->headerCellClass() ?>"><div id="elh_tujuan_pembelajaran_kode_mapel" class="tujuan_pembelajaran_kode_mapel"><?= $Grid->renderSort($Grid->kode_mapel) ?></div></th>
<?php } ?>
<?php if ($Grid->tujuan_pembelajaran->Visible) { // tujuan_pembelajaran ?>
        <th data-name="tujuan_pembelajaran" class="<?= $Grid->tujuan_pembelajaran->headerCellClass() ?>"><div id="elh_tujuan_pembelajaran_tujuan_pembelajaran" class="tujuan_pembelajaran_tujuan_pembelajaran"><?= $Grid->renderSort($Grid->tujuan_pembelajaran) ?></div></th>
<?php } ?>
<?php
// Render list options (header, right)
$Grid->ListOptions->render("header", "right");
?>
    </tr>
</thead>
<tbody>
<?php
$Grid->StartRecord = 1;
$Grid->StopRecord = $Grid->TotalRecords; // Show all records

// Restore number of post back records
if ($CurrentForm && ($Grid->isConfirm() || $Grid->EventCancelled)) {
    $CurrentForm->Index = -1;
    if ($CurrentForm->hasValue($Grid->FormKeyCountName) && ($Grid->isGridAdd() || $Grid->isGridEdit() || $Grid->isConfirm())) {
        $Grid->KeyCount = $CurrentForm->getValue($Grid->FormKeyCountName);
        $Grid->StopRecord = $Grid->StartRecord + $Grid->KeyCount - 1;
    }
}
$Grid->RecordCount = $Grid->StartRecord - 1;
if ($Grid->Recordset && !$Grid->Recordset->EOF) {
    // Nothing to do
} elseif (!$Grid->AllowAddDeleteRow && $Grid->StopRecord == 0) {
    $Grid->StopRecord = $Grid->GridAddRowCount;
}

// Initialize aggregate
$Grid->RowType = ROWTYPE_AGGREGATEINIT;
$Grid->resetAttributes();
$Grid->renderRow();
if ($Grid->isGridAdd())
    $Grid->RowIndex = 0;
if ($Grid->isGridEdit())
    $Grid->RowIndex = 0;
while ($Grid->RecordCount < $Grid->StopRecord) {
    $Grid->RecordCount++;
    if ($Grid->RecordCount >= $Grid->StartRecord) {
        $Grid->RowCount++;
        if ($Grid->isGridAdd() || $Grid->isGridEdit() || $Grid->isConfirm()) {
            $Grid->RowIndex++;
            $CurrentForm->Index = $Grid->RowIndex;
            if ($CurrentForm->hasValue($Grid->FormActionName) && ($Grid->isConfirm() || $Grid->EventCancelled)) {
                $Grid->RowAction = strval($CurrentForm->getValue($Grid->FormActionName));
            } elseif ($Grid->isGridAdd()) {
                $Grid->RowAction = "insert";
            } else {
                $Grid->RowAction = "";
            }
        }

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

        // Init row class and style
        $Grid->resetAttributes();
        $Grid->CssClass = "";
        if ($Grid->isGridAdd()) {
            if ($Grid->CurrentMode == "copy") {
                $Grid->loadRowValues($Grid->Recordset); // Load row values
                $Grid->OldKey = $Grid->getKey(true); // Get from CurrentValue
            } else {
                $Grid->loadRowValues(); // Load default values
                $Grid->OldKey = "";
            }
        } else {
            $Grid->loadRowValues($Grid->Recordset); // Load row values
            $Grid->OldKey = $Grid->getKey(true); // Get from CurrentValue
        }
        $Grid->setKey($Grid->OldKey);
        $Grid->RowType = ROWTYPE_VIEW; // Render view
        if ($Grid->isGridAdd()) { // Grid add
            $Grid->RowType = ROWTYPE_ADD; // Render add
        }
        if ($Grid->isGridAdd() && $Grid->EventCancelled && !$CurrentForm->hasValue("k_blankrow")) { // Insert failed
            $Grid->restoreCurrentRowFormValues($Grid->RowIndex); // Restore form values
        }
        if ($Grid->isGridEdit()) { // Grid edit
            if ($Grid->EventCancelled) {
                $Grid->restoreCurrentRowFormValues($Grid->RowIndex); // Restore form values
            }
            if ($Grid->RowAction == "insert") {
                $Grid->RowType = ROWTYPE_ADD; // Render add
            } else {
                $Grid->RowType = ROWTYPE_EDIT; // Render edit
            }
        }
        if ($Grid->isGridEdit() && ($Grid->RowType == ROWTYPE_EDIT || $Grid->RowType == ROWTYPE_ADD) && $Grid->EventCancelled) { // Update failed
            $Grid->restoreCurrentRowFormValues($Grid->RowIndex); // Restore form values
        }
        if ($Grid->RowType == ROWTYPE_EDIT) { // Edit row
            $Grid->EditRowCount++;
        }
        if ($Grid->isConfirm()) { // Confirm row
            $Grid->restoreCurrentRowFormValues($Grid->RowIndex); // Restore form values
        }

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

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

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

        // Skip delete row / empty row for confirm page
        if ($Grid->RowAction != "delete" && $Grid->RowAction != "insertdelete" && !($Grid->RowAction == "insert" && $Grid->isConfirm() && $Grid->emptyRow())) {
?>
    <tr <?= $Grid->rowAttributes() ?>>
<?php
// Render list options (body, left)
$Grid->ListOptions->render("body", "left", $Grid->RowCount);
?>
    <?php if ($Grid->materi_id->Visible) { // materi_id ?>
        <td data-name="materi_id" <?= $Grid->materi_id->cellAttributes() ?>>
<?php if ($Grid->RowType == ROWTYPE_ADD) { // Add record ?>
<?php if ($Grid->materi_id->getSessionValue() != "") { ?>
<span id="el<?= $Grid->RowCount ?>_tujuan_pembelajaran_materi_id" class="form-group">
<span<?= $Grid->materi_id->viewAttributes() ?>>
<input type="text" readonly class="form-control-plaintext" value="<?= HtmlEncode(RemoveHtml($Grid->materi_id->getDisplayValue($Grid->materi_id->ViewValue))) ?>"></span>
</span>
<input type="hidden" id="x<?= $Grid->RowIndex ?>_materi_id" name="x<?= $Grid->RowIndex ?>_materi_id" value="<?= HtmlEncode($Grid->materi_id->CurrentValue) ?>" data-hidden="1">
<?php } else { ?>
<span id="el<?= $Grid->RowCount ?>_tujuan_pembelajaran_materi_id" class="form-group">
<div class="input-group ew-lookup-list">
    <div class="form-control ew-lookup-text" tabindex="-1" id="lu_x<?= $Grid->RowIndex ?>_materi_id"><?= EmptyValue(strval($Grid->materi_id->ViewValue)) ? $Language->phrase("PleaseSelect") : $Grid->materi_id->ViewValue ?></div>
    <div class="input-group-append">
        <button type="button" title="<?= HtmlEncode(str_replace("%s", RemoveHtml($Grid->materi_id->caption()), $Language->phrase("LookupLink", true))) ?>" class="ew-lookup-btn btn btn-default"<?= ($Grid->materi_id->ReadOnly || $Grid->materi_id->Disabled) ? " disabled" : "" ?> onclick="ew.modalLookupShow({lnk:this,el:'x<?= $Grid->RowIndex ?>_materi_id',m:0,n:10});"><i class="fas fa-search ew-icon"></i></button>
    </div>
</div>
<div class="invalid-feedback"><?= $Grid->materi_id->getErrorMessage() ?></div>
<?= $Grid->materi_id->Lookup->getParamTag($Grid, "p_x" . $Grid->RowIndex . "_materi_id") ?>
<input type="hidden" is="selection-list" data-table="tujuan_pembelajaran" data-field="x_materi_id" data-type="text" data-multiple="0" data-lookup="1" data-value-separator="<?= $Grid->materi_id->displayValueSeparatorAttribute() ?>" name="x<?= $Grid->RowIndex ?>_materi_id" id="x<?= $Grid->RowIndex ?>_materi_id" value="<?= $Grid->materi_id->CurrentValue ?>"<?= $Grid->materi_id->editAttributes() ?>>
</span>
<?php } ?>
<input type="hidden" data-table="tujuan_pembelajaran" data-field="x_materi_id" data-hidden="1" name="o<?= $Grid->RowIndex ?>_materi_id" id="o<?= $Grid->RowIndex ?>_materi_id" value="<?= HtmlEncode($Grid->materi_id->OldValue) ?>">
<?php } ?>
<?php if ($Grid->RowType == ROWTYPE_EDIT) { // Edit record ?>
<?php if ($Grid->materi_id->getSessionValue() != "") { ?>
<span id="el<?= $Grid->RowCount ?>_tujuan_pembelajaran_materi_id" class="form-group">
<span<?= $Grid->materi_id->viewAttributes() ?>>
<input type="text" readonly class="form-control-plaintext" value="<?= HtmlEncode(RemoveHtml($Grid->materi_id->getDisplayValue($Grid->materi_id->ViewValue))) ?>"></span>
</span>
<input type="hidden" id="x<?= $Grid->RowIndex ?>_materi_id" name="x<?= $Grid->RowIndex ?>_materi_id" value="<?= HtmlEncode($Grid->materi_id->CurrentValue) ?>" data-hidden="1">
<?php } else { ?>
<span id="el<?= $Grid->RowCount ?>_tujuan_pembelajaran_materi_id" class="form-group">
<div class="input-group ew-lookup-list">
    <div class="form-control ew-lookup-text" tabindex="-1" id="lu_x<?= $Grid->RowIndex ?>_materi_id"><?= EmptyValue(strval($Grid->materi_id->ViewValue)) ? $Language->phrase("PleaseSelect") : $Grid->materi_id->ViewValue ?></div>
    <div class="input-group-append">
        <button type="button" title="<?= HtmlEncode(str_replace("%s", RemoveHtml($Grid->materi_id->caption()), $Language->phrase("LookupLink", true))) ?>" class="ew-lookup-btn btn btn-default"<?= ($Grid->materi_id->ReadOnly || $Grid->materi_id->Disabled) ? " disabled" : "" ?> onclick="ew.modalLookupShow({lnk:this,el:'x<?= $Grid->RowIndex ?>_materi_id',m:0,n:10});"><i class="fas fa-search ew-icon"></i></button>
    </div>
</div>
<div class="invalid-feedback"><?= $Grid->materi_id->getErrorMessage() ?></div>
<?= $Grid->materi_id->Lookup->getParamTag($Grid, "p_x" . $Grid->RowIndex . "_materi_id") ?>
<input type="hidden" is="selection-list" data-table="tujuan_pembelajaran" data-field="x_materi_id" data-type="text" data-multiple="0" data-lookup="1" data-value-separator="<?= $Grid->materi_id->displayValueSeparatorAttribute() ?>" name="x<?= $Grid->RowIndex ?>_materi_id" id="x<?= $Grid->RowIndex ?>_materi_id" value="<?= $Grid->materi_id->CurrentValue ?>"<?= $Grid->materi_id->editAttributes() ?>>
</span>
<?php } ?>
<?php } ?>
<?php if ($Grid->RowType == ROWTYPE_VIEW) { // View record ?>
<span id="el<?= $Grid->RowCount ?>_tujuan_pembelajaran_materi_id">
<span<?= $Grid->materi_id->viewAttributes() ?>><center>
<?php
$materi_id = $tujuan_pembelajaran->materi_id->getViewValue();
$tp = explode(", ", $materi_id);
echo $tp[0];
?>
</center>
</span>
</span>
<?php if ($Grid->isConfirm()) { ?>
<input type="hidden" data-table="tujuan_pembelajaran" data-field="x_materi_id" data-hidden="1" name="ftujuan_pembelajarangrid$x<?= $Grid->RowIndex ?>_materi_id" id="ftujuan_pembelajarangrid$x<?= $Grid->RowIndex ?>_materi_id" value="<?= HtmlEncode($Grid->materi_id->FormValue) ?>">
<input type="hidden" data-table="tujuan_pembelajaran" data-field="x_materi_id" data-hidden="1" name="ftujuan_pembelajarangrid$o<?= $Grid->RowIndex ?>_materi_id" id="ftujuan_pembelajarangrid$o<?= $Grid->RowIndex ?>_materi_id" value="<?= HtmlEncode($Grid->materi_id->OldValue) ?>">
<?php } ?>
<?php } ?>
</td>
    <?php } ?>
    <?php if ($Grid->kode_mapel->Visible) { // kode_mapel ?>
        <td data-name="kode_mapel" <?= $Grid->kode_mapel->cellAttributes() ?>>
<?php if ($Grid->RowType == ROWTYPE_ADD) { // Add record ?>
<span id="el<?= $Grid->RowCount ?>_tujuan_pembelajaran_kode_mapel" class="form-group">
<input type="<?= $Grid->kode_mapel->getInputTextType() ?>" data-table="tujuan_pembelajaran" data-field="x_kode_mapel" name="x<?= $Grid->RowIndex ?>_kode_mapel" id="x<?= $Grid->RowIndex ?>_kode_mapel" size="30" maxlength="255" value="<?= $Grid->kode_mapel->EditValue ?>"<?= $Grid->kode_mapel->editAttributes() ?>>
<div class="invalid-feedback"><?= $Grid->kode_mapel->getErrorMessage() ?></div>
</span>
<input type="hidden" data-table="tujuan_pembelajaran" data-field="x_kode_mapel" data-hidden="1" name="o<?= $Grid->RowIndex ?>_kode_mapel" id="o<?= $Grid->RowIndex ?>_kode_mapel" value="<?= HtmlEncode($Grid->kode_mapel->OldValue) ?>">
<?php } ?>
<?php if ($Grid->RowType == ROWTYPE_EDIT) { // Edit record ?>
<span id="el<?= $Grid->RowCount ?>_tujuan_pembelajaran_kode_mapel" class="form-group">
<input type="<?= $Grid->kode_mapel->getInputTextType() ?>" data-table="tujuan_pembelajaran" data-field="x_kode_mapel" name="x<?= $Grid->RowIndex ?>_kode_mapel" id="x<?= $Grid->RowIndex ?>_kode_mapel" size="30" maxlength="255" value="<?= $Grid->kode_mapel->EditValue ?>"<?= $Grid->kode_mapel->editAttributes() ?>>
<div class="invalid-feedback"><?= $Grid->kode_mapel->getErrorMessage() ?></div>
</span>
<?php } ?>
<?php if ($Grid->RowType == ROWTYPE_VIEW) { // View record ?>
<span id="el<?= $Grid->RowCount ?>_tujuan_pembelajaran_kode_mapel">
<span<?= $Grid->kode_mapel->viewAttributes() ?>>
<?= $Grid->kode_mapel->getViewValue() ?></span>
</span>
<?php if ($Grid->isConfirm()) { ?>
<input type="hidden" data-table="tujuan_pembelajaran" data-field="x_kode_mapel" data-hidden="1" name="ftujuan_pembelajarangrid$x<?= $Grid->RowIndex ?>_kode_mapel" id="ftujuan_pembelajarangrid$x<?= $Grid->RowIndex ?>_kode_mapel" value="<?= HtmlEncode($Grid->kode_mapel->FormValue) ?>">
<input type="hidden" data-table="tujuan_pembelajaran" data-field="x_kode_mapel" data-hidden="1" name="ftujuan_pembelajarangrid$o<?= $Grid->RowIndex ?>_kode_mapel" id="ftujuan_pembelajarangrid$o<?= $Grid->RowIndex ?>_kode_mapel" value="<?= HtmlEncode($Grid->kode_mapel->OldValue) ?>">
<?php } ?>
<?php } ?>
</td>
    <?php } ?>
    <?php if ($Grid->tujuan_pembelajaran->Visible) { // tujuan_pembelajaran ?>
        <td data-name="tujuan_pembelajaran" <?= $Grid->tujuan_pembelajaran->cellAttributes() ?>>
<?php if ($Grid->RowType == ROWTYPE_ADD) { // Add record ?>
<span id="el<?= $Grid->RowCount ?>_tujuan_pembelajaran_tujuan_pembelajaran" class="form-group">
<input type="<?= $Grid->tujuan_pembelajaran->getInputTextType() ?>" data-table="tujuan_pembelajaran" data-field="x_tujuan_pembelajaran" name="x<?= $Grid->RowIndex ?>_tujuan_pembelajaran" id="x<?= $Grid->RowIndex ?>_tujuan_pembelajaran" size="30" maxlength="255" value="<?= $Grid->tujuan_pembelajaran->EditValue ?>"<?= $Grid->tujuan_pembelajaran->editAttributes() ?>>
<div class="invalid-feedback"><?= $Grid->tujuan_pembelajaran->getErrorMessage() ?></div>
</span>
<input type="hidden" data-table="tujuan_pembelajaran" data-field="x_tujuan_pembelajaran" data-hidden="1" name="o<?= $Grid->RowIndex ?>_tujuan_pembelajaran" id="o<?= $Grid->RowIndex ?>_tujuan_pembelajaran" value="<?= HtmlEncode($Grid->tujuan_pembelajaran->OldValue) ?>">
<?php } ?>
<?php if ($Grid->RowType == ROWTYPE_EDIT) { // Edit record ?>
<span id="el<?= $Grid->RowCount ?>_tujuan_pembelajaran_tujuan_pembelajaran" class="form-group">
<input type="<?= $Grid->tujuan_pembelajaran->getInputTextType() ?>" data-table="tujuan_pembelajaran" data-field="x_tujuan_pembelajaran" name="x<?= $Grid->RowIndex ?>_tujuan_pembelajaran" id="x<?= $Grid->RowIndex ?>_tujuan_pembelajaran" size="30" maxlength="255" value="<?= $Grid->tujuan_pembelajaran->EditValue ?>"<?= $Grid->tujuan_pembelajaran->editAttributes() ?>>
<div class="invalid-feedback"><?= $Grid->tujuan_pembelajaran->getErrorMessage() ?></div>
</span>
<?php } ?>
<?php if ($Grid->RowType == ROWTYPE_VIEW) { // View record ?>
<span id="el<?= $Grid->RowCount ?>_tujuan_pembelajaran_tujuan_pembelajaran">
<span<?= $Grid->tujuan_pembelajaran->viewAttributes() ?>>
<?= $Grid->tujuan_pembelajaran->getViewValue() ?></span>
</span>
<?php if ($Grid->isConfirm()) { ?>
<input type="hidden" data-table="tujuan_pembelajaran" data-field="x_tujuan_pembelajaran" data-hidden="1" name="ftujuan_pembelajarangrid$x<?= $Grid->RowIndex ?>_tujuan_pembelajaran" id="ftujuan_pembelajarangrid$x<?= $Grid->RowIndex ?>_tujuan_pembelajaran" value="<?= HtmlEncode($Grid->tujuan_pembelajaran->FormValue) ?>">
<input type="hidden" data-table="tujuan_pembelajaran" data-field="x_tujuan_pembelajaran" data-hidden="1" name="ftujuan_pembelajarangrid$o<?= $Grid->RowIndex ?>_tujuan_pembelajaran" id="ftujuan_pembelajarangrid$o<?= $Grid->RowIndex ?>_tujuan_pembelajaran" value="<?= HtmlEncode($Grid->tujuan_pembelajaran->OldValue) ?>">
<?php } ?>
<?php } ?>
</td>
    <?php } ?>
<?php
// Render list options (body, right)
$Grid->ListOptions->render("body", "right", $Grid->RowCount);
?>
    </tr>
<?php if ($Grid->RowType == ROWTYPE_ADD || $Grid->RowType == ROWTYPE_EDIT) { ?>
<script>
loadjs.ready(["ftujuan_pembelajarangrid","load"], function () {
    ftujuan_pembelajarangrid.updateLists(<?= $Grid->RowIndex ?>);
});
</script>
<?php } ?>
<?php
    }
    } // End delete row checking
    if (!$Grid->isGridAdd() || $Grid->CurrentMode == "copy")
        if (!$Grid->Recordset->EOF) {
            $Grid->Recordset->moveNext();
        }
}
?>
<?php
    if ($Grid->CurrentMode == "add" || $Grid->CurrentMode == "copy" || $Grid->CurrentMode == "edit") {
        $Grid->RowIndex = '$rowindex$';
        $Grid->loadRowValues();

        // Set row properties
        $Grid->resetAttributes();
        $Grid->RowAttrs->merge(["data-rowindex" => $Grid->RowIndex, "id" => "r0_tujuan_pembelajaran", "data-rowtype" => ROWTYPE_ADD]);
        $Grid->RowAttrs->appendClass("ew-template");
        $Grid->RowType = ROWTYPE_ADD;

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

        // Render list options
        $Grid->renderListOptions();
        $Grid->StartRowCount = 0;
?>
    <tr <?= $Grid->rowAttributes() ?>>
<?php
// Render list options (body, left)
$Grid->ListOptions->render("body", "left", $Grid->RowIndex);
?>
    <?php if ($Grid->materi_id->Visible) { // materi_id ?>
        <td data-name="materi_id">
<?php if (!$Grid->isConfirm()) { ?>
<?php if ($Grid->materi_id->getSessionValue() != "") { ?>
<span id="el$rowindex$_tujuan_pembelajaran_materi_id" class="form-group tujuan_pembelajaran_materi_id">
<span<?= $Grid->materi_id->viewAttributes() ?>>
<input type="text" readonly class="form-control-plaintext" value="<?= HtmlEncode(RemoveHtml($Grid->materi_id->getDisplayValue($Grid->materi_id->ViewValue))) ?>"></span>
</span>
<input type="hidden" id="x<?= $Grid->RowIndex ?>_materi_id" name="x<?= $Grid->RowIndex ?>_materi_id" value="<?= HtmlEncode($Grid->materi_id->CurrentValue) ?>" data-hidden="1">
<?php } else { ?>
<span id="el$rowindex$_tujuan_pembelajaran_materi_id" class="form-group tujuan_pembelajaran_materi_id">
<div class="input-group ew-lookup-list">
    <div class="form-control ew-lookup-text" tabindex="-1" id="lu_x<?= $Grid->RowIndex ?>_materi_id"><?= EmptyValue(strval($Grid->materi_id->ViewValue)) ? $Language->phrase("PleaseSelect") : $Grid->materi_id->ViewValue ?></div>
    <div class="input-group-append">
        <button type="button" title="<?= HtmlEncode(str_replace("%s", RemoveHtml($Grid->materi_id->caption()), $Language->phrase("LookupLink", true))) ?>" class="ew-lookup-btn btn btn-default"<?= ($Grid->materi_id->ReadOnly || $Grid->materi_id->Disabled) ? " disabled" : "" ?> onclick="ew.modalLookupShow({lnk:this,el:'x<?= $Grid->RowIndex ?>_materi_id',m:0,n:10});"><i class="fas fa-search ew-icon"></i></button>
    </div>
</div>
<div class="invalid-feedback"><?= $Grid->materi_id->getErrorMessage() ?></div>
<?= $Grid->materi_id->Lookup->getParamTag($Grid, "p_x" . $Grid->RowIndex . "_materi_id") ?>
<input type="hidden" is="selection-list" data-table="tujuan_pembelajaran" data-field="x_materi_id" data-type="text" data-multiple="0" data-lookup="1" data-value-separator="<?= $Grid->materi_id->displayValueSeparatorAttribute() ?>" name="x<?= $Grid->RowIndex ?>_materi_id" id="x<?= $Grid->RowIndex ?>_materi_id" value="<?= $Grid->materi_id->CurrentValue ?>"<?= $Grid->materi_id->editAttributes() ?>>
</span>
<?php } ?>
<?php } else { ?>
<span id="el$rowindex$_tujuan_pembelajaran_materi_id" class="form-group tujuan_pembelajaran_materi_id">
<span<?= $Grid->materi_id->viewAttributes() ?>>
<input type="text" readonly class="form-control-plaintext" value="<?= HtmlEncode(RemoveHtml($Grid->materi_id->getDisplayValue($Grid->materi_id->ViewValue))) ?>"></span>
</span>
<input type="hidden" data-table="tujuan_pembelajaran" data-field="x_materi_id" data-hidden="1" name="x<?= $Grid->RowIndex ?>_materi_id" id="x<?= $Grid->RowIndex ?>_materi_id" value="<?= HtmlEncode($Grid->materi_id->FormValue) ?>">
<?php } ?>
<input type="hidden" data-table="tujuan_pembelajaran" data-field="x_materi_id" data-hidden="1" name="o<?= $Grid->RowIndex ?>_materi_id" id="o<?= $Grid->RowIndex ?>_materi_id" value="<?= HtmlEncode($Grid->materi_id->OldValue) ?>">
</td>
    <?php } ?>
    <?php if ($Grid->kode_mapel->Visible) { // kode_mapel ?>
        <td data-name="kode_mapel">
<?php if (!$Grid->isConfirm()) { ?>
<span id="el$rowindex$_tujuan_pembelajaran_kode_mapel" class="form-group tujuan_pembelajaran_kode_mapel">
<input type="<?= $Grid->kode_mapel->getInputTextType() ?>" data-table="tujuan_pembelajaran" data-field="x_kode_mapel" name="x<?= $Grid->RowIndex ?>_kode_mapel" id="x<?= $Grid->RowIndex ?>_kode_mapel" size="30" maxlength="255" value="<?= $Grid->kode_mapel->EditValue ?>"<?= $Grid->kode_mapel->editAttributes() ?>>
<div class="invalid-feedback"><?= $Grid->kode_mapel->getErrorMessage() ?></div>
</span>
<?php } else { ?>
<span id="el$rowindex$_tujuan_pembelajaran_kode_mapel" class="form-group tujuan_pembelajaran_kode_mapel">
<span<?= $Grid->kode_mapel->viewAttributes() ?>>
<input type="text" readonly class="form-control-plaintext" value="<?= HtmlEncode(RemoveHtml($Grid->kode_mapel->getDisplayValue($Grid->kode_mapel->ViewValue))) ?>"></span>
</span>
<input type="hidden" data-table="tujuan_pembelajaran" data-field="x_kode_mapel" data-hidden="1" name="x<?= $Grid->RowIndex ?>_kode_mapel" id="x<?= $Grid->RowIndex ?>_kode_mapel" value="<?= HtmlEncode($Grid->kode_mapel->FormValue) ?>">
<?php } ?>
<input type="hidden" data-table="tujuan_pembelajaran" data-field="x_kode_mapel" data-hidden="1" name="o<?= $Grid->RowIndex ?>_kode_mapel" id="o<?= $Grid->RowIndex ?>_kode_mapel" value="<?= HtmlEncode($Grid->kode_mapel->OldValue) ?>">
</td>
    <?php } ?>
    <?php if ($Grid->tujuan_pembelajaran->Visible) { // tujuan_pembelajaran ?>
        <td data-name="tujuan_pembelajaran">
<?php if (!$Grid->isConfirm()) { ?>
<span id="el$rowindex$_tujuan_pembelajaran_tujuan_pembelajaran" class="form-group tujuan_pembelajaran_tujuan_pembelajaran">
<input type="<?= $Grid->tujuan_pembelajaran->getInputTextType() ?>" data-table="tujuan_pembelajaran" data-field="x_tujuan_pembelajaran" name="x<?= $Grid->RowIndex ?>_tujuan_pembelajaran" id="x<?= $Grid->RowIndex ?>_tujuan_pembelajaran" size="30" maxlength="255" value="<?= $Grid->tujuan_pembelajaran->EditValue ?>"<?= $Grid->tujuan_pembelajaran->editAttributes() ?>>
<div class="invalid-feedback"><?= $Grid->tujuan_pembelajaran->getErrorMessage() ?></div>
</span>
<?php } else { ?>
<span id="el$rowindex$_tujuan_pembelajaran_tujuan_pembelajaran" class="form-group tujuan_pembelajaran_tujuan_pembelajaran">
<span<?= $Grid->tujuan_pembelajaran->viewAttributes() ?>>
<input type="text" readonly class="form-control-plaintext" value="<?= HtmlEncode(RemoveHtml($Grid->tujuan_pembelajaran->getDisplayValue($Grid->tujuan_pembelajaran->ViewValue))) ?>"></span>
</span>
<input type="hidden" data-table="tujuan_pembelajaran" data-field="x_tujuan_pembelajaran" data-hidden="1" name="x<?= $Grid->RowIndex ?>_tujuan_pembelajaran" id="x<?= $Grid->RowIndex ?>_tujuan_pembelajaran" value="<?= HtmlEncode($Grid->tujuan_pembelajaran->FormValue) ?>">
<?php } ?>
<input type="hidden" data-table="tujuan_pembelajaran" data-field="x_tujuan_pembelajaran" data-hidden="1" name="o<?= $Grid->RowIndex ?>_tujuan_pembelajaran" id="o<?= $Grid->RowIndex ?>_tujuan_pembelajaran" value="<?= HtmlEncode($Grid->tujuan_pembelajaran->OldValue) ?>">
</td>
    <?php } ?>
<?php
// Render list options (body, right)
$Grid->ListOptions->render("body", "right", $Grid->RowIndex);
?>
<script>
loadjs.ready(["ftujuan_pembelajarangrid","load"], function() {
    ftujuan_pembelajarangrid.updateLists(<?= $Grid->RowIndex ?>);
});
</script>
    </tr>
<?php
    }
?>
</tbody>
</table><!-- /.ew-table -->
</div><!-- /.ew-grid-middle-panel -->
<?php if ($Grid->CurrentMode == "add" || $Grid->CurrentMode == "copy") { ?>
<input type="hidden" name="<?= $Grid->FormKeyCountName ?>" id="<?= $Grid->FormKeyCountName ?>" value="<?= $Grid->KeyCount ?>">
<?= $Grid->MultiSelectKey ?>
<?php } ?>
<?php if ($Grid->CurrentMode == "edit") { ?>
<input type="hidden" name="<?= $Grid->FormKeyCountName ?>" id="<?= $Grid->FormKeyCountName ?>" value="<?= $Grid->KeyCount ?>">
<?= $Grid->MultiSelectKey ?>
<?php } ?>
<?php if ($Grid->CurrentMode == "") { ?>
<input type="hidden" name="action" id="action" value="">
<?php } ?>
<input type="hidden" name="detailpage" value="ftujuan_pembelajarangrid">
</div><!-- /.ew-list-form -->
<?php
// Close recordset
if ($Grid->Recordset) {
    $Grid->Recordset->close();
}
?>
<?php if ($Grid->ShowOtherOptions) { ?>
<div class="card-footer ew-grid-lower-panel">
<?php $Grid->OtherOptions->render("body", "bottom") ?>
</div>
<div class="clearfix"></div>
<?php } ?>
</div><!-- /.ew-grid -->
<?php } ?>
<?php if ($Grid->TotalRecords == 0 && !$Grid->CurrentAction) { // Show other options ?>
<div class="ew-list-other-options">
<?php $Grid->OtherOptions->render("body") ?>
</div>
<div class="clearfix"></div>
<?php } ?>
<?php if (!$Grid->isExport()) { ?>
<script>
// Field event handlers
loadjs.ready("head", function() {
    ew.addEventHandlers("tujuan_pembelajaran");
});
</script>
<script>
loadjs.ready("load", function () {
    // Write your table-specific startup script here, no need to add script tags.
});
</script>
<?php } ?>
