Tambah fitur otorisasi SLA
- Menambahkan view baru untuk otorisasi SLA (`sla.blade.php` dan `index-sla.blade.php`). - Menambahkan route baru untuk data datatables SLA (`sla.datatables`). - Mengupdate controller (`PenilaianController`, `SLAController`) untuk mendukung alur otorisasi SLA. - Menyesuaikan model `Authorization` guna kebutuhan SLA.
This commit is contained in:
@@ -8,6 +8,7 @@ use Illuminate\Http\Request;
|
|||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
use Modules\Lpj\Http\Requests\PenilaianRequest;
|
use Modules\Lpj\Http\Requests\PenilaianRequest;
|
||||||
|
use Modules\Lpj\Models\Authorization;
|
||||||
use Modules\Lpj\Models\JenisPenilaian;
|
use Modules\Lpj\Models\JenisPenilaian;
|
||||||
use Modules\Lpj\Models\Penilaian;
|
use Modules\Lpj\Models\Penilaian;
|
||||||
use Modules\Lpj\Models\PenilaianTeam;
|
use Modules\Lpj\Models\PenilaianTeam;
|
||||||
@@ -376,6 +377,9 @@ class PenilaianController extends Controller
|
|||||||
|
|
||||||
$header = $headers[$type] ?? 'Pelaporan';
|
$header = $headers[$type] ?? 'Pelaporan';
|
||||||
|
|
||||||
|
if($header==='SLA') {
|
||||||
|
return view('lpj::penilaian.otorisator.index-sla', compact('header'));
|
||||||
|
}
|
||||||
return view('lpj::penilaian.otorisator.index', compact('header'));
|
return view('lpj::penilaian.otorisator.index', compact('header'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -389,14 +393,32 @@ class PenilaianController extends Controller
|
|||||||
];
|
];
|
||||||
|
|
||||||
$header = $headers[$type] ?? 'Pelaporan';
|
$header = $headers[$type] ?? 'Pelaporan';
|
||||||
|
$authorization=null;
|
||||||
|
if($header === 'SLA') {
|
||||||
|
$authorization = Authorization::with(['user'])->find($id);
|
||||||
|
$permohonan = Permohonan::find($authorization->permohonan_id);
|
||||||
|
} else {
|
||||||
$permohonan = Permohonan::find($id);
|
$permohonan = Permohonan::find($id);
|
||||||
|
}
|
||||||
return view('lpj::penilaian.otorisator.show', compact('permohonan', 'header'));
|
if($header === 'SLA') {
|
||||||
|
return view('lpj::penilaian.otorisator.sla', compact('permohonan', 'header','authorization'));
|
||||||
|
}
|
||||||
|
return view('lpj::penilaian.otorisator.show', compact('permohonan', 'header','authorization'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function otorisatorUpdate(Request $request, $id, $context)
|
public function otorisatorUpdate(Request $request, $id, $context)
|
||||||
{
|
{
|
||||||
|
if($context==='SLA'){
|
||||||
|
$authorization = Authorization::with(['user'])->find($id);
|
||||||
|
if (!$authorization) {
|
||||||
|
return response()->json([
|
||||||
|
'message' => 'Data authorization SLA tidak ditemukan.',
|
||||||
|
], 404);
|
||||||
|
}
|
||||||
|
$permohonan = Permohonan::find($authorization->permohonan_id);
|
||||||
|
} else {
|
||||||
$permohonan = Permohonan::find($id);
|
$permohonan = Permohonan::find($id);
|
||||||
|
}
|
||||||
if (!$permohonan) {
|
if (!$permohonan) {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'message' => 'Data permohonan tidak ditemukan.',
|
'message' => 'Data permohonan tidak ditemukan.',
|
||||||
@@ -447,13 +469,41 @@ class PenilaianController extends Controller
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'sla':
|
case 'sla':
|
||||||
|
if (Auth::user()->roles[0]->name === 'senior-officer') {
|
||||||
|
$authorization->update([
|
||||||
|
'status' => '3',
|
||||||
|
'approve_so' => Auth::user()->id,
|
||||||
|
'approve_so_at' => now(),
|
||||||
|
'keterangan_so' => $request->message,
|
||||||
|
]);
|
||||||
|
} elseif (Auth::user()->roles[0]->name === 'EO Appraisal' || Auth::user()->roles[0]->name === 'administrator') {
|
||||||
|
$status = '2';
|
||||||
|
if(!in_array($permohonan->nulai_plafond_id,[1,4])){
|
||||||
|
$status = '1';
|
||||||
|
$permohonan->update([
|
||||||
|
'status' => $authorization->request
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$authorization->update([
|
||||||
|
'status' => $status,
|
||||||
|
'approve_eo' => Auth::user()->id,
|
||||||
|
'approve_eo_at' => now(),
|
||||||
|
'keterangan_eo' => $request->message,
|
||||||
|
]);
|
||||||
|
} elseif (Auth::user()->roles[0]->name === 'DD Appraisal') {
|
||||||
|
$authorization->update([
|
||||||
|
'status' => '1',
|
||||||
|
'approve_dd' => Auth::user()->id,
|
||||||
|
'approve_dd_at' => now(),
|
||||||
|
'keterangan_dd' => $request->message,
|
||||||
|
]);
|
||||||
|
|
||||||
$permohonan->update([
|
$permohonan->update([
|
||||||
'status' => 'proses-sla',
|
'status' => $authorization->request
|
||||||
'keterangan' => $request->message,
|
|
||||||
]);
|
]);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
|
|||||||
@@ -4,9 +4,11 @@ namespace Modules\Lpj\Http\Controllers;
|
|||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
use Modules\Lpj\Models\Authorization;
|
||||||
|
|
||||||
class SLAController extends Controller
|
class SLAController extends Controller
|
||||||
{
|
{
|
||||||
|
public $user;
|
||||||
/**
|
/**
|
||||||
* Display a listing of the resource.
|
* Display a listing of the resource.
|
||||||
*/
|
*/
|
||||||
@@ -62,4 +64,74 @@ class SLAController extends Controller
|
|||||||
{
|
{
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function dataForDatatables(Request $request)
|
||||||
|
{
|
||||||
|
if (is_null($this->user) || !$this->user->can('debitur.view')) {
|
||||||
|
// abort(403, 'Sorry! You are not allowed to view users.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = Authorization::query()->with('permohonan.debiture','user','approveSo','approveEo','approveDd');
|
||||||
|
|
||||||
|
// Pencarian berdasarkan parameter search
|
||||||
|
if ($request->has('search') && !empty($request->get('search'))) {
|
||||||
|
$search = $request->get('search');
|
||||||
|
$query->where(function ($q) use ($search) {
|
||||||
|
$q->where('nomor_registrasi', 'LIKE', '%' . $search . '%');
|
||||||
|
$q->orWhere('tanggal_permohonan', 'LIKE', '%' . $search . '%');
|
||||||
|
$q->orWhereRelation('user', 'name', 'LIKE', '%' . $search . '%');
|
||||||
|
$q->orWhereRelation('debiture', 'name', 'LIKE', '%' . $search . '%');
|
||||||
|
$q->orWhereRelation('jenisPenilaian', 'name', 'LIKE', '%' . $search . '%');
|
||||||
|
$q->orWhereRelation('branch', 'name', 'LIKE', '%' . $search . '%');
|
||||||
|
$q->orWhere('status', 'LIKE', '%' . $search . '%');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sorting berdasarkan sortField dan sortOrder
|
||||||
|
if ($request->has('sortOrder') && !empty($request->get('sortOrder'))) {
|
||||||
|
$order = $request->get('sortOrder');
|
||||||
|
$column = $request->get('sortField');
|
||||||
|
$query->orderBy($column, $order);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hitung total records
|
||||||
|
$totalRecords = $query->count();
|
||||||
|
|
||||||
|
// Pagination (default page size 10)
|
||||||
|
$size = $request->get('size', 10);
|
||||||
|
if ($size == 0) {
|
||||||
|
$size = 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($request->has('page') && $request->has('size')) {
|
||||||
|
$page = $request->get('page', 1);
|
||||||
|
$offset = ($page - 1) * $size;
|
||||||
|
|
||||||
|
$query->skip($offset)->take($size);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Filtered records
|
||||||
|
$filteredRecords = $query->count();
|
||||||
|
|
||||||
|
// Ambil data dengan relasi
|
||||||
|
$data = $query->get();
|
||||||
|
|
||||||
|
|
||||||
|
// Hitung jumlah halaman
|
||||||
|
$pageCount = ceil($totalRecords / $size);
|
||||||
|
|
||||||
|
// Ambil current page
|
||||||
|
$currentPage = max(1, $request->get('page', 1));
|
||||||
|
|
||||||
|
// Return JSON response
|
||||||
|
return response()->json([
|
||||||
|
'draw' => $request->get('draw'),
|
||||||
|
'recordsTotal' => $totalRecords,
|
||||||
|
'recordsFiltered' => $filteredRecords,
|
||||||
|
'pageCount' => $pageCount,
|
||||||
|
'page' => $currentPage,
|
||||||
|
'totalCount' => $totalRecords,
|
||||||
|
'data' => $data,
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,4 +56,16 @@ class Authorization extends Model
|
|||||||
{
|
{
|
||||||
return $this->belongsTo(User::class);
|
return $this->belongsTo(User::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function approveEo(){
|
||||||
|
return $this->belongsTo(User::class, 'approve_eo', 'id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function approveDd(){
|
||||||
|
return $this->belongsTo(User::class, 'approve_dd', 'id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function approveSo(){
|
||||||
|
return $this->belongsTo(User::class, 'approve_so', 'id');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
312
resources/views/penilaian/otorisator/index-sla.blade.php
Normal file
312
resources/views/penilaian/otorisator/index-sla.blade.php
Normal file
@@ -0,0 +1,312 @@
|
|||||||
|
@extends('layouts.main')
|
||||||
|
|
||||||
|
@section('breadcrumbs')
|
||||||
|
{{ Breadcrumbs::render('otorisator.' . strtolower($header)) }}
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<div class="w-full grid gap-5 lg:gap-7.5 mx-auto">
|
||||||
|
<div class="card border border-agi-100 pb-2.5">
|
||||||
|
<div class=" card-grid min-w-full" data-datatable="false" data-datatable-page-size="10"
|
||||||
|
data-datatable-state-save="false" id="permohonan-table"
|
||||||
|
data-api-url="{{ route('otorisator.sla.datatables') }}">
|
||||||
|
<div class="card-header bg-agi-50 py-5 flex-wrap">
|
||||||
|
<h3 class="card-title">
|
||||||
|
Daftar {{ $header }}
|
||||||
|
</h3>
|
||||||
|
<div class="flex flex-wrap gap-2 lg:gap-5">
|
||||||
|
<div class="flex">
|
||||||
|
<label class="input input-sm"> <i class="ki-filled ki-magnifier"> </i>
|
||||||
|
<input placeholder="Search Penilaian" id="search" type="text" value="">
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="flex flex-wrap gap-2.5">
|
||||||
|
<div class="h-[24px] border border-r-gray-200"></div>
|
||||||
|
<a class="btn btn-sm btn-light" href="{{ route('permohonan.export') }}"> Export to Excel </a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="scrollable-x-auto">
|
||||||
|
<table class="table table-auto table-border align-middle text-gray-700 font-medium text-sm"
|
||||||
|
data-datatable-table="true">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="w-14">
|
||||||
|
<input class="checkbox checkbox-sm" data-datatable-check="true" type="checkbox"/>
|
||||||
|
</th>
|
||||||
|
<th class="min-w-[150px]" data-datatable-column="nomor_registrasi">
|
||||||
|
<span class="sort"> <span class="sort-label"> Nomor Registrasi </span>
|
||||||
|
<span class="sort-icon"> </span> </span>
|
||||||
|
</th>
|
||||||
|
<th class="min-w-[150px]" data-datatable-column="tanggal_permohonan">
|
||||||
|
<span class="sort"> <span class="sort-label"> Tanggal Permohonan </span>
|
||||||
|
<span class="sort-icon"> </span> </span>
|
||||||
|
</th>
|
||||||
|
<th class="min-w-[150px]" data-datatable-column="user_id">
|
||||||
|
<span class="sort"> <span class="sort-label"> User Pemohon </span>
|
||||||
|
<span class="sort-icon"> </span> </span>
|
||||||
|
</th>
|
||||||
|
<th class="min-w-[150px]" data-datatable-column="debitur_id">
|
||||||
|
<span class="sort"> <span class="sort-label"> Debitur </span>
|
||||||
|
<span class="sort-icon"> </span> </span>
|
||||||
|
</th>
|
||||||
|
<th class="min-w-[150px]" data-datatable-column="alasan">
|
||||||
|
<span class="sort"> <span class="sort-label"> Alasan </span>
|
||||||
|
<span class="sort-icon"> </span> </span>
|
||||||
|
</th>
|
||||||
|
<th class="min-w-[150px]" data-datatable-column="request">
|
||||||
|
<span class="sort"> <span class="sort-label"> Request </span>
|
||||||
|
<span class="sort-icon"> </span> </span>
|
||||||
|
</th>
|
||||||
|
<th class="min-w-[150px]" data-datatable-column="approval_so">
|
||||||
|
<span class="sort"> <span class="sort-label"> Approval SO </span>
|
||||||
|
<span class="sort-icon"> </span> </span>
|
||||||
|
</th>
|
||||||
|
|
||||||
|
<th class="min-w-[150px]" data-datatable-column="approval_eo">
|
||||||
|
<span class="sort"> <span class="sort-label"> Approval EO </span>
|
||||||
|
<span class="sort-icon"> </span> </span>
|
||||||
|
</th>
|
||||||
|
|
||||||
|
<th class="min-w-[150px]" data-datatable-column="approval_dd">
|
||||||
|
<span class="sort"> <span class="sort-label"> Approval DD </span>
|
||||||
|
<span class="sort-icon"> </span> </span>
|
||||||
|
</th>
|
||||||
|
|
||||||
|
<th class="min-w-[50px] text-center" data-datatable-column="actions">Action</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="card-footer justify-center md:justify-between flex-col md:flex-row gap-3 text-gray-600 text-2sm font-medium">
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
Show
|
||||||
|
<select class="select select-sm w-16" data-datatable-size="true" name="perpage"> </select> per
|
||||||
|
page
|
||||||
|
</div>
|
||||||
|
<div class="flex items-center gap-4">
|
||||||
|
<span data-datatable-info="true"> </span>
|
||||||
|
<div class="pagination" data-datatable-pagination="true">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@push('scripts')
|
||||||
|
<script>
|
||||||
|
function otorisator() {
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Are you sure?',
|
||||||
|
text: "You won't be able to revert this!",
|
||||||
|
icon: 'warning',
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: '#3085d6',
|
||||||
|
cancelButtonColor: '#d33',
|
||||||
|
confirmButtonText: 'Yes!'
|
||||||
|
}).then((result) => {
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
$.ajaxSetup({
|
||||||
|
headers: {
|
||||||
|
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$.ajax(`permohonan/${data}`, {
|
||||||
|
type: 'POST'
|
||||||
|
}).then((response) => {
|
||||||
|
swal.fire('eddited!', 'Pelaporan has been edited.', 'success').then(() => {
|
||||||
|
window.location.reload();
|
||||||
|
});
|
||||||
|
}).catch((error) => {
|
||||||
|
console.error('Error:', error);
|
||||||
|
Swal.fire('Error!', 'An error occurred while file.', 'error');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<script type="module">
|
||||||
|
const element = document.querySelector('#permohonan-table');
|
||||||
|
const searchInput = document.getElementById('search');
|
||||||
|
|
||||||
|
const dataHeader = @json($header);
|
||||||
|
|
||||||
|
|
||||||
|
const apiUrl = element.getAttribute('data-api-url');
|
||||||
|
const dataTableOptions = {
|
||||||
|
apiEndpoint: apiUrl,
|
||||||
|
pageSize: 5,
|
||||||
|
columns: {
|
||||||
|
select: {
|
||||||
|
render: (item, data, context) => {
|
||||||
|
const checkbox = document.createElement('input');
|
||||||
|
checkbox.className = 'checkbox checkbox-sm';
|
||||||
|
checkbox.type = 'checkbox';
|
||||||
|
checkbox.value = data.id.toString();
|
||||||
|
checkbox.setAttribute('data-datatable-row-check', 'true');
|
||||||
|
return checkbox.outerHTML.trim();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
nomor_registrasi: {
|
||||||
|
title: 'Nomor Registrasi',
|
||||||
|
render: (item, data) => {
|
||||||
|
return `${data.permohonan.nomor_registrasi}`;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
tanggal_permohonan: {
|
||||||
|
title: 'Tanggal Permohonan',
|
||||||
|
render: (item, data) => {
|
||||||
|
return `${window.formatTanggalIndonesia(data.created_at)}`;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
user_id: {
|
||||||
|
title: 'User Pemohon',
|
||||||
|
render: (item, data) => {
|
||||||
|
return `${data.user.name}`;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
debitur_id: {
|
||||||
|
title: 'Debitur',
|
||||||
|
render: (item, data) => {
|
||||||
|
return `${data.permohonan.debiture.name}`;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
alasan: {
|
||||||
|
title: 'Alasan',
|
||||||
|
},
|
||||||
|
request: {
|
||||||
|
title: 'Request',
|
||||||
|
},
|
||||||
|
approval_so: {
|
||||||
|
title: 'Approval SO',
|
||||||
|
render: (item, data) => {
|
||||||
|
if(data.approve_so) {
|
||||||
|
return `${data.approve_so.name} | ${window.formatTanggalIndonesia(data.approve_so_at)}`;
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
},
|
||||||
|
},
|
||||||
|
approval_eo: {
|
||||||
|
title: 'Approval EO',
|
||||||
|
render: (item, data) => {
|
||||||
|
if(data.approve_eo) {
|
||||||
|
return `${data.approve_eo.name} | ${window.formatTanggalIndonesia(data.approve_eo_at)}`;
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
},
|
||||||
|
},
|
||||||
|
approval_dd: {
|
||||||
|
title: 'Approval DD',
|
||||||
|
render: (item, data) => {
|
||||||
|
if(data.approve_dd) {
|
||||||
|
return `${data.approve_dd.name} | ${window.formatTanggalIndonesia(data.approve_dd_at)}`;
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
},
|
||||||
|
},
|
||||||
|
actions: {
|
||||||
|
title: 'Status',
|
||||||
|
render: (item, data) => {
|
||||||
|
const userRoles = @json(Auth::user()->getRoleNames());
|
||||||
|
const isAdmin = userRoles.includes('administrator');
|
||||||
|
|
||||||
|
let buttons = `
|
||||||
|
<div class="flex flex-nowrap justify-center">
|
||||||
|
<a class="btn btn-sm btn-icon btn-clear btn-warning" href="otorisator/show/${data.id}/${dataHeader}">
|
||||||
|
<i class="ki-outline ki-eye"></i>
|
||||||
|
</a>
|
||||||
|
`;
|
||||||
|
buttons += `</div>`;
|
||||||
|
return buttons;
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
let dataTable = new KTDataTable(element, dataTableOptions);
|
||||||
|
// Custom search functionality
|
||||||
|
searchInput.addEventListener('input', function () {
|
||||||
|
const searchValue = this.value.trim();
|
||||||
|
dataTable.search(searchValue, true);
|
||||||
|
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function otorisatorData(dataId) {
|
||||||
|
const dataHeader = @json($header);
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Apakah Anda yakin?',
|
||||||
|
text: `Untuk melakukan otorisator ${dataHeader}!`,
|
||||||
|
icon: 'warning',
|
||||||
|
input: 'textarea', // Menambahkan input textarea
|
||||||
|
inputLabel: 'Keterangan',
|
||||||
|
inputPlaceholder: 'Masukkan keterangan...',
|
||||||
|
inputAttributes: {
|
||||||
|
'aria-label': 'Masukkan keterangan'
|
||||||
|
},
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: '#3085d6',
|
||||||
|
cancelButtonColor: '#d33',
|
||||||
|
confirmButtonText: 'Ya, Lanjutkan!',
|
||||||
|
cancelButtonText: 'Batal',
|
||||||
|
}).then((result) => {
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
const userMessage = result.value || ''; // Ambil pesan dari textarea
|
||||||
|
$.ajaxSetup({
|
||||||
|
headers: {
|
||||||
|
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
||||||
|
},
|
||||||
|
});
|
||||||
|
$.ajax({
|
||||||
|
url: `/otorisator/otorisator/${dataId}/${dataHeader}`,
|
||||||
|
type: 'POST',
|
||||||
|
data: {
|
||||||
|
message: userMessage // Kirim pesan sebagai bagian dari data
|
||||||
|
},
|
||||||
|
success: (response) => {
|
||||||
|
Swal.fire('Berhasil!', 'Data berhasil diotorisasi. Menunggu Approval EO dan atau DD', 'success').then(() => {
|
||||||
|
window.location.reload();
|
||||||
|
});
|
||||||
|
console.log(response);
|
||||||
|
},
|
||||||
|
error: (error) => {
|
||||||
|
console.error('Error:', error);
|
||||||
|
Swal.fire('Gagal!', 'Terjadi kesalahan saat melakukan otorisator.',
|
||||||
|
'error');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function showLoadingSwal(message, duration = 5000) {
|
||||||
|
Swal.fire({
|
||||||
|
title: message,
|
||||||
|
allowOutsideClick: false,
|
||||||
|
didOpen: () => {
|
||||||
|
Swal.showLoading();
|
||||||
|
},
|
||||||
|
timer: duration, // Durasi dalam milidetik
|
||||||
|
timerProgressBar: true, // Menampilkan progres bar timer
|
||||||
|
}).then((result) => {
|
||||||
|
if (result.dismiss === Swal.DismissReason.timer) {
|
||||||
|
console.log('Dialog loading otomatis ditutup.');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
@endpush
|
||||||
@@ -246,27 +246,6 @@
|
|||||||
<i class="ki-outline ki-eye"></i>
|
<i class="ki-outline ki-eye"></i>
|
||||||
</a>
|
</a>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
if ((isAdmin || userRoles.includes('senior-officer')) && !data.approval_so) {
|
|
||||||
buttons += `
|
|
||||||
<a class="btn btn-sm btn-icon btn-clear btn-primary" onclick="otorisatorData(${data.id})">
|
|
||||||
<i class="ki-filled ki-double-check"></i>
|
|
||||||
</a>
|
|
||||||
`;
|
|
||||||
} else if ((isAdmin || userRoles.includes('EO Appraisal')) && data.approval_so && !data.approval_eo) {
|
|
||||||
buttons += `
|
|
||||||
<a class="btn btn-sm btn-icon btn-clear btn-primary" onclick="otorisatorData(${data.id})">
|
|
||||||
<i class="ki-filled ki-double-check"></i>
|
|
||||||
</a>
|
|
||||||
`;
|
|
||||||
} else if ((isAdmin || userRoles.includes('DD Appraisal')) && data.approval_eo && !data.approval_dd && [1, 4].includes(data.nilai_plafond_id)) {
|
|
||||||
buttons += `
|
|
||||||
<a class="btn btn-sm btn-icon btn-clear btn-primary" onclick="otorisatorData(${data.id})">
|
|
||||||
<i class="ki-filled ki-double-check"></i>
|
|
||||||
</a>
|
|
||||||
`;
|
|
||||||
}
|
|
||||||
|
|
||||||
buttons += `</div>`;
|
buttons += `</div>`;
|
||||||
return buttons;
|
return buttons;
|
||||||
},
|
},
|
||||||
|
|||||||
239
resources/views/penilaian/otorisator/sla.blade.php
Normal file
239
resources/views/penilaian/otorisator/sla.blade.php
Normal file
@@ -0,0 +1,239 @@
|
|||||||
|
@extends('layouts.main')
|
||||||
|
|
||||||
|
@php
|
||||||
|
if($header=="sla"){
|
||||||
|
$header = "Freze SLA";
|
||||||
|
}
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
@section('breadcrumbs')
|
||||||
|
{{ Breadcrumbs::render(request()->route()->getName(), $permohonan->id, $header) }}
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<div class="w-full grid gap-5 lg:gap-7.5 mx-auto">
|
||||||
|
|
||||||
|
@php
|
||||||
|
$dataHeader = strtolower($header ?? '');
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
@include('lpj::component.detail-jaminan', ['backLink' => 'otorisator.' . $dataHeader . '.index'])
|
||||||
|
|
||||||
|
@foreach ($permohonan->debiture->documents as $dokumen)
|
||||||
|
<div class="card border border-agi-100 pb-2.5">
|
||||||
|
<div class="card-header bg-agi-50" id="basic_settings">
|
||||||
|
<h3 class="card-title">
|
||||||
|
Team
|
||||||
|
</h3>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card-body grid gap-5">
|
||||||
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||||
|
@php
|
||||||
|
$surveyor = $permohonan->penilaian->userPenilai->where('role', 'surveyor')->first();
|
||||||
|
$penilai = $permohonan->penilaian->userPenilai->where('role', 'penilai')->first();
|
||||||
|
|
||||||
|
@endphp
|
||||||
|
<label class="form-label max-w-56">
|
||||||
|
Surveyor
|
||||||
|
</label>
|
||||||
|
<div class="flex flex-wrap items-baseline w-full">
|
||||||
|
|
||||||
|
<p class="flex w-full text-gray-600 font-medium text-sm">
|
||||||
|
{{ $surveyor->userPenilaiTeam->name }}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class="flex w-full text-gray-600 font-medium text-sm">{{ checkRegionUserName($surveyor->userPenilaiTeam->id) }}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<label class="form-label max-w-56">
|
||||||
|
Penilai
|
||||||
|
</label>
|
||||||
|
<div class="flex flex-wrap items-baseline w-full">
|
||||||
|
|
||||||
|
<p class="flex w-full text-gray-600 font-medium text-sm">
|
||||||
|
{{ $penilai->userPenilaiTeam->name }}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class="flex w-full text-gray-600 font-medium text-sm">
|
||||||
|
{{ checkRegionUserName($penilai->userPenilaiTeam->id) }}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@php
|
||||||
|
$inspeksiId = null;
|
||||||
|
foreach ($dokumen->inspeksi as $item) {
|
||||||
|
$inspeksiId = $item->id;
|
||||||
|
}
|
||||||
|
@endphp
|
||||||
|
</div>
|
||||||
|
@endforeach
|
||||||
|
|
||||||
|
<div class="card border border-agi-100 pb-2.5">
|
||||||
|
<div class="card-header bg-agi-50" id="basic_settings">
|
||||||
|
<h3 class="card-title">
|
||||||
|
Alasan Freze SLA
|
||||||
|
</h3>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card-body grid gap-5">
|
||||||
|
{{ $authorization->alasan ?? ''}}
|
||||||
|
<table class="table table-border">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>Pemohon</td>
|
||||||
|
<td>{{ $authorization->user->name }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Alasan</td>
|
||||||
|
<td>{{ $authorization->alasan }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Tanggal Permohonan</td>
|
||||||
|
<td>{{ formatTanggalIndonesia($authorization->created_at,1) }}</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@php
|
||||||
|
if($header=="SLA"){
|
||||||
|
$header = "Freze SLA";
|
||||||
|
}
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
@if($authorization->approve_so)
|
||||||
|
<div class="card border border-agi-100 pb-2.5">
|
||||||
|
<div class="card-header bg-agi-50" id="basic_settings">
|
||||||
|
<h3 class="card-title">
|
||||||
|
Approval
|
||||||
|
</h3>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card-body">
|
||||||
|
<table class="table table-border">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>Diperiksa Oleh</td>
|
||||||
|
<td>{{ getUser($authorization->approve_so)->name ?? 'N/A' }}</td>
|
||||||
|
<td>{{ $authorization->approve_so_at ? formatTanggalIndonesia($authorization->approve_so_at,1) : 'N/A' }}</td>
|
||||||
|
</tr>
|
||||||
|
@if($authorization->approve_eo!=null)
|
||||||
|
<tr>
|
||||||
|
<td>Disetujui Oleh (EO)</td>
|
||||||
|
<td>{{ getUser($authorization->approve_eo)->name ?? 'N/A' }}</td>
|
||||||
|
<td>{{ $authorization->approve_eo_at ? formatTanggalIndonesia($authorization->approve_eo_at,1) : 'N/A' }}</td>
|
||||||
|
</tr>
|
||||||
|
@endif
|
||||||
|
@if(in_array($authorization->nilai_eafond_id,[1,4]) && $authorization->approve_dd!=null)
|
||||||
|
<tr>
|
||||||
|
<td>Disetujui Oleh (DD)</td>
|
||||||
|
<td>{{ getUser($authorization->approve_dd)->name ?? 'N/A' }}</td>
|
||||||
|
<td>{{ $authorization->approve_dd_at ? formatTanggalIndonesia($authorization->approve_dd_at,1) : 'N/A' }}</td>
|
||||||
|
</tr>
|
||||||
|
@endif
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
<div>
|
||||||
|
<div>
|
||||||
|
<div class="flex gap-2.5">
|
||||||
|
@php
|
||||||
|
$inspeksiId = null;
|
||||||
|
$documentId = null;
|
||||||
|
$jenisJaminanId = null;
|
||||||
|
foreach ($permohonan->debiture->documents as $item) {
|
||||||
|
foreach ($item->inspeksi as $key => $value) {
|
||||||
|
$inspeksiId = $item->id;
|
||||||
|
}
|
||||||
|
$documentId = $item->id;
|
||||||
|
$jenisJaminanId = $item->jenis_jaminan_id;
|
||||||
|
}
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
@if ($dataHeader == 'pelaporan')
|
||||||
|
<a class="btn btn-success"
|
||||||
|
href="{{ route('otorisator.view-laporan') }}?permohonanId={{ $permohonan->id }}&documentId={{ $documentId }}&inspeksiId={{ $inspeksiId }}&jaminanId={{ $jenisJaminanId }}&statusLpj={{true}}">
|
||||||
|
Lihat Laporan
|
||||||
|
</a>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
@if(Auth::user()->hasAnyRole(['administrator','senior-officer']) && $authorization->approve_so==null)
|
||||||
|
<button onclick="otorisatorData({{ $authorization->id }})" type="button" class="btn btn-primary">
|
||||||
|
<i class="ki-filled ki-double-check"></i>
|
||||||
|
Otorisasi {{ $header ?? '' }}
|
||||||
|
</button>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
@if(Auth::user()->hasAnyRole(['administrator','EO Appraisal']) && $authorization->approve_so && $authorization->approve_eo==null)
|
||||||
|
<button onclick="otorisatorData({{ $authorization->id }})" type="button" class="btn btn-primary">
|
||||||
|
<i class="ki-filled ki-double-check"></i>
|
||||||
|
Otorisasi {{ $header ?? '' }}
|
||||||
|
</button>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
@if(Auth::user()->hasAnyRole(['administrator','DD Appraisal']) && $authorization->approve_eo && $authorization->approve_dd==null && in_array($permohonan->nilai_plafond_id,[1,4]))
|
||||||
|
<button onclick="otorisatorData({{ $authorization->id }})" type="button" class="btn btn-primary">
|
||||||
|
<i class="ki-filled ki-double-check"></i>
|
||||||
|
Otorisasi {{ $header ?? '' }}
|
||||||
|
</button>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@push('scripts')
|
||||||
|
<script>
|
||||||
|
function otorisatorData(dataId) {
|
||||||
|
const dataHeader = @json($header);
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Apakah Anda yakin?',
|
||||||
|
text: `Untuk melakukan otorisator ${dataHeader}!`,
|
||||||
|
icon: 'warning',
|
||||||
|
input: 'textarea',
|
||||||
|
inputLabel: 'Keterangan',
|
||||||
|
inputPlaceholder: 'Masukkan keterangan...',
|
||||||
|
inputAttributes: {
|
||||||
|
'aria-label': 'Masukkan keterangan'
|
||||||
|
},
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: '#3085d6',
|
||||||
|
cancelButtonColor: '#d33',
|
||||||
|
confirmButtonText: 'Ya, Lanjutkan!',
|
||||||
|
cancelButtonText: 'Batal',
|
||||||
|
}).then((result) => {
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
const userMessage = result.value || ''; // Ambil pesan dari textarea
|
||||||
|
$.ajaxSetup({
|
||||||
|
headers: {
|
||||||
|
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
||||||
|
},
|
||||||
|
});
|
||||||
|
$.ajax({
|
||||||
|
url: `/otorisator/otorisator/${dataId}/SLA`,
|
||||||
|
type: 'POST',
|
||||||
|
data: {
|
||||||
|
message: userMessage
|
||||||
|
},
|
||||||
|
success: (response) => {
|
||||||
|
Swal.fire('Berhasil!', 'Data berhasil diotorisasi. Menunggu Approval EO dan atau DD', 'success').then(() => {
|
||||||
|
window.location.reload();
|
||||||
|
});
|
||||||
|
console.log(response);
|
||||||
|
},
|
||||||
|
error: (error) => {
|
||||||
|
console.error('Error:', error);
|
||||||
|
Swal.fire('Gagal!', 'Terjadi kesalahan saat melakukan otorisator.',
|
||||||
|
'error');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
@endpush
|
||||||
@@ -520,6 +520,9 @@ Route::middleware(['auth'])->group(function () {
|
|||||||
);
|
);
|
||||||
|
|
||||||
Route::get('sla', [PenilaianController::class, 'otorisator'])->name('sla.index')->defaults('type', 'sla');
|
Route::get('sla', [PenilaianController::class, 'otorisator'])->name('sla.index')->defaults('type', 'sla');
|
||||||
|
Route::get('/datatables/sla', [SLAController::class, 'dataForDatatables'])->name(
|
||||||
|
'sla.datatables',
|
||||||
|
);
|
||||||
Route::get('/datatables/{otorisator}', [PenilaianController::class, 'dataForAuthorization'])->name(
|
Route::get('/datatables/{otorisator}', [PenilaianController::class, 'dataForAuthorization'])->name(
|
||||||
'datatables',
|
'datatables',
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user