first initial
This commit is contained in:
101
public/js/pages/back/master/category.js
Normal file
101
public/js/pages/back/master/category.js
Normal file
@@ -0,0 +1,101 @@
|
||||
$.ajaxSetup({
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
||||
}
|
||||
});
|
||||
|
||||
var table = $('#kt_table').DataTable({
|
||||
processing: true,
|
||||
serverSide: true,
|
||||
ajax: $("input[name='ajax_url']"),
|
||||
columns: [
|
||||
{data: 'name', name: 'name'},
|
||||
{data: 'form', name: 'form'},
|
||||
{data: 'action', name: 'action', orderable: false, searchable: false},
|
||||
]
|
||||
});
|
||||
|
||||
|
||||
$("#addCategory").click(function() {
|
||||
$("#categoryModal").modal("show")
|
||||
let form_action = $("input[name='store_url']").val()
|
||||
$("#categoryForm").attr('action', form_action)
|
||||
$("#categoryForm input[name='_method']").remove()
|
||||
$("#categoryForm").attr('data-form', 'store')
|
||||
$("#categoryForm").trigger("reset")
|
||||
})
|
||||
|
||||
|
||||
function destroyCategory(id) {
|
||||
let action = $("#destroyCategory"+id).attr("data-action")
|
||||
console.log(action)
|
||||
Swal.fire({
|
||||
title: 'Hapus Kategori?',
|
||||
text: "Data Pekerjaan yang terkait dengan kategori ini juga akan terhapus!",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#d33',
|
||||
cancelButtonColor: '#dedede',
|
||||
confirmButtonText: 'Hapus'
|
||||
}).then((result) => {
|
||||
if (result.value) {
|
||||
$.ajax({
|
||||
url: action,
|
||||
type: 'POST',
|
||||
data: {
|
||||
_token: $('meta[name="csrf-token"]').attr('content'),
|
||||
_method: 'DELETE'
|
||||
},
|
||||
success: function(res) {
|
||||
Swal.fire(
|
||||
'Kategori Dihapus!'
|
||||
)
|
||||
table.ajax.reload()
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function editCategory(id) {
|
||||
let form_action = $("#editCategory"+id).attr("data-action")
|
||||
let edit_url = $("#editCategory"+id).attr("data-url")
|
||||
$("#categoryModal").modal("show")
|
||||
$("#categoryForm").append('<input type="hidden" name="_method" value="PUT">')
|
||||
$("#categoryForm").attr('action', form_action)
|
||||
$("#categoryForm").attr('data-form', 'update')
|
||||
$.get(edit_url, function(res) {
|
||||
$("#categoryForm input[name='name']").val(res.data.name)
|
||||
$("#categoryForm option[value='"+ res.data.form +"']").prop('selected', true);
|
||||
})
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
$("#categoryForm").submit(function(e) {
|
||||
e.preventDefault();
|
||||
let dataForm = $("#categoryForm").attr('data-form')
|
||||
if(dataForm == 'store') {
|
||||
$.ajax({
|
||||
url: $('#categoryForm').attr("action"),
|
||||
type: 'POST',
|
||||
data: $('#categoryForm').serialize(),
|
||||
success: function(res) {
|
||||
$("#categoryModal").modal("hide")
|
||||
$('#categoryForm').trigger("reset")
|
||||
table.ajax.reload()
|
||||
}
|
||||
})
|
||||
}else if(dataForm == 'update') {
|
||||
$.ajax({
|
||||
url: $('#categoryForm').attr("action"),
|
||||
type: 'POST',
|
||||
data: $('#categoryForm').serialize(),
|
||||
success: function(res) {
|
||||
$("#categoryModal").modal("hide")
|
||||
$('#categoryForm').trigger("reset")
|
||||
table.ajax.reload()
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
});
|
||||
128
public/js/pages/back/master/dealer.js
Normal file
128
public/js/pages/back/master/dealer.js
Normal file
@@ -0,0 +1,128 @@
|
||||
$.ajaxSetup({
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
||||
}
|
||||
});
|
||||
|
||||
var table = $('#kt_table').DataTable({
|
||||
processing: true,
|
||||
serverSide: true,
|
||||
ajax: $("input[name='ajax_url']"),
|
||||
columns: [
|
||||
{data: 'dealer_code', name: 'dealer_code'},
|
||||
{data: 'name', name: 'name'},
|
||||
{data: 'pic_name', name: 'u.name'},
|
||||
{data: 'address', name: 'address'},
|
||||
{data: 'action', name: 'action', orderable: false, searchable: false},
|
||||
]
|
||||
});
|
||||
|
||||
|
||||
$("#addDealer").click(function() {
|
||||
$("#dealerModal").modal("show")
|
||||
let form_action = $("input[name='store_url']").val()
|
||||
$("#dealerForm").attr('action', form_action)
|
||||
$("#dealerForm input[name='_method']").remove()
|
||||
$("#dealerForm").attr('data-form', 'store')
|
||||
$("#dealerForm").trigger("reset")
|
||||
})
|
||||
|
||||
function destroyDealer(id) {
|
||||
let action = $("#destroyDealer"+id).attr("data-action")
|
||||
Swal.fire({
|
||||
title: 'Hapus Dealer?',
|
||||
text: "Data pengguna yang terkait dengan dealer ini juga akan terhapus!",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#d33',
|
||||
cancelButtonColor: '#dedede',
|
||||
confirmButtonText: 'Hapus'
|
||||
}).then((result) => {
|
||||
if (result.value) {
|
||||
$.ajax({
|
||||
url: action,
|
||||
type: 'POST',
|
||||
data: {
|
||||
_token: $('meta[name="csrf-token"]').attr('content'),
|
||||
_method: 'DELETE'
|
||||
},
|
||||
success: function(res) {
|
||||
Swal.fire(
|
||||
'Dealer Dihapus!'
|
||||
)
|
||||
table.ajax.reload()
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function editDealer(id) {
|
||||
let form_action = $("#editDealer"+id).attr("data-action")
|
||||
let edit_url = $("#editDealer"+id).attr("data-url")
|
||||
$("#dealerModal").modal("show")
|
||||
$("#dealerForm").append('<input type="hidden" name="_method" value="PUT">')
|
||||
$("#dealerForm").attr('action', form_action)
|
||||
$("#dealerForm").attr('data-form', 'update')
|
||||
$.get(edit_url, function(res) {
|
||||
$("#dealerForm input[name='name']").val(res.data.name)
|
||||
$("#dealerForm input[name='dealer_code']").val(res.data.dealer_code)
|
||||
$("#dealerForm input[name='address']").val(res.data.address)
|
||||
})
|
||||
}
|
||||
|
||||
function addPic(id) {
|
||||
let form_action = $("#addPic"+id).attr("data-action")
|
||||
let edit_url = $("#addPic"+id).attr("data-url")
|
||||
$("#picModal").modal("show")
|
||||
$("#picForm").append('<input type="hidden" name="_method" value="PUT">')
|
||||
$("#picForm").attr('action', form_action)
|
||||
$.get(edit_url, function(res) {
|
||||
$("#picForm input[name='name']").val(res.data.name)
|
||||
$("#picForm input[name='dealer_code']").val(res.data.dealer_code)
|
||||
})
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
$("#picForm").submit(function(e) {
|
||||
e.preventDefault()
|
||||
$.ajax({
|
||||
url: $('#picForm').attr("action"),
|
||||
type: 'POST',
|
||||
data: {pic: $('#picForm select[name="pic_id"]').val()},
|
||||
success: function(res) {
|
||||
$("#picModal").modal("hide")
|
||||
$('#picForm').trigger("reset")
|
||||
table.ajax.reload()
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
$("#dealerForm").submit(function(e) {
|
||||
e.preventDefault();
|
||||
let dataForm = $("#dealerForm").attr('data-form')
|
||||
if(dataForm == 'store') {
|
||||
$.ajax({
|
||||
url: $('#dealerForm').attr("action"),
|
||||
type: 'POST',
|
||||
data: $('#dealerForm').serialize(),
|
||||
success: function(res) {
|
||||
$("#dealerModal").modal("hide")
|
||||
$('#dealerForm').trigger("reset")
|
||||
table.ajax.reload()
|
||||
}
|
||||
})
|
||||
}else if(dataForm == 'update') {
|
||||
$.ajax({
|
||||
url: $('#dealerForm').attr("action"),
|
||||
type: 'POST',
|
||||
data: $('#dealerForm').serialize(),
|
||||
success: function(res) {
|
||||
$("#dealerModal").modal("hide")
|
||||
$('#dealerForm').trigger("reset")
|
||||
table.ajax.reload()
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
});
|
||||
104
public/js/pages/back/master/work.js
Normal file
104
public/js/pages/back/master/work.js
Normal file
@@ -0,0 +1,104 @@
|
||||
$.ajaxSetup({
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
||||
}
|
||||
});
|
||||
|
||||
var table = $('#kt_table').DataTable({
|
||||
processing: true,
|
||||
serverSide: true,
|
||||
ajax: $("input[name='ajax_url']"),
|
||||
columns: [
|
||||
{data: 'category_name', name: 'c.name'},
|
||||
{data: 'name', name: 'w.name'},
|
||||
{data: 'shortname', name: 'w.shortname'},
|
||||
{data: 'desc', name: 'w.desc'},
|
||||
{data: 'action', name: 'action', orderable: false, searchable: false},
|
||||
]
|
||||
});
|
||||
|
||||
|
||||
$("#addWork").click(function() {
|
||||
$("#workModal").modal("show")
|
||||
let form_action = $("input[name='store_url']").val()
|
||||
$("#workForm").attr('action', form_action)
|
||||
$("#workForm input[name='_method']").remove()
|
||||
$("#workForm").attr('data-form', 'store')
|
||||
$("#workForm").trigger("reset")
|
||||
$("#workForm textarea[name='desc']").val("")
|
||||
})
|
||||
|
||||
function destroyWork(id) {
|
||||
let action = $("#destroyWork"+id).attr("data-action")
|
||||
Swal.fire({
|
||||
title: 'Hapus Pekerjaan?',
|
||||
text: "Anda tidak akan bisa mengembalikannya!",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#d33',
|
||||
cancelButtonColor: '#dedede',
|
||||
confirmButtonText: 'Hapus'
|
||||
}).then((result) => {
|
||||
if (result.value) {
|
||||
$.ajax({
|
||||
url: action,
|
||||
type: 'POST',
|
||||
data: {
|
||||
_token: $('meta[name="csrf-token"]').attr('content'),
|
||||
_method: 'DELETE'
|
||||
},
|
||||
success: function(res) {
|
||||
Swal.fire(
|
||||
'Dealer Dihapus!'
|
||||
)
|
||||
table.ajax.reload()
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function editWork(id) {
|
||||
let form_action = $("#editWork"+id).attr("data-action")
|
||||
let edit_url = $("#editWork"+id).attr("data-url")
|
||||
$("#workModal").modal("show")
|
||||
$("#workForm").append('<input type="hidden" name="_method" value="PUT">')
|
||||
$("#workForm").attr('action', form_action)
|
||||
$("#workForm").attr('data-form', 'update')
|
||||
$.get(edit_url, function(res) {
|
||||
$("#workForm input[name='name']").val(res.data.name)
|
||||
$("#workForm input[name='shortname']").val(res.data.shortname)
|
||||
$("#workForm textarea[name='desc']").html(res.data.desc)
|
||||
$("#workForm option[value='"+ res.data.category_id +"']").prop('selected', true);
|
||||
})
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
$("#workForm").submit(function(e) {
|
||||
e.preventDefault();
|
||||
let dataForm = $("#workForm").attr('data-form')
|
||||
if(dataForm == 'store') {
|
||||
$.ajax({
|
||||
url: $('#workForm').attr("action"),
|
||||
type: 'POST',
|
||||
data: $('#workForm').serialize(),
|
||||
success: function(res) {
|
||||
$("#workModal").modal("hide")
|
||||
$('#workForm').trigger("reset")
|
||||
table.ajax.reload()
|
||||
}
|
||||
})
|
||||
}else if(dataForm == 'update') {
|
||||
$.ajax({
|
||||
url: $('#workForm').attr("action"),
|
||||
type: 'POST',
|
||||
data: $('#workForm').serialize(),
|
||||
success: function(res) {
|
||||
$("#workModal").modal("hide")
|
||||
$('#workForm').trigger("reset")
|
||||
table.ajax.reload()
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
});
|
||||
0
public/js/pages/back/report/transaction.js
Normal file
0
public/js/pages/back/report/transaction.js
Normal file
105
public/js/pages/back/user.js
Normal file
105
public/js/pages/back/user.js
Normal file
@@ -0,0 +1,105 @@
|
||||
$.ajaxSetup({
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
||||
}
|
||||
});
|
||||
|
||||
var table = $('#kt_table').DataTable({
|
||||
processing: true,
|
||||
serverSide: true,
|
||||
ajax: $("input[name='ajax_url']").val(),
|
||||
columns: [
|
||||
{data: 'DT_RowIndex', name: 'DT_RowIndex', orderable: false, searchable: false},
|
||||
{data: 'dealer_name', name: 'd.name'},
|
||||
{data: 'role_name', name: 'r.name'},
|
||||
{data: 'name', name: 'users.name'},
|
||||
{data: 'email', name: 'users.email'},
|
||||
{data: 'action', name: 'action', orderable: false, searchable: false},
|
||||
]
|
||||
});
|
||||
|
||||
|
||||
$("#addUser").click(function() {
|
||||
$("#userModal").modal("show")
|
||||
let form_action = $("input[name='store_url']").val()
|
||||
$("#userForm").attr('action', form_action)
|
||||
$("#userForm input[name='_method']").remove()
|
||||
$("#userForm").attr('data-form', 'store')
|
||||
$("#userForm").trigger("reset")
|
||||
$("#modalHeading").html("Tambah Pengguna")
|
||||
})
|
||||
|
||||
function destroyUser(id) {
|
||||
let action = $("#destroyUser"+id).attr("data-action")
|
||||
Swal.fire({
|
||||
title: 'Hapus User?',
|
||||
text: "Semua data yang terkait dengan Pengguna ini juga akan terhapus!",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#d33',
|
||||
cancelButtonColor: '#dedede',
|
||||
confirmButtonText: 'Hapus'
|
||||
}).then((result) => {
|
||||
if (result.value) {
|
||||
$.ajax({
|
||||
url: action,
|
||||
type: 'POST',
|
||||
data: {
|
||||
_token: $('meta[name="csrf-token"]').attr('content'),
|
||||
_method: 'DELETE'
|
||||
},
|
||||
success: function(res) {
|
||||
Swal.fire(
|
||||
'Pengguna Dihapus!'
|
||||
)
|
||||
table.ajax.reload()
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function editUser(id) {
|
||||
let form_action = $("#editUser"+id).attr("data-action")
|
||||
let edit_url = $("#editUser"+id).attr("data-url")
|
||||
$("#userModal").modal("show")
|
||||
$("#userForm").append('<input type="hidden" name="_method" value="PUT">')
|
||||
$("#userForm").attr('action', form_action)
|
||||
$("#userForm").attr('data-form', 'update')
|
||||
$.get(edit_url, function(res) {
|
||||
$("#userForm input[name='name']").val(res.data.name)
|
||||
$("#userForm input[name='email']").val(res.data.email)
|
||||
$("#userForm select[name='dealer_id'] option[value='"+ res.data.dealer_id +"']").prop('selected', true);
|
||||
$("#userForm select[name='role'] option[value='"+ res.data.role_id +"']").prop('selected', true);
|
||||
})
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
$("#userForm").submit(function(e) {
|
||||
e.preventDefault();
|
||||
let dataForm = $("#userForm").attr('data-form')
|
||||
if(dataForm == 'store') {
|
||||
$.ajax({
|
||||
url: $('#userForm').attr("action"),
|
||||
type: 'POST',
|
||||
data: $('#userForm').serialize(),
|
||||
success: function(res) {
|
||||
$("#userModal").modal("hide")
|
||||
$('#userForm').trigger("reset")
|
||||
table.ajax.reload()
|
||||
}
|
||||
})
|
||||
}else if(dataForm == 'update') {
|
||||
$.ajax({
|
||||
url: $('#userForm').attr("action"),
|
||||
type: 'POST',
|
||||
data: $('#userForm').serialize(),
|
||||
success: function(res) {
|
||||
$("#userModal").modal("hide")
|
||||
$('#userForm').trigger("reset")
|
||||
table.ajax.reload()
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user