|
|
|
|
@@ -15,7 +15,7 @@ use Carbon\Carbon;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ClientsController extends Controller
|
|
|
|
|
{
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* Display a listing of the resource.
|
|
|
|
|
*
|
|
|
|
|
@@ -51,11 +51,11 @@ class ClientsController extends Controller
|
|
|
|
|
/*
|
|
|
|
|
$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')
|
|
|
|
|
@@ -75,8 +75,8 @@ class ClientsController extends Controller
|
|
|
|
|
->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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return response()->json($client_arr);
|
|
|
|
|
}
|
|
|
|
|
public function getClientJsonRawJs(Request $request){
|
|
|
|
|
@@ -100,7 +100,7 @@ class ClientsController extends Controller
|
|
|
|
|
}
|
|
|
|
|
return response()->json($client_arr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Show the form for creating a new resource.
|
|
|
|
|
@@ -118,7 +118,7 @@ class ClientsController extends Controller
|
|
|
|
|
$company_types = ['Aggregator/Supplier' => 'Aggregator/Supplier', 'Enterprise' => 'Enterprise', 'Hybrid' => 'Hybrid'];
|
|
|
|
|
$industries = Models\Industry::orderBy('name', 'ASC')->pluck('name', 'name');
|
|
|
|
|
// $industries = Models\Industry::pluck('name', 'name')->orderBy('name', 'ASC');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$data = [
|
|
|
|
|
'page_title' => 'Create Client',
|
|
|
|
|
@@ -134,7 +134,7 @@ class ClientsController extends Controller
|
|
|
|
|
|
|
|
|
|
return view('client.create', $data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Store a newly created resource in storage.
|
|
|
|
|
@@ -160,11 +160,11 @@ class ClientsController extends Controller
|
|
|
|
|
$onboarding_stages = Models\ClientOnboardingMainStage::orderBy('stage_id')->get();
|
|
|
|
|
// dd($onboarding_stages);
|
|
|
|
|
$client_current_stages = [];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach ($onboarding_stages as $value) {
|
|
|
|
|
$client_current_stages[$value->stage] = "PENDING";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$client_arr = [
|
|
|
|
|
'name' => $request->name,
|
|
|
|
|
'email' => $request->email,
|
|
|
|
|
@@ -176,7 +176,7 @@ class ClientsController extends Controller
|
|
|
|
|
'created_by' => session('current_user.id'),
|
|
|
|
|
'last_modified_by' => session('current_user.id'),
|
|
|
|
|
'progress_indicator_score' => 10,
|
|
|
|
|
'progress_indicator' => $onboarding_stages[0]->stage, // 'Agreement Stage', //
|
|
|
|
|
'progress_indicator' => $onboarding_stages[0]->stage, // 'Agreement Stage', //
|
|
|
|
|
'onboarding_progress_stage' => json_encode($client_current_stages)
|
|
|
|
|
];
|
|
|
|
|
if ($request->has('notes')) {
|
|
|
|
|
@@ -206,16 +206,16 @@ class ClientsController extends Controller
|
|
|
|
|
if ($request->has('payment_mode')) {
|
|
|
|
|
$client_arr['pay_mode'] = $request->payment_mode;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$result = Models\Client::create($client_arr);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//add entries for client_onboarding_progress
|
|
|
|
|
$get_stage_subs_items = Models\ClientOnboardingSubItem::get();
|
|
|
|
|
$get_stage_subs_items = Models\ClientOnboardingSubItem::get();
|
|
|
|
|
foreach ($get_stage_subs_items as $value) {
|
|
|
|
|
$progress_arr = [
|
|
|
|
|
'stage_id' => $value->stage_id,
|
|
|
|
|
'client_id' => $result->id,
|
|
|
|
|
'name' => $value->name,
|
|
|
|
|
'stage_id' => $value->stage_id,
|
|
|
|
|
'client_id' => $result->id,
|
|
|
|
|
'name' => $value->name,
|
|
|
|
|
'status' => 'PENDING'
|
|
|
|
|
];
|
|
|
|
|
$clients_onboarding_progress = Models\ClientOnboardingProgress::create($progress_arr);
|
|
|
|
|
@@ -228,7 +228,7 @@ class ClientsController extends Controller
|
|
|
|
|
'last_modified_by_id' => session('current_user.id')
|
|
|
|
|
];
|
|
|
|
|
$retval = Models\UssdClientPayment::create($ussd_client_payment_arr);
|
|
|
|
|
//TODO send an email to jim/priscilla about new USSD client,
|
|
|
|
|
//TODO send an email to jim/priscilla about new USSD client,
|
|
|
|
|
#dispatch(new SendNewUssdClientEmail($result));
|
|
|
|
|
}
|
|
|
|
|
#save services this has been moved to the main client table
|
|
|
|
|
@@ -261,8 +261,8 @@ class ClientsController extends Controller
|
|
|
|
|
if ($request->has('highlight')) {
|
|
|
|
|
$notes_arr['highlight'] = 'YES';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//dd($notes_arr);
|
|
|
|
|
$result = Models\ClientNote::create($notes_arr);
|
|
|
|
|
// dd($result);
|
|
|
|
|
@@ -285,7 +285,7 @@ class ClientsController extends Controller
|
|
|
|
|
public function getSingleNote($id){
|
|
|
|
|
$note = Models\ClientNote::find($id);
|
|
|
|
|
if ($note) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$current_date = date_create(date('Y-m-d'));
|
|
|
|
|
// dump($current_date);
|
|
|
|
|
$expiry_date = date_create($note->created_at);
|
|
|
|
|
@@ -304,7 +304,7 @@ class ClientsController extends Controller
|
|
|
|
|
else{
|
|
|
|
|
return response()->json([ 'code' => 3, 'msg' => 'Request could not be handled at this time']);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public function notesUpdate(Request $request)
|
|
|
|
|
{
|
|
|
|
|
@@ -316,14 +316,14 @@ class ClientsController extends Controller
|
|
|
|
|
$note = Models\ClientNote::find($request->note_id);
|
|
|
|
|
$note->notes_body = $request->notes_body;
|
|
|
|
|
$note->services = implode(',', $request->services);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($request->has('highlight')) {
|
|
|
|
|
$note->highlight = 'YES';
|
|
|
|
|
}
|
|
|
|
|
$result = $note->save();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$notes = Models\ClientNote::with('client_info', 'created_by_info')->find($request->note_id);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//dispatch(new SendNewNotesEmailAlert($notes));
|
|
|
|
|
|
|
|
|
|
if ($result) {
|
|
|
|
|
@@ -338,15 +338,15 @@ class ClientsController extends Controller
|
|
|
|
|
$this->logUsersActivity($type = 'staff', $content);
|
|
|
|
|
return response()->json($data, 200);
|
|
|
|
|
}
|
|
|
|
|
public function financeStore(Request $request)
|
|
|
|
|
{
|
|
|
|
|
public function financeStore(Request $request){
|
|
|
|
|
$request->validate([
|
|
|
|
|
'client_id' => 'required',
|
|
|
|
|
'services' => 'required',
|
|
|
|
|
'invoice_number' => 'required',
|
|
|
|
|
'invoice_amount' => 'required|numeric',
|
|
|
|
|
'invoice_date' => 'required',
|
|
|
|
|
'invoice_status' => 'required'
|
|
|
|
|
'invoice_status' => 'required',
|
|
|
|
|
'short_code' => 'sometimes|numeric'
|
|
|
|
|
]);
|
|
|
|
|
$auth_user = session('current_user');
|
|
|
|
|
|
|
|
|
|
@@ -356,6 +356,7 @@ class ClientsController extends Controller
|
|
|
|
|
'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
|
|
|
|
|
@@ -363,7 +364,7 @@ class ClientsController extends Controller
|
|
|
|
|
if ($request->has('remarks')) {
|
|
|
|
|
$finance_arr['remarks'] = $request->remarks;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$result = Models\ClientPayment::create($finance_arr);
|
|
|
|
|
|
|
|
|
|
#$payments = Models\ClientPayment::with('client_info', 'created_by_info')->find($result->id);
|
|
|
|
|
@@ -394,19 +395,24 @@ class ClientsController extends Controller
|
|
|
|
|
]);
|
|
|
|
|
$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);
|
|
|
|
|
}
|
|
|
|
|
/*
|
|
|
|
|
$networks_raw = [
|
|
|
|
|
'AirtelTigo GH' => 'AirtelTigo GH',
|
|
|
|
|
'MTN GH' => 'MTN GH',
|
|
|
|
|
'Airtel MW' => 'Airtel MW',
|
|
|
|
|
'Airtel Zambia' => 'Airtel Zambia',
|
|
|
|
|
'TNM MW' => 'TNM MW',
|
|
|
|
|
'Airtel Zambia' => 'Airtel Zambia',
|
|
|
|
|
'TNM MW' => 'TNM MW',
|
|
|
|
|
'Airtel MW' => 'Airtel MW',
|
|
|
|
|
'Safaricom Kenya' => 'Safaricom Kenya',
|
|
|
|
|
'Safaricom Kenya' => 'Safaricom Kenya',
|
|
|
|
|
'Airtel Kenya' => 'Airtel Kenya',
|
|
|
|
|
'Telkom Kenya' => 'Telkom Kenya',
|
|
|
|
|
'Telkom Kenya' => 'Telkom Kenya',
|
|
|
|
|
'Orange Kenya' => 'Orange Kenya'
|
|
|
|
|
];
|
|
|
|
|
];
|
|
|
|
|
if (stripos($request->network, 'MW') !== false ) {
|
|
|
|
|
$country = 'Malawi';
|
|
|
|
|
}
|
|
|
|
|
@@ -426,16 +432,17 @@ class ClientsController extends Controller
|
|
|
|
|
$data = ['code' => 3, 'msg' => 'Your request could not be handled at this time'];
|
|
|
|
|
return response()->json($data, 200);
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
$shortcode_arr = [
|
|
|
|
|
'name' => $request->name,
|
|
|
|
|
'client_id' => $request->client_id,
|
|
|
|
|
'network' => $request->network,
|
|
|
|
|
'country' => $country, //$network->country,
|
|
|
|
|
'country' => $mnoCountry, //$network->country,
|
|
|
|
|
'shortcode' => $request->shortcode,
|
|
|
|
|
'code_type' => $request->code_type,
|
|
|
|
|
'toll_free' => $request->toll_free,
|
|
|
|
|
'last_updaed_by' => $auth_user['id'],
|
|
|
|
|
'last_updated_by' => $auth_user['id'],
|
|
|
|
|
'launch_date' => $request->launch_date,
|
|
|
|
|
'expiry_date' => $request->expiry_date,
|
|
|
|
|
'status' => $request->status
|
|
|
|
|
@@ -443,7 +450,7 @@ class ClientsController extends Controller
|
|
|
|
|
if ($request->has('remarks')) {
|
|
|
|
|
$shortcode_arr['remarks'] = $request->remarks;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$result = Models\ClientShortCode::create($shortcode_arr);
|
|
|
|
|
|
|
|
|
|
if ($result) {
|
|
|
|
|
@@ -458,8 +465,7 @@ class ClientsController extends Controller
|
|
|
|
|
$this->logUsersActivity($type = 'staff', $content);
|
|
|
|
|
return response()->json($data, 200);
|
|
|
|
|
}
|
|
|
|
|
public function financeUpdate(Request $request)
|
|
|
|
|
{
|
|
|
|
|
public function financeUpdate(Request $request){
|
|
|
|
|
$request->validate([
|
|
|
|
|
'payment_id' => 'required',
|
|
|
|
|
'client_id' => 'required',
|
|
|
|
|
@@ -491,14 +497,63 @@ class ClientsController extends Controller
|
|
|
|
|
$this->logUsersActivity($type = 'staff', $content);
|
|
|
|
|
return response()->json($data, 200);
|
|
|
|
|
}
|
|
|
|
|
public function shortCodeUpdate(Request $request){
|
|
|
|
|
$request->validate([
|
|
|
|
|
'client_id' => 'required',
|
|
|
|
|
'network' => 'required',
|
|
|
|
|
'shortcode' => 'required',
|
|
|
|
|
'code_type' => 'required',
|
|
|
|
|
'toll_free' => 'required',
|
|
|
|
|
'status' => 'required',
|
|
|
|
|
'remarks' => 'required',
|
|
|
|
|
'launch_date' => 'required',
|
|
|
|
|
'expiry_date' => 'required'
|
|
|
|
|
]);
|
|
|
|
|
$auth_user = session('current_user');
|
|
|
|
|
$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);
|
|
|
|
|
// code...
|
|
|
|
|
}
|
|
|
|
|
$shortcode_arr = [
|
|
|
|
|
'name' => $request->name,
|
|
|
|
|
'client_id' => $request->client_id,
|
|
|
|
|
'network' => $request->network,
|
|
|
|
|
'country' => $mnoCountry, //$network->country,
|
|
|
|
|
'shortcode' => $request->shortcode,
|
|
|
|
|
'code_type' => $request->code_type,
|
|
|
|
|
'toll_free' => $request->toll_free,
|
|
|
|
|
'last_updated_by' => $auth_user['id'],
|
|
|
|
|
'launch_date' => $request->launch_date,
|
|
|
|
|
'expiry_date' => $request->expiry_date,
|
|
|
|
|
'status' => $request->status
|
|
|
|
|
];
|
|
|
|
|
if ($request->has('remarks')) {
|
|
|
|
|
$shortcode_arr['remarks'] = $request->remarks;
|
|
|
|
|
}
|
|
|
|
|
// $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'];
|
|
|
|
|
}
|
|
|
|
|
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";
|
|
|
|
|
$this->logUsersActivity($type = 'staff', $content);
|
|
|
|
|
return response()->json($data, 200);
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* Display the specified resource.
|
|
|
|
|
*
|
|
|
|
|
* @param int $id
|
|
|
|
|
* @return \Illuminate\Http\Response
|
|
|
|
|
*/
|
|
|
|
|
public function show($id)
|
|
|
|
|
{
|
|
|
|
|
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);
|
|
|
|
|
// dd(json_decode($showclient->progress_indicators, true));
|
|
|
|
|
@@ -515,17 +570,17 @@ class ClientsController extends Controller
|
|
|
|
|
$service_type = Models\Service::pluck('name', 'id');
|
|
|
|
|
$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 = ['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 = [
|
|
|
|
|
'AirtelTigo GH' => 'AirtelTigo GH',
|
|
|
|
|
'MTN GH' => 'MTN GH',
|
|
|
|
|
'Airtel MW' => 'Airtel MW',
|
|
|
|
|
'Airtel Zambia' => 'Airtel Zambia',
|
|
|
|
|
'TNM MW' => 'TNM MW',
|
|
|
|
|
'Airtel Zambia' => 'Airtel Zambia',
|
|
|
|
|
'TNM MW' => 'TNM MW',
|
|
|
|
|
'Airtel MW' => 'Airtel MW',
|
|
|
|
|
'Safaricom Kenya' => 'Safaricom Kenya',
|
|
|
|
|
'Safaricom Kenya' => 'Safaricom Kenya',
|
|
|
|
|
'Airtel Kenya' => 'Airtel Kenya',
|
|
|
|
|
'Telkom Kenya' => 'Telkom Kenya',
|
|
|
|
|
'Telkom Kenya' => 'Telkom Kenya',
|
|
|
|
|
'Orange Kenya' => 'Orange Kenya'
|
|
|
|
|
];
|
|
|
|
|
//->where('highlight', 'NO')
|
|
|
|
|
@@ -568,27 +623,27 @@ class ClientsController extends Controller
|
|
|
|
|
else{
|
|
|
|
|
$expiry_date = Carbon::parse($showclient->contract_validity);
|
|
|
|
|
$current_date = Carbon::parse(date('Y-m-d'));
|
|
|
|
|
|
|
|
|
|
$polar = ($expiry_date < $current_date) ? "-" : "+";
|
|
|
|
|
|
|
|
|
|
$polar = ($expiry_date < $current_date) ? "-" : "+";
|
|
|
|
|
$days = $expiry_date->diffInDays($current_date);
|
|
|
|
|
if($days > 365){
|
|
|
|
|
if ($polar == '-') {
|
|
|
|
|
$highlight_colour = 'warning';
|
|
|
|
|
$renewal_due = "Contract expired " . floor($days/365) . " year(s) ago";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
$renewal_due = "In " . floor($days/365) . " year(s)";
|
|
|
|
|
$renewal_due = "In " . floor($days/365) . " year(s)";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
elseif($days > 31){
|
|
|
|
|
if ($polar == '-') {
|
|
|
|
|
$highlight_colour = 'warning';
|
|
|
|
|
$renewal_due = "Contract expired " . floor($days/31) . " month(s) ago";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
$renewal_due = "In " . floor($days/31) . " months";
|
|
|
|
|
$renewal_due = "In " . floor($days/31) . " months";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
@@ -598,9 +653,9 @@ class ClientsController extends Controller
|
|
|
|
|
$renewal_due = "Contract expired $days days(s) ago";
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
$renewal_due = "In $days day(s)" ;
|
|
|
|
|
$renewal_due = "In $days day(s)" ;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sort($networks_raw);
|
|
|
|
|
@@ -629,14 +684,13 @@ class ClientsController extends Controller
|
|
|
|
|
];
|
|
|
|
|
return view('client.show', $data);
|
|
|
|
|
}
|
|
|
|
|
public function showReadonly($id)
|
|
|
|
|
{
|
|
|
|
|
public function showReadonly($id){
|
|
|
|
|
//with('short_code_info')->
|
|
|
|
|
$showclient = Models\Client::with('service_info', 'country_info', 'auth_user_info', 'short_code_info')->find($id);
|
|
|
|
|
$service_type = Models\Service::pluck('name', 'id');
|
|
|
|
|
$service_type_names = Models\Service::pluck('name', 'name');
|
|
|
|
|
$show_services = json_decode($showclient->services, true); //Models\ClientCategory::where('client_id', $id)->get();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//->where('highlight', 'NO')
|
|
|
|
|
$show_notes = Models\ClientNote::with('created_by_info', 'client_info')->where('client_id', $id)->orderBy('id', 'DESC')->get()->take(20);
|
|
|
|
|
$voice_codes = Models\ClientShortCode::where('client_id', $id)->where('code_type', 'voice')->get();
|
|
|
|
|
@@ -647,7 +701,7 @@ class ClientsController extends Controller
|
|
|
|
|
$networks = Models\NetworkOps::pluck('name', 'name');
|
|
|
|
|
$all_shortcodes = Models\ClientShortCode::with('client_info', 'client_info', 'update_info')->where('client_id', $id)->orderBy('code_type', 'ASC')->get();
|
|
|
|
|
$showdocuments = Models\ClientFile::where('client_id', $id)->get();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($showclient->status == 'Live') {
|
|
|
|
|
$status_bg = "info";
|
|
|
|
|
}
|
|
|
|
|
@@ -665,18 +719,18 @@ class ClientsController extends Controller
|
|
|
|
|
$renewal_due = "N/A";
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$current_date = date_create(date('Y-m-d'));
|
|
|
|
|
|
|
|
|
|
$expiry_date = date_create($showclient->contract_validity);
|
|
|
|
|
|
|
|
|
|
$diff = date_diff($current_date, $expiry_date);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$polar = $diff->format("%R");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$months = $diff->format("%m");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$days = $diff->format("%a");
|
|
|
|
|
if ($days < 31) {
|
|
|
|
|
if ($polar == '-') {
|
|
|
|
|
@@ -684,7 +738,7 @@ class ClientsController extends Controller
|
|
|
|
|
$renewal_due = "Contract expired $days days(s) ago";
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
$renewal_due = "In $days day(s)" ;
|
|
|
|
|
$renewal_due = "In $days day(s)" ;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
@@ -692,12 +746,12 @@ class ClientsController extends Controller
|
|
|
|
|
if ($polar == '-') {
|
|
|
|
|
$highlight_colour = 'warning';
|
|
|
|
|
$renewal_due = "Contract expired $months month(s) ago";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
$renewal_due = "In $months months";
|
|
|
|
|
$renewal_due = "In $months months";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$data = [
|
|
|
|
|
'page_title' => 'Client Profile',
|
|
|
|
|
@@ -738,8 +792,7 @@ class ClientsController extends Controller
|
|
|
|
|
];
|
|
|
|
|
return view('client.service-edit', $data);
|
|
|
|
|
}
|
|
|
|
|
public function getPayment($id)
|
|
|
|
|
{
|
|
|
|
|
public function getPayment($id){
|
|
|
|
|
$payment = Models\ClientPayment::find($id);
|
|
|
|
|
if ($payment) {
|
|
|
|
|
$services_arr = explode(',', $payment->services);
|
|
|
|
|
@@ -749,9 +802,17 @@ class ClientsController extends Controller
|
|
|
|
|
else{
|
|
|
|
|
return response()->json([ 'code' => 3, 'msg' => 'Request could not be handled at this time']);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getShortCodeDetails($id){
|
|
|
|
|
$shortcode = Models\ClientShortCode::with('client_info', 'update_info')->find($id);
|
|
|
|
|
if ($shortcode) {
|
|
|
|
|
$services_arr = Models\Service::pluck('name', 'id');
|
|
|
|
|
return response()->json([ 'code' => 1, 'result' => $shortcode, 'services_arr' => $services_arr]);
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
return response()->json([ 'code' => 3, 'msg' => 'Request could not be handled at this time']);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public function getShortCodes($type){
|
|
|
|
|
//$auth_users = Models\SystemUser::pluck('name', 'id');
|
|
|
|
|
//todo : separate the short codes into individual pages
|
|
|
|
|
@@ -770,7 +831,7 @@ class ClientsController extends Controller
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
$codes = Models\ClientShortCode::with('update_info')->get();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$data = [
|
|
|
|
|
'page_title' => 'Client Short Codes',
|
|
|
|
|
'codes_data' => $codes_data,
|
|
|
|
|
@@ -789,7 +850,7 @@ 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();
|
|
|
|
|
@@ -814,10 +875,10 @@ class ClientsController extends Controller
|
|
|
|
|
// dump($stage_details);
|
|
|
|
|
$onboarding_sub_items_progress = Models\ClientOnboardingProgress::where('stage_id', $stage_details->stage_id)->where('client_id', $id)->pluck('name', 'name');
|
|
|
|
|
// dd($onboarding_sub_items_progress);
|
|
|
|
|
$onboarding_sub_items = Models\ClientOnboardingSubItem::where('stage_id', $stage_details->stage_id)->pluck('name', 'name');
|
|
|
|
|
$onboarding_sub_items = Models\ClientOnboardingSubItem::where('stage_id', $stage_details->stage_id)->pluck('name', 'name');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
else{
|
|
|
|
|
|
|
|
|
|
@@ -829,7 +890,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);
|
|
|
|
|
|
|
|
|
|
@@ -891,7 +952,7 @@ class ClientsController extends Controller
|
|
|
|
|
$sender_ids = ['click' => 'click'];
|
|
|
|
|
$old_sender_ids = [];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($client->status == 'Live') {
|
|
|
|
|
$status_bg = "info";
|
|
|
|
|
@@ -902,10 +963,10 @@ class ClientsController extends Controller
|
|
|
|
|
else{
|
|
|
|
|
$status_bg = "danger";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$contract_types = ['Bilateral' => 'Bilateral', 'Unilateral' => 'Unilateral'];
|
|
|
|
|
$connections = ['SMPP' => 'SMPP', 'HTTP' => 'HTTP'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$data = [
|
|
|
|
|
'client' => $client,
|
|
|
|
|
'countries' => $countries,
|
|
|
|
|
@@ -924,7 +985,7 @@ class ClientsController extends Controller
|
|
|
|
|
'rate_emails' => $rate_emails,
|
|
|
|
|
'support_skype_arr' => $support_skype_arr,
|
|
|
|
|
'support_phones' => $support_phones,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
'old_finance_emails' => $old_finance_emails,
|
|
|
|
|
'old_rate_emails' => $old_rate_emails,
|
|
|
|
|
'old_support_emails' => $old_support_emails,
|
|
|
|
|
@@ -938,7 +999,7 @@ class ClientsController extends Controller
|
|
|
|
|
'industries' => $industries,
|
|
|
|
|
'how_we_got_clients_arr' => $how_we_got_clients_arr,
|
|
|
|
|
'current_services' => json_decode($client->services, true),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
'onboarding_sub_items_progress' => $onboarding_sub_items_progress,
|
|
|
|
|
'onboarding_sub_items' => $onboarding_sub_items,
|
|
|
|
|
'current_pending_stage' => $client->progress_indicator,
|
|
|
|
|
@@ -956,21 +1017,21 @@ class ClientsController extends Controller
|
|
|
|
|
*/
|
|
|
|
|
public function update(Requests\UpdateClientRequest $request, $id)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$client_update = Models\Client::find($id);
|
|
|
|
|
if ($client_update->progress_indicator != 'COMPLETED') {
|
|
|
|
|
$current_pending_stage_details = Models\ClientOnboardingMainStage::where('stage', $request->current_pending_stage)->first();
|
|
|
|
|
$get_stage_subs_items = Models\ClientOnboardingSubItem::where('stage_id', $current_pending_stage_details->stage_id)->get();
|
|
|
|
|
$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 ];
|
|
|
|
|
$progress_arr = [
|
|
|
|
|
'status' => 'COMPLETED'
|
|
|
|
|
'status' => 'COMPLETED'
|
|
|
|
|
];
|
|
|
|
|
$clients_onboarding_progress = Models\ClientOnboardingProgress::updateOrCreate($stage_id, $progress_arr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//update the status of onboarding progress stage in clients
|
|
|
|
|
//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);
|
|
|
|
|
@@ -979,11 +1040,11 @@ class ClientsController extends Controller
|
|
|
|
|
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';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$pending_stage = Arr::where($onboarding_progress_stage, function ($value, $key) {
|
|
|
|
|
return $value == "PENDING";
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#$pending_stage = array_key_first($pending_stage);
|
|
|
|
|
reset($pending_stage);
|
|
|
|
|
$pending_stage = key($pending_stage);
|
|
|
|
|
@@ -1006,7 +1067,7 @@ class ClientsController extends Controller
|
|
|
|
|
$request->document_one->storeAs('client_files', $filename, 'public');
|
|
|
|
|
$document_arr['file_path'] = $filename;
|
|
|
|
|
$client_update->name = $request->name;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$document_arr['file_extension'] = $request->document_one->extension();
|
|
|
|
|
$document_arr['file_reff'] = time() . uniqid();
|
|
|
|
|
$document_arr['name'] = $request->document_one_name;
|
|
|
|
|
@@ -1021,7 +1082,7 @@ class ClientsController extends Controller
|
|
|
|
|
$request->document_two->storeAs('client_files', $filename, 'public');
|
|
|
|
|
$document_arr['file_path'] = $filename;
|
|
|
|
|
$client_update->name = $request->name;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$document_arr['file_extension'] = $request->document_two->extension();
|
|
|
|
|
$document_arr['file_reff'] = time() . uniqid();
|
|
|
|
|
$document_arr['name'] = $request->document_two_name;
|
|
|
|
|
@@ -1036,7 +1097,7 @@ class ClientsController extends Controller
|
|
|
|
|
$request->document_three->storeAs('client_files', $filename, 'public');
|
|
|
|
|
$document_arr['file_path'] = $filename;
|
|
|
|
|
$client_update->name = $request->name;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$document_arr['file_extension'] = $request->document_three->extension();
|
|
|
|
|
$document_arr['file_reff'] = time() . uniqid();
|
|
|
|
|
$document_arr['name'] = $request->document_three_name;
|
|
|
|
|
@@ -1051,7 +1112,7 @@ class ClientsController extends Controller
|
|
|
|
|
$request->other_document->storeAs('client_files', $filename, 'public');
|
|
|
|
|
$document_arr['file_path'] = $filename;
|
|
|
|
|
$client_update->name = $request->name;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$document_arr['file_extension'] = $request->other_document->extension();
|
|
|
|
|
$document_arr['file_reff'] = time() . uniqid();
|
|
|
|
|
$document_arr['name'] = $request->document_three_name;
|
|
|
|
|
@@ -1074,14 +1135,14 @@ 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);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$progress_breakdown = array_count_values($onboarding_progress_stage);
|
|
|
|
|
if (array_has($progress_breakdown, ['COMPLETED']) == false) {
|
|
|
|
|
$indicator_score = "0";
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
$indicator_score = ($progress_breakdown['COMPLETED']/count($onboarding_progress_stage)) * 100;
|
|
|
|
|
}
|
|
|
|
|
$indicator_score = ($progress_breakdown['COMPLETED']/count($onboarding_progress_stage)) * 100;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$indicator_score = number_format($indicator_score);
|
|
|
|
|
$client_update->progress_indicator_score = $indicator_score;
|
|
|
|
|
@@ -1093,7 +1154,7 @@ class ClientsController extends Controller
|
|
|
|
|
$client_update->skype_name = $request->skype_name ?? "";
|
|
|
|
|
$client_update->linkedin_name = $request->linkedin_name ?? "";
|
|
|
|
|
$client_update->smpp_username = $request->smpp_username ?? "";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$client_update->company_type = $request->company_type ?? "";
|
|
|
|
|
$client_update->auth_user_id = $request->auth_user_id ?? "";
|
|
|
|
|
$client_update->contract_type = $request->contract_type ?? "";
|
|
|
|
|
@@ -1116,13 +1177,13 @@ class ClientsController extends Controller
|
|
|
|
|
$client_update->how_we_got_client = $request->how_we_got_client_other ?? "";
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
$client_update->how_we_got_client = $request->how_we_got_client ?? "";
|
|
|
|
|
$client_update->how_we_got_client = $request->how_we_got_client ?? "";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$client_update->created_by = session('current_user.id');
|
|
|
|
|
$client_update->last_modified_by = session('current_user.id');
|
|
|
|
|
$client_update->last_modified_by = session('current_user.id');
|
|
|
|
|
|
|
|
|
|
$result = $client_update->save();
|
|
|
|
|
|
|
|
|
|
@@ -1162,7 +1223,7 @@ class ClientsController extends Controller
|
|
|
|
|
public function store_services($services_arr, $client_id){
|
|
|
|
|
foreach ($services_arr as $id) {
|
|
|
|
|
$client_arr = [
|
|
|
|
|
'client_id' => $client_id,
|
|
|
|
|
'client_id' => $client_id,
|
|
|
|
|
'category_id' => $id
|
|
|
|
|
];
|
|
|
|
|
$result = Models\ClientCategory::create($client_arr);
|
|
|
|
|
@@ -1175,7 +1236,7 @@ class ClientsController extends Controller
|
|
|
|
|
|
|
|
|
|
foreach ($services_arr as $id) {
|
|
|
|
|
$client_arr = [
|
|
|
|
|
'client_id' => $client_id,
|
|
|
|
|
'client_id' => $client_id,
|
|
|
|
|
'category_id' => $id
|
|
|
|
|
];
|
|
|
|
|
$result = Models\ClientCategory::create($client_arr);
|
|
|
|
|
@@ -1212,7 +1273,7 @@ class ClientsController extends Controller
|
|
|
|
|
$client_file = Models\ClientFile::with('client_info')->findOrFail($id);
|
|
|
|
|
//PDF file is stored under project/public/download/info.pdf
|
|
|
|
|
$file = public_path('documents/client_files/') . $client_file->file_path;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$headers = []; //['Content-Type: application/pdf'];
|
|
|
|
|
$filename = $client_file->client_info->name . "_" . $client_file->name;
|
|
|
|
|
$filename = $this->cleanStr($filename);
|
|
|
|
|
@@ -1223,7 +1284,7 @@ class ClientsController extends Controller
|
|
|
|
|
}
|
|
|
|
|
public function showOnboardingForm($client_id){
|
|
|
|
|
$client = Models\Client::findOrFail($client_id);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$onboarding_stages = Models\ClientOnboardingProgress::where('client_id', $client_id)->orderBy('stage_id')->get();
|
|
|
|
|
//dd($onboarding_stages);
|
|
|
|
|
$data = [
|
|
|
|
|
@@ -1241,7 +1302,41 @@ class ClientsController extends Controller
|
|
|
|
|
$string = preg_replace('/[^A-Za-z0-9\-]/', '', $string);
|
|
|
|
|
// Replaces multiple hyphens with single one.
|
|
|
|
|
$string = preg_replace('/-+/', '_', $string);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return $string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getMnoCountry($network){
|
|
|
|
|
$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'
|
|
|
|
|
];
|
|
|
|
|
if (stripos($network, 'MW') !== false ) {
|
|
|
|
|
$country = 'Malawi';
|
|
|
|
|
}
|
|
|
|
|
elseif (stripos($network, 'GH') !== false) {
|
|
|
|
|
$country = 'Ghana';
|
|
|
|
|
}
|
|
|
|
|
elseif (stripos($network, 'Zambia') !== false) {
|
|
|
|
|
$country = 'Zambia';
|
|
|
|
|
}
|
|
|
|
|
elseif (stripos($network, 'Bots') !== false) {
|
|
|
|
|
$country = 'Botswana';
|
|
|
|
|
}
|
|
|
|
|
elseif (stripos($network, 'KE') !== false) {
|
|
|
|
|
$country = 'Kenya';
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
$country = false;
|
|
|
|
|
}
|
|
|
|
|
return $country;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|