Merge remote-tracking branch 'origin/main'

# Conflicts:
#	public/js/app.js
#	public/js/theme.js
#	resources/js/customer.js
#	resources/views/website/card.blade.php
pull/36/head
A1Gard 1 year ago
commit 93fef5ff04

@ -60,7 +60,7 @@ PUSHER_APP_CLUSTER=mt1
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}" MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
ZARINPAL_MERCHANT='12000000-0220-0000-0220-220000000001' ZARINPAL_MERCHANT='test'
PAY_GATWAY=zarinpal PAY_GATWAY=zarinpal
THUMBNAIL_SIZE=600x600 THUMBNAIL_SIZE=600x600

@ -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,

@ -65,7 +65,7 @@ class WebsiteController extends Controller
// $vid = Clip::latest()->where('active', 1)->first(); // $vid = Clip::latest()->where('active', 1)->first();
$discount = Discount::whereNotNull('expire') $discount = Discount::whereNotNull('expire')
->where('expire', '>', \DB::raw('NOW()')) ->where('expire', '>', date('Y-m-d'))
->whereNotNull('product_id')->pluck('product_id')->toArray(); ->whereNotNull('product_id')->pluck('product_id')->toArray();
$disPros = Product::whereIn('id', $discount)->get(); $disPros = Product::whereIn('id', $discount)->get();

@ -327,7 +327,7 @@ class Product extends Model implements HasMedia
function hasDiscount() function hasDiscount()
{ {
return $this->discounts()->where('expire', '>', \DB::raw('NOW()'))->count() > 0; return $this->discounts()->where('expire', '>', date('Y-m-d'))->count() > 0;
} }
public function isFav() public function isFav()

@ -2,6 +2,8 @@
namespace Database\Factories; namespace Database\Factories;
use App\Models\Address;
use App\Models\Customer;
use Illuminate\Database\Eloquent\Factories\Factory; use Illuminate\Database\Eloquent\Factories\Factory;
/** /**
@ -16,8 +18,21 @@ class CustomerFactory extends Factory
*/ */
public function definition() public function definition()
{ {
$state = rand(1,31);
$k = array_keys(Address::$cities[$state]);
shuffle($k);
return [ return [
// //
'name' => $this->faker->name,
'address' => $this->faker->address,
'mobile' => '0912'.rand(1111111,9999999),
'email' => $this->faker->unique()->email,
'state' => $state,
'city' => $k[0],
'password' => bcrypt('password'),
'credit' => 0,
]; ];
} }
} }

@ -0,0 +1,21 @@
<?php
namespace Database\Seeders;
use App\Models\Customer;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class CustomerSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
//
Customer::factory(5)->create();
}
}

@ -2,6 +2,7 @@
namespace Database\Seeders; namespace Database\Seeders;
use App\Models\Customer;
use Illuminate\Database\Console\Seeds\WithoutModelEvents; use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder; use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Storage;
@ -32,6 +33,7 @@ class DatabaseSeeder extends Seeder
UserSeeder::class, UserSeeder::class,
CategorySeeder::class, CategorySeeder::class,
CatSeeder::class, CatSeeder::class,
CustomerSeeder::class,
PostSeeder::class, PostSeeder::class,
MenuSeeder::class, MenuSeeder::class,
PropSeeder::class, PropSeeder::class,

@ -730,6 +730,32 @@ li.no_results {
display: none; display: none;
} }
.cats-x3 {
-moz-column-count: 4;
column-count: 4;
}
/*-1000px width*/
@media (max-width: 1000px) {
.cats-x3 {
-moz-column-count: 3;
column-count: 3;
}
}
/*-600px width*/
@media (max-width: 600px) {
.cats-x3 {
-moz-column-count: 2;
column-count: 2;
}
}
/*-300px width*/
@media (max-width: 300px) {
.cats-x3 {
-moz-column-count: 1;
column-count: 1;
}
}
.wizard .steps { .wizard .steps {
display: flex; display: flex;
position: relative; position: relative;
@ -906,6 +932,10 @@ li.no_results {
background: dodgerblue; background: dodgerblue;
} }
.select2-container {
max-width: 97%;
}
body { body {
overflow-x: hidden; overflow-x: hidden;
zoom: 100%; zoom: 100%;

@ -10773,7 +10773,9 @@ tr.border-bottom td {
} }
.pink-pattern { .pink-pattern {
background: url(/images/loginbg.png?c2ff5cc63e62d379756642a76feda7a9) !important; background: url(/images/shop.jpg?b9d2a691aa19c475462365228672329f) no-repeat !important;
background-size: cover !important;
background-position: center !important;
margin-top: 0; margin-top: 0;
padding-top: 10vh; padding-top: 10vh;
padding-bottom: 10vh; padding-bottom: 10vh;
@ -11435,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;

Binary file not shown.

After

Width:  |  Height:  |  Size: 671 KiB

@ -125,7 +125,12 @@ export default {
}, },
methods: { methods: {
changeImg:function ($k) { changeImg:function ($k) {
// console.log($k);
// console.log(this.onSelectImage);
// console.log(this.quantities);
this.quantities[this.onSelectImage].image = $k; this.quantities[this.onSelectImage].image = $k;
// console.log(this.quantities);
this.$forceUpdate();
}, },
showModal: function (i) { showModal: function (i) {
// this.showModal(i); // this.showModal(i);
@ -212,12 +217,16 @@ export default {
background: #FFFFFF99; background: #FFFFFF99;
z-index: 999; z-index: 999;
overflow-y: scroll; overflow-y: scroll;
backdrop-filter: blur(3px);
} }
#overlay img { #overlay img {
max-width: 100%; max-width: 100%;
width: 100%;
opacity: .75; opacity: .75;
height: 150px;
object-fit: cover;
} }
#overlay img.selected { #overlay img.selected {

@ -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;
}

@ -1,3 +1,7 @@
.multiselect__tag{ .multiselect__tag{
background: dodgerblue; background: dodgerblue;
} }
.select2-container{
max-width: 97%;
}

@ -2,3 +2,29 @@
#xls-file,#optionz{ #xls-file,#optionz{
display: none; display: none;
} }
.cats-x3{
column-count: 4
}
/*-1000px width*/
@media (max-width: 1000px) {
.cats-x3{
column-count: 3
}
}
/*-600px width*/
@media (max-width: 600px) {
.cats-x3{
column-count: 2
}
}
/*-300px width*/
@media (max-width: 300px) {
.cats-x3{
column-count: 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 671 KiB

@ -804,7 +804,9 @@ tr.border-bottom td {
} }
.pink-pattern { .pink-pattern {
background: url("../css/loginbg.png") !important; background: url("../css/shop.jpg") no-repeat !important;
background-size: cover !important;
background-position: center !important;
margin-top: 0; margin-top: 0;
padding-top: 10vh; padding-top: 10vh;
padding-bottom: 10vh; padding-bottom: 10vh;

@ -388,8 +388,8 @@ jQuery(function ($) {
} }
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){
@ -408,17 +408,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) {
let p = c.price; let p = c.price;
@ -450,7 +450,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) {

@ -1,69 +1 @@
axios = require('axios'); axios = require('axios'); window.axios = axios; window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; alertify = require('alertifyjs'); require('../js/bootstrap'); window._ = require('lodash'); require('bootstrap/dist/js/bootstrap.bundle') require('chart.js/dist/chart.min') var $ = window.jQuery = jQuery = require('jquery'); require('lightbox2/dist/js/lightbox.min'); require('owl.carousel/dist/owl.carousel.min'); require('xzoom/dist/xzoom.min'); window.Vue = require('vue').default; // require('./js/gsap.min.js'); // require('./js/Physics2DPlugin3.min'); // require('./js/mega-menu.js'); require('./js/product.js'); require('./js/theme.js'); require('./js/chart.js'); require('../js/customer.js'); // require('../js/') Vue.component('example-component', require('../js/components/ExampleComponent.vue').default); Vue.component('meta-price', require('../js/components/MetaPrice.vue').default); Vue.component('currency', require('../js/components/CurrencyInput.vue').default); Vue.component('meta-element', require('../js/components/MetaElement.vue').default); Vue.component('meta-search', require('../js/components/MetaSearch').default); var app = new Vue({ el: '#app', data: { metaz: '123', jdata: [], def: [], }, mounted() { }, created() { if (document.querySelector('#jDataSrc') !== undefined && document.querySelector('#jDataSrc') != null){ try { this.jdata = JSON.parse(document.querySelector('#jDataSrc').value); this.def = JSON.parse(document.querySelector('#jDef').value); } catch { console.log('json error: for meta product page'); } } }, methods: { }, watch:{ jdata:{ handler: function(n) { this.$refs.metaEl.updateJdata(n); // this.$refs.metaPr.updateJdata(n); }, deep: true }, } }); window.app = app;
window.axios = axios;
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
alertify = require('alertifyjs');
require('../js/bootstrap');
window._ = require('lodash');
require('bootstrap/dist/js/bootstrap.bundle')
require('chart.js/dist/chart.min')
var $ = window.jQuery = jQuery = require('jquery');
require('lightbox2/dist/js/lightbox.min');
require('owl.carousel/dist/owl.carousel.min');
require('xzoom/dist/xzoom.min');
window.Vue = require('vue').default;
// require('./js/gsap.min.js');
// require('./js/Physics2DPlugin3.min');
// require('./js/mega-menu.js');
require('./js/product.js');
require('./js/theme.js');
require('./js/chart.js');
require('../js/customer.js');
// require('../js/')
Vue.component('example-component', require('../js/components/ExampleComponent.vue').default);
Vue.component('meta-price', require('../js/components/MetaPrice.vue').default);
Vue.component('currency', require('../js/components/CurrencyInput.vue').default);
Vue.component('meta-element', require('../js/components/MetaElement.vue').default);
Vue.component('meta-search', require('../js/components/MetaSearch').default);
var app = new Vue({
el: '#app',
data: {
metaz: '123',
jdata: [],
def: [],
},
mounted() {
},
created() {
if (document.querySelector('#jDataSrc') !== undefined && document.querySelector('#jDataSrc') != null){
try {
this.jdata = JSON.parse(document.querySelector('#jDataSrc').value);
this.def = JSON.parse(document.querySelector('#jDef').value);
} catch {
console.log('json error: for meta product page');
}
}
},
methods: {
},
watch:{
jdata:{
handler: function(n) {
this.$refs.metaEl.updateJdata(n);
// this.$refs.metaPr.updateJdata(n);
},
deep: true
},
}
});
window.app = app;

@ -2,18 +2,13 @@
<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>

@ -15,9 +15,9 @@
@include('starter-kit::component.err') @include('starter-kit::component.err')
<form <form
@if(isset($p)) @if(isset($p))
action="{{route('admin.props.update',$p->id)}}" action="{{route('admin.props.update',$p->id)}}"
@else @else
action="{{route('admin.props.store')}}" action="{{route('admin.props.store')}}"
@endif @endif
method="post" enctype="multipart/form-data"> method="post" enctype="multipart/form-data">
@csrf @csrf
@ -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">
@ -63,7 +63,7 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="xtype">{{__("Type")}}:</label> <label for="xtype">{{__("Type")}}:</label>
<select name="type" id="xtype" class="form-control" required> <select name="type" id="xtype" class="form-control" required>
<option <option
value="text" {{ old('type',$p->type??null) == 'text' ? 'selected' : '' }} > {{__("Text type")}}</option> value="text" {{ old('type',$p->type??null) == 'text' ? 'selected' : '' }} > {{__("Text type")}}</option>
<option <option
@ -80,29 +80,43 @@
value="singlemulti" {{ old('type',$p->type??null) == 'singlemulti' ? 'selected' : '' }}>{{__("Single Select & multi search")}}</option> value="singlemulti" {{ old('type',$p->type??null) == 'singlemulti' ? 'selected' : '' }}>{{__("Single Select & multi search")}}</option>
</select> </select>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="category">{{__("Category")}}</label> <label>{{__("Category")}}</label>
<select {{-- <select--}}
multiple {{-- multiple--}}
name="category[]" {{-- name="category[]"--}}
id="category" {{-- id="category"--}}
class="form-control" {{-- class="form-control"--}}
data-placeholder="Select category" {{-- data-placeholder="Select category"--}}
required> {{-- required>--}}
<option value=""></option> {{-- <option value=""></option>--}}
@foreach($allCategories as $cat) {{-- @foreach($allCategories as $cat)--}}
<option value="{{ $cat->id }}" {{-- <option value="{{ $cat->id }}"--}}
@if(isset($cats) && in_array($cat->id,$cats)) selected @endif > {{$cat->name}} </option> {{-- @if(isset($cats) && in_array($cat->id,$cats)) selected @endif > {{$cat->name}} </option>--}}
@endforeach {{-- @endforeach--}}
</select> {{-- </select>--}}
{{-- --}}
<div class="cats-x3">
@foreach($allCategories as $k => $cat)
<div class="form-check form-switch">
<input class="form-check-input" value="{{ $cat->id }}"
@if(isset($cats) && in_array($cat->id,$cats)) checked @endif name="category[]"
type="checkbox" id="c{{$k}}">
<label class="form-check-label" for="c{{$k}}"> {{$cat->name}} </label>
</div> </div>
@endforeach
</div>
</div>
<div> <div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label> <label>
{{__("Is effective price?")}} {{__("Is effective price?")}}
</label> </label>
<input type="checkbox" @if( isset($p) && $p->priceable) checked @endif name="priceable" class="form-check"> <input type="checkbox" @if( isset($p) && $p->priceable) checked @endif name="priceable"
class="form-check">
</div> </div>
<div class="card-header"> <div class="card-header">
{{__("Icon")}} {{__("Icon")}}
@ -137,7 +151,9 @@
</h2> </h2>
<div class="content"> <div class="content">
</div> </div>
<div class="btn btn-success m-2" style="float: left" id="add-options"> <div class="fa fa-plus"></div></div> <div class="btn btn-success m-2" style="float: left" id="add-options">
<div class="fa fa-plus"></div>
</div>
</div> </div>
<div class="clearfix"></div> <div class="clearfix"></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>

@ -147,17 +147,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>
@ -207,8 +219,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>
@ -227,6 +239,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')
@ -382,6 +395,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();!!}'>

@ -208,7 +208,7 @@ class AdminWebPagesTest extends TestCase
$response->assertStatus(200); $response->assertStatus(200);
if (Customer::count() != 0){ if (Customer::count() != 0){
$response = $this->actingAs($user)->get(route('admin.customer.edit',Customer::first()->slug)); $response = $this->actingAs($user)->get(route('admin.customer.edit',Customer::first()->id));
$response->assertStatus(200); $response->assertStatus(200);
} }

Loading…
Cancel
Save