fix stki2
This commit is contained in:
@@ -1849,6 +1849,35 @@ class AdminPageController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
public function GetRekodPermohonanCawangan($kodcaw)
|
||||
{
|
||||
if($kodcaw === 'admin')
|
||||
{
|
||||
$listpermohonan = Permohonan::join('pengesahan', 'permohonan.mohonid', '=', 'pengesahan.mohonid')
|
||||
->where('tagterima',1)
|
||||
->orWhere('tagoperasi','=',2)
|
||||
->orWhere('tagakaun','=',2)
|
||||
->orWhere('tagpb','=',2)
|
||||
->orWhere('tagdeposit','=',2)
|
||||
->orWhere('tagprint','=',2)
|
||||
->orderBy('tarikh_permohonan','desc')->paginate(5);
|
||||
|
||||
}else{
|
||||
$listpermohonan = Permohonan::join('pengesahan', 'permohonan.mohonid', '=', 'pengesahan.mohonid')
|
||||
->where('pengesahan.kodcaw', $kodcaw)
|
||||
->where('tagterima',1)
|
||||
->orWhere('tagoperasi','=',2)
|
||||
->orWhere('tagakaun','=',2)
|
||||
->orWhere('tagpb','=',2)
|
||||
->orWhere('tagdeposit','=',2)
|
||||
->orWhere('tagprint','=',2)
|
||||
->get();
|
||||
|
||||
}
|
||||
|
||||
return response()->json($listpermohonan);
|
||||
}
|
||||
|
||||
public function GetPermohonanCawangan($kodcaw,Request $request)
|
||||
{
|
||||
|
||||
@@ -1856,10 +1885,23 @@ class AdminPageController extends Controller
|
||||
{
|
||||
$listpermohonan = Permohonan::join('pengesahan', 'permohonan.mohonid', '=', 'pengesahan.mohonid')
|
||||
->where('tagterima',0)
|
||||
->where('tagoperasi','!=',2)
|
||||
->where('tagakaun','!=',2)
|
||||
->where('tagpb','!=',2)
|
||||
->where('tagdeposit','!=',2)
|
||||
->where('tagprint','!=',2)
|
||||
->orderBy('tarikh_permohonan','desc')->paginate(5);
|
||||
|
||||
}else{
|
||||
$listpermohonan = Permohonan::where([['kodcaw', $kodcaw],['tagterima',0]])->get();
|
||||
$listpermohonan = Permohonan::join('pengesahan', 'permohonan.mohonid', '=', 'pengesahan.mohonid')
|
||||
->where('pengesahan.kodcaw', $kodcaw)
|
||||
->where('tagterima',0)
|
||||
->where('tagoperasi','!=',2)
|
||||
->where('tagakaun','!=',2)
|
||||
->where('tagpb','!=',2)
|
||||
->where('tagdeposit','!=',2)
|
||||
->where('tagprint','!=',2)
|
||||
->get();
|
||||
}
|
||||
|
||||
return response()->json($listpermohonan);
|
||||
@@ -1868,7 +1910,9 @@ class AdminPageController extends Controller
|
||||
public function GetPermohonanById($kodcaw,$mohonid)
|
||||
{
|
||||
$permohonanstatus = [];
|
||||
$listpermohonan = Permohonan::where([['kodcaw', $kodcaw],['mohonid',$mohonid]])->first()->toArray();
|
||||
$listpermohonan = Permohonan::join('pengesahan', 'permohonan.mohonid', '=', 'pengesahan.mohonid')
|
||||
->where([['permohonan.kodcaw', $kodcaw],['permohonan.mohonid',$mohonid]])->first()->toArray();
|
||||
|
||||
$status = Status::where('mohonid',$mohonid)->get()->toArray();
|
||||
|
||||
array_push($listpermohonan,(["status" => $status]));
|
||||
@@ -1879,15 +1923,33 @@ class AdminPageController extends Controller
|
||||
public function GetDescriptionStatus($mohonid)
|
||||
{
|
||||
$statusarray = [];
|
||||
|
||||
$status = Status::where('mohonid',$mohonid)->get()->toArray();
|
||||
$statusdetails = [];
|
||||
$status = Status::join('pengesahan', 'status.mohonid', '=', 'pengesahan.mohonid')
|
||||
->join('permohonan', 'status.mohonid', '=', 'permohonan.mohonid')
|
||||
->where('status.mohonid',$mohonid)->get()->toArray();
|
||||
|
||||
foreach($status as $index=>$stat)
|
||||
{
|
||||
$status_lookup = LookupStatus::where('statusid',$stat['statusid'])->first()->toArray();
|
||||
$date = date('d-m-Y',strtotime($stat['tarikhmasa']));
|
||||
$time = date('g:i a',strtotime($stat['tarikhmasa']));
|
||||
array_push($status_lookup,['tarikh' => $date, 'masa' => $time]);
|
||||
|
||||
switch($stat['statusid']){
|
||||
case 1: array_push($status_lookup,['tarikh' => $date, 'masa' => $time,'nama_pemohon' => $stat['nama_pemohon']]);
|
||||
break;
|
||||
case 2: array_push($status_lookup,['tarikh' => $date, 'masa' => $time,'nama_operasi' => $stat['nama_operasi']]);
|
||||
break;
|
||||
case 3: array_push($status_lookup,['tarikh' => $date, 'masa' => $time,'nama_akaun' => $stat['nama_akaun']]);
|
||||
break;
|
||||
case 4: array_push($status_lookup,['tarikh' => $date, 'masa' => $time,'jumlah_diluluskan' => $stat['jumlah_diluluskan']]);
|
||||
break;
|
||||
case 5: array_push($status_lookup,['tarikh' => $date, 'masa' => $time,'jenisbank' => $stat['jenisbank'],'noresit' => $stat['noresit']]);
|
||||
break;
|
||||
case 6: array_push($status_lookup,['tarikh' => $date, 'masa' => $time,'nama_penerima' => $stat['nama_penerima']]);
|
||||
break;
|
||||
case 7: array_push($status_lookup,['tarikh' => $date, 'masa' => $time]);
|
||||
break;
|
||||
}
|
||||
array_push($statusarray,$status_lookup);
|
||||
}
|
||||
|
||||
@@ -1897,28 +1959,40 @@ class AdminPageController extends Controller
|
||||
public function KelulusanPermohonanByOperasi(Request $request)
|
||||
{
|
||||
$timeloni = Carbon::now();
|
||||
|
||||
$status = new Status;
|
||||
try{
|
||||
|
||||
if($request->kelulusan == 'Lulus')
|
||||
{
|
||||
$status->mohonid = $request->mohonid;
|
||||
$status->statusid = 2;
|
||||
$status->tarikhmasa = $timeloni->toDateTimeString();
|
||||
$status->save();
|
||||
|
||||
$pengesahan = Pengesahan::where([['mohonid',$request->mohonid],['tagoperasi',0]])
|
||||
->update(array(
|
||||
'tagoperasi' => 1,
|
||||
'nama_operasi' => $request->namaoperasi,
|
||||
'tarikh_pengesahanoperasi' => $timeloni->toDateString()
|
||||
));
|
||||
|
||||
}else{
|
||||
|
||||
$status->mohonid = $request->mohonid;
|
||||
$status->statusid = 7;
|
||||
$status->tarikhmasa = $timeloni->toDateTimeString();
|
||||
$status->save();
|
||||
|
||||
$pengesahan = Pengesahan::where([['mohonid',$request->mohonid],['tagoperasi',0]])
|
||||
->update(array(
|
||||
'tagoperasi' => 2,
|
||||
'nama_operasi' => $request->namaoperasi,
|
||||
'tarikh_pengesahanoperasi' => $timeloni->toDateString()
|
||||
));
|
||||
|
||||
}
|
||||
|
||||
return response()->json(1);
|
||||
|
||||
return response()->json($pengesahan,200);
|
||||
|
||||
}catch (\Throwable $e){
|
||||
return response($e);
|
||||
@@ -1930,18 +2004,31 @@ class AdminPageController extends Controller
|
||||
public function KelulusanPermohonanByAkaun(Request $request)
|
||||
{
|
||||
$timeloni = Carbon::now();
|
||||
$status = new Status;
|
||||
|
||||
try{
|
||||
|
||||
if($request->kelulusan == 'Lulus')
|
||||
{
|
||||
$status->mohonid = $request->mohonid;
|
||||
$status->statusid = 3;
|
||||
$status->tarikhmasa = $timeloni->toDateTimeString();
|
||||
$status->save();
|
||||
|
||||
$pengesahan = Pengesahan::where([['mohonid',$request->mohonid],['tagakaun',0]])
|
||||
->update(array(
|
||||
'tagakaun' => 1,
|
||||
'nama_akaun' => $request->namaakaun,
|
||||
'tarikh_pengesahanakaun' => $timeloni->toDateString()
|
||||
));
|
||||
}else{
|
||||
|
||||
}else
|
||||
{
|
||||
$status->mohonid = $request->mohonid;
|
||||
$status->statusid = 7;
|
||||
$status->tarikhmasa = $timeloni->toDateTimeString();
|
||||
$status->save();
|
||||
|
||||
$pengesahan = Pengesahan::where([['mohonid',$request->mohonid],['tagakaun',0]])
|
||||
->update(array(
|
||||
'tagakaun' => 2,
|
||||
@@ -1950,7 +2037,7 @@ class AdminPageController extends Controller
|
||||
));
|
||||
}
|
||||
|
||||
return response()->json(1);
|
||||
return response()->json($pengesahan);
|
||||
|
||||
|
||||
}catch (\Throwable $e){
|
||||
@@ -1958,19 +2045,54 @@ class AdminPageController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
public function PengesahanCetakan(Request $request)
|
||||
{
|
||||
$timeloni = Carbon::now();
|
||||
|
||||
try{
|
||||
$pengesahan = Pengesahan::where([['mohonid',$request->mohonid],['tagakaun',1]])
|
||||
->update(array(
|
||||
'tagprint' => 1,
|
||||
'nama_print' => $request->namaprint,
|
||||
'tarikh_print' => $timeloni->toDateString()
|
||||
));
|
||||
|
||||
return response()->json($pengesahan);
|
||||
}catch (\Throwable $e){
|
||||
return response($e);
|
||||
}
|
||||
}
|
||||
|
||||
public function KelulusanPermohonanByPB(Request $request)
|
||||
{
|
||||
$timeloni = Carbon::now();
|
||||
$status = new Status;
|
||||
|
||||
try{
|
||||
|
||||
if($request->kelulusan == 'Lulus')
|
||||
{
|
||||
$status->mohonid = $request->mohonid;
|
||||
$status->statusid = 4;
|
||||
$status->tarikhmasa = $timeloni->toDateTimeString();
|
||||
$status->save();
|
||||
|
||||
$pengesahan = Pengesahan::where([['mohonid',$request->mohonid],['tagpb',0]])
|
||||
->update(array(
|
||||
'tagpb' => 1
|
||||
));
|
||||
|
||||
$permohonan = Permohonan::where('mohonid',$request->mohonid)
|
||||
->update(array(
|
||||
'tarikh_diluluskan' => $timeloni->toDateTimeString(),
|
||||
'jumlah_diluluskan' => $request->amaun_lulus
|
||||
));
|
||||
}else{
|
||||
$status->mohonid = $request->mohonid;
|
||||
$status->statusid = 7;
|
||||
$status->tarikhmasa = $timeloni->toDateTimeString();
|
||||
$status->save();
|
||||
|
||||
$pengesahan = Pengesahan::where([['mohonid',$request->mohonid],['tagpb',0]])
|
||||
->update(array(
|
||||
'tagpb' => 2
|
||||
@@ -1980,6 +2102,74 @@ class AdminPageController extends Controller
|
||||
return response()->json(1);
|
||||
|
||||
|
||||
}catch (\Throwable $e){
|
||||
return response($e);
|
||||
}
|
||||
}
|
||||
|
||||
public function DepositBank(Request $request)
|
||||
{
|
||||
$timeloni = Carbon::now();
|
||||
$status = new Status;
|
||||
|
||||
try{
|
||||
|
||||
if($request->kelulusan == 'Lulus')
|
||||
{
|
||||
$status->mohonid = $request->mohonid;
|
||||
$status->statusid = 5;
|
||||
$status->tarikhmasa = $timeloni->toDateTimeString();
|
||||
$status->save();
|
||||
|
||||
$pengesahan = Pengesahan::where([['mohonid',$request->mohonid],['tagdeposit',0]])
|
||||
->update(array(
|
||||
'tagdeposit' => 1,
|
||||
'tarikh_bankin' => $timeloni->toDateString(),
|
||||
'jenisbank' => $request->jenisbank,
|
||||
'noresit' => $request->noresit
|
||||
));
|
||||
}else{
|
||||
$status->mohonid = $request->mohonid;
|
||||
$status->statusid = 7;
|
||||
$status->tarikhmasa = $timeloni->toDateTimeString();
|
||||
$status->save();
|
||||
|
||||
$pengesahan = Pengesahan::where([['mohonid',$request->mohonid],['tagdeposit',0]])
|
||||
->update(array(
|
||||
'tagdeposit' => 2
|
||||
));
|
||||
}
|
||||
|
||||
return response()->json(1);
|
||||
|
||||
|
||||
}catch (\Throwable $e){
|
||||
return response($e);
|
||||
}
|
||||
}
|
||||
|
||||
public function TagTerima(Request $request)
|
||||
{
|
||||
$timeloni = Carbon::now();
|
||||
$status = new Status;
|
||||
|
||||
try{
|
||||
|
||||
$status->mohonid = $request->mohonid;
|
||||
$status->statusid = 6;
|
||||
$status->tarikhmasa = $timeloni->toDateTimeString();
|
||||
$status->save();
|
||||
|
||||
$pengesahan = Permohonan::where([['mohonid',$request->mohonid],['tagterima',0]])
|
||||
->update(array(
|
||||
'tagterima' => 1,
|
||||
'tarikh_terima' => $timeloni->toDateString(),
|
||||
'nama_penerima' => $request->namapenerima
|
||||
));
|
||||
|
||||
return response()->json(1);
|
||||
|
||||
|
||||
}catch (\Throwable $e){
|
||||
return response($e);
|
||||
}
|
||||
|
||||
+5
-1
@@ -29,7 +29,11 @@ class Pengesahan extends Model
|
||||
'mohonid',
|
||||
'tagoperasi',
|
||||
'tagakaun',
|
||||
'tagpb'
|
||||
'tagpb',
|
||||
'tagdeposit',
|
||||
'tagprint',
|
||||
'tarikh_print',
|
||||
'nama_print'
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
@@ -685,12 +685,16 @@ $router->group(['prefix'=>'admin'], function () use ($router){
|
||||
|
||||
$router->post('permohonan/add/{kodcaw}',['uses'=>'AdminPageController@TambahPermohonan']);
|
||||
$router->get('permohonan/get/{kodcaw}',['uses'=>'AdminPageController@GetPermohonanCawangan']);
|
||||
$router->get('permohonan/rekod/{kodcaw}',['uses'=>'AdminPageController@GetRekodPermohonanCawangan']);
|
||||
$router->get('permohonan/get/{kodcaw}/{mohonid}',['uses'=>'AdminPageController@GetPermohonanById']);
|
||||
$router->get('permohonan/description/{mohonid}',['uses'=>'AdminPageController@GetDescriptionStatus']);
|
||||
|
||||
$router->put('permohonan/updateoperasi',['uses'=>'AdminPageController@KelulusanPermohonanByOperasi']);
|
||||
$router->put('permohonan/updateakaun',['uses'=>'AdminPageController@KelulusanPermohonanByAkaun']);
|
||||
$router->put('permohonan/updatecetak',['uses'=>'AdminPageController@PengesahanCetakan']);
|
||||
$router->put('permohonan/updatepb',['uses'=>'AdminPageController@KelulusanPermohonanByPB']);
|
||||
$router->put('permohonan/updatebank',['uses'=>'AdminPageController@DepositBank']);
|
||||
$router->put('permohonan/tagterima',['uses'=>'AdminPageController@TagTerima']);
|
||||
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user