Melengkapi feature Approve Jadwal Kunjungan yang di berikan Surveyor
This commit is contained in:
committed by
putrakuningan
parent
dfe1e98d80
commit
614abd01ac
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user