diff --git a/1_KMA.jpg b/1_KMA.jpg deleted file mode 100644 index 1d9348f..0000000 Binary files a/1_KMA.jpg and /dev/null differ diff --git a/app/Http/Controllers/ClientsController.php b/app/Http/Controllers/ClientsController.php index fc0bfc9..fb2caee 100755 --- a/app/Http/Controllers/ClientsController.php +++ b/app/Http/Controllers/ClientsController.php @@ -82,14 +82,14 @@ class ClientsController extends Controller public function getClientJsonRawJs(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); - + //$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') ->select('clients.id', 'clients.name', 'clients.status', 'clients.country', 'aumngr.name As accountMgr', 'aumodify.name AS modifiedBy') ->paginate(10); - if($request->has('keyword')){ // != '' + if($request->has('keyword')){ $keyword = $request->keyword; $client_arr = \DB::table('clients') ->join('auth_users AS aumngr', 'aumngr.id', '=', 'clients.auth_user_id') @@ -156,6 +156,7 @@ class ClientsController extends Controller 'industry' => 'required', 'auth_user_id' => 'required', // account manager ]); + $onboarding_stages = Models\ClientOnboardingMainStage::orderBy('stage_id')->get(); // dd($onboarding_stages); $client_current_stages = []; @@ -219,7 +220,8 @@ class ClientsController extends Controller ]; $clients_onboarding_progress = Models\ClientOnboardingProgress::create($progress_arr); } - if (in_array('3', $request->services)) { + + if (in_array('USSD', $request->services)) { \Log::info('ussd client detected'); $ussd_client_payment_arr = [ 'client_id' => $result->id, @@ -263,7 +265,7 @@ class ClientsController extends Controller //dd($notes_arr); $result = Models\ClientNote::create($notes_arr); - + // dd($result); $notes = Models\ClientNote::with('client_info', 'created_by_info')->find($result->id); //todo : send emails dispatch(new SendNewNotesEmailAlert($notes)); @@ -606,6 +608,8 @@ class ClientsController extends Controller } sort($networks_raw); + + $data = [ 'page_title' => 'Client Profile', 'showclient' => $showclient, @@ -752,26 +756,30 @@ class ClientsController extends Controller } - public function getShortCodes(){ + public function getShortCodes($type){ //$auth_users = Models\SystemUser::pluck('name', 'id'); - - $voice_codes = Models\ClientShortCode::with('client_info', 'client_info', 'update_info')->where('code_type', 'voice')->get(); - $sms_codes = Models\ClientShortCode::with('client_info','client_info', 'update_info')->where('code_type', 'sms')->get(); - $ussd_codes = Models\ClientShortCode::with('client_info', 'client_info', 'update_info')->where('code_type', 'ussd')->get(); - //dd($voice_codes); - - // dump($sms_codes[0]->last_updaed_by); - // dd($auth_users[$sms_codes[0]->last_updaed_by]); - + //todo : separate the short codes into individual pages + switch ($type) { + case 'sms': + $codes_data = Models\ClientShortCode::with('client_info','client_info', 'update_info')->where('code_type', 'sms')->get(); + break; + case 'ussd': + $codes_data = Models\ClientShortCode::with('client_info', 'client_info', 'update_info')->where('code_type', 'ussd')->get(); + break; + case 'voice': + $codes_data = Models\ClientShortCode::with('client_info', 'client_info', 'update_info')->where('code_type', 'voice')->get(); + break; + default: + // code... show 404 + break; + } $codes = Models\ClientShortCode::with('update_info')->get(); $data = [ 'page_title' => 'Client Short Codes', - 'voice_codes' => $voice_codes, - 'sms_codes' => $sms_codes, - 'ussd_codes' => $ussd_codes, + 'codes_data' => $codes_data, + 'type' => $type ]; - // dd($data); return view('client.shortcodes', $data); } /** @@ -783,7 +791,6 @@ class ClientsController extends Controller public function edit($id) { $client = Models\Client::find($id); - $service_type = Models\Service::orderBy('name', 'ASC')->pluck('name', 'name'); $countries = Models\Country::orderBy('en_short_name', 'ASC')->pluck('en_short_name','en_short_name'); @@ -977,8 +984,11 @@ class ClientsController extends Controller $pending_stage = Arr::where($onboarding_progress_stage, function ($value, $key) { return $value == "PENDING"; }); - $pending_stage = array_key_first($pending_stage); + #$pending_stage = array_key_first($pending_stage); + reset($pending_stage); + $pending_stage = key($pending_stage); + if ($pending_stage == true) { //Pending Exist $client_update->progress_indicator = $pending_stage; @@ -1215,10 +1225,12 @@ class ClientsController extends Controller public function showOnboardingForm($client_id){ $client = Models\Client::findOrFail($client_id); - + $onboarding_stages = Models\ClientOnboardingProgress::where('client_id', $client_id)->orderBy('stage_id')->get(); + //dd($onboarding_stages); $data = [ 'page_title' => 'Clients | Onboarding Checklist', - 'client' => $client + 'client' => $client, + 'onboarding_stages' => $onboarding_stages ]; return view('client.onboarding_show', $data); } diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php index baee9e8..107ba68 100755 --- a/app/Http/Controllers/Controller.php +++ b/app/Http/Controllers/Controller.php @@ -47,8 +47,10 @@ class Controller extends BaseController return $response; } - public function logUsersActivity($type, $content){ - $user_id = session('current_user.id'); + public function logUsersActivity($type, $content, $user_id = null){ + if($user_id == null){ + $user_id = session('current_user.id'); + } $activity_arr = [ 'type' => $type, 'content' => $content, diff --git a/app/Http/Controllers/Finance/DashboardController.php b/app/Http/Controllers/Finance/DashboardController.php new file mode 100644 index 0000000..197e169 --- /dev/null +++ b/app/Http/Controllers/Finance/DashboardController.php @@ -0,0 +1,17 @@ + 'Finance | Dashboard' + ]; + + return view('finance.dashboard', $data); + } +} diff --git a/app/Http/Controllers/LoginController.php b/app/Http/Controllers/LoginController.php index 780fb0d..a5b69fd 100755 --- a/app/Http/Controllers/LoginController.php +++ b/app/Http/Controllers/LoginController.php @@ -12,7 +12,6 @@ class LoginController extends Controller $data = [ 'designation' => $designation ]; - return view('login.index', $data); } @@ -35,10 +34,19 @@ class LoginController extends Controller \Log::info($logged_in->name . ' Successfully logged in at : ' . date('Y-m-d H:i:s')); $content = $logged_in->name . " Successfully Logged In"; - $this->logUsersActivity($type = 'staff', $content); + $this->logUsersActivity($type = 'staff', $content, $logged_in->id); $this->deleteLoggedUser(); $this->storeLoggedUser(); - return redirect(url('/')); + + switch ($logged_in->designation_info->name) { + case 'Accounts & Finance': + return redirect(url('finance')); + break; + + default: + return redirect(url('/')); + break; + } } public function handle_logout(Request $request) { @@ -51,7 +59,7 @@ class LoginController extends Controller $request->session()->flush(); $request->session()->regenerate(true); - $this->logUsersActivity($type = 'staff', $content); + $this->logUsersActivity($type = 'staff', $content, $user_id); return redirect("/"); } diff --git a/app/Http/Controllers/TestingController.php b/app/Http/Controllers/TestingController.php new file mode 100644 index 0000000..e9022c0 --- /dev/null +++ b/app/Http/Controllers/TestingController.php @@ -0,0 +1,10 @@ + $value->stage_id, 'client_id' => $row->id, 'name' => $value->name ]; + $progress_arr = [ + 'status' => 'PENDING' + ]; + $clients_onboarding_progress = Models\ClientOnboardingProgress::updateOrCreate($stage_id, $progress_arr); + } + $count_cl++; + } + dump($count_cl); + } + function massOnboardingProgress($client_id){ + //todo : update + /* + -- client_onboarding_sub_items -- this holds all sub items + -- client_onboarding_progress -- update to completed + -- in the clients table + -- onboarding_progress_stage == update to complete, + -- progress_indicator to complete, + -- progress_indicator_score to 100 + */ + $get_stage_subs_items = Models\ClientOnboardingSubItem::get(); + foreach ($get_stage_subs_items as $value) { + $progress_arr = [ + 'stage_id' => $value->stage_id, + 'client_id' => $client_id, + 'name' => $value->name, + 'status' => 'COMPLETE' + ]; + $clients_onboarding_progress = Models\ClientOnboardingProgress::create($progress_arr); + } + $all_clients = Models\Client::get(); + $count_cl = 0; + foreach ($all_clients as $row) { $get_stage_subs_items = Models\ClientOnboardingSubItem::get(); foreach ($get_stage_subs_items as $value) { $stage_id = ['stage_id' => $value->stage_id, 'client_id' => $row->id, 'name' => $value->name ]; @@ -50,3 +84,4 @@ class UtilityController extends Controller dump($count_cl); } } +// https://www.tokyvideo.com/video/sheena-the-queen-of-the-jungle-1984-movie-with-tanya-roberts-ted-wass-donovan-scott \ No newline at end of file diff --git a/app/Http/Middleware/CheckDesignation.php b/app/Http/Middleware/CheckDesignation.php new file mode 100644 index 0000000..3f8399a --- /dev/null +++ b/app/Http/Middleware/CheckDesignation.php @@ -0,0 +1,21 @@ +note; $emails = ['samuel@click-mobile.com']; @@ -39,6 +40,7 @@ class NewMnoNotesEmailAlerts implements ShouldQueue 'services' => $note->services, 'notes_body' => $note->notes_body ]; + \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->to($emails)->subject('New Notes on Mobile Operators'); diff --git a/app/Jobs/SendNewNotesEmailAlert.php b/app/Jobs/SendNewNotesEmailAlert.php index 6b8e99b..bc00fbd 100644 --- a/app/Jobs/SendNewNotesEmailAlert.php +++ b/app/Jobs/SendNewNotesEmailAlert.php @@ -42,6 +42,10 @@ class SendNewNotesEmailAlert implements ShouldQueue 'services' => $note->services, 'notes_body' => $note->notes_body ]; + + \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->to($emails)->subject('New Notes'); diff --git a/common-fixes.md b/common-fixes.md new file mode 100644 index 0000000..e04c578 --- /dev/null +++ b/common-fixes.md @@ -0,0 +1,20 @@ +# Inability to insert emojis into DB tables + +Step 1, change your database's default charset: + +ALTER DATABASE database_name CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; +if the db is not created yet, create it with correct encodings: + +CREATE DATABASE database_name DEFAULT CHARSET = utf8mb4 DEFAULT COLLATE = utf8mb4_unicode_ci; +Step 2, set charset when creating table: + +CREATE TABLE IF NOT EXISTS table_name ( +... +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci; +or alter table + +ALTER TABLE table_name CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; +ALTER TABLE table_name MODIFY field_name TEXT CHARSET utf8mb4; + +### Source +- https://stackoverflow.com/questions/39463134/how-to-store-emoji-character-in-mysql-database diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index 50fb93b..0000000 --- a/docker-compose.yml +++ /dev/null @@ -1,41 +0,0 @@ -version: '3' -services: - app: - image: 'php:7.4-fpm' - volumes: - - .:/var/www/html - working_dir: /var/www/html - networks: - - laravel - web: - image: 'nginx:latest' - ports: - - '82:82' - volumes: - - ./nginx.conf:/etc/nginx/conf.d/default.conf - depends_on: - - app - networks: - - laravel - mysql: - image: 'mysql:5.7' - environment: - MYSQL_DATABASE: laravel - MYSQL_ROOT_PASSWORD: secret - networks: - - laravel - redis: - image: 'redis:latest' - networks: - - laravel - worker: - build: - context: . - dockerfile: Dockerfile.worker - volumes: - - .:/var/www/html - working_dir: /var/www/html - networks: - - laravel -networks: - laravel: \ No newline at end of file diff --git a/public/assets/js/clientshow.js b/public/assets/js/clientshow.js index 7531e87..6c8f1d9 100644 --- a/public/assets/js/clientshow.js +++ b/public/assets/js/clientshow.js @@ -16,7 +16,7 @@ */ $('.progressIndicatorCheckbox').on('change', function() { // From the other examples - console.log('finker'); + // console.log('finker'); if (!this.checked) { var sure = confirm("Are you sure?"); this.checked = !sure; @@ -38,7 +38,7 @@ $('#newNotesForm').modal('show'); }); $('#progressIndicatorBtn').click(function(evt){ - console.log('foo bars'); + // console.log('foo bars'); evt.preventDefault(); $('#progressIndicatorDetailsModal').modal('show'); }); @@ -77,7 +77,7 @@ async: false, success: function (data){ if (data.code === 1) { - console.log(theIDD); + // console.log(theIDD); $('#paymentIdEdit').val(theIDD); $('#financeServicesEdit').val(data.services_arr).change(); $('#invoiceNumberEdit').val(data.result.invoice_number); @@ -111,7 +111,7 @@ tve.preventDefault(); //var theIDD = $("input[name=payment_entry_id]").val(); var theIDD = $(this).siblings('.notesRowId').val(); - console.log(theIDD); + // console.log(theIDD); $.ajax({ type: "GET", @@ -121,7 +121,7 @@ async: false, success: function (data){ if (data.code === 1) { - console.log(theIDD); + // console.log(theIDD); $('#noteIdEdit').val(theIDD); $('#notesServicesEdit').val(data.services_arr).change(); $('#notesBodyEdit').val(data.result.notes_body); @@ -226,11 +226,11 @@ //console.log(error); //console.log("AJAX error in request: " + JSON.stringify(err, null, 2)); var output = $.parseJSON(error.responseText); - console.log(output.errors); + // console.log(output.errors); $('#financeNotifyArea').removeClass('hidden'); $('#financeNotifyArea').addClass('alert alert-danger'); $.each(output.errors, function (key, value) { - console.log(value[0]); + // console.log(value[0]); $('#financeNotifyArea').text(value[0]); }); } @@ -276,7 +276,7 @@ $('#editNotesForm').submit(function(evt){ evt.preventDefault(); - console.log($(this).length); + // console.log($(this).length); var formData = new FormData($(this)[0]); $.ajax({ type: "POST", @@ -348,15 +348,15 @@ }, error: function (data) { var output = $.parseJSON(data.responseText); - console.log(output.errors); + // console.log(output.errors); $('#notifyArea').removeClass('hidden'); $.each(output.errors, function (key, value) { - console.log(value[0]); + // console.log(value[0]); $('#notifyArea').text(value[0]); }); }, fail : function(errordata){ - console.log(errordata); + // console.log(errordata); } }); }); diff --git a/public/assets/js/financedashboard.js b/public/assets/js/financedashboard.js new file mode 100644 index 0000000..11cc661 --- /dev/null +++ b/public/assets/js/financedashboard.js @@ -0,0 +1,25 @@ +$(document).ready(function(){ + /* + $.ajax({ + type: "get", + url: base_url + '/dashboard/get_events', + // data : formData, + processData: false, + contentType: false, + async: false, + success: function (data){ + //init_calendar(data); + }, + error: function(error){ + var output = $.parseJSON(error.responseText); + console.log(output.errors); + $('#ipNotifyArea').removeClass('hidden'); + $('#ipNotifyArea').addClass('alert alert-danger'); + $.each(output.errors, function (key, value) { + //console.log(value[0]); + $('#ipNotifyArea').text(value[0]); + }); + } + }); + */ +}); \ No newline at end of file diff --git a/resources/views/client/index-tabulator.blade.php b/resources/views/client/index-tabulator.blade.php index 618a04f..5e95f2e 100644 --- a/resources/views/client/index-tabulator.blade.php +++ b/resources/views/client/index-tabulator.blade.php @@ -108,7 +108,8 @@ field: "accountMgr", sorter: "string", }, - { title:"Progress", + /* + { title:"Onboarding Progress Score", field:"progress_indicator_score", sorter:"number", hozAlign:"left", @@ -116,6 +117,11 @@ width:200, editable:true }, + */ + { title:"Onboarding %", + field:"progress_indicator_score", + sorter:"number", + }, { title: "Status", field: "status", diff --git a/resources/views/client/onboarding_show.blade.php b/resources/views/client/onboarding_show.blade.php index e2ad55d..f3c483b 100644 --- a/resources/views/client/onboarding_show.blade.php +++ b/resources/views/client/onboarding_show.blade.php @@ -29,42 +29,36 @@
:message
') !!} -| Stage | +Activity | +Status | +|||
|---|---|---|---|---|---|
| No Records found | +|||||
| {{ $row->stage_id }} | +{{ $row->name }} | ++ {{ $row->status }} + + | +|||
- {{ $indirow }} + {{ $key }}
- {{ $indirow }} + {{ $indkey }}
| Invoice | +Invoice Date | +Order | +Amount | + +
|---|---|---|---|
| 121000040 | +May 23, 2014 11:47:56 PM | +121000210 | +Paid | +
| 121000040 | +May 23, 2014 11:47:56 PM | +121000210 | +Paid | +