Merge branch 'staging' into feature/senior-officer
This commit is contained in:
@@ -171,7 +171,11 @@ class KJPPController extends Controller
|
||||
$validated['detail_nama_pic_marketing'] = $detailNamaPicMarketingJson;
|
||||
$validated['detail_nomor_hp_pic_marketing'] = $detailNomorHpPicMarketingJson;
|
||||
$validated['ijin_usaha_id'] = json_encode($validated['ijin_usaha_id']);
|
||||
$validated['jenis_aset_id'] = json_encode($validated['jenis_aset_id']);
|
||||
if (empty($validated['jenis_aset_id'])) {
|
||||
$validated['jenis_aset_id'] = json_encode([]);
|
||||
} else {
|
||||
$validated['jenis_aset_id'] = json_encode($validated['jenis_aset_id']);
|
||||
}
|
||||
// Tambahkan nama file ke data yang divalidasi
|
||||
$validated['attachment'] = $filename;
|
||||
|
||||
@@ -434,7 +438,11 @@ class KJPPController extends Controller
|
||||
$validated['detail_nama_pic_marketing'] = $detailNamaPicMarketingJson;
|
||||
$validated['detail_nomor_hp_pic_marketing'] = $detailNomorHpPicMarketingJson;
|
||||
$validated['ijin_usaha_id'] = json_encode($validated['ijin_usaha_id']);
|
||||
$validated['jenis_aset_id'] = json_encode($validated['jenis_aset_id']);
|
||||
if (empty($validated['jenis_aset_id'])) {
|
||||
$validated['jenis_aset_id'] = json_encode([]);
|
||||
} else {
|
||||
$validated['jenis_aset_id'] = json_encode($validated['jenis_aset_id']);
|
||||
}
|
||||
|
||||
// Perbarui data di database
|
||||
KJPP::where('id', $id)->update($validated);
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace Modules\Lpj\Http\Controllers;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use Modules\Lpj\Exports\BasicDataSurveyorExport;
|
||||
@@ -527,22 +528,29 @@ class SurveyorController extends Controller
|
||||
|
||||
|
||||
|
||||
public function storeAproved($id)
|
||||
public function storeAproved(Request $request, $id): JsonResponse
|
||||
{
|
||||
try {
|
||||
$penilaian = Penilaian::findOrFail($id);
|
||||
$penilaian->update([
|
||||
'authorized_status' => 1,
|
||||
]);
|
||||
$data = [];
|
||||
if (request()->ajax()) {
|
||||
try {
|
||||
$penilaian = Penilaian::findOrFail($id);
|
||||
$penilaian->update([
|
||||
'authorized_status' => 1,
|
||||
]);
|
||||
|
||||
$data['status'] = 'success';
|
||||
$data['message']= 'Jadwal '.$request->noReg.' berhasil di aprove';
|
||||
} catch (\Exception $e) {
|
||||
$data['status'] = 'error';
|
||||
$data['message'] = 'Gagal membuat jadwal: ' . $e->getMessage();
|
||||
}
|
||||
|
||||
return redirect()
|
||||
->route('permohonan.index')
|
||||
->with('success', 'Jadwal berhasil di aprove.');
|
||||
} catch (\Exception $e) {
|
||||
return redirect()
|
||||
->route('permohonan.index')
|
||||
->with('error', 'Gagal membuat jadwal: ' . $e->getMessage());
|
||||
} else {
|
||||
$data['status'] = 'error';
|
||||
$data['message'] = "no ajax request";
|
||||
}
|
||||
|
||||
return response()->json($data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ class KJPPRequest extends FormRequest
|
||||
'detail_nomor_hp_pic_marketing' => 'nullable',
|
||||
'ijin_usaha_id' => 'required|array',
|
||||
'ijin_usaha_id.*' => 'exists:ijin_usaha,code',
|
||||
'jenis_aset_id' => 'required|array',
|
||||
'jenis_aset_id' => 'nullable|array',
|
||||
'jenis_aset_id.*' => 'exists:jenis_jaminan,code',
|
||||
'attachment' => 'nullable|mimes:pdf|max:1024'
|
||||
];
|
||||
@@ -98,7 +98,6 @@ class KJPPRequest extends FormRequest
|
||||
'nomor_hp_pic_marketing.numeric' => 'Nomor HP PIC Marketing harus berupa angka!',
|
||||
'nomor_hp_pic_marketing.digits_between' => 'Nomor HP PIC Marketing minimum 10 digit dan maksimum 15 digit!',
|
||||
'ijin_usaha_id.required' => 'Ijin Usaha Wajib diisi!',
|
||||
'jenis_aset_id.required' => 'Jenis Aset Wajib diisi!',
|
||||
'attachment.mimes' => 'Attachment harus berformat pdf!',
|
||||
'attachment.max' => 'Attachment berukuran maksimum 1 MB!',
|
||||
];
|
||||
|
||||
28
database/migrations/2024_12_10_091151_update_kjpp_table.php
Normal file
28
database/migrations/2024_12_10_091151_update_kjpp_table.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?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::table('kjpp', function (Blueprint $table) {
|
||||
$table->string('jenis_aset_id')->nullable()->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('kjpp', function (Blueprint $table) {
|
||||
$table->string('jenis_aset_id')->change();
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -250,7 +250,7 @@
|
||||
Pengalaman (Jenis Aset)
|
||||
</label>
|
||||
<div class="flex flex-wrap items-baseline w-full gap-1">
|
||||
@if (isset($kjpp->jenis_aset_id))
|
||||
@if (isset($kjpp->jenis_aset_id) && !empty(json_decode($kjpp->jenis_aset_id, true)))
|
||||
@foreach (json_decode($kjpp->jenis_aset_id, true) as $aset_code)
|
||||
@php
|
||||
$jenis_aset = $jenis_jaminan->firstWhere('code', $aset_code);
|
||||
@@ -263,8 +263,8 @@
|
||||
@endif
|
||||
@endforeach
|
||||
@else
|
||||
<span class="flex flex-row space-x-4 text-white font-medium text-sm dark-mode:text-gray-600">
|
||||
No asset type selected.
|
||||
<span class="flex flex-row space-x-4 text-gray-600 font-medium text-sm dark-mode:text-gray-600">
|
||||
-
|
||||
</span>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
@@ -186,9 +186,9 @@
|
||||
let actionHtml = `<div class="flex flex-nowrap justify-center gap-1.5">`;
|
||||
|
||||
if (data && data.penilaian && data.penilaian.waktu_penilaian !== null && data.status !==
|
||||
'done') {
|
||||
'done' && data.penilaian.authorized_status==null) {
|
||||
actionHtml += `
|
||||
<a class="btn btn-sm btn-outline btn-primary" href="surveyor/storeAproved/${data.penilaian.id}">
|
||||
<a class="btn btn-sm btn-outline btn-primary" href="javascript:void(0)" onclick="surveyorApproveKunjungan(${data.penilaian.id},'${data.nomor_registrasi}')" title="Approve Jadwal Kunjungan No Reg ${data.nomor_registrasi}">
|
||||
<i class="ki-filled ki-calendar-edit"></i>
|
||||
</a>
|
||||
`;
|
||||
@@ -225,5 +225,58 @@
|
||||
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
function surveyorApproveKunjungan(id, noReg) {
|
||||
Swal.fire({
|
||||
title: ' ',
|
||||
text: "Yakin akan Menyetujui Jadwal Kunjungan "+noReg+"?",
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: 'Yes'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
//define variable
|
||||
// $id ==> penilaian.id
|
||||
let token = "{{ csrf_token() }}";
|
||||
let useURL = "{{ URL::to('/surveyor/storeAproved') }}"+"/"+id;
|
||||
|
||||
var input_data = new Object();
|
||||
input_data._token = token;
|
||||
input_data.id = id;
|
||||
input_data.noReg =noReg;
|
||||
$.ajax({
|
||||
url: useURL,
|
||||
type: "PUT",
|
||||
cache: false,
|
||||
data: input_data,
|
||||
dataType: "json",
|
||||
success: function(response) {
|
||||
console.log(response);
|
||||
if('success' == response.status)
|
||||
{
|
||||
swal.fire('Sukses Menyetujui!', response.message, 'success').then(() => {
|
||||
location.reload(true);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
Swal.fire('Error!', response.message, 'error');
|
||||
}
|
||||
|
||||
},
|
||||
error: function(response, textStatus, errorThrown) {
|
||||
// var errors = response.responseJSON.errors;
|
||||
// console.log(errors);
|
||||
console.log(response);
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
|
||||
@@ -518,7 +518,7 @@ Route::middleware(['auth'])->group(function () {
|
||||
Route::post('store', [SurveyorController::class, 'store'])->name('store');
|
||||
Route::post('storeDenah', [SurveyorController::class, 'storeDenah'])->name('storeDenah');
|
||||
Route::put('storeJadwal', [SurveyorController::class, 'storeJadwal'])->name('storeJadwal');
|
||||
Route::get('storeAproved/{id}', [SurveyorController::class, 'storeAproved'])->name('storeAproved');
|
||||
Route::put('storeAproved/{storeAproved}', [SurveyorController::class, 'storeAproved'])->name('storeAproved');
|
||||
Route::put('storeFreeze', [SurveyorController::class, 'storeFreeze'])->name('storeFreeze');
|
||||
Route::post('storeFoto', [SurveyorController::class, 'storeFoto'])->name('storeFoto');
|
||||
Route::post('storeDataPembanding', [SurveyorController::class, 'storeDataPembanding'])->name('storeDataPembanding');
|
||||
|
||||
Reference in New Issue
Block a user