added voucher
This commit is contained in:
@@ -1,17 +1,20 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<!-- Required meta tags -->
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="csrf_token" content="{{ csrf_token() }}" />
|
||||
<!-- Bootstrap CSS -->
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet"
|
||||
integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
|
||||
|
||||
<title>Merchbay</title>
|
||||
<link rel="icon" href="{{ asset('public/favicon.ico') }}">
|
||||
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
|
||||
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@100;200;400;500;600;700;800;900&display=swap" rel="stylesheet">
|
||||
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@100;200;400;500;600;700;800;900&display=swap"
|
||||
rel="stylesheet">
|
||||
|
||||
<link href="{{ asset('public/assets/css/merchbay/styles.css') }}" rel="stylesheet">
|
||||
<!-- <link href="{{ asset('public/assets/login/css/style.css') }}" rel="stylesheet">
|
||||
@@ -21,12 +24,16 @@
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=G-SB3QK6BR1N"></script>
|
||||
<script>
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag(){dataLayer.push(arguments);}
|
||||
|
||||
function gtag() {
|
||||
dataLayer.push(arguments);
|
||||
}
|
||||
gtag('js', new Date());
|
||||
|
||||
gtag('config', 'G-SB3QK6BR1N');
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
@include('merchbay.navbar')
|
||||
@@ -42,7 +49,9 @@
|
||||
|
||||
<!-- Option 1: jQuery and Bootstrap Bundle (includes Popper) -->
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"
|
||||
integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous">
|
||||
</script>
|
||||
<script src="https://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js"></script>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
@@ -128,6 +137,29 @@
|
||||
$('#frm_search_store').submit();
|
||||
});
|
||||
|
||||
$("#frm_voucher").validate({
|
||||
rules: {
|
||||
voucher: {
|
||||
required: true
|
||||
}
|
||||
},
|
||||
messages: {},
|
||||
|
||||
errorPlacement: function(error, element) {
|
||||
var placement = $(element).data('error');
|
||||
|
||||
if (placement) {
|
||||
|
||||
$(placement).append(error)
|
||||
|
||||
} else {
|
||||
|
||||
error.insertAfter(element);
|
||||
|
||||
}
|
||||
},
|
||||
submitHandler: submitVoucher
|
||||
});
|
||||
|
||||
}); // end document ready
|
||||
|
||||
@@ -158,7 +190,8 @@
|
||||
//
|
||||
|
||||
// console.log(response.success);
|
||||
$("#btn-login").html('<span class="glyphicon glyphicon-log-in"></span> Sign In');
|
||||
$("#btn-login").html(
|
||||
'<span class="glyphicon glyphicon-log-in"></span> Sign In');
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -195,6 +228,45 @@
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
function submitVoucher() {
|
||||
var form = $('#frm_voucher')
|
||||
var data = form.serialize();
|
||||
// console.log(data);
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "{{ url('teamstore/q/add-voucher') }}",
|
||||
data: data,
|
||||
beforeSend: function(xhr) {
|
||||
$("#btn_apply_voucher").attr('disabled', true);
|
||||
$("#btn_apply_voucher").html('Applying <i class="fa fa-spinner fa-spin"></i>');
|
||||
|
||||
var token = $('meta[name="csrf_token"]').attr('content');
|
||||
if (token) {
|
||||
return xhr.setRequestHeader('X-CSRF-TOKEN', token);
|
||||
}
|
||||
},
|
||||
success: function(response) {
|
||||
console.log(response);
|
||||
$("#btn_apply_voucher").attr('disabled', false);
|
||||
$("#btn_apply_voucher").html('Apply');
|
||||
if (response.success) {
|
||||
$("#voucher_list").append(response.message);
|
||||
form.validate().resetForm();
|
||||
form[0].reset();
|
||||
$('#my_subtotal').text(response.subtotal);
|
||||
|
||||
} else {
|
||||
$("#error_voucher").html(response.message).fadeIn().delay(5000).fadeOut('slow',
|
||||
function() {
|
||||
$("#error_voucher").html("");
|
||||
$("#error_voucher").css("display", "block");
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
@@ -284,7 +356,8 @@
|
||||
return;
|
||||
}
|
||||
// Ensure that it is a number and stop the keypress
|
||||
if ((e.shiftKey || (e.keyCode < 48 || e.keyCode > 57)) && (e.keyCode < 96 || e.keyCode > 105)) {
|
||||
if ((e.shiftKey || (e.keyCode < 48 || e.keyCode > 57)) && (e.keyCode < 96 || e.keyCode >
|
||||
105)) {
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
@@ -455,12 +528,18 @@
|
||||
var doc = parser.parseFromString(response, "text/html");
|
||||
var elem = doc.getElementById("orderTableBody");
|
||||
var currentClassName = elem.getElementsByTagName('tr')[0].className;
|
||||
elem.getElementsByClassName(currentClassName)[0].classList.remove(currentClassName); // remove current Classname
|
||||
elem.getElementsByTagName('tr')[0].classList.add("table-tr-" + Math.ceil(Math.random() * 999999) + n); // add random classname
|
||||
elem.getElementsByClassName(currentClassName)[0].classList.remove(
|
||||
currentClassName); // remove current Classname
|
||||
elem.getElementsByTagName('tr')[0].classList.add("table-tr-" + Math
|
||||
.ceil(Math.random() * 999999) + n); // add random classname
|
||||
$('#tableRow tbody').append(elem.innerHTML);
|
||||
$('#addnew-btn-tbl-row').html('')
|
||||
$('#addnew-btn-tbl-row').append('<button type="button" id="addNewRow" class="btn btn-success btn-sm pull-left" data-toggle="tooltip" title="Add Another"><i class="fa fa-plus" aria-hidden="true"></i> Add Row</button>');
|
||||
$('.tr-remove-btn').html('<button type="button" class="btn btn-danger btn-sm removeRow btn-roster-action" data-toggle="tooltip" title="Remove"><i class="fa fa-remove" aria-hidden="true"></i></button>');
|
||||
$('#addnew-btn-tbl-row').append(
|
||||
'<button type="button" id="addNewRow" class="btn btn-success btn-sm pull-left" data-toggle="tooltip" title="Add Another"><i class="fa fa-plus" aria-hidden="true"></i> Add Row</button>'
|
||||
);
|
||||
$('.tr-remove-btn').html(
|
||||
'<button type="button" class="btn btn-danger btn-sm removeRow btn-roster-action" data-toggle="tooltip" title="Remove"><i class="fa fa-remove" aria-hidden="true"></i></button>'
|
||||
);
|
||||
$('#orderListPanel').scrollTop($('#orderListPanel')[0].scrollHeight);
|
||||
$('.inputName').keyup(function() {
|
||||
this.value = this.value.toLocaleUpperCase();
|
||||
@@ -477,7 +556,9 @@
|
||||
var trCount = $('#tableRow tbody').children('tr').length;
|
||||
if (trCount <= 2) {
|
||||
$('#addnew-btn-tbl-row').html('');
|
||||
$('.tr-remove-btn').html('<button type="button" id="addNewRow" class="btn btn-success btn-sm btn-roster-action" data-toggle="tooltip" title="Add Another"><i class="fa fa-plus" aria-hidden="true"></i></button>');
|
||||
$('.tr-remove-btn').html(
|
||||
'<button type="button" id="addNewRow" class="btn btn-success btn-sm btn-roster-action" data-toggle="tooltip" title="Add Another"><i class="fa fa-plus" aria-hidden="true"></i></button>'
|
||||
);
|
||||
}
|
||||
$('.' + str).remove();
|
||||
});
|
||||
@@ -485,4 +566,5 @@
|
||||
}); //end document ready
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user