bug fixes and new additions

This commit is contained in:
Kwesi Banson Jnr
2025-08-13 00:10:17 +00:00
parent cf39ff2682
commit eabf61b7da
133 changed files with 4231 additions and 590 deletions

View File

@@ -30,6 +30,14 @@ class ClientsController extends Controller
];
return view('client.index-tabulator', $data);
}
public function indexInactive(){
$data = [
'page_title' => 'Inactive Clients',
'current_user' => session('current_user')
];
// dd('foo bar');
return view('client.index-inactive', $data);
}
public function indexBak(){
$client_arr = new Models\Client;
$client_arr = $client_arr->with('auth_user_info','country_info', 'created_by_info')->orderBy('name', 'ASC')->paginate(10);
@@ -73,6 +81,7 @@ class ClientsController extends Controller
->join('auth_users AS aumngr', 'aumngr.id', '=', 'clients.auth_user_id')
->join('auth_users AS aumodify', 'aumodify.id', '=', 'clients.last_modified_by')
->select('clients.id', 'clients.name', 'clients.status', 'clients.country', 'aumngr.name As accountMgr', 'aumodify.name AS modifiedBy')
->paginate(10);
if($request->has('keyword')){
@@ -87,6 +96,56 @@ class ClientsController extends Controller
return response()->json($client_arr);
}
public function getInactiveClientJson(Request $request){
$client_arr = \DB::table('clients')
->join('auth_users AS aumngr', 'aumngr.id', '=', 'clients.auth_user_id')
->join('auth_users AS aumodify', 'aumodify.id', '=', 'clients.last_modified_by')
->join('flags AS flags', 'flags.country', '=', 'clients.country')
->select('clients.id', 'clients.name', 'clients.status','clients.progress_indicator_score', 'clients.country', 'aumngr.name As accountMgr', 'aumodify.name AS modifiedBy', 'flags.url AS theflag')
->whereRaw("status = 'inactive'")
->orderBy('name', 'ASC')
->get();
// ->paginate(15);
if($request->has('keyword')){
$keyword = $request->keyword;
$client_arr = \DB::table('clients')
->join('auth_users AS aumngr', 'aumngr.id', '=', 'clients.auth_user_id')
->join('auth_users AS aumodify', 'aumodify.id', '=', 'clients.last_modified_by')
->join('flags AS flags', 'flags.country', '=', 'clients.country')
->select('clients.id','clients.name', 'clients.status', 'clients.progress_indicator_score','clients.country', 'aumngr.name As accountMgr', 'aumodify.name AS modifiedBy', 'flags.url AS theflag')
->whereRaw("status = 'inactive'")
->whereRaw("clients.name like '%$keyword%' or clients.status like '%$keyword%' OR clients.country like '%$keyword%' OR aumngr.name like '%$keyword%' OR aumodify.name like '%$keyword%' OR clients.progress_indicator_score like '%$keyword%'")
->orderBy('name', 'ASC')
->get();
// ->paginate(15);
}
return response()->json($client_arr);
}
public function getInacticeClientJsonRawJs(Request $request){
$client_arr = \DB::table('clients')
->join('auth_users AS aumngr', 'aumngr.id', '=', 'clients.auth_user_id')
->join('auth_users AS aumodify', 'aumodify.id', '=', 'clients.last_modified_by')
->select('clients.id', 'clients.name', 'clients.status', 'clients.country', 'aumngr.name As accountMgr', 'aumodify.name AS modifiedBy')
->whereRaw("status = 'inactive'")
->paginate(10);
if($request->has('keyword')){
$keyword = $request->keyword;
$client_arr = \DB::table('clients')
->join('auth_users AS aumngr', 'aumngr.id', '=', 'clients.auth_user_id')
->join('auth_users AS aumodify', 'aumodify.id', '=', 'clients.last_modified_by')
->select('clients.id','clients.name', 'clients.status', 'clients.country', 'aumngr.name As accountMgr', 'aumodify.name AS modifiedBy')
// ->where('status', 'inactive')
->whereRaw("status = 'inactive'")
->whereRaw("clients.name like '%$keyword%' or clients.status like '%$keyword%' OR clients.country like '%$keyword%' OR aumngr.name like '%$keyword%' OR aumodify.name like '%$keyword%'")
->paginate(10);
}
return response()->json($client_arr);
}
/**
* Show the form for creating a new resource.
@@ -99,7 +158,7 @@ class ClientsController extends Controller
$service_type = Models\Service::pluck('name', 'name');
$payment_type = ['Prepaid' => 'Prepaid', 'Postpaid' => 'Postpaid']; //Models\PaymentType::pluck('name', 'id');
$auth_users = Models\SystemUser::pluck('name', 'id');
$status = ['Live' => 'Live', 'inactive' => 'Inactive', 'Prospective' => 'Prospective'];
$status = ['Live' => 'Live', 'inactive' => 'Inactive', 'Prospective' => 'Prospective', 'Cancelled' => 'Cancelled'];
$currency = Models\Currency::pluck('name','name');
$company_types = ['Aggregator/Supplier' => 'Aggregator/Supplier', 'Enterprise' => 'Enterprise', 'Hybrid' => 'Hybrid'];
$industries = Models\Industry::orderBy('name', 'ASC')->pluck('name', 'name');
@@ -669,6 +728,7 @@ class ClientsController extends Controller
'Telkom Kenya' => 'Telkom Kenya',
'Orange Kenya' => 'Orange Kenya'
];
// dd($networks_raw);
//->where('highlight', 'NO')
$show_notes = Models\ClientNote::with('created_by_info', 'client_info')->where('client_id', $id)->orderBy('created_at', 'DESC')->get()->take(20);
$show_notes_highlight = Models\ClientNote::with('created_by_info', 'client_info')->where('client_id', $id)->where('highlight', 'YES')->orderBy('created_at', 'DESC')->get()->take(1);
@@ -684,7 +744,7 @@ class ClientsController extends Controller
$support_fees = Models\ClientSupportFees::where('client_id', $id)->orderBy('id', 'DESC')->get();
$showdocuments = Models\ClientFile::where('client_id', $id)->get();
$client_sender_ids = Models\SenderId::with('network_info', 'created_by_info')->where('client_id', $id)->orderBy('senderid', 'ASC')->get();
//$client_sender_ids = Models\SenderId::with('network_info', 'created_by_info')->where('client_id', $id)->orderBy('senderid', 'ASC')->get();
// dd($showdocuments[0]->name);
if ($showclient->status == 'Live') {
$status_bg = "info";
@@ -695,7 +755,7 @@ class ClientsController extends Controller
else{
$status_bg = "danger";
}
// dd($showclient->progress_indicator_score);
if ($showclient->progress_indicator_score >= 70) {
$progress_status_bg = "success";
}
@@ -705,7 +765,7 @@ class ClientsController extends Controller
else{
$progress_status_bg = "danger";
}
// dump($progress_status_bg);
$renewal_due = 'N/A';
$highlight_colour = 'none';
@@ -777,8 +837,8 @@ class ClientsController extends Controller
'showdocuments' => $showdocuments,
'support_fees' => $support_fees,
'recurring_arr' => $recurring_arr,
'client_sender_ids' => $client_sender_ids,
'sender_id_statuses' => $sender_id_statuses,
// 'client_sender_ids' => $client_sender_ids,
// 'sender_id_statuses' => $sender_id_statuses,
'country_network_arr' => $country_networks,
'mnos_arr' => ['' => '-- Select Country first --']
];
@@ -787,8 +847,8 @@ class ClientsController extends Controller
// dd($value->network_info->name);
// }
// dd($data);
// return view('client.show_original_copy', $data);
return view('client.show_test', $data);
// return view('client.show', $data);
return view('client.show_accordion', $data);
}
public function showReadonly($id){
@@ -958,7 +1018,8 @@ class ClientsController extends Controller
$countries = Models\Country::orderBy('en_short_name', 'ASC')->pluck('en_short_name','en_short_name');
$payment_type = ['Prepaid' => 'Prepaid', 'Postpaid' => 'Postpaid']; // Models\PaymentType::pluck('name', 'id')->toArray();
$status = ['Live' => 'Live', 'inactive' => 'Inactive', 'Prospective' => 'Prospective'];
// $status = ['Live' => 'Live', 'inactive' => 'Inactive', 'Prospective' => 'Prospective'];
$status = ['Live' => 'Live', 'inactive' => 'Inactive', 'Prospective' => 'Prospective', 'Cancelled' => 'Cancelled'];
$currency = Models\Currency::orderBy('name', 'ASC')->pluck('name', 'name');
$existing_documents = Models\ClientFile::where('client_id', $id)->get();
$files = [
@@ -996,7 +1057,7 @@ class ClientsController extends Controller
if ($client->progress_indicator !== "COMPLETED") {
$stage_details = Models\ClientOnboardingMainStage::where('stage', $client->progress_indicator)->first();
// dump($stage_details);
$onboarding_sub_items_progress = Models\ClientOnboardingProgress::where('stage_id', $stage_details->stage_id)->where('client_id', $id)->pluck('name', 'name');
$onboarding_sub_items_progress = Models\ClientOnboardingProgress::where('stage_id', $stage_details->stage_id)->where('client_id', $id)->where('status', 'COMPLETED')->pluck('name', 'name');
// dd($onboarding_sub_items_progress);
$onboarding_sub_items = Models\ClientOnboardingSubItem::where('stage_id', $stage_details->stage_id)->pluck('name', 'name');
}
@@ -1125,6 +1186,7 @@ class ClientsController extends Controller
'has_pending' => $has_pending,
'files' => $files
];
// dd($data['onboarding_sub_items_progress']);
return view('client.edit', $data);
}
@@ -1145,7 +1207,11 @@ class ClientsController extends Controller
$get_stage_subs_items = Models\ClientOnboardingSubItem::where('stage_id', $current_pending_stage_details->stage_id)->get();
#update the table for onboarding progress
foreach ($request->onboarding_sub_items_progress as $value) {
$stage_id = ['stage_id' => $current_pending_stage_details->stage_id, 'client_id' => $id, 'name' => $value ];
$stage_id = [
'stage_id' => $current_pending_stage_details->stage_id,
'client_id' => $id,
'name' => $value
];
$progress_arr = [
'status' => 'COMPLETED'
];
@@ -1154,10 +1220,7 @@ class ClientsController extends Controller
//update the status of onboarding progress stage in clients
$get_stage_onboarding_status = Models\ClientOnboardingProgress::where('client_id', $id)->where('stage_id', $current_pending_stage_details->stage_id)->where('status', 'COMPLETED')->get();
// dd($get_stage_onboarding_status);
$onboarding_progress_stage = json_decode($client_update->onboarding_progress_stage, true);
// dd(count($get_stage_subs_items) == count($get_stage_onboarding_status));
if (count($get_stage_subs_items) == count($get_stage_onboarding_status)) {
//check if all items have been completed and update
$onboarding_progress_stage[$current_pending_stage_details->stage] = 'COMPLETED';
@@ -1169,7 +1232,6 @@ class ClientsController extends Controller
#$pending_stage = array_key_first($pending_stage);
reset($pending_stage);
$pending_stage = key($pending_stage);
// dd($pending_stage);
if ($pending_stage == true) {
//Pending Exist
$client_update->progress_indicator = $pending_stage;
@@ -1276,15 +1338,16 @@ class ClientsController extends Controller
#$client_update->progress_indicators = json_encode($request->onboarding_sub_items_progress);
if ($client_update->progress_indicator != 'COMPLETED') {
$client_update->onboarding_progress_stage = json_encode($onboarding_progress_stage);
// dump(json_encode($onboarding_progress_stage));
$progress_breakdown = array_count_values($onboarding_progress_stage);
// dd($progress_breakdown);
if (array_has($progress_breakdown, ['COMPLETED']) == false) {
// dd('foo');
$indicator_score = "0";
}
else{
$indicator_score = ($progress_breakdown['COMPLETED']/count($onboarding_progress_stage)) * 100;
}
$indicator_score = number_format($indicator_score);
$client_update->progress_indicator_score = $indicator_score;
}