bug fixes and new additions
This commit is contained in:
@@ -19,9 +19,22 @@ class ShortCodesController extends Controller{
|
||||
];
|
||||
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')
|
||||
@@ -44,12 +57,14 @@ class ShortCodesController extends Controller{
|
||||
'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();
|
||||
//$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')
|
||||
@@ -57,7 +72,7 @@ class ShortCodesController extends Controller{
|
||||
->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.shortcode', 'ASC')
|
||||
->orderBy('client_short_codes.created_at', 'DESC')
|
||||
->paginate(15);
|
||||
|
||||
if($request->has('keyword')){
|
||||
@@ -69,7 +84,7 @@ class ShortCodesController extends Controller{
|
||||
->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.shortcode', 'ASC')
|
||||
->orderBy('client_short_codes.created_at', 'DESC')
|
||||
->paginate(15);
|
||||
}
|
||||
return response()->json($shortcode_arr);
|
||||
@@ -77,6 +92,8 @@ class ShortCodesController extends Controller{
|
||||
|
||||
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')
|
||||
@@ -85,8 +102,11 @@ class ShortCodesController extends Controller{
|
||||
'page_title' => 'Short Codes',
|
||||
'type' => 'USSD',
|
||||
'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){
|
||||
@@ -98,7 +118,7 @@ class ShortCodesController extends Controller{
|
||||
->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.shortcode', 'ASC')
|
||||
->orderBy('client_short_codes.created_at', 'DESC')
|
||||
->paginate(15);
|
||||
|
||||
if($request->has('keyword')){
|
||||
@@ -110,7 +130,7 @@ class ShortCodesController extends Controller{
|
||||
->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.shortcode', 'ASC')
|
||||
->orderBy('client_short_codes.created_at', 'DESC')
|
||||
->paginate(15);
|
||||
}
|
||||
return response()->json($shortcode_arr);
|
||||
@@ -119,6 +139,8 @@ class ShortCodesController extends Controller{
|
||||
|
||||
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')
|
||||
@@ -127,6 +149,8 @@ class ShortCodesController extends Controller{
|
||||
'page_title' => 'Short Codes',
|
||||
'type' => 'Voice',
|
||||
'codes_data' => $codes_data,
|
||||
'country_network_arr' => $country_networks,
|
||||
'client_arr' => $client_arr,
|
||||
'current_user' => session('current_user')
|
||||
];
|
||||
return view('shortcodes.voiceindex', $data);
|
||||
@@ -140,7 +164,7 @@ class ShortCodesController extends Controller{
|
||||
->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.shortcode', 'ASC')
|
||||
->orderBy('client_short_codes.created_at', 'DESC')
|
||||
->paginate(15);
|
||||
|
||||
if($request->has('keyword')){
|
||||
@@ -152,7 +176,7 @@ class ShortCodesController extends Controller{
|
||||
->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.shortcode', 'ASC')
|
||||
->orderBy('client_short_codes.created_at', 'DESC')
|
||||
->paginate(15);
|
||||
}
|
||||
return response()->json($shortcode_arr);
|
||||
|
||||
Reference in New Issue
Block a user