Initial commit
This commit is contained in:
23115
public/js/app.js
Normal file
23115
public/js/app.js
Normal file
File diff suppressed because it is too large
Load Diff
173
public/js/dealer_landing.js
Normal file
173
public/js/dealer_landing.js
Normal file
@@ -0,0 +1,173 @@
|
||||
$(document).ready(function() {
|
||||
|
||||
$('#addNewMerchant').click(function() {
|
||||
var org_id = $(this).siblings('.orgRowId').val();
|
||||
console.log(org_id);
|
||||
$('#selectedOrgId').val(org_id);
|
||||
$('#createMerchantModal').modal('show');
|
||||
});
|
||||
|
||||
$('.topUpMerchantBtn').click(function() {
|
||||
var merchId = $(this).siblings('.orgRowId').val();
|
||||
console.log(merchId);
|
||||
$('.selectedMerchantId').val(merchId);
|
||||
$('#topUpMerchantByIdModal').modal('show');
|
||||
});
|
||||
|
||||
$('.topUpMerchantByIdBtn').click(function() {
|
||||
var merchId = $(this).siblings('.rowMerchantId').val();
|
||||
console.log(merchId);
|
||||
$('.selectedMerchantId').val(merchId);
|
||||
$('#topUpMerchantByIdModal').modal('show');
|
||||
});
|
||||
|
||||
|
||||
$('#newMerchantForm').submit(function(evt){
|
||||
evt.preventDefault();
|
||||
var formData = new FormData(this);
|
||||
$('#topupSuccess').html('');
|
||||
$('#topupError').html('');
|
||||
$.ajax({
|
||||
url: base_url + '/organisation/merchant',
|
||||
type: 'POST',
|
||||
data: formData,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
beforeSend: function() {
|
||||
$('#topupError').addClass('hidden');
|
||||
console.log('Sending data...');
|
||||
},
|
||||
success: function(data) {
|
||||
console.log('Success:', data);
|
||||
$('#topupError').addClass('hidden');
|
||||
$('#topupSuccess').removeClass('hidden');
|
||||
$('#topupSuccess').html('<p>' + data.message + '</p>');
|
||||
$('#newMerchantForm')[0].reset();
|
||||
$('#orgTopUpModal').modal('hide');
|
||||
// $('#topupSuccess').delay(5000).fadeOut();
|
||||
// $('#topupSuccess').html('');
|
||||
setTimeout(function() {
|
||||
location.reload();
|
||||
}, 3000);
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error('Error:', error);
|
||||
if (xhr.status === 422) {
|
||||
$('#topupError').removeClass('hidden');
|
||||
//console.log(xhr.responseJSON.errors); // Display validation errors
|
||||
$.each(xhr.responseJSON.errors, function(key, value) {
|
||||
$('#topupError').append('<p>' + value[0] + '</p>');
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
// Handle the form submission
|
||||
$('#otpButton').on('click', function(e) {
|
||||
e.preventDefault();
|
||||
$('#successArea').addClass('hidden');
|
||||
$('#errorArea').addClass('hidden');
|
||||
$('#topFormBtn').addClass('hidden');
|
||||
$('#otpButton').removeClass('hidden');
|
||||
$('#otpDivArea').addClass('hidden');
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: base_url + '/organisation/topupotp',
|
||||
// data: $(this).serialize(),
|
||||
success: function(response) {
|
||||
console.log(response);
|
||||
if (response.status == 'failed') {
|
||||
$('#errorArea').removeClass('hidden');
|
||||
$('#errorArea').html(response.message);
|
||||
}
|
||||
else{
|
||||
$('#successArea').removeClass('hidden');
|
||||
$('#successArea').html(response.message);
|
||||
$('#topFormBtn').removeClass('hidden');
|
||||
$('#otpButton').addClass('hidden');
|
||||
$('#otpDivArea').removeClass('hidden');
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
$('#errorArea').removeClass('hidden');
|
||||
$('#errorArea').html(response.message);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#dealerTopForm').on('submit', function(evt) {
|
||||
evt.preventDefault();
|
||||
|
||||
// var formdata = $(this).formData();
|
||||
$('#successArea').addClass('hidden');
|
||||
$('#errorArea').addClass('hidden');
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: base_url + '/organisation/topup',
|
||||
data: $(this).serialize(),
|
||||
success: function(response) {
|
||||
console.log(response);
|
||||
// $('#dealer_form')[0].reset();
|
||||
if (response.status == 'failed') {
|
||||
$('#errorArea').removeClass('hidden');
|
||||
$('#errorArea').html(response.message);
|
||||
}
|
||||
else{
|
||||
|
||||
$('#successArea').removeClass('hidden');
|
||||
$('#successArea').html(response.message);
|
||||
location.reload();
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.log(xhr);
|
||||
console.log(xhr.responseJSON.errors);
|
||||
console.log(xhr.responseJSON.message);
|
||||
$('#errorArea').removeClass('hidden');
|
||||
xhr.responseJSON.errors.forEach(function(value, index) {
|
||||
console.log(index + ': ' + value);
|
||||
$('#errorArea').html(index + ': ' + value);
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#dealerTopFormById').on('submit', function(evt) {
|
||||
evt.preventDefault();
|
||||
$('#topupByIdSuccess').addClass('hidden');
|
||||
$('#topupByIdError').addClass('hidden');
|
||||
var merchID = $('.selectedMerchantId').val();
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: base_url + '/organisation/topup',
|
||||
// data: formdata, //a $(this).serialize(),
|
||||
data: { merchant_id: merchID, merchant: merchID, amount: $('#topUpAmountById').val() },
|
||||
headers: { "X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content") },
|
||||
success: function(response) {
|
||||
console.log(response);
|
||||
if (response.status == 'failed') {
|
||||
$('#topupByIdError').removeClass('hidden');
|
||||
$('#topupByIdError').html(response.message);
|
||||
}
|
||||
else{
|
||||
$('#topupByIdSuccess').removeClass('hidden');
|
||||
$('#topupByIdSuccess').html(response.message);
|
||||
setTimeout(function() {
|
||||
location.reload();
|
||||
}, 3000);
|
||||
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
$('#topupByIdError').removeClass('hidden');
|
||||
// $('#topupByIdError').html(response.message);
|
||||
xhr.responseJSON.errors.forEach(function(value, index) {
|
||||
console.log(index + ': ' + value);
|
||||
$('#errorArea').html(index + ': ' + value);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
10
public/js/jquery-confirm.js
vendored
Normal file
10
public/js/jquery-confirm.js
vendored
Normal file
File diff suppressed because one or more lines are too long
124
public/js/merchant_landing.js
Normal file
124
public/js/merchant_landing.js
Normal file
@@ -0,0 +1,124 @@
|
||||
$(document).ready(function() {
|
||||
|
||||
|
||||
// Handle the form submission
|
||||
$('#otpButton').on('click', function(e) {
|
||||
e.preventDefault();
|
||||
$('#successArea').addClass('hidden');
|
||||
$('#errorArea').addClass('hidden');
|
||||
$('#topFormBtn').addClass('hidden');
|
||||
$('#otpButton').removeClass('hidden');
|
||||
$('#otpDivArea').addClass('hidden');
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: base_url + '/organisation/topupotp',
|
||||
// data: $(this).serialize(),
|
||||
success: function(response) {
|
||||
console.log(response);
|
||||
if (response.status == 'failed') {
|
||||
$('#errorArea').removeClass('hidden');
|
||||
$('#errorArea').html(response.message);
|
||||
}
|
||||
else{
|
||||
$('#successArea').removeClass('hidden');
|
||||
$('#successArea').html(response.message);
|
||||
$('#topFormBtn').removeClass('hidden');
|
||||
$('#otpButton').addClass('hidden');
|
||||
$('#otpDivArea').removeClass('hidden');
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
$('#errorArea').removeClass('hidden');
|
||||
$('#errorArea').html(response.message);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#changePinForm').on('submit', function(et) {
|
||||
// $('#newNotesFormForm').submit(function(evt){
|
||||
// $('#changePinForm').submit(function(et) {
|
||||
et.preventDefault();
|
||||
// return false;
|
||||
//var formdata = $(this).formData();
|
||||
var formData = new FormData($(this)[0]);
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: base_url + '/merchant/change-pin',
|
||||
data: formData, // $(this).serialize(),
|
||||
processData: false,
|
||||
contentType: false,
|
||||
async: false,
|
||||
// headers: { "X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content") },
|
||||
success: function(response) {
|
||||
console.log(response);
|
||||
if (response.status == 'failed') {
|
||||
$.alert({
|
||||
title: 'Error!',
|
||||
content: response.message,
|
||||
});
|
||||
}
|
||||
else{
|
||||
$.alert({
|
||||
title: 'Alert!',
|
||||
content: response.message,
|
||||
});
|
||||
$('#changePinForm')[0].reset();
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
$.alert({
|
||||
title: 'Alert!',
|
||||
content: response.message,
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#dealerTopFormzz').on('submit', function(evt) {
|
||||
evt.preventDefault();
|
||||
// var formdata = $(this).formData();
|
||||
$('#successArea').addClass('hidden');
|
||||
$('#errorArea').addClass('hidden');
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: base_url + '/organisation/topup',
|
||||
data: $(this).serialize(),
|
||||
success: function(response) {
|
||||
console.log(response);
|
||||
// $('#dealer_form')[0].reset();
|
||||
if (response.status == 'failed') {
|
||||
$('#errorArea').removeClass('hidden');
|
||||
$('#errorArea').html(response.message);
|
||||
}
|
||||
else{
|
||||
|
||||
$('#successArea').removeClass('hidden');
|
||||
$('#successArea').html(response.message);
|
||||
location.reload();
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
$('#errorArea').removeClass('hidden');
|
||||
$('#errorArea').html(response.message);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$("#changePinFormMMM").click(function() {
|
||||
var formdata = $(this).formData();
|
||||
$.ajax({
|
||||
url: base_url + "/merchant/change-pin",
|
||||
type: "POST",
|
||||
data: formdata, //{ name: "Kwesi", age: 30 },
|
||||
// headers: { "X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content") },
|
||||
success: function(response) {
|
||||
console.log(response);
|
||||
alert(response.message);
|
||||
},
|
||||
error: function(error) {
|
||||
console.error(error);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user