<div class="modal-header">
    <h4 class="modal-title">Edit Revisi Permintaan</h4>
    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
        <span aria-hidden="true">×</span>
    </button>
</div>
<div class="modal-body">
    <form method="POST" action="<?= base_url('permintaan_perubahan/edit/' . $data->id_perubahan) ?>" enctype="multipart/form-data">
        <?= csrf_field() ?>
        <div class="form-group">
            <label class="form-label" for="id_permintaan">Permintaan Perubahan</label>
            <select class="custom-select rounded-0" id="id_permintaan" name="id_permintaan" required>
                <option value="">--- Pilih Permintaan ---</option>
                <?php foreach ($permintaan as $pmt): ?>
                    <option value="<?= $pmt->id_permintaan ?>" <?= $pmt->id_permintaan == $data->id_permintaan ? 'selected' : '' ?>><?= $pmt->id_permintaan ?> - <?= $pmt->nama_model ?></option>
                <?php endforeach; ?>
            </select>
        </div>
        <div class="form-group">
            <label class="form-label" for="exampleInputTanggalPerubahan">Tanggal Perubahan</label>
            <input type="datetime-local" class="form-control" id="exampleInputTanggalPerubahan" name="tanggal_perubahan" placeholder="Input Tanggal Perubahan" value="<?= $data->tanggal_perubahan ? date('Y-m-d\TH:i', strtotime($data->tanggal_perubahan)) : '' ?>" required>
        </div>
        <div class="form-group">
            <label class="form-label" for="exampleInputDetailPerubahan">Detail Perubahan</label>
            <textarea class="form-control" id="summernote" name="detail_perubahan" placeholder="Input Detail Perubahan" required><?= $data->detail_perubahan ?></textarea>
        </div>

        <div class="modal-footer">
            <button type="submit" class="btn btn-primary">Simpan</button>
            <button type="button" class="btn btn-secondary" data-dismiss="modal">Batal</button>
        </div>
    </form>
</div>
<script>
    $(function() {
        // Summernote
        $('#summernote').summernote()

        // CodeMirror
        CodeMirror.fromTextArea(document.getElementById("codeMirrorDemo"), {
            mode: "htmlmixed",
            theme: "monokai"
        });
    })
</script>