diff --git a/I Paid Almost NOTHING For This PC... But What IS It? [3CDVOTeF_hw].mp4 b/I Paid Almost NOTHING For This PC... But What IS It? [3CDVOTeF_hw].mp4 new file mode 100644 index 0000000..b53fc48 Binary files /dev/null and b/I Paid Almost NOTHING For This PC... But What IS It? [3CDVOTeF_hw].mp4 differ diff --git a/app/Http/Controllers/ClientsController.php b/app/Http/Controllers/ClientsController.php index 523296b..8785389 100755 --- a/app/Http/Controllers/ClientsController.php +++ b/app/Http/Controllers/ClientsController.php @@ -10,6 +10,7 @@ use App\Jobs\SendNewUssdClientEmail; use App\Jobs\SendUssdClientActiveEmail; use App\Jobs\SendNewNotesEmailAlert; use App\Jobs\SendOnboardingCompletedEmailAlert; +use App\Jobs\SendShortCodeListToFinance; use App\Http\Requests; use Carbon\Carbon; use App\Libs\PaperLessNgx; @@ -23,31 +24,8 @@ class ClientsController extends Controller * @return \Illuminate\Http\Response */ public function index(){ - - /* - $currentuser = session('current_user.name'); - $user_model = Models\SystemUser::find(session('current_user.id')); - #\Auth::user()->actions; - $actions = $user_model->actions; - dd($actions); - $clientModel = new Models\Client; - $currentuser = session('current_user.name'); - $user_model = Models\SystemUser::find(session('current_user.id')); - activity()->performedOn($clientModel) - ->causedBy($user_model) - ->log($currentuser . ' Opened the Client Module at: ' . date('Y-m-d H:i:s')); - */ - // ->log('viewed'); - /* - $client = Models\Client::find(3); - dd($client->client_services); - - $client_arr = new Models\Client; - $client_arr = $client_arr->with('auth_user_info','country_info', 'created_by_info')->orderBy('name', 'ASC')->paginate(15); - */ $data = [ 'page_title' => 'Clients', - //'client_arr' => $client_arr, 'current_user' => session('current_user') ]; return view('client.index-tabulator', $data); @@ -62,22 +40,15 @@ class ClientsController extends Controller return view('client.index-rawjs', $data); } public function getClientJson(Request $request){ - /* - $client_arr = new Models\Client; - $client_arr = $client_arr->with('auth_user_info','country_info', 'created_by_info', 'modified_by_info')->orderBy('name', 'ASC')->paginate(20); - - dump($request->all()); - $client_arr = $client_arr->with('auth_user_info','country_info', 'created_by_info', 'modified_by_info') - ->orderBy('name', 'ASC')->paginate(20); - } - */ + $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') ->orderBy('name', 'ASC') - ->paginate(15); + ->get(); + // ->paginate(15); if($request->has('keyword')){ $keyword = $request->keyword; @@ -88,7 +59,8 @@ class ClientsController extends Controller ->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("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') - ->paginate(15); + ->get(); + // ->paginate(15); } return response()->json($client_arr); @@ -133,7 +105,6 @@ class ClientsController extends Controller $industries = Models\Industry::orderBy('name', 'ASC')->pluck('name', 'name'); // $industries = Models\Industry::pluck('name', 'name')->orderBy('name', 'ASC'); - $data = [ 'page_title' => 'Create Client', 'countries' => $countries, @@ -274,10 +245,9 @@ class ClientsController extends Controller $notes_arr['highlight'] = 'YES'; } - - //dd($notes_arr); - $result = Models\ClientNote::create($notes_arr); + $result = Models\ClientNote::updateOrCreate(['services' => $request->services, 'client_id' => $request->client_id, 'auth_user_id' => $auth_user['id'] ], $notes_arr); // dd($result); + $client = Models\Client::find($request->client_id); $notes = Models\ClientNote::with('client_info', 'created_by_info')->find($result->id); //todo : send emails dispatch(new SendNewNotesEmailAlert($notes)); @@ -290,7 +260,7 @@ class ClientsController extends Controller } $user_id = session('current_user.id'); $username = session('current_user.name'); - $content = "User ID : " . $user_id . " (" . $username . ") Added a new Note"; + $content = "User ID : " . $user_id . " (" . $username . ") Added a new Note for : " . $client->name; $this->logUsersActivity($type = 'staff', $content); return response()->json($data, 200); } @@ -360,9 +330,7 @@ class ClientsController extends Controller // 'short_code' => 'sometimes|numeric' ]); $auth_user = session('current_user'); - // dump($request->has('short_code')); - //dd($request->all()); - // dump($request->short_code); + if ($request->short_code !== null) { $check = is_numeric($request->short_code); if ($check == false) { @@ -370,7 +338,7 @@ class ClientsController extends Controller return response()->json($data, 200); } } - // dd($request->all()); + $finance_arr = [ 'invoice_number' => $request->invoice_number, 'invoice_amount' => $request->invoice_amount, @@ -384,8 +352,15 @@ class ClientsController extends Controller if ($request->has('remarks')) { $finance_arr['remarks'] = $request->remarks; } - // dd($finance_arr); - $result = Models\ClientPayment::create($finance_arr); + $client = Models\Client::find($request->client_id); + $result = Models\ClientPayment::updateOrCreate(['invoice_number' => $request->invoice_number, 'client_id' => $request->client_id, ], $finance_arr); + if ($request->has('short_code')) { + $short_code_list = Models\ClientShortCode::where('client_id', $request->client_id)->get(); + $client = Models\Client::find($request->client_id); + $message_body = $auth_user['name'] . " has added a new Short Code ($request->short_code) Payment entry for " . $client->name; + + dispatch(new SendShortCodeListToFinance($short_code_list, $message_body, $finance_arr)); + } #$payments = Models\ClientPayment::with('client_info', 'created_by_info')->find($result->id); if ($result) { @@ -396,7 +371,7 @@ class ClientsController extends Controller } $user_id = session('current_user.id'); $username = session('current_user.name'); - $content = "User ID : " . $user_id . " (" . $username . ") Added a payment record"; + $content = "User ID : " . $user_id . " (" . $username . ") Added a payment record for : " . $client->name; $this->logUsersActivity($type = 'staff', $content); return response()->json($data, 200); } @@ -427,7 +402,7 @@ class ClientsController extends Controller $support_fees_arr['remarks'] = $request->remarks; } $result = Models\ClientSupportFees::create($support_fees_arr); - + $client = Models\Client::find($request->client_id); #$payments = Models\ClientPayment::with('client_info', 'created_by_info')->find($result->id); if ($result) { $data = ['code' => 1, 'msg' => 'Support Fees Details successfully added']; @@ -437,7 +412,7 @@ class ClientsController extends Controller } $user_id = session('current_user.id'); $username = session('current_user.name'); - $content = "User ID : " . $user_id . " (" . $username . ") Added a support fees record"; + $content = "User ID : " . $user_id . " (" . $username . ") Added a support fees record for : " . $client->name; $this->logUsersActivity($type = 'staff', $content); return response()->json($data, 200); } @@ -451,15 +426,17 @@ class ClientsController extends Controller 'status' => 'required', 'remarks' => 'required', 'launch_date' => 'required', - 'expiry_date' => 'required' + 'expiry_date' => 'required', + 'monthly_fee' => 'sometimes' ]); + // dd($request->all()); $auth_user = session('current_user'); #$network = Models\NetworkOps::find($request->network); - $mnoCountry = $this->getMnoCountry($request->network); - if ($mnoCountry == false) { - $data = ['code' => 3, 'msg' => 'Your request could not be handled at this time']; - return response()->json($data, 200); - } + // $mnoCountry = $this->getMNO($request->network); + // if ($mnoCountry == false) { + // $data = ['code' => 3, 'msg' => 'Your request could not be handled at this time']; + // return response()->json($data, 200); + // } /* $networks_raw = [ 'AirtelTigo GH' => 'AirtelTigo GH', @@ -498,7 +475,7 @@ class ClientsController extends Controller 'name' => $request->name, 'client_id' => $request->client_id, 'network' => $request->network, - 'country' => $mnoCountry, //$network->country, + // 'country' => $mnoCountry, //$network->country, 'shortcode' => $request->shortcode, 'code_type' => $request->code_type, 'toll_free' => $request->toll_free, @@ -506,13 +483,19 @@ class ClientsController extends Controller 'launch_date' => $request->launch_date, 'expiry_date' => $request->expiry_date, 'status' => $request->status + ]; + + // dd($shortcode_arr); if ($request->has('remarks')) { $shortcode_arr['remarks'] = $request->remarks; } - + if ($request->has('monthly_fee')) { + $shortcode_arr['monthly_fee'] = $request->monthly_fee; + } + $result = Models\ClientShortCode::create($shortcode_arr); - + $client = Models\Client::find($request->client_id); if ($result) { $data = ['code' => 1, 'msg' => 'ShortCode Details successfully added']; } @@ -521,7 +504,7 @@ class ClientsController extends Controller } $user_id = session('current_user.id'); $username = session('current_user.name'); - $content = "User ID : " . $user_id . " (" . $username . ") Added new short code"; + $content = "User ID : " . $user_id . " (" . $username . ") Added new short code for " . $client->name; $this->logUsersActivity($type = 'staff', $content); return response()->json($data, 200); } @@ -535,6 +518,7 @@ class ClientsController extends Controller 'invoice_date' => 'required', 'invoice_status' => 'required' ]); + $auth_user = session('current_user'); $payment = Models\ClientPayment::findOrFail($request->payment_id); @@ -542,9 +526,31 @@ class ClientsController extends Controller $payment->invoice_amount = $request->invoice_amount; $payment->invoice_date = $request->invoice_date; $payment->invoice_status = $request->invoice_status; + $payment->short_code = ($request->short_code) ? $request->short_code : ""; + $payment->services = implode(',', $request->services); $result = $payment->save(); - + $client = Models\Client::find($request->client_id); + if ($request->has('short_code')) { + $short_code_list = Models\ClientShortCode::where('client_id', $request->client_id)->get(); + + $finance_arr = [ + 'invoice_number' => $request->invoice_number, + 'invoice_amount' => $request->invoice_amount, + 'invoice_date' => $request->invoice_date, + 'invoice_status' => $request->invoice_status, + 'short_code' => ($request->short_code) ? $request->short_code : "", + 'services' => implode(',', $request->services), + 'user_id' => $auth_user['id'], + 'client_id' => $request->client_id + ]; + if ($request->has('remarks')) { + $finance_arr['remarks'] = $request->remarks; + } + $message_body = $auth_user['name'] . " has updated a Short Code ($request->short_code) Payment entry for " . $client->name; + #dispatch(new SendShortCodeListToFinance($short_code_list, $message_body, $finance_arr)); + } + if ($result) { $data = ['code' => 1, 'msg' => 'Payment Details successfully updated']; } @@ -553,8 +559,11 @@ class ClientsController extends Controller } $user_id = session('current_user.id'); $username = session('current_user.name'); - $content = "User ID : " . $user_id . " (" . $username . ") updated an existing payment record"; + $content = "User ID : " . $user_id . " (" . $username . ") updated an existing payment record for " . $client->name; $this->logUsersActivity($type = 'staff', $content); + + + return response()->json($data, 200); } public function shortCodeUpdate(Request $request){ @@ -564,6 +573,7 @@ class ClientsController extends Controller 'shortcode' => 'required', 'code_type' => 'required', 'toll_free' => 'required', + 'monthly_fee' => 'sometimes', 'status' => 'required', 'remarks' => 'required', 'launch_date' => 'required', @@ -592,18 +602,21 @@ class ClientsController extends Controller if ($request->has('remarks')) { $shortcode_arr['remarks'] = $request->remarks; } + if ($request->has('monthly_fee')) { + $shortcode_arr['monthly_fee'] = $request->monthly_fee; + } // $payment = Models\ClientShortCode::findOrFail($request->shortcode_id); $result = Models\ClientShortCode::where('id', $request->shortcode_id)->update($shortcode_arr); if ($result) { - $data = ['code' => 1, 'msg' => 'Payment Details successfully updated']; + $data = ['code' => 1, 'msg' => 'Short Code Details successfully updated']; } 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 . ") updated short code enty"; + $content = "User ID : " . $user_id . " (" . $username . ") updated short code enty for " . $request->short_code; $this->logUsersActivity($type = 'staff', $content); return response()->json($data, 200); } @@ -614,7 +627,6 @@ class ClientsController extends Controller * @return \Illuminate\Http\Response */ public function show($id){ - //with('short_code_info')-> $showclient = Models\Client::with('service_info', 'country_flag_info', 'auth_user_info', 'short_code_info')->find($id); //$clientModel = new Models\Client; /* @@ -639,6 +651,12 @@ class ClientsController extends Controller $service_type_names = Models\Service::pluck('name', 'name'); $show_services = Models\ClientCategory::where('client_id', $id)->get(); //$networks_raw = ['AirtelTigo GH' => 'AirtelTigo GH','MTN GH' => 'MTN GH', 'Airtel MW' => 'Airtel MW', 'Airtel Zambia' => 'Airtel Zambia', 'TNM MW' => 'TNM MW', 'Airtel MW' => 'Airtel MW']; + // $networks_raw_two = Models\NetworkOps::pluck('country', 'id'); + // dd($networks_raw_two); + $country_networks = \DB::table('network_operators')->Select(\DB::raw('id, concat(name, " (", country, ")") AS network'))->orderBy('network')->pluck('network', 'network'); + // $country_networks = \DB::table('network_operators')->Select(\DB::raw('concat(name, " (", country, ")") AS network)')->orderBy('network')->get()->toArray(); + // $country_networks = \DB::table('network_operators')->Select(\DB::raw('concat(name, " (", country, ")") AS network)'))->pluck('network', 'network'); + $networks_raw = [ 'AirtelTigo GH' => 'AirtelTigo GH', 'MTN GH' => 'MTN GH', @@ -652,12 +670,16 @@ class ClientsController extends Controller 'Orange Kenya' => 'Orange Kenya' ]; //->where('highlight', 'NO') - $show_notes = Models\ClientNote::with('created_by_info', 'client_info')->where('client_id', $id)->orderBy('id', 'DESC')->get()->take(20); + $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); + $voice_codes = Models\ClientShortCode::where('client_id', $id)->where('code_type', 'voice')->get(); $sms_codes = Models\ClientShortCode::where('client_id', $id)->where('code_type', 'sms')->get(); $ussd_codes = Models\ClientShortCode::where('client_id', $id)->where('code_type', 'ussd')->get(); $recent_payments = Models\ClientPayment::where('client_id', $id)->orderBy('id', 'DESC')->get(); + $countries = Models\Country::pluck('en_short_name','en_short_name'); + // dd($countries); $networks = Models\NetworkOps::pluck('name', 'id'); $support_fees = Models\ClientSupportFees::where('client_id', $id)->orderBy('id', 'DESC')->get(); @@ -739,6 +761,7 @@ class ClientsController extends Controller 'service_type' => $service_type, 'service_type_names' => $service_type_names, 'show_notes' => $show_notes, + 'show_notes_highlight' => $show_notes_highlight, 'status_bg' => $status_bg, 'progress_status_bg' => $progress_status_bg, 'voice_codes' => $voice_codes, @@ -755,13 +778,17 @@ class ClientsController extends Controller 'support_fees' => $support_fees, 'recurring_arr' => $recurring_arr, 'client_sender_ids' => $client_sender_ids, - 'sender_id_statuses' => $sender_id_statuses + 'sender_id_statuses' => $sender_id_statuses, + 'country_network_arr' => $country_networks, + 'mnos_arr' => ['' => '-- Select Country first --'] ]; // dump($client_sender_ids); // foreach ($client_sender_ids as $value) { // dd($value->network_info->name); // } - return view('client.show', $data); + // dd($data); + // return view('client.show_original_copy', $data); + return view('client.show_test', $data); } public function showReadonly($id){ @@ -1109,7 +1136,7 @@ class ClientsController extends Controller * @return \Illuminate\Http\Response */ public function update(Requests\UpdateClientRequest $request, $id){ - // dump($request->all()); + // dd($request->all()); // \DB::connection()->enableQueryLog(); $client_update = Models\Client::find($id); $paperless = new PaperLessNgx(); @@ -1155,25 +1182,25 @@ class ClientsController extends Controller dispatch(new SendOnboardingCompletedEmailAlert($client)); } } - - $existing_documents = Models\ClientFile::where('client_id', $id)->get(); if ($request->has('document_one') && $request->has('document_one_name')) { if ($request->file('document_one')->isValid()) { - $filename = "erp_" . time() . str_random(4) . "." . $request->document_one->extension(); + $filename = "erp_" . time() . str_random(4) . "." . $request->document_one->extension(); $request->document_one->storeAs('client_files', $filename, 'public'); $document_arr['file_path'] = $filename; $client_update->name = $request->name; $store_location = "client_files"; - $top = $paperless->processPaperlessFile($request->document_one_name, $request->document_one_name, $filename, $store_location); + #$top = $paperless->processPaperlessFile($request->document_one_name, $request->document_one_name, $filename, $store_location); $document_arr['file_extension'] = $request->document_one->extension(); $document_arr['file_reff'] = time() . uniqid(); $document_arr['name'] = $request->document_one_name; $document_arr['created_by'] = session('current_user.id'); //$document_arr['client_id'] = $id; - $result = Models\ClientFile::create($document_arr, ['client_id' => $id]); + //$document_arr, + // $result = Models\ClientNote::updateOrCreate(['services' => $request->services, 'client_id' => $request->client_id, 'auth_user_id' => $auth_user['id'] ], $notes_arr); + $result = Models\ClientFile::updateOrCreate(['client_id' => $id, 'name' => $request->document_one_name], $document_arr); } } if ($request->has('document_two') && $request->has('document_two_name')) { @@ -1183,7 +1210,7 @@ class ClientsController extends Controller $document_arr['file_path'] = $filename; $client_update->name = $request->name; $store_location = "client_files"; - $top = $paperless->processPaperlessFile($request->document_two_name, $request->document_two_name, $filename, $store_location); + #$top = $paperless->processPaperlessFile($request->document_two_name, $request->document_two_name, $filename, $store_location); $document_arr['file_extension'] = $request->document_two->extension(); @@ -1193,7 +1220,7 @@ class ClientsController extends Controller $document_arr['client_id'] = $id; // $result = Models\ClientFile::create($document_arr); //$document_arr['client_id'] = $id; - $result = Models\ClientFile::create($document_arr, ['client_id' => $id]); + $result = Models\ClientFile::updateOrCreate(['client_id' => $id, 'name' => $request->document_two_name], $document_arr); } } if ($request->has('document_three') && $request->has('document_three_name')) { @@ -1204,7 +1231,7 @@ class ClientsController extends Controller $client_update->name = $request->name; $store_location = "client_files"; - $top = $paperless->processPaperlessFile($request->document_three_name, $request->document_three_name, $filename, $store_location); + #$top = $paperless->processPaperlessFile($request->document_three_name, $request->document_three_name, $filename, $store_location); $document_arr['file_extension'] = $request->document_three->extension(); $document_arr['file_reff'] = time() . uniqid(); @@ -1213,7 +1240,7 @@ class ClientsController extends Controller $document_arr['client_id'] = $id; // $result = Models\ClientFile::create($document_arr); //$document_arr['client_id'] = $id; - $result = Models\ClientFile::create($document_arr, ['client_id' => $id]); + $result = Models\ClientFile::updateOrCreate(['client_id' => $id, 'name' => $request->document_three_name], $document_arr); } } if ($request->has('other_document') && $request->has('other_document_name')) { @@ -1224,19 +1251,18 @@ class ClientsController extends Controller $client_update->name = $request->name; $store_location = "client_files"; - $top = $paperless->processPaperlessFile($request->other_document_name, $request->other_document_name, $filename, $store_location); + #$top = $paperless->processPaperlessFile($request->other_document_name, $request->other_document_name, $filename, $store_location); $document_arr['file_extension'] = $request->other_document->extension(); $document_arr['file_reff'] = time() . uniqid(); - $document_arr['name'] = $request->document_three_name; + $document_arr['name'] = ($request->other_document_name == null) ? 'Other Document' : $request->other_document_name; $document_arr['created_by'] = session('current_user.id'); $document_arr['client_id'] = $id; - $result = Models\ClientFile::create($document_arr); + // dd($document_arr); + $result = Models\ClientFile::updateOrCreate(['client_id' => $id, 'name' => $request->other_document_name], $document_arr); } } - - $client_update->name = $request->name; $client_update->email = $request->email; $client_update->phone = $request->phone ?? ""; @@ -1363,16 +1389,15 @@ class ClientsController extends Controller return true; } public function storeFiles(AddFilesRequest $request){ - $document_arr = $request->except('document'); if ($request->hasFile('document')) { if ($request->file('document')->isValid()) { - $filename = "erp_" . time() . "." . $request->document->extension(); + $filename = "erp_" . time() . "." . $request->document->extension(); $request->document->storeAs('client_files', $filename, 'public'); $document_arr['document'] = json_encode([$filename]); } } - + $client = Models\Client::find($request->client_id); $document_arr['file_extension'] = $request->document->extension(); $document_arr['file_reff'] = time() . uniqid(); $document_arr['last_modified_by'] = session('current_user.id'); @@ -1385,11 +1410,16 @@ class ClientsController extends Controller 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 . ") Document successfully uploaded for " . $client->name; + $this->logUsersActivity($type = 'staff', $content); return response()->json($data, 200); } public function getClientFile($id){ $client_file = Models\ClientFile::with('client_info')->findOrFail($id); + // dd($client_file); //PDF file is stored under project/public/download/info.pdf $file = public_path('documents/client_files/') . $client_file->file_path; @@ -1425,6 +1455,12 @@ class ClientsController extends Controller return $string; } + public function getMNO($id){ + $mno = Models\NetworkOps::find($id); + + return $mno; + + } public function getMnoCountry($network){ $networks_raw = [ 'AirtelTigo GH' => 'AirtelTigo GH', diff --git a/app/Http/Controllers/ContractRenewalReminderController.php b/app/Http/Controllers/ContractRenewalReminderController.php index 0ceb8b3..7940b92 100644 --- a/app/Http/Controllers/ContractRenewalReminderController.php +++ b/app/Http/Controllers/ContractRenewalReminderController.php @@ -71,11 +71,14 @@ class ContractRenewalReminderController extends Controller break; } } - if ($difference->days <= 10) { - $renew_ready['client_name'] = $value->client_info->name; - $renew_ready['account_manager_email'] = $value->created_by_info->email; - $renew_ready['days_to_renew'] = $difference->days; - dispatch(new SendSupportFeesReminderEmailAlert($renew_ready)); + if (isset($difference)) { + //will review this later + if ($difference->days <= 10) { + $renew_ready['client_name'] = $value->client_info->name; + $renew_ready['account_manager_email'] = $value->created_by_info->email; + $renew_ready['days_to_renew'] = $difference->days; + dispatch(new SendSupportFeesReminderEmailAlert($renew_ready)); + } } \Log::info('Support Fees Reminder schedule has successfully ran '); if (count($renew_ready) > 0) { diff --git a/app/Http/Controllers/GeneralDocumentsController.php b/app/Http/Controllers/GeneralDocumentsController.php index c272e91..0046f08 100644 --- a/app/Http/Controllers/GeneralDocumentsController.php +++ b/app/Http/Controllers/GeneralDocumentsController.php @@ -140,7 +140,7 @@ class GeneralDocumentsController extends Controller #sendToPaperLess $store_location = "general_files"; - $top = $paperless->processPaperlessFile($request->document_one_name, $request->document_one_category, $filename, $store_location); + #$top = $paperless->processPaperlessFile($request->document_one_name, $request->document_one_category, $filename, $store_location); $document_arr['file_extension'] = $request->document_one->extension(); $document_arr['file_reff'] = time() . uniqid(); @@ -158,7 +158,7 @@ class GeneralDocumentsController extends Controller #sendToPaperLess $store_location = "general_files"; - $top = $paperless->processPaperlessFile($request->document_two_name, $request->document_two_category, $filename, $store_location); + #$top = $paperless->processPaperlessFile($request->document_two_name, $request->document_two_category, $filename, $store_location); $document_arr['file_extension'] = $request->document_two->extension(); $document_arr['file_reff'] = time() . uniqid(); @@ -176,7 +176,7 @@ class GeneralDocumentsController extends Controller #sendToPaperLess $store_location = "general_files"; - $top = $paperless->processPaperlessFile($request->document_three_name, $request->document_three_category, $filename, $store_location); + #$top = $paperless->processPaperlessFile($request->document_three_name, $request->document_three_category, $filename, $store_location); $document_arr['file_extension'] = $request->document_three->extension(); $document_arr['file_reff'] = time() . uniqid(); diff --git a/app/Http/Controllers/HolidaysController.php b/app/Http/Controllers/HolidaysController.php new file mode 100644 index 0000000..cde9e40 --- /dev/null +++ b/app/Http/Controllers/HolidaysController.php @@ -0,0 +1,13 @@ +json($mno_arr); } + public function getCountryNetworks(Request $request){ + $mno_arr = Models\NetworkOps::where('country', $request->country)->pluck('name', 'id'); + // dd(count($mno_arr)); + if (count($mno_arr) == 0) { + $data = ['code' => '2', 'msg' => 'No MNOs found in the selected country']; + } + else{ + $data = ['code' => '1', 'mnos' => $mno_arr,]; + } + return response()->json($data); + } /** * Show the form for creating a new resource. @@ -388,7 +399,7 @@ class NetworkOperatorsController extends Controller $operator_update->name = $request->name; $store_location = "mno_files"; - $top = $paperless->processPaperlessFile($request->document_one_name, $request->document_one_category, $filename, $store_location); + #$top = $paperless->processPaperlessFile($request->document_one_name, $request->document_one_category, $filename, $store_location); $document_arr['file_extension'] = $request->document_one->extension(); $document_arr['file_reff'] = time() . uniqid(); @@ -406,7 +417,7 @@ class NetworkOperatorsController extends Controller $operator_update->name = $request->name; $store_location = "mno_files"; - $top = $paperless->processPaperlessFile($request->document_two_name, $request->document_two_category, $filename, $store_location); + #$top = $paperless->processPaperlessFile($request->document_two_name, $request->document_two_category, $filename, $store_location); $document_arr['file_extension'] = $request->document_two->extension(); $document_arr['file_reff'] = time() . uniqid(); @@ -424,7 +435,7 @@ class NetworkOperatorsController extends Controller // $operator_update->name = $request->name; $store_location = "mno_files"; - $top = $paperless->processPaperlessFile("sliding_rate", 'rates', $filename, $store_location); + #$top = $paperless->processPaperlessFile("sliding_rate", 'rates', $filename, $store_location); $document_arr['file_extension'] = $request->sliding_rate_file->extension(); diff --git a/app/Http/Controllers/ReportsController.php b/app/Http/Controllers/ReportsController.php index 66891e3..4cb7a4c 100644 --- a/app/Http/Controllers/ReportsController.php +++ b/app/Http/Controllers/ReportsController.php @@ -15,8 +15,38 @@ use Carbon\Carbon; -class ReportsController extends Controller -{ +class ReportsController extends Controller{ + public function overview(){ + $document_arr = \DB::table('general_documents') + ->select(\DB::raw('count(*) as docs_count, category')) + ->groupBy('category') + ->get(); + + $client_docs = \DB::table('client_files') + ->join('clients', 'clients.id', '=', 'client_files.client_id') + ->select(\DB::raw('count(*) as docs_count, clients.name, client_files.client_id')) + ->groupBy('clients.name', 'client_files.client_id') + ->get(); + + $mno_docs = \DB::table('mno_files') + ->join('network_operators', 'network_operators.id', '=', 'mno_files.mno_id') + ->select(\DB::raw('count(*) as docs_count, network_operators.name, mno_files.mno_id')) + ->groupBy('network_operators.name', 'mno_files.mno_id') + ->get(); + + + $data = [ + 'page_title' => 'Report Overview', + // 'vas_clients' => $vas_clients, + // 'domain_clients' => $domain_clients, + // 'recent_clients' => $recent_clients, + // 'user_activities' => $user_activities, + 'current_user' => session('current_user'), + // 'client_docs' => $client_docs, + 'mno_docs' => $mno_docs + ]; + return view('reports.overview', $data); + } public function getRecentClients(){ $data = [ 'page_title' => 'Recent Clients', @@ -43,4 +73,70 @@ class ReportsController extends Controller return response()->json($clients); } + + + public function getUserActivities(){ + #$user_activities = Models\UserActivity::where('user_id', '>', '1')->with('userInfo')->orderBy('created_at', 'DESC')->take(5)->get(); + $data = [ + 'page_title' => 'User Activities', + 'current_user' => session('current_user') + ]; + return view('reports.user-activities', $data); + } + + public function getUserActivitiesJson(Request $request){ + #$user_activities = Models\UserActivity::where('user_id', '>', '1')->with('userInfo')->orderBy('created_at', 'DESC')->take(5)->get(); + $user_activities = \DB::table('user_activities') + ->join('auth_users', 'auth_users.id', '=', 'user_activities.user_id') + ->select('user_activities.id','auth_users.name', 'user_activities.content', 'user_activities.ip_address', 'user_activities.created_at', + 'user_activities.updated_at') + ->whereRaw("user_activities.type = 'staff'") + ->orderBy('user_activities.created_at', 'DESC') + ->get(); + + + if($request->has('keyword')){ + $keyword = $request->keyword; + $user_activities = \DB::table('user_activities') + ->join('auth_users', 'auth_users.id', '=', 'user_activities.user_id') + ->select('user_activities.id','auth_users.name', 'user_activities.content', 'user_activities.ip_address', 'user_activities.created_at', 'user_activities.updated_at') + ->whereRaw("user_activities.name like '%$keyword%' or user_activities.ip_address like '%$keyword%' OR user_activities.created_at like '%$keyword%' OR user_activities.updated_at like '%$keyword%'") + ->orderBy('user_activities.created_at', 'DESC') + ->get(); + // ->paginate(15); + } + return response()->json($user_activities); + } + + public function getAmNewClients(){ + // $new_clients = Models\Client::where() + } + + public function getAmNewNotes(){ + + } + public function getClientsByService(){ + $data = [ + 'page_title' => 'Clients By Service', + 'current_user' => session('current_user') + ]; + return view('reports.clients-by-service', $data); + } + public function getClientsByServiceJson(){ + $keyword = "USSD"; + $clients = \DB::table('clients') + ->join('auth_users AS aumngr', 'aumngr.id', '=', 'clients.auth_user_id') + ->select('clients.name', 'clients.services', 'clients.status', 'clients.country', 'aumngr.name As accountMgr', 'clients.created_at') + ->whereRaw("services like '%$keyword%'") + ->orderBy('name', 'ASC')->get(); + + return response()->json($clients); + + } + public function name(){ + + $list = ['first', 'second', 'third']; + // return $list[2]; + print($list[2]); + } } diff --git a/app/Http/Controllers/SenderIdController.php b/app/Http/Controllers/SenderIdController.php index 66c2817..d8dcfa9 100644 --- a/app/Http/Controllers/SenderIdController.php +++ b/app/Http/Controllers/SenderIdController.php @@ -27,7 +27,7 @@ class SenderIdController extends Controller ->join('staff_members AS staffmodify', 'staffmodify.id', '=', 'sender_ids.last_modified_by') ->join('network_operators', 'network_operators.id', '=', 'sender_ids.network_id') ->join('clients', 'clients.id', '=', 'sender_ids.client_id') - ->select('sender_ids.id', 'clients.name AS clientName', 'network_operators.name AS networkName', 'network_operators.country', 'sender_ids.senderid', 'sender_ids.status', 'sender_ids.network_id', 'network_operators.country','sender_ids.remarks', 'staffcreate.name As createdBy', 'staffmodify.name AS modifiedBy') + ->select('sender_ids.id', 'clients.name AS clientName', 'network_operators.name AS networkName', 'network_operators.country', 'sender_ids.senderid', 'sender_ids.status', 'sender_ids.network_id', 'network_operators.country','sender_ids.remarks', 'staffcreate.name As createdBy','sender_ids.direct_mno', 'staffmodify.name AS modifiedBy') ->orderBy('sender_ids.senderid', 'ASC') ->paginate(15); @@ -38,8 +38,8 @@ class SenderIdController extends Controller ->join('staff_members AS staffmodify', 'staffmodify.id', '=', 'sender_ids.last_modified_by') ->join('network_operators', 'network_operators.id', '=', 'sender_ids.network_id') ->join('clients', 'clients.id', '=', 'sender_ids.client_id') - ->select('sender_ids.id', 'clients.name AS clientName', 'network_operators.name AS networkName', 'network_operators.country', 'sender_ids.senderid', 'sender_ids.status', 'sender_ids.network_id', 'network_operators.country','sender_ids.remarks', 'staffcreate.name As createdBy', 'staffmodify.name AS modifiedBy') - ->whereRaw("sender_ids.senderid LIKE '%$keyword%' OR sender_ids.status LIKE '%$keyword%' OR network_operators.name LIKE '%$keyword%' OR network_operators.country LIKE '%$keyword%' OR staffcreate.name LIKE '%$keyword%' OR staffmodify.name LIKE '%$keyword%' OR clients.name LIKE '%$keyword%'") + ->select('sender_ids.id', 'clients.name AS clientName', 'network_operators.name AS networkName', 'network_operators.country', 'sender_ids.senderid', 'sender_ids.status', 'sender_ids.network_id', 'network_operators.country','sender_ids.remarks', 'staffcreate.name As createdBy', 'sender_ids.direct_mno', 'staffmodify.name AS modifiedBy') + ->whereRaw("sender_ids.senderid LIKE '%$keyword%' OR sender_ids.status LIKE '%$keyword%' OR network_operators.name LIKE '%$keyword%' OR network_operators.country LIKE '%$keyword%' OR staffcreate.name LIKE '%$keyword%' OR staffmodify.name LIKE '%$keyword%' OR clients.name LIKE '%$keyword%' OR sender_ids.direct_mno LIKE '%$keyword%'") ->orderBy('sender_ids.senderid', 'ASC') ->paginate(15); } @@ -51,6 +51,8 @@ class SenderIdController extends Controller $networks = \DB::table('network_operators')->Select(\DB::raw('id, concat(name, " (", country, ")") AS network'))->orderBy('network')->get()->toArray(); $network_arr = array_pluck($networks, 'network', 'id'); + $direct_mno_arr = ['YES' => 'YES', 'NO' => 'NO']; + // dd($network_arr); #$network_arr = array_combine($network_arr, $network_arr); @@ -61,9 +63,10 @@ class SenderIdController extends Controller $data = [ 'page_title' => 'Create Sender ID', - 'network_arr' => $network_arr, + 'network_arr' => [], // $network_arr, 'status' => $status, 'clients' => $clients, + 'direct_mno_arr' => $direct_mno_arr, 'staffmembers' => $staffmembers ]; @@ -87,7 +90,16 @@ class SenderIdController extends Controller $senderid_arr['created_by'] = session('current_user.id'); $senderid_arr['last_modified_by'] = session('current_user.id'); $senderid_arr['remarks'] = $request->remarks ?? ''; - + if ($request->direct_mno == 'NO') { + $mno_world_wide = Models\Worldwidemno::find($request->network_id); + // code... save in the network ops with status as non-direct ... user createOrUpdate method + $network_ops_arr['name'] = $mno_world_wide->network; + $network_ops_arr['country'] = $mno_world_wide->country; + $network_ops_arr['name'] = $mno_world_wide->network; + $network_ops_arr['direct_business'] = 'NO'; // $mno_world_wide->network; + $result = Models\NetworkOps::updateOrCreate(['name' => $mno_world_wide->network, 'country' => $mno_world_wide->country, 'direct_business' => 'NO'], $network_ops_arr); + } + // dd($senderid_arr); $result = Models\SenderId::create($senderid_arr); @@ -169,4 +181,18 @@ class SenderIdController extends Controller return response()->json([ 'code' => 3, 'msg' => 'Request could not be handled at this time']); } } + + + public function getMNOList($type){ + if ($type == 'YES') { + $data_arr = \DB::table('network_operators')->Select(\DB::raw('id, concat(name, " (", country, ")") AS name'))->orderBy('country')->get()->toArray(); + } + elseif ($type == 'NO') { + $data_arr = \DB::table('mno_world_wide')->Select(\DB::raw('id, concat(network, " (", country, ")") AS name'))->orderBy('country')->get()->toArray(); + } + else{ + return response()->json(['code' => 3, 'msg' => 'invalid request']); + } + return response()->json(['code' => 1, 'msg' => 'success', 'result' => $data_arr]); + } } diff --git a/app/Http/Controllers/ShortCodesController.php b/app/Http/Controllers/ShortCodesController.php index b4af376..7c128f5 100644 --- a/app/Http/Controllers/ShortCodesController.php +++ b/app/Http/Controllers/ShortCodesController.php @@ -26,22 +26,36 @@ class ShortCodesController extends Controller{ ->select('code_type', \DB::raw('count(*) as total')) ->groupBy('code_type') ->get(); + $networks_raw = [ + 'AirtelTigo GH' => 'AirtelTigo GH', + 'MTN GH' => 'MTN GH', + 'Airtel MW' => 'Airtel MW', + 'Airtel Zambia' => 'Airtel Zambia', + 'TNM MW' => 'TNM MW', + 'Airtel MW' => 'Airtel MW', + 'Safaricom Kenya' => 'Safaricom Kenya', + 'Airtel Kenya' => 'Airtel Kenya', + 'Telkom Kenya' => 'Telkom Kenya', + 'Orange Kenya' => 'Orange Kenya' + ]; + sort($networks_raw); $data = [ 'page_title' => 'Short Codes', 'type' => 'SMS', 'codes_data' => $codes_data, + 'networks_raw' => array_combine($networks_raw, $networks_raw), 'current_user' => session('current_user') ]; return view('shortcodes.smsindex', $data); } public function getShortCodesJson(Request $request){ - #$this->log_query(); + $this->log_query(); //$codes_data = Models\ClientShortCode::with('client_info', 'update_info')->where('code_type', 'sms')->orderBy('id', 'DESC')->get(); $shortcode_arr = \DB::table('client_short_codes') ->join('auth_users', 'auth_users.id', '=', 'client_short_codes.last_updated_by') ->join('clients', 'clients.id', '=', 'client_short_codes.client_id') - ->select('client_short_codes.id', 'client_short_codes.name', 'client_short_codes.shortcode', 'clients.name AS clientName', 'client_short_codes.network', 'client_short_codes.toll_free', 'client_short_codes.status', 'client_short_codes.remarks', 'client_short_codes.launch_date', 'client_short_codes.expiry_date', 'client_short_codes.last_updated_by', 'auth_users.name AS modifiedBy') + ->select('client_short_codes.id', 'client_short_codes.name', 'client_short_codes.shortcode', 'clients.name AS clientName', 'client_short_codes.network', 'client_short_codes.toll_free', 'client_short_codes.monthly_fee', 'client_short_codes.status', 'client_short_codes.remarks', 'client_short_codes.launch_date', 'client_short_codes.expiry_date', 'client_short_codes.last_updated_by', 'auth_users.name AS modifiedBy') ->where('client_short_codes.code_type', 'sms') ->orderBy('client_short_codes.shortcode', 'ASC') ->paginate(15); @@ -52,8 +66,8 @@ class ShortCodesController extends Controller{ $shortcode_arr = \DB::table('client_short_codes') ->join('auth_users', 'auth_users.id', '=', 'client_short_codes.last_updated_by') ->join('clients', 'clients.id', '=', 'client_short_codes.client_id') - ->select('client_short_codes.id', 'client_short_codes.name', 'client_short_codes.shortcode', 'clients.name AS clientName', 'client_short_codes.network', 'client_short_codes.toll_free', 'client_short_codes.status', 'client_short_codes.remarks', 'client_short_codes.launch_date', 'client_short_codes.expiry_date', 'client_short_codes.last_updated_by', 'auth_users.name AS modifiedBy') - ->whereRaw("code_type = '$code_type' AND (client_short_codes.name LIKE '%$keyword%' OR client_short_codes.shortcode LIKE '%$keyword%' OR client_short_codes.status LIKE '%$keyword%' OR client_short_codes.network LIKE '%$keyword%' OR client_short_codes.toll_free LIKE '%$keyword%' OR client_short_codes.launch_date LIKE '%$keyword%' OR client_short_codes.expiry_date LIKE '%$keyword%' OR clients.name LIKE '%$keyword%' OR auth_users.name LIKE '%$keyword%')") + ->select('client_short_codes.id', 'client_short_codes.name', 'client_short_codes.shortcode', 'clients.name AS clientName', 'client_short_codes.network', 'client_short_codes.toll_free', 'client_short_codes.monthly_fee', 'client_short_codes.status', 'client_short_codes.remarks', 'client_short_codes.launch_date', 'client_short_codes.expiry_date', 'client_short_codes.last_updated_by', 'auth_users.name AS modifiedBy') + ->whereRaw("code_type = '$code_type' AND (client_short_codes.name LIKE '%$keyword%' OR client_short_codes.shortcode LIKE '%$keyword%' OR client_short_codes.status LIKE '%$keyword%' OR client_short_codes.network LIKE '%$keyword%' OR client_short_codes.toll_free LIKE '%$keyword%' OR client_short_codes.monthly_fee LIKE '%$keyword%' OR client_short_codes.launch_date LIKE '%$keyword%' OR client_short_codes.expiry_date LIKE '%$keyword%' OR clients.name LIKE '%$keyword%' OR auth_users.name LIKE '%$keyword%')") // ->where('code_type', $code_type) ->orderBy('client_short_codes.shortcode', 'ASC') ->paginate(15); @@ -82,7 +96,7 @@ class ShortCodesController extends Controller{ $shortcode_arr = \DB::table('client_short_codes') ->join('auth_users', 'auth_users.id', '=', 'client_short_codes.last_updated_by') ->join('clients', 'clients.id', '=', 'client_short_codes.client_id') - ->select('client_short_codes.id', 'client_short_codes.name', 'client_short_codes.shortcode', 'clients.name AS clientName', 'client_short_codes.network', 'client_short_codes.toll_free', 'client_short_codes.status', 'client_short_codes.remarks', 'client_short_codes.launch_date', 'client_short_codes.expiry_date', 'client_short_codes.last_updated_by', 'auth_users.name AS modifiedBy') + ->select('client_short_codes.id', 'client_short_codes.name', 'client_short_codes.shortcode', 'clients.name AS clientName', 'client_short_codes.network', 'client_short_codes.toll_free', 'client_short_codes.monthly_fee', 'client_short_codes.status', 'client_short_codes.remarks', 'client_short_codes.launch_date', 'client_short_codes.expiry_date', 'client_short_codes.last_updated_by', 'auth_users.name AS modifiedBy') ->where('client_short_codes.code_type', 'ussd') ->orderBy('client_short_codes.shortcode', 'ASC') ->paginate(15); @@ -93,8 +107,8 @@ class ShortCodesController extends Controller{ $shortcode_arr = \DB::table('client_short_codes') ->join('auth_users', 'auth_users.id', '=', 'client_short_codes.last_updated_by') ->join('clients', 'clients.id', '=', 'client_short_codes.client_id') - ->select('client_short_codes.id', 'client_short_codes.name', 'client_short_codes.shortcode', 'clients.name AS clientName', 'client_short_codes.network', 'client_short_codes.toll_free', 'client_short_codes.status', 'client_short_codes.remarks', 'client_short_codes.launch_date', 'client_short_codes.expiry_date', 'client_short_codes.last_updated_by', 'auth_users.name AS modifiedBy') - ->whereRaw("code_type = '$code_type' AND (client_short_codes.name LIKE '%$keyword%' OR client_short_codes.shortcode LIKE '%$keyword%' OR client_short_codes.status LIKE '%$keyword%' OR client_short_codes.network LIKE '%$keyword%' OR client_short_codes.toll_free LIKE '%$keyword%' OR client_short_codes.launch_date LIKE '%$keyword%' OR client_short_codes.expiry_date LIKE '%$keyword%' OR clients.name LIKE '%$keyword%' OR auth_users.name LIKE '%$keyword%')") + ->select('client_short_codes.id', 'client_short_codes.name', 'client_short_codes.shortcode', 'clients.name AS clientName', 'client_short_codes.network', 'client_short_codes.toll_free', 'client_short_codes.monthly_fee', 'client_short_codes.status', 'client_short_codes.remarks', 'client_short_codes.launch_date', 'client_short_codes.expiry_date', 'client_short_codes.last_updated_by', 'auth_users.name AS modifiedBy') + ->whereRaw("code_type = '$code_type' AND (client_short_codes.name LIKE '%$keyword%' OR client_short_codes.shortcode LIKE '%$keyword%' OR client_short_codes.status LIKE '%$keyword%' OR client_short_codes.network LIKE '%$keyword%' OR client_short_codes.toll_free LIKE '%$keyword%' OR client_short_codes.monthly_fee LIKE '%$keyword%' OR client_short_codes.launch_date LIKE '%$keyword%' OR client_short_codes.expiry_date LIKE '%$keyword%' OR clients.name LIKE '%$keyword%' OR auth_users.name LIKE '%$keyword%')") // ->where('code_type', $code_type) ->orderBy('client_short_codes.shortcode', 'ASC') ->paginate(15); @@ -124,7 +138,7 @@ class ShortCodesController extends Controller{ $shortcode_arr = \DB::table('client_short_codes') ->join('auth_users', 'auth_users.id', '=', 'client_short_codes.last_updated_by') ->join('clients', 'clients.id', '=', 'client_short_codes.client_id') - ->select('client_short_codes.id', 'client_short_codes.name', 'client_short_codes.shortcode', 'clients.name AS clientName', 'client_short_codes.network', 'client_short_codes.toll_free', 'client_short_codes.status', 'client_short_codes.remarks', 'client_short_codes.launch_date', 'client_short_codes.expiry_date', 'client_short_codes.last_updated_by', 'auth_users.name AS modifiedBy') + ->select('client_short_codes.id', 'client_short_codes.name', 'client_short_codes.shortcode', 'clients.name AS clientName', 'client_short_codes.network', 'client_short_codes.toll_free', 'client_short_codes.monthly_fee','client_short_codes.status', 'client_short_codes.remarks', 'client_short_codes.launch_date', 'client_short_codes.expiry_date', 'client_short_codes.last_updated_by', 'auth_users.name AS modifiedBy') ->where('client_short_codes.code_type', 'voice') ->orderBy('client_short_codes.shortcode', 'ASC') ->paginate(15); @@ -135,8 +149,8 @@ class ShortCodesController extends Controller{ $shortcode_arr = \DB::table('client_short_codes') ->join('auth_users', 'auth_users.id', '=', 'client_short_codes.last_updated_by') ->join('clients', 'clients.id', '=', 'client_short_codes.client_id') - ->select('client_short_codes.id', 'client_short_codes.name', 'client_short_codes.shortcode', 'clients.name AS clientName', 'client_short_codes.network', 'client_short_codes.toll_free', 'client_short_codes.status', 'client_short_codes.remarks', 'client_short_codes.launch_date', 'client_short_codes.expiry_date', 'client_short_codes.last_updated_by', 'auth_users.name AS modifiedBy') - ->whereRaw("code_type = '$code_type' AND (client_short_codes.name LIKE '%$keyword%' OR client_short_codes.shortcode LIKE '%$keyword%' OR client_short_codes.status LIKE '%$keyword%' OR client_short_codes.network LIKE '%$keyword%' OR client_short_codes.toll_free LIKE '%$keyword%' OR client_short_codes.launch_date LIKE '%$keyword%' OR client_short_codes.expiry_date LIKE '%$keyword%' OR clients.name LIKE '%$keyword%' OR auth_users.name LIKE '%$keyword%')") + ->select('client_short_codes.id', 'client_short_codes.name', 'client_short_codes.shortcode', 'clients.name AS clientName', 'client_short_codes.network', 'client_short_codes.toll_free', 'client_short_codes.monthly_fee', 'client_short_codes.status', 'client_short_codes.remarks', 'client_short_codes.launch_date', 'client_short_codes.expiry_date', 'client_short_codes.last_updated_by', 'auth_users.name AS modifiedBy') + ->whereRaw("code_type = '$code_type' AND (client_short_codes.name LIKE '%$keyword%' OR client_short_codes.shortcode LIKE '%$keyword%' OR client_short_codes.status LIKE '%$keyword%' OR client_short_codes.network LIKE '%$keyword%' OR client_short_codes.toll_free LIKE '%$keyword%' OR client_short_codes.monthly_fee LIKE '%$keyword%' OR client_short_codes.launch_date LIKE '%$keyword%' OR client_short_codes.expiry_date LIKE '%$keyword%' OR clients.name LIKE '%$keyword%' OR auth_users.name LIKE '%$keyword%')") // ->where('code_type', $code_type) ->orderBy('client_short_codes.shortcode', 'ASC') ->paginate(15); diff --git a/app/Http/Controllers/StaffMembersController.php b/app/Http/Controllers/StaffMembersController.php index 2069f0d..8071849 100644 --- a/app/Http/Controllers/StaffMembersController.php +++ b/app/Http/Controllers/StaffMembersController.php @@ -9,6 +9,28 @@ use Session; class StaffMembersController extends Controller { public function index(){ + $staff_members_arr = Models\StaffMember::paginate(10); + // dd($staff_members_arr); + + $data = [ + 'page_title' => 'Staff Members', + 'staff_members' => $staff_members_arr, + 'current_user' => session('current_user') + ]; + return view('staff_members.index-two', $data); + } + public function profile($staff_member_id){ + $staff_member = Models\StaffMember::find($staff_member_id); + // dd($staff_member); + + $data = [ + 'page_title' => 'Staff Profile', + 'staff_member' => $staff_member, + 'current_user' => session('current_user') + ]; + return view('staff_members.profile', $data); + } + public function indexOld(){ $staff_members_arr = new Models\StaffMember; $data = [ 'page_title' => 'Staff Members', diff --git a/app/Http/Controllers/UtilityController.php b/app/Http/Controllers/UtilityController.php index e9fb0a8..d6749f6 100644 --- a/app/Http/Controllers/UtilityController.php +++ b/app/Http/Controllers/UtilityController.php @@ -6,9 +6,8 @@ use Illuminate\Http\Request; use App\Models; use Spatie\Activitylog\Models\Activity; -// use Illuminate\Contracts\Mail\Mailer; - - +use Illuminate\Contracts\Mail\Mailer; +use App\Jobs\SendTestEmail; class UtilityController extends Controller { @@ -17,7 +16,8 @@ class UtilityController extends Controller } public function EmailTest(Mailer $mailer) { - + dispatch(new SendTestEmail()); + /* $emails = ['kwesi@click-mobile.com', 'kwesi_banson@hotmail.com']; $data = [ @@ -30,6 +30,20 @@ class UtilityController extends Controller $message->from('erp@click-mobile.com', 'Click Mobile ERP'); $message->to($emails)->subject('New Notes'); }); + */ + /* + $emails = [ + 'kwesi@click-mobile.com', + 'kwesi_banson@hotmail.com' + ]; + $data = []; + $top = $mailer->send('emails.test', $data, function ($message) use ($data, $emails) { + $message->from('support@click-mobile.com', 'Click Mobile ERP'); + $message->to($emails)->subject('Short Code Invoices'); + }); + + dd($top); + */ } /** * maptest function to display the map view. @@ -37,7 +51,6 @@ class UtilityController extends Controller * @return Illuminate\View\View */ public function maptest(){ - return view('utility.map'); } @@ -145,5 +158,71 @@ class UtilityController extends Controller dump($activity_up->subject); //returns the instance of NewsItem that was created dump($activity_up->changes); } + + public function loadShortCodes(){ + $short_codes_file = public_path('misc/client_short_codes.csv'); + $codes_arr = file($short_codes_file); + + dump($codes_arr); + // "Friendly Name" + // 1 => "Shortcode" + // 2 => "Network" + // 3 => "Client" + // 4 => "Status" + // 0 => "Nexmo" + // 1 => "40520" + // 2 => "Safaricom" + // 3 => "Nexmo" + // 4 => "LIVE\r\n" + + $client_arr = []; + foreach ($codes_arr as $row) { + $row_arr = explode(',', $row); + $client_arr['name'] = trim($row_arr[0]); + $client_arr['shortcode'] = trim($row_arr[1]); + $client_arr['network'] = trim($row_arr[2]); + $client_arr['client'] = trim($row_arr[3]); + $client_arr['status'] = trim($row_arr[4]); + + dd($client_arr); + } + + } + + public function getClient($name){ + + } + public function getNetwork($name){ + + } + public function processMnoWorldwideFile(){ + + + $file = public_path('helper_documents/mcc_mnc_table.json'); + + $jsonData = file_get_contents($file); + + // Decode the JSON string into an associative array + $dataArray = json_decode($jsonData, true); + + if (json_last_error() === JSON_ERROR_NONE) { + $counter = 0; + foreach ($dataArray as $key => $value) { + $result = Models\Worldwidemno::create($value); + $counter++; + } + dump($counter . " Records found and inserted"); + } else { + dump('Error decoding JSON: ' . json_last_error_msg()); + } + + + + // dd($file); + // $decoded = json_decode($file, true); + // dd($decoded); + + } + } // https://www.tokyvideo.com/video/sheena-the-queen-of-the-jungle-1984-movie-with-tanya-roberts-ted-wass-donovan-scott diff --git a/app/Http/Controllers/VpnController.php b/app/Http/Controllers/VpnController.php new file mode 100644 index 0000000..4bc6816 --- /dev/null +++ b/app/Http/Controllers/VpnController.php @@ -0,0 +1,156 @@ +with('mno_info')->paginate(15); + // dd($result); + $data = [ + 'page_title' => 'infrastructure: VPN', + 'vpn_list' => $result + ]; + // dd($result); + return view('vpn.index', $data); + } + public function indexBKK(){ + $result = Models\VpnConfig::get(); + // dd($result); + $data = [ + 'page_title' => 'infrastructure: VPN', + 'vpn_list' => $result + ]; + return view('vpn.index_test', $data); + } + public function index(){ + $data = [ + 'page_title' => 'Infrastructure: VPN', + 'current_user' => session('current_user') + ]; + return view('vpn.index_rawjs', $data); + } + public function getVpnListJsonRawJs(Request $request){ + // dd($request->has('keyword') && $request->keyword == true); + + if($request->has('keyword') && $request->keyword == true){ + //'vpn_configs.client_id', + $keyword = $request->keyword; + $vpn_list_arr = \DB::table('vpn_configs') + ->join('auth_users', 'auth_users.id', '=', 'vpn_configs.user_id') + ->join('network_operators', 'network_operators.id', '=', 'vpn_configs.mno_id') + ->select('network_operators.id', 'vpn_configs.date_received', 'network_operators.name AS mnoName', 'network_operators.country', 'auth_users.name As username', 'vpn_configs.vpn_device', 'vpn_configs.mno_id', 'vpn_configs.partner_type', 'vpn_configs.remote_peer_ip', 'vpn_configs.local_access_control_list', 'vpn_configs.partner_access_control_list') + ->whereRaw("network_operators.name LIKE '%$keyword%' OR vpn_configs.vpn_device LIKE '%$keyword%' OR network_operators.country LIKE '%$keyword%' OR vpn_configs.remote_peer_ip LIKE '%$keyword%' OR vpn_configs.local_access_control_list like '%$keyword%' OR vpn_configs.partner_access_control_list LIKE '%$keyword%'") + ->paginate(10); + } + else{ + $vpn_list_arr = \DB::table('vpn_configs') + ->join('auth_users', 'auth_users.id', '=', 'vpn_configs.user_id') + ->join('network_operators', 'network_operators.id', '=', 'vpn_configs.mno_id') + ->select('vpn_configs.id', 'vpn_configs.date_received', 'network_operators.name AS mnoName', 'network_operators.country', 'auth_users.name As username', 'vpn_configs.vpn_device', 'vpn_configs.mno_id', 'vpn_configs.partner_type', 'vpn_configs.remote_peer_ip', 'vpn_configs.local_access_control_list', 'vpn_configs.partner_access_control_list') + ->paginate(10); + + } + return response()->json($vpn_list_arr); + } + + public function create(){ + $partner_type_arr = ['client' => 'client', 'mno' => 'mno']; + $partners_arr = []; + $services = Models\Service::pluck('name', 'name'); + $data = [ + 'page_title' => 'infrastructure: VPN', + 'partner_type_arr' => $partner_type_arr, + 'partners_arr' => $partners_arr, + 'services_arr' => $services + ]; + return view('vpn.create', $data); + } + public function edit($id){ + $vpn = Models\VpnConfig::find($id); + $partner_type_arr = ['client' => 'client', 'mno' => 'mno']; + $partners_arr = []; + $services = Models\Service::pluck('name', 'name'); + $data = [ + 'vpn' => $vpn, + 'page_title' => 'infrastructure: VPN', + 'partner_type_arr' => $partner_type_arr, + 'partners_arr' => $partners_arr, + 'services_arr' => $services + ]; + return view('vpn.create', $data); + } + + + + public function store(Request $request){ + $request->validate([ + 'partner_type_id' => 'required', + 'vpn_device' => 'sometimes', + 'remote_peer_ip' => 'required', + 'partner_access_control_list' => 'required', + 'local_access_control_list' => 'required', + 'partner_type' => 'required', + 'phase_1_raw_settings' => 'sometimes', + 'phase_2_raw_settings' => 'sometimes', + ]); + // dd($request->all()); + $vpn_configs_arr = $request->except('_token', 'vpn_form'); + if ($request->partner_type == 'mno') { + + $vpn_configs_arr['mno_id'] = $request->partner_type_id; + } + elseif($request->partner_type == 'client'){ + $vpn_configs_arr['client_id'] = $request->partner_type_id; + } + else{ + Session::flash('error_message', 'Your request could not be handled at this time. Try again'); + return redirect(url('infrastructure/vpn')); + } + + $vpn_configs_arr['user_id'] = session('current_user.id'); + + // dd($vpn_configs_arr); + if ($request->hasFile('vpn_form')) { + if ($request->file('vpn_form')->isValid()) { + $filename = "erp_" . time() . "." . $request->vpn_form->extension(); + $request->vpn_form->storeAs('vpn_form_files', $filename, 'public'); + $document_arr['vpn_form'] = json_encode([$filename]); + $vpn_configs_arr['partner_vpn_form'] = $filename; + } + } + $result = Models\VpnConfig::create($vpn_configs_arr); + + Session::flash('success_message', 'VPN Configs successfully added'); + return redirect(url('infrastructure/vpn')); + } + + public function getMNOandClient($type){ + if ($type == 'mno') { + $data_arr = \DB::table('network_operators')->Select(\DB::raw('id, concat(name, " (", country, ")") AS partner'))->orderBy('name')->get()->toArray(); + } + elseif ($type == 'client') { + $data_arr = \DB::table('clients')->Select(\DB::raw('id, concat(name, " (", country, ")") AS partner'))->orderBy('name')->get()->toArray(); + } + else{ + return response()->json(['code' => 3, 'msg' => 'invalid request']); + } + return response()->json(['code' => 1, 'msg' => 'success', 'result' => $data_arr]); + } + public function getPhaseOneTwo($vpn_list_id){ + $vpn = Models\VpnConfig::find($vpn_list_id); + if ($vpn) { + // code... + $data = ['code' => 1, 'msg' => 'success', 'result' => $vpn]; + } + else{ + $data = ['code' => 3, 'msg' => 'request could not be handled']; + } + return response()->json($data); + + } +} + diff --git a/app/Jobs/NewMnoNotesEmailAlerts.php b/app/Jobs/NewMnoNotesEmailAlerts.php index a2ee288..ed3c7fd 100644 --- a/app/Jobs/NewMnoNotesEmailAlerts.php +++ b/app/Jobs/NewMnoNotesEmailAlerts.php @@ -42,7 +42,7 @@ class NewMnoNotesEmailAlerts implements ShouldQueue ]; \Log::info($note->notes_body); $mailer->send('emails.new-mno-notes', $data, function ($message) use ($data, $emails) { - $message->from('support@click-mobile.com', 'Click Mobile ERP'); + $message->from('alerts@click-mobile.com', 'Click Mobile ERP'); $message->to($emails)->subject('New Notes on Mobile Operators'); }); } diff --git a/app/Jobs/SendClientContractRenewalAlert.php b/app/Jobs/SendClientContractRenewalAlert.php index 6451d65..5f54c0e 100644 --- a/app/Jobs/SendClientContractRenewalAlert.php +++ b/app/Jobs/SendClientContractRenewalAlert.php @@ -40,7 +40,7 @@ class SendClientContractRenewalAlert implements ShouldQueue ]; $mailer->send('emails.client_renewal-alert', $data, function ($message) use ($data, $emails) { - $message->from('support@click-mobile.com', 'Click Mobile ERP'); + $message->from('alerts@click-mobile.com', 'Click Mobile ERP'); $message->to($emails)->subject('Client Contract Renewal Alert'); }); } diff --git a/app/Jobs/SendMnoContractRenewalEmailAlert.php b/app/Jobs/SendMnoContractRenewalEmailAlert.php index 6116154..f9e39d1 100644 --- a/app/Jobs/SendMnoContractRenewalEmailAlert.php +++ b/app/Jobs/SendMnoContractRenewalEmailAlert.php @@ -39,7 +39,7 @@ class SendMnoContractRenewalEmailAlert implements ShouldQueue 'alert_body' => 'Contract for ' . $renewalSet['mno_name'] . ' will expire in ' . $renewalSet['days_to_expire'] . ' days. Take note' ]; $mailer->send('emails.renewal-alert', $data, function ($message) use ($data, $emails) { - $message->from('support@click-mobile.com', 'Click Mobile ERP'); + $message->from('alerts@click-mobile.com', 'Click Mobile ERP'); $message->to($emails)->subject('Contract Renewal Alert'); }); } diff --git a/app/Jobs/SendNewNotesEmailAlert.php b/app/Jobs/SendNewNotesEmailAlert.php index bc00fbd..9ff9b21 100644 --- a/app/Jobs/SendNewNotesEmailAlert.php +++ b/app/Jobs/SendNewNotesEmailAlert.php @@ -31,11 +31,8 @@ class SendNewNotesEmailAlert implements ShouldQueue public function handle(Mailer $mailer) { $note = $this->note; - $emails = ['samuel@click-mobile.com']; - + $emails = ['samuel@click-mobile.com', 'kwesi@click-mobile.com', 'mansa@click-mobile.com']; //$note_body = $note->notes_body; - - $data = [ 'client' => $note->client_info->name, 'created_by' => $note->created_by_info->name, @@ -46,8 +43,9 @@ class SendNewNotesEmailAlert implements ShouldQueue \Log::info("New notes for : " . $note->client_info->name); \Log::info("New notes triggered by : " . $note->created_by_info->name); \Log::info($note->notes_body); + $mailer->send('emails.new-notes', $data, function ($message) use ($data, $emails) { - $message->from('support@click-mobile.com', 'Click Mobile ERP'); + $message->from('alerts@click-mobile.com', 'Click Mobile ERP'); $message->to($emails)->subject('New Notes'); }); } diff --git a/app/Jobs/SendNewUssdClientEmail.php b/app/Jobs/SendNewUssdClientEmail.php index 64306e5..09b9a9c 100755 --- a/app/Jobs/SendNewUssdClientEmail.php +++ b/app/Jobs/SendNewUssdClientEmail.php @@ -41,7 +41,7 @@ class SendNewUssdClientEmail implements ShouldQueue 'status' => $status ]; $mailer->send('emails.new_ussd_client', $data, function ($message) use ($data, $emails) { - $message->from('support@click-mobile.com', 'Click Mobile Account Manager Tracker'); + $message->from('alerts@click-mobile.com', 'Click Mobile ERP'); $message->to($emails)->subject('New USSD Client Details'); }); diff --git a/app/Jobs/SendOnboardingCompletedEmailAlert.php b/app/Jobs/SendOnboardingCompletedEmailAlert.php index 66f4d0d..a751b00 100644 --- a/app/Jobs/SendOnboardingCompletedEmailAlert.php +++ b/app/Jobs/SendOnboardingCompletedEmailAlert.php @@ -43,7 +43,7 @@ class SendOnboardingCompletedEmailAlert implements ShouldQueue 'how_we_got' => $client->how_we_got_client ]; $mailer->send('emails.onboarding_completed', $data, function ($message) use ($data, $emails) { - $message->from('support@click-mobile.com', 'Click Mobile ERP'); + $message->from('alerts@click-mobile.com', 'Click Mobile ERP'); $message->to($emails)->subject('Onboarding Completed'); }); } diff --git a/app/Jobs/SendShortCodeListToFinance.php b/app/Jobs/SendShortCodeListToFinance.php new file mode 100644 index 0000000..ef07acb --- /dev/null +++ b/app/Jobs/SendShortCodeListToFinance.php @@ -0,0 +1,59 @@ +short_code_list = $short_code_list; + $this->message_body = $message_body; + $this->finance_arr = $finance_arr; + } + + /** + * Execute the job. + * + * @return void + */ + public function handle(Mailer $mailer) + { + $short_code_list = $this->short_code_list; + $message_body = $this->message_body; + $finance_arr = $this->finance_arr; + + $emails = [ + 'samuel@click-mobile.com', + 'kwesi@click-mobile.com', + 'daniel@click-mobile.com', + 'jim@click-mobile.com', + 'priscilla@click-mobile.com', + 'mansa@click-mobile.com' + ]; + $data = [ + 'short_code_list' => $short_code_list, + 'message_body' => $message_body, + 'finance_arr' => $finance_arr + ]; + $mailer->send('emails.short_code_payment_alert', $data, function ($message) use ($data, $emails) { + $message->from('alerts@click-mobile.com', 'Click Mobile ERP'); + $message->to($emails)->subject('Short Code Invoices'); + }); + } +} diff --git a/app/Jobs/SendSupportFeesReminderEmailAlert.php b/app/Jobs/SendSupportFeesReminderEmailAlert.php index 7db16a6..cb04b5a 100644 --- a/app/Jobs/SendSupportFeesReminderEmailAlert.php +++ b/app/Jobs/SendSupportFeesReminderEmailAlert.php @@ -45,7 +45,7 @@ class SendSupportFeesReminderEmailAlert implements ShouldQueue 'alert_body' => 'Support fees for ' . $renewalSet['client_name'] . ' will be due in ' . $renewalSet['days_to_renew'] . ' days. Take note' ]; $mailer->send('emails.supportfees-alert', $data, function ($message) use ($data, $emails) { - $message->from('support@click-mobile.com', 'Click Mobile ERP'); + $message->from('alerts@click-mobile.com', 'Click Mobile ERP'); $message->to($emails)->subject('Support Fees Reminder'); }); } diff --git a/app/Jobs/SendTestEmail.php b/app/Jobs/SendTestEmail.php new file mode 100644 index 0000000..c74b0be --- /dev/null +++ b/app/Jobs/SendTestEmail.php @@ -0,0 +1,44 @@ +send('emails.test', $data, function ($message) use ($data, $emails) { + $message->from('alerts@click-mobile.com', 'Click Mobile ERP'); + $message->to($emails)->subject('Short Code Invoices'); + }); + } +} diff --git a/app/Jobs/SendUssdClientActiveEmail.php b/app/Jobs/SendUssdClientActiveEmail.php index 20dd147..70f3a83 100755 --- a/app/Jobs/SendUssdClientActiveEmail.php +++ b/app/Jobs/SendUssdClientActiveEmail.php @@ -41,7 +41,7 @@ class SendUssdClientActiveEmail implements ShouldQueue 'status' => $status ]; $mailer->send('emails.active_ussd_client', $data, function ($message) use ($data, $emails) { - $message->from('support@click-mobile.com', 'Click Mobile Account Manager Tracker'); + $message->from('alerts@click-mobile.com', 'Click Mobile ERP'); $message->to($emails)->subject('New USSD Client Details'); }); diff --git a/app/Models/ClientNote.php b/app/Models/ClientNote.php index aa93002..f232ea1 100644 --- a/app/Models/ClientNote.php +++ b/app/Models/ClientNote.php @@ -11,9 +11,9 @@ class ClientNote extends Model protected $guarded = array('id'); protected static $logUnguarded = true; - public function getActivitylogOptions(): LogOptions{ - return LogOptions::defaults()->logUnguarded(); - } + // public function getActivitylogOptions(): LogOptions{ + // return LogOptions::defaults()->logUnguarded(); + // } public function client_info(){ return $this->hasOne('App\Models\Client', 'id', 'client_id'); diff --git a/app/Models/Holiday.php b/app/Models/Holiday.php new file mode 100644 index 0000000..d418e84 --- /dev/null +++ b/app/Models/Holiday.php @@ -0,0 +1,10 @@ +hasOne('App\Models\Client', 'id', 'client_id'); + } + public function mno_info(){ + return $this->hasOne('App\Models\NetworkOps', 'id', 'mno_id'); + } + public function userInfo(){ + return $this->hasOne('App\Models\SystemUser', 'id', 'user_id'); + } +} diff --git a/app/Models/Worldwidemno.php b/app/Models/Worldwidemno.php new file mode 100644 index 0000000..4b641a3 --- /dev/null +++ b/app/Models/Worldwidemno.php @@ -0,0 +1,11 @@ + xoxp-677819906294-675678554016-693747277911-5166bcbb9a5fc3d5434b42a10c4d358a - //old ---> xoxp-677819906294-675678554016-720956680656-4a6b5d0fcb00e9e0512c14341d3a7563 - /* - $slackHandler = new \Monolog\Handler\SlackHandler('xoxp-677819906294-675678554016-693747277911-5166bcbb9a5fc3d5434b42a10c4d358a', '#click_erp_notify', 'Monolog', true, null, \Monolog\Logger::ERROR); - $slackHandler = new \Monolog\Handler\SlackHandler('xoxp-677819906294-675678554016-693747277911-5166bcbb9a5fc3d5434b42a10c4d358a', '#click_erp_notify', 'Monolog', true, null, \Monolog\Logger::INFO); - $slackHandler = new \Monolog\Handler\SlackHandler('xoxp-677819906294-675678554016-693747277911-5166bcbb9a5fc3d5434b42a10c4d358a', '#click_erp_notify', 'Monolog', true, null, \Monolog\Logger::DEBUG); + //old ---> xoxp-677819906294-675678554016-720956680656-4a6b5d0fcb00e9e0512c14341d3a7563 + //clickml_erp_ntfy + //click_erp_notify + // $slackHandler = new \Monolog\Handler\SlackHandler('xoxp-677819906294-675678554016-693747277911-5166bcbb9a5fc3d5434b42a10c4d358a', '#clickml_erp_ntfy', 'Monolog', true, null, \Monolog\Logger::ERROR); + // $slackHandler = new \Monolog\Handler\SlackHandler('xoxp-677819906294-675678554016-693747277911-5166bcbb9a5fc3d5434b42a10c4d358a', '#clickml_erp_ntfy', 'Monolog', true, null, \Monolog\Logger::INFO); + // $slackHandler = new \Monolog\Handler\SlackHandler('xoxp-677819906294-675678554016-693747277911-5166bcbb9a5fc3d5434b42a10c4d358a', '#clickml_erp_ntfy', 'Monolog', true, null, \Monolog\Logger::DEBUG); + + // $monolog->pushHandler($slackHandler); - $monolog->pushHandler($slackHandler); - */ } /** diff --git a/info.md b/info.md new file mode 100644 index 0000000..9b43d59 --- /dev/null +++ b/info.md @@ -0,0 +1,2 @@ + +- Balance notifications \ No newline at end of file diff --git a/mphatso-notes.md b/mphatso-notes.md deleted file mode 100644 index 145830d..0000000 --- a/mphatso-notes.md +++ /dev/null @@ -1,8 +0,0 @@ -INSERT INTO `client_notes` (`id`, `client_id`, `services`, `auth_user_id`, `notes_body`, `highlight`, `created_at`, `updated_at`) -VALUES - (955, '229', 'A2P', 15, 'A bilateral prepaid agreement has been signed by both Click Mobile and Telxio Networks.\r\nThe next step is to exchange tech forms for the interconnection.', 'NO', '2024-03-11 11:34:14', '2024-03-11 11:34:14'); - - -INSERT INTO `client_notes` (`id`, `client_id`, `services`, `auth_user_id`, `notes_body`, `highlight`, `created_at`, `updated_at`) -VALUES - (954, '229', 'A2P', 15, 'A bilateral prepaid agreement has been signed by both Click Mobile and Telxio.\r\nThe next stepp is to excahnge tech forms for the interconnection.', 'NO', '2024-03-11 08:00:02', '2024-03-11 08:00:02'); diff --git a/pending-issues.md b/pending-issues.md index f4ca4f9..72c8c2f 100644 --- a/pending-issues.md +++ b/pending-issues.md @@ -1,7 +1,22 @@ +# Leave management +- apply for leave +- approve/deny leave +- view leave days +- list staff on leave with return dates + +## Leave Management Config Table +- id +- staff_type (director, standard) +- allocated_leave_days +- current_year +- + +# Holidays +- list all holidays by country/general +- send holiday reminders +- Use the calender + # Onboarding process - - - Thank you sir, Has it been uploaded on the ERP @@ -34,7 +49,18 @@ Comments 1. Charity suggested we link clients with Sender IDs to avoid having to enter Sender IDS on a separate page -2. Charity and the team also suggested it would be good for us country managers to have more options on the ERP. Country documents should also have an option to add expiry dates. Have the same notes function under countries just like AMs. + +2. Charity and the team also suggested it would be good for us country managers to have more options on the ERP. Country documents should also have an option to add expiry dates. Have the same notes function under countries just like AMs. --- ask for clarifications on the invoices + 3. Charity also suggested that we have a feature that sends emails to AMs to remind them of the invoices. Since invoices have validity period to say to be paid after so an so date, it should be used to send reminders to alert AMs to followup on payments. Don’t know if it makes sense. + 4. I have asked Kwesi if we could have a page on the ERP that displays all activities rather than just on the home page. Also suggested that we be able to click on some activities like when AM leaves a note, we should be able to open and view that note. -5. The other suggestion was to have an option to view all clients instead of just showing 15 clients per page, have an option to view 15, view 50. view 100. view all. that way will be able to download XLSX/PDF for all clients if we view all. currently it only downloads 15 clients of that particular page + +5. The other suggestion was to have an option to view all clients instead of just showing 15 clients per page, have an option to view 15, view 50. view 100. view all. that way will be able to download XLSX/PDF for all clients if we view all. currently it only downloads 15 clients of that particular page - done + + +## Mansa +- Reports on new clients +- reports on new notes + +- @exoscutter diff --git a/public/assets/js/clientshow.js b/public/assets/js/clientshow.js index 3b35e72..20c9f27 100644 --- a/public/assets/js/clientshow.js +++ b/public/assets/js/clientshow.js @@ -14,6 +14,34 @@ $('#textbox1').val(this.checked); }); */ + function matchCustom(params, data) { + // If there are no search terms, return all of the data + if ($.trim(params.term) === '') { + return data; + } + + // Do not display the item if there is no 'text' property + if (typeof data.text === 'undefined') { + return null; + } + + // `params.term` should be the term that is used for searching + // `data.text` is the text that is displayed for the data object + if (data.text.indexOf(params.term) > -1) { + var modifiedData = $.extend({}, data, true); + modifiedData.text += ' (matched)'; + + // You can return modified objects from here + // This includes matching the `children` how you want in nested data sets + return modifiedData; + } + + // Return `null` if the term should not be displayed + return null; + } + $('#shortCodeCountry').select2({ + matcher: matchCustom + }); $('.progressIndicatorCheckbox').on('change', function() { // From the other examples // console.log('finker'); @@ -23,8 +51,45 @@ $('#textbox1').val(sure.toString()); } }); - - + $("select#shortCodeCountry").change(function(){ + var shortCodeCountry = $(this).val(); + var theToken = "{{ csrf_token }}"; + $.ajax({ + type: "POST", + url: base_url + '/mnos/getCountryNetworks', + headers: { + 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') + }, + data: {"country" : shortCodeCountry }, + cache: false, + beforeSend: function () { + console.log('loader here'); + //show a loader here + //$('#district').html(''); + }, + success: function(data) { + console.log(data.mnos); + // var jason = JSON.parse(data); + if (data.code === 1) { + var actionPoint = $('#networks').empty(); + console.log(actionPoint); + $.each(data.mnos, function(key, value) { + console.log(id); + console.log(row); + //$('#networks').append($("