added voucher
This commit is contained in:
@@ -1,488 +1,570 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
|
||||
<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() }}" />
|
||||
<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 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="{{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/form-elements.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="{{ 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/form-elements.css') }}" rel="stylesheet"> -->
|
||||
<script src='https://www.google.com/recaptcha/api.js'></script>
|
||||
<!-- Global site tag (gtag.js) - Google Analytics -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=G-SB3QK6BR1N"></script>
|
||||
<script>
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag(){dataLayer.push(arguments);}
|
||||
gtag('js', new Date());
|
||||
|
||||
gtag('config', 'G-SB3QK6BR1N');
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<script>
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
|
||||
function gtag() {
|
||||
dataLayer.push(arguments);
|
||||
}
|
||||
gtag('js', new Date());
|
||||
|
||||
gtag('config', 'G-SB3QK6BR1N');
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
@include('merchbay.navbar')
|
||||
<div class="container">
|
||||
<div class="wrapper bg-white">
|
||||
@yield('main-content')
|
||||
</div>
|
||||
@include('merchbay.footer')
|
||||
<div class="wrapper bg-white">
|
||||
@yield('main-content')
|
||||
</div>
|
||||
@include('merchbay.footer')
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- Optional JavaScript; choose one of the two! -->
|
||||
|
||||
<!-- 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="//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://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js"></script>
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$('.reveal-password').click(function(e){
|
||||
var $pwd = $(".pwd");
|
||||
if ($pwd.attr('type') === 'password') {
|
||||
$pwd.attr('type', 'text');
|
||||
$(this).html('<i class="fa fa-eye-slash"></i>');
|
||||
} else {
|
||||
$pwd.attr('type', 'password');
|
||||
$(this).html('<i class="fa fa-eye"></i>');
|
||||
}
|
||||
});
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('.reveal-password').click(function(e) {
|
||||
var $pwd = $(".pwd");
|
||||
if ($pwd.attr('type') === 'password') {
|
||||
$pwd.attr('type', 'text');
|
||||
$(this).html('<i class="fa fa-eye-slash"></i>');
|
||||
} else {
|
||||
$pwd.attr('type', 'password');
|
||||
$(this).html('<i class="fa fa-eye"></i>');
|
||||
}
|
||||
});
|
||||
|
||||
if($('.data-errors').length > 0){
|
||||
$('#team-store-login').modal('show')
|
||||
return false;
|
||||
}
|
||||
if ($('.data-errors').length > 0) {
|
||||
$('#team-store-login').modal('show')
|
||||
return false;
|
||||
}
|
||||
|
||||
$("#frm-login").validate({
|
||||
rules: {
|
||||
email: {
|
||||
required: true,
|
||||
email: true
|
||||
},
|
||||
password: {
|
||||
required: true
|
||||
//minlength: 6 // <-- removed underscore
|
||||
}
|
||||
},
|
||||
messages: {},
|
||||
errorPlacement: function(error, element) {
|
||||
var placement = $(element).data('error');
|
||||
if (placement) {
|
||||
$(placement).append(error);
|
||||
}else {
|
||||
error.insertAfter(element);
|
||||
}
|
||||
},
|
||||
submitHandler: submitLoginForm
|
||||
});
|
||||
$("#frm-login").validate({
|
||||
rules: {
|
||||
email: {
|
||||
required: true,
|
||||
email: true
|
||||
},
|
||||
password: {
|
||||
required: true
|
||||
//minlength: 6 // <-- removed underscore
|
||||
}
|
||||
},
|
||||
messages: {},
|
||||
errorPlacement: function(error, element) {
|
||||
var placement = $(element).data('error');
|
||||
if (placement) {
|
||||
$(placement).append(error);
|
||||
} else {
|
||||
error.insertAfter(element);
|
||||
}
|
||||
},
|
||||
submitHandler: submitLoginForm
|
||||
});
|
||||
|
||||
$("#frm-register").validate({
|
||||
rules: {
|
||||
name: {
|
||||
required : true
|
||||
},
|
||||
username: {
|
||||
required : true
|
||||
},
|
||||
email: {
|
||||
required: true,
|
||||
email: true
|
||||
},
|
||||
password: {
|
||||
required: true
|
||||
//minlength: 6 // <-- removed underscore
|
||||
}
|
||||
},
|
||||
messages: {},
|
||||
errorPlacement: function(error, element) {
|
||||
var placement = $(element).data('error');
|
||||
if (placement) {
|
||||
$(placement).append(error);
|
||||
}else {
|
||||
error.insertAfter(element);
|
||||
}
|
||||
},
|
||||
submitHandler: submitRegisterForm
|
||||
});
|
||||
$("#frm-register").validate({
|
||||
rules: {
|
||||
name: {
|
||||
required: true
|
||||
},
|
||||
username: {
|
||||
required: true
|
||||
},
|
||||
email: {
|
||||
required: true,
|
||||
email: true
|
||||
},
|
||||
password: {
|
||||
required: true
|
||||
//minlength: 6 // <-- removed underscore
|
||||
}
|
||||
},
|
||||
messages: {},
|
||||
errorPlacement: function(error, element) {
|
||||
var placement = $(element).data('error');
|
||||
if (placement) {
|
||||
$(placement).append(error);
|
||||
} else {
|
||||
error.insertAfter(element);
|
||||
}
|
||||
},
|
||||
submitHandler: submitRegisterForm
|
||||
});
|
||||
|
||||
$('.password-protected').click(function(){
|
||||
$('.password-protected').click(function() {
|
||||
|
||||
$('#_teamstore_id').val($(this).data('store-id'))
|
||||
// console.log($(this).data('store-id'))
|
||||
$('#team-store-login').modal('show')
|
||||
return false;
|
||||
$('#_teamstore_id').val($(this).data('store-id'))
|
||||
// console.log($(this).data('store-id'))
|
||||
$('#team-store-login').modal('show')
|
||||
return false;
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('change', '#select_sort_stores', function(event) {
|
||||
event.preventDefault();
|
||||
$('#frm_search_store').submit();
|
||||
});
|
||||
|
||||
$(document).on('change', '#select_sort_stores', function(event) {
|
||||
event.preventDefault();
|
||||
$('#frm_search_store').submit();
|
||||
});
|
||||
|
||||
}); // end document ready
|
||||
$("#frm_voucher").validate({
|
||||
rules: {
|
||||
voucher: {
|
||||
required: true
|
||||
}
|
||||
},
|
||||
messages: {},
|
||||
|
||||
function submitLoginForm (){
|
||||
// method="POST" action="{{ url('/auth/login') }}"
|
||||
var data = $("#frm-login").serialize();
|
||||
// console.log(data)
|
||||
$.ajax({
|
||||
type : 'POST',
|
||||
url : "{{ url('/custom/auth') }}",
|
||||
data : data,
|
||||
dataType : 'json',
|
||||
beforeSend: function() {
|
||||
$("#login-response-msg").fadeOut();
|
||||
$("#btn-login").html('Signing in <i class="fa fa-spinner fa-spin"></i>');
|
||||
},
|
||||
success : function(response){
|
||||
$("#login-response-msg").html("");
|
||||
$("#login-response-msg").fadeIn(1000, function(){
|
||||
|
||||
if(response.success){
|
||||
// $("#login-response-msg").html(response);
|
||||
// console.log();
|
||||
location.reload();
|
||||
}else{
|
||||
$("#login-response-msg").html(response.message);
|
||||
}
|
||||
//
|
||||
errorPlacement: function(error, element) {
|
||||
var placement = $(element).data('error');
|
||||
|
||||
// console.log(response.success);
|
||||
$("#btn-login").html('<span class="glyphicon glyphicon-log-in"></span> Sign In');
|
||||
});
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}/* login submit */
|
||||
if (placement) {
|
||||
|
||||
function submitRegisterForm (){
|
||||
var data = $("#frm-register").serialize();
|
||||
$(placement).append(error)
|
||||
|
||||
$.ajax({
|
||||
type : 'POST',
|
||||
url : "{{ url('/custom/register') }}",
|
||||
data : data,
|
||||
dataType : 'json',
|
||||
beforeSend: function() {
|
||||
$("#register-response-msg").fadeOut();
|
||||
$("#btn-register").html('Please wait <i class="fa fa-spinner fa-spin"></i>');
|
||||
},
|
||||
success : function(response){
|
||||
$("#register-response-msg").html("");
|
||||
$("#register-response-msg").fadeIn(1000, function(){
|
||||
|
||||
if(response.success){
|
||||
location.reload();
|
||||
}else{
|
||||
$("#register-response-msg").html(response.message);
|
||||
}
|
||||
$("#btn-register").html('Register');
|
||||
});
|
||||
} else {
|
||||
|
||||
// console.log(response);
|
||||
}
|
||||
});
|
||||
return false;
|
||||
error.insertAfter(element);
|
||||
|
||||
}
|
||||
</script>
|
||||
}
|
||||
},
|
||||
submitHandler: submitVoucher
|
||||
});
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
// $('.img-zoom').zoom();
|
||||
$('.inputName').keyup(function() {
|
||||
this.value = this.value.toLocaleUpperCase();
|
||||
});
|
||||
}); // end document ready
|
||||
|
||||
// $('.carousel').bcSwipe({ threshold: 50 });
|
||||
function submitLoginForm() {
|
||||
// method="POST" action="{{ url('/auth/login') }}"
|
||||
var data = $("#frm-login").serialize();
|
||||
// console.log(data)
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: "{{ url('/custom/auth') }}",
|
||||
data: data,
|
||||
dataType: 'json',
|
||||
beforeSend: function() {
|
||||
$("#login-response-msg").fadeOut();
|
||||
$("#btn-login").html('Signing in <i class="fa fa-spinner fa-spin"></i>');
|
||||
},
|
||||
success: function(response) {
|
||||
$("#login-response-msg").html("");
|
||||
$("#login-response-msg").fadeIn(1000, function() {
|
||||
|
||||
$('.btn-number').click(function(e){
|
||||
e.preventDefault();
|
||||
|
||||
fieldName = $(this).attr('data-field');
|
||||
type = $(this).attr('data-type');
|
||||
var input = $("input[name='"+fieldName+"']");
|
||||
var currentVal = parseInt(input.val());
|
||||
if (!isNaN(currentVal)) {
|
||||
if(type == 'minus') {
|
||||
|
||||
if(currentVal > input.attr('min')) {
|
||||
input.val(currentVal - 1).change();
|
||||
}
|
||||
if(parseInt(input.val()) == input.attr('min')) {
|
||||
$(this).attr('disabled', true);
|
||||
}
|
||||
if (response.success) {
|
||||
// $("#login-response-msg").html(response);
|
||||
// console.log();
|
||||
location.reload();
|
||||
} else {
|
||||
$("#login-response-msg").html(response.message);
|
||||
}
|
||||
//
|
||||
|
||||
} else if(type == 'plus') {
|
||||
// console.log(response.success);
|
||||
$("#btn-login").html(
|
||||
'<span class="glyphicon glyphicon-log-in"></span> Sign In');
|
||||
});
|
||||
}
|
||||
});
|
||||
return false;
|
||||
} /* login submit */
|
||||
|
||||
if(currentVal < input.attr('max')) {
|
||||
input.val(currentVal + 1).change();
|
||||
}
|
||||
if(parseInt(input.val()) == input.attr('max')) {
|
||||
$(this).attr('disabled', true);
|
||||
}
|
||||
function submitRegisterForm() {
|
||||
var data = $("#frm-register").serialize();
|
||||
|
||||
}
|
||||
} else {
|
||||
input.val(0);
|
||||
}
|
||||
});
|
||||
|
||||
$('#myCarousel').on('slid.bs.carousel', function (e) {
|
||||
var id = $('.item.active').data('slide-number');
|
||||
// $('#carousel-text').html($('#slide-content-'+id).html());
|
||||
// console.log(id)
|
||||
$('.a_thumbnail').removeClass('active');
|
||||
$('#carousel-selector-'+id).addClass('active');
|
||||
});
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: "{{ url('/custom/register') }}",
|
||||
data: data,
|
||||
dataType: 'json',
|
||||
beforeSend: function() {
|
||||
$("#register-response-msg").fadeOut();
|
||||
$("#btn-register").html('Please wait <i class="fa fa-spinner fa-spin"></i>');
|
||||
},
|
||||
success: function(response) {
|
||||
$("#register-response-msg").html("");
|
||||
$("#register-response-msg").fadeIn(1000, function() {
|
||||
|
||||
$('.input-number').focusin(function(){
|
||||
$(this).data('oldValue', $(this).val());
|
||||
});
|
||||
if (response.success) {
|
||||
location.reload();
|
||||
} else {
|
||||
$("#register-response-msg").html(response.message);
|
||||
}
|
||||
$("#btn-register").html('Register');
|
||||
});
|
||||
|
||||
$('.input-number').change(function() {
|
||||
|
||||
minValue = parseInt($(this).attr('min'));
|
||||
maxValue = parseInt($(this).attr('max'));
|
||||
valueCurrent = parseInt($(this).val());
|
||||
|
||||
name = $(this).attr('name');
|
||||
if(valueCurrent >= minValue) {
|
||||
$(".btn-number[data-type='minus'][data-field='"+name+"']").removeAttr('disabled')
|
||||
} else {
|
||||
alert('Sorry, the minimum value was reached');
|
||||
$(this).val($(this).data('oldValue'));
|
||||
}
|
||||
if(valueCurrent <= maxValue) {
|
||||
$(".btn-number[data-type='plus'][data-field='"+name+"']").removeAttr('disabled')
|
||||
} else {
|
||||
alert('Sorry, the maximum value was reached');
|
||||
$(this).val($(this).data('oldValue'));
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
// console.log(response);
|
||||
}
|
||||
});
|
||||
return false;
|
||||
|
||||
$(".input-number").keydown(function (e) {
|
||||
// Allow: backspace, delete, tab, escape, enter and .
|
||||
if ($.inArray(e.keyCode, [46, 8, 9, 27, 13, 190]) !== -1 ||
|
||||
// Allow: Ctrl+A
|
||||
(e.keyCode == 65 && e.ctrlKey === true) ||
|
||||
// Allow: home, end, left, right
|
||||
(e.keyCode >= 35 && e.keyCode <= 39)) {
|
||||
// let it happen, don't do anything
|
||||
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)) {
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$('.multi-item-carousel .item').each(function(){
|
||||
var next = $(this).next();
|
||||
if (!next.length) {
|
||||
next = $(this).siblings(':first');
|
||||
}
|
||||
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>');
|
||||
|
||||
next.children(':first-child').clone().appendTo($(this));
|
||||
|
||||
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);
|
||||
|
||||
for (var i=0; i<2; i++){
|
||||
|
||||
next=next.next();
|
||||
|
||||
if (!next.length){
|
||||
next=$(this).siblings(':first');
|
||||
}
|
||||
next.children(':first-child').clone().appendTo($(this));
|
||||
}
|
||||
} else {
|
||||
$("#error_voucher").html(response.message).fadeIn().delay(5000).fadeOut('slow',
|
||||
function() {
|
||||
$("#error_voucher").html("");
|
||||
$("#error_voucher").css("display", "block");
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
|
||||
});
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
// $('.img-zoom').zoom();
|
||||
$('.inputName').keyup(function() {
|
||||
this.value = this.value.toLocaleUpperCase();
|
||||
});
|
||||
|
||||
$('#jersey_chk').click(function(){
|
||||
// $('.carousel').bcSwipe({ threshold: 50 });
|
||||
|
||||
var product_price = $('#product_price').val();
|
||||
var getPriceHold = $('#price_holder').val();
|
||||
var getHalf = getPriceHold / 2;
|
||||
|
||||
if($(this).is(':checked')){
|
||||
$('.td-hide').css('display', '');
|
||||
$('.th-hide').css('display', '');
|
||||
|
||||
$('#product_price').val(Number(product_price) + Number(getHalf));
|
||||
$('#display-product-price').html('$ ' + $('#product_price').val());
|
||||
// console.log($('#product_price').val() - getHalf);
|
||||
}else{
|
||||
$('.cls-uniformName').val('');
|
||||
$('.td-hide').css('display', 'none');
|
||||
$('.th-hide').css('display', 'none');
|
||||
$('.btn-number').click(function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
$('#product_price').val(Number(product_price) - Number(getHalf));
|
||||
$('#display-product-price').html('$ ' + $('#product_price').val());
|
||||
// console.log($('#product_price').val() + getHalf);
|
||||
}
|
||||
// console.log($(this).is(':checked'));
|
||||
});
|
||||
fieldName = $(this).attr('data-field');
|
||||
type = $(this).attr('data-type');
|
||||
var input = $("input[name='" + fieldName + "']");
|
||||
var currentVal = parseInt(input.val());
|
||||
if (!isNaN(currentVal)) {
|
||||
if (type == 'minus') {
|
||||
|
||||
$('#shorts_chk').click(function(){
|
||||
if (currentVal > input.attr('min')) {
|
||||
input.val(currentVal - 1).change();
|
||||
}
|
||||
if (parseInt(input.val()) == input.attr('min')) {
|
||||
$(this).attr('disabled', true);
|
||||
}
|
||||
|
||||
var product_price = $('#product_price').val();
|
||||
var getPriceHold = $('#price_holder').val();
|
||||
var getHalf = getPriceHold / 2;
|
||||
} else if (type == 'plus') {
|
||||
|
||||
if($(this).is(':checked')){
|
||||
$('#product_price').val(Number(product_price) + Number(getHalf));
|
||||
$('#display-product-price').html('$ ' + $('#product_price').val());
|
||||
}else{
|
||||
if (currentVal < input.attr('max')) {
|
||||
input.val(currentVal + 1).change();
|
||||
}
|
||||
if (parseInt(input.val()) == input.attr('max')) {
|
||||
$(this).attr('disabled', true);
|
||||
}
|
||||
|
||||
$('#product_price').val(Number(product_price) - Number(getHalf));
|
||||
$('#display-product-price').html('$ ' + $('#product_price').val());
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on('input keyup', '.capitalizeText', function() {
|
||||
$(this).val($(this).val().toUpperCase());
|
||||
});
|
||||
}
|
||||
} else {
|
||||
input.val(0);
|
||||
}
|
||||
});
|
||||
|
||||
$('[id^=carousel-selector-]').click( function(){
|
||||
var id = this.id.substr(this.id.lastIndexOf("-") + 1);
|
||||
var id = parseInt(id);
|
||||
$('#myCarousel').carousel(id);
|
||||
$('.a_thumbnail').removeClass('active');
|
||||
$(this).addClass('active');
|
||||
});
|
||||
$('#myCarousel').on('slid.bs.carousel', function(e) {
|
||||
var id = $('.item.active').data('slide-number');
|
||||
// $('#carousel-text').html($('#slide-content-'+id).html());
|
||||
// console.log(id)
|
||||
$('.a_thumbnail').removeClass('active');
|
||||
$('#carousel-selector-' + id).addClass('active');
|
||||
});
|
||||
|
||||
$("#frm-order-list").validate({
|
||||
$('.input-number').focusin(function() {
|
||||
$(this).data('oldValue', $(this).val());
|
||||
});
|
||||
|
||||
rules: {
|
||||
$('.input-number').change(function() {
|
||||
|
||||
'order_jersey_size[]': {
|
||||
required: true
|
||||
},
|
||||
'order_shorts_size[]': {
|
||||
required: true
|
||||
},
|
||||
'order_number[]': {
|
||||
required: true
|
||||
}
|
||||
},
|
||||
|
||||
messages: {},
|
||||
errorPlacement: function(error, element) {
|
||||
var placement = $(element).data('error');
|
||||
if (placement) {
|
||||
$(placement).html(error);
|
||||
}
|
||||
},
|
||||
minValue = parseInt($(this).attr('min'));
|
||||
maxValue = parseInt($(this).attr('max'));
|
||||
valueCurrent = parseInt($(this).val());
|
||||
|
||||
success: function(error, element) {
|
||||
var placement = $(element).data('error');
|
||||
if (placement) {
|
||||
$(placement).html('');
|
||||
}
|
||||
},
|
||||
submitHandler: submitOrderListForm
|
||||
});
|
||||
name = $(this).attr('name');
|
||||
if (valueCurrent >= minValue) {
|
||||
$(".btn-number[data-type='minus'][data-field='" + name + "']").removeAttr('disabled')
|
||||
} else {
|
||||
alert('Sorry, the minimum value was reached');
|
||||
$(this).val($(this).data('oldValue'));
|
||||
}
|
||||
if (valueCurrent <= maxValue) {
|
||||
$(".btn-number[data-type='plus'][data-field='" + name + "']").removeAttr('disabled')
|
||||
} else {
|
||||
alert('Sorry, the maximum value was reached');
|
||||
$(this).val($(this).data('oldValue'));
|
||||
}
|
||||
|
||||
function submitOrderListForm(){
|
||||
var data = $("#frm-order-list").serializeArray();
|
||||
|
||||
$.ajax({
|
||||
type : 'POST',
|
||||
url : "{{ url('teamstore/q/add-to-cart') }}",
|
||||
data : data,
|
||||
dataType: 'json',
|
||||
beforeSend:function(xhr){
|
||||
var token = $('meta[name="csrf_token"]').attr('content');
|
||||
});
|
||||
|
||||
if (token) {
|
||||
return xhr.setRequestHeader('X-CSRF-TOKEN', token);
|
||||
}
|
||||
xhr.setRequestHeader( 'X-Requested-With', 'XMLHttpRequest');
|
||||
},
|
||||
success : function(response){
|
||||
|
||||
if(response.success){
|
||||
window.location = "{{ url('cart') }}";
|
||||
}else{
|
||||
alert(response.message);
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
return false;
|
||||
$(".input-number").keydown(function(e) {
|
||||
// Allow: backspace, delete, tab, escape, enter and .
|
||||
if ($.inArray(e.keyCode, [46, 8, 9, 27, 13, 190]) !== -1 ||
|
||||
// Allow: Ctrl+A
|
||||
(e.keyCode == 65 && e.ctrlKey === true) ||
|
||||
// Allow: home, end, left, right
|
||||
(e.keyCode >= 35 && e.keyCode <= 39)) {
|
||||
// let it happen, don't do anything
|
||||
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)) {
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ adding of rows @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
|
||||
$(document).on('button click', '#addNewRow', function(){
|
||||
var p_id = $('#p_id').val();
|
||||
$.ajax({ //create an ajax request to load_page.php
|
||||
type: "POST",
|
||||
url: "{{ url('/teamstore/q/add-new-row') }}",
|
||||
data: {
|
||||
p_id : p_id
|
||||
},
|
||||
$('.multi-item-carousel .item').each(function() {
|
||||
var next = $(this).next();
|
||||
if (!next.length) {
|
||||
next = $(this).siblings(':first');
|
||||
}
|
||||
|
||||
dataType: "html", //expect html to be returned
|
||||
beforeSend:function(xhr){
|
||||
var token = $('meta[name="csrf_token"]').attr('content');
|
||||
next.children(':first-child').clone().appendTo($(this));
|
||||
|
||||
if (token) {
|
||||
return xhr.setRequestHeader('X-CSRF-TOKEN', token);
|
||||
}
|
||||
xhr.setRequestHeader( 'X-Requested-With', 'XMLHttpRequest');
|
||||
},
|
||||
|
||||
success: function(response){
|
||||
for (var i = 0; i < 2; i++) {
|
||||
|
||||
var d = new Date();
|
||||
var n = d.getTime();
|
||||
next = next.next();
|
||||
|
||||
var parser = new DOMParser();
|
||||
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
|
||||
$('#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>');
|
||||
$('#orderListPanel').scrollTop($('#orderListPanel')[0].scrollHeight);
|
||||
$('.inputName').keyup(function() {
|
||||
this.value = this.value.toLocaleUpperCase();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ end adding of rows @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
|
||||
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ removing of rows @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
$(document).on('button click', '.removeRow', function(){
|
||||
var str = $(this).closest('tr').attr('class');
|
||||
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>');
|
||||
}
|
||||
$('.'+str).remove();
|
||||
});
|
||||
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ end removing of rows @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
}); //end document ready
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
if (!next.length) {
|
||||
next = $(this).siblings(':first');
|
||||
}
|
||||
next.children(':first-child').clone().appendTo($(this));
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$('#jersey_chk').click(function() {
|
||||
|
||||
var product_price = $('#product_price').val();
|
||||
var getPriceHold = $('#price_holder').val();
|
||||
var getHalf = getPriceHold / 2;
|
||||
|
||||
if ($(this).is(':checked')) {
|
||||
$('.td-hide').css('display', '');
|
||||
$('.th-hide').css('display', '');
|
||||
|
||||
$('#product_price').val(Number(product_price) + Number(getHalf));
|
||||
$('#display-product-price').html('$ ' + $('#product_price').val());
|
||||
// console.log($('#product_price').val() - getHalf);
|
||||
} else {
|
||||
$('.cls-uniformName').val('');
|
||||
$('.td-hide').css('display', 'none');
|
||||
$('.th-hide').css('display', 'none');
|
||||
|
||||
$('#product_price').val(Number(product_price) - Number(getHalf));
|
||||
$('#display-product-price').html('$ ' + $('#product_price').val());
|
||||
// console.log($('#product_price').val() + getHalf);
|
||||
}
|
||||
// console.log($(this).is(':checked'));
|
||||
});
|
||||
|
||||
$('#shorts_chk').click(function() {
|
||||
|
||||
var product_price = $('#product_price').val();
|
||||
var getPriceHold = $('#price_holder').val();
|
||||
var getHalf = getPriceHold / 2;
|
||||
|
||||
if ($(this).is(':checked')) {
|
||||
$('#product_price').val(Number(product_price) + Number(getHalf));
|
||||
$('#display-product-price').html('$ ' + $('#product_price').val());
|
||||
} else {
|
||||
|
||||
$('#product_price').val(Number(product_price) - Number(getHalf));
|
||||
$('#display-product-price').html('$ ' + $('#product_price').val());
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on('input keyup', '.capitalizeText', function() {
|
||||
$(this).val($(this).val().toUpperCase());
|
||||
});
|
||||
|
||||
$('[id^=carousel-selector-]').click(function() {
|
||||
var id = this.id.substr(this.id.lastIndexOf("-") + 1);
|
||||
var id = parseInt(id);
|
||||
$('#myCarousel').carousel(id);
|
||||
$('.a_thumbnail').removeClass('active');
|
||||
$(this).addClass('active');
|
||||
});
|
||||
|
||||
$("#frm-order-list").validate({
|
||||
|
||||
rules: {
|
||||
|
||||
'order_jersey_size[]': {
|
||||
required: true
|
||||
},
|
||||
'order_shorts_size[]': {
|
||||
required: true
|
||||
},
|
||||
'order_number[]': {
|
||||
required: true
|
||||
}
|
||||
},
|
||||
|
||||
messages: {},
|
||||
errorPlacement: function(error, element) {
|
||||
var placement = $(element).data('error');
|
||||
if (placement) {
|
||||
$(placement).html(error);
|
||||
}
|
||||
},
|
||||
|
||||
success: function(error, element) {
|
||||
var placement = $(element).data('error');
|
||||
if (placement) {
|
||||
$(placement).html('');
|
||||
}
|
||||
},
|
||||
submitHandler: submitOrderListForm
|
||||
});
|
||||
|
||||
function submitOrderListForm() {
|
||||
var data = $("#frm-order-list").serializeArray();
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: "{{ url('teamstore/q/add-to-cart') }}",
|
||||
data: data,
|
||||
dataType: 'json',
|
||||
beforeSend: function(xhr) {
|
||||
var token = $('meta[name="csrf_token"]').attr('content');
|
||||
|
||||
if (token) {
|
||||
return xhr.setRequestHeader('X-CSRF-TOKEN', token);
|
||||
}
|
||||
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
|
||||
},
|
||||
success: function(response) {
|
||||
|
||||
if (response.success) {
|
||||
window.location = "{{ url('cart') }}";
|
||||
} else {
|
||||
alert(response.message);
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ adding of rows @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
|
||||
$(document).on('button click', '#addNewRow', function() {
|
||||
var p_id = $('#p_id').val();
|
||||
$.ajax({ //create an ajax request to load_page.php
|
||||
type: "POST",
|
||||
url: "{{ url('/teamstore/q/add-new-row') }}",
|
||||
data: {
|
||||
p_id: p_id
|
||||
},
|
||||
|
||||
dataType: "html", //expect html to be returned
|
||||
beforeSend: function(xhr) {
|
||||
var token = $('meta[name="csrf_token"]').attr('content');
|
||||
|
||||
if (token) {
|
||||
return xhr.setRequestHeader('X-CSRF-TOKEN', token);
|
||||
}
|
||||
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
|
||||
},
|
||||
|
||||
success: function(response) {
|
||||
|
||||
var d = new Date();
|
||||
var n = d.getTime();
|
||||
|
||||
var parser = new DOMParser();
|
||||
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
|
||||
$('#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>'
|
||||
);
|
||||
$('#orderListPanel').scrollTop($('#orderListPanel')[0].scrollHeight);
|
||||
$('.inputName').keyup(function() {
|
||||
this.value = this.value.toLocaleUpperCase();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ end adding of rows @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
|
||||
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ removing of rows @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
$(document).on('button click', '.removeRow', function() {
|
||||
var str = $(this).closest('tr').attr('class');
|
||||
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>'
|
||||
);
|
||||
}
|
||||
$('.' + str).remove();
|
||||
});
|
||||
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ end removing of rows @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
}); //end document ready
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user