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!',
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user