added roster

This commit is contained in:
franknstayn
2022-03-03 23:28:28 +08:00
parent c10c536dba
commit c946685844
9 changed files with 451 additions and 361 deletions

View File

@@ -212,6 +212,7 @@ class TeamStoreController extends Controller
$thumbnails_array = $m->getThumbnails($product_array[0]->Id);
$teams_array = $m->getTeams($product_array[0]->Id);
$selectRoster = $m->selectRoster($product_array[0]->Id);
// $sizes_array = $m->getSizes();
if (empty($thumbnails_array)) {
@@ -255,7 +256,8 @@ class TeamStoreController extends Controller
->with('teams_array', $teams_array)
->with('sizes_array', $sizes_array)
->with('available_qty', $availableQty)
->with('store_products', $store_products);
->with('store_products', $store_products)
->with('roster', $selectRoster);
}
public function login(Request $request)
@@ -295,9 +297,12 @@ class TeamStoreController extends Controller
$availableQty = null;
}
$selectRoster = $TeamStoreModel->selectRoster($item[0]->Id);
$handle_form = view('teamstore-sublayouts.forms.' . $item[0]->ProductForm)
->with('sizes_array', $sizes_array)
->with('availableQty', $availableQty)
->with('roster', $selectRoster)
->render();
return $handle_form;
@@ -416,7 +421,7 @@ class TeamStoreController extends Controller
'ShippingCostId' => $shipping_cost_id
);
}
} elseif ($product_form == "name-number-size-form") {
} elseif ($product_form == "name-number-size-form" || $product_form == "roster-name-number-size-form") {
$order_names = $post['order_names'];
$order_number = $post['order_number'];

View File

@@ -285,4 +285,12 @@ class TeamStoreModel extends Model
$i = DB::select("SELECT * FROM teamstores WHERE IsActive = 'true' ORDER BY RAND() LIMIT 10");
return $i;
}
function selectRoster($productId){
$i = DB::table('roster')
->where("ProductId", $productId)
->get();
return $i;
}
}

View File

@@ -490,7 +490,7 @@
<td><b>Price</b></td>
<td><b>Quantity</b></td>
</tr>
@elseif($item->FormUsed == 'name-number-size-form')
@elseif($item->FormUsed == 'name-number-size-form' || $item->FormUsed == "roster-name-number-size-form")
<tr>
<th>Name</th>
<th>Number</th>
@@ -590,7 +590,7 @@
</td>
</tr>
@elseif($item->FormUsed == 'name-number-size-form')
@elseif($item->FormUsed == 'name-number-size-form' || $item->FormUsed == "roster-name-number-size-form")
<tr>
<td>{{ $sub_item->Name }}
</td>

View File

@@ -128,7 +128,7 @@
<th></th>
</tr>
@elseif($item->FormUsed == 'name-number-size-form')
@elseif($item->FormUsed == 'name-number-size-form' || $item->FormUsed == "roster-name-number-size-form")
<tr>
<th>Name</th>
<th>Number</th>
@@ -229,7 +229,7 @@
href="{{ url('removeitem') }}/{{ $sub_item->Id }}"><i
class="fa fa-times"></i></a></td>
</tr>
@elseif($item->FormUsed == 'name-number-size-form')
@elseif($item->FormUsed == 'name-number-size-form' || $item->FormUsed == "roster-name-number-size-form")
<tr>
<td>{{ $sub_item->Name }}</td>
<td>{{ $sub_item->Number }}</td>

View File

@@ -34,20 +34,28 @@
</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',
! 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>
<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>
@@ -780,6 +788,14 @@
$('.' + 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)
});
}); //end document ready
</script>
</body>

View File

@@ -1,17 +1,18 @@
<!DOCTYPE html>
<html lang="en">
<head>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="Custom Uniforms offered in a variety colors to match your team. Browse through our baseball, fastpitch, softball, lacrosse, football, volleyball and basketball gear.">
<meta name="keywords" content="custom uniforms, footwear, athletic equipment, sporting goods">
<meta name="author" content="Frank John Begornia">
<meta name="author" content="Kidneo">
<meta name="csrf_token" content="{{ csrf_token() }}" />
<meta name="company_url" content="{{ $store_array[0]->StoreUrl }}" />
<meta property="og:url" content="https://crewsportswear.com" />
<meta property="og:url" content="https://merchbay.com" />
<meta property="og:type" content="article" />
<meta property="og:title" content="CREW Apparel" />
<meta property="og:description" content="Custom Uniforms offered in a variety colors to match your team. Browse through our baseball, fastpitch, softball, lacrosse, football, volleyball and basketball gear." />
@@ -60,14 +61,17 @@
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-136108155-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date());
gtag('config', 'UA-136108155-1');
</script>
</head>
</head>
<body>
<body>
@include('layout.navbar')
<!-- Example row of columns -->
@yield('content')
@@ -95,31 +99,33 @@
this.value = this.value.toLocaleUpperCase();
});
$('.carousel').bcSwipe({ threshold: 50 });
$('.carousel').bcSwipe({
threshold: 50
});
$('.btn-number').click(function(e){
$('.btn-number').click(function(e) {
e.preventDefault();
fieldName = $(this).attr('data-field');
type = $(this).attr('data-type');
var input = $("input[name='"+fieldName+"']");
var input = $("input[name='" + fieldName + "']");
var currentVal = parseInt(input.val());
if (!isNaN(currentVal)) {
if(type == 'minus') {
if (type == 'minus') {
if(currentVal > input.attr('min')) {
if (currentVal > input.attr('min')) {
input.val(currentVal - 1).change();
}
if(parseInt(input.val()) == input.attr('min')) {
if (parseInt(input.val()) == input.attr('min')) {
$(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();
}
if(parseInt(input.val()) == input.attr('max')) {
if (parseInt(input.val()) == input.attr('max')) {
$(this).attr('disabled', true);
}
@@ -129,15 +135,15 @@
}
});
$('#myCarousel').on('slid.bs.carousel', function (e) {
$('#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');
$('#carousel-selector-' + id).addClass('active');
});
$('.input-number').focusin(function(){
$('.input-number').focusin(function() {
$(this).data('oldValue', $(this).val());
});
@@ -148,14 +154,14 @@
valueCurrent = parseInt($(this).val());
name = $(this).attr('name');
if(valueCurrent >= minValue) {
$(".btn-number[data-type='minus'][data-field='"+name+"']").removeAttr('disabled')
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')
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'));
@@ -164,7 +170,7 @@
});
$(".input-number").keydown(function (e) {
$(".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
@@ -180,7 +186,7 @@
}
});
$('.multi-item-carousel .item').each(function(){
$('.multi-item-carousel .item').each(function() {
var next = $(this).next();
if (!next.length) {
next = $(this).siblings(':first');
@@ -189,32 +195,32 @@
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){
next=$(this).siblings(':first');
if (!next.length) {
next = $(this).siblings(':first');
}
next.children(':first-child').clone().appendTo($(this));
}
});
$('#jersey_chk').click(function(){
$('#jersey_chk').click(function() {
var product_price = $('#product_price').val();
var getPriceHold = $('#price_holder').val();
var getHalf = getPriceHold / 2;
if($(this).is(':checked')){
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{
} else {
$('.cls-uniformName').val('');
$('.td-hide').css('display', 'none');
$('.th-hide').css('display', 'none');
@@ -226,16 +232,16 @@
// console.log($(this).is(':checked'));
});
$('#shorts_chk').click(function(){
$('#shorts_chk').click(function() {
var product_price = $('#product_price').val();
var getPriceHold = $('#price_holder').val();
var getHalf = getPriceHold / 2;
if($(this).is(':checked')){
if ($(this).is(':checked')) {
$('#product_price').val(Number(product_price) + Number(getHalf));
$('#display-product-price').html('$ ' + $('#product_price').val());
}else{
} else {
$('#product_price').val(Number(product_price) - Number(getHalf));
$('#display-product-price').html('$ ' + $('#product_price').val());
@@ -246,7 +252,7 @@
$(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 = parseInt(id);
$('#myCarousel').carousel(id);
@@ -286,27 +292,27 @@
submitHandler: submitOrderListForm
});
function submitOrderListForm(){
function submitOrderListForm() {
var data = $("#frm-order-list").serializeArray();
$.ajax({
type : 'POST',
url : "{{ url('teamstore/q/add-to-cart') }}",
data : data,
type: 'POST',
url: "{{ url('teamstore/q/add-to-cart') }}",
data: data,
dataType: 'json',
beforeSend:function(xhr){
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');
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
},
success : function(response){
success: function(response) {
if(response.success){
if (response.success) {
window.location = "{{ url('cart') }}";
}else{
} else {
alert(response.message);
location.reload();
}
@@ -318,26 +324,26 @@
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ adding of rows @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
$(document).on('button click', '#addNewRow', function(){
$(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
p_id: p_id
},
dataType: "html", //expect html to be returned
beforeSend:function(xhr){
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');
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
},
success: function(response){
success: function(response) {
var d = new Date();
var n = d.getTime();
@@ -363,17 +369,21 @@
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ end adding 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 trCount = $('#tableRow tbody').children('tr').length;
if(trCount <= 2){
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();
$('.' + str).remove();
});
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ end removing of rows @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
}); //end document ready
</script>
</body>
</body>
</html>

View File

@@ -0,0 +1,51 @@
<div class="panel-design-details" id="orderListPanel">
<table class="table" id="tableRow" style="font-size:12px;">
<thead>
<tr>
<!-- <th>#</th> -->
<th class="col-md-5">Name / Number</th>
<!-- <th class="col-md-3">Number</th> -->
<th class="col-md-3">Size</th>
<th class="text-center"></th>
</tr>
</thead>
<tbody id="orderTableBody">
<tr class="table-tr-0">
<td class="w-50">
<!-- <input type="text" name="order_names[]" id="order_names" class="form-control input-sm inputName roster-input" placeholder="Name"> -->
<select class="form-control input-sm select-name" id="order_names" name="order_names[]">
<!-- <option value="none">none</option> -->
@foreach($roster as $ros)
<option value="{{ $ros->Name }}" data-number="{{ $ros->Number }}">{{ $ros->Name }} - {{ $ros->Number }}</option>
@endforeach
<!-- <option value="00">00</option> -->
</select>
</td>
<!-- <td> -->
<!-- <select class="form-control input-sm roster-input" name="order_number[]">
<option value="none">none</option>
@for($i = 0; $i <= 99; $i++)
<option value="{{ $i }}">{{ $i }}</option>
@endfor
<option value="00">00</option>
</select> -->
<input type="hidden" class="form-control input-sm roster-input" name="order_number[]" />
<!-- </td> -->
<td class="w-50">
<select class="form-control input-sm order-size roster-input" name="order_size[]" style="border-right: 1px solid #ccc;" data-row-number="1">
@foreach($sizes_array as $size)
<option value="{{ $size->Size }}">{{ $size->SizeDisplay }}</option>
@endforeach
</select>
</td>
<td id="action-column" class="text-center" style="padding: 4px !important; border-top: none">
<span class="tr-remove-btn">
<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>
</span>
</td>
</tr>
</tbody>
</table>
<div id="addnew-btn-tbl-row">
</div>
</div>

View File

@@ -70,7 +70,7 @@
<th>Price</th>
<th>Quantity</th>
</tr>
@elseif($array_item[0]->FormUsed=="name-number-size-form")
@elseif($array_item[0]->FormUsed=="name-number-size-form" || $array_item[0]->FormUsed == "roster-name-number-size-form")
<tr>
<th>Name</th>
<th>Number</th>
@@ -150,7 +150,7 @@
<td>{{ $array_item[0]->Quantity }}</td>
</tr>
@elseif($array_item[0]->FormUsed=="name-number-size-form")
@elseif($array_item[0]->FormUsed=="name-number-size-form" || $array_item[0]->FormUsed == "roster-name-number-size-form")
<tr>
<td>{{ $array_item[0]->Name }}</td>
<td>{{ $array_item[0]->Number }}</td>

View File

@@ -135,7 +135,7 @@
<th>Quantity</th>
</tr>
@elseif($item->FormUsed=="name-number-size-form")
@elseif($item->FormUsed=="name-number-size-form" || $item->FormUsed == "roster-name-number-size-form")
<tr>
<th>Name</th>
<th>Number</th>
@@ -197,7 +197,7 @@
<td>{{ $sub_item->Quantity }}</td>
</tr>
@elseif($item->FormUsed=="name-number-size-form")
@elseif($item->FormUsed=="name-number-size-form" || $item->FormUsed == "roster-name-number-size-form")
<tr>
<td>{{ $sub_item->Name }}</td>
<td>{{ $sub_item->Number }}</td>