short code in client payment, edit logic for short codes

This commit is contained in:
Kwesi Banson
2024-06-11 23:41:52 +00:00
parent 464b544587
commit 318fddbff0
16 changed files with 730 additions and 244 deletions

View File

@@ -11,10 +11,10 @@
var returnVal = confirm("Are you sure?");
$(this).prop("checked", returnVal);
}
$('#textbox1').val(this.checked);
$('#textbox1').val(this.checked);
});
*/
$('.progressIndicatorCheckbox').on('change', function() {
$('.progressIndicatorCheckbox').on('change', function() {
// From the other examples
// console.log('finker');
if (!this.checked) {
@@ -45,7 +45,7 @@
evt.preventDefault();
$('#progressIndicatorDetailsModal').modal('show');
});
$('#createSmsShortCodeBtn').click(function(evt){
evt.preventDefault();
$('#shortCodeType').val('sms');
@@ -101,11 +101,56 @@
title: 'Alert!',
content: 'Your request could not be handled. Try again !',
});
}
}
});
});
$('.shortCodeEditBtn').click(function(tve){
tve.preventDefault();
var theIDD = $(this).siblings('.shortCodeEntryRowId').val();
$.ajax({
type: "GET",
url: base_url + '/clients/get_shortcode/' + theIDD,
processData: false,
contentType: false,
async: false,
success: function (data){
if (data.code === 1) {
console.log(theIDD);
console.log(data);
$('#shortCodeIDEdit').val(theIDD);
$('#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();
$('#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 !',
});
}
}
});
});
@@ -143,17 +188,17 @@
title: 'Alert!',
content: 'Your request could not be handled. Try again !',
});
}
}
});
});
$('#newNotesFormForm').submit(function(evt){
evt.preventDefault();
evt.preventDefault();
var formData = new FormData($(this)[0]);
$.ajax({
type: "POST",
@@ -184,14 +229,14 @@
title: 'Alert!',
content: 'Your request could not be handled. Try again !',
});
}
}
});
});
});
$('#financeForm').submit(function(evt){
evt.preventDefault();
evt.preventDefault();
var formData = new FormData($(this)[0]);
$.ajax({
type: "POST",
@@ -222,7 +267,7 @@
title: 'Alert!',
content: 'Your request could not be handled. Try again !',
});
}
},
error: function(error){
@@ -237,11 +282,26 @@
$('#financeNotifyArea').text(value[0]);
});
}
});
});
});
$('#financeServicesStore').change(function(evtt){
let currentServices = $('#financeServicesStore').val();
$.each(currentServices, function (key, value) {
// console.log(value);
let short_code_services = ["USSD", "SMS Application", "IVR"];
let checkArray = $.inArray(value, short_code_services) > -1;
// console.log(checkArray);
if (checkArray == true) {
$('#ShortCodeFormGrp').removeClass('hidden');
}
else{
$('#ShortCodeFormGrp').addClass('hidden');
}
});
});
$('#financeEditForm').submit(function(evt){
evt.preventDefault();
evt.preventDefault();
var formData = new FormData($(this)[0]);
$.ajax({
type: "POST",
@@ -271,14 +331,50 @@
title: 'Alert!',
content: 'Your request could not be handled. Try again !',
});
}
}
});
});
});
$('#shortCodeEditForm').submit(function(evt){
evt.preventDefault();
var formData = new FormData($(this)[0]);
$.ajax({
type: "POST",
url: base_url + '/clients/shortcode_update',
data : formData,
processData: false,
contentType: false,
async: false,
success: function (data){
if (data.code === 1) {
$.alert({
title: 'Alert!',
content: 'Short Code Details successfully updated',
});
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 !',
});
}
}
});
});
$('#editNotesForm').submit(function(evt){
evt.preventDefault();
evt.preventDefault();
// console.log($(this).length);
var formData = new FormData($(this)[0]);
$.ajax({
@@ -309,14 +405,14 @@
title: 'Alert!',
content: 'Your request could not be handled. Try again !',
});
}
}
});
});
});
$('#shortCodeForm').submit(function(evt){
evt.preventDefault();
evt.preventDefault();
var formData = new FormData($(this)[0]);
$.ajax({
type: "POST",
@@ -346,7 +442,7 @@
title: 'Alert!',
content: 'Your request could not be handled. Try again !',
});
}
},
error: function (data) {
@@ -361,7 +457,7 @@
fail : function(errordata){
// console.log(errordata);
}
});
});
});
});
});