bug fixes, senderID polishing, support fees, paperless partial

This commit is contained in:
Kwesi Banson
2024-07-02 09:25:00 +00:00
parent 318fddbff0
commit edb78d1bfc
116 changed files with 1488 additions and 368 deletions

View File

@@ -380,6 +380,47 @@ class ClientsController extends Controller
$this->logUsersActivity($type = 'staff', $content);
return response()->json($data, 200);
}
public function supportFeesStore(Request $request){
$request->validate([
'client_id' => 'required',
'services' => 'required',
'invoice_number' => 'required',
// 'invoice_amount' => 'required|numeric',
'invoice_date' => 'required',
'status' => 'required',
'recurring' => 'required'
]);
$auth_user = session('current_user');
// dd($request->all());
$support_fees_arr = [
'invoice_number' => $request->invoice_number,
'recurring' => $request->recurring,
'invoice_date' => $request->invoice_date,
'invoice_status' => $request->status,
'services' => implode(',', $request->services),
'user_id' => $auth_user['id'],
'status' => $request->status,
'client_id' => $request->client_id
];
if ($request->has('remarks')) {
$support_fees_arr['remarks'] = $request->remarks;
}
$result = Models\ClientSupportFees::create($support_fees_arr);
#$payments = Models\ClientPayment::with('client_info', 'created_by_info')->find($result->id);
if ($result) {
$data = ['code' => 1, 'msg' => 'Support Fees Details successfully added'];
}
else{
$data = ['code' => 3, 'msg' => 'Your request could not be handled at this time'];
}
$user_id = session('current_user.id');
$username = session('current_user.name');
$content = "User ID : " . $user_id . " (" . $username . ") Added a support fees record";
$this->logUsersActivity($type = 'staff', $content);
return response()->json($data, 200);
}
public function shortcodeStore(Request $request)
{
$request->validate([
@@ -591,6 +632,7 @@ class ClientsController extends Controller
$recent_payments = Models\ClientPayment::where('client_id', $id)->orderBy('id', 'DESC')->get();
$countries = Models\Country::pluck('en_short_name','en_short_name');
$networks = Models\NetworkOps::pluck('name', 'id');
$support_fees = Models\ClientSupportFees::where('client_id', $id)->orderBy('id', 'DESC')->get();
$showdocuments = Models\ClientFile::where('client_id', $id)->get();
if ($showclient->status == 'Live') {
@@ -659,7 +701,7 @@ class ClientsController extends Controller
}
sort($networks_raw);
$recurring_arr = ['NO' => 'NO', 'Monthly' => 'Monthly', 'Quarterly' => 'Quarterly', 'Semiannual' => 'Semiannual', 'Yearly' => 'Yearly'];
$data = [
'page_title' => 'Client Profile',
@@ -680,7 +722,9 @@ class ClientsController extends Controller
'renewal_due' => $renewal_due,
'recent_payments' => $recent_payments,
'highlight_colour' => $highlight_colour,
'showdocuments' => $showdocuments
'showdocuments' => $showdocuments,
'support_fees' => $support_fees,
'recurring_arr' => $recurring_arr
];
return view('client.show', $data);
}
@@ -850,7 +894,6 @@ class ClientsController extends Controller
{
$client = Models\Client::find($id);
$service_type = Models\Service::orderBy('name', 'ASC')->pluck('name', 'name');
$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();
@@ -878,7 +921,6 @@ class ClientsController extends Controller
$onboarding_sub_items = Models\ClientOnboardingSubItem::where('stage_id', $stage_details->stage_id)->pluck('name', 'name');
}
/*
else{
@@ -890,10 +932,7 @@ class ClientsController extends Controller
}
*/
$how_we_got_clients_arr = ['Event : (GCCM) etc' => 'Event : (GCCM) etc', 'Referral' => 'Referral', 'Word of Mouth' => 'Word of Mouth', 'Marketing' => 'Marketing', 'Other' => 'Other'];
// 'current_services' => json_decode($client->services, true);
if ($client->support_emails) {
$support_emails = json_decode($client->support_emails, true);
$support_emails = array_combine($support_emails, $support_emails);