607 lines
23 KiB
PHP
607 lines
23 KiB
PHP
<!doctype html>
|
|
<html class="fixed sidebar-left-collapsed">
|
|
|
|
<head>
|
|
|
|
<!-- Basic -->
|
|
<meta charset="UTF-8">
|
|
|
|
<title>MASTER DATA</title>
|
|
<meta name="keywords" content="HTML5 Admin Template" />
|
|
<meta name="description" content="Porto Admin - Responsive HTML5 Template">
|
|
<meta name="author" content="okler.net">
|
|
|
|
<!-- Mobile Metas -->
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
|
|
|
<!-- Vendor CSS -->
|
|
<link rel="stylesheet" href="<?php echo base_url('') ?>assets/vendor/bootstrap/css/bootstrap.css" />
|
|
<link rel="stylesheet" href="<?php echo base_url('') ?>assets/vendor/font-awesome/css/font-awesome.css" />
|
|
<link rel="stylesheet" href="<?php echo base_url('') ?>assets/vendor/magnific-popup/magnific-popup.css" />
|
|
<link rel="stylesheet" href="<?php echo base_url('') ?>assets/vendor/bootstrap-datepicker/css/datepicker3.css" />
|
|
|
|
<!-- Specific Page Vendor CSS -->
|
|
<link rel="stylesheet" href="<?php echo base_url('') ?>assets/vendor/select2/select2.css" />
|
|
<link rel="stylesheet" href="<?php echo base_url('') ?>assets/vendor/jquery-datatables-bs3/assets/css/datatables.css" />
|
|
<link rel="stylesheet" href="<?php echo base_url('') ?>assets/vendor/pnotify/pnotify.custom.css" />
|
|
<link rel="stylesheet" href="<?php echo base_url('') ?>assets/vendor/bootstrap-multiselect/bootstrap-multiselect.css" />
|
|
<link rel="stylesheet" href="<?php echo base_url('') ?>assets/vendor/base/jquery-ui.css" />
|
|
|
|
<!-- Theme CSS -->
|
|
<link rel="stylesheet" href="<?php echo base_url('') ?>assets/stylesheets/theme.css" />
|
|
|
|
<!-- Skin CSS -->
|
|
<link rel="stylesheet" href="<?php echo base_url('') ?>assets/stylesheets/skins/default.css" />
|
|
|
|
<!-- Theme Custom CSS -->
|
|
<link rel="stylesheet" href="<?php echo base_url('') ?>assets/stylesheets/theme-custom.css">
|
|
|
|
<!-- Head Libs -->
|
|
<script src="<?php echo base_url('') ?>assets/vendor/modernizr/modernizr.js"></script>
|
|
|
|
</head>
|
|
<script src="<?= base_url() ?>assets/bower_components/jquery/jquery-3.3.1.min.js"></script>
|
|
<script src="<?= base_url() ?>assets/bower_components/sweetalert2/sweetalert2.all.min.js"></script>
|
|
|
|
<style>
|
|
.ui-front {
|
|
z-index: 9999;
|
|
}
|
|
|
|
.bordergoldall {
|
|
border-left-style: solid;
|
|
border-right-style: solid;
|
|
border-top-style: solid;
|
|
border-bottom-style: solid;
|
|
border-width: 5px;
|
|
border-color: gold;
|
|
}
|
|
|
|
.borderorangeall {
|
|
border-left-style: solid;
|
|
border-right-style: solid;
|
|
border-top-style: solid;
|
|
border-bottom-style: solid;
|
|
border-width: 5px;
|
|
border-color: orange;
|
|
}
|
|
|
|
.f18 {
|
|
font-size: 18px;
|
|
}
|
|
|
|
</style>
|
|
|
|
<script type="text/javascript">
|
|
let base_url = '<?= base_url() ?>';
|
|
</script>
|
|
|
|
<body>
|
|
<section class="body">
|
|
|
|
<!-- start: header -->
|
|
<?php $this->load->view('template/header'); ?>
|
|
<!-- end: header -->
|
|
|
|
<div class="inner-wrapper">
|
|
<!-- start: sidebar -->
|
|
<?php $this->load->view('template/sidebar'); ?>
|
|
<!-- end: sidebar -->
|
|
|
|
<section role="main" class="content-body">
|
|
|
|
<?php
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$nama_panggilan = $this->session->userdata('nama_panggilan');
|
|
$username = $this->session->userdata('username');
|
|
$tgl_now = date('d/m/Y');
|
|
?>
|
|
|
|
<header class="page-header">
|
|
<h2><b>Data Master UnitService | </b><b style="color:LightGreen">[<?=$tampil?>]</b></h2>
|
|
</header>
|
|
|
|
<!-- start: page -->
|
|
<section class="panel panel-featured panel-featured-dark">
|
|
<header class="panel-heading">
|
|
<div class="panel-actions">
|
|
<a data-toggle="modal" data-target="#modalFitur" style="color:Coral"><b>Fitur </b><i class="fa fa-question-circle"></i></a>  
|
|
<a onclick="tutupTab()"><b style="color:Black">Tutup <i class="fa fa-times"></i></b></a>
|
|
</div>
|
|
<h2 class="panel-title"><b style="color:Olive">DATA UNITSERVICE</b></h2>
|
|
</header>
|
|
<div class="panel-body">
|
|
<div class="panel-group" id="accordion">
|
|
<div class="panel panel-accordion">
|
|
<header class="panel-heading">
|
|
<h2 class="panel-title">
|
|
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion" <?php if ($hak>=2) { ?>href="#collapseOne" onclick="setBersih()"<?php } ?>>
|
|
<b class="f18" style="color:DarkGreen"><b style="color:Black">[1]</b> DATA BARU <?php if ($hak<=1) { ?><i class="fa fa-ban text-danger"></i><?php } ?></b>
|
|
</a>
|
|
</h2>
|
|
</header>
|
|
<div id="collapseOne" class="accordion-body collapse">
|
|
<div class="panel-body">
|
|
<div class="form-group bordergoldall">
|
|
<h4><div class="col-md-12">
|
|
<b style="color:DarkCyan"><i>Note : [Warna Merah harus diisi.]</i></b>
|
|
</div></h4>
|
|
<br><br>
|
|
<h4><div class="col-md-2"><b style="color:Red">Nama UnitService</b></div></h4>
|
|
<div class="col-md-4">
|
|
<textarea type="text" id="nama_unitservicenew" rows="3" cols="3" class="form-control" autocomplete="off" style="text-transform:uppercase" data-plugin-maxlength maxlength="64" placeholder="Nama UnitService"></textarea>
|
|
<small class="help-block"></small>
|
|
</div>
|
|
<h4><div class="col-md-2"><b style="color:Red">Jenis</b></div></h4>
|
|
<input type="hidden" id="id_jenisnew" class="form-control">
|
|
<div class="col-md-4">
|
|
<div class="input-group">
|
|
<input autocomplete="off" style="background:lightgrey;" type="text" id="nama_jenisnew" class="form-control" placeholder="Klik pada Icon" required>
|
|
<span class="input-group-addon" data-toggle="modal" data-target="#modalAmbilJenis" onclick="isiMasterJenis(1)"><i class="fa fa-cube text-danger"></i></span>
|
|
</div>
|
|
<small class="help-block"></small>
|
|
</div>
|
|
<div class="col-md-12 text-right">
|
|
<button type="button" class="btn btn-success" onclick="tambahData()"><b>Tambah Data</b> <i class="fa fa-plus"></i></button>
|
|
<small class="help-block"></small>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="panel panel-accordion">
|
|
<header class="panel-heading">
|
|
<h2 class="panel-title">
|
|
<a class="accordion-toggle" data-toggle="collapse" onclick="setBersih()" data-parent="#accordion" <?php if ($hak>0) { ?>href="#collapseTwo" onclick="setBersih()"<?php } ?>>
|
|
<b class="f18" style="color:DarkGreen"><b style="color:Black">[2]</b> CARI DATA <i style="color:Brown">(Ubah/Hapus)</i> <?php if ($hak==0) { ?><i class="fa fa-ban text-danger"></i><?php } ?></b>
|
|
</a>
|
|
</h2>
|
|
</header>
|
|
<div id="collapseTwo" class="accordion-body collapse">
|
|
<div class="panel-body">
|
|
<div class="form-group">
|
|
<h4><div class="col-md-2"><b style="color:SlateBlue">Pilih Data</b></div></h4>
|
|
<div class="col-md-10">
|
|
<select data-plugin-selectTwo name="id_unitserviceLihat" id="id_unitserviceLihat" onchange="lihatData(value);" class="form-control populate">
|
|
<option value="" selected>Pilih UnitService/Reset</option>
|
|
<?php if (is_array($unitservice) || is_object($unitservice)) {
|
|
foreach ($unitservice as $key) { ?>
|
|
<option value="<?= $key['ID_UNITSERVICE'] ?>"><?= $key['NAMA_UNITSERVICE'] ?> [<?= $key['NAMA_JENIS'] ?>]</option>
|
|
<?php }
|
|
} ?>
|
|
</select>
|
|
<small class="help-block"></small>
|
|
</div>
|
|
</div>
|
|
<div class="form-group borderorangeall" id="detailData" hidden="hidden">
|
|
<h4><div class="col-md-12">
|
|
<b style="color:DarkOrchid"><i>Note : [Semua Perubahan akan Otomatis tersimpan.]</i></b><br>
|
|
<b style="color:DarkCyan"><i>Note : [Warna Merah harus diisi.]</i></b>
|
|
</div></h4>
|
|
<br><br>
|
|
<input type="hidden" id="nama_unitserviceTemp" class="form-control">
|
|
<h4><div class="col-md-2"><b style="color:Red">Nama UnitService</b></div></h4>
|
|
<div class="col-md-4">
|
|
<textarea type="text" id="nama_unitserviceed" rows="3" cols="3" <?php if ($hak>=1) { ?>onchange="ubahData(1)"<?php } ?> class="form-control" autocomplete="off" style="text-transform:uppercase" data-plugin-maxlength maxlength="64" placeholder="Nama UnitService" required></textarea>
|
|
<small class="help-block"></small>
|
|
</div>
|
|
<h4><div class="col-md-2"><b style="color:Red">Jenis</b></div></h4>
|
|
<input type="hidden" id="id_jenised" class="form-control">
|
|
<div class="col-md-4">
|
|
<div class="input-group">
|
|
<input autocomplete="off" style="background:lightgrey;" type="text" id="nama_jenised" class="form-control" placeholder="Klik pada Icon" required>
|
|
<span class="input-group-addon" data-toggle="modal" data-target="#modalAmbilJenis" onclick="isiMasterJenis(2)"><i class="fa fa-cube text-danger"></i></span>
|
|
</div>
|
|
<small class="help-block"></small>
|
|
</div>
|
|
<div class="col-md-12 text-right" id="buttonDelete" hidden="hidden">
|
|
<button type="button" class="btn btn-danger" data-toggle="modal" data-target="#modalHapus" onclick="hapusData()"><b>Hapus Data</b> <i class="fa fa-minus"></i></button>
|
|
<small class="help-block"></small>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="panel panel-accordion">
|
|
<header class="panel-heading">
|
|
<h2 class="panel-title">
|
|
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion" <?php if ($hak>0) { ?>href="#collapseThree" onclick="setBersih()"<?php } ?>>
|
|
<b class="f18" style="color:DarkGreen"><b style="color:Black">[3]</b> CETAK DATA <?php if ($hak==0) { ?><i class="fa fa-ban text-danger"></i><?php } ?></b>
|
|
</a>
|
|
</h2>
|
|
</header>
|
|
<div id="collapseThree" class="accordion-body collapse">
|
|
<div class="panel-body">
|
|
<div class="form-group">
|
|
<h4><div class="col-md-2"><b style="color:Red">Jenis</b></div></h4>
|
|
<input type="hidden" id="id_jenislap" class="form-control">
|
|
<div class="col-md-4">
|
|
<div class="input-group">
|
|
<input autocomplete="off" style="background:lightgrey;" type="text" id="nama_jenislap" class="form-control" placeholder="Klik pada Icon" required>
|
|
<span class="input-group-addon" data-toggle="modal" data-target="#modalAmbilJenis" onclick="isiMasterJenis(3)"><i class="fa fa-cube text-danger"></i></span>
|
|
</div>
|
|
<small class="help-block"></small>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<?= form_open('Menu/MD_Excel_DataUnitService', array('id' => 'formmaster'), array('method' => 'MD_Excel_DataUnitService')); ?>
|
|
<h4><div class="col-md-2"><b style="color:SlateBlue">Menu</b></div></h4>
|
|
<div class="col-md-10 btn-group">
|
|
<input type="hidden" id="id_jenisfill" name="id_jenisfill" class="form-control">
|
|
<button type="submit" class="btn btn-default" onclick="isiData()" target="_blank"><b style="color:DarkGreen">Excel <i class="fa fa-file-excel-o"></i></b></button>
|
|
</div>
|
|
<?= form_close(); ?>
|
|
</div>
|
|
<br>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
</section>
|
|
</div>
|
|
</section>
|
|
|
|
<div id="modalFitur" class="modal fade" tabindex="-1" role="dialog">
|
|
<div class="modal-dialog modal-lg" style="width:50%">
|
|
<div class="modal-content">
|
|
<header class="panel-heading">
|
|
<h4 class="panel-title"><b>Fitur Teknis</b></h4>
|
|
</header>
|
|
<div class="panel-body">
|
|
<div class="modal-wrapper">
|
|
<div class="modal-text">
|
|
<div class="form-group">
|
|
<h5>
|
|
<b style="color:DarkRed">Berikut ini adalah Daftar Menu yang dapat diakses sesuai dengan Hak Akses Anda.</b><br>
|
|
<br><b style="color:DarkGreen">AKSES PENUH/OPERATOR</b><br><b> Semua Fungsi (Tambah, Ubah, Hapus)</b><br>
|
|
<br><b style="color:DarkGreen">TERBATAS</b><br><b>Hanya dapat Membaca Data</b><br>
|
|
</h5>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<footer class="panel-footer">
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<button type="button" class="btn btn-default pull-right" data-dismiss="modal">Close</button>
|
|
</div>
|
|
</div>
|
|
</footer>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="modalAmbilJenis" class="modal fade ui-front" tabindex="-1" role="dialog" data-keyboard="false">
|
|
<div class="modal-dialog modal-lg" style="width:60%">
|
|
<header class="panel-heading">
|
|
<h2 class="panel-title"><b>Isi Data | <b style="color:Red">[Jenis]</b></b></h2>
|
|
<div class="panel-actions">
|
|
<a class="text-dark" data-dismiss="modal"><b>Tutup </b><i class="fa fa-times"></i></a>
|
|
</div>
|
|
</header>
|
|
<div class="panel-body">
|
|
<div class="modal-wrapper">
|
|
<div class="modal-text">
|
|
<div class="row form-bordered">
|
|
<div class="form-group">
|
|
<div class="form-group">
|
|
<div class="col-md-6"></div>
|
|
<div class="col-md-6">
|
|
<input type="hidden" id="jenisVerse">
|
|
<input autocomplete="off" type="text" id="jenisSearch" oninput="cariDataJenis()" class="form-control populate" placeholder="Cari Jenis..."></input>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-12">
|
|
<table class="table table-bordered table-striped mb-none">
|
|
<thead>
|
|
<?php if ($hak>1) { ?>
|
|
<th class="center default">Pilih</th>
|
|
<?php } ?>
|
|
<th class="default">Tipe</th>
|
|
<th class="default">Nama</th>
|
|
</thead>
|
|
<tbody id="isiTabelJenis"></tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="modalHapus" class="modal fade" tabindex="-1" role="dialog">
|
|
<div class="modal-dialog">
|
|
<?= form_open('Menu/MD_Hapus_DataUnitService', array('id' => 'formmaster'), array('method' => 'MD_Hapus_DataUnitService')); ?>
|
|
<div class="modal-content">
|
|
<header class="panel-heading">
|
|
<h2 class="panel-title"><b>Hapus Data</b></h2>
|
|
</header>
|
|
<div class="panel-body">
|
|
<div class="modal-wrapper">
|
|
<div class="modal-text">
|
|
<input type="hidden" name="id_unitservicedel" id="id_unitservicedel" class="form-control">
|
|
<h4>Apakah ingin menghapus Data?</h4>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<footer class="panel-footer">
|
|
<div class="row">
|
|
<div class="col-md-12 text-right">
|
|
<button type="button" class="btn btn-default pull-left" data-dismiss="modal">Close</button>
|
|
<button type="submit" name="SubmitButton" id="SubmitButton" class="btn btn-danger"><b>Hapus</b> <i class="fa fa-minus"></i></button>
|
|
</div>
|
|
</div>
|
|
</footer>
|
|
</div>
|
|
<?= form_close(); ?>
|
|
</div>
|
|
</div>
|
|
|
|
<?php
|
|
$this->load->view('template/sidebar_right');
|
|
$this->load->view('template/script_vendor');
|
|
$this->load->view('template/script_flashdata');
|
|
$this->load->view('template/notification');
|
|
?>
|
|
|
|
<script>
|
|
function tutupTab() {
|
|
window.close();
|
|
}
|
|
|
|
function isiMasterJenis(verse) {
|
|
PNotify.removeAll();
|
|
document.getElementById("jenisVerse").value = verse;
|
|
document.getElementById("jenisSearch").value = null;
|
|
document.getElementById("jenisSearch").innerHTML = "";
|
|
tampilkanDataMasterJenis(verse, null);
|
|
}
|
|
|
|
function cariDataJenis() {
|
|
var verse = document.getElementById("jenisVerse").value;
|
|
var search = document.getElementById("jenisSearch").value;
|
|
tampilkanDataMasterJenis(verse, search);
|
|
}
|
|
|
|
function tampilkanDataMasterJenis(verse, textSearch) {
|
|
var hak = <?=$hak?>;
|
|
|
|
$.ajax({
|
|
type: 'POST',
|
|
data: {
|
|
search : textSearch,
|
|
mode : 1
|
|
},
|
|
url: '<?= base_url('') ?>index.php/Menu/GE_AmbilData_MasterJenis',
|
|
dataType: 'json',
|
|
success: function(response) {
|
|
JUMLAH = response.data.length;
|
|
var baris = '';
|
|
|
|
for (var i = 1; i <= JUMLAH; i++) {
|
|
var id = response.data[i - 1]['ID_JENIS'];
|
|
var nama = response.data[i - 1]['NAMA_JENIS'];
|
|
var tipe = response.data[i - 1]['TYPE_JENIS'];
|
|
|
|
if (tipe==0) {
|
|
mode = "NON-SN";
|
|
} else if (tipe==1) {
|
|
mode = "SN";
|
|
} else if (tipe==2) {
|
|
mode = "NON-QTY";
|
|
}
|
|
|
|
baris += '<tr>';
|
|
if (hak>1) {
|
|
baris += '<td class="center" style="vertical-align: middle;" ><button onclick="pilihJenis(' + id + ',' + verse + ')"><i class="fa fa-circle text-primary"></i></button></td>';
|
|
}
|
|
baris += '<td class="text-left" style="vertical-align: middle;"><b style="color:Black">' + nama + '</b></td>';
|
|
baris += '<td class="text-left" style="vertical-align: middle;"><b style="color:DarkGreen">' + mode + '</b></td>';
|
|
baris += '</tr>';
|
|
}
|
|
$('#isiTabelJenis').html(baris);
|
|
}
|
|
});
|
|
}
|
|
|
|
function pilihJenis(id, verse) {
|
|
PNotify.removeAll();
|
|
if (verse==1) {
|
|
document.getElementById("id_jenisnew").value = id;
|
|
} else if (verse==2) {
|
|
document.getElementById("id_jenised").value = id;
|
|
} else if (verse==3) {
|
|
document.getElementById("id_jenislap").value = id;
|
|
}
|
|
$('#modalAmbilJenis').modal('hide');
|
|
$.ajax({
|
|
url: "<?= base_url() ?>index.php/Menu/GE_AmbilData_PilihJenis",
|
|
type: "POST",
|
|
dataType: "json",
|
|
data: {
|
|
id_jenis : id
|
|
},
|
|
success: function(response) {
|
|
if (verse==1) {
|
|
document.getElementById("nama_jenisnew").value = response.nama_jenis;
|
|
} else if (verse==2) {
|
|
document.getElementById("nama_jenised").value = response.nama_jenis;
|
|
ubahData(2);
|
|
} else if (verse==3) {
|
|
document.getElementById("nama_jenislap").value = response.nama_jenis;
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
function setBersih() {
|
|
document.getElementById('detailData').style.display = 'none';
|
|
document.getElementById("id_jenisnew").value = null;
|
|
document.getElementById("id_jenised").value = null;
|
|
document.getElementById("id_jenislap").value = null;
|
|
document.getElementById("nama_jenisnew").value = null;
|
|
document.getElementById("nama_jenised").value = null;
|
|
document.getElementById("nama_jenislap").value = null;
|
|
document.getElementById("nama_unitservicenew").value = null;
|
|
document.getElementById("nama_unitserviceed").value = null;
|
|
document.getElementById("id_unitserviceLihat").value = null;
|
|
$('#id_unitserviceLihat').select2().select2('val', null);
|
|
}
|
|
|
|
function lihatData(id) {
|
|
document.getElementById('detailData').style.display = 'block';
|
|
var hak = <?=$hak?>;
|
|
|
|
if (id!="" && hak>0) {
|
|
$.ajax({
|
|
url: "<?= base_url() ?>index.php/Menu/MD_Ambil_DataUnitService",
|
|
type: "POST",
|
|
dataType: "json",
|
|
data: {
|
|
id_unitservice : id,
|
|
},
|
|
success: function(response) {
|
|
document.getElementById("id_jenised").value = response.id_jenis;
|
|
document.getElementById("nama_jenised").value = response.nama_jenis;
|
|
document.getElementById("nama_unitserviceed").value = response.nama_unitservice;
|
|
document.getElementById("nama_unitserviceTemp").value = response.nama_unitservice;
|
|
if (hak==1) {
|
|
document.getElementById("nama_unitserviceed").disabled = true;
|
|
document.getElementById("id_jenised").disabled = true;
|
|
} else {
|
|
document.getElementById('buttonDelete').style.display = 'block';
|
|
}
|
|
}
|
|
});
|
|
} else {
|
|
document.getElementById('detailData').style.display = 'none';
|
|
document.getElementById('buttonDelete').style.display = 'none';
|
|
}
|
|
}
|
|
|
|
function tambahData() {
|
|
var status = 0;
|
|
var nama_unitservice = document.getElementById("nama_unitservicenew").value;
|
|
var id_jenis = document.getElementById("id_jenisnew").value;
|
|
|
|
PNotify.removeAll();
|
|
|
|
if (nama_unitservice=="") {
|
|
notify("nama_null");
|
|
status++;
|
|
}
|
|
|
|
if (id_jenis=="") {
|
|
notify("jenisid_null");
|
|
status++;
|
|
}
|
|
|
|
if (status==0) {
|
|
$.ajax({
|
|
url: "<?= base_url() ?>index.php/Menu/MD_Tambah_DataUnitService",
|
|
type: "POST",
|
|
dataType: "json",
|
|
data: {
|
|
nama_unitservice : nama_unitservice,
|
|
id_jenis : id_jenis,
|
|
},
|
|
success: function(response) {
|
|
if (response.value==1) {
|
|
notify("success_add");
|
|
delayReload(1000,"<?= base_url() ?>index.php/Menu/MD_MasterUnitService/");
|
|
} else if (response.value==2) {
|
|
notify("name_same");
|
|
document.getElementById("nama_unitservicenew").value = null;
|
|
} else if (response.value==0) {
|
|
notify("failed");
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
setBersih();
|
|
}
|
|
|
|
function ubahData(menu) {
|
|
//1. Ganti Nama UnitService
|
|
//2. Ganti Jenis
|
|
|
|
var id_unitservice = document.getElementById("id_unitserviceLihat").value;
|
|
var id_jenis = document.getElementById("id_jenised").value;
|
|
var nama_unitservice = document.getElementById("nama_unitserviceed").value;
|
|
var nama_unitserviceTemp = document.getElementById("nama_unitserviceTemp").value;
|
|
var status = 0;
|
|
|
|
PNotify.removeAll();
|
|
|
|
if (id_unitservice!="") {
|
|
if (nama_unitservice.length==0) {
|
|
notify("datainput_null");
|
|
document.getElementById("nama_unitserviceed").value = nama_unitserviceTemp;
|
|
status++;
|
|
}
|
|
if (id_jenis=="") {
|
|
status++;
|
|
}
|
|
} else {
|
|
if (id_jenis=="") {
|
|
status++;
|
|
}
|
|
}
|
|
|
|
if (status==0) {
|
|
$.ajax({
|
|
url: "<?= base_url() ?>index.php/Menu/MD_Ubah_DataUnitService",
|
|
type: "POST",
|
|
dataType: "json",
|
|
data: {
|
|
id_unitservice : id_unitservice,
|
|
id_jenis : id_jenis,
|
|
nama_unitservice : nama_unitservice,
|
|
menu : menu,
|
|
},
|
|
success: function(response) {
|
|
if (response.value==1) {
|
|
notify("success_ed");
|
|
|
|
document.getElementById("id_unitserviceLihat").value = null;
|
|
$('#id_unitserviceLihat').select2().select2('val', null);
|
|
document.getElementById("id_unitserviceLihat").innerHTML = "";
|
|
var listData = response.unitservice;
|
|
var isiMaster = document.getElementById('id_unitserviceLihat');
|
|
isiMaster.innerHTML = isiMaster.innerHTML + '<option value="">Pilih UnitService/Reset</option>';
|
|
for (var i = 0; i < listData.length; i++) {
|
|
isiMaster.innerHTML = isiMaster.innerHTML + '<option value="' + listData[i]['ID_UNITSERVICE'] + '">' + listData[i]['NAMA_UNITSERVICE'] + ' [' + listData[i]['NAMA_JENIS'] + ']</option>';
|
|
}
|
|
$('#id_unitserviceLihat').val(id_unitservice).trigger('change');
|
|
} else if (response.value==2) {
|
|
notify("name_same");
|
|
document.getElementById("nama_unitserviceed").value = nama_unitserviceTemp;
|
|
} else if (response.value==3) {
|
|
notify("latest");
|
|
delayReload(1000,"<?= base_url() ?>index.php/Menu/MD_MasterUnitService/");
|
|
} else if (response.value==0) {
|
|
notify("failed");
|
|
}
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
function hapusData() {
|
|
PNotify.removeAll();
|
|
document.getElementById("id_unitservicedel").value = document.getElementById("id_unitserviceLihat").value;
|
|
}
|
|
|
|
function isiData() {
|
|
document.getElementById("id_jenisfill").value = document.getElementById("id_jenislap").value;
|
|
}
|
|
|
|
</script>
|
|
</body>
|
|
|
|
</html>
|