Initial commit
This commit is contained in:
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