Skip to content

Commit

Permalink
Merge pull request #264 from basoro/mlite
Browse files Browse the repository at this point in the history
Remove add, edit, del button
  • Loading branch information
basoro authored Oct 25, 2024
2 parents d7e3495 + 49602aa commit 9101103
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 788 deletions.
66 changes: 0 additions & 66 deletions plugins/detail_pemberian_obat/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,72 +97,6 @@ public function postAksi()
$act = '';
}

if ($act=='add') {

$tgl_perawatan = $_POST['tgl_perawatan'];
$jam = $_POST['jam'];
$no_rawat = $_POST['no_rawat'];
$kode_brng = $_POST['kode_brng'];
$h_beli = $_POST['h_beli'];
$biaya_obat = $_POST['biaya_obat'];
$jml = $_POST['jml'];
$embalase = $_POST['embalase'];
$tuslah = $_POST['tuslah'];
$total = $_POST['total'];
$status = $_POST['status'];
$kd_bangsal = $_POST['kd_bangsal'];
$no_batch = $_POST['no_batch'];
$no_faktur = $_POST['no_faktur'];


$detail_pemberian_obat_add = $this->db()->pdo()->prepare('INSERT INTO detail_pemberian_obat VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)');
$detail_pemberian_obat_add->execute([$tgl_perawatan, $jam, $no_rawat, $kode_brng, $h_beli, $biaya_obat, $jml, $embalase, $tuslah, $total, $status, $kd_bangsal, $no_batch, $no_faktur]);

}
if ($act=="edit") {

$tgl_perawatan = $_POST['tgl_perawatan'];
$jam = $_POST['jam'];
$no_rawat = $_POST['no_rawat'];
$kode_brng = $_POST['kode_brng'];
$h_beli = $_POST['h_beli'];
$biaya_obat = $_POST['biaya_obat'];
$jml = $_POST['jml'];
$embalase = $_POST['embalase'];
$tuslah = $_POST['tuslah'];
$total = $_POST['total'];
$status = $_POST['status'];
$kd_bangsal = $_POST['kd_bangsal'];
$no_batch = $_POST['no_batch'];
$no_faktur = $_POST['no_faktur'];


// BUANG FIELD PERTAMA

$detail_pemberian_obat_edit = $this->db()->pdo()->prepare("UPDATE detail_pemberian_obat SET tgl_perawatan=?, jam=?, no_rawat=?, kode_brng=?, h_beli=?, biaya_obat=?, jml=?, embalase=?, tuslah=?, total=?, status=?, kd_bangsal=?, no_batch=?, no_faktur=? WHERE tgl_perawatan=?");
$detail_pemberian_obat_edit->execute([$tgl_perawatan, $jam, $no_rawat, $kode_brng, $h_beli, $biaya_obat, $jml, $embalase, $tuslah, $total, $status, $kd_bangsal, $no_batch, $no_faktur,$tgl_perawatan]);

}

if ($act=="del") {
$tgl_perawatan= $_POST['tgl_perawatan'];
$check_db = $this->db()->pdo()->prepare("DELETE FROM detail_pemberian_obat WHERE tgl_perawatan='$tgl_perawatan'");
$result = $check_db->execute();
$error = $check_db->errorInfo();
if (!empty($result)){
$data = array(
'status' => 'success',
'msg' => $no_rkm_medis
);
} else {
$data = array(
'status' => 'error',
'msg' => $error['2']
);
}
echo json_encode($data);
}

if ($act=="lihat") {

$search_field_detail_pemberian_obat= $_POST['search_field_detail_pemberian_obat'];
Expand Down
195 changes: 0 additions & 195 deletions plugins/detail_pemberian_obat/js/admin/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,86 +70,6 @@ jQuery().ready(function () {
dom: "<'row'<'col-sm-12'tr>><<'pmd-datatable-pagination' l i p>>"
});

// ==============================================================
// FORM VALIDASI
// ==============================================================

$("form[name='form_detail_pemberian_obat']").validate({
rules: {
tgl_perawatan: 'required',
jam: 'required',
no_rawat: 'required',
kode_brng: 'required',
h_beli: 'required',
biaya_obat: 'required',
jml: 'required',
embalase: 'required',
tuslah: 'required',
total: 'required',
status: 'required',
kd_bangsal: 'required',
no_batch: 'required',
no_faktur: 'required'

},
messages: {
tgl_perawatan:'tgl_perawatan tidak boleh kosong!',
jam:'jam tidak boleh kosong!',
no_rawat:'no_rawat tidak boleh kosong!',
kode_brng:'kode_brng tidak boleh kosong!',
h_beli:'h_beli tidak boleh kosong!',
biaya_obat:'biaya_obat tidak boleh kosong!',
jml:'jml tidak boleh kosong!',
embalase:'embalase tidak boleh kosong!',
tuslah:'tuslah tidak boleh kosong!',
total:'total tidak boleh kosong!',
status:'status tidak boleh kosong!',
kd_bangsal:'kd_bangsal tidak boleh kosong!',
no_batch:'no_batch tidak boleh kosong!',
no_faktur:'no_faktur tidak boleh kosong!'

},
submitHandler: function (form) {
var tgl_perawatan= $('#tgl_perawatan').val();
var jam= $('#jam').val();
var no_rawat= $('#no_rawat').val();
var kode_brng= $('#kode_brng').val();
var h_beli= $('#h_beli').val();
var biaya_obat= $('#biaya_obat').val();
var jml= $('#jml').val();
var embalase= $('#embalase').val();
var tuslah= $('#tuslah').val();
var total= $('#total').val();
var status= $('#status').val();
var kd_bangsal= $('#kd_bangsal').val();
var no_batch= $('#no_batch').val();
var no_faktur= $('#no_faktur').val();

var typeact = $('#typeact').val();

var formData = new FormData(form); // tambahan
formData.append('typeact', typeact); // tambahan

$.ajax({
url: "{?=url([ADMIN,'detail_pemberian_obat','aksi'])?}",
method: "POST",
contentType: false, // tambahan
processData: false, // tambahan
data: formData,
success: function (data) {
if (typeact == "add") {
alert("Data Berhasil Ditambah");
}
else if (typeact == "edit") {
alert("Data Berhasil Diubah");
}
$("#modal_cs").hide();
location.reload(true);
}
})
}
});

// ==============================================================
// KETIKA MENGETIK DI INPUT SEARCH
// ==============================================================
Expand All @@ -164,121 +84,6 @@ var no_faktur= $('#no_faktur').val();
var_tbl_detail_pemberian_obat.draw();
});

// ===========================================
// Ketika tombol Edit di tekan
// ===========================================

$("#edit_data_detail_pemberian_obat").click(function () {
var rowData = var_tbl_detail_pemberian_obat.rows({ selected: true }).data()[0];
if (rowData != null) {

var tgl_perawatan = rowData['tgl_perawatan'];
var jam = rowData['jam'];
var no_rawat = rowData['no_rawat'];
var kode_brng = rowData['kode_brng'];
var h_beli = rowData['h_beli'];
var biaya_obat = rowData['biaya_obat'];
var jml = rowData['jml'];
var embalase = rowData['embalase'];
var tuslah = rowData['tuslah'];
var total = rowData['total'];
var status = rowData['status'];
var kd_bangsal = rowData['kd_bangsal'];
var no_batch = rowData['no_batch'];
var no_faktur = rowData['no_faktur'];



$("#typeact").val("edit");

$('#tgl_perawatan').val(tgl_perawatan);
$('#jam').val(jam);
$('#no_rawat').val(no_rawat);
$('#kode_brng').val(kode_brng);
$('#h_beli').val(h_beli);
$('#biaya_obat').val(biaya_obat);
$('#jml').val(jml);
$('#embalase').val(embalase);
$('#tuslah').val(tuslah);
$('#total').val(total);
$('#status').val(status);
$('#kd_bangsal').val(kd_bangsal);
$('#no_batch').val(no_batch);
$('#no_faktur').val(no_faktur);

//$("#tgl_perawatan").prop('disabled', true); // GA BISA DIEDIT KALI DISABLE
$('#modal-title').text("Edit Data Detail Pemberian Obat");
$("#modal_detail_pemberian_obat").modal();
}
else {
alert("Silakan pilih data yang akan di edit.");
}

});

// ==============================================================
// TOMBOL DELETE DI CLICK
// ==============================================================
jQuery("#hapus_data_detail_pemberian_obat").click(function () {
var rowData = var_tbl_detail_pemberian_obat.rows({ selected: true }).data()[0];


if (rowData) {
var tgl_perawatan = rowData['tgl_perawatan'];
var a = confirm("Anda yakin akan menghapus data dengan tgl_perawatan=" + tgl_perawatan);
if (a) {

$.ajax({
url: "{?=url([ADMIN,'detail_pemberian_obat','aksi'])?}",
method: "POST",
data: {
tgl_perawatan: tgl_perawatan,
typeact: 'del'
},
success: function (data) {
data = JSON.parse(data);
if(data.status === 'success') {
alert(data.msg);
} else {
alert(data.msg);
}
location.reload(true);
}
})
}
}
else {
alert("Pilih satu baris untuk dihapus");
}
});

// ==============================================================
// TOMBOL TAMBAH DATA DI CLICK
// ==============================================================
jQuery("#tambah_data_detail_pemberian_obat").click(function () {

$('#tgl_perawatan').val('');
$('#jam').val('');
$('#no_rawat').val('');
$('#kode_brng').val('');
$('#h_beli').val('');
$('#biaya_obat').val('');
$('#jml').val('');
$('#embalase').val('');
$('#tuslah').val('');
$('#total').val('');
$('#status').val('');
$('#kd_bangsal').val('');
$('#no_batch').val('');
$('#no_faktur').val('');


$("#typeact").val("add");
$("#tgl_perawatan").prop('disabled', false);

$('#modal-title').text("Tambah Data Detail Pemberian Obat");
$("#modal_detail_pemberian_obat").modal();
});

// ===========================================
// Ketika tombol lihat data di tekan
Expand Down
Loading

0 comments on commit 9101103

Please sign in to comment.