|
|
|
|
@@ -23,12 +23,13 @@ class ClientsController extends Controller
|
|
|
|
|
|
|
|
|
|
$client_arr = new Models\Client;
|
|
|
|
|
$client_arr = $client_arr->with('auth_user_info','country_info', 'created_by_info')->orderBy('name', 'ASC')->paginate(10);
|
|
|
|
|
|
|
|
|
|
//dd($client_arr);
|
|
|
|
|
$data = [
|
|
|
|
|
'page_title' => 'Clients',
|
|
|
|
|
'client_arr' => $client_arr,
|
|
|
|
|
'current_user' => session('current_user')
|
|
|
|
|
];
|
|
|
|
|
// dd($data);
|
|
|
|
|
return view('client.index-tabulator', $data);
|
|
|
|
|
}
|
|
|
|
|
public function indexBak(){
|
|
|
|
|
@@ -55,6 +56,7 @@ class ClientsController extends Controller
|
|
|
|
|
->join('auth_users AS aumngr', 'aumngr.id', '=', 'clients.auth_user_id')
|
|
|
|
|
->join('auth_users AS aumodify', 'aumodify.id', '=', 'clients.last_modified_by')
|
|
|
|
|
->select('clients.id', 'clients.name', 'clients.status', 'clients.country', 'aumngr.name As accountMgr', 'aumodify.name AS modifiedBy')
|
|
|
|
|
->orderBy('name', 'ASC')
|
|
|
|
|
->paginate(15);
|
|
|
|
|
|
|
|
|
|
if($request->has('keyword')){ // != ''
|
|
|
|
|
@@ -64,6 +66,7 @@ class ClientsController extends Controller
|
|
|
|
|
->join('auth_users AS aumodify', 'aumodify.id', '=', 'clients.last_modified_by')
|
|
|
|
|
->select('clients.id','clients.name', 'clients.status', 'clients.country', 'aumngr.name As accountMgr', 'aumodify.name AS modifiedBy')
|
|
|
|
|
->whereRaw("clients.name like '%$keyword%' or clients.status like '%$keyword%' OR clients.country like '%$keyword%' OR aumngr.name like '%$keyword%' OR aumodify.name like '%$keyword%'")
|
|
|
|
|
->orderBy('name', 'ASC')
|
|
|
|
|
->paginate(15);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -140,13 +143,15 @@ class ClientsController extends Controller
|
|
|
|
|
*/
|
|
|
|
|
public function create()
|
|
|
|
|
{
|
|
|
|
|
$countries = Models\Country::pluck('en_short_name','alpha_2_code');
|
|
|
|
|
$service_type = Models\Service::pluck('name', 'id');
|
|
|
|
|
$countries = Models\Country::pluck('en_short_name','en_short_name');
|
|
|
|
|
$service_type = Models\Service::pluck('name', 'name');
|
|
|
|
|
$payment_type = Models\PaymentType::pluck('name', 'id');
|
|
|
|
|
$auth_users = Models\Account::pluck('name', 'id');
|
|
|
|
|
$status = ['Live' => 'Live', 'inactive' => 'Inactive', 'Prospective' => 'Prospective'];
|
|
|
|
|
$currency = Models\Currency::pluck('name','name');
|
|
|
|
|
|
|
|
|
|
$company_types = ['Aggregator/Supplier' => 'Aggregator/Supplier', 'Enterprise' => 'Enterprise', 'Hybrid' => 'Hybrid'];
|
|
|
|
|
$industries = Models\Industry::orderBy('name', 'ASC')->pluck('name', 'name');
|
|
|
|
|
// $industries = Models\Industry::pluck('name', 'name')->orderBy('name', 'ASC');
|
|
|
|
|
$data = [
|
|
|
|
|
'page_title' => 'Create Client',
|
|
|
|
|
'countries' => $countries,
|
|
|
|
|
@@ -154,7 +159,9 @@ class ClientsController extends Controller
|
|
|
|
|
'status' => $status,
|
|
|
|
|
'currency' => $currency,
|
|
|
|
|
'auth_users' => $auth_users,
|
|
|
|
|
'payment_type' => $payment_type
|
|
|
|
|
'payment_type' => $payment_type,
|
|
|
|
|
'company_types' => $company_types,
|
|
|
|
|
'industries' => $industries
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
return view('client.create', $data);
|
|
|
|
|
@@ -177,12 +184,10 @@ class ClientsController extends Controller
|
|
|
|
|
'status' => 'required',
|
|
|
|
|
'payment_mode' => 'required',
|
|
|
|
|
'currency' => 'required',
|
|
|
|
|
'company_type' => 'required',
|
|
|
|
|
'industry' => 'required',
|
|
|
|
|
'auth_user_id' => 'required', // account manager
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// dd($request->all());
|
|
|
|
|
//'email' => 'unique:users,email_address'
|
|
|
|
|
$client_arr = [
|
|
|
|
|
'name' => $request->name,
|
|
|
|
|
'email' => $request->email,
|
|
|
|
|
@@ -194,15 +199,24 @@ class ClientsController extends Controller
|
|
|
|
|
'created_by' => session('current_user.id'),
|
|
|
|
|
'last_modified_by' => session('current_user.id')
|
|
|
|
|
];
|
|
|
|
|
if ($request->notes) {
|
|
|
|
|
if ($request->has('notes')) {
|
|
|
|
|
$client_arr['notes'] = $request->notes;
|
|
|
|
|
}
|
|
|
|
|
if ($request->skype_name) {
|
|
|
|
|
if ($request->has('services')) {
|
|
|
|
|
$client_arr['services'] = json_encode($request->services);
|
|
|
|
|
}
|
|
|
|
|
if ($request->has('phone')) {
|
|
|
|
|
$client_arr['phone'] = $request->phone;
|
|
|
|
|
}
|
|
|
|
|
if ($request->has('skype_name')) {
|
|
|
|
|
$client_arr['skype_name'] = $request->skype_name;
|
|
|
|
|
}
|
|
|
|
|
if ($request->linkedin_name) {
|
|
|
|
|
if ($request->has('linkedin_name')) {
|
|
|
|
|
$client_arr['linkedin_name'] = $request->linkedin_name;
|
|
|
|
|
}
|
|
|
|
|
if ($request->has('contact_person')) {
|
|
|
|
|
$client_arr['contact_person'] = $request->contact_person;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$result = Models\Client::create($client_arr);
|
|
|
|
|
|
|
|
|
|
@@ -216,7 +230,8 @@ class ClientsController extends Controller
|
|
|
|
|
//TODO send an email to jim/priscilla about new USSD client,
|
|
|
|
|
#dispatch(new SendNewUssdClientEmail($result));
|
|
|
|
|
}
|
|
|
|
|
$retval = $this->store_services($request->services, $result->id);
|
|
|
|
|
#save services this has been moved to the main client table
|
|
|
|
|
//$retval = $this->store_services($request->services, $result->id);
|
|
|
|
|
|
|
|
|
|
Session::flash('success_message', 'Client successfully added');
|
|
|
|
|
return redirect(url('clients'));
|
|
|
|
|
@@ -247,7 +262,7 @@ class ClientsController extends Controller
|
|
|
|
|
|
|
|
|
|
$notes = Models\ClientNote::with('client_info', 'created_by_info')->find($result->id);
|
|
|
|
|
//todo : send emails
|
|
|
|
|
//dispatch(new SendNewNotesEmailAlert($notes));
|
|
|
|
|
dispatch(new SendNewNotesEmailAlert($notes));
|
|
|
|
|
|
|
|
|
|
if ($result) {
|
|
|
|
|
$data = ['code' => 1, 'msg' => 'Notes successfully added'];
|
|
|
|
|
@@ -257,6 +272,129 @@ class ClientsController extends Controller
|
|
|
|
|
}
|
|
|
|
|
return response()->json($data, 200);
|
|
|
|
|
}
|
|
|
|
|
public function financeStore(Request $request)
|
|
|
|
|
{
|
|
|
|
|
$request->validate([
|
|
|
|
|
'client_id' => 'required',
|
|
|
|
|
'services' => 'required',
|
|
|
|
|
'invoice_number' => 'required',
|
|
|
|
|
'invoice_amount' => 'required',
|
|
|
|
|
'invoice_date' => 'required',
|
|
|
|
|
'invoice_status' => 'required'
|
|
|
|
|
]);
|
|
|
|
|
$auth_user = session('current_user');
|
|
|
|
|
|
|
|
|
|
// dd($request->all());
|
|
|
|
|
//'email' => 'unique:users,email_address'
|
|
|
|
|
$finance_arr = [
|
|
|
|
|
'invoice_number' => $request->invoice_number,
|
|
|
|
|
'invoice_amount' => $request->invoice_amount,
|
|
|
|
|
'invoice_date' => $request->invoice_date,
|
|
|
|
|
'invoice_status' => $request->invoice_status,
|
|
|
|
|
'services' => implode(',', $request->services),
|
|
|
|
|
'user_id' => $auth_user['id'],
|
|
|
|
|
'client_id' => $request->client_id
|
|
|
|
|
];
|
|
|
|
|
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);
|
|
|
|
|
if ($result) {
|
|
|
|
|
$data = ['code' => 1, 'msg' => 'Payment Details successfully added'];
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
$data = ['code' => 3, 'msg' => 'Your request could not be handled at this time'];
|
|
|
|
|
}
|
|
|
|
|
return response()->json($data, 200);
|
|
|
|
|
}
|
|
|
|
|
public function shortcodeStore(Request $request)
|
|
|
|
|
{
|
|
|
|
|
$request->validate([
|
|
|
|
|
'client_id' => 'required',
|
|
|
|
|
'network' => 'required',
|
|
|
|
|
'shortcode' => 'required',
|
|
|
|
|
'code_type' => 'required',
|
|
|
|
|
'toll_free' => 'required',
|
|
|
|
|
'status' => 'required',
|
|
|
|
|
'remarks' => 'required',
|
|
|
|
|
'launch_date' => 'required'
|
|
|
|
|
]);
|
|
|
|
|
$auth_user = session('current_user');
|
|
|
|
|
|
|
|
|
|
$shortcode_arr = [
|
|
|
|
|
'name' => $request->name,
|
|
|
|
|
'client_id' => $request->client_id,
|
|
|
|
|
'network' => $request->network,
|
|
|
|
|
'shortcode' => $request->shortcode,
|
|
|
|
|
'code_type' => $request->code_type,
|
|
|
|
|
'toll_free' => $request->toll_free,
|
|
|
|
|
'last_updaed_by' => $auth_user['id'],
|
|
|
|
|
'launch_date' => $request->launch_date,
|
|
|
|
|
'status' => $request->status
|
|
|
|
|
];
|
|
|
|
|
if ($request->has('remarks')) {
|
|
|
|
|
$shortcode_arr['remarks'] = $request->remarks;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$result = Models\ClientShortCode::create($shortcode_arr);
|
|
|
|
|
|
|
|
|
|
if ($result) {
|
|
|
|
|
$data = ['code' => 1, 'msg' => 'ShortCode Details successfully added'];
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
$data = ['code' => 3, 'msg' => 'Your request could not be handled at this time'];
|
|
|
|
|
}
|
|
|
|
|
return response()->json($data, 200);
|
|
|
|
|
}
|
|
|
|
|
public function financeUpdate(Request $request)
|
|
|
|
|
{
|
|
|
|
|
$request->validate([
|
|
|
|
|
'payment_id' => 'required',
|
|
|
|
|
'client_id' => 'required',
|
|
|
|
|
'services' => 'required',
|
|
|
|
|
'invoice_number' => 'required',
|
|
|
|
|
'invoice_amount' => 'required',
|
|
|
|
|
'invoice_date' => 'required',
|
|
|
|
|
'invoice_status' => 'required'
|
|
|
|
|
]);
|
|
|
|
|
$auth_user = session('current_user');
|
|
|
|
|
$payment = Models\ClientPayment::findOrFail($request->payment_id);
|
|
|
|
|
|
|
|
|
|
$payment->invoice_number = $request->invoice_number;
|
|
|
|
|
$payment->invoice_amount = $request->invoice_amount;
|
|
|
|
|
$payment->invoice_date = $request->invoice_date;
|
|
|
|
|
$payment->invoice_status = $request->invoice_status;
|
|
|
|
|
$payment->services = implode(',', $request->services);
|
|
|
|
|
$result = $payment->save();
|
|
|
|
|
|
|
|
|
|
//'email' => 'unique:users,email_address'
|
|
|
|
|
/*
|
|
|
|
|
$finance_arr = [
|
|
|
|
|
'invoice_number' => $request->invoice_number,
|
|
|
|
|
'invoice_amount' => $request->invoice_amount,
|
|
|
|
|
'invoice_date' => $request->invoice_date,
|
|
|
|
|
'invoice_status' => $request->invoice_status,
|
|
|
|
|
'services' => implode(',', $request->services),
|
|
|
|
|
'user_id' => $auth_user['id'],
|
|
|
|
|
'client_id' => $request->client_id
|
|
|
|
|
];
|
|
|
|
|
if ($request->has('remarks')) {
|
|
|
|
|
$finance_arr['remarks'] = $request->remarks;
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#$payments = Models\ClientPayment::with('client_info', 'created_by_info')->find($result->id);
|
|
|
|
|
if ($result) {
|
|
|
|
|
$data = ['code' => 1, 'msg' => 'Payment Details successfully updated'];
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
$data = ['code' => 3, 'msg' => 'Your request could not be handled at this time'];
|
|
|
|
|
}
|
|
|
|
|
return response()->json($data, 200);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Display the specified resource.
|
|
|
|
|
@@ -266,15 +404,21 @@ class ClientsController extends Controller
|
|
|
|
|
*/
|
|
|
|
|
public function show($id)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
$showclient = Models\Client::with('service_info', 'country_info', 'auth_user_info')->find($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 = 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();
|
|
|
|
|
$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');
|
|
|
|
|
$networks = Models\NetworkOps::pluck('name', 'name');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($showclient->status == 'Live') {
|
|
|
|
|
$status_bg = "info";
|
|
|
|
|
}
|
|
|
|
|
@@ -284,8 +428,48 @@ class ClientsController extends Controller
|
|
|
|
|
else{
|
|
|
|
|
$status_bg = "danger";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//dd($showclient->sender_ids);
|
|
|
|
|
|
|
|
|
|
$renewal_due = 'N/A';
|
|
|
|
|
$highlight_colour = 'none';
|
|
|
|
|
//review this later
|
|
|
|
|
if ($showclient->contract_validity == null || $showclient->contract_validity == '') {
|
|
|
|
|
$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 == '-') {
|
|
|
|
|
$highlight_colour = 'warning';
|
|
|
|
|
$renewal_due = "Contract expired $days days(s) ago";
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
$renewal_due = "In $days day(s)" ;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
|
|
|
|
|
if ($polar == '-') {
|
|
|
|
|
$highlight_colour = 'warning';
|
|
|
|
|
$renewal_due = "Contract expired $months month(s) ago";
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
$renewal_due = "In $months months";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$data = [
|
|
|
|
|
'page_title' => 'Client Profile',
|
|
|
|
|
'showclient' => $showclient,
|
|
|
|
|
@@ -293,9 +477,16 @@ class ClientsController extends Controller
|
|
|
|
|
'service_type' => $service_type,
|
|
|
|
|
'service_type_names' => $service_type_names,
|
|
|
|
|
'show_notes' => $show_notes,
|
|
|
|
|
'status_bg' => $status_bg
|
|
|
|
|
'status_bg' => $status_bg,
|
|
|
|
|
'voice_codes' => $voice_codes,
|
|
|
|
|
'sms_codes' => $sms_codes,
|
|
|
|
|
'ussd_codes' => $ussd_codes,
|
|
|
|
|
'countries' => $countries,
|
|
|
|
|
'networks' => $networks,
|
|
|
|
|
'renewal_due' => $renewal_due,
|
|
|
|
|
'recent_payments' => $recent_payments,
|
|
|
|
|
'highlight_colour' => $highlight_colour
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
return view('client.show', $data);
|
|
|
|
|
}
|
|
|
|
|
public function showservices($id)
|
|
|
|
|
@@ -311,14 +502,47 @@ class ClientsController extends Controller
|
|
|
|
|
}
|
|
|
|
|
public function editservice($id)
|
|
|
|
|
{
|
|
|
|
|
$service = Models\ClientCategory::find($id);
|
|
|
|
|
dd($service);
|
|
|
|
|
$payment = Models\ClientCategory::find($id);
|
|
|
|
|
$data = [
|
|
|
|
|
'page_title' => 'Show Services',
|
|
|
|
|
'service' => $service
|
|
|
|
|
];
|
|
|
|
|
return view('client.service-edit', $data);
|
|
|
|
|
}
|
|
|
|
|
public function getPayment($id)
|
|
|
|
|
{
|
|
|
|
|
$payment = Models\ClientPayment::find($id);
|
|
|
|
|
if ($payment) {
|
|
|
|
|
$services_arr = explode(',', $payment->services);
|
|
|
|
|
|
|
|
|
|
return response()->json([ 'code' => 1, 'result' => $payment, 'services_arr' => $services_arr]);
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
return response()->json([ 'code' => 3, 'msg' => 'Request could not be handled at this time']);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public function getShortCodes(){
|
|
|
|
|
//$auth_users = Models\SystemUser::pluck('name', 'id');
|
|
|
|
|
|
|
|
|
|
$voice_codes = Models\ClientShortCode::with('client_info', 'client_info', 'update_info')->where('code_type', 'voice')->get();
|
|
|
|
|
$sms_codes = Models\ClientShortCode::with('client_info','client_info', 'update_info')->where('code_type', 'sms')->get();
|
|
|
|
|
$ussd_codes = Models\ClientShortCode::with('client_info', 'client_info', 'update_info')->where('code_type', 'ussd')->get();
|
|
|
|
|
//dd($voice_codes);
|
|
|
|
|
|
|
|
|
|
// dump($sms_codes[0]->last_updaed_by);
|
|
|
|
|
// dd($auth_users[$sms_codes[0]->last_updaed_by]);
|
|
|
|
|
|
|
|
|
|
$codes = Models\ClientShortCode::with('update_info')->get();
|
|
|
|
|
|
|
|
|
|
$data = [
|
|
|
|
|
'page_title' => 'Client Short Codes',
|
|
|
|
|
'voice_codes' => $voice_codes,
|
|
|
|
|
'sms_codes' => $sms_codes,
|
|
|
|
|
'ussd_codes' => $ussd_codes,
|
|
|
|
|
];
|
|
|
|
|
return view('client.shortcodes', $data);
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* Show the form for editing the specified resource.
|
|
|
|
|
*
|
|
|
|
|
@@ -328,17 +552,75 @@ class ClientsController extends Controller
|
|
|
|
|
public function edit($id)
|
|
|
|
|
{
|
|
|
|
|
$client = Models\Client::find($id);
|
|
|
|
|
|
|
|
|
|
$service_type = Models\Service::pluck('name', 'id');
|
|
|
|
|
|
|
|
|
|
$service_type = Models\Service::pluck('name', 'name');
|
|
|
|
|
$countries = Models\Country::pluck('en_short_name','en_short_name');
|
|
|
|
|
|
|
|
|
|
$payment_type = ['Prepaid' => 'Prepaid', 'Postpaid' => 'Postpaid']; // Models\PaymentType::pluck('name', 'id')->toArray();
|
|
|
|
|
$status = ['Live' => 'Live', 'inactive' => 'Inactive', 'Prospective' => 'Prospective'];
|
|
|
|
|
$currency = Models\Currency::pluck('name', 'name'); //
|
|
|
|
|
|
|
|
|
|
$company_types = ['A2P Supplier' => 'A2P Supplier', 'A2P Consumer' => 'A2P Consumer', 'Hybrid' => 'Hybrid'];
|
|
|
|
|
$company_types = ['Aggregator/Supplier' => 'Aggregator/Supplier', 'Enterprise' => 'Enterprise', 'Hybrid' => 'Hybrid'];
|
|
|
|
|
$auth_users = Models\Account::pluck('name', 'id');
|
|
|
|
|
// dd($client->sender_ids);
|
|
|
|
|
$industries = Models\Industry::orderBy('name', 'ASC')->pluck('name', 'name');
|
|
|
|
|
$message_types_arr = ['International' => 'International', 'Local' => 'Local'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$how_we_got_clients_arr = ['Event : (GCCM) etc' => 'Event : (GCCM) etc', 'Referral' => 'Referral', 'Word of Mouth' => 'Word of Mouth', 'Marketing' => 'Marketing', 'Other' => 'Other'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 'current_services' => json_decode($client->services, true);
|
|
|
|
|
|
|
|
|
|
if ($client->support_emails) {
|
|
|
|
|
$support_emails = json_decode($client->support_emails, true);
|
|
|
|
|
$support_emails = array_combine($support_emails, $support_emails);
|
|
|
|
|
$old_support_emails = json_decode($client->support_emails, true);
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
$support_emails = [];
|
|
|
|
|
$old_support_emails = [];
|
|
|
|
|
}
|
|
|
|
|
if ($client->rate_emails) {
|
|
|
|
|
$rate_emails = json_decode($client->rate_emails, true);
|
|
|
|
|
$rate_emails = array_combine($rate_emails, $rate_emails);
|
|
|
|
|
$old_rate_emails = json_decode($client->rate_emails, true);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
$rate_emails = [];
|
|
|
|
|
$old_rate_emails = [];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($client->support_phones) {
|
|
|
|
|
$support_phones = json_decode($client->support_phones, true);
|
|
|
|
|
$support_phones = array_combine($support_phones, $support_phones);
|
|
|
|
|
$old_support_phones = json_decode($client->support_phones, true);
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
$support_phones = [];
|
|
|
|
|
$old_support_phones = [];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($client->support_skype) {
|
|
|
|
|
$support_skype_arr = json_decode($client->support_skype, true);
|
|
|
|
|
$support_skype_arr = array_combine($support_skype_arr, $support_skype_arr);
|
|
|
|
|
$old_support_skype_arr = json_decode($client->support_skype, true);
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
$support_skype_arr = [];
|
|
|
|
|
$old_support_skype_arr = [];
|
|
|
|
|
}
|
|
|
|
|
if ($client->finance_email) {
|
|
|
|
|
$finance_emails = json_decode($client->finance_email, true);
|
|
|
|
|
$finance_emails = array_combine($finance_emails, $finance_emails);
|
|
|
|
|
$old_finance_emails = json_decode($client->finance_email, true);
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
$finance_emails = [];
|
|
|
|
|
$old_finance_emails = [];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($client->sender_ids) {
|
|
|
|
|
$sender_ids = json_decode($client->sender_ids, true);
|
|
|
|
|
$sender_ids = array_combine($sender_ids, $sender_ids);
|
|
|
|
|
@@ -363,6 +645,7 @@ class ClientsController extends Controller
|
|
|
|
|
$contract_types = ['bilateral' => 'bilateral', 'unilateral' => 'unilateral'];
|
|
|
|
|
$connections = ['SMPP' => 'SMPP', 'HTTP' => 'HTTP'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$data = [
|
|
|
|
|
'client' => $client,
|
|
|
|
|
'countries' => $countries,
|
|
|
|
|
@@ -375,11 +658,27 @@ class ClientsController extends Controller
|
|
|
|
|
'connections_arr' => $connections,
|
|
|
|
|
'status_bg' => $status_bg,
|
|
|
|
|
'sender_ids' => $sender_ids,
|
|
|
|
|
|
|
|
|
|
'finance_emails' => $finance_emails,
|
|
|
|
|
'support_emails' => $support_emails,
|
|
|
|
|
'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,
|
|
|
|
|
'old_support_skype_arr' => $old_support_skype_arr,
|
|
|
|
|
'old_support_phones' => $old_support_phones,
|
|
|
|
|
|
|
|
|
|
'company_types' => $company_types,
|
|
|
|
|
'old_sender_ids' => $old_sender_ids,
|
|
|
|
|
'contract_types' => $contract_types
|
|
|
|
|
'contract_types' => $contract_types,
|
|
|
|
|
'message_types_arr' => $message_types_arr,
|
|
|
|
|
'industries' => $industries,
|
|
|
|
|
'how_we_got_clients_arr' => $how_we_got_clients_arr,
|
|
|
|
|
'current_services' => json_decode($client->services, true)
|
|
|
|
|
];
|
|
|
|
|
// dd($service_type->toArray());
|
|
|
|
|
return view('client.edit', $data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -403,9 +702,7 @@ class ClientsController extends Controller
|
|
|
|
|
]);
|
|
|
|
|
$client_update = Models\Client::find($id);
|
|
|
|
|
|
|
|
|
|
//dump($request->status);
|
|
|
|
|
//dump(($request->sender_ids) ? json_encode($request->sender_ids) : "");
|
|
|
|
|
//dd($request->all());
|
|
|
|
|
// dd($request->support_emails);
|
|
|
|
|
|
|
|
|
|
$client_update->name = $request->name;
|
|
|
|
|
$client_update->email = $request->email;
|
|
|
|
|
@@ -416,16 +713,38 @@ class ClientsController extends Controller
|
|
|
|
|
$client_update->country = $request->country;
|
|
|
|
|
$client_update->currency = $request->currency;
|
|
|
|
|
$client_update->notes = $request->notes;
|
|
|
|
|
$client_update->skype_name = $request->skype_name;
|
|
|
|
|
$client_update->linkedin_name = $request->linkedin_name;
|
|
|
|
|
$client_update->industry = $request->industry;
|
|
|
|
|
|
|
|
|
|
$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 ?? "";
|
|
|
|
|
$client_update->contract_validity = $request->contract_validity ?? "";
|
|
|
|
|
$client_update->smpp_details = $request->smpp_details ?? "";
|
|
|
|
|
$client_update->contract_auto_renew = $request->contract_auto_renew ?? "";
|
|
|
|
|
//$client_update->smpp_details = $request->smpp_details ?? "";
|
|
|
|
|
$client_update->sender_ids = ($request->sender_ids) ? json_encode($request->sender_ids) : "";
|
|
|
|
|
$client_update->connections = ($request->connections) ? json_encode($request->connections) : "";
|
|
|
|
|
$client_update->services = ($request->services) ? json_encode($request->services) : "";
|
|
|
|
|
$client_update->message_types = ($request->message_types) ? json_encode($request->message_types) : "";
|
|
|
|
|
|
|
|
|
|
$client_update->finance_email = ($request->finance_email) ? json_encode($request->finance_email) : "";
|
|
|
|
|
$client_update->support_emails = ($request->support_emails) ? json_encode($request->support_emails) : "";
|
|
|
|
|
$client_update->rate_emails = ($request->rate_emails) ? json_encode($request->rate_emails) : "";
|
|
|
|
|
$client_update->support_phones = ($request->support_phones) ? json_encode($request->support_phones) : "";
|
|
|
|
|
$client_update->support_skype = ($request->support_skype) ? json_encode($request->support_skype) : "";
|
|
|
|
|
|
|
|
|
|
if ($request->has('how_we_got_client')) {
|
|
|
|
|
if ($request->how_we_got_client == 'Other') {
|
|
|
|
|
$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->created_by = session('current_user.id');
|
|
|
|
|
$client_update->last_modified_by = session('current_user.id');
|
|
|
|
|
@@ -501,6 +820,7 @@ class ClientsController extends Controller
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function get_filter_ids($filter, $keyword)
|
|
|
|
|
{
|
|
|
|
|
switch ($filter) {
|
|
|
|
|
|