update function callcenter
This commit is contained in:
@@ -0,0 +1,189 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Services\CustomerService;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Carbon\Carbon;
|
||||
|
||||
|
||||
class CallCenterController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
}
|
||||
|
||||
public function notisperingatan(Request $request){
|
||||
$auth_user = Auth::user();
|
||||
$api_url = config('api.url');
|
||||
$cawangan_info = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/cawangan/'. $auth_user['cawangan'])->json();
|
||||
|
||||
$kelulusan = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/ListOperasi/')->json();
|
||||
|
||||
$arraykelulusan = [];
|
||||
|
||||
|
||||
foreach($kelulusan as $index=>$lulus)
|
||||
{
|
||||
foreach($lulus['kelulusanall'] as $index=>$kel)
|
||||
{
|
||||
array_push($arraykelulusan,["cawangan" => $lulus['cawangan'], "cawangankod" => $lulus['cawangankod'],"namateller" => $kel['teller'], 'siri' => $kel['siri'] , "norujukan" => $kel['norujukan'], 'pinjaman' => $kel['jumpinj'],'komen' => $kel['komen'], 'nilaimarhun' => ($kel['nilaimarhun'] ?? '-'), 'berat' => ($kel['berat'] ?? '-'),'margin' => ($kel['margin'] ?? '-'), 'status' => ($kel['status'] ?? '-'), 'pelulus' => $kel['pelulus']]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return view('callcenter.notisperingatan',compact('cawangan_info','api_url','arraykelulusan'));
|
||||
}
|
||||
|
||||
public function cariansag(Request $request)
|
||||
{
|
||||
// dd($request->all());
|
||||
$request->radaktif === 'aktif';
|
||||
$api_url = config('api.url');
|
||||
$auth_user = Auth::user();
|
||||
$current = Carbon::now();
|
||||
$current = new Carbon();
|
||||
$tarikh_cetak = $current->toDateString();
|
||||
$daritempoh = $request->daritempoh;
|
||||
$hinggatempoh = $request->hinggatempoh;
|
||||
|
||||
$cawangan_all = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url').'/arcc/cawangan')->json();
|
||||
$senarai = [];
|
||||
foreach($cawangan_all as $cawangan){
|
||||
$kodcaw = $cawangan['kodcaw'];
|
||||
// $kodcaw = 'WCY';
|
||||
$datagadai = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url').'/arcc/datagadai/'.$request->radaktif.'/'.$kodcaw ,[
|
||||
'daritempoh' => $daritempoh,
|
||||
'hinggatempoh' => $hinggatempoh,
|
||||
])->json();
|
||||
|
||||
$data = [
|
||||
'kodcaw'=>$cawangan['kodcaw'],
|
||||
'caw_name'=>$cawangan['details_caw'],
|
||||
'datagadai' => $datagadai ? $datagadai : '',
|
||||
];
|
||||
|
||||
array_push($senarai,$data);
|
||||
|
||||
// dd($data);
|
||||
}
|
||||
|
||||
return view('callcenter.listcariansag', compact(
|
||||
'kodcaw',
|
||||
'senarai',
|
||||
'daritempoh',
|
||||
'hinggatempoh',
|
||||
|
||||
));
|
||||
}
|
||||
|
||||
public function janadatanotisperingatan(Request $request)
|
||||
{
|
||||
$current = Carbon::now();
|
||||
$current = new Carbon();
|
||||
$currentNow = Carbon::now();
|
||||
$senarai = [];
|
||||
$tarikh_savedaftarnotis = $current->toDateString();
|
||||
$daritempoh = $request->daritempoh;
|
||||
$hinggatempoh = $request->hinggatempoh;
|
||||
$kodcaw = $request->kodcaw;
|
||||
$selected_caw = $request->caw;
|
||||
// dd($selected_caw);
|
||||
|
||||
$getbatchnotis=Http::withOptions(['verify' => config('app.api_verify')])->get( config('api.url').'/arcc/getbatchnotis',[
|
||||
'daritempoh' => $daritempoh,
|
||||
'hinggatempoh' => $hinggatempoh,
|
||||
])->json();
|
||||
|
||||
$newbatchnotis=$getbatchnotis;
|
||||
|
||||
if(!empty($selected_caw))
|
||||
{
|
||||
foreach($selected_caw as $index=>$caw){
|
||||
$cawangan_info = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/cawangan/'. $caw)->json();
|
||||
// dd($cawangan_info);
|
||||
$insertdatagadai = Http::withOptions(['verify' => config('app.api_verify')])->post(config('api.url').'/arcc/insertdatagadai/aktif/'.$caw ,[
|
||||
'daritempoh' => $daritempoh,
|
||||
'hinggatempoh' => $hinggatempoh,
|
||||
'kodcaw' => $caw,
|
||||
'notisid' => $newbatchnotis
|
||||
])->json();
|
||||
|
||||
$data = [
|
||||
'kodcaw'=>$caw,
|
||||
'caw_name'=>$cawangan_info['details_caw'],
|
||||
'datagadai' => $insertdatagadai ? $insertdatagadai : '',
|
||||
];
|
||||
|
||||
array_push($senarai,$data);
|
||||
}
|
||||
}
|
||||
return redirect()->route('arcc.notisperingatan')->with('success','Berjaya Daftar Notis Peringatan.');
|
||||
|
||||
}
|
||||
|
||||
// public function rekodnotisperingatan(Request $request){
|
||||
// $auth_user = Auth::user();
|
||||
// $api_url = config('api.url');
|
||||
|
||||
|
||||
// $cawangan_info = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/cawangan/'. $auth_user['cawangan'])->json();
|
||||
// $rekodblast = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url'). '/api/rekodblast/'. $auth_user['cawangan'])->json();
|
||||
// return view('callcenter.rekodnotisperingatan',compact('cawangan_info','api_url','rekodblast'));
|
||||
// }
|
||||
|
||||
public function rekodnotisperingatan()
|
||||
{
|
||||
$auth_user = Auth::user();
|
||||
$api_url = config('api.url');
|
||||
|
||||
$arrayinfo = [];
|
||||
|
||||
// $notis = Notis::select('tarikh_notis','id')
|
||||
// ->groupBy('tarikh_notis')
|
||||
// ->get();
|
||||
$notis = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url'). '/arcc/senarainotisperingatan')->json();
|
||||
// dd($notis);
|
||||
foreach($notis as $info)
|
||||
{
|
||||
$getcawnotis = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url'). '/arcc/getcawnotis/'.$info['id'])->json();
|
||||
|
||||
array_push($arrayinfo, ['info'=> $info,'cawnotis' => $getcawnotis]);
|
||||
}
|
||||
// dd($arrayinfo);
|
||||
return view('callcenter.rekodnotisperingatan',compact('notis','arrayinfo'));
|
||||
}
|
||||
|
||||
public function detailnotisperingatan($notisid)
|
||||
{
|
||||
$auth_user = Auth::user();
|
||||
$api_url = config('api.url');
|
||||
|
||||
$senarai = [];
|
||||
|
||||
$detailnotis = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url'). '/arcc/getcawnotis/'.$notisid)->json();
|
||||
// dd($detailnotis[0]);
|
||||
foreach($detailnotis as $info)
|
||||
{
|
||||
$getcawnotisbycaw = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url'). '/arcc/getcawnotisbycaw', [
|
||||
'kodcaw' => $info[0]['kodcaw'],
|
||||
'notisid' => $notisid
|
||||
])->json();
|
||||
|
||||
$data = [
|
||||
'kodcaw'=>$info[0]['kodcaw'],
|
||||
'caw_name'=>$info[0]['details_caw'],
|
||||
'getcawnotisbycaw' => $getcawnotisbycaw ? $getcawnotisbycaw : '',
|
||||
];
|
||||
|
||||
array_push($senarai,$info,$data, ['info'=> $info, 'data'=>$data]);
|
||||
}
|
||||
return view('callcenter.detailnotisperingatan',compact('detailnotis','senarai'));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user