diff --git a/resources/views/merchbay_main.blade.php b/resources/views/merchbay_main.blade.php index 7f6ea9b..1b5605e 100755 --- a/resources/views/merchbay_main.blade.php +++ b/resources/views/merchbay_main.blade.php @@ -1,488 +1,570 @@ - + + - + - + Merchbay - + - - - - + + + + - - - - + + + + + @include('merchbay.navbar')
-
- @yield('main-content') -
- @include('merchbay.footer') +
+ @yield('main-content') +
+ @include('merchbay.footer')
- + - - + + - + } + }, + submitHandler: submitVoucher + }); - - }); + - - \ No newline at end of file + 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( + '' + ); + $('.tr-remove-btn').html( + '' + ); + $('#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( + '' + ); + } + $('.' + str).remove(); + }); + // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ end removing of rows @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + }); //end document ready + + + +