diff --git a/app/Http/Controllers/ClientsController.php b/app/Http/Controllers/ClientsController.php index 62b1c0e..dad0a0e 100755 --- a/app/Http/Controllers/ClientsController.php +++ b/app/Http/Controllers/ClientsController.php @@ -854,21 +854,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', diff --git a/app/Http/Controllers/ShortCodesController.php b/app/Http/Controllers/ShortCodesController.php new file mode 100644 index 0000000..b4af376 --- /dev/null +++ b/app/Http/Controllers/ShortCodesController.php @@ -0,0 +1,151 @@ + 'Short Codes', + 'type' => 'SMS', + 'current_user' => session('current_user') + ]; + return view('shortcodes.index', $data); + } + + public function smsindex(){ + // $codes_data = Models\ClientShortCode::groupBy('code_type')->get(); + $codes_data = \DB::table('client_short_codes') + ->select('code_type', \DB::raw('count(*) as total')) + ->groupBy('code_type') + ->get(); + $data = [ + 'page_title' => 'Short Codes', + 'type' => 'SMS', + 'codes_data' => $codes_data, + '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.status', 'client_short_codes.remarks', 'client_short_codes.launch_date', 'client_short_codes.expiry_date', 'client_short_codes.last_updated_by', 'auth_users.name AS modifiedBy') + ->where('client_short_codes.code_type', 'sms') + ->orderBy('client_short_codes.shortcode', 'ASC') + ->paginate(15); + + 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.status', 'client_short_codes.remarks', 'client_short_codes.launch_date', 'client_short_codes.expiry_date', 'client_short_codes.last_updated_by', 'auth_users.name AS modifiedBy') + ->whereRaw("code_type = '$code_type' AND (client_short_codes.name LIKE '%$keyword%' OR client_short_codes.shortcode LIKE '%$keyword%' OR client_short_codes.status LIKE '%$keyword%' OR client_short_codes.network LIKE '%$keyword%' OR client_short_codes.toll_free LIKE '%$keyword%' OR client_short_codes.launch_date LIKE '%$keyword%' OR client_short_codes.expiry_date LIKE '%$keyword%' OR clients.name LIKE '%$keyword%' OR auth_users.name LIKE '%$keyword%')") + // ->where('code_type', $code_type) + ->orderBy('client_short_codes.shortcode', 'ASC') + ->paginate(15); + } + return response()->json($shortcode_arr); + } + + public function ussdindex(){ + // $codes_data = Models\ClientShortCode::groupBy('code_type')->get(); + $codes_data = \DB::table('client_short_codes') + ->select('code_type', \DB::raw('count(*) as total')) + ->groupBy('code_type') + ->get(); + $data = [ + 'page_title' => 'Short Codes', + 'type' => 'USSD', + 'codes_data' => $codes_data, + '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.status', 'client_short_codes.remarks', 'client_short_codes.launch_date', 'client_short_codes.expiry_date', 'client_short_codes.last_updated_by', 'auth_users.name AS modifiedBy') + ->where('client_short_codes.code_type', 'ussd') + ->orderBy('client_short_codes.shortcode', 'ASC') + ->paginate(15); + + 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.status', 'client_short_codes.remarks', 'client_short_codes.launch_date', 'client_short_codes.expiry_date', 'client_short_codes.last_updated_by', 'auth_users.name AS modifiedBy') + ->whereRaw("code_type = '$code_type' AND (client_short_codes.name LIKE '%$keyword%' OR client_short_codes.shortcode LIKE '%$keyword%' OR client_short_codes.status LIKE '%$keyword%' OR client_short_codes.network LIKE '%$keyword%' OR client_short_codes.toll_free LIKE '%$keyword%' OR client_short_codes.launch_date LIKE '%$keyword%' OR client_short_codes.expiry_date LIKE '%$keyword%' OR clients.name LIKE '%$keyword%' OR auth_users.name LIKE '%$keyword%')") + // ->where('code_type', $code_type) + ->orderBy('client_short_codes.shortcode', 'ASC') + ->paginate(15); + } + return response()->json($shortcode_arr); + } + + + public function voiceindex(){ + // $codes_data = Models\ClientShortCode::groupBy('code_type')->get(); + $codes_data = \DB::table('client_short_codes') + ->select('code_type', \DB::raw('count(*) as total')) + ->groupBy('code_type') + ->get(); + $data = [ + 'page_title' => 'Short Codes', + 'type' => 'Voice', + 'codes_data' => $codes_data, + '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.status', 'client_short_codes.remarks', 'client_short_codes.launch_date', 'client_short_codes.expiry_date', 'client_short_codes.last_updated_by', 'auth_users.name AS modifiedBy') + ->where('client_short_codes.code_type', 'voice') + ->orderBy('client_short_codes.shortcode', 'ASC') + ->paginate(15); + + 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.status', 'client_short_codes.remarks', 'client_short_codes.launch_date', 'client_short_codes.expiry_date', 'client_short_codes.last_updated_by', 'auth_users.name AS modifiedBy') + ->whereRaw("code_type = '$code_type' AND (client_short_codes.name LIKE '%$keyword%' OR client_short_codes.shortcode LIKE '%$keyword%' OR client_short_codes.status LIKE '%$keyword%' OR client_short_codes.network LIKE '%$keyword%' OR client_short_codes.toll_free LIKE '%$keyword%' OR client_short_codes.launch_date LIKE '%$keyword%' OR client_short_codes.expiry_date LIKE '%$keyword%' OR clients.name LIKE '%$keyword%' OR auth_users.name LIKE '%$keyword%')") + // ->where('code_type', $code_type) + ->orderBy('client_short_codes.shortcode', 'ASC') + ->paginate(15); + } + return response()->json($shortcode_arr); + } + + + + + +} diff --git a/resources/views/client/partials/shortcode-index.blade.php b/resources/views/client/partials/shortcode-index.blade.php index 91c0f1d..e0f30b0 100644 --- a/resources/views/client/partials/shortcode-index.blade.php +++ b/resources/views/client/partials/shortcode-index.blade.php @@ -1,6 +1,6 @@
- +
{{-- --}} @@ -14,7 +14,7 @@ - + @@ -26,15 +26,23 @@ @foreach ($codes_data as $row) - + - - + +
#Renewal Date Action
{{ $row->name }}{{ $row->shortcode }}{{ $row->shortcode }} {{ $row->network }}{{ strtoupper($row->toll_free) }}{{ $row->status }}{{ strtoupper($row->toll_free) }} + + + status) ?> + {{ $row->status }} + + {{ $row->remarks }} {{ date('d-m-Y', strtotime($row->launch_date)) }} @if($row->expiry_date == false) - {{ "No found"}} + {{ "N/A"}} @else {{ date('d-m-Y', strtotime($row->expiry_date)) }} @endif @@ -51,4 +59,4 @@
-
\ No newline at end of file + diff --git a/resources/views/client/shortcodes.blade.php b/resources/views/client/shortcodes.blade.php index 5c5a73f..908ff32 100644 --- a/resources/views/client/shortcodes.blade.php +++ b/resources/views/client/shortcodes.blade.php @@ -19,7 +19,7 @@
- +
@@ -47,11 +47,12 @@

@if($type == 'voice') - {{ ucfirst($type) }} Short Code + {{ ucfirst($type) }} Short Code @else - {{ strtoupper($type) }} Short Code + {{ strtoupper($type) }} Short Code @endif

+ @include('client.partials.shortcode-index')
@@ -66,7 +67,7 @@ @section('javascript') diff --git a/resources/views/layouts/partials/sidebar.blade.php b/resources/views/layouts/partials/sidebar.blade.php index c1725db..e5a696a 100644 --- a/resources/views/layouts/partials/sidebar.blade.php +++ b/resources/views/layouts/partials/sidebar.blade.php @@ -2,15 +2,8 @@ + + +@endsection + +@section('javascript') + + + + + + +@endsection diff --git a/resources/views/shortcodes/partials/shortcode-index.blade.php b/resources/views/shortcodes/partials/shortcode-index.blade.php new file mode 100644 index 0000000..e0f30b0 --- /dev/null +++ b/resources/views/shortcodes/partials/shortcode-index.blade.php @@ -0,0 +1,62 @@ +
+
+ + + + {{-- --}} + + + + + + + + + + + + + + @if ($codes_data->isEmpty()) + + + + @else + @foreach ($codes_data as $row) + + + + + + + + + + + + + @endforeach + @endif + +
#NameCodeNetworkToll FreeStatusRemarksLaunch DateRenewal DateAction +
No Records found
{{ $row->name }}{{ $row->shortcode }}{{ $row->network }}{{ strtoupper($row->toll_free) }} + + + status) ?> + {{ $row->status }} + + {{ $row->remarks }}{{ date('d-m-Y', strtotime($row->launch_date)) }} + @if($row->expiry_date == false) + {{ "N/A"}} + @else + {{ date('d-m-Y', strtotime($row->expiry_date)) }} + @endif + + + + +
+
+
diff --git a/resources/views/shortcodes/shortcodes.blade.php b/resources/views/shortcodes/shortcodes.blade.php new file mode 100644 index 0000000..8330b1e --- /dev/null +++ b/resources/views/shortcodes/shortcodes.blade.php @@ -0,0 +1,172 @@ +@extends('layouts.master') + @section('page_title') + @if(isset($page_title)) + {{ $page_title }} + @endif + @endsection + +@section('content') +
+
+
+
+ +
+
+ +
+ +
+
+
+
+
+
+
+
+ +
+
+ @include('commons.notifications') +
+
+
+

Client Short Codes

+
+ +
+
+
+ +
+
+
+

+ @if($type == 'voice') + {{ ucfirst($type) }} Short Code + @else + {{ strtoupper($type) }} Short Code + @endif +

+ + @include('client.partials.shortcode-index') +
+
+
+
+
+
+
+ +@endsection + +@section('javascript') + + + + + + +@endsection diff --git a/resources/views/shortcodes/smsindex.blade.php b/resources/views/shortcodes/smsindex.blade.php new file mode 100644 index 0000000..d80141a --- /dev/null +++ b/resources/views/shortcodes/smsindex.blade.php @@ -0,0 +1,196 @@ +@extends('layouts.master') + @section('page_title') + @if(isset($page_title)) + {{ $page_title }} + @endif + @endsection + @section('css') + + @endsection +@section('content') +
+
+
+
+ +
+
+ +
+ + +
+
+ +
+
+ @include('commons.notifications') +
+
+
+

Client Short Codes

+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+ +
+ +
+ +
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+ +@endsection + +@section('javascript') + + + + + + +@endsection diff --git a/resources/views/shortcodes/ussdindex.blade.php b/resources/views/shortcodes/ussdindex.blade.php new file mode 100644 index 0000000..c08322a --- /dev/null +++ b/resources/views/shortcodes/ussdindex.blade.php @@ -0,0 +1,190 @@ +@extends('layouts.master') + @section('page_title') + @if(isset($page_title)) + {{ $page_title }} + @endif + @endsection + @section('css') + + @endsection +@section('content') +
+
+
+
+ +
+
+ +
+ + +
+
+ +
+
+ @include('commons.notifications') +
+
+
+

USSD Short Codes

+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+ +
+ +
+ +
+
+
+
+ +
+
+
+
+
+
+ +@endsection + +@section('javascript') + + + + + + +@endsection diff --git a/resources/views/shortcodes/voiceindex.blade.php b/resources/views/shortcodes/voiceindex.blade.php new file mode 100644 index 0000000..90c7df8 --- /dev/null +++ b/resources/views/shortcodes/voiceindex.blade.php @@ -0,0 +1,189 @@ +@extends('layouts.master') + @section('page_title') + @if(isset($page_title)) + {{ $page_title }} + @endif + @endsection + @section('css') + + @endsection +@section('content') +
+
+
+
+ +
+
+ +
+ + +
+
+ +
+
+ @include('commons.notifications') +
+
+
+

Voice Short Codes

+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+ +
+ +
+ +
+
+
+
+
+
+
+
+
+
+ +@endsection + +@section('javascript') + + + + + + +@endsection diff --git a/routes/web.php b/routes/web.php index 222ae22..aafa9b3 100755 --- a/routes/web.php +++ b/routes/web.php @@ -41,6 +41,7 @@ Route::get('paperless', 'UtilityController@paperlessTest'); Route::get('paperless_getparams/{name}', 'UtilityController@getPaperlessAttributes'); + Route::get('testmap', 'UtilityController@maptest'); Route::get('login', 'LoginController@getLoginPage'); @@ -86,6 +87,16 @@ Route::group(['middleware' => ['checklogin', 'checkcurrentlylogged']], function( Route::resource('generaldocuments', 'GeneralDocumentsController'); + Route::get('smsshortcodes/all', 'ShortCodesController@getShortCodesJson'); + Route::get('smsshortcodes', 'ShortCodesController@smsindex'); + + Route::get('ussdshortcodes/all', 'ShortCodesController@getUssdShortCodesJson'); + Route::get('ussdshortcodes', 'ShortCodesController@ussdindex'); + + Route::get('voiceshortcodes/all', 'ShortCodesController@getVoiceShortCodesJson'); + Route::get('voiceshortcodes', 'ShortCodesController@voiceindex'); + + Route::get('senderids/all', 'SenderIdController@getSenderIdsJson'); Route::resource('senderids', 'SenderIdController');