Merge branch 'staging' into feature/senior-officer
This commit is contained in:
46
app/Exports/JenisLampiranExport.php
Normal file
46
app/Exports/JenisLampiranExport.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\app\Exports;
|
||||
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\WithColumnFormatting;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
|
||||
use Modules\Lpj\app\Models\JenisLampiran;
|
||||
|
||||
class JenisLampiranExport implements WithColumnFormatting, WithHeadings, FromCollection, WithMapping
|
||||
{
|
||||
public function collection()
|
||||
{
|
||||
return JenisLampiran::all();
|
||||
}
|
||||
|
||||
public function map($row): array
|
||||
{
|
||||
return [
|
||||
$row->id,
|
||||
$row->nama,
|
||||
$row->deskripsi,
|
||||
$row->created_at
|
||||
];
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'ID',
|
||||
'Nama',
|
||||
'Deskripsi',
|
||||
'Created At'
|
||||
];
|
||||
}
|
||||
|
||||
public function columnFormats(): array
|
||||
{
|
||||
return [
|
||||
'A' => NumberFormat::FORMAT_NUMBER,
|
||||
'D' => NumberFormat::FORMAT_DATE_DATETIME
|
||||
];
|
||||
}
|
||||
}
|
||||
172
app/Http/Controllers/JenisLampiranController.php
Normal file
172
app/Http/Controllers/JenisLampiranController.php
Normal file
@@ -0,0 +1,172 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Http\Controllers;
|
||||
|
||||
use Exception;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Controller;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use Modules\Lpj\Exports\JenisLampiranExport;
|
||||
use Modules\Lpj\Http\Requests\JenisLampiranRequest;
|
||||
use Modules\Lpj\Models\JenisLampiran;
|
||||
|
||||
class JenisLampiranController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$jenisLampirans = JenisLampiran::all();
|
||||
return view('lpj::jenis_lampiran.index', compact('jenisLampirans'));
|
||||
}
|
||||
|
||||
public function store(JenisLampiranRequest $request)
|
||||
{
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$validated = $request->validated();
|
||||
$validated['created_by'] = Auth::id();
|
||||
|
||||
$jenisLampiran = JenisLampiran::create($validated);
|
||||
|
||||
DB::commit();
|
||||
return redirect()
|
||||
->route('basicdata.jenis-lampiran.index')
|
||||
->with('success', 'Jenis Lampiran berhasil ditambahkan.');
|
||||
} catch (Exception $e) {
|
||||
DB::rollBack();
|
||||
return redirect()
|
||||
->back()
|
||||
->with('error', 'Gagal menambahkan Jenis Lampiran: ' . $e->getMessage())
|
||||
->withInput();
|
||||
}
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
return view('lpj::jenis_lampiran.create');
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
$jenisLampiran = JenisLampiran::findOrFail($id);
|
||||
return view('lpj::jenis_lampiran.show', compact('jenisLampiran'));
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$jenisLampiran = JenisLampiran::findOrFail($id);
|
||||
return view('lpj::jenis_lampiran.create', compact('jenisLampiran'));
|
||||
}
|
||||
|
||||
public function update(JenisLampiranRequest $request, $id)
|
||||
{
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$jenisLampiran = JenisLampiran::findOrFail($id);
|
||||
$validated = $request->validated();
|
||||
$validated['updated_by'] = Auth::id();
|
||||
|
||||
$jenisLampiran->update($validated);
|
||||
|
||||
DB::commit();
|
||||
return redirect()
|
||||
->route('basicdata.jenis-lampiran.index')
|
||||
->with('success', 'Jenis Lampiran berhasil diperbarui.');
|
||||
} catch (Exception $e) {
|
||||
DB::rollBack();
|
||||
return redirect()
|
||||
->back()
|
||||
->with('error', 'Gagal memperbarui Jenis Lampiran: ' . $e->getMessage())
|
||||
->withInput();
|
||||
}
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$jenisLampiran = JenisLampiran::findOrFail($id);
|
||||
$jenisLampiran->deleted_by = Auth::id();
|
||||
$jenisLampiran->save();
|
||||
|
||||
$jenisLampiran->delete();
|
||||
|
||||
DB::commit();
|
||||
echo json_encode(['success' => true, 'message' => 'Jenis Lampiran berhasil dihapus.']);
|
||||
|
||||
} catch (Exception $e) {
|
||||
DB::rollBack();
|
||||
echo json_encode([
|
||||
'success' => false,
|
||||
'message' => 'Gagal menghapus Jenis Lampiran: ' . $e->getMessage()
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function dataForDatatables(Request $request)
|
||||
{
|
||||
// Retrieve data from the database
|
||||
$query = JenisLampiran::query();
|
||||
|
||||
// Apply search filter if provided
|
||||
if ($request->has('search') && !empty($request->get('search'))) {
|
||||
$search = $request->get('search');
|
||||
$query->where(function ($q) use ($search) {
|
||||
$q->where('nama', 'LIKE', "%$search%")
|
||||
->orWhere('deskripsi', 'LIKE', "%$search%");
|
||||
});
|
||||
}
|
||||
|
||||
// Apply sorting if provided
|
||||
if ($request->has('sortOrder') && !empty($request->get('sortOrder'))) {
|
||||
$order = $request->get('sortOrder');
|
||||
$column = $request->get('sortField');
|
||||
$query->orderBy($column, $order);
|
||||
}
|
||||
|
||||
// Get the total count of records
|
||||
$totalRecords = $query->count();
|
||||
|
||||
// Apply pagination if provided
|
||||
if ($request->has('page') && $request->has('size')) {
|
||||
$page = $request->get('page');
|
||||
$size = $request->get('size');
|
||||
$offset = ($page - 1) * $size; // Calculate the offset
|
||||
|
||||
$query->skip($offset)->take($size);
|
||||
}
|
||||
|
||||
// Get the filtered count of records
|
||||
$filteredRecords = $query->count();
|
||||
|
||||
// Get the data for the current page
|
||||
$data = $query->get();
|
||||
|
||||
// Calculate the page count
|
||||
$pageCount = ceil($totalRecords / $request->get('size'));
|
||||
|
||||
// Calculate the current page number
|
||||
$currentPage = $request->get('page', 1);
|
||||
|
||||
// Return the response data as a JSON object
|
||||
return response()->json([
|
||||
'draw' => $request->get('draw'),
|
||||
'recordsTotal' => $totalRecords,
|
||||
'recordsFiltered' => $filteredRecords,
|
||||
'pageCount' => $pageCount,
|
||||
'page' => $currentPage,
|
||||
'totalCount' => $totalRecords,
|
||||
'data' => $data,
|
||||
]);
|
||||
}
|
||||
|
||||
public function export()
|
||||
{
|
||||
if (is_null($this->user) || !$this->user->can('jenis_lampiran.export')) {
|
||||
abort(403, 'Sorry! You are not allowed to export jenis lampiran.');
|
||||
}
|
||||
|
||||
return Excel::download(new JenisLampiranExport, 'jenis_lampiran.xlsx');
|
||||
}
|
||||
}
|
||||
@@ -18,10 +18,11 @@
|
||||
public function upload(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'permohonan_id' => 'required|exists:permohonan,id',
|
||||
'nama_file' => 'nullable|string|max:255',
|
||||
'file' => 'required|file|max:10240',
|
||||
'keterangan' => 'nullable|string|max:255',
|
||||
'permohonan_id' => 'required|exists:permohonan,id',
|
||||
'jenis_lampiran_id' => 'required|exists:jenis_lampiran,id',
|
||||
'nama_file' => 'nullable|string|max:255',
|
||||
'file' => 'required|file|max:10240',
|
||||
'keterangan' => 'nullable|string|max:255',
|
||||
]);
|
||||
|
||||
$lampiran = LampiranDokumen::uploadLampiran($request->all());
|
||||
|
||||
@@ -437,10 +437,10 @@ class PenilaianController extends Controller
|
||||
$header = $headers[$type] ?? 'Pelaporan';
|
||||
$authorization = null;
|
||||
if ($header === 'SLA') {
|
||||
$authorization = Authorization::with(['user'])->find($id);
|
||||
$permohonan = Permohonan::find($authorization->permohonan_id);
|
||||
$authorization = Authorization::with(['user','permohonan.lampiranDokumen.jenisLampiran'])->find($id);
|
||||
$permohonan = Permohonan::with(['lampiranDokumen.jenisLampiran'])->find($authorization->permohonan_id);
|
||||
} else {
|
||||
$permohonan = Permohonan::find($id);
|
||||
$permohonan = Permohonan::with(['lampiranDokumen.jenisLampiran'])->find($id);
|
||||
}
|
||||
if ($header === 'SLA') {
|
||||
return view('lpj::penilaian.otorisator.sla', compact('permohonan', 'header', 'authorization'));
|
||||
|
||||
54
app/Http/Requests/JenisLampiranRequest.php
Normal file
54
app/Http/Requests/JenisLampiranRequest.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class JenisLampiranRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
$rules = [
|
||||
'nama' => [
|
||||
'required',
|
||||
'string',
|
||||
'max:255',
|
||||
Rule::unique('jenis_lampiran')->where(function ($query) {
|
||||
return $query->whereNull('deleted_at');
|
||||
})->ignore($this->route('jenis_lampiran')),
|
||||
],
|
||||
'deskripsi' => 'nullable|string',
|
||||
];
|
||||
|
||||
return $rules;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get custom messages for validator errors.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function messages()
|
||||
{
|
||||
return [
|
||||
'nama.required' => 'Nama jenis lampiran harus diisi.',
|
||||
'nama.max' => 'Nama jenis lampiran tidak boleh lebih dari 255 karakter.',
|
||||
];
|
||||
}
|
||||
}
|
||||
20
app/Models/JenisLampiran.php
Normal file
20
app/Models/JenisLampiran.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Modules\Lpj\Models\Base;
|
||||
use Modules\Lpj\Models\LampiranDokumen;
|
||||
|
||||
class JenisLampiran extends Base
|
||||
{
|
||||
|
||||
protected $table = 'jenis_lampiran';
|
||||
protected $fillable = ['nama', 'deskripsi'];
|
||||
|
||||
public function lampiranDokumen()
|
||||
{
|
||||
return $this->hasMany(LampiranDokumen::class);
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@ class LampiranDokumen extends Base
|
||||
{
|
||||
protected $table = 'lampiran_dokumen';
|
||||
|
||||
protected $fillable = ['permohonan_id', 'nama_file', 'path_file', 'keterangan'];
|
||||
protected $fillable = ['permohonan_id', 'nama_file', 'path_file', 'keterangan','jenis_lampiran_id'];
|
||||
|
||||
public function permohonan()
|
||||
{
|
||||
@@ -34,6 +34,7 @@ class LampiranDokumen extends Base
|
||||
|
||||
return self::create([
|
||||
'permohonan_id' => $fileData['permohonan_id'] ?? null,
|
||||
'jenis_lampiran_id' => $fileData['jenis_lampiran_id'] ?? null,
|
||||
'nama_file' => $fileName,
|
||||
'path_file' => $filePath,
|
||||
'keterangan' => $fileData['keterangan'] ?? null,
|
||||
@@ -62,4 +63,9 @@ class LampiranDokumen extends Base
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function jenisLampiran()
|
||||
{
|
||||
return $this->belongsTo(JenisLampiran::class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('jenis_lampiran', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('nama');
|
||||
$table->text('deskripsi')->nullable();
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
$table->unsignedBigInteger('created_by')->nullable();
|
||||
$table->unsignedBigInteger('updated_by')->nullable();
|
||||
$table->unsignedBigInteger('deleted_by')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('jenis_lampiran');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Modules\Lpj\Models\JenisLampiran;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('lampiran_dokumen', function (Blueprint $table) {
|
||||
$table->foreignIdFor(JenisLampiran::class)->constrained('jenis_lampiran')->onDelete('cascade')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('lampiran_dokumen', function (Blueprint $table) {
|
||||
$table->dropForeign(['jenis_lampiran_id']);
|
||||
$table->dropColumn('jenis_lampiran_id');
|
||||
});
|
||||
}
|
||||
};
|
||||
11
module.json
11
module.json
@@ -880,6 +880,17 @@
|
||||
"administrator",
|
||||
"admin"
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "Jenis Lampiran",
|
||||
"path": "basicdata.jenis-lampiran",
|
||||
"classes": "",
|
||||
"attributes": [],
|
||||
"permission": "",
|
||||
"roles": [
|
||||
"administrator",
|
||||
"admin"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -93,71 +93,7 @@
|
||||
@endforeach
|
||||
@endif
|
||||
|
||||
<!-- New section for Lampiran Dokumen -->
|
||||
<div class="card border border-agi-100 min-w-full mt-5">
|
||||
<div class="card-header light:bg-agi-50">
|
||||
<h3 class="card-title">
|
||||
Lampiran Dokumen
|
||||
</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
|
||||
@forelse($permohonan->lampiranDokumen as $lampiran)
|
||||
<div class="border p-4 rounded-lg">
|
||||
<h4 class="font-semibold mb-2">{{ $lampiran->nama_file }}</h4>
|
||||
<p class="text-sm text-gray-600 mb-2">Keterangan : {{ $lampiran->keterangan }}</p>
|
||||
<div class="flex justify-between items-center">
|
||||
<div>
|
||||
<a href="{{ Storage::url($lampiran->path_file) }}" target="_blank" class="text-blue-600 hover:underline">
|
||||
<i class="ki-filled ki-eye mr-2"></i>View
|
||||
</a>
|
||||
<a href="{{ Storage::url($lampiran->path_file) }}" download="{{ Storage::url($lampiran->path_file) }}" class="text-green-600 hover:underline ml-4">
|
||||
<i class="ki-filled ki-cloud-download mr-2"></i>Download
|
||||
</a>
|
||||
</div>
|
||||
@if(Auth::user()->hasRole('administrator'))
|
||||
<form action="{{ route('lampiran.delete', $lampiran->id) }}" method="POST" onsubmit="return confirm('Are you sure you want to delete this lampiran?');">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
<button type="submit" class="text-red-600 hover:underline">
|
||||
<i class="ki-filled ki-trash mr-2"></i>Delete
|
||||
</button>
|
||||
</form>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
@empty
|
||||
<p class="col-span-3 text-center text-gray-500">Tidak ada lampiran dokumen.</p>
|
||||
@endforelse
|
||||
</div>
|
||||
|
||||
@if(Auth::user()->hasRole(['Penilai', 'administrator','penilai','admin']))
|
||||
<form action="{{ route('lampiran.upload',) }}" method="POST" enctype="multipart/form-data" class="mt-6">
|
||||
@csrf
|
||||
<input type="hidden" name="permohonan_id" value="{{ $permohonan->id }}">
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
<div>
|
||||
<label for="nama_file" class="block text-sm font-medium text-gray-700">Nama File</label>
|
||||
<input type="text" name="nama_file" id="nama_file" required class="input mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm sm:text-sm border-gray-300 rounded-md">
|
||||
</div>
|
||||
<div>
|
||||
<label for="file" class=" block text-sm font-medium text-gray-700">File</label>
|
||||
<input type="file" name="file" id="file" required class="file-input mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm sm:text-sm border-gray-300 rounded-md">
|
||||
</div>
|
||||
<div class="md:col-span-2">
|
||||
<label for="keterangan" class="block text-sm font-medium text-gray-700">Keterangan</label>
|
||||
<textarea name="keterangan" id="keterangan" rows="3" class="textarea mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm sm:text-sm border-gray-300 rounded-md"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-4">
|
||||
<button type="submit" class="inline-flex justify-center py-2 px-4 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">
|
||||
Upload Lampiran
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
@include('lpj::component.lampiran-dokumen')
|
||||
|
||||
<div class="card border border-agi-100 grow" id="activity_2024">
|
||||
@include('lpj::component.history-permohonan')
|
||||
|
||||
@@ -352,72 +352,7 @@
|
||||
@if (!isset($status))
|
||||
</div>
|
||||
|
||||
<!-- New section for Lampiran Dokumen -->
|
||||
<div class="card border border-agi-100 min-w-full mt-5">
|
||||
<div class="card-header light:bg-agi-50">
|
||||
<h3 class="card-title">
|
||||
Lampiran Dokumen
|
||||
</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
|
||||
@forelse($permohonan->lampiranDokumen as $lampiran)
|
||||
<div class="border p-4 rounded-lg">
|
||||
<h4 class="font-semibold mb-2">{{ $lampiran->nama_file }}</h4>
|
||||
<p class="text-sm text-gray-600 mb-2">Keterangan : {{ $lampiran->keterangan }}</p>
|
||||
<div class="flex justify-between items-center">
|
||||
<div>
|
||||
<a href="{{ Storage::url($lampiran->path_file) }}" target="_blank" class="text-blue-600 hover:underline">
|
||||
<i class="ki-filled ki-eye mr-2"></i>View
|
||||
</a>
|
||||
<a href="{{ Storage::url($lampiran->path_file) }}" download="{{ Storage::url($lampiran->path_file) }}" class="text-green-600 hover:underline ml-4">
|
||||
<i class="ki-filled ki-cloud-download mr-2"></i>Download
|
||||
</a>
|
||||
</div>
|
||||
@if(Auth::user()->hasRole('administrator'))
|
||||
<form action="{{ route('lampiran.delete', $lampiran->id) }}" method="POST" onsubmit="return confirm('Are you sure you want to delete this lampiran?');">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
<button type="submit" class="text-red-600 hover:underline">
|
||||
<i class="ki-filled ki-trash mr-2"></i>Delete
|
||||
</button>
|
||||
</form>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
@empty
|
||||
<p class="col-span-3 text-center text-gray-500">Tidak ada lampiran dokumen.</p>
|
||||
@endforelse
|
||||
</div>
|
||||
|
||||
@if(Auth::user()->hasRole(['Penilai', 'administrator','penilai','admin','surveyor']))
|
||||
<form action="{{ route('lampiran.upload',) }}" method="POST" enctype="multipart/form-data" class="mt-6">
|
||||
@csrf
|
||||
<input type="hidden" name="permohonan_id" value="{{ $permohonan->id }}">
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
<div>
|
||||
<label for="nama_file" class="block text-sm font-medium text-gray-700">Nama File</label>
|
||||
<input type="text" name="nama_file" id="nama_file" required class="input mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm sm:text-sm border-gray-300 rounded-md">
|
||||
</div>
|
||||
<div>
|
||||
<label for="file" class=" block text-sm font-medium text-gray-700">File</label>
|
||||
<input type="file" name="file" id="file" required class="file-input mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm sm:text-sm border-gray-300 rounded-md">
|
||||
</div>
|
||||
<div class="md:col-span-2">
|
||||
<label for="keterangan" class="block text-sm font-medium text-gray-700">Keterangan</label>
|
||||
<textarea name="keterangan" id="keterangan" rows="3" class="textarea mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm sm:text-sm border-gray-300 rounded-md"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-4">
|
||||
<button type="submit" class="inline-flex justify-center py-2 px-4 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">
|
||||
Upload Lampiran
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@include('lpj::component.lampiran-dokumen')
|
||||
@include('lpj::component.history-permohonan')
|
||||
|
||||
|
||||
|
||||
75
resources/views/component/lampiran-dokumen.blade.php
Normal file
75
resources/views/component/lampiran-dokumen.blade.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<!-- New section for Lampiran Dokumen -->
|
||||
<div class="card border border-agi-100 min-w-full mt-5">
|
||||
<div class="card-header light:bg-agi-50">
|
||||
<h3 class="card-title">
|
||||
Lampiran Dokumen
|
||||
</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
|
||||
@forelse($permohonan->lampiranDokumen as $lampiran)
|
||||
<div class="border p-4 rounded-lg">
|
||||
<h4 class="font-semibold mb-2">{{ $lampiran->nama_file }}</h4>
|
||||
<p class="text-sm text-gray-600 mb-2">Keterangan : {{ $lampiran->keterangan }}</p>
|
||||
<p class="text-sm text-gray-600 mb-2 capitalize">Jenis Lampiran : {{ str_replace('-',' ',$lampiran->jenisLampiran->nama) }}</p>
|
||||
<div class="flex justify-between items-center">
|
||||
<div>
|
||||
<a href="{{ Storage::url($lampiran->path_file) }}" target="_blank" class="text-blue-600 hover:underline">
|
||||
<i class="ki-filled ki-eye mr-2"></i>View
|
||||
</a>
|
||||
<a href="{{ Storage::url($lampiran->path_file) }}" download="{{ Storage::url($lampiran->path_file) }}" class="text-green-600 hover:underline ml-4">
|
||||
<i class="ki-filled ki-cloud-download mr-2"></i>Download
|
||||
</a>
|
||||
</div>
|
||||
@if(Auth::user()->hasRole('administrator'))
|
||||
<form action="{{ route('lampiran.delete', $lampiran->id) }}" method="POST" onsubmit="return confirm('Are you sure you want to delete this lampiran?');">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
<button type="submit" class="text-red-600 hover:underline">
|
||||
<i class="ki-filled ki-trash mr-2"></i>Delete
|
||||
</button>
|
||||
</form>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
@empty
|
||||
<p class="col-span-3 text-center text-gray-500">Tidak ada lampiran dokumen.</p>
|
||||
@endforelse
|
||||
</div>
|
||||
|
||||
@if(Auth::user()->hasRole(['Penilai', 'administrator','penilai','admin','surveyor']))
|
||||
<form action="{{ route('lampiran.upload') }}" method="POST" enctype="multipart/form-data" class="mt-6">
|
||||
@csrf
|
||||
<input type="hidden" name="permohonan_id" value="{{ $permohonan->id }}">
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
<div>
|
||||
<label for="nama_file" class="block text-sm font-medium text-gray-700">Nama File</label>
|
||||
<input type="text" name="nama_file" id="nama_file" required class="input mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm sm:text-sm border-gray-300 rounded-md">
|
||||
</div>
|
||||
<div>
|
||||
<label for="file" class="block text-sm font-medium text-gray-700">File</label>
|
||||
<input type="file" name="file" id="file" required class="file-input mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm sm:text-sm border-gray-300 rounded-md">
|
||||
</div>
|
||||
<div>
|
||||
<label for="jenis_lampiran_id" class="block text-sm font-medium text-gray-700">Jenis Lampiran</label>
|
||||
<select name="jenis_lampiran_id" id="jenis_lampiran_id" required class="tomselect mt-1 block w-full py-2 px-3 border border-gray-300 bg-white rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm">
|
||||
<option value="">Pilih Jenis Lampiran</option>
|
||||
@foreach(\Modules\Lpj\Models\JenisLampiran::all() as $jenisLampiran)
|
||||
<option value="{{ $jenisLampiran->id }}">{{ $jenisLampiran->nama }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div class="md:col-span-2">
|
||||
<label for="keterangan" class="block text-sm font-medium text-gray-700">Keterangan</label>
|
||||
<textarea name="keterangan" id="keterangan" rows="3" class="textarea mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm sm:text-sm border-gray-300 rounded-md"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-4">
|
||||
<button type="submit" class="inline-flex justify-center py-2 px-4 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">
|
||||
Upload Lampiran
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
62
resources/views/jenis_lampiran/create.blade.php
Normal file
62
resources/views/jenis_lampiran/create.blade.php
Normal file
@@ -0,0 +1,62 @@
|
||||
@extends('layouts.main')
|
||||
|
||||
@section('breadcrumbs')
|
||||
@if(isset($jenisLampiran->id))
|
||||
{{ Breadcrumbs::render(request()->route()->getName(),$jenisLampiran->id) }}
|
||||
@else
|
||||
{{ Breadcrumbs::render(request()->route()->getName()) }}
|
||||
@endif
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<div class="w-full grid gap-5 lg:gap-7.5 mx-auto">
|
||||
@if(isset($jenisLampiran->id))
|
||||
<form action="{{ route('basicdata.jenis-lampiran.update', $jenisLampiran->id) }}" method="POST">
|
||||
<input type="hidden" name="id" value="{{ $jenisLampiran->id }}">
|
||||
@method('PUT')
|
||||
@else
|
||||
<form method="POST" action="{{ route('basicdata.jenis-lampiran.store') }}">
|
||||
@endif
|
||||
@csrf
|
||||
<div class="card border border-agi-100 pb-2.5">
|
||||
<div class="card-header bg-agi-50" id="basic_settings">
|
||||
<h3 class="card-title">
|
||||
{{ isset($jenisLampiran->id) ? 'Edit' : 'Tambah' }} Jenis Lampiran
|
||||
</h3>
|
||||
<div class="flex items-center gap-2">
|
||||
<a href="{{ route('basicdata.jenis-lampiran.index') }}" class="btn btn-xs btn-info"><i class="ki-filled ki-exit-left"></i> Back</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body grid gap-5">
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||
<label class="form-label max-w-56">
|
||||
Nama
|
||||
</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<input class="input @error('nama') border-danger bg-danger-light @enderror" type="text" name="nama" value="{{ $jenisLampiran->nama ?? old('nama') }}">
|
||||
@error('nama')
|
||||
<em class="alert text-danger text-sm">{{ $message }}</em>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||
<label class="form-label max-w-56">
|
||||
Deskripsi
|
||||
</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<textarea class="textarea @error('deskripsi') border-danger bg-danger-light @enderror" name="deskripsi" rows="3">{{ $jenisLampiran->deskripsi ?? old('deskripsi') }}</textarea>
|
||||
@error('deskripsi')
|
||||
<em class="alert text-danger text-sm">{{ $message }}</em>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex justify-end">
|
||||
<button type="submit" class="btn btn-primary">
|
||||
Save
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@endsection
|
||||
145
resources/views/jenis_lampiran/index.blade.php
Normal file
145
resources/views/jenis_lampiran/index.blade.php
Normal file
@@ -0,0 +1,145 @@
|
||||
@extends('layouts.main')
|
||||
|
||||
@section('breadcrumbs')
|
||||
{{ Breadcrumbs::render('basicdata.jenis-lampiran') }}
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<div class="grid">
|
||||
<div class="card border border-agi-100 card-grid min-w-full" data-datatable="false" data-datatable-page-size="10" data-datatable-state-save="false" id="jenis-lampiran-table" data-api-url="{{ route('basicdata.jenis-lampiran.datatables') }}">
|
||||
<div class="card-header bg-agi-50 py-5 flex-wrap">
|
||||
<h3 class="card-title">
|
||||
Daftar Jenis Lampiran
|
||||
</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 Jenis Lampiran" 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('basicdata.jenis-lampiran.export') }}"> Export to Excel </a>
|
||||
<a class="btn btn-sm btn-primary" href="{{ route('basicdata.jenis-lampiran.create') }}"> Tambah Jenis Lampiran </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-[250px]" data-datatable-column="nama">
|
||||
<span class="sort"> <span class="sort-label"> Nama </span>
|
||||
<span class="sort-icon"> </span> </span>
|
||||
</th>
|
||||
<th class="min-w-[250px]" data-datatable-column="deskripsi">
|
||||
<span class="sort"> <span class="sort-label"> Deskripsi </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>
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<script type="text/javascript">
|
||||
function deleteData(data) {
|
||||
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, delete it!'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
$.ajaxSetup({
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
||||
}
|
||||
});
|
||||
|
||||
$.ajax(`basic-data/jenis-lampiran/${data}`, {
|
||||
type: 'DELETE'
|
||||
}).then((response) => {
|
||||
swal.fire('Deleted!', 'Jenis Lampiran has been deleted.', 'success').then(() => {
|
||||
window.location.reload();
|
||||
});
|
||||
}).catch((error) => {
|
||||
console.error('Error:', error);
|
||||
Swal.fire('Error!', 'An error occurred while deleting the jenis lampiran.', 'error');
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
<script type="module">
|
||||
const element = document.querySelector('#jenis-lampiran-table');
|
||||
const searchInput = document.getElementById('search');
|
||||
|
||||
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();
|
||||
},
|
||||
},
|
||||
nama: {
|
||||
title: 'Nama',
|
||||
},
|
||||
deskripsi: {
|
||||
title: 'Deskripsi',
|
||||
},
|
||||
actions: {
|
||||
title: 'Action',
|
||||
render: (item, data) => {
|
||||
return `<div class="flex flex-nowrap justify-center">
|
||||
<a class="btn btn-sm btn-icon btn-clear btn-info" href="basic-data/jenis-lampiran/${data.id}/edit">
|
||||
<i class="ki-outline ki-notepad-edit"></i>
|
||||
</a>
|
||||
<a onclick="deleteData(${data.id})" class="delete btn btn-sm btn-icon btn-clear btn-danger">
|
||||
<i class="ki-outline ki-trash"></i>
|
||||
</a>
|
||||
</div>`;
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
let dataTable = new KTDataTable(element, dataTableOptions);
|
||||
// Custom search functionality
|
||||
searchInput.addEventListener('input', function () {
|
||||
const searchValue = this.value.trim();
|
||||
dataTable.search(searchValue, true);
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
@@ -82,18 +82,18 @@
|
||||
{{ $authorization->keterangan ?? '' }}
|
||||
<table class="table table-border">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Pemohon</td>
|
||||
<td>{{ $authorization->user->name }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Alasan</td>
|
||||
<td>{{ $authorization->keterangan }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Tanggal Permohonan</td>
|
||||
<td>{{ formatTanggalIndonesia($authorization->created_at, 1) }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Pemohon</td>
|
||||
<td>{{ $authorization->user->name }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Alasan</td>
|
||||
<td>{{ $authorization->keterangan }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Tanggal Permohonan</td>
|
||||
<td>{{ formatTanggalIndonesia($authorization->created_at, 1) }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@@ -116,28 +116,28 @@
|
||||
<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>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>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>
|
||||
@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
|
||||
@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>
|
||||
@@ -161,14 +161,14 @@
|
||||
|
||||
@if ($dataHeader == 'pelaporan')
|
||||
<a class="btn btn-success"
|
||||
href="{{ route('otorisator.view-laporan') }}?permohonanId={{ $permohonan->id }}&documentId={{ $documentId }}&inspeksiId={{ $inspeksiId }}&jaminanId={{ $jenisJaminanId }}&statusLpj={{ true }}">
|
||||
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 }}, 'SO')" type="button"
|
||||
class="btn btn-primary">
|
||||
class="btn btn-primary">
|
||||
<i class="ki-filled ki-double-check"></i>
|
||||
Otorisasi {{ $header ?? '' }}
|
||||
</button>
|
||||
@@ -178,7 +178,7 @@
|
||||
$authorization->approve_so &&
|
||||
$authorization->approve_eo == null)
|
||||
<button onclick="otorisatorData({{ $authorization->id }}, 'EO')" type="button"
|
||||
class="btn btn-primary">
|
||||
class="btn btn-primary">
|
||||
<i class="ki-filled ki-double-check"></i>
|
||||
Otorisasi {{ $header ?? '' }}
|
||||
</button>
|
||||
@@ -189,117 +189,135 @@
|
||||
$authorization->approve_dd == null &&
|
||||
in_array($permohonan->nilai_plafond_id, [1, 4]))
|
||||
<button onclick="otorisatorData({{ $authorization->id }}, 'DD')" type="button"
|
||||
class="btn btn-primary">
|
||||
class="btn btn-primary">
|
||||
<i class="ki-filled ki-double-check"></i>
|
||||
Otorisasi {{ $header ?? '' }}
|
||||
</button>
|
||||
@endif
|
||||
|
||||
@if (
|
||||
(Auth::user()->hasAnyRole(['administrator', 'senior-officer']) &&
|
||||
$authorization->approve_so != null &&
|
||||
$authorization->approve_eo != null) ||
|
||||
$authorization->approve_dd != null)
|
||||
<button onclick="otorisatorData({{ $authorization->id }}, 'UNFREZE')" type="button"
|
||||
class="btn btn-primary">
|
||||
<i class="ki-filled ki-double-check"></i>
|
||||
Otorisasi Un{{ $header ?? '' }}
|
||||
</button>
|
||||
(Auth::user()->hasAnyRole(['administrator', 'senior-officer']) &&
|
||||
$authorization->approve_so != null &&
|
||||
$authorization->approve_eo != null) ||
|
||||
$authorization->approve_dd != null
|
||||
)
|
||||
@php
|
||||
$memoDeviasiExists = false;
|
||||
if ($authorization->permohonan && $authorization->permohonan->lampiranDokumen) {
|
||||
$memoDeviasiExists = $authorization->permohonan->lampiranDokumen()
|
||||
->whereHas('jenisLampiran', function($query) {
|
||||
$query->where('nama', 'memo-deviasi');
|
||||
})
|
||||
->exists();
|
||||
}
|
||||
@endphp
|
||||
|
||||
@if ($memoDeviasiExists)
|
||||
<button onclick="otorisatorData({{ $authorization->id }}, 'UNFREZE')" type="button"
|
||||
class="btn btn-primary">
|
||||
<i class="ki-filled ki-double-check"></i>
|
||||
Otorisasi Un{{ $header ?? '' }}
|
||||
</button>
|
||||
@else
|
||||
<span class="badge badge-warning">
|
||||
Memo Deviasi Belum Ada
|
||||
</span>
|
||||
@endif
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<script>
|
||||
const handleRejection = (dataId, dataHeader = '') => {
|
||||
Swal.fire({
|
||||
title: 'Masukkan alasan penolakan:',
|
||||
input: 'textarea',
|
||||
inputPlaceholder: 'Tuliskan alasan...',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#f39c12',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: 'Kirim',
|
||||
cancelButtonText: 'Batal',
|
||||
preConfirm: (alasan) => {
|
||||
if (!alasan) {
|
||||
Swal.showValidationMessage('Alasan harus diisi!');
|
||||
return false;
|
||||
@push('scripts')
|
||||
<script>
|
||||
const handleRejection = (dataId, dataHeader = '') => {
|
||||
Swal.fire({
|
||||
title: 'Masukkan alasan penolakan:',
|
||||
input: 'textarea',
|
||||
inputPlaceholder: 'Tuliskan alasan...',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#f39c12',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: 'Kirim',
|
||||
cancelButtonText: 'Batal',
|
||||
preConfirm: (alasan) => {
|
||||
if (!alasan) {
|
||||
Swal.showValidationMessage('Alasan harus diisi!');
|
||||
return false;
|
||||
}
|
||||
return alasan;
|
||||
}
|
||||
return alasan;
|
||||
}).then((rejectResult) => {
|
||||
if (rejectResult.isConfirmed) {
|
||||
handleAjaxRequest(
|
||||
`/otorisator/revisi-laporan/${dataId}`, {
|
||||
keterangan: rejectResult.value,
|
||||
dataHeader: dataHeader
|
||||
},
|
||||
'Data berhasil ditolak.',
|
||||
'Terjadi kesalahan saat melakukan penolakan.'
|
||||
);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const showSwalConfirmation = (
|
||||
title, text, html, confirmText, denyText, cancelText, preConfirm, icon = 'question'
|
||||
) => {
|
||||
return Swal.fire({
|
||||
title: title,
|
||||
text: text,
|
||||
html: html,
|
||||
icon: icon,
|
||||
focusConfirm: false,
|
||||
preConfirm: preConfirm,
|
||||
showCancelButton: true,
|
||||
showDenyButton: !!denyText,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
denyButtonColor: '#f39c12',
|
||||
confirmButtonText: confirmText,
|
||||
denyButtonText: denyText,
|
||||
cancelButtonText: cancelText,
|
||||
});
|
||||
};
|
||||
|
||||
const handleAjaxRequest = (url, data, successMessage, errorMessage) => {
|
||||
$.ajaxSetup({
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
||||
},
|
||||
});
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: 'POST',
|
||||
data: data,
|
||||
success: () => {
|
||||
Swal.fire('Berhasil!', successMessage, 'success').then(() => {
|
||||
const redirectUrl = `/otorisator/sla`;
|
||||
window.location.href = redirectUrl;
|
||||
});
|
||||
},
|
||||
error: (error) => {
|
||||
console.error('Error:', error);
|
||||
Swal.fire('Gagal!', errorMessage, 'error');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
function otorisatorData(dataId, role = '') {
|
||||
let dataHeader = @json($header);
|
||||
|
||||
// Update dataHeader if condition matches
|
||||
if (dataHeader === 'Freze SLA' && (role === 'UNFREZE' || role === 'FREZE')) {
|
||||
dataHeader = 'Unfreeze SLA';
|
||||
}
|
||||
}).then((rejectResult) => {
|
||||
if (rejectResult.isConfirmed) {
|
||||
handleAjaxRequest(
|
||||
`/otorisator/revisi-laporan/${dataId}`, {
|
||||
keterangan: rejectResult.value,
|
||||
dataHeader: dataHeader
|
||||
},
|
||||
'Data berhasil ditolak.',
|
||||
'Terjadi kesalahan saat melakukan penolakan.'
|
||||
);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const showSwalConfirmation = (
|
||||
title, text, html, confirmText, denyText, cancelText, preConfirm, icon = 'question'
|
||||
) => {
|
||||
return Swal.fire({
|
||||
title: title,
|
||||
text: text,
|
||||
html: html,
|
||||
icon: icon,
|
||||
focusConfirm: false,
|
||||
preConfirm: preConfirm,
|
||||
showCancelButton: true,
|
||||
showDenyButton: !!denyText,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
denyButtonColor: '#f39c12',
|
||||
confirmButtonText: confirmText,
|
||||
denyButtonText: denyText,
|
||||
cancelButtonText: cancelText,
|
||||
});
|
||||
};
|
||||
const isPaparanSO = dataHeader === 'Unfreeze SLA' && role === 'UNFREZE';
|
||||
const hideDenyButton = (dataHeader === 'Unfreeze SLA' && (role === 'UNFREZE' || role === 'FREZE'));
|
||||
|
||||
const handleAjaxRequest = (url, data, successMessage, errorMessage) => {
|
||||
$.ajaxSetup({
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
||||
},
|
||||
});
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: 'POST',
|
||||
data: data,
|
||||
success: () => {
|
||||
Swal.fire('Berhasil!', successMessage, 'success').then(() => {
|
||||
const redirectUrl = `/otorisator/sla`;
|
||||
window.location.href = redirectUrl;
|
||||
});
|
||||
},
|
||||
error: (error) => {
|
||||
console.error('Error:', error);
|
||||
Swal.fire('Gagal!', errorMessage, 'error');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
function otorisatorData(dataId, role = '') {
|
||||
let dataHeader = @json($header);
|
||||
|
||||
// Update dataHeader if condition matches
|
||||
if (dataHeader === 'Freze SLA' && (role === 'UNFREZE' || role === 'FREZE')) {
|
||||
dataHeader = 'Unfreeze SLA';
|
||||
}
|
||||
|
||||
const isPaparanSO = dataHeader === 'Unfreeze SLA' && role === 'UNFREZE';
|
||||
const hideDenyButton = (dataHeader === 'Unfreeze SLA' && (role === 'UNFREZE' || role === 'FREZE'));
|
||||
|
||||
const swalHtml = isPaparanSO ? `
|
||||
const swalHtml = isPaparanSO ? `
|
||||
<div class="text-left space-y-4">
|
||||
<p class="text-gray-700 text-center">Untuk melakukan otorisasi ${dataHeader}!</p>
|
||||
<div>
|
||||
@@ -307,50 +325,50 @@
|
||||
</div>
|
||||
</div>` : '';
|
||||
|
||||
showSwalConfirmation(
|
||||
'Apakah Anda yakin?',
|
||||
`Untuk melakukan otorisasi ${dataHeader}!`,
|
||||
swalHtml,
|
||||
'Ya, Lanjutkan!',
|
||||
hideDenyButton ? null : 'Tolak',
|
||||
'Batal',
|
||||
() => {
|
||||
if (isPaparanSO) {
|
||||
const message = document.getElementById('swal-keterangan')?.value;
|
||||
showSwalConfirmation(
|
||||
'Apakah Anda yakin?',
|
||||
`Untuk melakukan otorisasi ${dataHeader}!`,
|
||||
swalHtml,
|
||||
'Ya, Lanjutkan!',
|
||||
hideDenyButton ? null : 'Tolak',
|
||||
'Batal',
|
||||
() => {
|
||||
if (isPaparanSO) {
|
||||
const message = document.getElementById('swal-keterangan')?.value;
|
||||
|
||||
if (!message) {
|
||||
Swal.showValidationMessage('Keterangan harus diisi!');
|
||||
return false;
|
||||
if (!message) {
|
||||
Swal.showValidationMessage('Keterangan harus diisi!');
|
||||
return false;
|
||||
}
|
||||
|
||||
return {
|
||||
message,
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
message: 'Ya, lanjutkan.'
|
||||
};
|
||||
}
|
||||
},
|
||||
'question'
|
||||
).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
const requestData = isPaparanSO ? {
|
||||
keterangan: result.value.message,
|
||||
} : {
|
||||
keterangan: result.value.message
|
||||
};
|
||||
|
||||
return {
|
||||
message,
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
message: 'Ya, lanjutkan.'
|
||||
};
|
||||
handleAjaxRequest(
|
||||
`/otorisator/otorisator/${dataId}/${dataHeader}`,
|
||||
requestData,
|
||||
'Data berhasil diotorisasi.',
|
||||
'Terjadi kesalahan saat melakukan otorisasi.'
|
||||
);
|
||||
} else if (!hideDenyButton && result.isDenied) {
|
||||
handleRejection(dataId, dataHeader);
|
||||
}
|
||||
},
|
||||
'question'
|
||||
).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
const requestData = isPaparanSO ? {
|
||||
keterangan: result.value.message,
|
||||
} : {
|
||||
keterangan: result.value.message
|
||||
};
|
||||
|
||||
handleAjaxRequest(
|
||||
`/otorisator/otorisator/${dataId}/${dataHeader}`,
|
||||
requestData,
|
||||
'Data berhasil diotorisasi.',
|
||||
'Terjadi kesalahan saat melakukan otorisasi.'
|
||||
);
|
||||
} else if (!hideDenyButton && result.isDenied) {
|
||||
handleRejection(dataId, dataHeader);
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
});
|
||||
}
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
@@ -699,5 +699,20 @@ Breadcrumbs::for('noc', function (BreadcrumbTrail $trail) {
|
||||
$trail->push('Data Laporan External');
|
||||
});
|
||||
|
||||
Breadcrumbs::for('basicdata.jenis-lampiran', function (BreadcrumbTrail $trail) {
|
||||
$trail->parent('basicdata');
|
||||
$trail->push('Jenis Lampiran', route('basicdata.jenis-lampiran.index'));
|
||||
});
|
||||
|
||||
Breadcrumbs::for('basicdata.jenis-lampiran.create', function (BreadcrumbTrail $trail) {
|
||||
$trail->parent('basicdata.jenis-lampiran');
|
||||
$trail->push('Tambah Jenis Lampiran', route('basicdata.jenis-lampiran.create'));
|
||||
});
|
||||
|
||||
Breadcrumbs::for('basicdata.jenis-lampiran.edit', function (BreadcrumbTrail $trail, $id) {
|
||||
$trail->parent('basicdata.jenis-lampiran');
|
||||
$trail->push('Edit Jenis Lampiran', route('basicdata.jenis-lampiran.edit', $id));
|
||||
});
|
||||
|
||||
// add andy
|
||||
require __DIR__ . '/breadcrumbs_registrasi.php';
|
||||
|
||||
@@ -12,7 +12,8 @@ use Modules\Lpj\Http\Controllers\IjinUsahaController;
|
||||
use Modules\Lpj\Http\Controllers\JenisDokumenController;
|
||||
use Modules\Lpj\Http\Controllers\JenisFasilitasKreditController;
|
||||
use Modules\Lpj\Http\Controllers\JenisJaminanController;
|
||||
use Modules\Lpj\Http\Controllers\JenisLaporanController;
|
||||
use Modules\Lpj\Http\Controllers\JenisLampiranController;
|
||||
use Modules\Lpj\Http\Controllers\JenisLaporanController;
|
||||
use Modules\Lpj\Http\Controllers\JenisLegalitasJaminanController;
|
||||
use Modules\Lpj\Http\Controllers\JenisPenilaianController;
|
||||
use Modules\Lpj\Http\Controllers\KJPPController;
|
||||
@@ -55,6 +56,12 @@ Route::middleware(['auth'])->group(function () {
|
||||
|
||||
Route::name('basicdata.')->prefix('basic-data')->group(function () {
|
||||
|
||||
Route::name('jenis-lampiran.')->prefix('jenis-lampiran')->group(function () {
|
||||
Route::get('datatables', [JenisLampiranController::class, 'dataForDatatables'])->name('datatables');
|
||||
Route::get('export', [JenisLampiranController::class, 'export'])->name('export');
|
||||
});
|
||||
Route::resource('jenis-lampiran', JenisLampiranController::class);
|
||||
|
||||
Route::name('custom-field.')->prefix('custom-field')->group(function () {
|
||||
Route::get('restore/{id}', [CustomFieldController::class, 'restore'])->name('restore');
|
||||
Route::get('datatables', [CustomFieldController::class, 'dataForDatatables'])->name(
|
||||
@@ -650,6 +657,8 @@ Route::middleware(['auth'])->group(function () {
|
||||
Route::post('lampiran/upload', [LampiranDokumenController::class, 'upload'])->name('lampiran.upload');
|
||||
Route::delete('lampiran/{lampiran}', [LampiranDokumenController::class, 'delete'])->name('lampiran.delete');
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
require __DIR__ . '/registrasi.php';
|
||||
|
||||
Reference in New Issue
Block a user