fixed shopping card bugs

improved panel ui/ux
fixed product page select by quantity
pull/26/head
A1Gard 1 year ago
parent 3e8513f3be
commit 1794d1853a

@ -12,9 +12,11 @@ class TransportController extends Controller
{ {
function createOrUpdate(Transport $transport,TransportSaveRequest $request){ function createOrUpdate(Transport $transport,TransportSaveRequest $request){
$transport->price = $request->price; $transport->price = $request->price;
$transport->title = $request->title; $transport->title = $request->title;
$transport->description = $request->description; $transport->description = $request->description;
$transport->is_default = $request->has('is_default');
if ($request->has('is_default')){ if ($request->has('is_default')){
Transport::where('is_default')->update([ Transport::where('is_default')->update([
'is_default' => 0, 'is_default' => 0,

@ -11437,6 +11437,48 @@ h3.textt{
transform: scale(1); transform: scale(1);
} }
} }
.color-pick .color {
display: inline-block;
opacity: 0.75;
margin-right: 4px;
border-radius: 15px;
border: 1px dotted silver;
}
.color-pick .color span {
display: inline-block;
mix-blend-mode: darken;
font-size: 11px;
padding-right: 4px;
padding-left: 4px;
}
.color-pick .color .cl {
float: left;
min-width: 25px;
height: 25px;
display: inline-block;
border-radius: 50%;
position: relative;
cursor: pointer;
}
.color-pick .color.active {
opacity: 1;
border: 1px solid black;
position: relative;
padding-right: 15px;
}
.color-pick .color.active .cl:after {
content: "✓";
right: 20%;
top: 5%;
position: absolute;
color: white;
mix-blend-mode: difference;
}
.x-mega-menu { .x-mega-menu {
background: #eeeeee; background: #eeeeee;
display: grid; display: grid;

File diff suppressed because one or more lines are too long

@ -403,3 +403,49 @@
transform: scale(1); transform: scale(1);
} }
} }
.color-pick {
}
.color-pick .color {
display: inline-block;
opacity: .75;
margin-right: 4px;
border-radius: 15px;
border: 1px dotted silver;
}
.color-pick .color span {
display: inline-block;
mix-blend-mode: darken;
font-size: 11px;
padding-right: 4px;
padding-left: 4px;
}
.color-pick .color .cl{
float: left;
min-width: 25px;
height: 25px;
display: inline-block;
border-radius: 50%;
position: relative;
cursor: pointer;
}
.color-pick .color.active {
opacity: 1;
border: 1px solid black;
position: relative;
padding-right: 15px;
}
.color-pick .color.active .cl:after {
content: '';
right: 20%;
top:5%;
position: absolute;
color: white;
mix-blend-mode: difference;
}

@ -381,8 +381,8 @@ jQuery(function ($) {
try { try {
if ($('#qnt').length != 0) { if ($('#qnt').length != 0) {
sizes = {}; sizes = {};
qnt = JSON.parse($('#qnt').val()); let qnt = JSON.parse($('#qnt').val());
// console.log(qnt); console.log(qnt);
let txt = ''; let txt = '';
for( const q of qnt) { for( const q of qnt) {
if (q.count > 0){ if (q.count > 0){
@ -401,17 +401,17 @@ jQuery(function ($) {
setTimeout(function () { setTimeout(function () {
$("#size-pick .size:first-child").click(); $("#size-pick .size:first-child").click();
},50); },50);
$("#size-pick .size").bind('click.select',function () { // $("#size-pick .size").bind('click.select',function () {
$("#size-pick .size").removeClass('active'); // $("#size-pick .size").removeClass('active');
let colorNames = {}; let colorNames = {};
try { try {
colorNames = JSON.parse($("#colors").val()); colorNames = JSON.parse($("#colors").val());
} catch { } catch {
} }
$(this).addClass('active'); // $(this).addClass('active');
let colors = sizes[$(this).data('id')]; let colors = sizes[$(this).data('id')];
let txt = ''; txt = '';
let cl = ''; let cl = '';
for( const c of colors) { for( const c of colors) {
cl = colorNames[c.color]; cl = colorNames[c.color];
@ -439,7 +439,7 @@ jQuery(function ($) {
$("#counting").text($(this).data('count')); $("#counting").text($(this).data('count'));
$(".product-count").attr('max',$(this).data('count')).val(1); $(".product-count").attr('max',$(this).data('count')).val(1);
}); });
}); // });
} }
} catch (e) { } catch (e) {

@ -2,17 +2,12 @@
<div class="row"> <div class="row">
<div class="col-md-6 mt-3"> <div class="col-md-6 mt-3">
<div class="form-group pt-3" > <div class="form-group pt-3" >
<br>
<label for="active">
{{__('Active')}}
</label>
<input name="active" type="checkbox" id="active"
class="float-left ml-4 mt-1 form-check-inline @error('active') is-invalid @enderror" <div class="form-check form-switch">
@if (old('active',$product->active??0) != 0) <input name="active" class="form-check-input @error('active') is-invalid @enderror" type="checkbox" value="1" id="active" @if (old('active',$product->active??0) != 0)
checked checked
@endif @endif>
value="1"/> <label class="form-check-label" for="active">{{__('Active')}}</label>
</div> </div>
</div> </div>
</div> </div>

@ -35,7 +35,7 @@
<div class="form-group"> <div class="form-group">
<label for="width">{{__("Width")}}:</label> <label for="width">{{__("Width")}}:</label>
<input type="text" placeholder="{{__("Width")}}" name="width" class="form-control" id="width" required <input type="text" placeholder="{{__("Width")}}" name="width" class="form-control" id="width" required
value="{{old('width',$p->width??null)}}"> value="{{old('width',$p->width??'col-md-12')}}">
</div> </div>
<div class="form-group"> <div class="form-group">

@ -45,16 +45,19 @@
<label for="description"> <label for="description">
{{__('Description')}} {{__('Description')}}
</label> </label>
<textarea name="description" rows="4" class="form-control @error('description') is-invalid @enderror" placeholder="{{__('Description')}}" >{{old('description',$transport->description??null)}}</textarea> <textarea name="description" rows="4" class="form-control @error('description') is-invalid @enderror" placeholder="{{__('Description')}}" @if( isset($transport) && $transport->is_default) checked @endif >{{old('description',$transport->description??null)}}</textarea>
</div> </div>
</div> </div>
<div class="col-md-12 mt-3 mr-5"> <div class="col-md-12 mt-3 mr-5">
<div class="form-group"> <div class="form-group">
<input id="is_default" name="is_default" type="checkbox" class="form-check-input @error('is_default') is-invalid @enderror" @if( isset($transport) && $transport->is_default) checked @endif/>
<label class="form-check-label" for="is_default"> <div class="form-check form-switch">
{{__('Is default')}} <input value="1" class="form-check-input @error('is_default') is-invalid @enderror" name="is_default" @if( isset($transport) && $transport->is_default) checked @endif type="checkbox" id="is_default">
</label> <label class="form-check-label" for="is_default"> {{__('Is default')}}</label>
</div>
</div> </div>
</div> </div>
<div class="col-md-12"> <div class="col-md-12">
<label> &nbsp; </label> <label> &nbsp; </label>

@ -151,9 +151,9 @@
{{\App\Helpers\getColorName($data->color)}} {{\App\Helpers\getColorName($data->color)}}
</b> </b>
</span> </span>
<span class="badge bg-dark"> {{-- <span class="badge bg-dark">--}}
{{$data->size}} {{-- {{$data->size}}--}}
</span> {{-- </span>--}}
</td> </td>
<td colspan="2" class="price-td" data-price="{{$qpro->price}}"> <td colspan="2" class="price-td" data-price="{{$qpro->price}}">
@if($qpro->price == 0) @if($qpro->price == 0)

@ -139,17 +139,29 @@
</th> </th>
<td> <td>
<div class="color-pick"> <div class="color-pick">
<input type="hidden" class="color" value="red"/>
@php $colors = json_decode(\App\Helpers\getProp('color')->options,'true'); @endphp
@foreach($colors as $c)
<div style="background: {{$c['value']}}" data-color="{{$c['value']}}"
class="color @if($c['value'] == $pro->getMeta('color')) active @endif"></div>
@endforeach
</div> </div>
</td> </td>
</tr> </tr>
@endif @endif
<tr>
<th style="vertical-align: middle">
تعداد
</th>
<td>
{{-- <div id="counting" class="text-muted float-start mt-2"></div>--}}
<div class="product-count d-inline-block">
<div class="btn btn-info count-inc" style="padding: 2px 5px">
<i class="fa fa-plus"></i>
</div>
<input type="number" id="single-count" class="product-count"
value="1" max="1">
<div class="btn btn-info count-dec" style="padding: 2px 5px">
<i class="fa fa-minus"></i>
</div>
</div>
</td>
</tr>
@if($pro->hasMeta('warranty')) @if($pro->hasMeta('warranty'))
<tr> <tr>
<th> <th>
@ -199,8 +211,8 @@
</a> </a>
</div> </div>
<div class="col"> <div class="col">
<a href="{{route('card.add',$pro->slug)}}" <a href="{{route('card.addq',['',''])}}"
class="add-to-card btn btn-primary w-100 mt-1"> class="add-to-card-q btn btn-primary w-100 mt-1">
<img src="{{asset('images/basket.svg')}}" class="basket-icon" alt=""> <img src="{{asset('images/basket.svg')}}" class="basket-icon" alt="">
افزودن به سبد خرید افزودن به سبد خرید
</a> </a>
@ -219,6 +231,7 @@
</ul> </ul>
<div class="tab-container"> <div class="tab-container">
<div id="tab-detail" class="active"> <div id="tab-detail" class="active">
<table class="table table-bordered attribute "> <table class="table table-bordered attribute ">
@foreach($pro->getAllMeta() as $k => $meta) @foreach($pro->getAllMeta() as $k => $meta)
@if($k != 'color' && $k != 'warranty') @if($k != 'color' && $k != 'warranty')
@ -374,6 +387,7 @@
</div> </div>
</div> </div>
</div> </div>
</section> </section>
<input type="hidden" id="qn" value=""> <input type="hidden" id="qn" value="">
<input type="hidden" id="qnt" value='{!! $pro->quantities()->orderBy('price')->get();!!}'> <input type="hidden" id="qnt" value='{!! $pro->quantities()->orderBy('price')->get();!!}'>

Loading…
Cancel
Save