fixed shortcode edit issues plus refactoring

This commit is contained in:
Kwesi Banson Jnr
2026-02-05 08:38:07 +00:00
parent 063572463b
commit 9cd017fb9a
20 changed files with 655 additions and 117 deletions

View File

@@ -98,9 +98,24 @@ class ShortCodesController extends Controller{
->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,
@@ -145,9 +160,23 @@ class ShortCodesController extends Controller{
->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,
@@ -181,6 +210,10 @@ class ShortCodesController extends Controller{
}
return response()->json($shortcode_arr);
}
public function handle_delete($id){
$result = Models\ClientShortCode::destroy($id);
return response()->json(['code' => 1, 'msg' => $result]);
}