Compare commits

...

10 Commits

Author SHA1 Message Date
Kwesi Banson Jnr
5dbe76dbd4 multiple bug fixes including sender ID filtering 2026-04-16 14:22:04 +00:00
Kwesi Banson Jnr
72180de8e4 added logic for updating user profile plus other bug fixes 2026-03-16 16:41:32 +00:00
Kwesi Banson Jnr
9cd017fb9a fixed shortcode edit issues plus refactoring 2026-02-05 08:38:07 +00:00
Kwesi Banson Jnr
063572463b fixed senderid bulk upload, uploaded logo file on prod 2025-11-28 21:14:38 +00:00
Kwesi Banson Jnr
d5ac7391dd bug fixes, AM change feature, refactoring 2025-11-23 14:40:32 +00:00
Kwesi Banson Jnr
eabf61b7da bug fixes and new additions 2025-08-13 00:10:17 +00:00
Kwesi Banson Jnr
cf39ff2682 after a series of bug fixes plus Non MNO logic for Sender IDs, unfinished leave management and holiday modules 2025-03-19 10:33:04 +00:00
Kwesi Banson
6cede6d980 added sender ID to the clients Tab in Show view plus bug fixes 2024-08-26 10:23:49 +00:00
Kwesi Banson
4a0248e40d Moved ShortCodes to a new controller, added Tabulator, bug fixes 2024-07-09 15:49:56 +00:00
Kwesi Banson
101012c684 Added MNO docs to Paperless, fixed new clients info on dashboard 2024-07-04 11:32:19 +00:00
668 changed files with 212083 additions and 912 deletions

View File

@@ -1,4 +1,4 @@
# URL
F# URL
- http://206.225.84.201/general/team_tracker
# Email
@@ -8,6 +8,9 @@
app password: sqczcsrtcehpywjv
## Accounts
- kwesi
- Pa$$w0rd!/password
- charity
- char5009
@@ -55,3 +58,15 @@ app password: sqczcsrtcehpywjv
- daniel
- theCitadel@111
- orou
- boatformer@100
- andrew
- blacktone@900
- aniguia@click-mobile.com
- mozfet@100
- melissa@click-mobile.com
- swlgas@Och5T

View File

@@ -0,0 +1,43 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\Http\Controllers\HolidaysController;
class ProcessHolidayAlert extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'holidayalerts:send';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Send Upcoming Holiday Alerts to team members';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct(HolidaysController $hoidays_alerts)
{
parent::__construct();
$this->hoidays_alerts = $hoidays_alerts;
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$this->hoidays_alerts->getHolidayDetails();
}
}

View File

@@ -0,0 +1,44 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\Http\Controllers\ContractRenewalReminderController;
class ProcessSupportFeesRenewalReminders extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'support_fees_renewal:send';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Send Reminders on Support Fees';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct(ContractRenewalReminderController $contractRenewalReminder)
{
parent::__construct();
$this->contractRenewalReminder = $contractRenewalReminder;
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$this->contractRenewalReminder->getSupportFeesList();
}
}

View File

@@ -14,7 +14,8 @@ class Kernel extends ConsoleKernel
*/
protected $commands = [
Commands\SendContractRenewalReminders::class,
Commands\ProcessClientContractRenewalAlert::class
Commands\ProcessClientContractRenewalAlert::class,
Commands\ProcessHolidayAlert::class
];
/**
@@ -29,6 +30,8 @@ class Kernel extends ConsoleKernel
// ->hourly();
$schedule->command('renewal:send')->weekdays()->at('13:00');
$schedule->command('client_renewal:send')->weekdays()->at('14:00');
$schedule->command('support_fees_renewal:send')->weekdays()->at('15:00');
$schedule->command('holidayalerts:send')->weekdays()->at('16:00');
}
/**

View File

@@ -10,9 +10,12 @@ 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;
use Spatie\Activitylog\Models\Activity;
use Config;
class ClientsController extends Controller
{
@@ -22,57 +25,76 @@ class ClientsController extends Controller
* @return \Illuminate\Http\Response
*/
public function index(){
/*
$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);
}
public function indexBak(){
$client_arr = new Models\Client;
$client_arr = $client_arr->with('auth_user_info','country_info', 'created_by_info')->orderBy('name', 'ASC')->paginate(10);
public function indexInactive(){
$data = [
'page_title' => 'Clients',
'page_title' => 'Inactive Clients',
'current_user' => session('current_user')
];
return view('client.index-rawjs', $data);
// dd('foo bar');
return view('client.index-inactive', $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);
}
*/
// $this->log_query();
$client_arr = \DB::table('clients')
->join('auth_users AS aumngr', 'aumngr.id', '=', 'clients.auth_user_id')
->join('auth_users AS aumodify', 'aumodify.id', '=', 'clients.last_modified_by')
->join('flags AS flags', 'flags.country', '=', 'clients.country')
->select('clients.id', 'clients.name', 'clients.status','clients.progress_indicator_score', 'clients.country', 'aumngr.name As accountMgr', 'aumodify.name AS modifiedBy', 'flags.url AS theflag')
->whereRaw("status NOT IN ('inactive', 'Cancelled')")
->orderBy('name', 'ASC')
->paginate(15);
->get();
// ->paginate(15);
if($request->has('keyword')){
$keyword = $request->keyword;
if (strpos('inactive', $keyword) !== false ) {
// dump('foo bars');
$client_arr = \DB::table('clients')
->join('auth_users AS aumngr', 'aumngr.id', '=', 'clients.auth_user_id')
->join('auth_users AS aumodify', 'aumodify.id', '=', 'clients.last_modified_by')
->join('flags AS flags', 'flags.country', '=', 'clients.country')
->select('clients.id','clients.name', 'clients.status', 'clients.progress_indicator_score','clients.country', 'aumngr.name As accountMgr', 'aumodify.name AS modifiedBy', 'flags.url AS theflag')
->whereRaw("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%'")
// ->whereRaw("status IN ('Live', 'Prospective')")
->whereRaw("status NOT IN ('inactive', 'Cancelled')")
->whereRaw("clients.name LIKE '%$keyword%' OR clients.country LIKE '%$keyword%' OR aumngr.name like '%$keyword%' OR aumodify.name LIKE '%$keyword%'")
->orderBy('name', 'ASC')
->paginate(15);
->get();
// foreach ($client_arr as $value) {
// // code...
// dd($value);
// }
dump($client_arr->contains('status', 'inactive'));
}
elseif (strpos('Cancelled', $keyword) !== false ) {
$client_arr = \DB::table('clients')
->join('auth_users AS aumngr', 'aumngr.id', '=', 'clients.auth_user_id')
->join('auth_users AS aumodify', 'aumodify.id', '=', 'clients.last_modified_by')
->join('flags AS flags', 'flags.country', '=', 'clients.country')
->select('clients.id','clients.name', 'clients.status', 'clients.progress_indicator_score','clients.country', 'aumngr.name As accountMgr', 'aumodify.name AS modifiedBy', 'flags.url AS theflag')
// ->whereRaw("status IN ('Live', 'Prospective')")
->whereRaw("status NOT IN ('inactive', 'Cancelled')")
->whereRaw("clients.name LIKE '%$keyword%' OR clients.country LIKE '%$keyword%' OR aumngr.name LIKE '%$keyword%' OR aumodify.name LIKE '%$keyword%'")
->orderBy('name', 'ASC')
->get();
}else{
$client_arr = \DB::table('clients')
->join('auth_users AS aumngr', 'aumngr.id', '=', 'clients.auth_user_id')
->join('auth_users AS aumodify', 'aumodify.id', '=', 'clients.last_modified_by')
->join('flags AS flags', 'flags.country', '=', 'clients.country')
->select('clients.id','clients.name', 'clients.status', 'clients.progress_indicator_score','clients.country', 'aumngr.name As accountMgr', 'aumodify.name AS modifiedBy', 'flags.url AS theflag')
->whereRaw("status IN ('Live', 'Prospective')")
->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')
->get();
}
// ->paginate(15);
}
return response()->json($client_arr);
@@ -85,6 +107,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')
->whereRaw("status <> 'Inactive'")
->paginate(10);
if($request->has('keyword')){
@@ -93,6 +116,57 @@ 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')
->whereRaw("status <> 'Inactive'")
->whereRaw("clients.name like '%$keyword%' OR clients.status like '%$keyword%' OR clients.country like '%$keyword%' OR aumngr.name like '%$keyword%' OR aumodify.name like '%$keyword%'")
->paginate(10);
}
return response()->json($client_arr);
}
public function getInactiveClientJson(Request $request){
$client_arr = \DB::table('clients')
->join('auth_users AS aumngr', 'aumngr.id', '=', 'clients.auth_user_id')
->join('auth_users AS aumodify', 'aumodify.id', '=', 'clients.last_modified_by')
->join('flags AS flags', 'flags.country', '=', 'clients.country')
->select('clients.id', 'clients.name', 'clients.status','clients.progress_indicator_score', 'clients.country', 'aumngr.name As accountMgr', 'aumodify.name AS modifiedBy', 'flags.url AS theflag')
->whereRaw("status IN ('inactive', 'Cancelled')")
->orderBy('name', 'ASC')
->get();
// ->paginate(15);
if($request->has('keyword')){
$keyword = $request->keyword;
$client_arr = \DB::table('clients')
->join('auth_users AS aumngr', 'aumngr.id', '=', 'clients.auth_user_id')
->join('auth_users AS aumodify', 'aumodify.id', '=', 'clients.last_modified_by')
->join('flags AS flags', 'flags.country', '=', 'clients.country')
->select('clients.id','clients.name', 'clients.status', 'clients.progress_indicator_score','clients.country', 'aumngr.name As accountMgr', 'aumodify.name AS modifiedBy', 'flags.url AS theflag')
->whereRaw("status IN ('inactive', 'Cancelled')")
->whereRaw("clients.name LIKE '%$keyword%' OR clients.status LIKE '%$keyword%' OR clients.country LIKE '%$keyword%' OR aumngr.name LIKE '%$keyword%' OR aumodify.name LIKE '%$keyword%' OR clients.progress_indicator_score LIKE '%$keyword%'")
->orderBy('name', 'ASC')
->get();
// ->paginate(15);
}
return response()->json($client_arr);
}
public function getInacticeClientJsonRawJs(Request $request){
$client_arr = \DB::table('clients')
->join('auth_users AS aumngr', 'aumngr.id', '=', 'clients.auth_user_id')
->join('auth_users AS aumodify', 'aumodify.id', '=', 'clients.last_modified_by')
->select('clients.id', 'clients.name', 'clients.status', 'clients.country', 'aumngr.name As accountMgr', 'aumodify.name AS modifiedBy')
->whereRaw("status = 'Inactive'")
->paginate(10);
if($request->has('keyword')){
$keyword = $request->keyword;
$client_arr = \DB::table('clients')
->join('auth_users AS aumngr', 'aumngr.id', '=', 'clients.auth_user_id')
->join('auth_users AS aumodify', 'aumodify.id', '=', 'clients.last_modified_by')
->select('clients.id','clients.name', 'clients.status', 'clients.country', 'aumngr.name As accountMgr', 'aumodify.name AS modifiedBy')
// ->where('status', 'inactive')
->whereRaw("status = 'Inactive'")
->whereRaw("clients.name like '%$keyword%' or clients.status like '%$keyword%' OR clients.country like '%$keyword%' OR aumngr.name like '%$keyword%' OR aumodify.name like '%$keyword%'")
->paginate(10);
}
@@ -111,13 +185,12 @@ class ClientsController extends Controller
$service_type = Models\Service::pluck('name', 'name');
$payment_type = ['Prepaid' => 'Prepaid', 'Postpaid' => 'Postpaid']; //Models\PaymentType::pluck('name', 'id');
$auth_users = Models\SystemUser::pluck('name', 'id');
$status = ['Live' => 'Live', 'inactive' => 'Inactive', 'Prospective' => 'Prospective'];
$status = ['Live' => 'Live', 'Inactive' => 'Inactive', 'Prospective' => 'Prospective', 'Cancelled' => 'Cancelled'];
$currency = Models\Currency::pluck('name','name');
$company_types = ['Aggregator/Supplier' => 'Aggregator/Supplier', 'Enterprise' => 'Enterprise', 'Hybrid' => 'Hybrid'];
$industries = Models\Industry::orderBy('name', 'ASC')->pluck('name', 'name');
// $industries = Models\Industry::pluck('name', 'name')->orderBy('name', 'ASC');
$data = [
'page_title' => 'Create Client',
'countries' => $countries,
@@ -258,10 +331,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));
@@ -274,7 +346,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);
}
@@ -341,11 +413,18 @@ class ClientsController extends Controller
'invoice_amount' => 'required|numeric',
'invoice_date' => 'required',
'invoice_status' => 'required',
'short_code' => 'sometimes|numeric'
// 'short_code' => 'sometimes|numeric'
]);
$auth_user = session('current_user');
//dd($request->all());
if ($request->short_code !== null) {
$check = is_numeric($request->short_code);
if ($check == false) {
$data = ['code' => 3, 'msg' => 'Short Code must be a number'];
return response()->json($data, 200);
}
}
$finance_arr = [
'invoice_number' => $request->invoice_number,
'invoice_amount' => $request->invoice_amount,
@@ -359,8 +438,15 @@ class ClientsController extends Controller
if ($request->has('remarks')) {
$finance_arr['remarks'] = $request->remarks;
}
$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;
$result = Models\ClientPayment::create($finance_arr);
dispatch(new SendShortCodeListToFinance($short_code_list, $message_body, $finance_arr));
}
#$payments = Models\ClientPayment::with('client_info', 'created_by_info')->find($result->id);
if ($result) {
@@ -371,7 +457,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);
}
@@ -402,7 +488,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'];
@@ -412,7 +498,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);
}
@@ -426,15 +512,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',
@@ -473,7 +561,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,
@@ -481,13 +569,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'];
}
@@ -496,7 +590,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);
}
@@ -510,6 +604,7 @@ class ClientsController extends Controller
'invoice_date' => 'required',
'invoice_status' => 'required'
]);
$auth_user = session('current_user');
$payment = Models\ClientPayment::findOrFail($request->payment_id);
@@ -517,8 +612,30 @@ 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'];
@@ -528,8 +645,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){
@@ -539,6 +659,7 @@ class ClientsController extends Controller
'shortcode' => 'required',
'code_type' => 'required',
'toll_free' => 'required',
'monthly_fee' => 'sometimes',
'status' => 'required',
'remarks' => 'required',
'launch_date' => 'required',
@@ -567,18 +688,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);
}
@@ -589,8 +713,15 @@ 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;
/*
$currentuser = session('current_user.name');
$user_model = Models\SystemUser::find(session('current_user.id'));
activity()->performedOn($showclient)
->causedBy($user_model)
->log($currentuser . ' Opened the page for : ' . $showclient->name . date('Y-m-d H:i:s'));
*/
// dd(json_decode($showclient->progress_indicators, true));
/*
"Initial talks\/ discussions",
@@ -606,6 +737,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');
$auth_users = Models\SystemUser::orderBy('name', 'ASC')->pluck('name', 'id');
$networks_raw = [
'AirtelTigo GH' => 'AirtelTigo GH',
'MTN GH' => 'MTN GH',
@@ -618,17 +755,24 @@ class ClientsController extends Controller
'Telkom Kenya' => 'Telkom Kenya',
'Orange Kenya' => 'Orange Kenya'
];
// dd($networks_raw);
//->where('highlight', 'NO')
$show_notes = Models\ClientNote::with('created_by_info', 'client_info')->where('client_id', $id)->orderBy('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();
$showdocuments = Models\ClientFile::where('client_id', $id)->get();
//$client_sender_ids = Models\SenderId::with('network_info', 'created_by_info')->where('client_id', $id)->orderBy('senderid', 'ASC')->get();
// dd($showdocuments[0]->name);
if ($showclient->status == 'Live') {
$status_bg = "info";
}
@@ -638,7 +782,7 @@ class ClientsController extends Controller
else{
$status_bg = "danger";
}
// dd($showclient->progress_indicator_score);
if ($showclient->progress_indicator_score >= 70) {
$progress_status_bg = "success";
}
@@ -648,7 +792,7 @@ class ClientsController extends Controller
else{
$progress_status_bg = "danger";
}
// dump($progress_status_bg);
$renewal_due = 'N/A';
$highlight_colour = 'none';
@@ -696,7 +840,9 @@ class ClientsController extends Controller
sort($networks_raw);
$recurring_arr = ['NO' => 'NO', 'Monthly' => 'Monthly', 'Quarterly' => 'Quarterly', 'Semiannual' => 'Semiannual', 'Yearly' => 'Yearly'];
$sender_id_statuses = ['Pending' => 'Pending', 'Inactive' => 'Inactive', 'Approved' => 'Approved'];
$change_account_mgr_permisson = Config::get('permissions.CHANGE_ACCOUNT_MANAGERS');
$change_account_mgr_permisson = ($this->hasAnyAccess([$change_account_mgr_permisson])) ? 'YES' : 'NO';
$data = [
'page_title' => 'Client Profile',
'showclient' => $showclient,
@@ -704,6 +850,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,
@@ -718,10 +865,23 @@ class ClientsController extends Controller
'highlight_colour' => $highlight_colour,
'showdocuments' => $showdocuments,
'support_fees' => $support_fees,
'recurring_arr' => $recurring_arr
'recurring_arr' => $recurring_arr,
// 'client_sender_ids' => $client_sender_ids,
// 'sender_id_statuses' => $sender_id_statuses,
'change_account_mgr_permisson' => $change_account_mgr_permisson,
'am_list_arr' => $auth_users,
'country_network_arr' => $country_networks,
'mnos_arr' => ['' => '-- Select Country first --']
];
return view('client.show', $data);
// dump($client_sender_ids);
// foreach ($client_sender_ids as $value) {
// dd($value->network_info->name);
// }
// dd($data);
// return view('client.show', $data);
return view('client.show_accordion', $data);
}
public function showReadonly($id){
//with('short_code_info')->
$showclient = Models\Client::with('service_info', 'country_info', 'auth_user_info', 'short_code_info')->find($id);
@@ -852,21 +1012,22 @@ class ClientsController extends Controller
public function getShortCodes($type){
//$auth_users = Models\SystemUser::pluck('name', 'id');
//todo : separate the short codes into individual pages
// dd(session('current_user.designation'));
switch ($type) {
case 'sms':
$codes_data = Models\ClientShortCode::with('client_info','client_info', 'update_info')->where('code_type', 'sms')->get();
$codes_data = Models\ClientShortCode::with('client_info','client_info', 'update_info')->where('code_type', 'sms')->orderBy('id', 'DESC')->get();
break;
case 'ussd':
$codes_data = Models\ClientShortCode::with('client_info', 'client_info', 'update_info')->where('code_type', 'ussd')->get();
$codes_data = Models\ClientShortCode::with('client_info', 'client_info', 'update_info')->where('code_type', 'ussd')->orderBy('id', 'DESC')->get();
break;
case 'voice':
$codes_data = Models\ClientShortCode::with('client_info', 'client_info', 'update_info')->where('code_type', 'voice')->get();
$codes_data = Models\ClientShortCode::with('client_info', 'client_info', 'update_info')->where('code_type', 'voice')->orderBy('id', 'DESC')->get();
break;
default:
// code... show 404
break;
}
$codes = Models\ClientShortCode::with('update_info')->get();
// $codes = Models\ClientShortCode::with('update_info')->get();
$data = [
'page_title' => 'Client Short Codes',
@@ -888,9 +1049,29 @@ class ClientsController extends Controller
$countries = Models\Country::orderBy('en_short_name', 'ASC')->pluck('en_short_name','en_short_name');
$payment_type = ['Prepaid' => 'Prepaid', 'Postpaid' => 'Postpaid']; // Models\PaymentType::pluck('name', 'id')->toArray();
$status = ['Live' => 'Live', 'inactive' => 'Inactive', 'Prospective' => 'Prospective'];
// $status = ['Live' => 'Live', 'inactive' => 'Inactive', 'Prospective' => 'Prospective'];
$status = ['Live' => 'Live', 'inactive' => 'Inactive', 'Prospective' => 'Prospective', 'Cancelled' => 'Cancelled'];
$currency = Models\Currency::orderBy('name', 'ASC')->pluck('name', 'name');
$existing_documents = Models\ClientFile::where('client_id', $id)->get();
$files = [
'contract' => 'NO',
'non_disclosure' => 'NO',
'technical_doc' => 'NO'
];
foreach ($existing_documents as $value) {
if ($value->name == 'Contract') {
$files['contract'] = "YES";
}
else if($value->name == 'Non Disclosure'){
$files['non_disclosure'] = "YES";
}
else if($value->name == 'Technical Document'){
$files['technical_doc'] = "YES";
}
else{
}
}
$company_types = ['Aggregator/Supplier' => 'Aggregator/Supplier', 'Enterprise' => 'Enterprise'];
$auth_users = Models\SystemUser::orderBy('name', 'ASC')->pluck('name', 'id');
$industries = Models\Industry::orderBy('name', 'ASC')->pluck('name', 'name');
@@ -907,7 +1088,7 @@ class ClientsController extends Controller
if ($client->progress_indicator !== "COMPLETED") {
$stage_details = Models\ClientOnboardingMainStage::where('stage', $client->progress_indicator)->first();
// dump($stage_details);
$onboarding_sub_items_progress = Models\ClientOnboardingProgress::where('stage_id', $stage_details->stage_id)->where('client_id', $id)->pluck('name', 'name');
$onboarding_sub_items_progress = Models\ClientOnboardingProgress::where('stage_id', $stage_details->stage_id)->where('client_id', $id)->where('status', 'COMPLETED')->pluck('name', 'name');
// dd($onboarding_sub_items_progress);
$onboarding_sub_items = Models\ClientOnboardingSubItem::where('stage_id', $stage_details->stage_id)->pluck('name', 'name');
}
@@ -1033,8 +1214,10 @@ class ClientsController extends Controller
'onboarding_sub_items_progress' => $onboarding_sub_items_progress,
'onboarding_sub_items' => $onboarding_sub_items,
'current_pending_stage' => $client->progress_indicator,
'has_pending' => $has_pending
'has_pending' => $has_pending,
'files' => $files
];
// dd($data['onboarding_sub_items_progress']);
return view('client.edit', $data);
}
@@ -1047,26 +1230,31 @@ class ClientsController extends Controller
*/
public function update(Requests\UpdateClientRequest $request, $id){
// dump($request->all());
// \DB::connection()->enableQueryLog();
$client_update = Models\Client::find($id);
// dump($client_update->progress_indicator);
$paperless = new PaperLessNgx();
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();
#update the table for onboarding progress
// dump($request->onboarding_sub_items_progress);
if ($request->onboarding_sub_items_progress) {
foreach ($request->onboarding_sub_items_progress as $value) {
$stage_id = ['stage_id' => $current_pending_stage_details->stage_id, 'client_id' => $id, 'name' => $value ];
$stage_id = [
'stage_id' => $current_pending_stage_details->stage_id,
'client_id' => $id,
'name' => $value
];
$progress_arr = [
'status' => 'COMPLETED'
];
$clients_onboarding_progress = Models\ClientOnboardingProgress::updateOrCreate($stage_id, $progress_arr);
}
}
//update the status of onboarding progress stage in clients
$get_stage_onboarding_status = Models\ClientOnboardingProgress::where('client_id', $id)->where('stage_id', $current_pending_stage_details->stage_id)->where('status', 'COMPLETED')->get();
// dd($get_stage_onboarding_status);
$onboarding_progress_stage = json_decode($client_update->onboarding_progress_stage, true);
// dd(count($get_stage_subs_items) == count($get_stage_onboarding_status));
if (count($get_stage_subs_items) == count($get_stage_onboarding_status)) {
//check if all items have been completed and update
$onboarding_progress_stage[$current_pending_stage_details->stage] = 'COMPLETED';
@@ -1078,7 +1266,6 @@ class ClientsController extends Controller
#$pending_stage = array_key_first($pending_stage);
reset($pending_stage);
$pending_stage = key($pending_stage);
// dd($pending_stage);
if ($pending_stage == true) {
//Pending Exist
$client_update->progress_indicator = $pending_stage;
@@ -1091,34 +1278,35 @@ 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(6) . "." . $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);
// dd($top);
#$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);
//$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')) {
if ($request->file('document_two')->isValid()) {
$filename = "erp_" . time() . str_random(6) . "." . $request->document_two->extension();
$filename = "erp_" . time() . str_random(4) . "." . $request->document_two->extension();
$request->document_two->storeAs('client_files', $filename, 'public');
$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();
@@ -1126,48 +1314,51 @@ class ClientsController extends Controller
$document_arr['name'] = $request->document_two_name;
$document_arr['created_by'] = session('current_user.id');
$document_arr['client_id'] = $id;
$result = Models\ClientFile::create($document_arr);
// $result = Models\ClientFile::create($document_arr);
//$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')) {
if ($request->file('document_three')->isValid()) {
$filename = "erp_" . time() . str_random(6) . "." . $request->document_three->extension();
$filename = "erp_" . time() . str_random(4) . "." . $request->document_three->extension();
$request->document_three->storeAs('client_files', $filename, 'public');
$document_arr['file_path'] = $filename;
$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();
$document_arr['name'] = $request->document_three_name;
$document_arr['created_by'] = session('current_user.id');
$document_arr['client_id'] = $id;
$result = Models\ClientFile::create($document_arr);
// $result = Models\ClientFile::create($document_arr);
//$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')) {
if ($request->file('other_document')->isValid()) {
$filename = "erp_" . time() . str_random(6) . "." . $request->other_document->extension();
$filename = "erp_" . time() . str_random(4) . "." . $request->other_document->extension();
$request->other_document->storeAs('client_files', $filename, 'public');
$document_arr['file_path'] = $filename;
$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 ?? "";
@@ -1181,15 +1372,16 @@ class ClientsController extends Controller
#$client_update->progress_indicators = json_encode($request->onboarding_sub_items_progress);
if ($client_update->progress_indicator != 'COMPLETED') {
$client_update->onboarding_progress_stage = json_encode($onboarding_progress_stage);
// dump(json_encode($onboarding_progress_stage));
$progress_breakdown = array_count_values($onboarding_progress_stage);
// dd($progress_breakdown);
if (array_has($progress_breakdown, ['COMPLETED']) == false) {
// dd('foo');
$indicator_score = "0";
}
else{
$indicator_score = ($progress_breakdown['COMPLETED']/count($onboarding_progress_stage)) * 100;
}
$indicator_score = number_format($indicator_score);
$client_update->progress_indicator_score = $indicator_score;
}
@@ -1241,6 +1433,10 @@ class ClientsController extends Controller
'device' => $request->header('User-Agent')
];
$retval = Models\UserActivity::create($activity_arr);
// $queries = \DB::getQueryLog();
// dd($queries);
// \Log::info($queries);
Session::flash('success_message', 'Client successfully Updated');
return redirect(url('clients', $id));
}
@@ -1289,8 +1485,46 @@ class ClientsController extends Controller
}
return true;
}
public function storeFiles(AddFilesRequest $request){
public function changeAccountManagers(Request $request){
$new_account_manager = Models\SystemUser::find($request->account_manager);
$client = Models\Client::with('auth_user_info')->find($request->client_id);
$client->auth_user_id = $request->account_manager;
$client->last_modified_by = session('current_user.id');
$result = $client->save();
if ($result) {
$log_text = session('current_user.name') . " changed the account manager of ";
$log_text .= " " . $client->name . " from " . $client->auth_user_info->name;
$log_text .= " to " . $new_account_manager->name;
$activity_arr = [
'type' => 'staff',
'content' => $log_text,
'user_id' => session('current_user.id'),
'ip_address' => \Request::ip(),
'device' => $request->header('User-Agent')
];
$retval = Models\UserActivity::create($activity_arr);
$user_id = session('current_user.id');
$username = session('current_user.name');
$content = $log_text;
$this->logUsersActivity($type = 'staff', $content);
$data = ['code' => 1, $msg = 'success'];
return response()->json($data, 200);
}
else{
$data = ['code' => 3, $msg = 'fail'];
return response()->json($data, 200);
}
}
public function storeFiles(AddFilesRequest $request){
$document_arr = $request->except('document');
if ($request->hasFile('document')) {
if ($request->file('document')->isValid()) {
@@ -1299,7 +1533,7 @@ class ClientsController extends Controller
$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');
@@ -1312,11 +1546,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;
@@ -1352,6 +1591,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',

View File

@@ -9,6 +9,7 @@ use App\Models;
use Session;
use Illuminate\Support\Arr;
use App\Jobs\SendMnoContractRenewalEmailAlert;
use App\Jobs\SendSupportFeesReminderEmailAlert;
use App\Http\Requests;
use Carbon\Carbon;
@@ -36,4 +37,54 @@ class ContractRenewalReminderController extends Controller
\Log::info('MNOs due for renewal ' . $log_data);
$this->sendNtfy('MNOs due for renewal ' . $log_data);
}
public function getSupportFeesList(){
$support_fees_arr = Models\ClientSupportFees::with('created_by_info', 'client_info')->where('recurring', '<>', 'NO')->get();
// dd($support_fees_arr);
$renew_ready = [];
$current_date = date('Y-m-d');
foreach ($support_fees_arr as $value) {
// dd($value->created_by_info);
$date1 = date_create($current_date);
switch ($value->recurring) {
case 'Annual':
$date2 = date('Y-m-d', strtotime('+1 year', strtotime($value->invoice_date)));
$date2 = date_create($value->invoice_date);
$difference = date_diff($date1, $date2);
break;
case 'Semiannual':
$date2 = date('Y-m-d', strtotime('+6 months', strtotime($value->invoice_date)));
$date2 = date_create($value->invoice_date);
$difference = date_diff($date1, $date2);
break;
case 'Quarterly':
$date2 = date('Y-m-d', strtotime('+3 months', strtotime($value->invoice_date)));
$date2 = date_create($value->invoice_date);
$difference = date_diff($date1, $date2);
break;
case 'Monthly':
$date2 = date('Y-m-d', strtotime('+1 month', strtotime($value->invoice_date)));
$date2 = date_create($date2);
$difference = date_diff($date1, $date2);
break;
default:
continue 2;
break;
}
}
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) {
$log_data = implode(', ', $renew_ready);
\Log::info('Support Fees Reminder for ' . $log_data);
$this->sendNtfy('Support Fees due for renewal ' . $log_data);
}
}
}

View File

@@ -7,10 +7,11 @@ use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;
use App\Models;
use Config;
class Controller extends BaseController{
class Controller extends BaseController
{
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
public function log_queryBAK() {
\DB::listen(function ($sql) {
\Log::info('showing query', array('sql' => $sql));
@@ -23,8 +24,7 @@ class Controller extends BaseController
\Log::info('Showing query', array('sql' => $sql));
$encoded_sql = json_encode($sql);
$this->sendNtfy("Showing Query : " . $encoded_sql);
}
);
});
}
public function sendNtfy($data){
@@ -63,6 +63,15 @@ class Controller extends BaseController
$retval = Models\UserActivity::create($activity_arr);
return true;
}
public function logUsersActivityTwo($content){
$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'));
return true;
}
public function storeLoggedUser(){
$user_id = session('current_user.id');
$logged_arr = [
@@ -83,4 +92,20 @@ class Controller extends BaseController
}
return true;
}
public function hasAnyAccess($permissions){
// dump(Config::get('permissions.' ));
$required_permission = array_sum($permissions);
#$system_permissions = Models\Permission::where('status', 'active')->get();
if (session('current_user.permissions') <> '') {
if ((int)session('current_user.permissions') & $required_permission) {
return true;
}
else{
return false;
}
}
return false;
}
}

View File

@@ -0,0 +1,159 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models;
use Session;
class DailyQuotesController extends Controller
{
public function index(){
// $quote_arr = Models\DailyQuote::orderBy('created_at', 'DESC')->paginate(5);
$search = request('keyword');
// Start the query builder
$query = Models\DailyQuote::query();
// Apply search filters if a search term is present
if ($search) {
$query->where(function ($q) use ($search) {
$q->where('quote', 'like', '%' . $search . '%')
->orWhere('author', 'like', '%' . $search . '%');
});
}
// Paginate the results
$quote_arr = $query->orderBy('created_at', 'DESC')->paginate(10); // 10 items per page
// Append the search parameter to the pagination links
// This is crucial for maintaining the search results when navigating pages
if ($search) {
$quote_arr->appends(['q' => $search]);
}
// Pass the paginated data to the view
// return view('search_results', ['users' => $users, 'search' => $search]);
$data = [
'page_title' => 'Daily Quotes',
'quote_arr' => $quote_arr,
'search' => $search
// 'current_user' => session('current_user')
];
// dump($data);
// return view('daily_quotes.index', $data);
return view('daily_quotes.index-raw', $data);
}
public function getDailyQuotesJson(Request $request)
{
#$this->log_query();
$quote_arr = \DB::table('daily_quotes')
->join('staff_members AS staffcreate', 'staffcreate.id', '=', 'daily_quotes.added_by_id')
->select('daily_quotes.id', 'daily_quotes.author', 'daily_quotes.quote_date', 'daily_quotes.quote', 'daily_quotes.status', 'staffcreate.name As addedBy')
->orderBy('daily_quotes.quote', 'ASC')
->paginate(15);
if($request->has('keyword')){
$queries = [];
$keyword = $request->keyword;
$request->session()->put('current_user.quote_keyword', $keyword);
$queries['keyword'] = $keyword;
$quote_arr = \DB::table('daily_quotes')
->join('staff_members AS staffcreate', 'staffcreate.id', '=', 'daily_quotes.added_by_id')
->select('daily_quotes.id', 'daily_quotes.author', 'daily_quotes.quote_date', 'daily_quotes.quote', 'daily_quotes.status', 'staffcreate.name As addedBy')
->whereRaw("daily_quotes.quote LIKE '%$keyword%' OR daily_quotes.status LIKE '%$keyword%' OR daily_quotes.author LIKE '%$keyword%' OR daily_quotes.quote_date LIKE '%$keyword%' OR staffcreate.name LIKE '%$keyword%'")
->orderBy('daily_quotes.quote', 'ASC')
->paginate(15)->appends($queries);
}
return response()->json($quote_arr);
}
public function create(){
$status = [
'active' => 'active',
'inactive' => 'inactive',
];
$data = [
'page_title' => 'New Daily Quote',
'status' => $status,
];
return view('daily_quotes.create', $data);
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$request->validate([
'quote' => 'required',
'author' => 'required',
'quote_date' => 'sometimes',
'status' => 'required',
]);
$check_duplicate = Models\DailyQuote::where('quote', $request->quote)->first();
if ($check_duplicate) {
return redirect()->back()->withInput()->withErrors("Daily Quote already exist!");
}
$quote_arr = $request->except('_token');
$quote_arr['added_by_id'] = session('current_user.id');
$result = Models\DailyQuote::create($quote_arr);
Session::flash('success_message', 'Daily Quote successfully added');
return redirect(url('dailyquotes'));
}
public function edit($id){
$quote = Models\DailyQuote::findOrFail($id);
$status = [
'active' => 'active',
'inactive' => 'inactive',
];
$data = [
'page_title' => 'Edit Daily Quote',
'status' => $status,
'clients' => $client_arr,
'quote' => $quote,
];
return view('quote.edit', $data);
}
public function update(Request $request, $id)
{
$request->validate([
'quote' => 'required|max:11',
'author' => 'required_if:direct_mno,YES',
'quote_date' => 'required_if:direct_mno,NO',
'status' => 'required',
'remarks' => 'sometimes',
]);
// dd($request->all());
$quote = Models\DailyQuote::findOrFail($id);
$quote->quote = $request->quote;
$quote->author = $request->author ?? '';
$quote->status = $request->status;
$quote->quote_date = $request->quote_date ?? '';
$quote->added_by_id = session('current_user.id');
$quote->save();
Session::flash('success_message', 'Daily Quote successfully Updated');
return redirect(url('dailyquotes'));
}
}

View File

@@ -5,30 +5,41 @@ namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models;
use Session;
use DB;
use Carbon\Carbon;
class DashboardController extends Controller
{
public function index(){
// dd('foo bar');
$currentdate = date('m-d');
$total_clients = Models\Client::count();
$ussd_clients = Models\Client::where('services', 'LIKE', '%ussd%')->orwhere('services', 'LIKE', '%A2P%')->count();
$airtime_clients = Models\Client::where('services', 'LIKE', '%airtime%')->count();
// dd($airtime_clients);
$sms_clients = Models\Client::where('services', 'LIKE', '%sms%')->count();
$voice_clients = Models\Client::where('services', 'LIKE', '%ivr%')->count();
$expiring_contracts = Models\Client::where('contract_auto_renew', '<>', 'YES')->where('contract_validity', '<>', null)->orwhere('contract_validity', '<>', '')->orderBy('contract_validity', 'ASC')->take(5)->get();
$user_activities = Models\UserActivity::where('user_id', '>', '1')->with('userInfo')->orderBy('created_at', 'DESC')->take(5)->get();
$recent_clients = Models\Client::with('auth_user_info')->orderBy('created_at', 'DESC')->take(5)->get();
$recent_clients = Models\Client::with('auth_user_info')->orderBy('id', 'DESC')->take(5)->get();
// $upcoming_birthdays = Models\StaffMember::whereDate('dob', '>=', $currentdate)->orderBy('dob', 'ASC')->take(5)->get();
$upcoming_birthdays = Models\StaffMember::whereRaw("(month(dob) >= month(curdate())) AND day(dob) >= day(curdate())")->orderBy('dob', 'ASC')->take(5)->get();
$upcoming_hodidays = Models\NationalHoliday::whereRaw("(month(event_date) >= month(curdate()))")->whereRaw("(year(event_date) >= year(curdate()))")->whereRaw("(date(event_date) >= curdate())")->orderBy('event_date', 'ASC')->take(15)->get();
$main_quote = Models\DailyQuote::where('status', 'active')->first();
$data = [
'page_title' => 'Dashboard',
'sms' => $sms_clients,
'ussd' => $ussd_clients,
'voice' => $voice_clients,
'airtime' => $airtime_clients,
'total' => $total_clients,
'main_quote' => $main_quote,
'recent_clients' => $recent_clients,
'user_activities' => $user_activities,
'expiring_contracts' => $expiring_contracts
'expiring_contracts' => $expiring_contracts,
'upcoming_birthdays' => $upcoming_birthdays,
'upcoming_hodidays' => $upcoming_hodidays
];
// dd($data);
return view('dashboard.index_two', $data);
}
@@ -47,4 +58,70 @@ class DashboardController extends Controller
return response()->json($event_arr);
}
public function getQuotes(){
// put numbers against the quotes
// $daily_quotes = Models\Client::where('services', 'LIKE', '%ivr%')->count();
$daily_quotes = DB::table('daily_quotes')
->where('id', '>=', DB::raw('(SELECT FLOOR(RAND() * (SELECT MAX(id) FROM daily_quotes)))'))
->first();
return response()->json($daily_quotes);
}
public function getMnosContracts(){
$threeMonthsLater = Carbon::now()->addMonths(3)->format('m-d');
$threeMonthsEarlier = Carbon::now()->addMonths(3)->format('m-d');
$currentMonth = Carbon::now()->format('m');
$today = Carbon::now()->format('m-d');
$expiring_three_months = Models\NetworkOps::where('contract_auto_renew', 'NO')->whereRaw("DATE_FORMAT(contract_validity, '%m-%d') = ?", [$threeMonthsLater])->get();
#$network_arr = Models\NetworkOps::where('contract_auto_renew', 'NO')->whereRaw("DATE_FORMAT(contract_validity, '%m-%d') = ?", [$threeMonthsEarlier])->get();
$expired_in_current_month = Models\NetworkOps::whereRaw("DATE_FORMAT(contract_validity, '%m-%d') < ?", [$today])->get();
$expired_overall = Models\NetworkOps::whereDate('contract_validity', '<', Carbon::now())->get();
// $network_arr = Models\NetworkOps::with('account_manager_info')
// ->where('contract_auto_renew', 'NO')
// ->get();
$expiring_current_month = Models\NetworkOps::whereMonth('contract_validity', $currentMonth)->get();
$data = [
'expiring_three_months' => $expiring_three_months->count(),
'expired_overall' => $expired_overall->count(),
'expiring_current_month' => $expiring_current_month->count()
];
return response()->json($data);
}
public function getClientContracts(){
$threeMonthsLater = Carbon::now()->addMonths(3)->format('m-d');
$threeMonthsEarlier = Carbon::now()->addMonths(3)->format('m-d');
$currentMonth = Carbon::now()->format('m');
$today = Carbon::now()->format('m-d');
$expiring_three_months = Models\Client::where('contract_auto_renew', 'NO')->whereRaw("DATE_FORMAT(contract_validity, '%m-%d') = ?", [$threeMonthsLater])->get();
#$network_arr = Models\NetworkOps::where('contract_auto_renew', 'NO')->whereRaw("DATE_FORMAT(contract_validity, '%m-%d') = ?", [$threeMonthsEarlier])->get();
$expired_in_current_month = Models\Client::whereRaw("DATE_FORMAT(contract_validity, '%m-%d') < ?", [$today])->get();
$expired_overall = Models\Client::whereDate('contract_validity', '<', Carbon::now())->get();
// $network_arr = Models\NetworkOps::with('account_manager_info')
// ->where('contract_auto_renew', 'NO')
// ->get();
$expiring_current_month = Models\Client::whereMonth('contract_validity', $currentMonth)->get();
$data = [
'expiring_three_months' => $expiring_three_months->count(),
'expired_overall' => $expired_overall->count(),
'expiring_current_month' => $expiring_current_month->count()
];
return response()->json($data);
}
}

View File

@@ -0,0 +1,58 @@
<?php
namespace App\Http\Controllers;
use Webklex\PHPIMAP\ClientManager;
use Webklex\PHPIMAP\Exceptions\ConnectionFailedException;
use App\Libs\ImapService;
use Illuminate\Http\JsonResponse;
class EmailController extends Controller
{
public function indexInbox(ImapService $imap): JsonResponse{
try {
$emails = $imap->getLatestEmails(10);
return response()->json($emails);
// Or for view: return view('emails.index', compact('emails'));
} catch (\Exception $e) {
return response()->json(['error' => $e->getMessage()], 500);
}
}
public function index()
{
try {
// Initialize IMAP client
$client = app(ClientManager::class)->account('default');
$client->connect();
// Get INBOX folder
$folder = $client->getFolder('INBOX');
// Fetch last 10 emails (newest first)
$messages = $folder->messages()->unseen()->limit(10)->get();
// Prepare data for view
$emails = $messages->map(function ($message) {
return [
'subject' => $message->getSubject() ?? '(No Subject)',
'sender' => $message->getFrom()[0]->mail ?? 'Unknown',
'email_date' => $message->getDate()->toDateTimeString(),
'email_body' => substr(strip_tags($message->getTextBody()), 0, 200) . '...',
];
});
// Disconnect
$client->disconnect();
dd($emails);
// Return view or JSON
// return view('emails.index', compact('emails'));
// Or for API: return response()->json($emails);
} catch (ConnectionFailedException $e) {
return response()->json(['error' => 'Failed to connect: ' . $e->getMessage()], 500);
} catch (\Exception $e) {
return response()->json(['error' => 'Error: ' . $e->getMessage()], 500);
}
}
}

View File

@@ -31,6 +31,7 @@ class GeneralDocumentsController extends Controller
$category_names = [
'api' => 'API Documents',
'airtime' => 'Click Airtime',
'presentations' => 'Presentations',
'rates' => 'SMS/Voice Rates',
'scfees' => 'Short Code Fees',
@@ -107,6 +108,7 @@ class GeneralDocumentsController extends Controller
$categories = [
'sidwl' => 'Sender ID Whitelisting Letter',
'api' => 'API Docs',
'airtime' => 'Click Airtime',
'rates' => 'Rates',
'scfees' => 'Short Code Fees',
'presentations' => 'presentations',
@@ -133,14 +135,14 @@ class GeneralDocumentsController extends Controller
if ($request->has('document_one') && $request->has('document_one_name') && $request->has('document_one_category')) {
if ($request->file('document_one')->isValid()) {
//dd($request->all());
$filename = "erp_" . time() . str_random(6) . "." . $request->document_one->extension();
$filename = "erp_" . time() . str_random(4) . "." . $request->document_one->extension();
$request->document_one->storeAs('general_files', $filename, 'public');
$document_arr['filename'] = $filename;
$document_arr['category'] = $request->document_one_category;
#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();
@@ -151,14 +153,14 @@ class GeneralDocumentsController extends Controller
}
if ($request->has('document_two') && $request->has('document_two_name') && $request->has('document_two_category')) {
if ($request->file('document_two')->isValid()) {
$filename = "erp_" . time() . str_random(6) . "." . $request->document_two->extension();
$filename = "erp_" . time() . str_random(4) . "." . $request->document_two->extension();
$request->document_two->storeAs('general_files', $filename, 'public');
$document_arr['filename'] = $filename;
$document_arr['category'] = $request->document_two_category;
#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();
@@ -169,14 +171,14 @@ class GeneralDocumentsController extends Controller
}
if ($request->has('document_three') && $request->has('document_three_name') && $request->has('document_three_category')) {
if ($request->file('document_three')->isValid()) {
$filename = "erp_" . time() . str_random(6) . "." . $request->document_three->extension();
$filename = "erp_" . time() . str_random(4) . "." . $request->document_three->extension();
$request->document_three->storeAs('general_files', $filename, 'public');
$document_arr['filename'] = $filename;
$document_arr['category'] = $request->document_three_category;
#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();

View File

@@ -0,0 +1,104 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models;
use Session;
use Illuminate\Support\Arr;
use App\Jobs\SendHolidayEmailAlerts;
use App\Http\Requests;
use Carbon\Carbon;
class HolidaysController extends Controller{
public function getHolidayDetails(){
$upcoming_hodidays = Models\NationalHoliday::whereRaw("(month(event_date) >= month(curdate()))")->whereRaw("(year(event_date) >= year(curdate()))")->orderBy('event_date', 'ASC')->take(15)->get();
if ($upcoming_hodidays->isEmpty() == false) {
dispatch(new SendHolidayEmailAlerts($upcoming_hodidays->toArray()));
}
}
public function index(){
// Using pagination is generally better than get() for lists
$holidays = Models\NationalHoliday::orderBy('event_date', 'asc')->paginate(15);
dd($holidays);
return view('holidays.index', compact('holidays'));
}
/**
* Show the form for creating a new holiday.
*/
public function create(){
return view('holidays.create');
}
/**
* Store a newly created holiday in the database.
*/
public function store(Request $request)
{
$validatedData = $request->validate([
'name' => 'required|string|max:191',
'country' => 'required|string|max:191',
'event_date' => 'required|date',
]);
Models\NationalHoliday::create($validatedData);
return redirect()->route('holidays.index')
->with('success', 'Holiday created successfully.');
}
/**
* Display the specified holiday.
*/
public function show($id)
{
$holiday = Models\NationalHoliday::findOrFail($id);
return view('holidays.show', compact('holiday'));
}
/**
* Show the form for editing the specified holiday.
*/
public function edit($id)
{
$holiday = Models\NationalHoliday::findOrFail($id);
return view('holidays.edit', compact('holiday'));
}
/**
* Update the specified holiday in the database.
*/
public function update(Request $request, $id)
{
$validatedData = $request->validate([
'name' => 'required|string|max:191',
'country' => 'required|string|max:191',
'event_date' => 'required|date',
]);
$holiday = Models\NationalHoliday::findOrFail($id);
$holiday->update($validatedData);
return redirect()->route('holidays.index')
->with('success', 'Holiday updated successfully.');
}
/**
* Remove the specified holiday from the database.
*/
public function destroy($id)
{
$holiday = Models\NationalHoliday::findOrFail($id);
$holiday->delete();
return redirect()->route('holidays.index')
->with('success', 'Holiday deleted successfully.');
}
}

View File

@@ -0,0 +1,10 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class LeaveManagementController extends Controller
{
//
}

View File

@@ -4,6 +4,12 @@ namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models;
use Spatie\Activitylog\Models\Activity;
use Illuminate\Support\Str;
use App\Jobs\SendOtpEmailAlert;
use Illuminate\Support\Facades\Hash;
use Session;
class LoginController extends Controller
{
@@ -14,8 +20,119 @@ class LoginController extends Controller
];
return view('login.index', $data);
}
public function passwordResetPage(){
$data = [
'page_title' => "Password Reset"
];
return view('login.reset_form', $data);
}
public function passwordResetLink(Request $request){
$request->validate([
'email' => 'required',
]);
// dd($request->email);
$logged_in = Models\StaffMember::where('email', $request->email)->first();
public function handleLogin(Request $request){
if($logged_in == false ){
return redirect()->back()->withErrors(array("Email not found. Check and try again!"));
}
$request->session()->regenerate(true);
$request->session()->put('current_reset_user.id', $logged_in->id);
$request->session()->put('current_reset_user.email', $logged_in->email);
// $data = [
// 'page_title' => "Password Reset",
// 'user_id' => base64_encode($logged_in->id)
// ];
return redirect('reset_form_show');
}
public function passwordResetFormShow(){
$data = [
'page_title' => "Password Reset"
];
return view('login.reset_submit', $data);
}
public function passwordReset(Request $request){
$request->validate([
'password' => 'required|confirmed|min:6',
]);
if($request->password == 'password' ){
return redirect()->back()->withErrors(array("It is extremely dangerous to use password as your password."));
}
$user_id = session('current_reset_user.id');
$user_email = session('current_reset_user.email');
$staff = Models\StaffMember::where('email', $user_email)->first();
$staff->password = Hash::make($request->password);
$staff->save();
$data = [
'page_title' => "Password Reset"
];
$content = $user_email . " Successfully changed their password";
$this->logUsersActivity($type = 'staff', $content, $user_id);
$this->deleteLoggedUser();
$this->storeLoggedUser();
Session::flash('success_message', 'Password successfully reset');
return redirect('login');
#return view('login.index', $data);
}
public function passwordResetHandle(Request $request){
$request->validate([
'email' => 'required',
'password' => 'required',
'confirm_password' => 'required',
]);
dd($request->all());
$data = [
'page_title' => "Password Reset"
];
return view('login.index', $data);
}
public function resendOtp(){
if(!request()->session()->has('current_otpuser')){
return redirect(url('login'))->withErrors("No session found. You need to be logged in!");
}
$otp_code = Str::random(6);
request()->session()->put('current_otpuser.otp', $otp_code);
$otp_user = session('current_otpuser');
$otp_set = [
'otp' => $otp_code,
'email' => $otp_user['email'],
'auth_name' => $otp_user['name']
];
dispatch(new SendOtpEmailAlert($otp_set));
\Log::info($otp_code);
$data = [
'otp_user_id' => $otp_user['id'],
'page_title' => 'Login OTP',
'auth_name' => $otp_user['name']
];
return view('login.otp', $data);
}
public function showOtpPage(){
if(!request()->session()->has('current_otpuser')){
$random = uniqid();
return redirect(url('login'))->withErrors("$random | You need to be logged in ");
}
$otp_user = session('current_otpuser');
// dump(session('current_otpuser.otp'));
\Log::info(session('current_otpuser.otp'));
$data = [
'otp_user_id' => $otp_user['id'],
'page_title' => 'Login OTP',
'auth_name' => $otp_user['name']
];
return view('login.otp', $data);
}
public function handleLoginOtp(Request $request){
$this->validate($request, ['email' => 'required', 'password' => 'required']);
//system user : $table = "auth_users";
$logged_in = Models\SystemUser::with('designation_info')->where('email', $request->email)->where('password', md5($request->password))->first();
@@ -23,22 +140,84 @@ class LoginController extends Controller
if(empty($logged_in)){
return redirect("/")->withErrors(array("Incorrect Email/Password. Check and try again!"))->withInput();
}
if ($logged_in->is_password_changed == 'NO') {
$hashedPassword = Hash::make($request->password);
$staff_member = Models\StaffMember::where('email', $logged_in->email)->first();
if ($staff_member) {
$staff_member->password = $hashedPassword;
$staff_member->permissions = $logged_in->permissions;
$staff_member->designation = $logged_in->designation;
$staff_member->save();
$logged_in->is_password_changed = 'YES';
$logged_in->save();
}
}
$otp_code = Str::random(6);
$request->session()->regenerate(true);
$request->session()->put('current_user.id', $logged_in->id);
$request->session()->put('current_user.name', $logged_in->name);
$request->session()->put('current_user.email', $logged_in->email);
$request->session()->put('current_user.phone', $logged_in->phone);
$request->session()->put('current_user.designation', $logged_in->designation_info->name);
$request->session()->put('current_otpuser.id', $logged_in->id);
$request->session()->put('current_otpuser.otp', $otp_code);
$request->session()->put('current_otpuser.name', $logged_in->name);
$request->session()->put('current_otpuser.email', $logged_in->email);
$request->session()->put('current_otpuser.phone', $logged_in->phone);
$request->session()->put('current_otpuser.datetime_sent', date('Y-m-d H:i:s'));
$request->session()->put('current_otpuser.permissions', $logged_in->permissions);
$request->session()->put('current_otpuser.designation', $logged_in->designation_info->name);
\Log::info($logged_in->name . ' Successfully logged in at : ' . date('Y-m-d H:i:s'));
$content = $logged_in->name . " Successfully Logged In";
$otp_set = ['otp' => $otp_code, 'email' => $logged_in->email, 'auth_name' => $logged_in->name];
dispatch(new SendOtpEmailAlert($otp_set));
return redirect(url('showotp'));
}
public function handleLogin(Request $request){
// dump($request->all());
$this->validate($request, ['otp' => 'required', 'otp_user_id' => 'required']);
//system user : $table = "auth_users";
$current_date = date('Y-m-d H:i:s');
$otp_user = session('current_otpuser');
$this->logUsersActivity($type = 'staff', $content, $logged_in->id);
$date1 = new \DateTime($otp_user['datetime_sent']);
$date2 = new \DateTime($current_date);
$interval = $date1->diff($date2);
$minutes = ($interval->h * 60) + $interval->i;
// dd($minutes);
if($minutes > 2 ){
return redirect("showotp")->withErrors(array("OTP Time Out. Resend and try again!"));
}
$otp_user = session('current_otpuser');
if(strtoupper($otp_user['otp']) !== strtoupper($request->otp)){
return redirect("showotp")->withErrors(array("Incorrect OTP. Check and try again!"))->withInput();
}
#$logged_in = Models\SystemUser::with('designation_info')->where('email', $request->email)->where('password', md5($request->password))->first();
/*
if(empty($logged_in)){
return redirect("/")->withErrors(array("Incorrect Email/Password. Check and try again!"))->withInput();
}
*/
$request->session()->regenerate(true);
$request->session()->put('current_user.id', $otp_user['id']);
$request->session()->put('current_user.name', $otp_user['name']);
$request->session()->put('current_user.email', $otp_user['email']);
$request->session()->put('current_user.phone', $otp_user['phone']);
$request->session()->put('current_user.permissions', $otp_user['permissions']);
$request->session()->put('current_user.designation', $otp_user['designation']);
\Log::info($otp_user['name']. ' Successfully logged in at : ' . date('Y-m-d H:i:s'));
$content = $otp_user['name'] . " Successfully Logged In";
// dd($content);
#activity()->log($otp_user['name']. ' Successfully logged in at : ' . date('Y-m-d H:i:s'));
$this->logUsersActivity($type = 'staff', $content, $otp_user['id']);
$this->deleteLoggedUser();
$this->storeLoggedUser();
switch ($logged_in->designation_info->name) {
return redirect(url('/'));
/*
switch ($otp_user['designation_info']) {
case 'Administrator':
return redirect(url('finance')); // change it to a combined dashboard
break;
@@ -50,6 +229,7 @@ class LoginController extends Controller
return redirect(url('/'));
break;
}
*/
}
public function handle_logout(Request $request) {
@@ -62,6 +242,7 @@ class LoginController extends Controller
$request->session()->flush();
$request->session()->regenerate(true);
#activity()->log($username . " Logged Out : " . date('Y-m-d H:i:s'));
$this->logUsersActivity($type = 'staff', $content, $user_id);
return redirect("/");

View File

@@ -9,6 +9,7 @@ use Illuminate\Support\Arr;
// use App\Http\Requests;
use App\Http\Requests;
use App\Jobs\NewMnoNotesEmailAlerts;
use App\Libs\PaperLessNgx;
// use Illuminate\Http\Request as Requests;
@@ -20,8 +21,7 @@ class NetworkOperatorsController extends Controller
*
* @return \Illuminate\Http\Response
*/
public function indexBAK()
{
public function indexBAK(){
$network_operators = new Models\NetworkOps;
$table_columns = \DB::select(\DB::raw("show full columns from network_operators"));
$exclude_arr = [
@@ -69,8 +69,8 @@ class NetworkOperatorsController extends Controller
public function getMnosJson(Request $request){
//$this->log_query();
$mno_arr = \DB::table('network_operators')
->join('staff_members AS staffam', 'staffam.id', '=', 'network_operators.account_manager_id')
->join('staff_members AS staffmodify', 'staffmodify.id', '=', 'network_operators.last_modified_by')
->join('auth_users AS staffam', 'staffam.id', '=', 'network_operators.account_manager_id')
->join('auth_users AS staffmodify', 'staffmodify.id', '=', 'network_operators.last_modified_by')
->select('network_operators.id', 'staffam.name AS accountManager', 'network_operators.name AS networkName', 'network_operators.country','network_operators.contract_validity', 'network_operators.connection_status', 'staffmodify.name AS modifiedBy')
->orderBy('network_operators.name', 'ASC')
->paginate(15);
@@ -78,8 +78,8 @@ class NetworkOperatorsController extends Controller
if($request->has('keyword')){
$keyword = $request->keyword;
$mno_arr = \DB::table('network_operators')
->join('staff_members AS staffam', 'staffam.id', '=', 'network_operators.account_manager_id')
->join('staff_members AS staffmodify', 'staffmodify.id', '=', 'network_operators.last_modified_by')
->join('auth_users AS staffam', 'staffam.id', '=', 'network_operators.account_manager_id')
->join('auth_users AS staffmodify', 'staffmodify.id', '=', 'network_operators.last_modified_by')
->select('network_operators.id', 'staffam.name AS accountManager', 'network_operators.name AS networkName', 'network_operators.country','network_operators.contract_validity', 'network_operators.connection_status', 'staffmodify.name AS modifiedBy')
->whereRaw("network_operators.name LIKE '%$keyword%' OR network_operators.connection_status LIKE '%$keyword%' OR network_operators.country LIKE '%$keyword%' OR staffam.name LIKE '%$keyword%' ")
->orderBy('network_operators.name', 'ASC')
@@ -87,6 +87,17 @@ class NetworkOperatorsController extends Controller
}
return response()->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.
@@ -98,14 +109,16 @@ class NetworkOperatorsController extends Controller
$account_manager = Models\SystemUser::pluck('name', 'id');
$services = Models\Service::pluck('name', 'name');
$status = ['Active' => 'Active', 'Inactive' => 'Inactive', 'Pending' => 'Pending'];
$direct_arr = ['Direct' => 'Direct', 'Non Direct' => 'Non Direct'];
// dd('foo bar');
$data = [
'page_title' => 'Create Network Operator',
'countries'=> $countries,
'account_manager' => $account_manager,
'services' => $services,
'status' => $status
'status' => $status,
'direct_arr' => $direct_arr
];
return view('network_ops.create', $data);
}
@@ -118,12 +131,14 @@ class NetworkOperatorsController extends Controller
public function store(Request $request){
$request->validate([
'name' => 'required',
'direct_status' => 'required',
'country' => 'required',
'account_manager_id' => 'required',
'services' => 'required',
'contact_person' => 'required',
'email' => 'required',
'phone' => 'required'
'account_manager_id' => 'required_if:direct_status,Direct',
'services' => 'required_if:direct_status,Direct',
'contact_person' => 'required_if:direct_status,Direct',
'email' => 'required_if:direct_status,Direct',
'phone' => 'required_if:direct_status,Direct',
'status' => 'required'
]);
$operator_arr = [
@@ -139,6 +154,9 @@ class NetworkOperatorsController extends Controller
if ($request->has('services')) {
$operator_arr['services'] = json_encode($request->services);
}
if ($request->account_manager_id == false) {
$operator_arr['account_manager_id'] = session('current_user.id');
}
if ($request->has('phone')) {
$operator_arr['phone'] = $request->phone;
}
@@ -151,7 +169,7 @@ class NetworkOperatorsController extends Controller
if ($request->has('contact_person')) {
$operator_arr['contact_person'] = $request->contact_person;
}
// dd($operator_arr);
$saved = Models\NetworkOps::create($operator_arr);
Session::flash('success_message', 'Network Operator successfully added');
return redirect(url('mnos'));
@@ -335,6 +353,7 @@ class NetworkOperatorsController extends Controller
$status_bg = "danger";
}
$rate_types = ['flat_rate' => 'Flat Rate', 'sliding' => 'Sliding Scale'];
$contract_types = ['Bilateral' => 'Bilateral', 'Unilateral' => 'Unilateral'];
$data = [
'page_title' => 'Edit Network Operator',
'network_arr' => $network_arr,
@@ -357,7 +376,8 @@ class NetworkOperatorsController extends Controller
'ip_addresses' => $ip_addresses,
'notes_arr' => $notes_arr,
'recent_payments' => $recent_payments,
'service_type_names' => $service_type_names
'service_type_names' => $service_type_names,
'contract_types' => $contract_types
];
return view('network_ops.edit', $data);
}
@@ -371,14 +391,24 @@ class NetworkOperatorsController extends Controller
*/
public function update(Requests\UpdateMnoRequest $request, $id)
{
if ($request->has('document_one') && isset($request->document_one_name) == false) {
return redirect()->back()->withErrors(array("You need to add a name for the document to be uploaded !"))->withInput();
}
if ($request->has('document_two') && isset($request->document_two_name) == false) {
return redirect()->back()->withErrors(array("You need to add a name for the document to be uploaded !"))->withInput();
}
$operator_update = Models\NetworkOps::find($id);
$paperless = new PaperLessNgx();
if ($request->has('document_one') && $request->has('document_one_name')) {
if ($request->file('document_one')->isValid()) {
$filename = "erp_" . time() . str_random(6) . "." . $request->document_one->extension();
$filename = "erp_" . time() . str_random(4) . "." . $request->document_one->extension();
$request->document_one->storeAs('mno_files', $filename, 'public');
$document_arr['file_path'] = $filename;
$operator_update->name = $request->name;
$store_location = "mno_files";
#$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();
$document_arr['name'] = $request->document_one_name;
@@ -394,6 +424,9 @@ class NetworkOperatorsController extends Controller
$document_arr['file_path'] = $filename;
$operator_update->name = $request->name;
$store_location = "mno_files";
#$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();
$document_arr['name'] = $request->document_two_name;
@@ -409,6 +442,10 @@ class NetworkOperatorsController extends Controller
$document_arr['file_path'] = $filename;
// $operator_update->name = $request->name;
$store_location = "mno_files";
#$top = $paperless->processPaperlessFile("sliding_rate", 'rates', $filename, $store_location);
$document_arr['file_extension'] = $request->sliding_rate_file->extension();
$document_arr['file_reff'] = time() . uniqid();
$document_arr['name'] = "Sliding Scale Rate File";
@@ -462,6 +499,7 @@ class NetworkOperatorsController extends Controller
'mno_id' => 'required',
'ip_address' => 'required|ipv4',
'service' => 'required',
'system_id' => 'sometimes',
'port' => 'sometimes|numeric',
'status' => 'required'
]);
@@ -471,6 +509,7 @@ class NetworkOperatorsController extends Controller
'ip_address' => $request->ip_address,
'mno_id' => $request->mno_id,
'service' => $request->service,
'system_id' => ($request->system_id) ? $request->system_id : "",
'port' => $request->port,
'status' => $request->status,
'created_by' => $auth_user['id'],

View File

@@ -18,6 +18,7 @@ class OfficeLocationsController extends Controller
'offices_arr' => $offices_arr,
'current_user' => session('current_user')
];
// dd($data);
// dd($offices_arr->isEmpty());
return view('officelocations.index', $data);
}
@@ -35,7 +36,7 @@ class OfficeLocationsController extends Controller
$id = $request->branch_id;
$document_arr = \DB::table('branch_files')
->join('auth_users', 'auth_users.id', '=', 'branch_files.uploaded_by')
->select('branch_files.id', 'branch_files.name','branch_files.file_reff', 'auth_users.name AS UploadedBy', 'branch_files.created_at')
->select('branch_files.id', 'branch_files.name', 'branch_files.validity_period','branch_files.file_reff', 'auth_users.name AS UploadedBy', 'branch_files.created_at')
->orderBy('branch_files.name', 'ASC')
->where('branch_files.branch_id', $id)
->paginate(15);
@@ -44,7 +45,7 @@ class OfficeLocationsController extends Controller
$keyword = $request->keyword;
$document_arr = \DB::table('branch_files')
->join('auth_users', 'auth_users.id', '=', 'branch_files.uploaded_by')
->select('branch_files.id', 'branch_files.name','branch_files.file_reff', 'auth_users.name AS UploadedBy', 'branch_files.created_at')
->select('branch_files.id', 'branch_files.name', 'branch_files.validity_period', 'branch_files.file_reff', 'auth_users.name AS UploadedBy', 'branch_files.created_at')
->orderBy('branch_files.name', 'ASC')
->where('branch_files.branch_id', $id)
->whereRaw("branch_files.name LIKE '%$keyword%' OR branch_files.description LIKE '%$keyword%' OR branch_files.filename LIKE '%$keyword%' OR auth_users.name LIKE '%$keyword%'")
@@ -55,7 +56,7 @@ class OfficeLocationsController extends Controller
public function create()
{
$countries = Models\Country::pluck('en_short_name','en_short_name');
$staffmembers = Models\StaffMember::pluck('name', 'id');
$staffmembers = Models\SystemUser::pluck('name', 'id'); //system users
$data = [
'page_title' => 'Add Office Location',
'countries' => $countries,
@@ -70,6 +71,7 @@ class OfficeLocationsController extends Controller
'page_title' => 'Upload Document',
'branch_id' => $id
];
// dd($data);
return view('officelocations.filescreate', $data);
}
/**
@@ -84,7 +86,6 @@ class OfficeLocationsController extends Controller
'street_name' => 'sometimes',
'physical_address' => 'required',
'postal_address' => 'required',
'block_number' => 'sometimes',
'city_town' => 'required',
'country' => 'required|unique:office_locations,country',
'country_manager_id' => 'required',
@@ -101,6 +102,7 @@ class OfficeLocationsController extends Controller
$office_arr['user_id'] = session('current_user.id');
$office_arr['flag_url'] = $flag_url;
$office_arr['city'] = $request->city_town;
$result = Models\OfficeLocation::create($office_arr);
Session::flash('success_message', 'Office Location successfully added');
return redirect(url('officelocations'));
@@ -132,13 +134,13 @@ class OfficeLocationsController extends Controller
'country_manager_id' => 'required',
'office_phone' => 'required'
]);
// dd($request->all());
$office = Models\OfficeLocation::findOrFail($id);
$office->street_name = $request->street_name ?? "";
$office->physical_address = $request->physical_address;
$office->postal_address = $request->postal_address;
$office->block_number = $request->block_number;
$office->city = $request->city_town;
$office->country = $request->country;
$office->country_manager_id = $request->country_manager_id;
$office->office_phone = $request->office_phone;
@@ -162,6 +164,7 @@ class OfficeLocationsController extends Controller
$document_arr['file_extension'] = $request->document_one->extension();
$document_arr['file_reff'] = time() . uniqid();
$document_arr['name'] = $request->document_one_name;
$document_arr['validity_period'] = $request->validity_period_one;
$document_arr['uploaded_by'] = session('current_user.id');
$result = Models\BranchFile::create($document_arr);
}
@@ -177,6 +180,7 @@ class OfficeLocationsController extends Controller
$document_arr['file_extension'] = $request->document_two->extension();
$document_arr['file_reff'] = time() . uniqid();
$document_arr['name'] = $request->document_two_name;
$document_arr['validity_period'] = $request->validity_period_two;
$document_arr['uploaded_by'] = session('current_user.id');
$result = Models\BranchFile::create($document_arr);
}
@@ -192,6 +196,7 @@ class OfficeLocationsController extends Controller
$document_arr['file_extension'] = $request->document_three->extension();
$document_arr['file_reff'] = time() . uniqid();
$document_arr['name'] = $request->document_three_name;
$document_arr['validity_period'] = $request->validity_period_third;
$document_arr['uploaded_by'] = session('current_user.id');
$result = Models\BranchFile::create($document_arr);
}
@@ -204,10 +209,12 @@ class OfficeLocationsController extends Controller
$request->validate([
'document_one_name' => 'required',
'id' => 'required',
'validity_period_one' => 'sometimes',
'document_one' => 'max:10240|mimes:png,jpg,jpeg,bmp,pdf,doc,docx,xlx,xlsx,pptx,ppt',
]);
$document = Models\BranchFile::findOrFail($request->id);
$document->name = $request->document_one_name;
$document->validity_period = $request->validity_period_one;
if ($request->has('document_one')) {
if ($request->file('document_one')->isValid()) {
$filename = "erp_" . time() . str_random(6) . "." . $request->document_one->extension();

View File

@@ -0,0 +1,10 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class RemindersController extends Controller
{
//
}

View File

@@ -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',
@@ -26,6 +56,7 @@ class ReportsController extends Controller
}
public function getRecentClientsJson(){
// $period = $request->period;
// $clients = Models\Client::where()->get();
/*
$clients = \DB::table('clients')
@@ -42,4 +73,133 @@ 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(50);
}
return response()->json($user_activities);
}
public function getMnosContracts(){
#$user_activities = Models\UserActivity::where('user_id', '>', '1')->with('userInfo')->orderBy('created_at', 'DESC')->take(5)->get();
$data = [
'page_title' => 'Expired MNO Contracts',
'current_user' => session('current_user')
];
return view('reports.mno-expired-contracts', $data);
}
public function getMnosContractsJson(Request $request){
$today = Carbon::now()->format('m-d');
$expired_contracts = \DB::table('network_operators')
->join('auth_users', 'auth_users.id', '=', 'network_operators.account_manager_id')
->select('network_operators.id','auth_users.name AS accountManager', 'network_operators.name','network_operators.contact_person', 'network_operators.contact_person_email', 'network_operators.country', 'network_operators.contract_validity', 'network_operators.created_at')
->whereRaw("DATE_FORMAT(contract_validity, '%m-%d') < ?", [$today])
->orderBy('network_operators.name', 'DESC')
->get();
if($request->has('keyword')){
$keyword = $request->keyword;
$expired_contracts = \DB::table('network_operators')
->join('auth_users', 'auth_users.id', '=', 'network_operators.account_manager_id')
->select('network_operators.id','auth_users.name AS accountManager', 'network_operators.name','network_operators.contact_person', 'network_operators.contact_person_email', 'network_operators.country', 'network_operators.contract_validity', 'network_operators.created_at')
->whereRaw("DATE_FORMAT(contract_validity, '%m-%d') < ?", [$today])
->whereRaw("network_operators.name like '%$keyword%' or network_operators.contact_person like '%$keyword%' OR network_operators.created_at like '%$keyword%' OR network_operators.contract_validity like '%$keyword%' OR network_operators.contact_person_email like '%$keyword%'")
->orderBy('network_operators.name', 'DESC')
->get();
}
return response()->json($expired_contracts);
}
public function getClientContracts(){
#$user_activities = Models\UserActivity::where('user_id', '>', '1')->with('userInfo')->orderBy('created_at', 'DESC')->take(5)->get();
$data = [
'page_title' => 'Expirted Client Contracts',
'current_user' => session('current_user')
];
return view('reports.clients-expired-contracts', $data);
}
public function getClientContractsJson(Request $request){
$today = Carbon::now()->format('m-d');
$expired_contracts = \DB::table('clients')
->join('auth_users', 'auth_users.id', '=', 'clients.auth_user_id')
->select('clients.id','auth_users.name AS accountManager', 'clients.name','clients.contact_person', 'clients.email', 'clients.country', 'clients.contract_validity', 'clients.created_at')
->whereRaw("DATE_FORMAT(contract_validity, '%m-%d') < ?", [$today])
->orderBy('clients.name', 'DESC')
->get();
if($request->has('keyword')){
$keyword = $request->keyword;
$expired_contracts = \DB::table('clients')
->join('auth_users', 'auth_users.id', '=', 'clients.auth_user_id')
->select('clients.id','auth_users.name AS accountManager', 'clients.name','clients.contact_person', 'clients.email', 'clients.country', 'clients.contract_validity', 'clients.created_at')
->whereRaw("DATE_FORMAT(contract_validity, '%m-%d') < ?", [$today])
->whereRaw("clients.name like '%$keyword%' or clients.contact_person like '%$keyword%' OR clients.created_at like '%$keyword%' OR clients.contract_validity like '%$keyword%' OR clients.contact_person_email like '%$keyword%'")
->orderBy('clients.name', 'DESC')
->get();
}
return response()->json($expired_contracts);
}
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]);
}
}

View File

@@ -5,6 +5,9 @@ namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models;
use Session;
use Excel;
use App\Imports\SenderidImport;
use Illuminate\Support\Facades\File;
class SenderIdController extends Controller
{
@@ -19,29 +22,103 @@ class SenderIdController extends Controller
];
return view('senderid.index', $data);
}
public function getSenderIdsJson(Request $request)
public function getSenderIdsJsonBak(Request $request)
{
#$this->log_query();
$senderid_arr = \DB::table('sender_ids')
->join('staff_members AS staffcreate', 'staffcreate.id', '=', 'sender_ids.created_by')
->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')
// ->join('network_operators', 'network_operators.id', '=', 'sender_ids.network_id')
// ->join('clients', 'clients.id', '=', 'sender_ids.client_id')
->select('sender_ids.id', 'mno_name', 'supplier_name', 'sender_ids.senderid', 'sender_ids.status', 'sender_ids.remarks', 'staffcreate.name As createdBy','sender_ids.direct_mno', 'staffmodify.name AS modifiedBy')
->orderBy('sender_ids.senderid', 'ASC')
->paginate(15);
if($request->has('keyword')){
$queries = [];
$keyword = $request->keyword;
$request->session()->put('current_user.senderid_keyword', $keyword);
$queries['keyword'] = $keyword;
$senderid_arr = \DB::table('sender_ids')
->join('staff_members AS staffcreate', 'staffcreate.id', '=', 'sender_ids.created_by')
->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%'")
// ->join('network_operators', 'network_operators.id', '=', 'sender_ids.network_id')
// ->join('clients', 'clients.id', '=', 'sender_ids.client_id')
->select('sender_ids.id', 'mno_name', 'supplier_name', 'sender_ids.senderid', 'sender_ids.status', '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 mno_name LIKE '%$keyword%' OR supplier_name LIKE '%$keyword%' OR staffcreate.name LIKE '%$keyword%' OR staffmodify.name LIKE '%$keyword%' OR sender_ids.direct_mno LIKE '%$keyword%'")
->orderBy('sender_ids.senderid', 'ASC')
->paginate(15);
->paginate(15)->appends($queries);
}
return response()->json($senderid_arr);
}
function getSenderIdsJson(Request $request){
$query = \DB::table('sender_ids')
->join('staff_members AS staffcreate', 'staffcreate.id', '=', 'sender_ids.created_by')
->join('staff_members AS staffmodify', 'staffmodify.id', '=', 'sender_ids.last_modified_by')
->select(
'sender_ids.id',
'mno_name',
'supplier_name',
'sender_ids.senderid',
'sender_ids.status',
'sender_ids.remarks',
'staffcreate.name AS createdBy',
'sender_ids.direct_mno',
'staffmodify.name AS modifiedBy'
);
// 2. Handle Tabulator's Column Header Filters
if ($request->has('filter')) {
$filters = $request->input('filter');
// Map the Tabulator JS fields to the actual database table columns
$columnMap = [
'createdBy' => 'staffcreate.name',
'modifiedBy' => 'staffmodify.name',
'mno_name' => 'mno_name', // Add table prefixes here if needed
'supplier_name' => 'supplier_name'
];
foreach ($filters as $filter) {
$field = $filter['field'];
$value = $filter['value'];
// Determine the correct DB column. Default to sender_ids table to avoid 'ambiguous column' errors
$dbColumn = $columnMap[$field] ?? 'sender_ids.' . $field;
// Securely bind the value using Laravel's active record (prevents SQL injection)
$query->where($dbColumn, 'LIKE', '%' . $value . '%');
}
}
// 3. Handle your existing Global Keyword Search (if you still have a global search box)
if ($request->has('keyword')) {
$keyword = $request->input('keyword');
$request->session()->put('current_user.senderid_keyword', $keyword);
// Group the OR conditions in a closure so they don't break the Tabulator filters above
$query->where(function($q) use ($keyword) {
$q->where('sender_ids.senderid', 'LIKE', "%{$keyword}%")
->orWhere('sender_ids.status', 'LIKE', "%{$keyword}%")
->orWhere('mno_name', 'LIKE', "%{$keyword}%")
->orWhere('supplier_name', 'LIKE', "%{$keyword}%")
->orWhere('staffcreate.name', 'LIKE', "%{$keyword}%")
->orWhere('staffmodify.name', 'LIKE', "%{$keyword}%")
->orWhere('sender_ids.direct_mno', 'LIKE', "%{$keyword}%");
});
}
// 4. Order and fetch the final Paginated results
$query->orderBy('sender_ids.senderid', 'ASC');
// Grab Tabulator's requested page size, default to 15
$perPage = $request->input('size', 15);
$senderid_arr = $query->paginate($perPage);
// If using the global keyword, append it to the pagination links
if ($request->has('keyword')) {
$senderid_arr->appends(['keyword' => $request->keyword]);
}
return response()->json($senderid_arr);
}
@@ -49,26 +126,46 @@ class SenderIdController extends Controller
{
#$network_arr = Models\NetworkOps::pluck('name','country');
$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');
$networks = \DB::table('network_operators')->Select(\DB::raw('concat(name, " (", country, ")") AS networkvalue, concat(name, " (", country, ")") AS network'))->orderBy('network')->get()->toArray();
$network_arr = array_pluck($networks, 'network', 'networkvalue');
$direct_mno_arr = ['YES' => 'YES', 'NO' => 'NO'];
// dd($network_arr);
#$network_arr = array_combine($network_arr, $network_arr);
$clients = Models\Client::pluck('name', 'id');
// $clients = Models\Client::pluck('name', 'name');
$clients = \DB::table('clients')->Select(\DB::raw('concat(name, " (", country, ")") AS clientvalue, concat(name, " (", country, ")") AS client'))->orderBy('client')->get()->toArray();
$client_arr = array_pluck($clients, 'client', 'clientvalue');
$staffmembers = Models\StaffMember::pluck('name', 'id');
$status = ['Pending' => 'Pending', 'Inactive' => 'Inactive', 'Approved' => 'Approved'];
#$status = ['Pending' => 'Pending', 'Inactive' => 'Inactive', 'Approved' => 'Approved'];
#$status = ['Applied to MNO', 'Applied to Aggregator', 'Approved on MNO', 'Approved on Aggregator', 'Active', 'InActive'];
$status = [
'Applied to MNO' => 'Applied to MNO',
'Applied to Aggregator' => 'Applied to Aggregator',
'Approved on MNO' => 'Approved on MNO',
'Approved on Aggregator' => 'Approved on Aggregator',
'Active' => 'Active',
'Inactive' => 'InActive'
];
$data = [
'page_title' => 'Create Sender ID',
'network_arr' => $network_arr,
'status' => $status,
'clients' => $clients,
'clients' => $client_arr,
'direct_mno_arr' => $direct_mno_arr,
'staffmembers' => $staffmembers
];
// dd($data);
return view('senderid.create', $data);
}
public function showuploadform(){
$data = [
'page_title' => 'Upload Sender IDs',
];
return view('senderid.uploadbulk', $data);
}
/**
* Store a newly created resource in storage.
*
@@ -76,6 +173,276 @@ class SenderIdController extends Controller
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$request->validate([
'senderid' => 'required|max:11',
'mno_name' => 'required_if:direct_mno,YES',
'supplier_name' => 'required_if:direct_mno,NO',
'status' => 'required',
'remarks' => 'sometimes',
]);
// dump($request->all());
/*
$check_duplicate = Models\SenderId::where('senderid', $request->senderid)
->where('mno_name', $request->mno_name)
->first();
*/
$check_duplicate = Models\SenderId::where('senderid', $request->senderid)->first();
// dd($check_duplicate);
if ($check_duplicate) {
// code...
if ($request->direct_mno == 'YES' && $check_duplicate->direct_mno == 'YES') {
if ($request->mno_name == $check_duplicate->mno_name) {
return redirect()->back()->withInput()->withErrors("Sender ID already exist for " . $request->mno_name );
}
}
if ($request->direct_mno == 'NO' && $check_duplicate->direct_mno == 'NO') {
if ($request->supplier_name == $check_duplicate->supplier_name) {
return redirect()->back()->withInput()->withErrors("Sender ID already exist for " . $request->supplier_name );
}
}
}
// dd('foo stop');
// if($check_duplicate){
// return redirect()->back()->withInput()->withErrors("Sender ID already exist for " . $request->mno_name );
// }
$senderid_arr = $request->except('_token');
$senderid_arr['created_by'] = session('current_user.id');
$senderid_arr['last_modified_by'] = session('current_user.id');
$senderid_arr['remarks'] = $request->remarks ?? '';
$senderid_arr['direct_mno'] = $request->direct_mno;
// dd($senderid_arr);
$result = Models\SenderId::create($senderid_arr);
/*
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);
$senderid_arr['network_id'] = $result->id;
}
//validate senderid with same client and same network
// $result = Models\SenderId::create($senderid_arr);
$result = Models\SenderId::updateOrCreate([
'network_id' => $senderid_arr['network_id'],
'client_id' => $senderid_arr['client_id'],
'senderid' => $senderid_arr['senderid']
], $senderid_arr);
*/
#save services this has been moved to the main client table
//$retval = $this->store_services($request->services, $result->id);
// dd('foo bar');
Session::flash('success_message', 'Sender ID successfully added');
return redirect(url('senderids'));
}
public function uploadstore(Request $request)
{
$request->validate([
'senderid_file' => 'required|max:6000|mimes:xlx,xlsx',
]);
$request->session()->put('current_user.rejected_rows_filename', '');
// dump($request->all());
$networks = \DB::table('network_operators')->Select(\DB::raw('concat(name, " (", country, ")") AS networkvalue, concat(name, " (", country, ")") AS network'))->orderBy('network')->get()->toArray();
$network_arr = array_pluck($networks, 'network', 'networkvalue');
$clients = \DB::table('clients')->Select(\DB::raw('concat(name, " (", country, ")") AS clientvalue, concat(name, " (", country, ")") AS client'))->orderBy('client')->get()->toArray();
$client_arr = array_pluck($clients, 'client', 'clientvalue');
if (!$request->hasFile('senderid_file') && !$request->senderid_file->isValid() ) {
Session::flash('error_message', 'File could not be loaded');
return redirect()->back();
}
$file = $request->senderid_file;
$filename = "erp_" . time() . str_random(6) . "." . $request->senderid_file->extension();
$request->senderid_file->storeAs('general_files', $filename, 'public');
$stored_file = public_path('documents/general_files/'.$filename);
$extracted_arr = Excel::toArray(new SenderidImport, $stored_file);
// dd($extracted_arr[0]);
$row_count = $extracted_arr[0];
$main = [];
$count = 0;
$senderid_arr = [];
$rejected_rows = [];
$rejected_rows_filename = public_path('documents/general_files/'. $filename . "_rejected_rows.txt");
foreach ($extracted_arr[0] as $key => $value) {
if ($value['senderid'] == null) {
file_put_contents($rejected_rows_filename, json_encode($value) . PHP_EOL, FILE_APPEND);
continue;
}
if ($value['direct_mno'] == "YES" && $value['mno_name'] == null) {
file_put_contents($rejected_rows_filename, json_encode($value) . PHP_EOL, FILE_APPEND);
continue;
}
if ($value['direct_mno'] == "NO" && $value['supplier_name'] == null) {
file_put_contents($rejected_rows_filename, json_encode($value) . PHP_EOL, FILE_APPEND);
continue;
}
if ($value['direct_mno'] == "YES" && in_array($value['mno_name'], $network_arr) == true) {
file_put_contents($rejected_rows_filename, json_encode($value) . PHP_EOL, FILE_APPEND);
continue;
}
if ($value['direct_mno'] == "NO" && in_array($value['supplier_name'], $client_arr) == true) {
file_put_contents($rejected_rows_filename, json_encode($value) . PHP_EOL, FILE_APPEND);
continue;
}
$check_duplicate_mno = Models\SenderId::where('senderid', $value['senderid'])
->where('mno_name', $value['mno_name'])
->first();
$check_duplicate_client = Models\SenderId::where('senderid', $value['senderid'])
->where('supplier_name', $value['supplier_name'])
->first();
if ($check_duplicate_mno && $value['direct_mno'] == "YES") {
file_put_contents($rejected_rows_filename, json_encode($value) . PHP_EOL, FILE_APPEND);
continue;
}
if ($check_duplicate_client && $value['direct_mno'] == "NO") {
file_put_contents($rejected_rows_filename, json_encode($value) . PHP_EOL, FILE_APPEND);
continue;
}
if (strtoupper($value['direct_mno']) == 'YES') {
// dd('foo bar');
$senderid_arr['senderid'] = $value['senderid'];
$senderid_arr['mno_name'] = $value['mno_name'];
$senderid_arr['status'] = $value['status'];
$senderid_arr['created_by'] = session('current_user.id');
$senderid_arr['last_modified_by'] = session('current_user.id');
$senderid_arr['remarks'] = $value['remarks'];
$senderid_arr['direct_mno'] = 'YES';
}
else{
$senderid_arr['senderid'] = $value['senderid'];
$senderid_arr['supplier_name'] = $value['supplier_name'];
$senderid_arr['status'] = $value['status'];
$senderid_arr['created_by'] = session('current_user.id');
$senderid_arr['last_modified_by'] = session('current_user.id');
$senderid_arr['remarks'] = $value['remarks'];
$senderid_arr['direct_mno'] = 'NO';
}
// dd($senderid_arr);
$result = Models\SenderId::create($senderid_arr);
// dd($retval);
}
$request->session()->put('current_user.rejected_rows_filename', $filename . "_rejected_rows.txt");
$rejected = file($rejected_rows_filename);
// dump(session('current_user.rejected_rows_filename'));
// dd('the end');
Session::flash('success_message', 'Bulk Sender ID successfully uploaded, review the report file!');
return redirect(url('senderids'));
}
public function getUploadReport($name){
$file = public_path('documents/general_files/') . $name;
$headers = ['Content-Type' => 'text/plain '];
return \Response::download($file, 'Sender ID Upload Report.xlsx', $headers);
}
public function getSampleFile(){
$file = public_path('helper_documents/senderid_sample_file.xlsx');
$headers = ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'];
return \Response::download($file, 'Sender ID Sample Upload File.xlsx', $headers);
}
public function edit($id){
$senderid = Models\SenderId::findOrFail($id);
//dd($senderid);
$networks = \DB::table('network_operators')->Select(\DB::raw('concat(name, " (", country, ")") AS networkvalue, concat(name, " (", country, ")") AS network'))->orderBy('network')->get()->toArray();
$network_arr = array_pluck($networks, 'network', 'networkvalue');
$direct_mno_arr = ['YES' => 'YES', 'NO' => 'NO'];
// dd($network_arr);
$clients = \DB::table('clients')->Select(\DB::raw('concat(name, " (", country, ")") AS clientvalue, concat(name, " (", country, ")") AS client'))->orderBy('client')->get()->toArray();
$client_arr = array_pluck($clients, 'client', 'clientvalue');
$staffmembers = Models\StaffMember::pluck('name', 'id');
// $status = ['Pending' => 'Pending', 'Inactive' => 'Inactive', 'Approved' => 'Approved'];
$status = [
'Applied to MNO' => 'Applied to MNO',
'Applied to Aggregator' => 'Applied to Aggregator',
'Approved on MNO' => 'Approved on MNO',
'Approved on Aggregator' => 'Approved on Aggregator',
'Active' => 'Active',
'Inactive' => 'InActive'
];
// $data = [
// 'page_title' => 'Create Sender ID',
// 'network_arr' => $network_arr, G*385058081508uq
// 'status' => $status,
// 'clients' => $clients,
// 'senderid' => $senderid,
// 'direct_mno_arr' => $direct_mno_arr,
// 'staffmembers' => $staffmembers
// ];
$data = [
'page_title' => 'Edit Sender ID',
'network_arr' => $network_arr,
'status' => $status,
'clients' => $client_arr,
'senderid' => $senderid,
'direct_mno_arr' => $direct_mno_arr,
'staffmembers' => $staffmembers
];
return view('senderid.edit', $data);
}
public function update(Request $request, $id)
{
$request->validate([
'senderid' => 'required|max:11',
'mno_name' => 'required_if:direct_mno,YES',
'supplier_name' => 'required_if:direct_mno,NO',
'status' => 'required',
'remarks' => 'sometimes',
]);
// dd($request->all());
$senderid = Models\SenderId::findOrFail($id);
$senderid->senderid = $request->senderid;
$senderid->mno_name = $request->mno_name ?? '';
$senderid->status = $request->status;
$senderid->supplier_name = $request->supplier_name ?? '';
$senderid->remarks = $request->remarks;
$senderid->direct_mno = $request->direct_mno;
$senderid->last_modified_by = session('current_user.id');
// 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);
// $senderid->network_id = $result->id;
// }
$senderid->save();
Session::flash('success_message', 'Sender ID successfully Updated');
return redirect(url('senderids'));
}
public function direct_store(Request $request)
{
$request->validate([
'senderid' => 'required|max:11',
@@ -92,57 +459,84 @@ class SenderIdController extends Controller
$result = Models\SenderId::create($senderid_arr);
#save services this has been moved to the main client table
//$retval = $this->store_services($request->services, $result->id);
Session::flash('success_message', 'Sender ID successfully added');
return redirect(url('senderids'));
if($result){
return response()->json([ 'code' => 1, 'result' => 'success']);
}
else {
return response()->json([ 'code' => 3, 'msg' => 'Request could not be handled at this time']);
}
}
public function edit($id){
$senderid = Models\SenderId::findOrFail($id);
//dd($senderid);
$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');
public function exportSenderIdCsv(){
$fileName = 'senderid_list.csv';
$users = Models\SenderId::all()->toArray(); // Adjust model as needed
$clients = Models\Client::pluck('name', 'id');
$staffmembers = Models\StaffMember::pluck('name', 'id');
$status = ['Pending' => 'Pending', 'Inactive' => 'Inactive', 'Approved' => 'Approved'];
$data = [
'page_title' => 'Create Sender ID',
'network_arr' => $network_arr,
'status' => $status,
'clients' => $clients,
'senderid' => $senderid,
'staffmembers' => $staffmembers
$headers = [
'Content-Type' => 'text/csv',
'Content-Disposition' => "attachment; filename=\"$fileName\"",
'Pragma' => 'no-cache',
'Cache-Control' => 'must-revalidate, post-check=0, pre-check=0',
'Expires' => '0',
];
return view('senderid.edit', $data);
$keyword = session('current_user.senderid_keyword');
// dd(request('keyword'));
// dd($keyword);
request()->session()->put('current_user.senderid_keyword', null);
// dump($keyword);
$senderid_arr = \DB::table('sender_ids')
->join('staff_members AS staffcreate', 'staffcreate.id', '=', 'sender_ids.created_by')
->join('staff_members AS staffmodify', 'staffmodify.id', '=', 'sender_ids.last_modified_by')
->select('sender_ids.id', 'mno_name', 'supplier_name', 'sender_ids.senderid', 'sender_ids.status', '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 mno_name LIKE '%$keyword%' OR supplier_name LIKE '%$keyword%' OR staffcreate.name LIKE '%$keyword%' OR staffmodify.name LIKE '%$keyword%' OR sender_ids.direct_mno LIKE '%$keyword%'")
->orderBy('sender_ids.senderid', 'ASC')
->get()->toArray();
// dd($senderid_arr);
# add headers for each column in the CSV download
array_unshift($senderid_arr, array_keys((array)$senderid_arr[0]));
$callback = function() use ($senderid_arr){
$file_handle = fopen('php://output', 'w');
foreach ($senderid_arr as $row) {
$row = (array)$row;
fputcsv($file_handle, $row);
}
public function update(Request $request, $id)
{
fclose($file_handle);
};
$request->validate([
'senderid' => 'required|max:11',
'network_id' => 'required',
'status' => 'required',
'remarks' => 'sometimes',
]);
// return Response::stream($callback, 200, $headers);
return response()->stream($callback, 200, $headers);
$senderid = Models\SenderId::findOrFail($id);
$senderid->senderid = $request->senderid;
$senderid->client_id = $request->client_id;
$senderid->status = $request->status;
$senderid->network_id = $request->network_id;
$senderid->remarks = $request->remarks;
$senderid->save();
// $callback = function() use ($senderid_arr) {
// $file = fopen('php://output', 'w');
// // Add CSV headers
// fputcsv($file, array_keys($senderid_arr[0]));
// // Add data rows
// foreach ($senderid_arr as $row) {
// fputcsv($file, $row);
// }
// fclose($file);
Session::flash('success_message', 'Sender ID successfully Updated');
return redirect(url('senderids'));
// };
// return response()->stream($callback, 200, $headers);
}
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]);
}
}

View File

@@ -0,0 +1,222 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Arr;
use App\Http\Requests;
use Carbon\Carbon;
use App\Models;
use Session;
class ShortCodesController extends Controller{
public function indexTab(){
$data = [
'page_title' => 'Short Codes',
'type' => 'SMS',
'current_user' => session('current_user')
];
return view('shortcodes.index', $data);
}
public function create(){
$country_networks = \DB::table('network_operators')->Select(\DB::raw('id, concat(name, " (", country, ")") AS network'))->orderBy('network')->pluck('network', 'network');
$client_arr = Models\Client::pluck('name', 'id');
$data = [
'page_title' => 'New Short Code',
'country_network_arr' => $country_networks,
'client_arr' => $client_arr,
'current_user' => session('current_user')
];
return view('shortcodes.create', $data);
}
public function smsindex(){
// $codes_data = Models\ClientShortCode::groupBy('code_type')->get();
$country_networks = \DB::table('network_operators')->Select(\DB::raw('id, concat(name, " (", country, ")") AS network'))->orderBy('network')->pluck('network', 'network');
$client_arr = Models\Client::orderBy('name', 'ASC')->pluck('name', 'id');
$codes_data = \DB::table('client_short_codes')
->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),
'country_network_arr' => $country_networks,
'client_arr' => $client_arr,
'current_user' => session('current_user')
];
return view('shortcodes.smsindex', $data);
}
public function getShortCodesJson(Request $request){
//$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.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.created_at', 'DESC')
->paginate(15);
if($request->has('keyword')){
$keyword = $request->keyword;
$code_type = 'sms';
$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.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.created_at', 'DESC')
->paginate(15);
}
return response()->json($shortcode_arr);
}
public function ussdindex(){
// $codes_data = Models\ClientShortCode::groupBy('code_type')->get();
$country_networks = \DB::table('network_operators')->Select(\DB::raw('id, concat(name, " (", country, ")") AS network'))->orderBy('network')->pluck('network', 'network');
$client_arr = Models\Client::orderBy('name', 'ASC')->pluck('name', 'id');
$codes_data = \DB::table('client_short_codes')
->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' => 'USSD',
'networks_raw' => array_combine($networks_raw, $networks_raw),
'codes_data' => $codes_data,
'country_network_arr' => $country_networks,
'client_arr' => $client_arr,
'current_user' => session('current_user')
];
return view('shortcodes.ussdindex', $data);
}
public function getUssdShortCodesJson(Request $request){
#$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.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.created_at', 'DESC')
->paginate(15);
if($request->has('keyword')){
$keyword = $request->keyword;
$code_type = 'ussd';
$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.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.created_at', 'DESC')
->paginate(15);
}
return response()->json($shortcode_arr);
}
public function voiceindex(){
// $codes_data = Models\ClientShortCode::groupBy('code_type')->get();
$country_networks = \DB::table('network_operators')->Select(\DB::raw('id, concat(name, " (", country, ")") AS network'))->orderBy('network')->pluck('network', 'network');
$client_arr = Models\Client::orderBy('name', 'ASC')->pluck('name', 'id');
$codes_data = \DB::table('client_short_codes')
->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' => 'Voice',
'networks_raw' => array_combine($networks_raw, $networks_raw),
'codes_data' => $codes_data,
'country_network_arr' => $country_networks,
'client_arr' => $client_arr,
'current_user' => session('current_user')
];
return view('shortcodes.voiceindex', $data);
}
public function getVoiceShortCodesJson(Request $request){
#$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.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.created_at', 'DESC')
->paginate(15);
if($request->has('keyword')){
$keyword = $request->keyword;
$code_type = 'voice';
$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.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.created_at', 'DESC')
->paginate(15);
}
return response()->json($shortcode_arr);
}
public function handle_delete($id){
$result = Models\ClientShortCode::destroy($id);
return response()->json(['code' => 1, 'msg' => $result]);
}
}

View File

@@ -9,6 +9,32 @@ 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-cards', $data);
}
public function profile($staff_member_id){
$staff_member = Models\StaffMember::find($staff_member_id);
$data = [
'page_title' => 'Staff Profile',
'staff_member' => $staff_member,
'current_user' => session('current_user')
];
return view('staff_members.profile', $data);
}
public function profile_json(){
$staff_member_id = session('current_user.id');
$staff_member = Models\StaffMember::findOrFail($staff_member_id);
return response()->json(['code' => 1, 'staff_member' => $staff_member]);
}
public function indexOld(){
$staff_members_arr = new Models\StaffMember;
$data = [
'page_title' => 'Staff Members',
@@ -16,6 +42,26 @@ class StaffMembersController extends Controller
];
return view('staff_members.index', $data);
}
public function profileupdate(Request $request)
{
$account_arr = Models\StaffMember::find($request->user_id);
$account_arr->name = $request->name;
$account_arr->email = $request->email;
$account_arr->phone = $request->phone;
$msg_text = 'Staff detials successfully Updated';
if ($request->password == true) {
$account_arr->password = md5($request->password);
$msg_text = "Staff details and password successfully updated";
}
$result = $account_arr->save();
if ($result == true) {
$data = ['code' => 1, 'msg' => $msg_text];
}
else{
$data = ['code' => 1, 'msg' => 'Staff details could not be updated at this time. Try again!'];
}
return response()->json($data);
}
public function getstaffMemberssJson(Request $request)
{
#$this->log_query();

View File

@@ -0,0 +1,273 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models;
use Session;
use Illuminate\Support\Facades\File;
class SupportTicketsController extends Controller
{
//
public function index(){
$data = [
'page_title' => 'Support Tickets Home',
'current_user' => session('current_user')
];
return view('support-ticket.landing', $data);
}
public function ticketlist(){
$data = [
'page_title' => 'Support Tickets List',
'current_user' => session('current_user')
];
return view('support-ticket.index', $data);
}
public function getSuppoerTicketJson(Request $request)
{
#$this->log_query();
$supportticket_arr = \DB::table('support_tickets')
->join('staff_members AS staffcreate', 'staffcreate.id', '=', 'support_tickets.created_by_id')
->join('staff_members AS assignedTo', 'assignedTo.id', '=', 'support_tickets.assigned_to_id')
// ->join('network_operators', 'network_operators.id', '=', 'support_tickets.network_id')
// ->join('clients', 'clients.id', '=', 'support_tickets.client_id')
->select('support_tickets.id', 'support_tickets.case_number', 'support_tickets.subject', 'support_tickets.body', 'support_tickets.created_by_id', 'support_tickets.status', 'support_tickets.created_at', 'support_tickets.assigned_to_id', 'staffcreate.name As createdBy', 'assignedTo.name AS assignedToName')
->orderBy('support_tickets.id', 'ASC')
->paginate(15);
if($request->has('keyword')){
$queries = [];
$keyword = $request->keyword;
$queries['keyword'] = $keyword;
$supportticket_arr = \DB::table('support_tickets')
->join('staff_members AS staffcreate', 'staffcreate.id', '=', 'support_tickets.created_by_id')
->join('staff_members AS assignedTo', 'assignedTo.id', '=', 'support_tickets.assigned_to_id')
->select('support_tickets.id', 'support_tickets.case_number', 'support_tickets.subject', 'support_tickets.body', 'support_tickets.created_by_id', 'support_tickets.status', 'support_tickets.created_at', 'support_tickets.assigned_to_id', 'staffcreate.name As createdBy', 'assignedTo.name AS assignedToName')
->whereRaw("support_tickets.case_number LIKE '%$keyword%' OR assignedTo.name LIKE '%$keyword%' OR support_tickets.status LIKE '%$keyword%' OR support_tickets.body LIKE '%$keyword%' OR staffcreate.name LIKE '%$keyword%' OR support_tickets.created_at LIKE '%$keyword%'")
->orderBy('support_tickets.id', 'ASC')
->paginate(15)->appends($queries);
}
return response()->json($supportticket_arr);
}
public function create()
{
#$network_arr = Models\NetworkOps::pluck('name','country');
$networks = \DB::table('network_operators')->Select(\DB::raw('concat(name, " (", country, ")") AS networkvalue, concat(name, " (", country, ")") AS network'))->orderBy('network')->get()->toArray();
$network_arr = array_pluck($networks, 'network', 'networkvalue');
$direct_mno_arr = ['YES' => 'YES', 'NO' => 'NO'];
// dd($network_arr);
#$network_arr = array_combine($network_arr, $network_arr);
// $clients = Models\Client::pluck('name', 'name');
$clients = \DB::table('clients')->Select(\DB::raw('concat(name, " (", country, ")") AS clientvalue, concat(name, " (", country, ")") AS client'))->orderBy('client')->get()->toArray();
$client_arr = array_pluck($clients, 'client', 'clientvalue');
$staffmembers = Models\StaffMember::pluck('name', 'id');
#$status = ['Pending' => 'Pending', 'Inactive' => 'Inactive', 'Approved' => 'Approved'];
#$status = ['Applied to MNO', 'Applied to Aggregator', 'Approved on MNO', 'Approved on Aggregator', 'Active', 'InActive'];
$status = [
'Applied to MNO' => 'Applied to MNO',
'Applied to Aggregator' => 'Applied to Aggregator',
'Approved on MNO' => 'Approved on MNO',
'Approved on Aggregator' => 'Approved on Aggregator',
'Active' => 'Active',
'Inactive' => 'InActive'
];
$data = [
'page_title' => 'Create Sender ID',
'network_arr' => $network_arr,
'status' => $status,
'clients' => $client_arr,
'direct_mno_arr' => $direct_mno_arr,
'staffmembers' => $staffmembers
];
// dd($data);
return view('support-ticket.create', $data);
}
public function store(Request $request)
{
$request->validate([
'subject' => 'sometimes',
'body' => 'required',
'attachment' => 'sometimes',
//max:10240|mimes:png,jpg,jpeg,bmp,pdf,doc,docx,xlx,xlsx,pptx,ppt
]);
// dd($request->all());
//Generate case number here
$case_number = "ERP-" . date('Y-m-d-') . time();
$ticket_arr = $request->except('_token');
$ticket_arr['case_number'] = $case_number;
$ticket_arr['assigned_to_id'] = 1; // change this
$ticket_arr['created_by_id'] = session('current_user.id'); // change this
$result = Models\SupportTicket::create($ticket_arr);
if ($request->attachment !== null) {
if ($request->file('attachment')->isValid()) {
//dd($request->all());
$filename = "erp_" . time() . str_random(4) . "." . $request->attachment->extension();
$request->attachment->storeAs('supportticket_files', $filename, 'public');
$document_arr['filename'] = $filename;
$document_arr['file_extension'] = $request->document_one->extension();
$document_arr['file_reff'] = time() . uniqid();
$document_arr['case_number'] = $case_number;
$document_arr['uploaded_by'] = session('current_user.id');
$result = Models\SupportTicketsDocument::create($document_arr);
}
}
Session::flash('success_message', 'Support Ticket successfully created');
return redirect(url('supporttickets/list'));
}
public function edit($id){
$support_ticket = Models\SupportTicket::findOrFail($id);
$data = [
'page_title' => 'Edit Support',
'support_ticket' => $support_ticket,
];
return view('support-ticket.edit', $data);
}
public function update(Request $request, $id)
{
$request->validate([
'subject' => 'sometimes',
'body' => 'required',
'attachment' => 'sometimes',
]);
$support_ticket = Models\SupportTicket::findOrFail($id);
$support_ticket->body = $request->body;
$support_ticket->body = $request->subject;
$support_ticket->save();
Session::flash('success_message', 'Support Ticket successfully Updated');
return redirect(url('supporttickets/list'));
}
public function fileStore(Requests\BranchFilesRequest $request)
{
if ($request->has('document_one') && $request->has('document_one_name')) {
if ($request->file('document_one')->isValid()) {
$filename = "erp_" . time() . str_random(6) . "." . $request->document_one->extension();
$request->document_one->storeAs('branch_files', $filename, 'public');
$document_arr['filename'] = $filename;
$document_arr['branch_id'] = $request->branch_id;
$document_arr['file_path'] = $filename;
$document_arr['file_extension'] = $request->document_one->extension();
$document_arr['file_reff'] = time() . uniqid();
$document_arr['name'] = $request->document_one_name;
$document_arr['validity_period'] = $request->validity_period_one;
$document_arr['uploaded_by'] = session('current_user.id');
$result = Models\BranchFile::create($document_arr);
}
}
if ($request->has('document_two') && $request->has('document_two_name')) {
if ($request->file('document_two')->isValid()) {
$filename = "erp_" . time() . str_random(6) . "." . $request->document_two->extension();
$request->document_two->storeAs('branch_files', $filename, 'public');
$document_arr['filename'] = $filename;
$document_arr['branch_id'] = $request->branch_id;
$document_arr['file_path'] = $filename;
$document_arr['file_extension'] = $request->document_two->extension();
$document_arr['file_reff'] = time() . uniqid();
$document_arr['name'] = $request->document_two_name;
$document_arr['validity_period'] = $request->validity_period_two;
$document_arr['uploaded_by'] = session('current_user.id');
$result = Models\BranchFile::create($document_arr);
}
}
if ($request->has('document_three') && $request->has('document_three_name')) {
if ($request->file('document_three')->isValid()) {
$filename = "erp_" . time() . str_random(6) . "." . $request->document_three->extension();
$request->document_three->storeAs('branch_files', $filename, 'public');
$document_arr['filename'] = $filename;
$document_arr['branch_id'] = $request->branch_id;
$document_arr['file_path'] = $filename;
$document_arr['file_extension'] = $request->document_three->extension();
$document_arr['file_reff'] = time() . uniqid();
$document_arr['name'] = $request->document_three_name;
$document_arr['validity_period'] = $request->validity_period_third;
$document_arr['uploaded_by'] = session('current_user.id');
$result = Models\BranchFile::create($document_arr);
}
}
Session::flash('success_message', 'Document(s) successfully uploaded');
return redirect(url('supporttickets/list'));
}
public function filesUpdate(Request $request)
{
$request->validate([
'document_one_name' => 'required',
'id' => 'required',
'validity_period_one' => 'sometimes',
'document_one' => 'max:10240|mimes:png,jpg,jpeg,bmp,pdf,doc,docx,xlx,xlsx,pptx,ppt',
]);
$document = Models\BranchFile::findOrFail($request->id);
$document->name = $request->document_one_name;
$document->validity_period = $request->validity_period_one;
if ($request->has('document_one')) {
if ($request->file('document_one')->isValid()) {
$filename = "erp_" . time() . str_random(6) . "." . $request->document_one->extension();
$request->document_one->storeAs('branch_files', $filename, 'public');
$document->file_path = $filename;
$document->file_extension = $request->document_one->extension();
$document->file_reff = time() . uniqid();
//$document->name = $request->document_one_name;
$document->uploaded_by = session('current_user.id');
}
}
$result = $document->save();
Session::flash('success_message', 'Document(s) successfully updated');
return redirect(url('supporttickets/list'));
}
public function show_edit_files_form($id){
$document = Models\BranchFile::findOrFail($id);
$data = [
'page_title' => 'Update Document',
'document' => $document
];
return view('supporttickets.filesedit', $data);
}
public function getDocument($id)
{
$branch_file = Models\BranchFile::with('branch_info')->findOrFail($id);
$file = public_path('documents/branch_files/') . $branch_file->file_path;
$headers = []; //['Content-Type: application/pdf'];
$filename = $branch_file->branch_info->name . "_" . $branch_file->name;
$filename = $this->cleanStr($filename);
$filename = $filename . "." . $branch_file->file_extension;
// $filename = str_replace(' ', '_', $filename);
return \Response::download($file, $filename, $headers);
}
public function cleanStr($string){
// Replaces all spaces with hyphens.
$string = str_replace(' ', '-', $string);
// Removes special chars.
$string = preg_replace('/[^A-Za-z0-9\-]/', '', $string);
// Replaces multiple hyphens with single one.
$string = preg_replace('/-+/', '_', $string);
return $string;
}
}

View File

@@ -0,0 +1,145 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models;
use Session;
class SystemCredentialsController extends Controller{
public function index(){
$data = [
'page_title' => 'Credentials',
];
return view('sys_credentials.index', $data);
}
public function getCredListJson(Request $request){
//$this->log_query();
$credentials_arr = \DB::table('sys_credentials')
->join('auth_users AS userModify', 'userModify.id', '=', 'sys_credentials.last_modified_by_id')
->join('auth_users AS userCreate', 'userCreate.id', '=', 'sys_credentials.created_by_id')
->join('clients', 'clients.id', '=', 'sys_credentials.client_id')
->join('network_operators', 'network_operators.id', '=', 'sys_credentials.network_operator_id')
->select('sys_credentials.id', 'clients.name AS clientName', 'network_operators.name AS networkOpsName', 'sys_credentials.service', 'userCreate.name AS created_by_user', 'userModify.name AS modified_by_user', 'sys_credentials.client_id','sys_credentials.network_operator_id', 'sys_credentials.url_endpoint', 'sys_credentials.credentials', 'sys_credentials.expiry_date', 'sys_credentials.remarks', 'sys_credentials.created_at', 'sys_credentials.updated_at')
->orderBy('sys_credentials.service', 'ASC')
->paginate(20);
if($request->has('keyword')){
$keyword = $request->keyword;
$credentials_arr = \DB::table('sys_credentials')
->join('auth_users AS userModify', 'userModify.id', '=', 'sys_credentials.last_modified_by_id')
->join('auth_users AS userCreate', 'userCreate.id', '=', 'sys_credentials.created_by_id')
->join('clients', 'clients.id', '=', 'sys_credentials.client_id')
->join('network_operators', 'network_operators.id', '=', 'sys_credentials.network_operator_id')
->select('sys_credentials.id', 'clients.name AS clientName', 'network_operators.name AS networkOpsName', 'sys_credentials.service', 'userCreate.name AS created_by_user', 'userModify.name AS modified_by_user', 'sys_credentials.client_id','sys_credentials.network_operator_id', 'sys_credentials.url_endpoint', 'sys_credentials.credentials', 'sys_credentials.expiry_date', 'sys_credentials.remarks', 'sys_credentials.created_at', 'sys_credentials.updated_at')
->whereRaw("sys_credentials.service LIKE '%$keyword%' OR userCreate.name LIKE '%$keyword%' OR sys_credentials.url_endpoint LIKE '%$keyword%' OR sys_credentials.expiry_date LIKE '%$keyword%' OR userModify.name LIKE '%$keyword%' OR sys_credentials.created_at LIKE '%$keyword%' OR sys_credentials.remarks LIKE '%$keyword%' OR sys_credentials.updated_at LIKE '%$keyword%' OR network_operators.name LIKE '%$keyword%'")
->orderBy('sys_credentials.service', 'ASC')
->paginate(15);
}
return response()->json($credentials_arr);
}
public function create(){
$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');
$services = Models\Service::pluck('name', 'name');
$clients = Models\Client::pluck('name', 'id');
$auth_users = Models\SystemUser::pluck('name', 'id');
$data = [
'page_title' => 'System Credentialss',
'clients' => $clients,
'network_arr' => $network_arr,
'services' => $services,
'auth_users' => $auth_users
];
return view('sys_credentials.create', $data);
}
public function store(Request $request){
$request->validate([
'service' => 'required',
'client_id' => 'required',
'network_operator_id' => 'required',
'url_endpoint' => 'required',
'credentials' => 'required',
'expiry_date' => 'required',
'remarks' => 'sometimes',
]);
// dump($request->all());
$credentials_arr = $request->except('_token');
$credentials_arr['last_modified_by_id'] = session('current_user.id');
$credentials_arr['created_by_id'] = session('current_user.id');
// dd($credentials_arr);
// TODO: add user activity here
$result = Models\SystemCredential::create($credentials_arr);
Session::flash('success_message', 'Credentials successfully added');
return redirect(url('systemcreds'));
}
public function edit($id){
$credential = Models\SystemCredential::find($id);
$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');
$clients = Models\Client::pluck('name', 'id');
$auth_users = Models\SystemUser::pluck('name', 'id');
$data = [
'page_title' => 'System Credentials',
'credential' => $credential,
'clients' => $clients,
'network_arr' => $network_arr,
'auth_users' => $auth_users
];
return view('sys_credentials.edit', $data);
}
public function update(Request $request, $id){
$request->validate([
'friendly_name' => 'required',
'server_id' => 'required',
'public_ip_address' => 'sometimes|ip',
'private_ip_address' => 'sometimes|nullable|ip',
'main_use' => 'required',
'remarks' => 'nullable',
'status' => 'required',
'server_number' => 'required',
]);
$server = Models\ClickServer::findOrFail($id);
$server_arr = $request->except('_token', 'server_id', 'server_number');
$server_arr['last_modified_by_id'] = session('current_user.id');
$server_arr['server_id'] = $request->server_number;
$result = $server->update($server_arr);
Session::flash('success_message', 'Server Details successfully updated');
return redirect(url('infrastructure/server-list'));
}
public function reveal_password($id){
$server = Models\ClickServer::find($id);
if ($server) {
$response_arr = [
'code' => 1,
'password' => decrypt($server->root_password)
];
}
else{
$response_arr = [
'code' => 3,
'msg' => 'not found'
];
}
return response()->json($response_arr);
}
}

View File

@@ -53,6 +53,12 @@ class SystemUsersController extends Controller
return view('systemusers.index', $data);
}
public function profile_json(){
$staff_member_id = session('current_user.id');
$staff_member = Models\SystemUser::findOrFail($staff_member_id);
return response()->json(['code' => 1, 'staff_member' => $staff_member]);
}
/**
* Show the form for creating a new resource.
@@ -156,6 +162,25 @@ class SystemUsersController extends Controller
Session::flash('success_message', 'Account successfully Updated');
return redirect(url('systemusers'));
}
public function profileupdate(Request $request){
$account_arr = Models\SystemUser::find($request->user_id);
$account_arr->name = $request->name;
$account_arr->email = $request->email;
$account_arr->phone = $request->phone;
$msg_text = 'Account successfully Updated';
if ($request->password == true) {
$account_arr->password = md5($request->password);
$msg_text = "Account details and password successfully updated";
}
$result = $account_arr->save();
if ($result == true) {
$data = ['code' => 1, 'msg' => $msg_text];
}
else{
$data = ['code' => 1, 'msg' => 'Account could not be updated at this time. Try again!'];
}
return response()->json($data);
}
/**
* Remove the specified resource from storage.

View File

@@ -5,16 +5,44 @@ namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models;
// use Illuminate\Contracts\Mail\Mailer;
use Spatie\Activitylog\Models\Activity;
use Illuminate\Contracts\Mail\Mailer;
use App\Jobs\SendTestEmail;
use App\Notifications\EmailNotification;
class UtilityController extends Controller
{
public function underconstruction(){
return view('utility.underconstruction');
}
public function migrateSenderids(){
$senderid = Models\Senderidold::with('network_info', 'client_info')->where('direct_mno', 'YES')->get();
// dd($senderid);
$counter = 0;
foreach ($senderid as $row) {
// dd($row);
$senderid_arr['senderid'] = $row->senderid;
$senderid_arr['created_by'] = $row->created_by;
$senderid_arr['last_modified_by'] = $row->last_modified_by;
$senderid_arr['remarks'] = $row->remarks;
$senderid_arr['mno_name'] = $row->network_info->name . ' (' . $row->network_info->country .')';
$senderid_arr['status'] = $row->status;
$senderid_arr['direct_mno'] = $row->direct_mno;
$senderid_arr['created_at'] = $row->created_at;
$senderid_arr['modified_at'] = $row->modified_at;
$result = Models\SenderId::create($senderid_arr);
// dump($result);
$counter++;
}
return ['gip' => 'string', 'counter' => $counter];
}
public function EmailTest(Mailer $mailer)
{
dispatch(new SendTestEmail());
/*
$emails = ['kwesi@click-mobile.com', 'kwesi_banson@hotmail.com'];
$data = [
@@ -27,9 +55,27 @@ class UtilityController extends Controller
$message->from('erp@click-mobile.com', 'Click Mobile ERP');
$message->to($emails)->subject('New Notes');
});
}
public function maptest(){
*/
/*
$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.
*
* @return Illuminate\View\View
*/
public function maptest(){
return view('utility.map');
}
@@ -111,5 +157,108 @@ class UtilityController extends Controller
}
dump($count_cl);
}
function loggingTest(){
$rando = uniqid();
$newsItem = Models\Utility::create([
'name' => 'original name : ' . $rando,
'type' => 'Lorum'
]);
$activity = Activity::all()->last();
dump($activity->description); //returns 'created'
dump($activity->subject); //returns the instance of NewsItem that was created
dump($activity->changes); //returns ['attributes' => ['name' => 'original name', 'text' => 'Lorum']];
//
$rando = uniqid();
$newsItem->name = 'updated name to something like this ' . $rando;
$newsItem->type = 'franko';
$newsItem->save();
//updating the newsItem will cause an activity being logged
$activity_up = Activity::all()->last();
dump($activity_up);
dump($activity_up->description); //returns 'updated'
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);
}
public function sendEmailNotification(Request $request){
$user = Models\StaffMember::find(1);
// Create a new instance of your notification
$notification = new EmailNotification('This is a test notification.', 'https://example.com');
// Send the notification
$user->notify($notification);
}
}
// https://www.tokyvideo.com/video/sheena-the-queen-of-the-jungle-1984-movie-with-tanya-roberts-ted-wass-donovan-scott

View File

@@ -0,0 +1,156 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models;
use Session;
class VpnController extends Controller{
public function indexBK(){
$result = Models\VpnConfig::where('partner_type', 'mno')->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);
}
}

View File

@@ -17,9 +17,13 @@ class CheckCurrentlyLoggedInUsers
{
if($request->session()->has('current_user')){
$id = session('current_user.id');
$device = $request->server('HTTP_USER_AGENT');
$realm = $id . $device;
$current_user = Models\LoggedUser::where('user_id', $id)->where('device', $device)->first();
if($current_user == null){
return $next($request);
}
$current_user->last_seen_time = date('Y-m-d H:i:s');
$current_user->ip_address = \Request::ip();
@@ -28,3 +32,6 @@ class CheckCurrentlyLoggedInUsers
return $next($request);
}
}

View File

@@ -41,9 +41,13 @@ class UpdateMnoRequest extends FormRequest
'contact_person_phone' => 'required',
'contract_auto_renew' => 'required',
'contract_validity' => 'required',
'document_one' => 'max:20480|mimes:png,jpg,jpeg,bmp,pdf,doc,docx,xlx,xlsx',
'document_two' => 'max:20480|mimes:png,jpg,jpeg,bmp,pdf,doc,docx,xlx,xlsx',
'sliding_rate_file' => 'max:10240|mimes:png,jpg,jpeg,bmp,pdf,doc,docx,xlx,xlsx',
// 'document_one_name' => 'required_with:document_one.*',
// 'document_two_name' => 'required_with:document_two.*',
];
}

View File

@@ -0,0 +1,27 @@
<?php
namespace App\Imports;
use Illuminate\Support\Collection;
use Maatwebsite\Excel\Concerns\ToCollection;
use Maatwebsite\Excel\Concerns\WithHeadingRow;
class SenderidImport implements ToCollection, WithHeadingRow
{
/**
* @param Collection $collection
*/
public function collection(Collection $collection)
{
foreach ($collection as $row) {
dd($row);
return [
"senderid" => $row['senderid'],
"direct_mno" => $row['direct_mno'],
"mno_name" => $row['mno_name'],
"status" => $row['status'],
"remarks" => $row['remarks']
];
}
}
}

View File

@@ -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');
});
}

View File

@@ -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');
});
}

View File

@@ -0,0 +1,48 @@
<?php
namespace App\Jobs;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Contracts\Mail\Mailer;
use Illuminate\Support\Facades\Log;
class SendHolidayEmailAlerts implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
protected $holiday_arr;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct($holiday_arr)
{
$this->holiday_arr = $holiday_arr;
}
/**
* Execute the job.
*
* @return void
*/
public function handle(Mailer $mailer)
{
Log::info("Holidays in mailer job started.");
$holiday_arr = $this->holiday_arr;
$emails = [
'clicmobile@click-mobile.com',
];
$data = [
'holiday_arr' => $holiday_arr
];
$mailer->send('emails.holidays', $data, function ($message) use ($data, $emails) {
$message->from('alerts@click-mobile.com', 'Click Mobile ERP Team');
$message->to($emails)->subject('Upcoming Holidays');
});
Log::info("Holiday emails dispatched successfully.");
}
}

View File

@@ -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');
});
}

View File

@@ -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');
});
}

View File

@@ -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');
});

View File

@@ -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');
});
}

View File

@@ -0,0 +1,47 @@
<?php
namespace App\Jobs;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Contracts\Mail\Mailer;
class SendOtpEmailAlert implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
protected $otp_set;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct($otp_set)
{
$this->otp_set = $otp_set;
}
/**
* Execute the job.
*
* @return void
*/
public function handle(Mailer $mailer)
{
$otp_set = $this->otp_set;
$emails = [
$otp_set['email']
];
$data = [
'otp' => $otp_set['otp'],
'auth_name' => $otp_set['auth_name']
];
$mailer->send('emails.otp', $data, function ($message) use ($data, $emails) {
$message->from('alerts@click-mobile.com', 'Click Mobile ERP');
$message->to($emails)->subject('Login OTP');
});
}
}

View File

@@ -0,0 +1,59 @@
<?php
namespace App\Jobs;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Contracts\Mail\Mailer;
class SendShortCodeListToFinance implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
protected $short_code_list;
protected $message_body;
protected $finance_arr;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct($short_code_list, $message_body, $finance_arr)
{
$this->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');
});
}
}

View File

@@ -0,0 +1,52 @@
<?php
namespace App\Jobs;
use App\Models;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Contracts\Mail\Mailer;
class SendSupportFeesReminderEmailAlert implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
protected $renewalSet;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct($renewalSet)
{
$this->renewalSet = $renewalSet;
}
/**
* Execute the job.
*
* @return void
*/
public function handle(Mailer $mailer){
$renewalSet = $this->renewalSet;
$emails = ['samuel@click-mobile.com'];
$emails = ['kwesi@click-mobile.com'];
$emails = ['effie@click-mobile.com'];
$emails = ['priscilla@click-mobile.com'];
$emails = ['jim@click-mobile.com'];
$emails = ['daniel@click-mobile.com'];
$emails = ['mansa@click-mobile.com'];
$emails[] = $renewalSet['account_manager_email'];
$data = [
'client_name' => $renewalSet['client_name'],
'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('alerts@click-mobile.com', 'Click Mobile ERP');
$message->to($emails)->subject('Support Fees Reminder');
});
}
}

View File

@@ -0,0 +1,45 @@
<?php
namespace App\Jobs;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Contracts\Mail\Mailer;
class SendTestEmail implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Execute the job.
*
* @return void
*/
public function handle(Mailer $mailer)
{
$emails = [
'kwesi@click-mobile.com',
'kwesi_banson@hotmail.com',
'mansa@click-mobile.com',
'diana@click-mobile.com'
];
$data = [];
$mailer->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');
});
}
}

View File

@@ -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');
});

57
app/Libs/ImapService.php Normal file
View File

@@ -0,0 +1,57 @@
<?php
namespace App\Libs;
class ImapService
{
protected $connection;
public function __construct()
{
/*
$hostname = '{imap.gmail.com:993/imap/ssl/novalidate-cert}INBOX';
$username = "kwesibanson@gmail.com"; // env('IMAP_USERNAME', 'your.email@gmail.com');
$password = "yutbgxtlqwwepalr"; //env('IMAP_PASSWORD', 'your-app-password');
*/
$hostname = '{imap-mail.outlook.com:993/imap/ssl/novalidate-cert}INBOX';
$username = "kwesi_banson@hotmail.com"; // env('IMAP_USERNAME', 'your.email@gmail.com');
$password = "uyligiqtreyubvvp"; //"okxixwlqppkpfepy"; //env('IMAP_PASSWORD', 'your-app-password');
$this->connection = @imap_open($hostname, $username, $password);
if (!$this->connection) {
throw new \Exception('Cannot connect: ' . imap_last_error());
}
}
public function getLatestEmails($limit = 10): array
{
$emails = imap_search($this->connection, 'ALL', SE_UID);
if (!$emails) {
return [];
}
rsort($emails); // Newest first
$result = [];
foreach (array_slice($emails, 0, $limit) as $uid) {
$header = imap_headerinfo($this->connection, imap_msgno($this->connection, $uid), FT_UID);
$body = imap_fetchbody($this->connection, imap_msgno($this->connection, $uid), 1, FT_UID);
$body = quoted_printable_decode($body);
$result[] = [
'subject' => isset($header->subject) ? imap_utf8($header->subject) : '(No Subject)',
'from' => $header->from[0]->mailbox . '@' . $header->from[0]->host,
'date' => $header->date ?? 'Unknown',
'body' => substr(strip_tags($body), 0, 200) . '...',
];
}
return $result;
}
public function __destruct()
{
if ($this->connection) {
imap_close($this->connection);
}
}
}

View File

@@ -112,10 +112,13 @@ class PaperLessNgx {
# set parameters and push to paperless
$tags_correspondent = $this->getDocumentCorrespondent($category);
if ($store_location == "general_files") {
$file_path = "documents/general_files/" . $filename; //"documents/oasl.pdf";
$file_path = "documents/general_files/" . $filename;
}
else if ($store_location == "mno_files") {
$file_path = "documents/mno_files/" . $filename;
}
else{
$file_path = "documents/client_files/" . $filename; //"documents/oasl.pdf";
$file_path = "documents/client_files/" . $filename;
}
$tags_arr[] = $tags_correspondent['tags']; //[1,2];

View File

@@ -4,11 +4,29 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use App\Models;
#use Spatie\Activitylog\Traits\LogsActivity;
//use Spatie\Activitylog\Traits\CausesActivity;
#use Spatie\Activitylog\LogOptions;
class Client extends Model
{
#use LogsActivity;
protected $guarded = array('id');
public $table = "clients";
protected $appends = ['client_services'];
/*
protected static $logName = 'clients_log';
protected static $logOnlyDirty = true;
protected static $dontSubmitEmptyLogs = true;
protected static $logUnguarded = true;
public function getActivitylogOptions(): LogOptions{
return LogOptions::defaults()
->logUnguarded()->useLogName('client')->logOnlyDirty()->dontSubmitEmptyLogs();
}
*/
/*
public function getprogressIndicatorsAttribute($value){

View File

@@ -3,10 +3,17 @@
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Spatie\Activitylog\Traits\LogsActivity;
use Spatie\Activitylog\LogOptions;
class ClientNote extends Model
{
protected $guarded = array('id');
protected static $logUnguarded = true;
// public function getActivitylogOptions(): LogOptions{
// return LogOptions::defaults()->logUnguarded();
// }
public function client_info(){
return $this->hasOne('App\Models\Client', 'id', 'client_id');

View File

@@ -14,6 +14,6 @@ class ClientSupportFees extends Model
}
public function created_by_info(){
// return $this->hasOne('App\Models\Account', 'id', 'auth_user_id');
return $this->hasOne('App\Models\SystemUser', 'id', 'auth_user_id');
return $this->hasOne('App\Models\SystemUser', 'id', 'user_id');
}
}

10
app/Models/DailyQuote.php Normal file
View File

@@ -0,0 +1,10 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class DailyQuote extends Model
{
protected $guarded = array('id');
}

11
app/Models/Holiday.php Normal file
View File

@@ -0,0 +1,11 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Holiday extends Model
{
protected $guarded = array('id');
public $table = "holidays";
}

View File

@@ -0,0 +1,11 @@
<?php
namespace App\models;
use Illuminate\Database\Eloquent\Model;
class IncomingEmail extends Model
{
protected $guarded = array('id');
public $table = "incoming_emails";
}

View File

@@ -0,0 +1,12 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class LeaveManagement extends Model
{
protected $guarded = array('id');
public $table = "leave_management";
}

View File

@@ -11,6 +11,6 @@ class LoggedUser extends Model
public function auth_user_info(){
return $this->hasOne('App\Models\Account', 'id', 'user_id');
return $this->hasOne('App\Models\SystemUser', 'id', 'user_id');
}
}

View File

@@ -0,0 +1,17 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class NationalHoliday extends Model
{
protected $guarded = array('id');
public $table = "national_holidays";
// public function branch_info(){
// return $this->hasOne('App\Models\OfficeLocation', 'id', 'branch_id');
// }
}
?>

View File

@@ -9,9 +9,10 @@ class OfficeLocation extends Model
protected $guarded = array('id');
public function created_by_info(){
return $this->hasOne('App\Models\StaffMember', 'id', 'user_id');
return $this->hasOne('App\Models\SystemUser', 'id', 'user_id');
}
public function country_manager_info(){
return $this->hasOne('App\Models\StaffMember', 'id', 'country_manager_id');
// return $this->hasOne('App\Models\StaffMember', 'id', 'country_manager_id');
return $this->hasOne('App\Models\SystemUser', 'id', 'country_manager_id');
}
}

11
app/Models/Permission.php Normal file
View File

@@ -0,0 +1,11 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Permission extends Model
{
protected $guarded = array('id');
public $table = "hlp_permissions";
}

View File

@@ -3,17 +3,33 @@
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Spatie\Activitylog\Traits\LogsActivity;
use Spatie\Activitylog\LogOptions;
class SenderId extends Model{
// use LogsActivity;
protected $guarded = array('id');
public $table = "sender_ids";
protected static $logName = 'senderid_log';
// protected static $causedBy = $user_model;
// protected static $logOnlyDirty = true;
// protected static $dontSubmitEmptyLogs = true;
protected static $logUnguarded = true;
// public function getActivitylogOptions(): LogOptions{
// return LogOptions::defaults()
// ->logUnguarded()->useLogName('senderid_log')->logOnlyDirty()->dontSubmitEmptyLogs();
// }
public function modified_by_info(){
return $this->hasOne('App\Models\StaffMember', 'id', 'last_modified_by');
}
public function network_info(){
return $this->hasOne('App\Models\NetworkOps', 'id', 'netowkr_id');
return $this->hasOne('App\Models\NetworkOps', 'id', 'network_id');
}
public function created_by_info(){
return $this->hasOne('App\Models\StaffMember', 'id', 'created_by');

View File

@@ -0,0 +1,27 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Senderidold extends Model{
protected $guarded = array('id');
public $table = "sender_ids_copy";
public function modified_by_info(){
return $this->hasOne('App\Models\StaffMember', 'id', 'last_modified_by');
}
public function network_info(){
return $this->hasOne('App\Models\NetworkOps', 'id', 'network_id');
}
public function client_info(){
return $this->hasOne('App\Models\Client', 'id', 'client_id');
}
public function created_by_info(){
return $this->hasOne('App\Models\StaffMember', 'id', 'created_by');
}
}

View File

@@ -3,9 +3,12 @@
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Notifications\Notifiable;
class StaffMember extends Model
{
use Notifiable;
protected $guarded = array('id');
public $table = "staff_members";

View File

@@ -0,0 +1,25 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class SupportTicket extends Model
{
protected $guarded = array('id');
public $table = "support_tickets";
public function modified_by_info(){
return $this->hasOne('App\Models\StaffMember', 'id', 'last_modified_by');
}
public function created_by_info(){
return $this->hasOne('App\Models\StaffMember', 'id', 'created_by');
}
public function assignedTo(){
return $this->hasOne('App\Models\StaffMember', 'id', 'assigned_to');
}
}

View File

@@ -0,0 +1,14 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class SupportTicketsDocument extends Model
{
//
protected $guarded = array('id');
public $table = "support_ticket_attachments";
}

View File

@@ -0,0 +1,24 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class SystemCredential extends Model{
protected $guarded = array('id');
public $table = "sys_credentials";
public function modified_by_info(){
return $this->hasOne('App\Models\SystemUser', 'id', 'last_modified_by_id');
}
public function network_info(){
return $this->hasOne('App\Models\NetworkOps', 'id', 'network_id');
}
public function client_info(){
return $this->hasOne('App\Models\Client', 'id', 'client_id');
}
public function created_by_info(){
return $this->hasOne('App\Models\SystemUser', 'id', 'created_by_id');
}
}

View File

@@ -6,8 +6,11 @@ use Illuminate\Database\Eloquent\Model;
class SystemUser extends Model
{
// use LogsActivity;
//use CausesActivity;
protected $guarded = array('id');
public $table = "auth_users";
// protected static $logUnguarded = true;
public function designation_info(){
return $this->hasOne('App\Models\Designation', 'id', 'designation');

View File

@@ -14,6 +14,9 @@ class UserActivity extends Model
public function userInfo(){
return $this->hasOne('App\Models\StaffMember', 'id', 'user_id');
}
public function userInfoSystem(){
return $this->hasOne('App\Models\SystemUser', 'id', 'user_id');
}
public function getActivityTimeAttribute(){
$created = $this->created_at;
$parsed_created_date = Carbon::parse($created);

23
app/Models/Utility.php Normal file
View File

@@ -0,0 +1,23 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Spatie\Activitylog\Traits\LogsActivity;
use Spatie\Activitylog\LogOptions;
class Utility extends Model{
use LogsActivity;
protected $guarded = ['id'];
protected $table = "utility";
protected static $logUnguarded = true;
public function getActivitylogOptions(): LogOptions
{
return LogOptions::defaults()
->logUnguarded();
// ->logOnly(['name', 'type']);
// Chain fluent methods for configuration options
}
}

20
app/Models/VpnConfig.php Normal file
View File

@@ -0,0 +1,20 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class VpnConfig extends Model
{
protected $guarded = ['id'];
public function client_info(){
return $this->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');
}
}

View File

@@ -0,0 +1,11 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Worldwidemno extends Model
{
protected $guarded = array('id');
public $table = "mno_world_wide";
}

View File

@@ -0,0 +1,68 @@
<?php
namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
class DesktopNotification extends Notification
{
use Queueable;
public $message;
/**
* Create a new notification instance.
*
* @return void
*/
public function __construct($message){
$this->message = $message;
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
// return ['mail'];
return ['broadcast'];
}
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage
*/
/*
public function toMail($notifiable)
{
return (new MailMessage)
->line('The introduction to the notification.')
->action('Notification Action', url('/'))
->line('Thank you for using our application!');
}
*/
public function toBroadcast($notifiable){
return new BroadcastMessage([
'message' => $this->message
]);
}
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
public function toArray($notifiable)
{
return [
//
];
}
}

View File

@@ -0,0 +1,40 @@
<?php
namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Notifications\Messages\MailMessage;
class EmailNotification extends Notification
{
use Queueable;
protected $message;
protected $url;
public function __construct($message, $url = null)
{
$this->message = $message;
$this->url = $url;
}
public function via($notifiable)
{
return ['mail']; // Use 'mail' channel
}
public function toMail($notifiable)
{
$mailMessage = (new MailMessage)
->greeting('Hello!')
->line($this->message);
if ($this->url) {
$mailMessage->action('View Details', $this->url);
}
return $mailMessage->salutation('Regards, Your Application');
}
}
?>

View File

@@ -13,16 +13,18 @@ class AppServiceProvider extends ServiceProvider
*/
public function boot()
{
$monolog = \Log::getMonolog();
// $monolog = \Log::getMonolog();
//new --- > 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);
//clickml_erp_ntfy
//click_erp_notify
// team_erp
// $slackHandler = new \Monolog\Handler\SlackHandler('xoxp-677819906294-675678554016-693747277911-5166bcbb9a5fc3d5434b42a10c4d358a', '#click-erp', 'Monolog', true, null, \Monolog\Logger::ERROR);
// $slackHandler = new \Monolog\Handler\SlackHandler('xoxp-677819906294-675678554016-693747277911-5166bcbb9a5fc3d5434b42a10c4d358a', '#click-erp', 'Monolog', true, null, \Monolog\Logger::INFO);
// $slackHandler = new \Monolog\Handler\SlackHandler('xoxp-677819906294-675678554016-693747277911-5166bcbb9a5fc3d5434b42a10c4d358a', '#click-erp', 'Monolog', true, null, \Monolog\Logger::DEBUG);
// $monolog->pushHandler($slackHandler);
$monolog->pushHandler($slackHandler);
*/
}
/**

23
birthdays.md Normal file
View File

@@ -0,0 +1,23 @@
Birthdays
Mphatso: 26 January
Priscilla: 20 March
Chito: 28 March
Mansa: 18 April
Kwami: 24 April
David: 22 May
Orou: 23 June
Hilary: 1 July
Aniguia: 17 July
Melissa: 24 July
William: 25 July
Kwesi: 26 July
Charity: 27 July
Daniel: 15 August
Sam: 30 September
Effie: 3 October
Kopano: 17 October
Doka: 23 November
Diana: 16 December
Fanny: 21 December
Andrew: 31 December
Martha: She says she cant send coz of her religion.

View File

@@ -10,7 +10,10 @@
"laravel/framework": "5.5.*",
"laravel/tinker": "~1.0",
"laravelcollective/html": "^5.4.0",
"maatwebsite/excel": "^3.1"
"maatwebsite/excel": "^3.1",
"pusher/pusher-php-server": "^7.2",
"thibaud-dauce/laravel-mattermost-logger": "^1.2",
"webklex/laravel-imap": "^4.1"
},
"require-dev": {
"filp/whoops": "~2.0",

825
composer.lock generated
View File

@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "1b55af854942faedd605d375de12227b",
"content-hash": "c423f959b14bacba91bd6e5f5eabde1b",
"packages": [
{
"name": "dnoegel/php-xdg-base-dir",
@@ -459,6 +459,331 @@
},
"time": "2017-06-15T17:19:42+00:00"
},
{
"name": "guzzlehttp/guzzle",
"version": "7.9.3",
"source": {
"type": "git",
"url": "https://github.com/guzzle/guzzle.git",
"reference": "7b2f29fe81dc4da0ca0ea7d42107a0845946ea77"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/7b2f29fe81dc4da0ca0ea7d42107a0845946ea77",
"reference": "7b2f29fe81dc4da0ca0ea7d42107a0845946ea77",
"shasum": ""
},
"require": {
"ext-json": "*",
"guzzlehttp/promises": "^1.5.3 || ^2.0.3",
"guzzlehttp/psr7": "^2.7.0",
"php": "^7.2.5 || ^8.0",
"psr/http-client": "^1.0",
"symfony/deprecation-contracts": "^2.2 || ^3.0"
},
"provide": {
"psr/http-client-implementation": "1.0"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.8.2",
"ext-curl": "*",
"guzzle/client-integration-tests": "3.0.2",
"php-http/message-factory": "^1.1",
"phpunit/phpunit": "^8.5.39 || ^9.6.20",
"psr/log": "^1.1 || ^2.0 || ^3.0"
},
"suggest": {
"ext-curl": "Required for CURL handler support",
"ext-intl": "Required for Internationalized Domain Name (IDN) support",
"psr/log": "Required for using the Log middleware"
},
"type": "library",
"extra": {
"bamarni-bin": {
"bin-links": true,
"forward-command": false
}
},
"autoload": {
"files": [
"src/functions_include.php"
],
"psr-4": {
"GuzzleHttp\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Graham Campbell",
"email": "hello@gjcampbell.co.uk",
"homepage": "https://github.com/GrahamCampbell"
},
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
},
{
"name": "Jeremy Lindblom",
"email": "jeremeamia@gmail.com",
"homepage": "https://github.com/jeremeamia"
},
{
"name": "George Mponos",
"email": "gmponos@gmail.com",
"homepage": "https://github.com/gmponos"
},
{
"name": "Tobias Nyholm",
"email": "tobias.nyholm@gmail.com",
"homepage": "https://github.com/Nyholm"
},
{
"name": "Márk Sági-Kazár",
"email": "mark.sagikazar@gmail.com",
"homepage": "https://github.com/sagikazarmark"
},
{
"name": "Tobias Schultze",
"email": "webmaster@tubo-world.de",
"homepage": "https://github.com/Tobion"
}
],
"description": "Guzzle is a PHP HTTP client library",
"keywords": [
"client",
"curl",
"framework",
"http",
"http client",
"psr-18",
"psr-7",
"rest",
"web service"
],
"support": {
"issues": "https://github.com/guzzle/guzzle/issues",
"source": "https://github.com/guzzle/guzzle/tree/7.9.3"
},
"funding": [
{
"url": "https://github.com/GrahamCampbell",
"type": "github"
},
{
"url": "https://github.com/Nyholm",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/guzzlehttp/guzzle",
"type": "tidelift"
}
],
"time": "2025-03-27T13:37:11+00:00"
},
{
"name": "guzzlehttp/promises",
"version": "2.2.0",
"source": {
"type": "git",
"url": "https://github.com/guzzle/promises.git",
"reference": "7c69f28996b0a6920945dd20b3857e499d9ca96c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/promises/zipball/7c69f28996b0a6920945dd20b3857e499d9ca96c",
"reference": "7c69f28996b0a6920945dd20b3857e499d9ca96c",
"shasum": ""
},
"require": {
"php": "^7.2.5 || ^8.0"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.8.2",
"phpunit/phpunit": "^8.5.39 || ^9.6.20"
},
"type": "library",
"extra": {
"bamarni-bin": {
"bin-links": true,
"forward-command": false
}
},
"autoload": {
"psr-4": {
"GuzzleHttp\\Promise\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Graham Campbell",
"email": "hello@gjcampbell.co.uk",
"homepage": "https://github.com/GrahamCampbell"
},
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
},
{
"name": "Tobias Nyholm",
"email": "tobias.nyholm@gmail.com",
"homepage": "https://github.com/Nyholm"
},
{
"name": "Tobias Schultze",
"email": "webmaster@tubo-world.de",
"homepage": "https://github.com/Tobion"
}
],
"description": "Guzzle promises library",
"keywords": [
"promise"
],
"support": {
"issues": "https://github.com/guzzle/promises/issues",
"source": "https://github.com/guzzle/promises/tree/2.2.0"
},
"funding": [
{
"url": "https://github.com/GrahamCampbell",
"type": "github"
},
{
"url": "https://github.com/Nyholm",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/guzzlehttp/promises",
"type": "tidelift"
}
],
"time": "2025-03-27T13:27:01+00:00"
},
{
"name": "guzzlehttp/psr7",
"version": "2.7.1",
"source": {
"type": "git",
"url": "https://github.com/guzzle/psr7.git",
"reference": "c2270caaabe631b3b44c85f99e5a04bbb8060d16"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/psr7/zipball/c2270caaabe631b3b44c85f99e5a04bbb8060d16",
"reference": "c2270caaabe631b3b44c85f99e5a04bbb8060d16",
"shasum": ""
},
"require": {
"php": "^7.2.5 || ^8.0",
"psr/http-factory": "^1.0",
"psr/http-message": "^1.1 || ^2.0",
"ralouphie/getallheaders": "^3.0"
},
"provide": {
"psr/http-factory-implementation": "1.0",
"psr/http-message-implementation": "1.0"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.8.2",
"http-interop/http-factory-tests": "0.9.0",
"phpunit/phpunit": "^8.5.39 || ^9.6.20"
},
"suggest": {
"laminas/laminas-httphandlerrunner": "Emit PSR-7 responses"
},
"type": "library",
"extra": {
"bamarni-bin": {
"bin-links": true,
"forward-command": false
}
},
"autoload": {
"psr-4": {
"GuzzleHttp\\Psr7\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Graham Campbell",
"email": "hello@gjcampbell.co.uk",
"homepage": "https://github.com/GrahamCampbell"
},
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
},
{
"name": "George Mponos",
"email": "gmponos@gmail.com",
"homepage": "https://github.com/gmponos"
},
{
"name": "Tobias Nyholm",
"email": "tobias.nyholm@gmail.com",
"homepage": "https://github.com/Nyholm"
},
{
"name": "Márk Sági-Kazár",
"email": "mark.sagikazar@gmail.com",
"homepage": "https://github.com/sagikazarmark"
},
{
"name": "Tobias Schultze",
"email": "webmaster@tubo-world.de",
"homepage": "https://github.com/Tobion"
},
{
"name": "Márk Sági-Kazár",
"email": "mark.sagikazar@gmail.com",
"homepage": "https://sagikazarmark.hu"
}
],
"description": "PSR-7 message implementation that also provides common utility methods",
"keywords": [
"http",
"message",
"psr-7",
"request",
"response",
"stream",
"uri",
"url"
],
"support": {
"issues": "https://github.com/guzzle/psr7/issues",
"source": "https://github.com/guzzle/psr7/tree/2.7.1"
},
"funding": [
{
"url": "https://github.com/GrahamCampbell",
"type": "github"
},
{
"url": "https://github.com/Nyholm",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/guzzlehttp/psr7",
"type": "tidelift"
}
],
"time": "2025-03-27T12:30:47+00:00"
},
{
"name": "jakub-onderka/php-console-color",
"version": "v0.2",
@@ -1679,6 +2004,92 @@
},
"time": "2020-10-15T08:29:30+00:00"
},
{
"name": "paragonie/sodium_compat",
"version": "v1.23.0",
"source": {
"type": "git",
"url": "https://github.com/paragonie/sodium_compat.git",
"reference": "b938a5c6844d222a26d46a6c7b80291e4cd8cfab"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/paragonie/sodium_compat/zipball/b938a5c6844d222a26d46a6c7b80291e4cd8cfab",
"reference": "b938a5c6844d222a26d46a6c7b80291e4cd8cfab",
"shasum": ""
},
"require": {
"paragonie/random_compat": ">=1",
"php": "^5.2.4|^5.3|^5.4|^5.5|^5.6|^7|^8"
},
"require-dev": {
"phpunit/phpunit": "^3|^4|^5|^6|^7|^8|^9"
},
"suggest": {
"ext-libsodium": "PHP < 7.0: Better performance, password hashing (Argon2i), secure memory management (memzero), and better security.",
"ext-sodium": "PHP >= 7.0: Better performance, password hashing (Argon2i), secure memory management (memzero), and better security."
},
"type": "library",
"autoload": {
"files": [
"autoload.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"ISC"
],
"authors": [
{
"name": "Paragon Initiative Enterprises",
"email": "security@paragonie.com"
},
{
"name": "Frank Denis",
"email": "jedisct1@pureftpd.org"
}
],
"description": "Pure PHP implementation of libsodium; uses the PHP extension if it exists",
"keywords": [
"Authentication",
"BLAKE2b",
"ChaCha20",
"ChaCha20-Poly1305",
"Chapoly",
"Curve25519",
"Ed25519",
"EdDSA",
"Edwards-curve Digital Signature Algorithm",
"Elliptic Curve Diffie-Hellman",
"Poly1305",
"Pure-PHP cryptography",
"RFC 7748",
"RFC 8032",
"Salpoly",
"Salsa20",
"X25519",
"XChaCha20-Poly1305",
"XSalsa20-Poly1305",
"Xchacha20",
"Xsalsa20",
"aead",
"cryptography",
"ecdh",
"elliptic curve",
"elliptic curve cryptography",
"encryption",
"libsodium",
"php",
"public-key cryptography",
"secret-key cryptography",
"side-channel resistant"
],
"support": {
"issues": "https://github.com/paragonie/sodium_compat/issues",
"source": "https://github.com/paragonie/sodium_compat/tree/v1.23.0"
},
"time": "2025-10-06T08:53:07+00:00"
},
{
"name": "phpoffice/phpspreadsheet",
"version": "1.29.0",
@@ -2171,6 +2582,111 @@
},
"time": "2019-12-06T14:19:43+00:00"
},
{
"name": "pusher/pusher-php-server",
"version": "7.2.7",
"source": {
"type": "git",
"url": "https://github.com/pusher/pusher-http-php.git",
"reference": "148b0b5100d000ed57195acdf548a2b1b38ee3f7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/pusher/pusher-http-php/zipball/148b0b5100d000ed57195acdf548a2b1b38ee3f7",
"reference": "148b0b5100d000ed57195acdf548a2b1b38ee3f7",
"shasum": ""
},
"require": {
"ext-curl": "*",
"ext-json": "*",
"guzzlehttp/guzzle": "^7.2",
"paragonie/sodium_compat": "^1.6|^2.0",
"php": "^7.3|^8.0",
"psr/log": "^1.0|^2.0|^3.0"
},
"require-dev": {
"overtrue/phplint": "^2.3",
"phpunit/phpunit": "^9.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "5.0-dev"
}
},
"autoload": {
"psr-4": {
"Pusher\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "Library for interacting with the Pusher REST API",
"keywords": [
"events",
"messaging",
"php-pusher-server",
"publish",
"push",
"pusher",
"real time",
"real-time",
"realtime",
"rest",
"trigger"
],
"support": {
"issues": "https://github.com/pusher/pusher-http-php/issues",
"source": "https://github.com/pusher/pusher-http-php/tree/7.2.7"
},
"time": "2025-01-06T10:56:20+00:00"
},
{
"name": "ralouphie/getallheaders",
"version": "3.0.3",
"source": {
"type": "git",
"url": "https://github.com/ralouphie/getallheaders.git",
"reference": "120b605dfeb996808c31b6477290a714d356e822"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822",
"reference": "120b605dfeb996808c31b6477290a714d356e822",
"shasum": ""
},
"require": {
"php": ">=5.6"
},
"require-dev": {
"php-coveralls/php-coveralls": "^2.1",
"phpunit/phpunit": "^5 || ^6.5"
},
"type": "library",
"autoload": {
"files": [
"src/getallheaders.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Ralph Khattar",
"email": "ralph.khattar@gmail.com"
}
],
"description": "A polyfill for getallheaders.",
"support": {
"issues": "https://github.com/ralouphie/getallheaders/issues",
"source": "https://github.com/ralouphie/getallheaders/tree/develop"
},
"time": "2019-03-08T08:55:37+00:00"
},
{
"name": "ramsey/uuid",
"version": "3.9.4",
@@ -2567,6 +3083,73 @@
],
"time": "2020-10-24T10:57:07+00:00"
},
{
"name": "symfony/deprecation-contracts",
"version": "v2.5.4",
"source": {
"type": "git",
"url": "https://github.com/symfony/deprecation-contracts.git",
"reference": "605389f2a7e5625f273b53960dc46aeaf9c62918"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/605389f2a7e5625f273b53960dc46aeaf9c62918",
"reference": "605389f2a7e5625f273b53960dc46aeaf9c62918",
"shasum": ""
},
"require": {
"php": ">=7.1"
},
"type": "library",
"extra": {
"thanks": {
"url": "https://github.com/symfony/contracts",
"name": "symfony/contracts"
},
"branch-alias": {
"dev-main": "2.5-dev"
}
},
"autoload": {
"files": [
"function.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "A generic function and convention to trigger deprecation notices",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.4"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2024-09-25T14:11:13+00:00"
},
{
"name": "symfony/event-dispatcher",
"version": "v4.4.30",
@@ -4051,6 +4634,84 @@
],
"time": "2020-10-24T10:57:07+00:00"
},
{
"name": "thibaud-dauce/laravel-mattermost-logger",
"version": "1.2.1",
"source": {
"type": "git",
"url": "https://gitlab.com/thibauddauce/laravel-mattermost-logger.git",
"reference": "c5b5822c1df3f2ae8821bf124bf71b736885699b"
},
"dist": {
"type": "zip",
"url": "https://gitlab.com/api/v4/projects/thibauddauce%2Flaravel-mattermost-logger/repository/archive.zip?sha=c5b5822c1df3f2ae8821bf124bf71b736885699b",
"reference": "c5b5822c1df3f2ae8821bf124bf71b736885699b",
"shasum": ""
},
"require": {
"monolog/monolog": "^1.23",
"thibaud-dauce/mattermost-php": "^1.2"
},
"type": "library",
"autoload": {
"psr-4": {
"ThibaudDauce\\MattermostLogger\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Thibaud Dauce",
"email": "thibaud.dauce@pm.me"
}
],
"time": "2018-11-07T15:59:04+00:00"
},
{
"name": "thibaud-dauce/mattermost-php",
"version": "1.3.0",
"source": {
"type": "git",
"url": "https://github.com/ThibaudDauce/mattermost-php.git",
"reference": "0299c3dc6a2f7adacf663db6dcc93ad5a7b99bd2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/ThibaudDauce/mattermost-php/zipball/0299c3dc6a2f7adacf663db6dcc93ad5a7b99bd2",
"reference": "0299c3dc6a2f7adacf663db6dcc93ad5a7b99bd2",
"shasum": ""
},
"require": {
"guzzlehttp/guzzle": "^6.2|^7.0"
},
"type": "library",
"autoload": {
"psr-4": {
"ThibaudDauce\\Mattermost\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Thibaud Dauce",
"email": "thibaud@dauce.fr",
"homepage": "https://www.formations-laravel.fr"
}
],
"description": "Mattermost PHP driver to send incoming webhooks",
"homepage": "https://github.com/thibaud-dauce/mattermost-php",
"support": {
"issues": "https://github.com/ThibaudDauce/mattermost-php/issues",
"source": "https://github.com/ThibaudDauce/mattermost-php/tree/1.3.0"
},
"time": "2020-11-26T13:26:31+00:00"
},
{
"name": "tijsverkoyen/css-to-inline-styles",
"version": "2.2.3",
@@ -4179,6 +4840,164 @@
}
],
"time": "2021-01-20T14:39:13+00:00"
},
{
"name": "webklex/laravel-imap",
"version": "4.1.2",
"source": {
"type": "git",
"url": "https://github.com/Webklex/laravel-imap.git",
"reference": "9038139b8789e60c998eb389d419d41b969f2713"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Webklex/laravel-imap/zipball/9038139b8789e60c998eb389d419d41b969f2713",
"reference": "9038139b8789e60c998eb389d419d41b969f2713",
"shasum": ""
},
"require": {
"ext-fileinfo": "*",
"ext-iconv": "*",
"ext-mbstring": "*",
"laravel/framework": ">=5.0.0",
"php": ">=5.5.9",
"webklex/php-imap": "^4.1.2"
},
"type": "library",
"extra": {
"laravel": {
"aliases": {
"Client": "Webklex\\IMAP\\Facades\\Client"
},
"providers": [
"Webklex\\IMAP\\Providers\\LaravelServiceProvider"
]
},
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"autoload": {
"psr-4": {
"Webklex\\IMAP\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Malte Goldenbaum",
"email": "github@webklex.com",
"role": "Developer"
}
],
"description": "Laravel IMAP client",
"homepage": "https://github.com/webklex/laravel-imap",
"keywords": [
"idle",
"imap",
"laravel",
"laravel-imap",
"mail",
"oauth",
"pop3",
"webklex"
],
"support": {
"issues": "https://github.com/Webklex/laravel-imap/issues",
"source": "https://github.com/Webklex/laravel-imap/tree/4.1.2"
},
"funding": [
{
"url": "https://www.buymeacoffee.com/webklex",
"type": "custom"
},
{
"url": "https://ko-fi.com/webklex",
"type": "ko_fi"
}
],
"time": "2023-01-18T18:33:20+00:00"
},
{
"name": "webklex/php-imap",
"version": "4.1.2",
"source": {
"type": "git",
"url": "https://github.com/Webklex/php-imap.git",
"reference": "94bf93ae8868ac1e073cfbaef377f0ca1acac2bc"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Webklex/php-imap/zipball/94bf93ae8868ac1e073cfbaef377f0ca1acac2bc",
"reference": "94bf93ae8868ac1e073cfbaef377f0ca1acac2bc",
"shasum": ""
},
"require": {
"ext-fileinfo": "*",
"ext-iconv": "*",
"ext-json": "*",
"ext-mbstring": "*",
"ext-openssl": "*",
"illuminate/pagination": ">=5.0.0",
"nesbot/carbon": ">=1.0",
"php": ">=7.0.0",
"symfony/http-foundation": ">=2.8.0"
},
"require-dev": {
"phpunit/phpunit": "~4.0"
},
"suggest": {
"symfony/mime": "Recomended for better extension support"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"autoload": {
"psr-4": {
"Webklex\\PHPIMAP\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Malte Goldenbaum",
"email": "github@webklex.com",
"role": "Developer"
}
],
"description": "PHP IMAP client",
"homepage": "https://github.com/webklex/php-imap",
"keywords": [
"imap",
"mail",
"php-imap",
"pop3",
"webklex"
],
"support": {
"issues": "https://github.com/Webklex/php-imap/issues",
"source": "https://github.com/Webklex/php-imap/tree/4.1.2"
},
"funding": [
{
"url": "https://www.buymeacoffee.com/webklex",
"type": "custom"
},
{
"url": "https://ko-fi.com/webklex",
"type": "ko_fi"
}
],
"time": "2022-12-14T15:45:15+00:00"
}
],
"packages-dev": [
@@ -6239,12 +7058,12 @@
],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"stability-flags": {},
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
"php": ">=7.0.0"
},
"platform-dev": [],
"platform-dev": {},
"plugin-api-version": "2.6.0"
}

45
config/activitylog.php Normal file
View File

@@ -0,0 +1,45 @@
<?php
return [
/*
* If set to false, no activities will be saved to the database.
*/
'enabled' => env('ACTIVITY_LOGGER_ENABLED', true),
/*
* When the clean-command is executed, all recording activities older than
* the number of days specified here will be deleted.
*/
'delete_records_older_than_days' => 365,
/*
* If no log name is passed to the activity() helper
* we use this default log name.
*/
'default_log_name' => 'default',
/*
* You can specify an auth driver here that gets user models.
* If this is null we'll use the default Laravel auth driver.
*/
'default_auth_driver' => null,
/*
* If set to true, the subject returns soft deleted models.
*/
'subject_returns_soft_deleted_models' => false,
/*
* This model will be used to log activity.
* It should be implements the Spatie\Activitylog\Contracts\Activity interface
* and extend Illuminate\Database\Eloquent\Model.
*/
'activity_model' => \Spatie\Activitylog\Models\Activity::class,
/*
* This is the name of the table that will be created by the migration and
* used by the Activity model shipped with this package.
*/
'table_name' => 'activity_log',
];

View File

@@ -62,6 +62,7 @@ return [
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'endpoint' => env('AWS_ENDPOINT'),
],
],

246
config/imap.php Normal file
View File

@@ -0,0 +1,246 @@
<?php
/*
* File: imap.php
* Category: config
* Author: M. Goldenbaum
* Created: 24.09.16 22:36
* Updated: -
*
* Description:
* -
*/
return [
/*
|--------------------------------------------------------------------------
| IMAP default account
|--------------------------------------------------------------------------
|
| The default account identifier. It will be used as default for any missing account parameters.
| If however the default account is missing a parameter the package default will be used.
| Set to 'false' [boolean] to disable this functionality.
|
*/
'default' => env('IMAP_DEFAULT_ACCOUNT', 'default'),
/*
|--------------------------------------------------------------------------
| Default date format
|--------------------------------------------------------------------------
|
| The default date format is used to convert any given Carbon::class object into a valid date string.
| These are currently known working formats: "d-M-Y", "d-M-y", "d M y"
|
*/
'date_format' => 'd-M-Y',
/*
|--------------------------------------------------------------------------
| Available IMAP accounts
|--------------------------------------------------------------------------
|
| Please list all IMAP accounts which you are planning to use within the
| array below.
|
*/
'accounts' => [
'default' => [// account identifier
'host' => env('IMAP_HOST', 'localhost'),
'port' => env('IMAP_PORT', 993),
'protocol' => env('IMAP_PROTOCOL', 'imap'), //might also use imap, [pop3 or nntp (untested)]
'encryption' => env('IMAP_ENCRYPTION', 'ssl'), // Supported: false, 'ssl', 'tls', 'notls', 'starttls'
'validate_cert' => env('IMAP_VALIDATE_CERT', true),
'username' => env('IMAP_USERNAME', 'root@example.com'),
'password' => env('IMAP_PASSWORD', ''),
'authentication' => env('IMAP_AUTHENTICATION', null),
'proxy' => [
'socket' => null,
'request_fulluri' => false,
'username' => null,
'password' => null,
],
"timeout" => 30,
"extensions" => []
],
/*
'gmail' => [ // account identifier
'host' => 'imap.gmail.com',
'port' => 993,
'encryption' => 'ssl',
'validate_cert' => true,
'username' => 'example@gmail.com',
'password' => 'PASSWORD',
'authentication' => 'oauth',
],
'another' => [ // account identifier
'host' => '',
'port' => 993,
'encryption' => false,
'validate_cert' => true,
'username' => '',
'password' => '',
'authentication' => null,
]
*/
],
/*
|--------------------------------------------------------------------------
| Available IMAP options
|--------------------------------------------------------------------------
|
| Available php imap config parameters are listed below
| -Delimiter (optional):
| This option is only used when calling $oClient->
| You can use any supported char such as ".", "/", (...)
| -Fetch option:
| IMAP::FT_UID - Message marked as read by fetching the body message
| IMAP::FT_PEEK - Fetch the message without setting the "seen" flag
| -Fetch sequence id:
| IMAP::ST_UID - Fetch message components using the message uid
| IMAP::ST_MSGN - Fetch message components using the message number
| -Body download option
| Default TRUE
| -Flag download option
| Default TRUE
| -Soft fail
| Default FALSE - Set to TRUE if you want to ignore certain exception while fetching bulk messages
| -RFC822
| Default TRUE - Set to FALSE to prevent the usage of \imap_rfc822_parse_headers().
| See https://github.com/Webklex/php-imap/issues/115 for more information.
| -Debug enable to trace communication traffic
| -UID cache enable the UID cache
| -Fallback date is used if the given message date could not be parsed
| -Boundary regex used to detect message boundaries. If you are having problems with empty messages, missing
| attachments or anything like this. Be advised that it likes to break which causes new problems..
| -Message key identifier option
| You can choose between the following:
| 'id' - Use the MessageID as array key (default, might cause hickups with yahoo mail)
| 'number' - Use the message number as array key (isn't always unique and can cause some interesting behavior)
| 'list' - Use the message list number as array key (incrementing integer (does not always start at 0 or 1)
| 'uid' - Use the message uid as array key (isn't always unique and can cause some interesting behavior)
| -Fetch order
| 'asc' - Order all messages ascending (probably results in oldest first)
| 'desc' - Order all messages descending (probably results in newest first)
| -Disposition types potentially considered an attachment
| Default ['attachment', 'inline']
| -Common folders
| Default folder locations and paths assumed if none is provided
| -Open IMAP options:
| DISABLE_AUTHENTICATOR - Disable authentication properties.
| Use 'GSSAPI' if you encounter the following
| error: "Kerberos error: No credentials cache
| file found (try running kinit) (...)"
| or ['GSSAPI','PLAIN'] if you are using outlook mail
|
*/
'options' => [
'delimiter' => '/',
'fetch' => \Webklex\PHPIMAP\IMAP::FT_PEEK,
'sequence' => \Webklex\PHPIMAP\IMAP::ST_UID,
'fetch_body' => true,
'fetch_flags' => true,
'soft_fail' => false,
'rfc822' => true,
'debug' => false,
'uid_cache' => true,
// 'fallback_date' => "01.01.1970 00:00:00",
'boundary' => '/boundary=(.*?(?=;)|(.*))/i',
'message_key' => 'list',
'fetch_order' => 'asc',
'dispositions' => ['attachment', 'inline'],
'common_folders' => [
"root" => "INBOX",
"junk" => "INBOX/Junk",
"draft" => "INBOX/Drafts",
"sent" => "INBOX/Sent",
"trash" => "INBOX/Trash",
],
'open' => [
// 'DISABLE_AUTHENTICATOR' => 'GSSAPI'
]
],
/**
* |--------------------------------------------------------------------------
* | Available decoding options
* |--------------------------------------------------------------------------
* |
* | Available php imap config parameters are listed below
* | -options: Decoder options (currently only the message subject and attachment name decoder can be set)
* | 'utf-8' - Uses imap_utf8($string) to decode a string
* | 'mimeheader' - Uses mb_decode_mimeheader($string) to decode a string
* | -decoder: Decoder to be used. Can be replaced by custom decoders if needed.
* | 'header' - HeaderDecoder
* | 'message' - MessageDecoder
* | 'attachment' - AttachmentDecoder
*/
'decoding' => [
'options' => [
'header' => 'utf-8', // mimeheader
'message' => 'utf-8', // mimeheader
'attachment' => 'utf-8' // mimeheader
],
'decoder' => [
'header' => \Webklex\PHPIMAP\Decoder\HeaderDecoder::class,
'message' => \Webklex\PHPIMAP\Decoder\MessageDecoder::class,
'attachment' => \Webklex\PHPIMAP\Decoder\AttachmentDecoder::class
]
],
/*
|--------------------------------------------------------------------------
| Available flags
|--------------------------------------------------------------------------
|
| List all available / supported flags. Set to null to accept all given flags.
*/
'flags' => ['recent', 'flagged', 'answered', 'deleted', 'seen', 'draft'],
/*
|--------------------------------------------------------------------------
| Available events
|--------------------------------------------------------------------------
|
*/
'events' => [
"message" => [
'new' => \Webklex\IMAP\Events\MessageNewEvent::class,
'moved' => \Webklex\IMAP\Events\MessageMovedEvent::class,
'copied' => \Webklex\IMAP\Events\MessageCopiedEvent::class,
'deleted' => \Webklex\IMAP\Events\MessageDeletedEvent::class,
'restored' => \Webklex\IMAP\Events\MessageRestoredEvent::class,
],
"folder" => [
'new' => \Webklex\IMAP\Events\FolderNewEvent::class,
'moved' => \Webklex\IMAP\Events\FolderMovedEvent::class,
'deleted' => \Webklex\IMAP\Events\FolderDeletedEvent::class,
],
"flag" => [
'new' => \Webklex\IMAP\Events\FlagNewEvent::class,
'deleted' => \Webklex\IMAP\Events\FlagDeletedEvent::class,
],
],
/*
|--------------------------------------------------------------------------
| Available masking options
|--------------------------------------------------------------------------
|
| By using your own custom masks you can implement your own methods for
| a better and faster access and less code to write.
|
| Checkout the two examples custom_attachment_mask and custom_message_mask
| for a quick start.
|
| The provided masks below are used as the default masks.
*/
'masks' => [
'message' => \Webklex\PHPIMAP\Support\Masks\MessageMask::class,
'attachment' => \Webklex\PHPIMAP\Support\Masks\AttachmentMask::class
]
];

18
config/permissions.php Normal file
View File

@@ -0,0 +1,18 @@
<?php
return [
'SUPER_ADMIN' => 1,
'VIEW_USERS' => 2,
'ADD_EDIT_REMOVE_USERS' => 4,
'MANAGE_CLIENTS' => 8,
'MANAGE_MNOS' => 16,
'MANAGE_SHORT_CODES' => 32,
'MANAGE_SENDER_IDS' => 64,
'MANAGE_VPN_CONFIGS' => 128,
'MANAGE_BRANCH_OFFICES' => 256,
'MANAGE_UTILITIES' => 512,
'MANAGE_TEAM_MEMBERS' => 1024,
'CHANGE_ACCOUNT_MANAGERS' => 2048,
];
?>

View File

@@ -0,0 +1,38 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateActivityLogTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create(config('activitylog.table_name'), function (Blueprint $table) {
$table->increments('id');
$table->string('log_name')->nullable();
$table->text('description');
$table->integer('subject_id')->nullable();
$table->string('subject_type')->nullable();
$table->integer('causer_id')->nullable();
$table->string('causer_type')->nullable();
$table->text('properties')->nullable();
$table->timestamps();
$table->index('log_name');
});
}
/**
* Reverse the migrations.
*/
public function down()
{
Schema::dropIfExists(config('activitylog.table_name'));
}
}

11
info.md Normal file
View File

@@ -0,0 +1,11 @@
# Details
- Balance notifications
# Charity notes entry | deleted
INSERT INTO `client_finances` (`id`, `client_id`, `invoice_number`, `invoice_amount`, `invoice_date`, `invoice_status`, `user_id`, `services`, `short_code`, `remarks`, `created_at`, `updated_at`)
VALUES
('602', '36', '1878', '6.16', '2025-06-17 00:00:00', 'UNPAID', '8', 'A2P', '', 'May 2025 SMS traffic', '2025-06-17 12:13:37', '2025-06-17 12:13:37');
The stream or file "/var/www/html/general/team_tracker/storage/logs/laravel-2026-01-26.log" could not be opened in append mode: failed to open stream: Permission denied

10
issues-20-02-2026.md Normal file
View File

@@ -0,0 +1,10 @@
1. The logo looks stretched. Can we get that fixed? resized and repositioned it nut we need a new one
2. we need to get ERP SSL sorted. -- this needs a domain name
3. Sams message of the day: Sam suggested we have an email that the quotes can be sent to and automatically update on the ERP.
And maybe add other quotes from different people. Not just Sams quote.
Have Effie, maybe Mansa, maybe you. And it should be changed to weekly not daily
implemented a solution with the emails
4. for contract validity (expiry date), add a feature for Auto Renewal which wont be asking for the validity.
This is of contracts that dont expire. done. need to upload
5. for the Holidays, he asked that I send emails to Country Managers every month asking for the following month holidays of their respective countries
6. How far with the profile page? -- done

51
live.env Normal file
View File

@@ -0,0 +1,51 @@
APP_NAME=Tracker
APP_ENV=production
APP_KEY=base64:8gXdEEPNnQJeaD4v9y4djtdj3h13Db3KeWbAlV4fYo0=
APP_DEBUG=false
APP_URL=http://localhost
LOG_CHANNEL=stack
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=click_team_tracker
DB_USERNAME=root
DB_PASSWORD=n1h1!1st
BROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=erp@click-mobile.com
MAIL_PASSWORD=sqczcsrtcehpywjv
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=null
MAIL_FROM_NAME="${APP_NAME}"
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

View File

@@ -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');

View File

@@ -1,13 +1,30 @@
# Onboarding process
# Leave management
- apply for leave
- approve/deny leave
- view leave days
- list staff on leave with return dates
# Date 2024-01-18
i Effie,
Lets have app fee and development once off 100,000 and at 13% annual maintenance, which reminds me we are not billing customers for support and annual maintenance ☹.
@'Kwesi Banson' we need to add these on the ERP.
Kind Regards,
## 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
## HI @Kwesi Banson
I have an idea, customers whose status are put to dormant should be kinda locked or change colour, i.e not waste our time. Can you add that on the system?
Kind Regards
Sam
# Onboarding process
Thank you sir,
Has it been uploaded on the ERP
@@ -38,22 +55,23 @@ Dynamic Numeric- Yes/No
Delivery Report- Yes/No
Comments
# Short Code Licence/Certificate Renewal Date
Our ZICTA certificate for the Geopoll short code 5155 will expire on the 22nd of March. Renewal fee is K18,000.
1. Charity suggested we link clients with Sender IDs to avoid having to enter Sender IDS on a separate page
Kind Regards,
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
Martha
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. Dont know if it makes sense.
VFGH83347501
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 - done
https://youtu.be/6kBAkodqBRM
## Mansa
- Reports on new clients
- reports on new notes
https://youtu.be/OUSTGLL51m0
- @exoscutter
In response to SSL Certificate renewal
Anything that needs renewal etc - needs to be on the ERP under tech,
Kind Regards
## Profile Management
- activate the edit button with

Binary file not shown.

After

Width:  |  Height:  |  Size: 571 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
public/assets/img/user 2.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

View File

@@ -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,7 +51,44 @@
$('#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('<img src="../../img/loading.gif" alt="" width="24" height="24">');
},
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($("<option />").val(row.id).text(row.name));
});
}
else {
console.log(data);
$.alert(data.msg);
}
},
fail : function(errordata){
console.log(errordata);å
}
});
});
$('select').select2();
$('#myDatepicker2').datetimepicker({
@@ -66,6 +131,10 @@
$('#shortCodeType').val('voice');
$('#newShortCodeFormModal').modal('show');
});
$('#createSenderIdBtn').click(function(evt){
evt.preventDefault();
$('#newSenderIdFormModal').modal('show');
});
$('#createPaymentBtn').click(function(evt){
evt.preventDefault();
@@ -75,6 +144,12 @@
evt.preventDefault();
$('#supportFeesFormModal').modal('show');
});
$('#changeAmTrigBtn').click(function(evt){
evt.preventDefault();
$('#changeAmModal').modal('show');
});
$('.paymentEntryEditBtn').click(function(tve){
tve.preventDefault();
//var theIDD = $("input[name=payment_entry_id]").val();
@@ -87,6 +162,7 @@
contentType: false,
async: false,
success: function (data){
console.log(data);
if (data.code === 1) {
// console.log(theIDD);
$('#paymentIdEdit').val(theIDD);
@@ -94,6 +170,7 @@
$('#invoiceNumberEdit').val(data.result.invoice_number);
$('#invoiceAmountEdit').val(data.result.invoice_amount);
$('#invoiceDateEdit').val(data.result.invoice_date);
$('#financeShortCodeEdit').val(data.result.short_code);
$('#invoiceStatusEdit').val(data.result.invoice_status).change();
$('#remarksEdit').val(data.result.remarks);
$('#financePaymentsEditForm').modal('show');
@@ -136,6 +213,7 @@
$('#shortCodeTypeEdit').val(data.result.code_type);
$('#shortCodeEdit').val(data.result.shortcode);
$('#tollFreeEdit').val(data.result.toll_free).change();
$('#monthlyFeeEdit').val(data.result.monthly_fee);
$('#launchDateEdit').val(data.result.launch_date);
$('#expiryDateEdit').val(data.result.expiry_date);
$('#codeStatusEdit').val(data.result.status).change();
@@ -264,7 +342,7 @@
location.reload();
}, 8000);
}
else if (data.code > 5) {
else if (data.code > 1) {
$.alert({
title: 'Alert!',
content: data.msg,
@@ -343,7 +421,7 @@
});
});
/*
$('#financeServicesStore').change(function(evtt){
let currentServices = $('#financeServicesStore').val();
$.each(currentServices, function (key, value) {
@@ -359,6 +437,7 @@
}
});
});
*/
$('#financeEditForm').submit(function(evt){
evt.preventDefault();
@@ -520,5 +599,96 @@
}
});
});
$('#changeAmForm').submit(function(evt){
evt.preventDefault();
var formData = new FormData($(this)[0]);
$.ajax({
type: "POST",
url: base_url + '/clients/changeam',
data : formData,
processData: false,
contentType: false,
async: false,
success: function (data){
if (data.code === 1) {
$.alert({
title: 'Alert!',
content: 'Account Manager successfully changed',
});
setTimeout(function(){
location.reload();
}, 8000);
}
else if (data.code > 1) {
$.alert({
title: 'Alert!',
content: data.msg,
});
}
else {
$.alert({
title: 'Alert!',
content: 'Your request could not be handled. Try again !',
});
}
},
error: function (data) {
var output = $.parseJSON(data.responseText);
console.log(output);
},
fail : function(errordata){
console.log(errordata);
}
});
});
$('#newSenderIdForm').submit(function(evt){
evt.preventDefault();
var formData = new FormData($(this)[0]);
$.ajax({
type: "POST",
url: base_url + '/senderids/direct_store',
data : formData,
processData: false,
contentType: false,
async: false,
success: function (data){
if (data.code === 1) {
$.alert({
title: 'Alert!',
content: 'Sender ID successfully saved',
});
setTimeout(function(){
location.reload();
}, 8000);
}
else if (data.code > 1) {
$.alert({
title: 'Alert!',
content: data.msg,
});
}
else {
$.alert({
title: 'Alert!',
content: 'Your request could not be handled. Try again !',
});
}
},
error: function (data) {
var output = $.parseJSON(data.responseText);
console.log(output.errors);
$('#senderIdnotifyArea').removeClass('hidden');
$.each(output.errors, function (key, value) {
console.log(value[0]);
$('#senderIdnotifyArea').text(value[0]);
});
},
fail : function(errordata){
console.log(errordata);
}
});
});
});

View File

@@ -1,25 +1,73 @@
$(document).ready(function(){
/*
$.ajax({
type: "get",
url: base_url + '/dashboard/get_events',
url: base_url + '/dashboard/getquotes',
// data : formData,
processData: false,
contentType: false,
async: false,
success: function (data){
//init_calendar(data);
console.log(data);
$('#dailyQuoteBlock').text(data.quote);
$('#authorParagraph').text(data.author);
},
error: function(error){
var output = $.parseJSON(error.responseText);
console.log(output.errors);
$('#ipNotifyArea').removeClass('hidden');
$('#ipNotifyArea').addClass('alert alert-danger');
$('#dailyQuoteBlock').text('');
$.each(output.errors, function (key, value) {
//console.log(value[0]);
$('#ipNotifyArea').text(value[0]);
console.log(value[0]);
});
}
});
*/
$.ajax({
type: "get",
url: base_url + '/dashboard/getmnoexpiry',
// data : formData,
processData: false,
contentType: false,
async: false,
success: function (data){
console.log(data);
$('#mnoExpiredHref').text(data.expired_overall);
$('#mnoExpiringThisMonth').text(data.expiring_current_month);
$('#mnoExpiringInThreeMonths').text(data.expiring_three_months);
},
error: function(error){
var output = $.parseJSON(error.responseText);
console.log(output.errors);
$('#dailyQuoteBlock').text('');
$.each(output.errors, function (key, value) {
console.log(value[0]);
});
}
});
$.ajax({
type: "get",
url: base_url + '/dashboard/getclientexpiry',
// data : formData,
processData: false,
contentType: false,
async: false,
success: function (data){
console.log(data);
$('#clientExpiredHref').text(data.expired_overall);
$('#clientExpiringThisMonth').text(data.expiring_current_month);
$('#clientExpiringInThreeMonths').text(data.expiring_three_months);
},
error: function(error){
var output = $.parseJSON(error.responseText);
console.log(output.errors);
$('#dailyQuoteBlock').text('');
$.each(output.errors, function (key, value) {
console.log(value[0]);
});
}
});
});

131
public/assets/js/senderid.js vendored Normal file
View File

@@ -0,0 +1,131 @@
$(document).ready(function(){
$('#resetBtn').click(function(){
console.log('foo bar');
location.reload();
});
var directMnoSelectionStart = $('#directMno').val();
if (directMnoSelectionStart !== undefined) {
// #console.log(directMnoSelectionStart + " at rest");
if (directMnoSelectionStart == 'YES') {
// $('#mnoDiv').removeClass('hidden');
// $('#supplierDiv').addClass('hidden');
$('#supplierName').attr('required', false);
$('#supplierName').attr('disabled', true);
$('#networkName').attr('disabled', false);
}
else if(directMnoSelectionStart == 'NO'){
// console.log('in the NO in Create | at rest');
// $('#supplierDiv').removeClass('hidden');
// $('#mnoDiv').addClass('hidden');
$('#networkName').attr('required', false);
$('#networkName').attr('disabled', true);
$('#supplierName').attr('disabled', false);
}
else{
console.log('do nothing in create | at rest');
}
}
//Edit
var directMnoSelectionEditStart = $('#directMnoEdit').val();
if (directMnoSelectionEditStart !== undefined) {
// console.log(directMnoSelectionEditStart + " at rest");
if (directMnoSelectionEditStart == 'YES') {
// $('#mnoDivEdit').removeClass('hidden');
// $('#supplierDivEdit').addClass('hidden');
$('#supplierNameEdit').attr('required', false);
$('#supplierNameEdit').attr('disabled', true);
$('#networkNameEdit').attr('disabled', false);
}
else if(directMnoSelectionEditStart == 'NO'){
console.log('in the NO in Edit | at rest');
// $('#supplierDivEdit').removeClass('hidden');
// $('#mnoDivEdit').addClass('hidden');
$('#networkNameEdit').attr('required', false);
$('#networkNameEdit').attr('disabled', true);
$('#supplierNameEdit').attr('disabled', false);
}
else{
console.log('do nothing in Edit | at rest');
}
}
//Create
$('#directMno').change(function(tve){
tve.preventDefault();
// var theIDD = $(this).siblings('.shortCodeEntryRowId').val();
var directMnoSelection = $(this).val();
// console.log('User selection ' + directMnoSelection);
if (directMnoSelection == 'YES') {
// $('#mnoDiv').removeClass('hidden');
// $('#supplierDiv').addClass('hidden');
// $('#mnoDivEdit').removeClass('hidden');
// // $('#supplierNameMM').val('').change();
// $('#supplierNameMM').remove();
// $('#supplierDiv').remove();
$('#supplierName').attr('required', false);
$('#supplierName').attr('disabled', true);
$('#networkName').attr('disabled', false);
// $("#supplierName").prop("disabled", true);
// $("#networkNameEdit").prop("disabled", false);
}
else{
// $('#supplierDiv').removeClass('hidden');
// $('#mnoDiv').addClass('hidden');
// $('#mnoDivEdit').addClass('hidden');
// $('#networkNameMM').val('').change();
// $('#mnoDiv').remove();
// $("#networkName").prop("disabled", true);
// $("#supplierNameEdit").prop("disabled", false);
$('#networkName').attr('disabled', true);
$('#networkName').attr('required', false);
$('#supplierName').attr('disabled', false);
}
});
$('#directMnoEdit').change(function(tve){
tve.preventDefault();
var directMnoSelectionEdit = $(this).val();
// console.log(directMnoSelectionEdit);
if (directMnoSelectionEdit == 'YES') {
// $('#mnoDivEdit').removeClass('hidden');
// $('#supplierDivEdit').addClass('hidden');
// $("#supplierNameEdit").prop("disabled", true);
// $("#networkNameEdit").prop("disabled", false);
$('#supplierNameEdit').attr('required', false);
$('#supplierNameEdit').attr('disabled', false);
$('#networkNameEdit').attr('disabled', true);
}
else if(directMnoSelectionEdit == 'NO'){
console.log('in the NO | on change');
// $('#supplierDivEdit').removeClass('hidden');
// $('#networkNameEdit').removeClass('hidden');
// $('#mnoDivEdit').addClass('hidden');
// $('#networkNameEdit').addClass('hidden');
// $("#supplierNameEdit").prop("disabled", false);
// $("#networkNameEdit").prop("disabled", true);
$('#networkNameEdit').attr('required', false);
$('#networkNameEdit').attr('disabled', true);
$('#supplierNameEdit').attr('disabled', false);
}
else{
console.log('do nothing | on change');
}
});
});

171
public/assets/js/shortcode.js vendored Normal file
View File

@@ -0,0 +1,171 @@
$(document).ready(function(){
console.log('foo bar');
$('.scdates').datetimepicker({
format: 'YYYY-MM-DD'
});
$('select').select2();
// $('#shortCodeDelBtn').on('click', function(evt) {
$(document).on('click', '.linkButton', function(){
var theVal = $(this).siblings('.hiddenInput').val();
console.log('heere at the wall' + theVal );
$.ajax({
type: "GET",
url: base_url + '/clients/get_shortcode/' + theVal,
processData: false,
contentType: false,
async: false,
success: function (data){
if (data.code === 1) {
console.log(data);
$('#shortCodeIDEdit').val(theVal);
$('#nameEdit').val(data.result.name);
$('#shortCodeClientIdEdit').val(data.result.client_id);
$('#shortCodeTypeEdit').val(data.result.code_type);
$('#shortCodeEdit').val(data.result.shortcode);
$('#tollFreeEdit').val(data.result.toll_free).change();
$('#monthlyFeeEdit').val(data.result.monthly_fee);
$('#launchDateEdit').val(data.result.launch_date);
$('#expiryDateEdit').val(data.result.expiry_date);
$('#codeStatusEdit').val(data.result.status).change();
$('#network').val(data.result.network).change();
$('#remarksEdit').val(data.result.remarks);
$('#shortCodeEditMain').modal('show');
}
else if (data.code > 1) {
$.alert({
title: 'Alert!',
content: data.msg,
});
}
else {
$.alert({
title: 'Alert!',
content: 'Your request could not be handled. Try again !',
});
}
}
});
});
$('.shortCodeDelBtn').click(function(evt){
evt.preventDefault();
$.confirm({
title: 'Confirm Deletion',
content: 'Are you sure you want to delete this Short Code?',
buttons: {
confirm: function() {
var shortCodeId = $('#shortCodeIDEdit').val();
$.ajax({
type: "GET",
url: base_url + '/allshortcode/remove_code/' + shortCodeId,
// data : formData,
processData: false,
contentType: false,
async: false,
success: function (data){
if (data.code === 1) {
$.alert({
title: 'Alert!',
content: 'Short Code Details successfully Removed',
});
setTimeout(function(){
location.reload();
}, 8000);
}
else if (data.code > 1) {
$.alert({
title: 'Alert!',
content: data.msg,
});
}
else {
$.alert({
title: 'Alert!',
content: 'Your request could not be handled. Try again !',
});
}
}
});
},
cancel: function() {
$.alert({
title: 'Alert!',
content: 'You cancelled the request. The Short Code has not been deleted!',
});
}
}
});
});
$('#createSmsShortCodeBtn').click(function(evt){
evt.preventDefault();
$('#shortCodeType').val('sms');
$('#newShortCodeFormModal').modal('show');
});
$('#createUssdShortCodeBtn').click(function(evt){
evt.preventDefault();
$('#shortCodeType').val('ussd');
$('#newShortCodeFormModal').modal('show');
});
$('#createVoiceShortCodeBtn').click(function(evt){
evt.preventDefault();
$('#shortCodeType').val('voice');
$('#newShortCodeFormModal').modal('show');
});
$('#shortCodeForm').submit(function(evt){
evt.preventDefault();
var formData = new FormData($(this)[0]);
$.ajax({
type: "POST",
url: base_url + '/clients/shortcode_store',
data : formData,
processData: false,
contentType: false,
async: false,
success: function (data){
if (data.code === 1) {
$.alert({
title: 'Alert!',
content: 'Short code details successfully saved',
});
setTimeout(function(){
location.reload();
}, 5000);
}
else if (data.code > 1) {
$.alert({
title: 'Alert!',
content: data.msg,
});
}
else {
$.alert({
title: 'Alert!',
content: 'Your request could not be handled. Try again !',
});
}
},
error: function (data) {
var output = $.parseJSON(data.responseText);
// console.log(output.errors);
$('#notifyArea').removeClass('hidden');
$.each(output.errors, function (key, value) {
// console.log(value[0]);
$('#notifyArea').text(value[0]);
});
},
fail : function(errordata){
// console.log(errordata);
}
});
});
});

0
public/assets/js/support_ticket.js vendored Normal file
View File

44
public/assets/js/vpn_configs.js vendored Normal file
View File

@@ -0,0 +1,44 @@
$(document).ready(function(){
$('#dateReceived').datetimepicker({
format: 'YYYY-MM-DD'
});
$('#partnerType').change(function(tve){
tve.preventDefault();
// var theIDD = $(this).siblings('.shortCodeEntryRowId').val();
var selectedPartnerType = $(this).val();
$.ajax({
type: "GET",
url: base_url + '/infrastructure/get-vpn-partner-list/' + selectedPartnerType,
processData: false,
contentType: false,
async: false,
success: function (data){
if (data.code === 1) {
$('#partnerTypeID').empty();
$.each(data.result, function(id, row) {
// console.log(row);
$('#partnerTypeID').append($("<option />").val(row.id).text(row.partner));
});
// $('#partnerTypeIDd').val(data.result).change();
// $('#codeStatusEdit').val(data.result.status).change();
// $('#network').val(data.result.network).change();
}
else if (data.code > 1) {
$.alert({
title: 'Alert!',
content: data.msg,
});
}
else {
$.alert({
title: 'Alert!',
content: 'Your request could not be handled. Try again !',
});
}
}
});
});
});

View File

@@ -0,0 +1,6 @@
root = true
[*]
indent_style = tab
end_of_line = lf
insert_final_newline = true

View File

@@ -0,0 +1,58 @@
---
name: Bug report
about: Report a bug with Tabulator
title: ''
labels: Possible Bug
assignees: ''
---
<!--
YOUR BUG REPORT MUST CONTAIN A LINK TO A JSFiddle OR Codepen THAT DEMONSTRATES THE ISSUE OR IT WILL BE CLOSED WITHOUT DISCUSSION
Please read the Bug Reporting Guide before completing this issue: http://tabulator.info/community/bug
Please make sure you fill in all the sections of this template to give us the best chance of helping you
-->
**Describe the bug**
A clear and concise description of what the bug is.
**Tabulator Info**
- Which version of Tabulator are you using?
**Working Example**
YOU MUST include a link to a JS Fiddle or Codepen that demonstrates the problem, it is very hard to diagnose an issue from a simple description.
<!--
Please read the Minimal Reproducable Example guide if you are unsure what the example should look like http://tabulator.info/community/mre
A quick guide on creating a JS Fiddle can be found on the Tabulator website http://tabulator.info/community/jsfiddle
ISSUES CREATED WITHOUT THIS EXAMPLE WILL BE CLOSED WITHOUT DISCUSSION
-->
**To Reproduce**
A step by step guide to recreate the issue in your JS Fiddle or Codepen:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
**Additional context**
Add any other context about the problem here.

Some files were not shown because too many files have changed in this diff Show More