- Updated Dockerfile configurations for various environments (alpine, basic, cloudrun, minimal, simple, test) to ensure compatibility with Laravel 5.0 and PHP 5.6. - Added PHP compatibility documentation outlining mcrypt requirements and upgrade paths. - Created cloudbuild.yaml for Google Cloud Build integration to streamline deployment to Cloud Run. - Introduced docker-compose.local.yml for local development with MySQL and Redis services. - Enhanced rebuild.sh script for easier local development and migration handling. - Updated Laravel Blade views to correct asset paths. - Added start-local.sh script for quick local setup and service management.
811 lines
32 KiB
PHP
Executable File
811 lines
32 KiB
PHP
Executable File
<!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">
|
|
|
|
<title>Merchbay</title>
|
|
<link rel="icon" href="{{ asset('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('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>
|
|
|
|
<meta name="facebook-domain-verification" content="tbum5il0csyvzwvvrosy5dk2534zn0" />
|
|
<script>
|
|
window.dataLayer = window.dataLayer || [];
|
|
|
|
function gtag() {
|
|
dataLayer.push(arguments);
|
|
}
|
|
gtag('js', new Date());
|
|
|
|
gtag('config', 'G-SB3QK6BR1N');
|
|
</script>
|
|
<!-- Meta Pixel Code -->
|
|
<script>
|
|
! function(f, b, e, v, n, t, s) {
|
|
if (f.fbq) return;
|
|
n = f.fbq = function() {
|
|
n.callMethod ?
|
|
n.callMethod.apply(n, arguments) : n.queue.push(arguments)
|
|
};
|
|
if (!f._fbq) f._fbq = n;
|
|
n.push = n;
|
|
n.loaded = !0;
|
|
n.version = '2.0';
|
|
n.queue = [];
|
|
t = b.createElement(e);
|
|
t.async = !0;
|
|
t.src = v;
|
|
s = b.getElementsByTagName(e)[0];
|
|
s.parentNode.insertBefore(t, s)
|
|
}(window, document, 'script',
|
|
'https://connect.facebook.net/en_US/fbevents.js');
|
|
fbq('init', '466782825021431');
|
|
fbq('track', 'PageView');
|
|
</script>
|
|
<noscript><img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=466782825021431&ev=PageView&noscript=1" /></noscript>
|
|
<!-- End Meta Pixel Code -->
|
|
</head>
|
|
|
|
<body>
|
|
<!-- Load Facebook SDK for JavaScript -->
|
|
<!-- <div id="fb-root"></div>
|
|
<script>
|
|
window.fbAsyncInit = function() {
|
|
FB.init({
|
|
xfbml: true,
|
|
version: 'v12.0'
|
|
});
|
|
};
|
|
|
|
(function(d, s, id) {
|
|
var js, fjs = d.getElementsByTagName(s)[0];
|
|
if (d.getElementById(id)) return;
|
|
js = d.createElement(s);
|
|
js.id = id;
|
|
js.src = 'https://connect.facebook.net/en_US/sdk/xfbml.customerchat.js';
|
|
fjs.parentNode.insertBefore(js, fjs);
|
|
}(document, 'script', 'facebook-jssdk'));
|
|
</script> -->
|
|
@include('merchbay.navbar')
|
|
<div class="container">
|
|
<div class="wrapper bg-white">
|
|
@yield('main-content')
|
|
|
|
<!-- Your Chat Plugin code -->
|
|
<div class="fb-customerchat" attribution="install_email" attribution_version="biz_inbox" page_id="107414144973415">
|
|
</div>
|
|
</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="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>');
|
|
}
|
|
});
|
|
|
|
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-register").validate({
|
|
rules: {
|
|
firstname: {
|
|
required: true
|
|
},
|
|
lastname: {
|
|
required: true
|
|
},
|
|
// username: {
|
|
// required: true
|
|
// },
|
|
email: {
|
|
required: true,
|
|
email: true
|
|
},
|
|
password: {
|
|
required: true
|
|
//minlength: 6 // <-- removed underscore
|
|
},
|
|
mobilenumber: {
|
|
required: true
|
|
},
|
|
address: {
|
|
required: true
|
|
},
|
|
state: {
|
|
required: true
|
|
},
|
|
city: {
|
|
required: true
|
|
},
|
|
zipcode: {
|
|
required: true
|
|
},
|
|
countryCode: {
|
|
required: true
|
|
}
|
|
},
|
|
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() {
|
|
|
|
$('#_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();
|
|
});
|
|
|
|
$("#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
|
|
|
|
|
|
function getSelectedCountry() {
|
|
var selectedState = $('#select_country').data('selected');
|
|
if (selectedState) {
|
|
// console.log(selectedState)
|
|
$("#select_country").val(selectedState).change();
|
|
// selectCountry()
|
|
}
|
|
|
|
}
|
|
|
|
function selectCountry(item) {
|
|
|
|
const country = item.options[item.selectedIndex].text;
|
|
const countryCode = item.options[item.selectedIndex].value
|
|
console.log(countryCode)
|
|
|
|
if (countryCode === "US") {
|
|
fetchUSA()
|
|
}
|
|
|
|
if (countryCode === "CA") {
|
|
fetchCanada()
|
|
}
|
|
|
|
}
|
|
|
|
function fetchCanada() {
|
|
$.getJSON("{{ asset('/api/canada.json') }}", function(items) {
|
|
var states = [];
|
|
|
|
Object.keys(items).forEach(function(state) {
|
|
states.push(state)
|
|
});
|
|
|
|
var uniqueStates = Array.from(new Set(states));
|
|
var selectedState = $('#lst-states').data('selected');
|
|
|
|
$('.dynamic-state').remove();
|
|
$('.dynamic-city').remove();
|
|
uniqueStates.sort().forEach(function(key) {
|
|
if (selectedState == key) {
|
|
$('#lst-states').append('<option value="' + key + '" selected class="dynamic-state">' + key + '</option>');
|
|
|
|
var cities = [];
|
|
cities = items[selectedState];
|
|
var uniqueCities = Array.from(new Set(cities));
|
|
var selectedCity = $('#lst-cities').data('selected');
|
|
$('.dynamic-city').remove();
|
|
uniqueCities.sort().forEach(function(key) {
|
|
if (selectedCity == key) {
|
|
$('#lst-cities').append('<option value="' + key + '" class="dynamic-city" selected>' + key + '</option>');
|
|
} else {
|
|
$('#lst-cities').append('<option value="' + key + '" class="dynamic-city">' + key + '</option>');
|
|
}
|
|
});
|
|
|
|
} else {
|
|
$('#lst-states').append('<option value="' + key + '" class="dynamic-state">' + key + '</option>');
|
|
}
|
|
});
|
|
|
|
|
|
$(document).on('select change', '#lst-states', function() {
|
|
var cities = [];
|
|
var selectedState = $(this).val()
|
|
cities = items[selectedState];
|
|
var uniqueCities = Array.from(new Set(cities));
|
|
$('.dynamic-city').remove();
|
|
uniqueCities.sort().forEach(function(key) {
|
|
$('#lst-cities').append('<option value="' + key + '" class="dynamic-city">' + key + '</option>');
|
|
});
|
|
});
|
|
});
|
|
}
|
|
|
|
function fetchUSA() {
|
|
$.getJSON("{{ asset('/api/usaCities.json') }}", function(data) {
|
|
var states = [];
|
|
|
|
for (i = 0; i < data.length; i++) {
|
|
states.push(data[i]['state']);
|
|
}
|
|
var uniqueStates = Array.from(new Set(states));
|
|
var selectedState = $('#lst-states').data('selected');
|
|
$('.dynamic-state').remove();
|
|
$('.dynamic-city').remove();
|
|
uniqueStates.sort().forEach(function(key) {
|
|
if (selectedState == key) {
|
|
$('#lst-states').append('<option value="' + key + '" selected class="dynamic-state">' + key + '</option>');
|
|
//
|
|
var cities = [];
|
|
for (i = 0; i < data.length; i++) {
|
|
console.log(data[i])
|
|
cities.push(data[i]);
|
|
}
|
|
var city = getCities(cities, key);
|
|
var uniqueCities = Array.from(new Set(city));
|
|
var selectedCity = $('#lst-cities').data('selected');
|
|
$('.dynamic-city').remove();
|
|
uniqueCities.sort().forEach(function(key) {
|
|
if (selectedCity == key) {
|
|
$('#lst-cities').append('<option value="' + key + '" class="dynamic-city" selected>' + key + '</option>');
|
|
} else {
|
|
$('#lst-cities').append('<option value="' + key + '" class="dynamic-city">' + key + '</option>');
|
|
}
|
|
});
|
|
|
|
} else {
|
|
$('#lst-states').append('<option value="' + key + '" class="dynamic-state">' + key + '</option>');
|
|
}
|
|
});
|
|
|
|
|
|
|
|
$(document).on('select change', '#lst-states', function() {
|
|
var cities = [];
|
|
for (i = 0; i < data.length; i++) {
|
|
cities.push(data[i]);
|
|
}
|
|
var city = getCities(cities, $(this).val());
|
|
var uniqueCities = Array.from(new Set(city));
|
|
$('.dynamic-city').remove();
|
|
uniqueCities.sort().forEach(function(key) {
|
|
|
|
$('#lst-cities').append('<option value="' + key + '" class="dynamic-city">' + key + '</option>');
|
|
});
|
|
});
|
|
|
|
});
|
|
}
|
|
|
|
function getCities(arr, q) {
|
|
var sd = [];
|
|
arr.find(function(element) {
|
|
if (element['state'] == q) {
|
|
sd.push(element['city']);
|
|
}
|
|
});
|
|
return sd;
|
|
}
|
|
|
|
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(response);
|
|
// location.reload();
|
|
if (response.redirect != "") {
|
|
window.location = response.redirect;
|
|
} else {
|
|
location.reload();
|
|
}
|
|
} else {
|
|
$("#login-response-msg").html(response.message);
|
|
}
|
|
//
|
|
|
|
// console.log(response.success);
|
|
$("#btn-login").html(
|
|
'<span class="glyphicon glyphicon-log-in"></span> Sign In');
|
|
});
|
|
}
|
|
});
|
|
return false;
|
|
} /* login submit */
|
|
|
|
function submitRegisterForm() {
|
|
|
|
var data = $("#frm-register").serializeArray();
|
|
data.push({
|
|
name: "country",
|
|
value: $("#select_country option:selected").text()
|
|
});
|
|
// var data = $("#frm-register").serialize();
|
|
|
|
$.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) {
|
|
if (response.redirect != "") {
|
|
window.location = response.redirect;
|
|
} else {
|
|
location.reload();
|
|
}
|
|
} else {
|
|
$("#register-response-msg").html(response.message);
|
|
}
|
|
$("#btn-register").html('Register');
|
|
});
|
|
|
|
// console.log(response);
|
|
}
|
|
});
|
|
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_total').text(response.total);
|
|
$('#my_subtotal').text(response.subtotal);
|
|
$('#shippingFee').text(response.shippingFee);
|
|
$('#remaining_shippingfee').text(response.remaining_shippingfee);
|
|
|
|
|
|
} 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();
|
|
});
|
|
|
|
// $('.carousel').bcSwipe({ threshold: 50 });
|
|
|
|
$('.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);
|
|
}
|
|
|
|
} else if (type == 'plus') {
|
|
|
|
if (currentVal < input.attr('max')) {
|
|
input.val(currentVal + 1).change();
|
|
}
|
|
if (parseInt(input.val()) == input.attr('max')) {
|
|
$(this).attr('disabled', true);
|
|
}
|
|
|
|
}
|
|
} 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');
|
|
});
|
|
|
|
$('.input-number').focusin(function() {
|
|
$(this).data('oldValue', $(this).val());
|
|
});
|
|
|
|
$('.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'));
|
|
}
|
|
|
|
|
|
});
|
|
|
|
$(".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');
|
|
}
|
|
|
|
next.children(':first-child').clone().appendTo($(this));
|
|
|
|
|
|
for (var i = 0; i < 2; i++) {
|
|
|
|
next = next.next();
|
|
|
|
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 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
|
|
$(document).on('select change', '.select-name', function() {
|
|
|
|
var selected = $(this).find('option:selected');
|
|
var number = selected.attr('data-number');
|
|
var name = selected.val();
|
|
$(this).closest("tr").find("input[name='order_number[]']").val(number)
|
|
});
|
|
|
|
|
|
$('#filter_product').change(function() {
|
|
this.form.submit();
|
|
});
|
|
}); //end document ready
|
|
</script>
|
|
</body>
|
|
|
|
</html> |