Merge branch 'staging' of https://git.putrakuningan.com/daengdeni/lpj into tender
This commit is contained in:
@@ -392,17 +392,19 @@
|
||||
|
||||
if ($zip->open($zipFilePath, ZipArchive::CREATE) === true) {
|
||||
foreach ($documents as $document) {
|
||||
$files = is_array(json_decode($document->dokumen_jaminan)) ? json_decode(
|
||||
$document->dokumen_jaminan,
|
||||
) : [$document->dokumen_jaminan];
|
||||
if($document->dokumen_jaminan) {
|
||||
$files = is_array(json_decode($document->dokumen_jaminan)) ? json_decode(
|
||||
$document->dokumen_jaminan,
|
||||
) : [$document->dokumen_jaminan];
|
||||
|
||||
foreach ($files as $file) {
|
||||
$filePath = storage_path('app/public/' . $file);
|
||||
if (file_exists($filePath)) {
|
||||
$zip->addFile($filePath, basename($filePath));
|
||||
} else {
|
||||
// Log or display an error message for missing files
|
||||
return redirect()->back()->with('error', 'File not found: ' . $filePath);
|
||||
foreach ($files as $file) {
|
||||
$filePath = storage_path('app/public/' . $file);
|
||||
if (file_exists($filePath)) {
|
||||
$zip->addFile($filePath, basename($filePath));
|
||||
} else {
|
||||
// Log or display an error message for missing files
|
||||
return redirect()->back()->with('error', 'File not found: ' . $filePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -222,7 +222,7 @@ class PenilaianController extends Controller
|
||||
});
|
||||
})->unique('id');
|
||||
|
||||
$existingTeamIds = $teamPenilai->pluck('id')->toArray();
|
||||
$existingTeamIds = $userTeam->pluck('id')->toArray();
|
||||
|
||||
$updateTeamPenilai = Teams::with(['regions', 'teamsUsers', 'teamsUsers.user'])
|
||||
->whereNotIn('id', $existingTeamIds)
|
||||
@@ -232,23 +232,14 @@ class PenilaianController extends Controller
|
||||
foreach ($userTeam as $item) {
|
||||
$regionName = $item->regions;
|
||||
}
|
||||
// $regionName = $userTeam->first()?->regions->name;
|
||||
|
||||
|
||||
|
||||
$penilaian = Penilaian::where('nomor_registrasi', $permohonan->nomor_registrasi)->first();
|
||||
|
||||
|
||||
$penilaianTeam = collect();
|
||||
if ($penilaian && $penilaian->id) {
|
||||
$penilaianTeam = PenilaianTeam::where('penilaian_id', $penilaian->id)->get();
|
||||
}
|
||||
|
||||
// return response()->json([
|
||||
// 'penilaianTeam' => $penilaianTeam
|
||||
// ]);
|
||||
|
||||
|
||||
return view('lpj::penilaian.form', compact('permohonan', 'teamPenilai', 'jenisPenilaian', 'penilaian', 'regionName', 'updateTeamPenilai', 'penilaianTeam'));
|
||||
}
|
||||
/**
|
||||
|
||||
@@ -21,10 +21,17 @@
|
||||
use Modules\Lpj\Models\Permohonan;
|
||||
use Modules\Lpj\Models\StatusPermohonan;
|
||||
use Modules\Lpj\Models\TujuanPenilaian;
|
||||
use Modules\Lpj\Services\PermohonanHistoryService;
|
||||
|
||||
class PermohonanController extends Controller
|
||||
{
|
||||
public $user;
|
||||
protected $historyService;
|
||||
|
||||
public function __construct(PermohonanHistoryService $historyService)
|
||||
{
|
||||
$this->historyService = $historyService;
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
@@ -36,8 +43,30 @@
|
||||
$validate = $request->validated();
|
||||
if ($validate) {
|
||||
try {
|
||||
// Process file upload
|
||||
$filePath = null;
|
||||
if ($request->hasFile('attachment')) {
|
||||
$file = $request->file('attachment');
|
||||
$fileName = time() . '_' . $file->getClientOriginalName();
|
||||
$filePath = $file->storeAs('permohonan_attachments', $fileName, 'public');
|
||||
}
|
||||
|
||||
// Get keterangan if provided
|
||||
$keterangan = $request->input('keterangan') ?? null;
|
||||
|
||||
|
||||
// Save to database
|
||||
Permohonan::create($validate);
|
||||
$permohonan = Permohonan::create($validate);
|
||||
|
||||
// Create history
|
||||
$this->historyService->createHistory(
|
||||
$permohonan,
|
||||
$validate['status'],
|
||||
$keterangan,
|
||||
[], // beforeRequest is empty for new permohonan
|
||||
$permohonan->toArray(),
|
||||
$filePath
|
||||
);
|
||||
return redirect()
|
||||
->route('permohonan.index')->with('success', 'Permohonan created successfully');
|
||||
} catch (Exception $e) {
|
||||
@@ -107,16 +136,41 @@
|
||||
|
||||
public function update(PermohonanRequest $request, $id)
|
||||
{
|
||||
$permohonan = Permohonan::findOrFail($id);
|
||||
$beforeRequest = $permohonan->toArray();
|
||||
|
||||
$validate = $request->validated();
|
||||
if ($validate) {
|
||||
try {
|
||||
// Update in database
|
||||
$permohonan = Permohonan::find($id);
|
||||
|
||||
if ($permohonan->status == 'revisi') {
|
||||
$validate['status'] = 'order';
|
||||
}
|
||||
|
||||
$permohonan->update($validate);
|
||||
|
||||
$afterRequest = $permohonan->fresh()->toArray();
|
||||
// Process file upload
|
||||
$file = null;
|
||||
if ($request->hasFile('attachment')) {
|
||||
$file = $request->file('attachment');
|
||||
}
|
||||
|
||||
// Get keterangan if provided
|
||||
$keterangan = $request->input('keterangan') ?? null;
|
||||
|
||||
$status =$validate['status'] ?? $permohonan->status;
|
||||
|
||||
$this->historyService->createHistory(
|
||||
$permohonan,
|
||||
$status,
|
||||
$keterangan,
|
||||
$beforeRequest,
|
||||
$afterRequest,
|
||||
$file
|
||||
);
|
||||
|
||||
return redirect()
|
||||
->route('permohonan.index')->with('success', 'Permohonan updated successfully');
|
||||
} catch (Exception $e) {
|
||||
|
||||
@@ -25,6 +25,7 @@ use Modules\Lpj\Models\SpekKategoritBangunan;
|
||||
use Modules\Lpj\Models\SaranaPelengkap;
|
||||
use Modules\Lpj\Models\ArahMataAngin;
|
||||
use Modules\Lpj\Models\Analisa;
|
||||
use Modules\Lpj\Models\PerkerasanJalan;
|
||||
use Modules\Lpj\Models\AnalisaFakta;
|
||||
use Modules\Lpj\Models\AnalisaLingkungan;
|
||||
use Modules\Lpj\Models\AnalisaTanahBagunan;
|
||||
@@ -591,6 +592,7 @@ class SurveyorController extends Controller
|
||||
$golMasySekitar = GolonganMasySekitar::all();
|
||||
$tingkatKeramaian = TingkatKeramaian::all();
|
||||
$laluLintasLokasi = LaluLintasLokasi::all();
|
||||
$perkerasanJalan = PerkerasanJalan::all();
|
||||
|
||||
|
||||
$analisa = Analisa::with('analisaTanahBangunan', 'analisaLingkungan', 'analisaFakta', 'jenisJaminan')
|
||||
@@ -598,6 +600,7 @@ class SurveyorController extends Controller
|
||||
->where('jenis_jaminan_id', $jaminanId)
|
||||
->first();
|
||||
|
||||
// return response()->json($permohonan);
|
||||
|
||||
|
||||
return view('lpj::surveyor.components.inspeksi', compact(
|
||||
@@ -622,7 +625,8 @@ class SurveyorController extends Controller
|
||||
'viewUnit',
|
||||
'golMasySekitar',
|
||||
'tingkatKeramaian',
|
||||
'laluLintasLokasi'
|
||||
'laluLintasLokasi',
|
||||
'perkerasanJalan'
|
||||
));
|
||||
}
|
||||
|
||||
@@ -714,27 +718,27 @@ class SurveyorController extends Controller
|
||||
try {
|
||||
$type = $request->route('type');
|
||||
|
||||
$modelClass = $this->getModelClass($type);
|
||||
$modelClass = $this->getModelClass($type);
|
||||
|
||||
if (!$modelClass) {
|
||||
return redirect()
|
||||
->route('basicdata.'. $type .'.index')
|
||||
->with('error', 'Invalid type specified.');
|
||||
}
|
||||
|
||||
if ($type == 'spek-bangunan') {
|
||||
$validate['spek_kategori_bagunan_id'] = $request->spek_kategori_bagunan_id;
|
||||
|
||||
}
|
||||
|
||||
|
||||
$data = array_merge($validate, ['status' => true]);
|
||||
$modelClass::create($data);
|
||||
|
||||
if (!$modelClass) {
|
||||
return redirect()
|
||||
->route('basicdata.'. $type .'.index')
|
||||
->with('error', 'Invalid type specified.');
|
||||
}
|
||||
->route('basicdata.' . $type .'.index')
|
||||
->with('success', 'created successfully');
|
||||
|
||||
if ($type == 'spek-bangunan') {
|
||||
$validate['spek_kategori_bagunan_id'] = $request->spek_kategori_bagunan_id;
|
||||
|
||||
}
|
||||
|
||||
|
||||
$data = array_merge($validate, ['status' => true]);
|
||||
$modelClass::create($data);
|
||||
|
||||
return redirect()
|
||||
->route('basicdata.' . $type .'.index')
|
||||
->with('success', 'created successfully');
|
||||
|
||||
} catch (Exeception $e) {
|
||||
|
||||
return response()->json(array('error' => $e->getMessage()), 400);
|
||||
@@ -842,6 +846,7 @@ class SurveyorController extends Controller
|
||||
'Golongan Masyarakat Sekitar' => GolonganMasySekitar::class,
|
||||
'Lantai Unit' => Lantai::class,
|
||||
'View Unit' => ViewUnit::class,
|
||||
'Perkerasan jalan' => PerkerasanJalan::class
|
||||
];
|
||||
|
||||
|
||||
@@ -961,7 +966,8 @@ class SurveyorController extends Controller
|
||||
}
|
||||
|
||||
|
||||
public function validateSubmit(){
|
||||
public function validateSubmit()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -1039,6 +1045,7 @@ class SurveyorController extends Controller
|
||||
'spek-bangunan' => ['Spek Bangunan', 'spek-bangunan'],
|
||||
'lantai-unit' => ['Lantai Unit', 'lantai-unit'],
|
||||
'view-unit' => ['View Unit', 'view-unit'],
|
||||
'perkerasan-jalan' => ['Perkerasan jalan', 'perkerasan-jalan']
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ class PerkerasanJalan extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'perkerasan_jalan';
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
|
||||
31
app/Models/PermohonanHistory.php
Normal file
31
app/Models/PermohonanHistory.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
// use Modules\Lpj\Database\Factories\PermohonanHistoryFactory;
|
||||
|
||||
class PermohonanHistory extends Base
|
||||
{
|
||||
protected $fillable = [
|
||||
'permohonan_id',
|
||||
'status',
|
||||
'keterangan',
|
||||
'before_request',
|
||||
'after_request',
|
||||
'file_path',
|
||||
'user_id'
|
||||
];
|
||||
|
||||
|
||||
public function permohonan()
|
||||
{
|
||||
return $this->belongsTo(Permohonan::class);
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
}
|
||||
43
app/Services/PermohonanHistoryService.php
Normal file
43
app/Services/PermohonanHistoryService.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Services;
|
||||
|
||||
use Modules\Lpj\Models\Permohonan;
|
||||
use Modules\Lpj\Models\PermohonanHistory;
|
||||
|
||||
class PermohonanHistoryService
|
||||
{
|
||||
public function createHistory(Permohonan $permohonan, string $status, ?string $keterangan, array $beforeRequest, array $afterRequest, ?string $file = null)
|
||||
{
|
||||
|
||||
$filePath = null;
|
||||
if ($file) {
|
||||
$filePath = $file->store('permohonan_history_files', 'public');
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
$history = PermohonanHistory::create([
|
||||
'permohonan_id' => $permohonan->id,
|
||||
'status' => $status,
|
||||
'keterangan' => $keterangan,
|
||||
'before_request' => json_encode($beforeRequest),
|
||||
'after_request' => json_encode($afterRequest),
|
||||
'file_path' => $filePath,
|
||||
'user_id' => auth()->id(),
|
||||
]);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
// Log the error
|
||||
\Log::error('Error creating PermohonanHistory: ' . $e->getMessage());
|
||||
|
||||
// You might want to delete the uploaded file if the database operation fails
|
||||
if ($filePath) {
|
||||
\Storage::disk('public')->delete($filePath);
|
||||
}
|
||||
|
||||
// Rethrow the exception or handle it as per your application's error handling policy
|
||||
throw new \Exception('Failed to create PermohonanHistory: ' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,20 +4,22 @@ use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class () extends Migration {
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('penilaian_team', function (Blueprint $table) {
|
||||
Schema::create('permohonan_histories', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('penilaian_id');
|
||||
$table->unsignedBigInteger('team_id');
|
||||
$table->unsignedBigInteger('user_id');
|
||||
$table->string('role');
|
||||
$table->boolean('status')->default(true);
|
||||
$table->char('authorized_status', 1)->nullable();
|
||||
$table->unsignedBigInteger('permohonan_id');
|
||||
$table->string('status');
|
||||
$table->text('keterangan')->nullable();
|
||||
$table->json('before_request')->nullable();
|
||||
$table->json('after_request')->nullable();
|
||||
$table->string('file_path')->nullable();
|
||||
$table->unsignedBigInteger('user_id')->nullable();
|
||||
$table->timestamps();
|
||||
$table->timestamp('authorized_at')->nullable();
|
||||
$table->unsignedBigInteger('authorized_by')->nullable();
|
||||
@@ -25,6 +27,9 @@ return new class () extends Migration {
|
||||
$table->unsignedBigInteger('created_by')->nullable();
|
||||
$table->unsignedBigInteger('updated_by')->nullable();
|
||||
$table->unsignedBigInteger('deleted_by')->nullable();
|
||||
|
||||
$table->foreign('permohonan_id')->references('id')->on('permohonan')->onDelete('cascade');
|
||||
$table->foreign('user_id')->references('id')->on('users')->onDelete('set null');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -33,6 +38,6 @@ return new class () extends Migration {
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('penilai_team');
|
||||
Schema::dropIfExists('permohonan_histories');
|
||||
}
|
||||
};
|
||||
@@ -33,6 +33,11 @@
|
||||
.dropdowns-content a:hover {
|
||||
background-color: #f1f1f1;
|
||||
}
|
||||
|
||||
.break-words {
|
||||
word-break: break-word;
|
||||
white-space: normal;
|
||||
}
|
||||
</style>
|
||||
@endpush
|
||||
|
||||
@@ -46,7 +51,6 @@
|
||||
@php
|
||||
|
||||
$sortedTeamsActivity = $teamsActivity->sortBy(function ($item) {
|
||||
|
||||
return $item->team->penilaianTeam
|
||||
->filter(function ($penilaianTeam) use ($item) {
|
||||
return $penilaianTeam->user_id == $item->user->id;
|
||||
@@ -64,8 +68,9 @@
|
||||
style="margin-start: 10px">
|
||||
<table class="table table-auto align-middle text-gray-700 font-medium text-sm">
|
||||
<tr>
|
||||
<th class="min-w-[150px]">
|
||||
<span class="text-base text-gray-900 font-normal">{{ $item->user->name }}</span>
|
||||
<th class="min-w-[150px]" style="width: 600px">
|
||||
<span
|
||||
class="text-base text-gray-900 font-normal break-words">{{ $item->user->name }}</span>
|
||||
</th>
|
||||
<th class="min-w-[150px]">
|
||||
<span class="text-base text-gray-900 font-normal">
|
||||
@@ -86,13 +91,14 @@
|
||||
class="ki-outline ki-minus text-gray-600 text-2sm accordion-active:block hidden"></i>
|
||||
</th>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</button>
|
||||
<div class="accordion-content hidden" id="accordion_{{ $index }}content_{{ $index }}">
|
||||
<div class="mx-8 pb-4" style="margin-bottom: 20px">
|
||||
<div class="card card-grid min-w-full" data-datatable="false"
|
||||
id="activity-table-{{ $index }}"
|
||||
data-api-url="{{ route('activity.progres.datatables', ['id' => $item->user->id ]) }}">
|
||||
data-api-url="{{ route('activity.progres.datatables', ['id' => $item->user->id]) }}">
|
||||
<div class="card-body">
|
||||
<div class="scrollable-x-auto">
|
||||
<table
|
||||
@@ -176,7 +182,8 @@
|
||||
},
|
||||
jenis_asset: {
|
||||
title: 'Jenis Asset',
|
||||
render: (item, data) => `${data.permohonan.debiture.documents.map(d => d.jenis_jaminan.name) || ''}`,
|
||||
render: (item, data) =>
|
||||
`${data.permohonan.debiture.documents.map(d => d.jenis_jaminan.name) || ''}`,
|
||||
},
|
||||
jenis_report: {
|
||||
title: 'Jenis Report',
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
<!-- Modal for PDF viewing -->
|
||||
<div id="pdfModal" class="fixed inset-0 bg-gray-800 bg-opacity-75 flex items-center justify-center hidden w-full">
|
||||
<!-- Modal for PDF and Image viewing -->
|
||||
<div id="previewModal" class="fixed inset-0 bg-gray-800 bg-opacity-75 flex items-center justify-center hidden w-full z-50">
|
||||
<div class="bg-white rounded-lg overflow-hidden shadow-xl transform transition-all min-w-3xl w-[1500px] h-[1200px]">
|
||||
<div class="p-4 h-full">
|
||||
<button onclick="closePDFModal()" class="float-right text-2xl">
|
||||
<i class="ki-filled ki-cross-square text-red-600"></i>
|
||||
</button>
|
||||
<div id="pdfViewer" class="h-full"></div>
|
||||
<div class="p-4 h-full flex flex-col">
|
||||
<div class="flex justify-between items-center mb-4">
|
||||
<button id="downloadBtn" class="btn btn-primary btn-sm">
|
||||
<i class="ki-duotone ki-cloud-download me-1"><span class="path1"></span><span class="path2"></span></i>
|
||||
Download File
|
||||
</button>
|
||||
<button onclick="closePreviewModal()" class="text-2xl">
|
||||
<i class="ki-filled ki-cross-square text-red-600"></i>
|
||||
</button>
|
||||
</div>
|
||||
<div id="previewContent" class="flex-grow"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -13,13 +19,48 @@
|
||||
@push('scripts')
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfobject/2.3.0/pdfobject.min.js"></script>
|
||||
<script>
|
||||
let currentFileUrl = '';
|
||||
|
||||
function viewPDF(url) {
|
||||
PDFObject.embed(url, "#pdfViewer");
|
||||
document.getElementById('pdfModal').classList.remove('hidden');
|
||||
currentFileUrl = url;
|
||||
const fileExtension = url.split('.').pop().toLowerCase();
|
||||
const previewContent = document.getElementById('previewContent');
|
||||
|
||||
if (['pdf'].includes(fileExtension)) {
|
||||
PDFObject.embed(url, "#previewContent");
|
||||
} else if (['jpg', 'jpeg', 'png', 'gif'].includes(fileExtension)) {
|
||||
previewContent.innerHTML = `<img src="${url}" alt="Preview" class="max-w-full max-h-full object-contain">`;
|
||||
} else {
|
||||
previewContent.innerHTML = '<p class="text-center">Unsupported file type</p>';
|
||||
}
|
||||
|
||||
document.getElementById('previewModal').classList.remove('hidden');
|
||||
document.addEventListener('keydown', handleEscKey);
|
||||
}
|
||||
|
||||
function closePDFModal() {
|
||||
document.getElementById('pdfModal').classList.add('hidden');
|
||||
function closePreviewModal() {
|
||||
document.getElementById('previewModal').classList.add('hidden');
|
||||
document.removeEventListener('keydown', handleEscKey);
|
||||
}
|
||||
|
||||
function handleEscKey(event) {
|
||||
if (event.key === 'Escape') {
|
||||
closePreviewModal();
|
||||
}
|
||||
}
|
||||
|
||||
// Close modal when clicking outside the content
|
||||
document.getElementById('previewModal').addEventListener('click', function(event) {
|
||||
if (event.target === this) {
|
||||
closePreviewModal();
|
||||
}
|
||||
});
|
||||
|
||||
// Download functionality
|
||||
document.getElementById('downloadBtn').addEventListener('click', function() {
|
||||
if (currentFileUrl) {
|
||||
window.open(currentFileUrl, '_blank');
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
@@ -161,7 +161,7 @@
|
||||
<div class="flex flex-col w-full gap-2" id="file-container-{{$n}}">
|
||||
<div class="flex items-center gap-2">
|
||||
<input class="flex-1 input" type="text" name="dokumen_nomor[{{ $n }}][]" placeholder="Nomor Dokumen">
|
||||
<input class="flex-1 file-input" type="file" name="dokumen_jaminan[{{ $n }}][]">
|
||||
<input class="flex-1 file-input" type="file" name="dokumen_jaminan[{{ $n }}][]" accept=".pdf,image/*">
|
||||
<button type="button" class="flex-none btn btn-primary w-[100px] text-center" onclick="addFileInput({{ $n }})">Add More</button>
|
||||
</div>
|
||||
<div id="additional-files-{{ $n }}"></div>
|
||||
@@ -260,7 +260,7 @@
|
||||
<div class="flex flex-col w-full gap-2" id="file-container-{{$n}}">
|
||||
<div class="flex items-center gap-2">
|
||||
<input class="flex-1 input" type="text" name="dokumen_nomor[{{ $n }}][]" placeholder="Nomor Dokumen">
|
||||
<input class="flex-1 file-input" type="file" name="dokumen_jaminan[{{ $n }}][]" multiple>
|
||||
<input class="flex-1 file-input" type="file" name="dokumen_jaminan[{{ $n }}][]" accept=".pdf,image/*">
|
||||
<button type="button" class="flex-none btn btn-primary w-[100px] text-center" onclick="addFileInput({{ $n }})">Add More</button>
|
||||
</div>
|
||||
<div id="additional-files-{{ $n }}"></div>
|
||||
@@ -525,7 +525,7 @@
|
||||
</div>
|
||||
<div class="flex items-center gap-2 my-2 w-full">
|
||||
<input class="flex-1 input" type="text" name="dokumen_nomor[${index}][]" placeholder="Nomor Dokumen">
|
||||
<input class="flex-1 file-input" type="file" name="dokumen_jaminan[${index}][]" multiple>
|
||||
<input class="flex-1 file-input" type="file" name="dokumen_jaminan[${index}][]" accept=".pdf,image/*">
|
||||
<button type="button" class="flex-none btn btn-primary w-[100px] text-center" onclick="addFileInput(${index})">Add File</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -562,7 +562,7 @@
|
||||
newInput.className = 'flex items-center gap-2 mb-2 w-full';
|
||||
newInput.innerHTML = `
|
||||
<input class="flex-1 input" type="text" name="dokumen_nomor[${index}][]" placeholder="Nomor Dokumen">
|
||||
<input class="flex-1 file-input" type="file" name="dokumen_jaminan[${index}][]" multiple>
|
||||
<input class="flex-1 file-input" type="file" name="dokumen_jaminan[${index}][]" accept=".pdf,image/*">
|
||||
<button type="button" class="flex-none btn btn-danger w-[100px] text-center" onclick="removeFileInput(this)">Remove</button>
|
||||
`;
|
||||
container.appendChild(newInput);
|
||||
@@ -583,6 +583,16 @@
|
||||
</a>
|
||||
</div>
|
||||
`;
|
||||
}else if (typeof dokumenJaminan === 'string' && dokumenNomor === null) {
|
||||
return `
|
||||
<div class="flex w-full lg:w-[30%]">
|
||||
<span class="flex-1 mt-2 text-info text-sm">Nomor Dokumen : --</span>
|
||||
<a href="/debitur/${debiturId}/jaminan/download?dokumen=${itemId}" class="flex-none badge badge-sm badge-outline mt-2">
|
||||
${dokumenJaminan.split('/').pop()}
|
||||
<i class="ki-filled ki-cloud-download"></i>
|
||||
</a>
|
||||
</div>
|
||||
`;
|
||||
} else if (Array.isArray(dokumenJaminan) && Array.isArray(dokumenNomor)) {
|
||||
return dokumenJaminan.map((file, index) => `<div class="flex w-full lg:w-[30%]">
|
||||
<span class="flex-1 mt-2 text-info text-sm">Nomor Dokumen : ${dokumenNomor[index] || 'N/A'}</span>
|
||||
@@ -591,8 +601,24 @@
|
||||
<i class="ki-filled ki-cloud-download"></i>
|
||||
</a></div>
|
||||
`).join('');
|
||||
} else if (Array.isArray(dokumenJaminan) && typeof dokumenNomor === 'string') {
|
||||
return dokumenJaminan.map((file, index) => `<div class="flex w-full lg:w-[30%]">
|
||||
<span class="flex-1 mt-2 text-info text-sm">Nomor Dokumen : ${dokumenNomor} || 'N/A'}</span>
|
||||
<a href="/debitur/${debiturId}/jaminan/download?dokumen=${itemId}&file=${file}" class="flex-none badge badge-sm badge-outline mt-2 mr-2">
|
||||
${file.split('/').pop()}
|
||||
<i class="ki-filled ki-cloud-download"></i>
|
||||
</a></div>
|
||||
`).join('');
|
||||
} else if (Array.isArray(dokumenJaminan) && dokumenNomor === 'null') {
|
||||
return dokumenJaminan.map((file, index) => `<div class="flex w-full lg:w-[30%]">
|
||||
<span class="flex-1 mt-2 text-info text-sm">Nomor Dokumen : ${dokumenNomor} || 'N/A'}</span>
|
||||
<a href="/debitur/${debiturId}/jaminan/download?dokumen=${itemId}&file=${file}" class="flex-none badge badge-sm badge-outline mt-2 mr-2">
|
||||
${file.split('/').pop()}
|
||||
<i class="ki-filled ki-cloud-download"></i>
|
||||
</a></div>
|
||||
`).join('');
|
||||
}
|
||||
return '';
|
||||
return dokumenNomor;
|
||||
}
|
||||
|
||||
function getCustomFieldInput(type, fieldName, value) {
|
||||
|
||||
@@ -71,10 +71,23 @@
|
||||
{{ $loop->index+1 }}. {{ $detail->jenisLegalitasJaminan->name }}
|
||||
</span>
|
||||
<div>
|
||||
@if(in_array(Auth::user()->roles[0]->name,['administrator','pemohon-eo']))
|
||||
<a href="{{ route('debitur.jaminan.download',['id'=>$debitur->id,'dokumen'=>$detail->id]) }}" class="badge badge-sm badge-outline mt-2 badge-info"><i class="ki-filled ki-cloud-download mr-2"></i> Download</a>
|
||||
@if(isset($detail->dokumen_jaminan))
|
||||
@php
|
||||
$dokumen_jaminan = is_array(json_decode($detail->dokumen_jaminan)) ? json_decode($detail->dokumen_jaminan) : [$detail->dokumen_jaminan];
|
||||
$dokumen_nomor = is_array(json_decode($detail->dokumen_nomor)) ? json_decode($detail->dokumen_nomor) : ($detail->dokumen_nomor ? [$detail->dokumen_nomor] : []);
|
||||
@endphp
|
||||
@foreach($dokumen_jaminan as $index => $dokumen)
|
||||
@if(in_array(Auth::user()->roles[0]->name,['administrator','pemohon-eo']))
|
||||
<a href="{{ route('debitur.jaminan.download', ['id' => $debitur->id, 'dokumen' => $detail->id, 'index' => $index]) }}"
|
||||
class="flex-none badge badge-sm badge-outline mt-2 mr-2">
|
||||
{{ basename($dokumen) }}
|
||||
<i class="ki-filled ki-cloud-download"></i>
|
||||
</a>
|
||||
@endif
|
||||
<span class="badge badge-sm badge-outline badge-warning mt-2" onclick="viewPDF('{{ Storage::url($dokumen_jaminan[$index]) }}')"><i class="ki-filled ki-eye mr-2"></i>Preview</span>
|
||||
<br>
|
||||
@endforeach
|
||||
@endif
|
||||
<span class="badge badge-sm badge-outline badge-warning mt-2" onclick="viewPDF('{{ Storage::url($detail->dokumen_jaminan) }}')"><i class="ki-filled ki-eye mr-2"></i>Preview</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="border-t border-gray-300 border-dashed">
|
||||
|
||||
@@ -210,11 +210,6 @@
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- @php
|
||||
var_dump($penilaianTeam);
|
||||
@endphp --}}
|
||||
|
||||
<div
|
||||
class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 {{ $penilaianTeam->isEmpty() ? '' : 'hidden' }}">
|
||||
<label class="form-label max-w-56">
|
||||
@@ -264,8 +259,7 @@
|
||||
|
||||
@if (
|
||||
$penilaianTeam->isNotEmpty() &&
|
||||
$penilaianTeam->contains(fn($item) => $item->role == 'surveyor' && is_null($item->user_id))
|
||||
)
|
||||
$penilaianTeam->contains(fn($item) => $item->role == 'surveyor' && is_null($item->user_id)))
|
||||
<div id="surveyorId" class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||
<label class="form-label max-w-56">
|
||||
Surveyor yang di tunjuk
|
||||
@@ -305,7 +299,7 @@
|
||||
@endforeach
|
||||
|
||||
@if ($penilaianTeam->isEmpty())
|
||||
<option value="pilih_dari_region">pilih dari region berdeda
|
||||
<option value="pilih_dari_region">Pilih Surveyor Dari Region
|
||||
</option>
|
||||
@endif
|
||||
</select>
|
||||
@@ -344,10 +338,8 @@
|
||||
|
||||
|
||||
@if (
|
||||
$penilaianTeam->isNotEmpty() &&
|
||||
$penilaianTeam->contains(fn($item) => $item->role == 'penilai' && is_null($item->user_id))
|
||||
)
|
||||
|
||||
$penilaianTeam->isNotEmpty() &&
|
||||
$penilaianTeam->contains(fn($item) => $item->role == 'penilai' && is_null($item->user_id)))
|
||||
<div id="penilaiId" class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||
<label class="form-label max-w-56">
|
||||
Penilai yang di tunjuk
|
||||
@@ -371,7 +363,7 @@
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
@elseif($penilaianTeam->isEmpty())
|
||||
@elseif($penilaianTeam->isEmpty())
|
||||
<div id="penilaiId" class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||
<label class="form-label max-w-56">
|
||||
Penilai yang di tunjuk
|
||||
@@ -385,7 +377,7 @@
|
||||
<option value="{{ $item->id }}">{{ $item->name }}</option>
|
||||
@endforeach
|
||||
@if ($penilaianTeam->isEmpty())
|
||||
<option value="pilih_dari_region">pilih dari region berdeda
|
||||
<option value="pilih_dari_region">Pilih Penilai Dari Region
|
||||
</option>
|
||||
@endif
|
||||
</select>
|
||||
@@ -437,6 +429,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||
<label class="form-label max-w-56">
|
||||
Catatan
|
||||
@@ -566,12 +559,6 @@
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const revisiForm = document.getElementById('revisiForm');
|
||||
const btnSubmit = document.getElementById('btnSubmit');
|
||||
@@ -613,4 +600,9 @@
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
@@ -40,6 +40,24 @@
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="mb-5">
|
||||
<h3 class="text-md font-medium text-gray-900">
|
||||
Nilai Plafond:
|
||||
</h3>
|
||||
<span class="text-2sm text-gray-700">
|
||||
{{ $permohonan->nilaiPlafond->name }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="mb-5">
|
||||
<h3 class="text-md font-medium text-gray-900">
|
||||
Status Bayar:
|
||||
</h3>
|
||||
<span class="text-md font-bold {{ $permohonan->status_bayar === 'belum_bayar' ? 'text-red-600' : 'text-green-600' }} uppercase">
|
||||
{{ str_replace('_',' ',$permohonan->status_bayar) }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -139,7 +157,7 @@
|
||||
@include('lpj::component.detail-jaminan')
|
||||
|
||||
<div class="card">
|
||||
<form action="{{ route('authorization.update', $permohonan->id) }}" method="POST">
|
||||
<form action="{{ route('authorization.update', $permohonan->id) }}" method="POST" id="authorizationForm">
|
||||
<input type="hidden" name="_method" value="PUT">
|
||||
@csrf
|
||||
<div class="card-body lg:py-7.5">
|
||||
@@ -149,6 +167,16 @@
|
||||
</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<textarea class="textarea" rows="3" type="number" id="keterangan" name="keterangan"></textarea>
|
||||
<em class="alert text-danger text-sm" id="keterangan-message"></em>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 mt-2" id="fileUploadSection">
|
||||
<label class="form-label max-w-56">
|
||||
Upload File Revisi
|
||||
</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<input type="file" class="file-input" id="revisionFile" name="revisionFile">
|
||||
<em class="alert text-danger text-sm hidden" id="file-message"></em>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -156,7 +184,7 @@
|
||||
<button type="submit" name="status" value="preregister" class="btn btn-success">
|
||||
Approve
|
||||
</button>
|
||||
<button type="submit" name="status" value="revisi" class="btn btn-warning ml-3">
|
||||
<button type="submit" name="status" value="revisi" id="revisi" class="btn btn-warning ml-3">
|
||||
Revisi
|
||||
</button>
|
||||
</div>
|
||||
@@ -164,3 +192,45 @@
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const form = document.getElementById('authorizationForm');
|
||||
const keterangan = document.getElementById('keterangan');
|
||||
const revisiBtn = document.getElementById('revisi');
|
||||
const keteranganMessage = document.getElementById('keterangan-message');
|
||||
|
||||
const revisionFile = document.getElementById('revisionFile');
|
||||
const fileMessage = document.getElementById('file-message');
|
||||
|
||||
|
||||
form.addEventListener('submit', function(event) {
|
||||
if (event.submitter === revisiBtn && keterangan.value.trim() === '') {
|
||||
event.preventDefault();
|
||||
keteranganMessage.textContent = 'Catatan harus diisi.';
|
||||
} else {
|
||||
keteranganMessage.textContent = '';
|
||||
}
|
||||
|
||||
if (!revisionFile.files.length) {
|
||||
event.preventDefault();
|
||||
fileMessage.textContent = 'File revisi harus diunggah.';
|
||||
fileMessage.classList.remove('hidden');
|
||||
} else {
|
||||
fileMessage.classList.add('hidden');
|
||||
}
|
||||
});
|
||||
|
||||
// Add event listener for typing in keterangan textarea
|
||||
keterangan.addEventListener('input', function() {
|
||||
keteranganMessage.classList.add('hidden');
|
||||
});
|
||||
|
||||
// Add event listener for file selection
|
||||
revisionFile.addEventListener('change', function() {
|
||||
fileMessage.classList.add('hidden');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
Reference in New Issue
Block a user