first initial

This commit is contained in:
2025-05-27 19:09:17 +07:00
commit 80375d8af3
1587 changed files with 572586 additions and 0 deletions

1
public/js/app.bundle.min.js vendored Normal file

File diff suppressed because one or more lines are too long

1208
public/js/app.js Normal file

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,8 @@
/**
* @license
* Lodash <https://lodash.com/>
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
* Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
*/

8
public/js/bootstrap-datepicker.min.js vendored Normal file

File diff suppressed because one or more lines are too long

75
public/js/init.js Normal file
View File

@@ -0,0 +1,75 @@
"use strict";
function moneyFormat(n, currency) {
n = (n != null) ? n : 0;
var v = parseFloat(n).toFixed(0);
return currency + " " + v.replace(/./g, function (c, i, a) {
return i > 0 && c !== "," && (a.length - i) % 3 === 0 ? "." + c : c;
});
}
var KTToastr = function () {
var successToastr = function (msg, title) {
toastr.options = {
"closeButton": true,
"debug": false,
"newestOnTop": false,
"progressBar": false,
"positionClass": "toast-top-right",
"preventDuplicates": true,
"onclick": null,
"showDuration": "500",
"hideDuration": "500",
"timeOut": "3000",
"extendedTimeOut": "3000",
"showEasing": "swing",
"hideEasing": "swing",
"showMethod": "fadeIn",
"hideMethod": "fadeOut"
};
var $toast = toastr["success"](msg, title);
if (typeof $toast === 'undefined') {
return;
}
}
var errorToastr = function (msg, title) {
toastr.options = {
"closeButton": true,
"debug": false,
"newestOnTop": false,
"progressBar": false,
"positionClass": "toast-top-right",
"preventDuplicates": true,
"onclick": null,
"showDuration": "500",
"hideDuration": "500",
"timeOut": "3000",
"extendedTimeOut": "3000",
"showEasing": "swing",
"hideEasing": "swing",
"showMethod": "fadeIn",
"hideMethod": "fadeOut"
};
var $toast = toastr["error"](msg, title);
if (typeof $toast === 'undefined') {
return;
}
}
return {
initSuccess: function (msg, title) {
successToastr(msg, title);
},
initError: function (msg, title) {
errorToastr(msg, title);
}
};
}();
jQuery(document).ready(function () {
var li = $('.kt-menu__item--active');
li.closest('li.kt-menu__item--submenu').addClass('kt-menu__item--open');
});

View 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()
}
})
}
})
});

View 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()
}
})
}
})
});

View 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()
}
})
}
})
});

View 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()
}
})
}
})
});