[ Mini Kiebo ]
Server: Windows NT AKFAR_SERVER 10.0 build 26200 (Windows 10) AMD64
Path:
D:
/
xampp
/
htdocs
/
simaku-aset
/
application
/
views
/
admin
/
pengadaan
/
[
Home
]
File: index_js.php
<div id="createWindow"> <form action="" id="createForm" method="POST"> <input type="hidden" id="isEdit" name="isEdit" value="0"> <input type="hidden" id="idUp" name="idUp" value=''> <div class="form-group row"> <label for="item_id" class="col-md-4 text-right">Pilih Nama Item:</label> <div class="col-md-5"> <input id="item_id" title="" class="k-textbox" style="width: 100%" /> <small> <a href="<?= base_url('master/items') ?>">Tambah Item</a></small> </div> </div> <div class="form-group row"> <label for="pengadaan_note" class="col-md-4 text-right">Keterangan:</label> <div class="col-md-5"> <input id="pengadaan_note" title="" class="k-textbox" style="width: 100%" /> </div> </div> <div class="form-group row pull-right"> <div class="col-md-6"> <button class="btn btn-primary" id='saveChanges' type="submit">Simpan</button> </div> </div> </form> </div> <script type="text/javascript"> $(document).ready(function() { $("#search").keyup(function() { var searchValue = $('#search').val(); $("#grid").data("kendoGrid").dataSource.filter({ field: "item_name", operator: "Contains", value: searchValue }); }); deleteDialogTemplateitem = kendo.template($("#deleteDialogTemplateitem").html()); $('#grid').kendoGrid({ dataSource: { transport: { read: function(options) { $.ajax({ dataType: 'json', url: '<?= base_url("Pengadaan/show") ?>', type: 'get', data: options.data, success: function(res) { options.success(res); }, error: function(xhr, ajaxOptions, thrownError) { console.log(ajaxOptions); } }) }, }, schema: { data: 'data', total: 'total', model: { id: "id", } }, pageSize: 20 }, editable: 'popup', // toolbar: [{ // template: kendo.template($("#tambahTemplate").html()), // }], edit: function(e) { e.container.parent().find('.k-window-title').text(e.model.isNew() ? "Tambah Data" : "Ubah Data"); }, sortable: true, pageable: { refresh: true, pageSizes: true, buttonCount: 5 }, columns: [{ field: "no_spmu", title: "No SPMU", width: 200 }, { field: "coa", title: "No Rekening", width: 100 }, { field: "nama_coa", title: "Nama Rekening", width: 100 }, { field: "uraian", title: "Uraian", width: 100 }, { field: "price", title: "Harga Satuan", width: 100 }, { field: "qty", title: "Kuantitas", width: 100 }, { field: "tgl_spmu", title: "Tanggal SPMU", width: 100 }, { headerTemplate: "<span class='k-icon k-i-gear'></span>", headerAttributes: { class: "table-header-cell", style: "text-align: center" }, attributes: { class: "table-cell", style: "text-align: center" }, command: [{ name: "update", iconClass: "k-icon k-i-checkmark", text: "Asetkan", click: update }], width: "150px" }] }); function update(e) { //satrt create pinjma var detailRow = e.detailRow; e.preventDefault(); createWindow.center().open(); var tr = $(e.target).closest("tr"), data = this.dataItem(tr); console.log(data); $("#item_id").data("kendoDropDownList").value(0); // $('#pengadaan_note').val(data.item_name); $('#isEdit').val("1"); $('#idUp').val(data.id); $('#saveChanges').text('Simpan'); // console.log(data.Entry_Period_Type_Id ,data.Register_Status_Id) } // Dropdown var item_id = $("#item_id").kendoDropDownList({ //start periode filter: "startswith", dataTextField: "item_name", dataValueField: "id", dataSource: { transport: { read: function(options) { $.ajax({ dataType: "json", url: '<?= base_url("master/items/drowdownItems") ?>', type: "GET", data: options.data, success: function(res) { options.success(res); }, error: function(xhr, ajaxOptions, thrownError) {} }); } } }, }); //periode }) function create_click() { //satrt create pinjma $('#isEdit').val('0'); $("#createForm")[0].reset(); createWindow.center().open(); } var createWindow = $("#createWindow").kendoWindow({ // jendela open function width: "600px", title: "Form Data", visible: false, actions: [ "Minimize", "Maximize", "Close" ] }).data("kendoWindow"); $("#createForm").submit(function(event) { alert("Anda Yakin?"); event.preventDefault(); var item_id = $("#item_id").val(); var pengadaan_note = $('#pengadaan_note').val(); if (item_id == "") { console.log('validasi error' + item_id + 'pengadaan_note' + pengadaan_note); } else { $.ajax({ headers: { "X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content") }, url: '<?= base_url("Pengadaan/update") ?>', type: "post", data: { id: $('#idUp').val(), item_id: item_id, pengadaan_note: pengadaan_note, }, dataType: "json", complete: function(e) { $('#grid').data("kendoGrid").dataSource.read(); $('#isEdit').val('0'); $('#saveChanges').text('Tambahkan'); createWindow.close(); }, error: function(xhr, ajaxOptions, thrownError) { } }); } }); </script>