pos-gis/resources/views/content/main.blade.php

356 lines
11 KiB
PHP
Raw Normal View History

2024-10-07 06:13:42 +00:00
<!DOCTYPE html>
@php
app()->setLocale(session('bahasa'));
@endphp
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<x-master.head/>
<x-master.script/>
<x-master.refScript/>
</head>
<x-other.loader/>
<body id="kt_body" class="{{ (session('theme') == 'dark') ? "dark zn-bg-texture-dark":"" }} quick-panel-right demo-panel-right offcanvas-right header-fixed header-mobile-fixed aside-enabled aside-static page-loading zn-bg-texture">
<!--begin::Main-->
<x-master.navMobile />
<div class="d-flex flex-column flex-root">
<div class="d-flex flex-row flex-column-fluid page">
<x-master.menu />
<div class="d-flex flex-column flex-row-fluid wrapper " id="kt_wrapper">
<div id="kt_header" class="header header-fixed shadow" >
<img src="/img/wave2.png" style="
position: absolute;
height: 60px;
width: 100%;
top: 55px;
" alt="">
<div class="container-fluid d-flex align-items-stretch justify-content-between">
<x-master.brand/>
<x-master.topbar/>
</div>
</div>
<div class="content d-flex flex-column flex-column-fluid" id="kt_content">
<div id="pageLoad" class="container-fluid">
@yield('content')
</div>
</div>
<x-master.footer/>
</div>
</div>
</div>
<x-master.navProfile/>
<x-other.modal id="mChangePassword" title="Change Password" subTitle="Form Change Password" info="" separator="false" size="sm">
<x-slot name="action">
<button onclick="changePassword_store()" class="btn btn-transparent-white font-weight-bold mr-2">Change</button>
</x-slot>
<x-slot name="content">
<form id="mChangePasswordForm">
<div class="form-group">
<label>Password Lama</label>
<div class="input-group input-group-solid input-group-md mb-2 zn_sh_password1">
<input type="password" class="form-control" name="oldPassword" id="oldPassword" placeholder="XXXXXXX"/>
<div style="cursor: pointer;" onclick="znShowPassword(1)">
<span class="input-group-text zn-icon-eye1"><i class="la la-eye-slash"></i></span>
</div>
</div>
</div>
<div class="form-group">
<label>Password Baru</label>
<div class="input-group input-group-solid input-group-md mb-2 zn_sh_password2">
<input type="password" class="form-control" name="newPassword" id="newPassword" placeholder="XXXXXXX"/>
<div style="cursor: pointer;" onclick="znShowPassword(2)">
<span class="input-group-text zn-icon-eye2"><i class="la la-eye-slash"></i></span>
</div>
</div>
</div>
<div class="form-group">
<label>Ketik Ulang Password Baru</label>
<div class="input-group input-group-solid input-group-md mb-2 zn_sh_password3">
<input type="password" class="form-control" name="confirmPassword" id="confirmPassword" placeholder="XXXXXXX"/>
<div style="cursor: pointer;" onclick="znShowPassword(3)">
<span class="input-group-text zn-icon-eye3"><i class="la la-eye-slash"></i></span>
</div>
</div>
</div>
</form>
</x-slot>
</x-other.modal>
<x-master.scrollTop/>
<x-other.notif/>
<script>
function showPageBack(url) {
znLoadingPage();
$('#pageLoad').html('');
let state = {name: "name", page: 'History', url:url};
doGet(url, function (msg, data) {
znLoadingPageEnd()
if (data == null){
toastr.error(msg);
}else {
znLoadingPageEnd()
$('#pageLoad').html(data);
$('#pageLoad').hide();
$('#pageLoad').show();
}
});
}
window.onpopstate =function (event) {
showPageBack(document.location);
};
jQuery(document).ready(function() {
let formData = new FormData();
doPost('/user/act_any/check_expired_password', formData, function (msg, res) {
if (res.rc == 99) {
$('#mChangePassword').modal('show');
$('#mChangePassword_btnClose').hide();
}
})
$("#mChangePasswordForm").bootstrapValidator({
excluded: [':disabled'],
fields: {
newPassword: {
validators: {
notEmpty: {
message: 'Tidak Boleh Kosong'
},
identical: {
field: 'confirmPassword',
message: 'Password Tidak Sama'
},
regexp: {
regexp: /^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9]).{8,}$/,
message: 'Password minimal 8 karakter terdiri dari huruf, huruf Kapital dan angka. Contoh : Superuser1'
}
}
},
confirmPassword: {
validators: {
notEmpty: {
message: 'Tidak Boleh Kosong'
},
identical: {
field: 'newPassword',
message: 'Tidak Sama Dengan Password Baru'
}
}
},
oldPassword: {
validators: {
notEmpty: {
message: 'Tidak Boleh Kosong'
}
}
},
}
}).on('success.field.bv', function(e, data) {
var $parent = data.element.parents('.form-group');
$parent.removeClass('has-success');
$parent.find('.form-control-feedback[data-bv-icon-for="' + data.field + '"]').hide();
});
});
// CHANGE PASSWORD
function changePasswordShow() {
$("#mChangePasswordForm")[0].reset();
$('#mChangePasswordForm').bootstrapValidator("resetForm",true);
$('#mChangePassword').modal('show');
}
function generateKey() {
popConfirm("Generate Key",
`Anda Yakin Akan Generate Key Baru ? `, function () {
let new_key = znRandomString(128);
$('#set_key_view').html(G_limit(new_key,20));
let formData = new FormData();
formData.append('key',new_key);
znLoadingPage();
doPost('/user/act_any/generate_key', formData, function (msg, res) {
znLoadingPageEnd();
if (res == null){
znNotif("danger", msg);
}else {
if(res.rc == 0){
znNotif('success',res.rm);
}else{
znNotif("danger", res.rm);
}
}
})
});
}
function changePassword_store() {
var $validor = $('#mChangePasswordForm').data('bootstrapValidator').validate();
if ($validor.isValid()) {
popConfirm("Ubah Password",
`Anda Yakin Akan Merubah Password ? `, function () {
znLoadingModal('mChangePasswordForm');
let myForm = document.getElementById('mChangePasswordForm');
let formData = new FormData(myForm);
doPost('/user/act_any/changePassword', formData, function (msg, res) {
znLoadingModalEnd('mChangePasswordForm');
if (res == null){
znNotif("danger", msg);
}else {
if(res.rc == 0){
znNotif('success',res.rm);
$('#mChangePassword').modal('hide');
let formData = new FormData();
doPost('/user/act_any/store_logout',formData, function (msg, res) {
if (res.rc == 0) {
znNotif("success", 'Password Berhasil Diubah');
setTimeout(() => {window.location.href = '/'}, 2500);
}else{
znNotif("danger", res.rm);
}
})
}else{
znNotif("danger", res.rm);
}
}
})
});
}
}
function znShowPassword(idx) {
if($(`.zn_sh_password${idx} input`).attr("type") == "text"){
$(`.zn_sh_password${idx} input`).attr(`type`, `password`);
$(`.zn-icon-eye${idx} i`).addClass( "la-eye-slash" );
$(`.zn-icon-eye${idx} i`).removeClass( "la-eye" );
}
else if($(`.zn_sh_password${idx} input`).attr("type") == "password"){
$(`.zn_sh_password${idx} input`).attr(`type`, `text`);
$(`.zn-icon-eye${idx} i`).removeClass( "la-eye-slash" );
$(`.zn-icon-eye${idx} i`).addClass( "la-eye" );
}
}
function getNotifAdmin() {
let formData = new FormData();
doPost('/user/act_any/get_notif', formData, function (msg, res) {
if (res == null){
// znNotif("danger", msg);
}else {
if(res.rc == 0){
// znNotif('success',res.rm);
// if (res.jumlah == 0) {
// $('.count_notif_admin').fadeOut();
// }else {
// $('.count_notif_admin').fadeIn();
// }
//console.log(res);
$('.count_notif_admin').html(res.jumlah);
$('#list_notif_admin').html('');
$.each(res.rm, function (k,v) {
//console.log(v.type);
var link = '';
if (v.type == '101') {
link = "/pembelian/list/baru";
}
else if(v.type == '102'){
link = "/pembelian/list/pembayaran";
}
$('#list_notif_admin').append(`
<a href="${link}" onclick="loadContent(event,this);" class="navi-item">
<div class="navi-link rounded">
<div class="symbol symbol-50 symbol-circle mr-3">
<div class="symbol-label">
<i class="flaticon2-notification text-primary icon-md"></i>
</div>
</div>
<div class="navi-text">
<div class="font-weight-bold font-size-lg">`+v.notif+`</div>
<div class="text-muted">`+G_FormatDate(v.created_at,'d-M-Y H:i:s')+`</div>
</div>
</div>
</a>`);
});
}else{
// znNotif("danger", res.rm);
}
}
})
}
function read_notif() {
let formData = new FormData();
doPost('/user/act_any/read_notif', formData, function (msg, res) {
$('.count_notif_admin').html(res.jumlah);
// if (res.jumlah == 0) {
// $('#count_notif_admin').fadeOut();
// }else {
// $('#count_notif_admin').fadeIn();
// }
})
}
function actLogout() {
console.log('wawaw');
$('#is-loading').fadeIn();
let formData = new FormData();
doPost('/user/act_any/store_logout',formData, function (msg, res) {
console.log(res);
if (res.rc == 0) {
window.location.href = '{{url("/")}}/admin_login';
}else{
toastr.info(res.rm);
}
})
}
</script>
</body>
</html>