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

@@ -23,7 +23,6 @@ class LoginController extends Controller
return redirect(url('login'))->withErrors("No session found. You need to be logged in!"); return redirect(url('login'))->withErrors("No session found. You need to be logged in!");
} }
$otp_code = Str::random(6); $otp_code = Str::random(6);
\Log::info($otp_code);
request()->session()->put('current_otpuser.otp', $otp_code); request()->session()->put('current_otpuser.otp', $otp_code);
$otp_user = session('current_otpuser'); $otp_user = session('current_otpuser');
@@ -33,6 +32,7 @@ class LoginController extends Controller
'auth_name' => $otp_user['name'] 'auth_name' => $otp_user['name']
]; ];
dispatch(new SendOtpEmailAlert($otp_set)); dispatch(new SendOtpEmailAlert($otp_set));
\Log::info($otp_code);
$data = [ $data = [
'otp_user_id' => $otp_user['id'], 'otp_user_id' => $otp_user['id'],
'page_title' => 'Login OTP', 'page_title' => 'Login OTP',
@@ -46,6 +46,9 @@ class LoginController extends Controller
return redirect(url('login'))->withErrors("$random | You need to be logged in "); return redirect(url('login'))->withErrors("$random | You need to be logged in ");
} }
$otp_user = session('current_otpuser'); $otp_user = session('current_otpuser');
// dump(session('current_otpuser.otp'));
\Log::info(session('current_otpuser.otp'));
$data = [ $data = [
'otp_user_id' => $otp_user['id'], 'otp_user_id' => $otp_user['id'],
'page_title' => 'Login OTP', 'page_title' => 'Login OTP',

View File

@@ -353,6 +353,7 @@ class NetworkOperatorsController extends Controller
$status_bg = "danger"; $status_bg = "danger";
} }
$rate_types = ['flat_rate' => 'Flat Rate', 'sliding' => 'Sliding Scale']; $rate_types = ['flat_rate' => 'Flat Rate', 'sliding' => 'Sliding Scale'];
$contract_types = ['Bilateral' => 'Bilateral', 'Unilateral' => 'Unilateral'];
$data = [ $data = [
'page_title' => 'Edit Network Operator', 'page_title' => 'Edit Network Operator',
'network_arr' => $network_arr, 'network_arr' => $network_arr,
@@ -375,7 +376,8 @@ class NetworkOperatorsController extends Controller
'ip_addresses' => $ip_addresses, 'ip_addresses' => $ip_addresses,
'notes_arr' => $notes_arr, 'notes_arr' => $notes_arr,
'recent_payments' => $recent_payments, '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); return view('network_ops.edit', $data);
} }

View File

@@ -98,9 +98,24 @@ class ShortCodesController extends Controller{
->select('code_type', \DB::raw('count(*) as total')) ->select('code_type', \DB::raw('count(*) as total'))
->groupBy('code_type') ->groupBy('code_type')
->get(); ->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 = [ $data = [
'page_title' => 'Short Codes', 'page_title' => 'Short Codes',
'type' => 'USSD', 'type' => 'USSD',
'networks_raw' => array_combine($networks_raw, $networks_raw),
'codes_data' => $codes_data, 'codes_data' => $codes_data,
'country_network_arr' => $country_networks, 'country_network_arr' => $country_networks,
'client_arr' => $client_arr, 'client_arr' => $client_arr,
@@ -145,9 +160,23 @@ class ShortCodesController extends Controller{
->select('code_type', \DB::raw('count(*) as total')) ->select('code_type', \DB::raw('count(*) as total'))
->groupBy('code_type') ->groupBy('code_type')
->get(); ->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 = [ $data = [
'page_title' => 'Short Codes', 'page_title' => 'Short Codes',
'type' => 'Voice', 'type' => 'Voice',
'networks_raw' => array_combine($networks_raw, $networks_raw),
'codes_data' => $codes_data, 'codes_data' => $codes_data,
'country_network_arr' => $country_networks, 'country_network_arr' => $country_networks,
'client_arr' => $client_arr, 'client_arr' => $client_arr,
@@ -181,6 +210,10 @@ class ShortCodesController extends Controller{
} }
return response()->json($shortcode_arr); return response()->json($shortcode_arr);
} }
public function handle_delete($id){
$result = Models\ClientShortCode::destroy($id);
return response()->json(['code' => 1, 'msg' => $result]);
}

View File

@@ -8,6 +8,8 @@ use App\Models;
use Spatie\Activitylog\Models\Activity; use Spatie\Activitylog\Models\Activity;
use Illuminate\Contracts\Mail\Mailer; use Illuminate\Contracts\Mail\Mailer;
use App\Jobs\SendTestEmail; use App\Jobs\SendTestEmail;
use App\Notifications\EmailNotification;
class UtilityController extends Controller class UtilityController extends Controller
{ {
@@ -247,5 +249,16 @@ class UtilityController extends Controller
} }
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 // https://www.tokyvideo.com/video/sheena-the-queen-of-the-jungle-1984-movie-with-tanya-roberts-ted-wass-donovan-scott

View File

@@ -21,6 +21,9 @@ class CheckCurrentlyLoggedInUsers
$device = $request->server('HTTP_USER_AGENT'); $device = $request->server('HTTP_USER_AGENT');
$realm = $id . $device; $realm = $id . $device;
$current_user = Models\LoggedUser::where('user_id', $id)->where('device', $device)->first(); $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->last_seen_time = date('Y-m-d H:i:s');
$current_user->ip_address = \Request::ip(); $current_user->ip_address = \Request::ip();
@@ -29,3 +32,6 @@ class CheckCurrentlyLoggedInUsers
return $next($request); return $next($request);
} }
} }

View File

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

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

@@ -11,6 +11,7 @@
"laravel/tinker": "~1.0", "laravel/tinker": "~1.0",
"laravelcollective/html": "^5.4.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" "thibaud-dauce/laravel-mattermost-logger": "^1.2"
}, },
"require-dev": { "require-dev": {

149
composer.lock generated
View File

@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "d6b526be34793fb2333359d042baaf53", "content-hash": "55c340daa242a9f806959c576ed88b31",
"packages": [ "packages": [
{ {
"name": "dnoegel/php-xdg-base-dir", "name": "dnoegel/php-xdg-base-dir",
@@ -2004,6 +2004,92 @@
}, },
"time": "2020-10-15T08:29:30+00:00" "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", "name": "phpoffice/phpspreadsheet",
"version": "1.29.0", "version": "1.29.0",
@@ -2496,6 +2582,67 @@
}, },
"time": "2019-12-06T14:19:43+00:00" "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", "name": "ralouphie/getallheaders",
"version": "3.0.3", "version": "3.0.3",

View File

@@ -5,3 +5,7 @@
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`) 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 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'); ('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

View File

@@ -1,8 +1,107 @@
$(document).ready(function(){ $(document).ready(function(){
console.log('foo bar');
$('.scdates').datetimepicker({ $('.scdates').datetimepicker({
format: 'YYYY-MM-DD' format: 'YYYY-MM-DD'
}); });
$('select').select2(); $('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){ $('#createSmsShortCodeBtn').click(function(evt){
evt.preventDefault(); evt.preventDefault();
$('#shortCodeType').val('sms'); $('#shortCodeType').val('sms');

View File

@@ -34,3 +34,5 @@ Approved on Aggregator
Active Active
InActive InActive
Prefix Tab on MNO module
Email ref : Fw: Ocotber 2025 Usage Invoice and Traffic Report

View File

@@ -163,6 +163,13 @@
{!! $errors->first('support_phones', '<p class="help-block">:message</p>') !!} {!! $errors->first('support_phones', '<p class="help-block">:message</p>') !!}
</div> </div>
</div> </div>
<div class="form-group">
<label class="" for="contractType">Contract Type</label>
<div class=" {{ $errors->has('contract_type') ? 'has-error' : ''}}">
{!! Form::select('contract_type', $contract_types, old('contract_type'), ['class' => 'form-control ', 'placeholder'=>'Select Contract type' , 'id' => 'contractType']) !!}
{!! $errors->first('contract_type', '<p class="help-block">:message</p>') !!}
</div>
</div>
<div class="form-group"> <div class="form-group">
<label class="" for="contractValidity">Contract Validity</label> <label class="" for="contractValidity">Contract Validity</label>
<div class=" {{ $errors->has('contract_validity') ? 'has-error' : ''}}"> <div class=" {{ $errors->has('contract_validity') ? 'has-error' : ''}}">

View File

@@ -75,7 +75,7 @@
</div> </div>
<div class="col-md-4"> <div class="col-md-4">
<h4 class="green">Company Details</h4> <h4 class="green">Company Details</h4>
<table class="table"> <table class="table table-bordered table-word-wrap">
<tr> <tr>
<th>Name</th> <th>Name</th>
<td>{{ $mnoshow->country }}</td> <td>{{ $mnoshow->country }}</td>
@@ -90,7 +90,7 @@
</tr> </tr>
<tr> <tr>
<th>Support Emails</th> <th>Support Emails</th>
<td> <td >
<?php <?php
echo ($mnoshow->support_emails) ? implode(',', json_decode($mnoshow->support_emails)) : ""; echo ($mnoshow->support_emails) ? implode(',', json_decode($mnoshow->support_emails)) : "";
?> ?>
@@ -121,7 +121,7 @@
</td> </td>
</tr> </tr>
<tr> <tr>
<th>Finace Contact Person</th> <th>Finance Contact Person</th>
<td> <td>
<?php <?php
echo ($mnoshow->contact_person_finance) ?? "N/A"; echo ($mnoshow->contact_person_finance) ?? "N/A";
@@ -134,7 +134,7 @@
</div> </div>
<div class="col-md-4"> <div class="col-md-4">
<h4 class="green">Operations </h4> <h4 class="green">Operations </h4>
<table class="table"> <table class="table table-word-wrap">
<tr> <tr>
<th>Services</th> <th>Services</th>
<td class=""> <td class="">

View File

@@ -0,0 +1,118 @@
<div class="modal fade" id="shortCodeEditMain" tabindex="-1" role="dialog" aria-labelledby="shortCodeEditModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<!-- <h4 class="modal-title">Default Modal</h4> -->
<h5 class="modal-title text-center" id="shortCodeEditModalLabelHeading">Edit Short Code Form</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<div id="notifyAreaEdit" class="alert alert-danger hidden"></div>
<form class="form-vertical" method="POST" id="shortCodeEditForm" action="{{ url('clients/shortcodes_update') }}">
{{ csrf_field() }}
<input type="hidden" name="shortcode_id" id="shortCodeIDEdit">
<input type="hidden" name="code_type" id="shortCodeTypeEdit">
<input type="hidden" name="client_id" id="shortCodeClientIdEdit">
<div class="row">
<div class="form-group" >
<div class="col-md-12" style="padding-bottom: 5px;">
<label for="nameEdit">Friendly Name *</label>
<input type="text" class="form-control" name="name" id="nameEdit" required >
</div>
</div>
<div class="form-group">
<div class="col-md-12" style="padding-bottom: 5px">
<label for="networks">Network *</label>
<!-- 'multiple'=> 'true', -->
{!! Form::select('network', $networks_raw, null, ['class' => 'form-control' , 'id' => 'networks', 'required' => 'required', 'style' => 'width: 100%']) !!}
</div>
</div>
<div class="form-group" >
<div class="col-md-12" style="padding-bottom: 5px;">
<label for="shortCodeEdit">Code *</label>
<input type="number" class="form-control" name="shortcode" id="shortCodeEdit" required >
</div>
</div>
<div class="form-group">
<div class="col-md-12" style="padding-bottom: 5px">
<label for="tollFreeEdit">Toll Free</label>
<select name="toll_free" id="tollFreeEdit" class="form-control" required style="width: 100%;">
<option value="YES">YES</option>
<option value="NO">NO</option>
</select>
</div>
</div>
<div class="form-group">
<div class="col-md-12" style="padding-bottom: 5px">
<label for="monthlyFeeEdit">Monthly Fee</label>
<input type="number" class="form-control" name="monthly_fee" id="monthlyFeeEdit" >
</div>
</div>
<div class="form-group">
<div class="col-md-6">
<div class='input-group date' id='myDatepicker22Edit' style="padding-bottom: 5px;">
<label for="launchDateEdit">Launch Date</label>
<input type="text" class="form-control" name="launch_date" id="launchDateEdit" required >
<div class="input-group-addon">
<span class="fa fa-calendar"></span>
</div>
</div>
</div>
<div class="col-md-6">
<div class='input-group date' id='myDatepicker223Edit' style="padding-bottom: 5px;">
<label for="expiryDateEdit">Expiry Date</label>
<input type="text" class="form-control" name="expiry_date" id="expiryDateEdit" required >
<div class="input-group-addon">
<span class="fa fa-calendar"></span>
</div>
</div>
</div>
</div>
<div class="form-group">
<div class="col-md-12" style="padding-bottom: 5px">
<label for="codeStatusEdit">Status</label>
<select id="codeStatusEdit" name="status" class="form-control" required style="width: 100%;">
<option value="LIVE">Live</option>
<option value="PENDING">Pending</option>
<option value="TESTING">Testing</option>
<option value="INACTIVE">Inactive </option>
</select>
</div>
</div>
<div class="form-group" >
<div class="col-md-12" style="padding-bottom: 5px;">
<label for="remarksEdit">Remarks</label>
<input type="text" class="form-control" name="remarks" id="remarksEdit"></textarea>
</div>
</div>
<div class="form-group" style="margin-bottom: 0.2rem; padding-bottom: 5px; padding-top: 5px;">
<div class="col-md-12" style="padding-bottom: 10px;">
<button type="submit" class="btn btn-success btn-block updateBtn"> <i class="fa fa-send"></i> Submit</button>
</div>
</div>
<div class="form-group" style="margin-bottom: 0.2rem; padding-bottom: 5px; padding-top: 5px;">
<div class="col-md-12" style="padding-bottom: 10px;">
<button type="button" class="btn btn-danger btn-block shortCodeDelBtn"> <i class="fa fa-trash"></i> Delete</button>
</div>
</div>
<div class="form-group" style="margin-bottom: 0.5rem; padding-bottom: 5px; padding-top: 5px;">
<div class="col-md-12">
<button type="button" class="btn btn-dark btn-block" data-dismiss="modal"><i class="fa fa-close"></i> Close</button>
</div>
</div>
</div>
</form>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- /.modal -->

View File

@@ -9,7 +9,7 @@
@endsection @endsection
@section('content') @section('content')
@include('shortcodes.partials.create') @include('shortcodes.partials.create')
@include('client.partials.edit-shortcodes') @include('shortcodes.partials.edit-short-code')
<div class=""> <div class="">
<div class="page-title"> <div class="page-title">
@@ -93,6 +93,7 @@
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function(){ $(document).ready(function(){
$('#shortCodeEditForm').submit(function(evt){ $('#shortCodeEditForm').submit(function(evt){
evt.preventDefault(); evt.preventDefault();
var formData = new FormData($(this)[0]); var formData = new FormData($(this)[0]);
@@ -130,49 +131,7 @@
}); });
}); });
$(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);
$('#shortCodeEditModal').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 !',
});
}
}
});
});
function getShortCodeDetails(id){ function getShortCodeDetails(id){
alert('heere at the wall from that side ' + id); alert('heere at the wall from that side ' + id);
} }
@@ -220,6 +179,7 @@
title: "Short Code", title: "Short Code",
field: "shortcode", field: "shortcode",
sorter: "string", sorter: "string",
formatter:link,
}, },
{ title:"Network", { title:"Network",
field:"network", field:"network",

View File

@@ -9,6 +9,7 @@
@endsection @endsection
@section('content') @section('content')
@include('shortcodes.partials.create') @include('shortcodes.partials.create')
@include('shortcodes.partials.edit-short-code')
<div class=""> <div class="">
<div class="page-title"> <div class="page-title">
<div class="title_left"> <div class="title_left">
@@ -91,11 +92,25 @@
return "<a href='"+ base_url + "/ussdshortcodes/"+rowID+"' class='btn btn-link'>"+url+"</a>"; return "<a href='"+ base_url + "/ussdshortcodes/"+rowID+"' class='btn btn-link'>"+url+"</a>";
//return '<a href="'+ base_url + '"/clients/"'+rowID+'" class="btn btn-link">'+ url +'</a>'; //return '<a href="'+ base_url + '"/clients/"'+rowID+'" class="btn btn-link">'+ url +'</a>';
} }
function link(cell, formatterParams){ function linkOld(cell, formatterParams){
var url = cell.getValue(); var url = cell.getValue();
var rowID = cell.getData().id var rowID = cell.getData().id
return "<a href='"+ base_url + "/ussdshortcodes/"+rowID+"/edit' class='btn btn-link'>"+url+"</a>"; return "<a href='"+ base_url + "/ussdshortcodes/"+rowID+"/edit' class='btn btn-link'>"+url+"</a>";
} }
function link(cell, formatterParams){
var url = cell.getValue();
var rowID = cell.getData().id
//use rowID to fetch details from DB and populate form on the modal
// return "<a href='"+ base_url + "/smsshortcodes/"+rowID+"/edit' class='btn btn-link' >"+url+"</a>";
//return "<input type='button' class='btn btn-link linkButton' value='" + url + "' name='" + url + "'/>";
return "<input type='hidden' class='hiddenInput' value='" + rowID + "' name='" + url + "'/><button type='button' class='btn btn-link linkButton' >"+url+"</button>";
// return "<a href='' class='btn btn-link'>"+url+"</a>";
}
function cellDesign (cell, formatterParams){ function cellDesign (cell, formatterParams){
var value = cell.getValue(); var value = cell.getValue();
return "<span style='color:#54B4D3; font-weight:bold;'>" + value + "</span>"; return "<span style='color:#54B4D3; font-weight:bold;'>" + value + "</span>";

View File

@@ -9,6 +9,7 @@
@endsection @endsection
@section('content') @section('content')
@include('shortcodes.partials.create') @include('shortcodes.partials.create')
@include('shortcodes.partials.edit-short-code')
<div class=""> <div class="">
<div class="page-title"> <div class="page-title">
<div class="title_left"> <div class="title_left">
@@ -89,11 +90,23 @@
return "<a href='"+ base_url + "/voiceshortcodes/"+rowID+"' class='btn btn-link'>"+url+"</a>"; return "<a href='"+ base_url + "/voiceshortcodes/"+rowID+"' class='btn btn-link'>"+url+"</a>";
//return '<a href="'+ base_url + '"/clients/"'+rowID+'" class="btn btn-link">'+ url +'</a>'; //return '<a href="'+ base_url + '"/clients/"'+rowID+'" class="btn btn-link">'+ url +'</a>';
} }
function link(cell, formatterParams){ function linkold(cell, formatterParams){
var url = cell.getValue(); var url = cell.getValue();
var rowID = cell.getData().id var rowID = cell.getData().id
return "<a href='"+ base_url + "/voiceshortcodes/"+rowID+"/edit' class='btn btn-link'>"+url+"</a>"; return "<a href='"+ base_url + "/voiceshortcodes/"+rowID+"/edit' class='btn btn-link'>"+url+"</a>";
} }
function link(cell, formatterParams){
var url = cell.getValue();
var rowID = cell.getData().id
//use rowID to fetch details from DB and populate form on the modal
// return "<a href='"+ base_url + "/smsshortcodes/"+rowID+"/edit' class='btn btn-link' >"+url+"</a>";
//return "<input type='button' class='btn btn-link linkButton' value='" + url + "' name='" + url + "'/>";
return "<input type='hidden' class='hiddenInput' value='" + rowID + "' name='" + url + "'/><button type='button' class='btn btn-link linkButton' >"+url+"</button>";
// return "<a href='' class='btn btn-link'>"+url+"</a>";
}
function cellDesign (cell, formatterParams){ function cellDesign (cell, formatterParams){
var value = cell.getValue(); var value = cell.getValue();
return "<span style='color:#54B4D3; font-weight:bold;'>" + value + "</span>"; return "<span style='color:#54B4D3; font-weight:bold;'>" + value + "</span>";

View File

@@ -24,9 +24,11 @@ Route::get('/home', 'HomeController@index')->name('home');
*/ */
// Route::post('testjs', 'UtilityController@showPage'); // Route::post('testjs', 'UtilityController@showPage');
// Route::get('mno_test', 'UtilityController@processMnoWorldwideFile'); // Route::get('mno_test', 'UtilityController@processMnoWorldwideFile'); sendEmailNotification
Route::get('loggingtest', 'UtilityController@loggingTest'); Route::get('loggingtest', 'UtilityController@loggingTest');
Route::get('notifytest', 'UtilityController@sendEmailNotification');
Route::get('loadcodes', 'UtilityController@loadShortCodes'); Route::get('loadcodes', 'UtilityController@loadShortCodes');
Route::get('migrate_senders', 'UtilityController@migrateSenderids'); Route::get('migrate_senders', 'UtilityController@migrateSenderids');
Route::get('/testlog', function () { Route::get('/testlog', function () {
@@ -169,6 +171,8 @@ Route::group(['middleware' => ['checklogin', 'checkcurrentlylogged']], function(
Route::post('clients/finance_update', 'ClientsController@financeUpdate'); Route::post('clients/finance_update', 'ClientsController@financeUpdate');
Route::post('clients/shortcode_update', 'ClientsController@shortCodeUpdate'); Route::post('clients/shortcode_update', 'ClientsController@shortCodeUpdate');
Route::get('allshortcode/remove_code/{id}', 'ShortCodesController@handle_delete');
Route::get('clients/get_payment/{id}', 'ClientsController@getPayment'); Route::get('clients/get_payment/{id}', 'ClientsController@getPayment');
Route::get('clients/get_shortcode/{id}', 'ClientsController@getShortCodeDetails'); Route::get('clients/get_shortcode/{id}', 'ClientsController@getShortCodeDetails');
Route::get('clients/get_note/{id}', 'ClientsController@getSingleNote'); Route::get('clients/get_note/{id}', 'ClientsController@getSingleNote');