added voucher
This commit is contained in:
@@ -1,33 +1,40 @@
|
|||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
|
||||||
|
<head>
|
||||||
<!-- Required meta tags -->
|
<!-- Required meta tags -->
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||||
<meta name="csrf_token" content="{{ csrf_token() }}" />
|
<meta name="csrf_token" content="{{ csrf_token() }}" />
|
||||||
<!-- Bootstrap CSS -->
|
<!-- 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>
|
<title>Merchbay</title>
|
||||||
<link rel="icon" href="{{asset('public/favicon.ico')}}">
|
<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://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/css/merchbay/styles.css') }}" rel="stylesheet">
|
||||||
<!-- <link href="{{asset('public/assets/login/css/style.css')}}" rel="stylesheet">
|
<!-- <link href="{{ asset('public/assets/login/css/style.css') }}" rel="stylesheet">
|
||||||
<link href="{{asset('public/assets/login/css/form-elements.css')}}" rel="stylesheet"> -->
|
<link href="{{ asset('public/assets/login/css/form-elements.css') }}" rel="stylesheet"> -->
|
||||||
<script src='https://www.google.com/recaptcha/api.js'></script>
|
<script src='https://www.google.com/recaptcha/api.js'></script>
|
||||||
<!-- Global site tag (gtag.js) - Google Analytics -->
|
<!-- Global site tag (gtag.js) - Google Analytics -->
|
||||||
<script async src="https://www.googletagmanager.com/gtag/js?id=G-SB3QK6BR1N"></script>
|
<script async src="https://www.googletagmanager.com/gtag/js?id=G-SB3QK6BR1N"></script>
|
||||||
<script>
|
<script>
|
||||||
window.dataLayer = window.dataLayer || [];
|
window.dataLayer = window.dataLayer || [];
|
||||||
function gtag(){dataLayer.push(arguments);}
|
|
||||||
|
function gtag() {
|
||||||
|
dataLayer.push(arguments);
|
||||||
|
}
|
||||||
gtag('js', new Date());
|
gtag('js', new Date());
|
||||||
|
|
||||||
gtag('config', 'G-SB3QK6BR1N');
|
gtag('config', 'G-SB3QK6BR1N');
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
|
||||||
|
<body>
|
||||||
|
|
||||||
@include('merchbay.navbar')
|
@include('merchbay.navbar')
|
||||||
<div class="container">
|
<div class="container">
|
||||||
@@ -42,11 +49,13 @@
|
|||||||
|
|
||||||
<!-- Option 1: jQuery and Bootstrap Bundle (includes Popper) -->
|
<!-- 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="//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 src="https://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js"></script>
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function(){
|
$(document).ready(function() {
|
||||||
$('.reveal-password').click(function(e){
|
$('.reveal-password').click(function(e) {
|
||||||
var $pwd = $(".pwd");
|
var $pwd = $(".pwd");
|
||||||
if ($pwd.attr('type') === 'password') {
|
if ($pwd.attr('type') === 'password') {
|
||||||
$pwd.attr('type', 'text');
|
$pwd.attr('type', 'text');
|
||||||
@@ -57,7 +66,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if($('.data-errors').length > 0){
|
if ($('.data-errors').length > 0) {
|
||||||
$('#team-store-login').modal('show')
|
$('#team-store-login').modal('show')
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -78,7 +87,7 @@
|
|||||||
var placement = $(element).data('error');
|
var placement = $(element).data('error');
|
||||||
if (placement) {
|
if (placement) {
|
||||||
$(placement).append(error);
|
$(placement).append(error);
|
||||||
}else {
|
} else {
|
||||||
error.insertAfter(element);
|
error.insertAfter(element);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -88,10 +97,10 @@
|
|||||||
$("#frm-register").validate({
|
$("#frm-register").validate({
|
||||||
rules: {
|
rules: {
|
||||||
name: {
|
name: {
|
||||||
required : true
|
required: true
|
||||||
},
|
},
|
||||||
username: {
|
username: {
|
||||||
required : true
|
required: true
|
||||||
},
|
},
|
||||||
email: {
|
email: {
|
||||||
required: true,
|
required: true,
|
||||||
@@ -107,14 +116,14 @@
|
|||||||
var placement = $(element).data('error');
|
var placement = $(element).data('error');
|
||||||
if (placement) {
|
if (placement) {
|
||||||
$(placement).append(error);
|
$(placement).append(error);
|
||||||
}else {
|
} else {
|
||||||
error.insertAfter(element);
|
error.insertAfter(element);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
submitHandler: submitRegisterForm
|
submitHandler: submitRegisterForm
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.password-protected').click(function(){
|
$('.password-protected').click(function() {
|
||||||
|
|
||||||
$('#_teamstore_id').val($(this).data('store-id'))
|
$('#_teamstore_id').val($(this).data('store-id'))
|
||||||
// console.log($(this).data('store-id'))
|
// console.log($(this).data('store-id'))
|
||||||
@@ -128,62 +137,86 @@
|
|||||||
$('#frm_search_store').submit();
|
$('#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
|
}); // end document ready
|
||||||
|
|
||||||
function submitLoginForm (){
|
function submitLoginForm() {
|
||||||
// method="POST" action="{{ url('/auth/login') }}"
|
// method="POST" action="{{ url('/auth/login') }}"
|
||||||
var data = $("#frm-login").serialize();
|
var data = $("#frm-login").serialize();
|
||||||
// console.log(data)
|
// console.log(data)
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type : 'POST',
|
type: 'POST',
|
||||||
url : "{{ url('/custom/auth') }}",
|
url: "{{ url('/custom/auth') }}",
|
||||||
data : data,
|
data: data,
|
||||||
dataType : 'json',
|
dataType: 'json',
|
||||||
beforeSend: function() {
|
beforeSend: function() {
|
||||||
$("#login-response-msg").fadeOut();
|
$("#login-response-msg").fadeOut();
|
||||||
$("#btn-login").html('Signing in <i class="fa fa-spinner fa-spin"></i>');
|
$("#btn-login").html('Signing in <i class="fa fa-spinner fa-spin"></i>');
|
||||||
},
|
},
|
||||||
success : function(response){
|
success: function(response) {
|
||||||
$("#login-response-msg").html("");
|
$("#login-response-msg").html("");
|
||||||
$("#login-response-msg").fadeIn(1000, function(){
|
$("#login-response-msg").fadeIn(1000, function() {
|
||||||
|
|
||||||
if(response.success){
|
if (response.success) {
|
||||||
// $("#login-response-msg").html(response);
|
// $("#login-response-msg").html(response);
|
||||||
// console.log();
|
// console.log();
|
||||||
location.reload();
|
location.reload();
|
||||||
}else{
|
} else {
|
||||||
$("#login-response-msg").html(response.message);
|
$("#login-response-msg").html(response.message);
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
|
||||||
// console.log(response.success);
|
// 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');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
}/* login submit */
|
} /* login submit */
|
||||||
|
|
||||||
function submitRegisterForm (){
|
function submitRegisterForm() {
|
||||||
var data = $("#frm-register").serialize();
|
var data = $("#frm-register").serialize();
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type : 'POST',
|
type: 'POST',
|
||||||
url : "{{ url('/custom/register') }}",
|
url: "{{ url('/custom/register') }}",
|
||||||
data : data,
|
data: data,
|
||||||
dataType : 'json',
|
dataType: 'json',
|
||||||
beforeSend: function() {
|
beforeSend: function() {
|
||||||
$("#register-response-msg").fadeOut();
|
$("#register-response-msg").fadeOut();
|
||||||
$("#btn-register").html('Please wait <i class="fa fa-spinner fa-spin"></i>');
|
$("#btn-register").html('Please wait <i class="fa fa-spinner fa-spin"></i>');
|
||||||
},
|
},
|
||||||
success : function(response){
|
success: function(response) {
|
||||||
$("#register-response-msg").html("");
|
$("#register-response-msg").html("");
|
||||||
$("#register-response-msg").fadeIn(1000, function(){
|
$("#register-response-msg").fadeIn(1000, function() {
|
||||||
|
|
||||||
if(response.success){
|
if (response.success) {
|
||||||
location.reload();
|
location.reload();
|
||||||
}else{
|
} else {
|
||||||
$("#register-response-msg").html(response.message);
|
$("#register-response-msg").html(response.message);
|
||||||
}
|
}
|
||||||
$("#btn-register").html('Register');
|
$("#btn-register").html('Register');
|
||||||
@@ -195,9 +228,48 @@
|
|||||||
return false;
|
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>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
// $('.img-zoom').zoom();
|
// $('.img-zoom').zoom();
|
||||||
$('.inputName').keyup(function() {
|
$('.inputName').keyup(function() {
|
||||||
@@ -206,29 +278,29 @@
|
|||||||
|
|
||||||
// $('.carousel').bcSwipe({ threshold: 50 });
|
// $('.carousel').bcSwipe({ threshold: 50 });
|
||||||
|
|
||||||
$('.btn-number').click(function(e){
|
$('.btn-number').click(function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
fieldName = $(this).attr('data-field');
|
fieldName = $(this).attr('data-field');
|
||||||
type = $(this).attr('data-type');
|
type = $(this).attr('data-type');
|
||||||
var input = $("input[name='"+fieldName+"']");
|
var input = $("input[name='" + fieldName + "']");
|
||||||
var currentVal = parseInt(input.val());
|
var currentVal = parseInt(input.val());
|
||||||
if (!isNaN(currentVal)) {
|
if (!isNaN(currentVal)) {
|
||||||
if(type == 'minus') {
|
if (type == 'minus') {
|
||||||
|
|
||||||
if(currentVal > input.attr('min')) {
|
if (currentVal > input.attr('min')) {
|
||||||
input.val(currentVal - 1).change();
|
input.val(currentVal - 1).change();
|
||||||
}
|
}
|
||||||
if(parseInt(input.val()) == input.attr('min')) {
|
if (parseInt(input.val()) == input.attr('min')) {
|
||||||
$(this).attr('disabled', true);
|
$(this).attr('disabled', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if(type == 'plus') {
|
} else if (type == 'plus') {
|
||||||
|
|
||||||
if(currentVal < input.attr('max')) {
|
if (currentVal < input.attr('max')) {
|
||||||
input.val(currentVal + 1).change();
|
input.val(currentVal + 1).change();
|
||||||
}
|
}
|
||||||
if(parseInt(input.val()) == input.attr('max')) {
|
if (parseInt(input.val()) == input.attr('max')) {
|
||||||
$(this).attr('disabled', true);
|
$(this).attr('disabled', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -238,15 +310,15 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#myCarousel').on('slid.bs.carousel', function (e) {
|
$('#myCarousel').on('slid.bs.carousel', function(e) {
|
||||||
var id = $('.item.active').data('slide-number');
|
var id = $('.item.active').data('slide-number');
|
||||||
// $('#carousel-text').html($('#slide-content-'+id).html());
|
// $('#carousel-text').html($('#slide-content-'+id).html());
|
||||||
// console.log(id)
|
// console.log(id)
|
||||||
$('.a_thumbnail').removeClass('active');
|
$('.a_thumbnail').removeClass('active');
|
||||||
$('#carousel-selector-'+id).addClass('active');
|
$('#carousel-selector-' + id).addClass('active');
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.input-number').focusin(function(){
|
$('.input-number').focusin(function() {
|
||||||
$(this).data('oldValue', $(this).val());
|
$(this).data('oldValue', $(this).val());
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -257,14 +329,14 @@
|
|||||||
valueCurrent = parseInt($(this).val());
|
valueCurrent = parseInt($(this).val());
|
||||||
|
|
||||||
name = $(this).attr('name');
|
name = $(this).attr('name');
|
||||||
if(valueCurrent >= minValue) {
|
if (valueCurrent >= minValue) {
|
||||||
$(".btn-number[data-type='minus'][data-field='"+name+"']").removeAttr('disabled')
|
$(".btn-number[data-type='minus'][data-field='" + name + "']").removeAttr('disabled')
|
||||||
} else {
|
} else {
|
||||||
alert('Sorry, the minimum value was reached');
|
alert('Sorry, the minimum value was reached');
|
||||||
$(this).val($(this).data('oldValue'));
|
$(this).val($(this).data('oldValue'));
|
||||||
}
|
}
|
||||||
if(valueCurrent <= maxValue) {
|
if (valueCurrent <= maxValue) {
|
||||||
$(".btn-number[data-type='plus'][data-field='"+name+"']").removeAttr('disabled')
|
$(".btn-number[data-type='plus'][data-field='" + name + "']").removeAttr('disabled')
|
||||||
} else {
|
} else {
|
||||||
alert('Sorry, the maximum value was reached');
|
alert('Sorry, the maximum value was reached');
|
||||||
$(this).val($(this).data('oldValue'));
|
$(this).val($(this).data('oldValue'));
|
||||||
@@ -273,7 +345,7 @@
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$(".input-number").keydown(function (e) {
|
$(".input-number").keydown(function(e) {
|
||||||
// Allow: backspace, delete, tab, escape, enter and .
|
// Allow: backspace, delete, tab, escape, enter and .
|
||||||
if ($.inArray(e.keyCode, [46, 8, 9, 27, 13, 190]) !== -1 ||
|
if ($.inArray(e.keyCode, [46, 8, 9, 27, 13, 190]) !== -1 ||
|
||||||
// Allow: Ctrl+A
|
// Allow: Ctrl+A
|
||||||
@@ -284,12 +356,13 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Ensure that it is a number and stop the keypress
|
// 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();
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.multi-item-carousel .item').each(function(){
|
$('.multi-item-carousel .item').each(function() {
|
||||||
var next = $(this).next();
|
var next = $(this).next();
|
||||||
if (!next.length) {
|
if (!next.length) {
|
||||||
next = $(this).siblings(':first');
|
next = $(this).siblings(':first');
|
||||||
@@ -298,32 +371,32 @@
|
|||||||
next.children(':first-child').clone().appendTo($(this));
|
next.children(':first-child').clone().appendTo($(this));
|
||||||
|
|
||||||
|
|
||||||
for (var i=0; i<2; i++){
|
for (var i = 0; i < 2; i++) {
|
||||||
|
|
||||||
next=next.next();
|
next = next.next();
|
||||||
|
|
||||||
if (!next.length){
|
if (!next.length) {
|
||||||
next=$(this).siblings(':first');
|
next = $(this).siblings(':first');
|
||||||
}
|
}
|
||||||
next.children(':first-child').clone().appendTo($(this));
|
next.children(':first-child').clone().appendTo($(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#jersey_chk').click(function(){
|
$('#jersey_chk').click(function() {
|
||||||
|
|
||||||
var product_price = $('#product_price').val();
|
var product_price = $('#product_price').val();
|
||||||
var getPriceHold = $('#price_holder').val();
|
var getPriceHold = $('#price_holder').val();
|
||||||
var getHalf = getPriceHold / 2;
|
var getHalf = getPriceHold / 2;
|
||||||
|
|
||||||
if($(this).is(':checked')){
|
if ($(this).is(':checked')) {
|
||||||
$('.td-hide').css('display', '');
|
$('.td-hide').css('display', '');
|
||||||
$('.th-hide').css('display', '');
|
$('.th-hide').css('display', '');
|
||||||
|
|
||||||
$('#product_price').val(Number(product_price) + Number(getHalf));
|
$('#product_price').val(Number(product_price) + Number(getHalf));
|
||||||
$('#display-product-price').html('$ ' + $('#product_price').val());
|
$('#display-product-price').html('$ ' + $('#product_price').val());
|
||||||
// console.log($('#product_price').val() - getHalf);
|
// console.log($('#product_price').val() - getHalf);
|
||||||
}else{
|
} else {
|
||||||
$('.cls-uniformName').val('');
|
$('.cls-uniformName').val('');
|
||||||
$('.td-hide').css('display', 'none');
|
$('.td-hide').css('display', 'none');
|
||||||
$('.th-hide').css('display', 'none');
|
$('.th-hide').css('display', 'none');
|
||||||
@@ -335,16 +408,16 @@
|
|||||||
// console.log($(this).is(':checked'));
|
// console.log($(this).is(':checked'));
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#shorts_chk').click(function(){
|
$('#shorts_chk').click(function() {
|
||||||
|
|
||||||
var product_price = $('#product_price').val();
|
var product_price = $('#product_price').val();
|
||||||
var getPriceHold = $('#price_holder').val();
|
var getPriceHold = $('#price_holder').val();
|
||||||
var getHalf = getPriceHold / 2;
|
var getHalf = getPriceHold / 2;
|
||||||
|
|
||||||
if($(this).is(':checked')){
|
if ($(this).is(':checked')) {
|
||||||
$('#product_price').val(Number(product_price) + Number(getHalf));
|
$('#product_price').val(Number(product_price) + Number(getHalf));
|
||||||
$('#display-product-price').html('$ ' + $('#product_price').val());
|
$('#display-product-price').html('$ ' + $('#product_price').val());
|
||||||
}else{
|
} else {
|
||||||
|
|
||||||
$('#product_price').val(Number(product_price) - Number(getHalf));
|
$('#product_price').val(Number(product_price) - Number(getHalf));
|
||||||
$('#display-product-price').html('$ ' + $('#product_price').val());
|
$('#display-product-price').html('$ ' + $('#product_price').val());
|
||||||
@@ -355,7 +428,7 @@
|
|||||||
$(this).val($(this).val().toUpperCase());
|
$(this).val($(this).val().toUpperCase());
|
||||||
});
|
});
|
||||||
|
|
||||||
$('[id^=carousel-selector-]').click( function(){
|
$('[id^=carousel-selector-]').click(function() {
|
||||||
var id = this.id.substr(this.id.lastIndexOf("-") + 1);
|
var id = this.id.substr(this.id.lastIndexOf("-") + 1);
|
||||||
var id = parseInt(id);
|
var id = parseInt(id);
|
||||||
$('#myCarousel').carousel(id);
|
$('#myCarousel').carousel(id);
|
||||||
@@ -395,27 +468,27 @@
|
|||||||
submitHandler: submitOrderListForm
|
submitHandler: submitOrderListForm
|
||||||
});
|
});
|
||||||
|
|
||||||
function submitOrderListForm(){
|
function submitOrderListForm() {
|
||||||
var data = $("#frm-order-list").serializeArray();
|
var data = $("#frm-order-list").serializeArray();
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type : 'POST',
|
type: 'POST',
|
||||||
url : "{{ url('teamstore/q/add-to-cart') }}",
|
url: "{{ url('teamstore/q/add-to-cart') }}",
|
||||||
data : data,
|
data: data,
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
beforeSend:function(xhr){
|
beforeSend: function(xhr) {
|
||||||
var token = $('meta[name="csrf_token"]').attr('content');
|
var token = $('meta[name="csrf_token"]').attr('content');
|
||||||
|
|
||||||
if (token) {
|
if (token) {
|
||||||
return xhr.setRequestHeader('X-CSRF-TOKEN', token);
|
return xhr.setRequestHeader('X-CSRF-TOKEN', token);
|
||||||
}
|
}
|
||||||
xhr.setRequestHeader( 'X-Requested-With', 'XMLHttpRequest');
|
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
|
||||||
},
|
},
|
||||||
success : function(response){
|
success: function(response) {
|
||||||
|
|
||||||
if(response.success){
|
if (response.success) {
|
||||||
window.location = "{{ url('cart') }}";
|
window.location = "{{ url('cart') }}";
|
||||||
}else{
|
} else {
|
||||||
alert(response.message);
|
alert(response.message);
|
||||||
location.reload();
|
location.reload();
|
||||||
}
|
}
|
||||||
@@ -427,26 +500,26 @@
|
|||||||
|
|
||||||
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ adding of rows @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ adding of rows @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
|
|
||||||
$(document).on('button click', '#addNewRow', function(){
|
$(document).on('button click', '#addNewRow', function() {
|
||||||
var p_id = $('#p_id').val();
|
var p_id = $('#p_id').val();
|
||||||
$.ajax({ //create an ajax request to load_page.php
|
$.ajax({ //create an ajax request to load_page.php
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "{{ url('/teamstore/q/add-new-row') }}",
|
url: "{{ url('/teamstore/q/add-new-row') }}",
|
||||||
data: {
|
data: {
|
||||||
p_id : p_id
|
p_id: p_id
|
||||||
},
|
},
|
||||||
|
|
||||||
dataType: "html", //expect html to be returned
|
dataType: "html", //expect html to be returned
|
||||||
beforeSend:function(xhr){
|
beforeSend: function(xhr) {
|
||||||
var token = $('meta[name="csrf_token"]').attr('content');
|
var token = $('meta[name="csrf_token"]').attr('content');
|
||||||
|
|
||||||
if (token) {
|
if (token) {
|
||||||
return xhr.setRequestHeader('X-CSRF-TOKEN', token);
|
return xhr.setRequestHeader('X-CSRF-TOKEN', token);
|
||||||
}
|
}
|
||||||
xhr.setRequestHeader( 'X-Requested-With', 'XMLHttpRequest');
|
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
|
||||||
},
|
},
|
||||||
|
|
||||||
success: function(response){
|
success: function(response) {
|
||||||
|
|
||||||
var d = new Date();
|
var d = new Date();
|
||||||
var n = d.getTime();
|
var n = d.getTime();
|
||||||
@@ -455,12 +528,18 @@
|
|||||||
var doc = parser.parseFromString(response, "text/html");
|
var doc = parser.parseFromString(response, "text/html");
|
||||||
var elem = doc.getElementById("orderTableBody");
|
var elem = doc.getElementById("orderTableBody");
|
||||||
var currentClassName = elem.getElementsByTagName('tr')[0].className;
|
var currentClassName = elem.getElementsByTagName('tr')[0].className;
|
||||||
elem.getElementsByClassName(currentClassName)[0].classList.remove(currentClassName); // remove current Classname
|
elem.getElementsByClassName(currentClassName)[0].classList.remove(
|
||||||
elem.getElementsByTagName('tr')[0].classList.add("table-tr-" + Math.ceil(Math.random() * 999999) + n); // add random classname
|
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);
|
$('#tableRow tbody').append(elem.innerHTML);
|
||||||
$('#addnew-btn-tbl-row').html('')
|
$('#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>');
|
$('#addnew-btn-tbl-row').append(
|
||||||
$('.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>');
|
'<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);
|
$('#orderListPanel').scrollTop($('#orderListPanel')[0].scrollHeight);
|
||||||
$('.inputName').keyup(function() {
|
$('.inputName').keyup(function() {
|
||||||
this.value = this.value.toLocaleUpperCase();
|
this.value = this.value.toLocaleUpperCase();
|
||||||
@@ -472,17 +551,20 @@
|
|||||||
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ end adding of rows @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ end adding of rows @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
|
|
||||||
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ removing of rows @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ removing of rows @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
$(document).on('button click', '.removeRow', function(){
|
$(document).on('button click', '.removeRow', function() {
|
||||||
var str = $(this).closest('tr').attr('class');
|
var str = $(this).closest('tr').attr('class');
|
||||||
var trCount = $('#tableRow tbody').children('tr').length;
|
var trCount = $('#tableRow tbody').children('tr').length;
|
||||||
if(trCount <= 2){
|
if (trCount <= 2) {
|
||||||
$('#addnew-btn-tbl-row').html('');
|
$('#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();
|
$('.' + str).remove();
|
||||||
});
|
});
|
||||||
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ end removing of rows @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ end removing of rows @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
}); //end document ready
|
}); //end document ready
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
Reference in New Issue
Block a user