+ {{$product->name}} +
++ {{$product->excerpt}} +
++ +
++ +
++ +
++ {{__("Item")}} + | ++ {{__("Value")}} + | +
---|---|
+ + + {{$meta['data']->label}} + | ++ {!! $meta['human_value'] !!} + | +
diff --git a/app/Console/Commands/clientAssetGenerator.php b/app/Console/Commands/clientAssetGenerator.php
index 5ad3746..f32e44c 100644
--- a/app/Console/Commands/clientAssetGenerator.php
+++ b/app/Console/Commands/clientAssetGenerator.php
@@ -33,6 +33,7 @@ class clientAssetGenerator extends Command
$vars['xshop-background'] = $gfxes['background'] ?? '#000000';
$vars['xshop-primary'] = $gfxes['primary'] ?? '#6e0000';
$vars['xshop-diff'] = getGrayscaleTextColor($gfxes['primary']) ?? '#6e0000';
+ $vars['xshop-diff2'] = getGrayscaleTextColor($gfxes['secondary']) ?? '#6e0000';
$vars['xshop-secondary'] = $gfxes['secondary'] ?? '#ff0000';
$vars['xshop-text'] = $gfxes['text'] ?? '#111111';
$vars['xshop-border-radius'] = $gfxes['border-radius'] ?? '7px';
diff --git a/app/Helpers/Helper.php b/app/Helpers/Helper.php
index 03c4eea..b59b5f5 100644
--- a/app/Helpers/Helper.php
+++ b/app/Helpers/Helper.php
@@ -975,3 +975,39 @@ function isGuestMaxAttemptTry($action, $max = 5, $minutes = 60)
return false;
}
}
+
+/**
+ * home url to best experience for multi lang shops
+ * @return string
+ */
+function homeUrl(){
+ return \route('client.welcome');
+}
+/**
+ * tag url to best experience for multi lang shops
+ * @return string
+ */
+function tagUrl($slug){
+ return route('client.tag',$slug);
+}
+
+function usableProp($props)
+{
+ $result = [];
+
+ foreach ($props as $prop) {
+ $tmp = [];
+ foreach (json_decode($prop->options) as $item) {
+ $tmp[$item->value] = $item->title;
+ }
+ $result[$prop->name]['data'] = $tmp;
+ $result[$prop->name]['icon'] = $prop->icon;
+ $result[$prop->name]['unit'] = $prop->unit;
+ $result[$prop->name]['searchable'] = $prop->searchable;
+ $result[$prop->name]['priceable'] = $prop->priceable;
+ $result[$prop->name]['type'] = $prop->type;
+ $result[$prop->name]['label'] = $prop->label;
+ }
+
+ return $result;
+}
diff --git a/app/Http/Controllers/ClientController.php b/app/Http/Controllers/ClientController.php
index 021aa8b..703d65a 100644
--- a/app/Http/Controllers/ClientController.php
+++ b/app/Http/Controllers/ClientController.php
@@ -13,6 +13,7 @@ use App\Models\Product;
use App\Models\Quantity;
use App\Models\User;
use Illuminate\Http\Request;
+use Illuminate\Support\Facades\Log;
use Plank\Metable\Meta;
use Spatie\Tags\Tag;
@@ -147,6 +148,14 @@ class ClientController extends Controller
return view('client.group', compact('area', 'posts', 'title', 'subtitle', 'group'));
}
+ public function product(Product $product)
+ {
+ $area = 'product';
+ $title = $product->name;
+ $subtitle = $product->excerpt; // WIP SEO
+ return view('client.default-list', compact('area', 'product', 'title', 'subtitle'));
+ }
+
public function category(Category $category, Request $request)
{
$area = 'category';
@@ -267,10 +276,22 @@ class ClientController extends Controller
$cards = json_decode(\Cookie::get('card'), true);
$qs = json_decode(\Cookie::get('q'), true);
if (in_array($product->id, $cards)) {
- $msg = "Product removed from card";
- $i = array_search($product->id, $cards);
- unset($cards[$i]);
- unset($qs[$i]);
+ $found = false;
+ foreach ($cards as $i => $card) {
+ if ($card == $product->id && $qs[$i] == $quantity) {
+ $found = true;
+ break;
+ }
+ }
+ if ($found) {
+ $msg = "Product removed from card";
+ unset($cards[$i]);
+ unset($qs[$i]);
+ }else{
+ $cards[] = $product->id;
+ $qs[] = $quantity;
+ $msg = "Product added to card";
+ }
} else {
$cards[] = $product->id;
$qs[] = $quantity;
@@ -427,6 +448,8 @@ class ClientController extends Controller
guestLog('sms');
$customer = Customer::where('mobile', $request->input('tel'));
$code = rand(11111, 99999);
+
+ Log::info('auth code: '.$code );
if ($customer->count() == 0) {
$customer = new Customer();
$customer->mobile = $request->input('tel');
diff --git a/app/Models/Product.php b/app/Models/Product.php
index 5a5193d..e3c622f 100644
--- a/app/Models/Product.php
+++ b/app/Models/Product.php
@@ -158,7 +158,11 @@ class Product extends Model implements HasMedia
if (!$this->isAvailable()){
return false;
}
- return $this->discounts()->where('expire', '>', date('Y-m-d'))->count() > 0;
+ return $this->discounts()
+ ->where(function ($query) {
+ $query->where('expire', '>=', date('Y-m-d'))
+ ->orWhereNull('expire');
+ })->count() > 0;
}
@@ -278,8 +282,7 @@ class Product extends Model implements HasMedia
public function webUrl()
{
- return '#';// WIP
- return route('');
+ return route('client.product',$this->slug);
}
diff --git a/database/seeders/PropSeeder.php b/database/seeders/PropSeeder.php
index 8a67000..5d1c3dc 100644
--- a/database/seeders/PropSeeder.php
+++ b/database/seeders/PropSeeder.php
@@ -47,7 +47,7 @@ class PropSeeder extends Seeder
'label' => __('Internal storage'),
'name'=>'hdd',
'type'=>'select',
- 'options' => '[{"title":"16 Gig","value":"16"},{"title":"32 Gig","value":"32"},{"title":"64 gig","value":"64"},{"title":"128 Gig","value":"128"},{"title":"256 G","value":"256"}]',
+ 'options' => '[{"title":"16 Gig","value":"16"},{"title":"32 Gig","value":"32"},{"title":"64 gig","value":"64"},{"title":"128 Gig","value":"128"},{"title":"256 Gig","value":"256"}]',
'searchable'=> 1,
'priceable' => 1,
'icon' => 'ri-hard-drive-3-line',
diff --git a/resources/js/client-custom/assetsNode.js b/resources/js/client-custom/assetsNode.js
index 75fd11a..888a95d 100644
--- a/resources/js/client-custom/assetsNode.js
+++ b/resources/js/client-custom/assetsNode.js
@@ -1,4 +1,3 @@
-import 'bootstrap';
import { createApp } from 'vue';
import ToastPlugin from 'vue-toast-notification';
import {useToast} from 'vue-toast-notification';
@@ -11,9 +10,10 @@ const $toast = useToast({
duration: 10000,
});
-
import MetaFilter from '../client-vue/MetaFilter.vue';
app.component('meta-filter', MetaFilter);
+import QunatotiesAddToCard from "../client-vue/QuantitiesAddToCard.vue";
+app.component('quantities-add-to-card', QunatotiesAddToCard);
app.use(ToastPlugin);
app.use(store);
diff --git a/resources/js/client-custom/windowLoader.js b/resources/js/client-custom/windowLoader.js
index 57d3b31..e27b910 100644
--- a/resources/js/client-custom/windowLoader.js
+++ b/resources/js/client-custom/windowLoader.js
@@ -1,3 +1,5 @@
+import bootstrap from 'bootstrap/dist/js/bootstrap.bundle.min.js';
+
window.addEventListener('load', function () {
const API_COOKIE_NAME = 'last_api_call';
const COOKIE_EXPIRY_MINUTES = 59;
@@ -46,4 +48,17 @@ window.addEventListener('load', function () {
} else {
console.log('Data was sent recently. Skipping this time.');
}
+
+
+ // bootstrap fix start
+ const tooltipTriggerList = document.querySelectorAll('[data-bs-toggle="tooltip"]')
+ const tooltipList = [...tooltipTriggerList].map(tooltipTriggerEl => new bootstrap.Tooltip(tooltipTriggerEl))
+
+ // add table class autho
+ document.querySelectorAll('.content table')?.forEach(function (el) {
+ el.classList.add('table')
+ });
+
+ // bootstrap fix end
+
});
diff --git a/resources/js/client-vue/QuantitiesAddToCard.vue b/resources/js/client-vue/QuantitiesAddToCard.vue
new file mode 100644
index 0000000..9207cd7
--- /dev/null
+++ b/resources/js/client-vue/QuantitiesAddToCard.vue
@@ -0,0 +1,187 @@
+
+
+ {{ commafy(q.price.toString()) }} {{ currency }}
+
+
+ {{$product->excerpt}} +
++ {{__("Item")}} + | ++ {{__("Value")}} + | +
---|---|
+ + + {{$meta['data']->label}} + | ++ {!! $meta['human_value'] !!} + | +