Compare commits
32 Commits
1.0.0-rc.6
...
1.0.0-rc.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1f4177cdb3 | ||
|
|
66c035ef9a | ||
|
|
fefd6209ac | ||
|
|
f5ec254c0e | ||
|
|
a43e82f3d9 | ||
|
|
65460fd9f1 | ||
|
|
d9ae84310d | ||
|
|
2fc091d754 | ||
|
|
7887e2d532 | ||
|
|
f92e175731 | ||
|
|
6bb910bb54 | ||
|
|
1db3725fb2 | ||
|
|
ebdf0c0d8e | ||
|
|
22ebcb102f | ||
|
|
cc3d4d3e32 | ||
|
|
ef1964d472 | ||
|
|
abb32e32b9 | ||
|
|
8c29459489 | ||
|
|
accb052f5c | ||
|
|
d5f095b5e5 | ||
|
|
fd628f3f95 | ||
|
|
a10f0b35d9 | ||
|
|
858421a9eb | ||
|
|
158bc4fd57 | ||
|
|
b7e3eefed6 | ||
|
|
67e4346c68 | ||
|
|
9ce62e82e5 | ||
|
|
7e93219774 | ||
|
|
29f46b7287 | ||
|
|
1f02c932a0 | ||
|
|
7d8bd8c372 | ||
|
|
f4bd4ddf24 |
@@ -43,6 +43,7 @@ COPY . /app
|
|||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
RUN mkdir -p /app/bootstrap/cache \
|
RUN mkdir -p /app/bootstrap/cache \
|
||||||
|
/app/storage/media-library/temp \
|
||||||
/app/storage/framework/cache \
|
/app/storage/framework/cache \
|
||||||
/app/storage/framework/views \
|
/app/storage/framework/views \
|
||||||
/app/storage/framework/sessions \
|
/app/storage/framework/sessions \
|
||||||
@@ -56,6 +57,7 @@ RUN chmod +x artisan
|
|||||||
RUN ./artisan vendor:publish --tag=public --force ## creates public/vendor/jsvalidation
|
RUN ./artisan vendor:publish --tag=public --force ## creates public/vendor/jsvalidation
|
||||||
RUN ./artisan vendor:publish --tag=boilerplate-public --force --ansi ## creates public/vendor/boilerplate
|
RUN ./artisan vendor:publish --tag=boilerplate-public --force --ansi ## creates public/vendor/boilerplate
|
||||||
RUN ./artisan vendor:publish --tag=datatables-buttons --force --ansi ## creates public/vendor/datatables/buttons
|
RUN ./artisan vendor:publish --tag=datatables-buttons --force --ansi ## creates public/vendor/datatables/buttons
|
||||||
|
RUN ./artisan vendor:publish --tag=lfm_public --force --ansi
|
||||||
|
|
||||||
## XXXvlab: 2025-09-25 these migration files are breaking first
|
## XXXvlab: 2025-09-25 these migration files are breaking first
|
||||||
## install, but we had to resolve to not install from scratch and use
|
## install, but we had to resolve to not install from scratch and use
|
||||||
@@ -84,8 +86,6 @@ RUN apk add --no-cache xz
|
|||||||
# bring PHP app with vendor
|
# bring PHP app with vendor
|
||||||
COPY --from=phpdeps /app /app
|
COPY --from=phpdeps /app /app
|
||||||
|
|
||||||
# ensure required runtime dirs exist (empty is fine)
|
|
||||||
RUN mkdir -p storage/framework/{cache,views,sessions} bootstrap/cache
|
|
||||||
# create artifact (use tar + xz so we don't depend on GNU tar -J)
|
# create artifact (use tar + xz so we don't depend on GNU tar -J)
|
||||||
RUN mkdir -p /out \
|
RUN mkdir -p /out \
|
||||||
&& tar -C /app -cf /out/app.tar \
|
&& tar -C /app -cf /out/app.tar \
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
namespace App\Http\Controllers\Admin\Botanic;
|
namespace App\Http\Controllers\Admin\Botanic;
|
||||||
|
|
||||||
use App\Datatables\Botanic\SpeciesDataTable;
|
use App\Datatables\Botanic\SpeciesDataTable;
|
||||||
use App\Repositories\Botanic\Genres;
|
|
||||||
use App\Repositories\Botanic\Species;
|
use App\Repositories\Botanic\Species;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
@@ -21,7 +20,7 @@ class SpecieController extends Controller
|
|||||||
|
|
||||||
public function create()
|
public function create()
|
||||||
{
|
{
|
||||||
$data = Genres::init();
|
$data = Species::init();
|
||||||
|
|
||||||
return view('Admin.Botanic.Species.create', $data);
|
return view('Admin.Botanic.Species.create', $data);
|
||||||
}
|
}
|
||||||
@@ -36,7 +35,7 @@ class SpecieController extends Controller
|
|||||||
|
|
||||||
public function edit($id)
|
public function edit($id)
|
||||||
{
|
{
|
||||||
$data = Genres::init();
|
$data = Species::init();
|
||||||
$data['specie'] = Species::getFull($id);
|
$data['specie'] = Species::getFull($id);
|
||||||
|
|
||||||
return view('Admin.Botanic.Species.edit', $data);
|
return view('Admin.Botanic.Species.edit', $data);
|
||||||
|
|||||||
@@ -63,6 +63,17 @@ class ArticleController extends Controller
|
|||||||
return view('Admin.Shop.Articles.edit', $data);
|
return view('Admin.Shop.Articles.edit', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function duplicate($id)
|
||||||
|
{
|
||||||
|
$data = Articles::getFull($id);
|
||||||
|
// Prepare for creation: blank id/slug, tweak name to indicate copy
|
||||||
|
$data['article']['id'] = null;
|
||||||
|
$data['article']['slug'] = null;
|
||||||
|
$data['article']['name'] = ($data['article']['name'] ?? '').' (copie)';
|
||||||
|
|
||||||
|
return view('Admin.Shop.Articles.create', $data);
|
||||||
|
}
|
||||||
|
|
||||||
public function destroy($id)
|
public function destroy($id)
|
||||||
{
|
{
|
||||||
return Articles::destroy($id);
|
return Articles::destroy($id);
|
||||||
|
|||||||
@@ -71,7 +71,10 @@ class PriceListValueController extends Controller
|
|||||||
|
|
||||||
public function addPrice($index)
|
public function addPrice($index)
|
||||||
{
|
{
|
||||||
$data['index'] = $index;
|
$data = [
|
||||||
|
'index' => $index,
|
||||||
|
'taxes' => Taxes::getOptions(),
|
||||||
|
];
|
||||||
|
|
||||||
return view('Admin.Shop.PriceListValues.partials.row_price', $data);
|
return view('Admin.Shop.PriceListValues.partials.row_price', $data);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
namespace App\Http\Requests\Admin\Shop;
|
namespace App\Http\Requests\Admin\Shop;
|
||||||
|
|
||||||
use Illuminate\Foundation\Http\FormRequest;
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
use Illuminate\Validation\Rule;
|
||||||
|
|
||||||
class StoreArticlePost extends FormRequest
|
class StoreArticlePost extends FormRequest
|
||||||
{
|
{
|
||||||
@@ -13,8 +14,13 @@ class StoreArticlePost extends FormRequest
|
|||||||
|
|
||||||
public function rules()
|
public function rules()
|
||||||
{
|
{
|
||||||
|
$articleId = $this->input('id');
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'ref' => 'required|unique:shop_articles',
|
'ref' => [
|
||||||
|
'required',
|
||||||
|
Rule::unique('shop_articles', 'ref')->ignore($articleId)->whereNull('deleted_at'),
|
||||||
|
],
|
||||||
'product_type' => 'required',
|
'product_type' => 'required',
|
||||||
'product_id' => 'required',
|
'product_id' => 'required',
|
||||||
'article_nature_id' => 'required',
|
'article_nature_id' => 'required',
|
||||||
|
|||||||
@@ -65,6 +65,9 @@ class Varieties
|
|||||||
{
|
{
|
||||||
$images = $data['images'] ?? false;
|
$images = $data['images'] ?? false;
|
||||||
$tags = $data['tags'] ?? false;
|
$tags = $data['tags'] ?? false;
|
||||||
|
if (! array_key_exists('plus', $data) || $data['plus'] === null) {
|
||||||
|
$data['plus'] = '';
|
||||||
|
}
|
||||||
unset($data['images']);
|
unset($data['images']);
|
||||||
unset($data['tags']);
|
unset($data['tags']);
|
||||||
$variety = self::store($data);
|
$variety = self::store($data);
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
namespace App\Repositories\Core;
|
namespace App\Repositories\Core;
|
||||||
|
|
||||||
|
use Spatie\MediaLibrary\MediaCollections\Models\Media as MediaModel;
|
||||||
|
|
||||||
class Medias
|
class Medias
|
||||||
{
|
{
|
||||||
public static function getImage($model, $conversion = 'normal', $collection = 'images')
|
public static function getImage($model, $conversion = 'normal', $collection = 'images')
|
||||||
@@ -79,13 +81,9 @@ class Medias
|
|||||||
|
|
||||||
public static function getImageSrc($image)
|
public static function getImageSrc($image)
|
||||||
{
|
{
|
||||||
if (! $image) {
|
$media = self::resolveMedia($image);
|
||||||
return null;
|
|
||||||
}
|
|
||||||
$id = $image['id'];
|
|
||||||
$filename = self::getFilename($image);
|
|
||||||
|
|
||||||
return "/storage/{$id}/{$filename}";
|
return $media ? $media->getUrl() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getThumbSrc($image)
|
public static function getThumbSrc($image)
|
||||||
@@ -110,6 +108,12 @@ class Medias
|
|||||||
|
|
||||||
public static function getSrcByType($image, $type)
|
public static function getSrcByType($image, $type)
|
||||||
{
|
{
|
||||||
|
$media = self::resolveMedia($image);
|
||||||
|
|
||||||
|
if ($media) {
|
||||||
|
return $type ? $media->getUrl($type) : $media->getUrl();
|
||||||
|
}
|
||||||
|
|
||||||
return $image ? '/storage/'.$image['id'].'/conversions/'.self::getFilename($image, $type) : false;
|
return $image ? '/storage/'.$image['id'].'/conversions/'.self::getFilename($image, $type) : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,4 +128,48 @@ class Medias
|
|||||||
{
|
{
|
||||||
return str_replace(['#', '/', '\\', ' '], '-', $name);
|
return str_replace(['#', '/', '\\', ' '], '-', $name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected static function resolveMedia($image): ?MediaModel
|
||||||
|
{
|
||||||
|
if ($image instanceof MediaModel) {
|
||||||
|
return $image;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_null($image)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_array($image)) {
|
||||||
|
return self::hydrateMedia($image);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_object($image)) {
|
||||||
|
if ($image instanceof \ArrayAccess) {
|
||||||
|
return self::hydrateMedia((array) $image);
|
||||||
|
}
|
||||||
|
|
||||||
|
$array = method_exists($image, 'toArray') ? $image->toArray() : (array) $image;
|
||||||
|
|
||||||
|
return self::hydrateMedia($array);
|
||||||
|
}
|
||||||
|
|
||||||
|
$id = data_get($image, 'id');
|
||||||
|
|
||||||
|
return $id ? MediaModel::query()->withoutGlobalScopes()->find($id) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static function hydrateMedia(array $attributes): ?MediaModel
|
||||||
|
{
|
||||||
|
$id = data_get($attributes, 'id');
|
||||||
|
|
||||||
|
if (! $id) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$media = new MediaModel();
|
||||||
|
$media->forceFill($attributes);
|
||||||
|
$media->exists = true;
|
||||||
|
|
||||||
|
return $media;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,11 @@ class ArticleImages
|
|||||||
|
|
||||||
public static function getFullImagesByArticle($article)
|
public static function getFullImagesByArticle($article)
|
||||||
{
|
{
|
||||||
$images = count($article->images) ? $article->images : collect([]);
|
if (! $article) {
|
||||||
|
return collect([]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$images = count($article->images ?? []) ? $article->images : collect([]);
|
||||||
switch ($article->product_type) {
|
switch ($article->product_type) {
|
||||||
case 'App\Models\Botanic\Variety':
|
case 'App\Models\Botanic\Variety':
|
||||||
$variety = $article->product ?? false;
|
$variety = $article->product ?? false;
|
||||||
|
|||||||
@@ -27,21 +27,34 @@ class ArticleTags
|
|||||||
|
|
||||||
switch ($article->product_type) {
|
switch ($article->product_type) {
|
||||||
case 'App\Models\Botanic\Variety':
|
case 'App\Models\Botanic\Variety':
|
||||||
$data += $article->product->tags->toArray();
|
$variety = $article->product;
|
||||||
if ($article->product->specie ?? false) {
|
if ($variety && $variety->tags) {
|
||||||
$data += $article->product->specie->tags->toArray();
|
$data = array_merge($data, $variety->tags->toArray());
|
||||||
|
}
|
||||||
|
if ($variety && $variety->specie && $variety->specie->tags) {
|
||||||
|
$data = array_merge($data, $variety->specie->tags->toArray());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'App\Models\Botanic\Specie':
|
case 'App\Models\Botanic\Specie':
|
||||||
$data += $article->product->tags->toArray();
|
$specie = $article->product;
|
||||||
|
if ($specie && $specie->tags) {
|
||||||
|
$data = array_merge($data, $specie->tags->toArray());
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'App\Models\Shop\Merchandise':
|
case 'App\Models\Shop\Merchandise':
|
||||||
$data += $article->product->tags->toArray();
|
$merchandise = $article->product;
|
||||||
$data += $article->product->producer->tags->toArray();
|
if ($merchandise && $merchandise->tags) {
|
||||||
|
$data = array_merge($data, $merchandise->tags->toArray());
|
||||||
|
}
|
||||||
|
if ($merchandise && $merchandise->producer && $merchandise->producer->tags) {
|
||||||
|
$data = array_merge($data, $merchandise->producer->tags->toArray());
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
$data += $article->tags->toArray();
|
if ($article->tags) {
|
||||||
|
$data = array_merge($data, $article->tags->toArray());
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($data as $tag) {
|
foreach ($data as $tag) {
|
||||||
if (! isset($tags[$tag['group']][$tag['name']])) {
|
if (! isset($tags[$tag['group']][$tag['name']])) {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ class Articles
|
|||||||
|
|
||||||
public static function autocomplete($str)
|
public static function autocomplete($str)
|
||||||
{
|
{
|
||||||
$data = Article::byAutocomplete($str)->orderBy('name')->limit(20)->pluck('name', 'id');
|
$data = Article::byAutocomplete($str)->visible()->orderBy('name')->limit(20)->pluck('name', 'id');
|
||||||
$export = [];
|
$export = [];
|
||||||
foreach ($data as $key => $name) {
|
foreach ($data as $key => $name) {
|
||||||
$export[] = ['value' => $key, 'text' => $name];
|
$export[] = ['value' => $key, 'text' => $name];
|
||||||
@@ -135,8 +135,11 @@ class Articles
|
|||||||
$data['specie'] = $article->product ? $article->product->description : '';
|
$data['specie'] = $article->product ? $article->product->description : '';
|
||||||
break;
|
break;
|
||||||
case 'App\Models\Shop\Merchandise':
|
case 'App\Models\Shop\Merchandise':
|
||||||
$data['merchandise'] = $article->product ? $article->product->description : '';
|
$merchandise = $article->product;
|
||||||
$data['producer'] = $article->product->producer->description;
|
$data['merchandise'] = $merchandise ? ($merchandise->description ?? '') : '';
|
||||||
|
if ($merchandise && $merchandise->producer) {
|
||||||
|
$data['producer'] = $merchandise->producer->description ?? '';
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
@@ -175,10 +178,18 @@ class Articles
|
|||||||
$articles = self::getArticlesWithOffers($options);
|
$articles = self::getArticlesWithOffers($options);
|
||||||
$searchOrder = $options['ids'] ?? false ? array_flip($options['ids']->toArray()) : false;
|
$searchOrder = $options['ids'] ?? false ? array_flip($options['ids']->toArray()) : false;
|
||||||
foreach ($articles as $article) {
|
foreach ($articles as $article) {
|
||||||
|
// Skip articles without an offer/tariff/price list for the resolved sale channel
|
||||||
|
if (!isset($article->offers[0]) || ! $article->offers[0]->tariff) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$price_lists = $article->offers[0]->tariff->price_lists->toArray();
|
$price_lists = $article->offers[0]->tariff->price_lists->toArray();
|
||||||
if (! count($price_lists)) {
|
if (! count($price_lists)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (empty($price_lists[0]['price_list_values'][0] ?? null)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (! is_array($data[$article->name] ?? false)) {
|
if (! is_array($data[$article->name] ?? false)) {
|
||||||
$data[$article->name] = self::getDataForSale($article);
|
$data[$article->name] = self::getDataForSale($article);
|
||||||
if ($searchOrder) {
|
if ($searchOrder) {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
namespace App\Repositories\Shop;
|
namespace App\Repositories\Shop;
|
||||||
|
|
||||||
use App\Models\Shop\Offer;
|
use App\Models\Shop\Offer;
|
||||||
|
use App\Models\Shop\PriceList;
|
||||||
use App\Models\Shop\PriceListValue;
|
use App\Models\Shop\PriceListValue;
|
||||||
use App\Models\Shop\SaleChannel;
|
use App\Models\Shop\SaleChannel;
|
||||||
use App\Traits\Model\Basic;
|
use App\Traits\Model\Basic;
|
||||||
@@ -185,20 +186,44 @@ class Offers
|
|||||||
->with([
|
->with([
|
||||||
'article',
|
'article',
|
||||||
'tariff:id,status_id',
|
'tariff:id,status_id',
|
||||||
|
'variation',
|
||||||
])
|
])
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
return $channels->map(function ($channel) use ($offers) {
|
return $channels->map(function ($channel) use ($offers) {
|
||||||
$priceValue = null;
|
$priceValue = null;
|
||||||
$candidateOffer = null;
|
$candidateOffer = null;
|
||||||
|
$allOffersForChannel = [];
|
||||||
|
|
||||||
foreach ($offers as $offer) {
|
foreach ($offers as $offer) {
|
||||||
$priceCandidate = self::getPrice($offer->id, 1, $channel->id);
|
$priceCandidate = self::getPrice($offer->id, 1, $channel->id);
|
||||||
|
|
||||||
if ($priceCandidate && (float) $priceCandidate->price_taxed > 0) {
|
if ($priceCandidate && (float) $priceCandidate->price_taxed > 0) {
|
||||||
$priceValue = $priceCandidate;
|
// Get price list name
|
||||||
$candidateOffer = $offer;
|
$priceListName = null;
|
||||||
break;
|
if ($priceCandidate) {
|
||||||
|
$priceListModel = PriceList::find($priceCandidate->price_list_id);
|
||||||
|
$priceListName = $priceListModel ? $priceListModel->name : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Collect all offers with their details
|
||||||
|
$allOffersForChannel[] = [
|
||||||
|
'id' => $offer->id,
|
||||||
|
'variation_name' => $offer->variation ? $offer->variation->name : null,
|
||||||
|
'stock_current' => (int) $offer->stock_current,
|
||||||
|
'status_id' => (int) $offer->status_id,
|
||||||
|
'is_active' => (int) $offer->status_id === 1,
|
||||||
|
'tariff_id' => $offer->tariff_id ? (int) $offer->tariff_id : null,
|
||||||
|
'price_taxed' => (float) $priceCandidate->price_taxed,
|
||||||
|
'quantity' => (int) $priceCandidate->quantity,
|
||||||
|
'price_list_name' => $priceListName,
|
||||||
|
];
|
||||||
|
|
||||||
|
// Keep first valid offer as the main candidate
|
||||||
|
if (!$candidateOffer) {
|
||||||
|
$priceValue = $priceCandidate;
|
||||||
|
$candidateOffer = $offer;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -209,6 +234,7 @@ class Offers
|
|||||||
$offerHasStock = $candidateOffer && $candidateOffer->stock_current !== null
|
$offerHasStock = $candidateOffer && $candidateOffer->stock_current !== null
|
||||||
? (float) $candidateOffer->stock_current > 0
|
? (float) $candidateOffer->stock_current > 0
|
||||||
: null;
|
: null;
|
||||||
|
$offerTariffId = $candidateOffer && $candidateOffer->tariff_id ? (int) $candidateOffer->tariff_id : null;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'id' => $channel->id,
|
'id' => $channel->id,
|
||||||
@@ -221,6 +247,8 @@ class Offers
|
|||||||
'offer_stock_current' => $offerStock,
|
'offer_stock_current' => $offerStock,
|
||||||
'offer_has_stock' => $offerHasStock,
|
'offer_has_stock' => $offerHasStock,
|
||||||
'tariff_status_id' => $offerTariffStatus,
|
'tariff_status_id' => $offerTariffStatus,
|
||||||
|
'tariff_id' => $offerTariffId,
|
||||||
|
'all_offers' => $allOffersForChannel,
|
||||||
];
|
];
|
||||||
})->toArray();
|
})->toArray();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,12 +46,34 @@ class PriceListValues
|
|||||||
{
|
{
|
||||||
foreach ($values as $value) {
|
foreach ($values as $value) {
|
||||||
$value['price_list_id'] = $price_list_id;
|
$value['price_list_id'] = $price_list_id;
|
||||||
if ($value['price']) {
|
if (self::hasPrice($value)) {
|
||||||
self::store($value);
|
self::store($value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function purgeRemovedValues($price_list_id, array $ids)
|
||||||
|
{
|
||||||
|
if (! count($ids)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
PriceListValue::byPriceList($price_list_id)
|
||||||
|
->whereIn('id', $ids)
|
||||||
|
->delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static function hasPrice($value): bool
|
||||||
|
{
|
||||||
|
if (! array_key_exists('price', $value)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$price = $value['price'];
|
||||||
|
|
||||||
|
return $price !== null && $price !== '';
|
||||||
|
}
|
||||||
|
|
||||||
public static function getModel()
|
public static function getModel()
|
||||||
{
|
{
|
||||||
return PriceListValue::query();
|
return PriceListValue::query();
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ class PriceLists
|
|||||||
'taxes' => Taxes::getOptions(),
|
'taxes' => Taxes::getOptions(),
|
||||||
'price_list' => [
|
'price_list' => [
|
||||||
'tariff_id' => $tariffId,
|
'tariff_id' => $tariffId,
|
||||||
'price_list_values' => array_fill(0, 3, ''),
|
'price_list_values' => [],
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -50,9 +50,8 @@ class PriceLists
|
|||||||
public static function edit($id)
|
public static function edit($id)
|
||||||
{
|
{
|
||||||
$price_list = self::getFull($id)->toArray();
|
$price_list = self::getFull($id)->toArray();
|
||||||
$n = count($price_list['price_list_values']);
|
if (count($price_list['price_list_values']) === 0) {
|
||||||
if ($n <= 3) {
|
$price_list['price_list_values'][] = [];
|
||||||
$price_list['price_list_values'] += array_fill($n, 3 - $n, '');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $price_list;
|
return $price_list;
|
||||||
@@ -71,9 +70,14 @@ class PriceLists
|
|||||||
public static function store($data)
|
public static function store($data)
|
||||||
{
|
{
|
||||||
$id = $data['id'] ?? false;
|
$id = $data['id'] ?? false;
|
||||||
$price_list_values = $data['price_list_values'] ?? false;
|
$price_list_values = $data['price_list_values'] ?? [];
|
||||||
|
$deleted_values = array_map('intval', array_filter($data['deleted_price_list_value_ids'] ?? [], function ($value) {
|
||||||
|
return $value !== null && $value !== '';
|
||||||
|
}));
|
||||||
unset($data['price_list_values']);
|
unset($data['price_list_values']);
|
||||||
|
unset($data['deleted_price_list_value_ids']);
|
||||||
$price_list = $id ? self::update($data) : self::create($data);
|
$price_list = $id ? self::update($data) : self::create($data);
|
||||||
|
PriceListValues::purgeRemovedValues($price_list->id, $deleted_values);
|
||||||
PriceListValues::storePrices($price_list->id, $price_list_values);
|
PriceListValues::storePrices($price_list->id, $price_list_values);
|
||||||
|
|
||||||
return $price_list;
|
return $price_list;
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ class SaleChannels
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return self::getByCode('EXP');
|
return self::getByCode('POSTE');
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getByCode($code)
|
public static function getByCode($code)
|
||||||
|
|||||||
@@ -8,8 +8,14 @@ class Searches
|
|||||||
{
|
{
|
||||||
public static function search($options)
|
public static function search($options)
|
||||||
{
|
{
|
||||||
|
// Get article IDs from Scout search
|
||||||
|
$searchResults = Article::search($options['search_name'])->get()->pluck('id');
|
||||||
|
|
||||||
|
// Filter to only include visible articles
|
||||||
|
$visibleArticleIds = Article::whereIn('id', $searchResults)->visible()->pluck('id');
|
||||||
|
|
||||||
return collect(Articles::getArticlesToSell([
|
return collect(Articles::getArticlesToSell([
|
||||||
'ids' => Article::search($options['search_name'])->get()->pluck('id'),
|
'ids' => $visibleArticleIds,
|
||||||
]))->sortBy('searchOrder')->toArray();
|
]))->sortBy('searchOrder')->toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,23 +1,35 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
return [
|
return [
|
||||||
// --- The default avatar size
|
// Default configuration group for Gravatar
|
||||||
'size' => 80,
|
'default' => [
|
||||||
|
// --- The default avatar size
|
||||||
|
'size' => 80,
|
||||||
|
|
||||||
// --- The default avatar to display if we have no results
|
// --- The default avatar to display if we have no results
|
||||||
// (bool) false
|
// (bool) false
|
||||||
// (string) 404
|
// (string) 404
|
||||||
// (string) mm: (mystery-man) a simple, cartoon-style silhouetted outline of a person (does not vary by email hash).
|
// (string) mm: (mystery-man) a simple, cartoon-style silhouetted outline of a person (does not vary by email hash).
|
||||||
// (string) identicon: a geometric pattern based on an email hash.
|
// (string) identicon: a geometric pattern based on an email hash.
|
||||||
// (string) monsterid: a generated 'monster' with different colors, faces, etc.
|
// (string) monsterid: a generated 'monster' with different colors, faces, etc.
|
||||||
// (string) wavatar: generated faces with differing features and backgrounds.
|
// (string) wavatar: generated faces with differing features and backgrounds.
|
||||||
// (string) retro: awesome generated, 8-bit arcade-style pixelated faces.
|
// (string) retro: awesome generated, 8-bit arcade-style pixelated faces.
|
||||||
'default' => 'identicon',
|
'fallback' => 'identicon',
|
||||||
|
|
||||||
// --- Set the type of avatars we allow to show
|
// --- Whether to use HTTPS protocol
|
||||||
// - g: suitable for display on all websites with any audience type.
|
'secure' => false,
|
||||||
// - pg: may contain rude gestures, provocatively dressed individuals, the lesser swear words, or mild violence.
|
|
||||||
// - r: may contain such things as harsh profanity, intense violence, nudity, or hard drug use.
|
// --- Set the type of avatars we allow to show
|
||||||
// - x: may contain hardcore sexual imagery or extremely disturbing violence.
|
// - g: suitable for display on all websites with any audience type.
|
||||||
'maxRating' => 'g',
|
// - pg: may contain rude gestures, provocatively dressed individuals, the lesser swear words, or mild violence.
|
||||||
|
// - r: may contain such things as harsh profanity, intense violence, nudity, or hard drug use.
|
||||||
|
// - x: may contain hardcore sexual imagery or extremely disturbing violence.
|
||||||
|
'maximumRating' => 'g',
|
||||||
|
|
||||||
|
// --- Force default image to always display
|
||||||
|
'forceDefault' => false,
|
||||||
|
|
||||||
|
// --- Optional file extension appended to URL
|
||||||
|
'forceExtension' => 'jpg',
|
||||||
|
]
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ return [
|
|||||||
* The path where to store temporary files while performing image conversions.
|
* The path where to store temporary files while performing image conversions.
|
||||||
* If set to null, storage_path('media-library/temp') will be used.
|
* If set to null, storage_path('media-library/temp') will be used.
|
||||||
*/
|
*/
|
||||||
'temporary_directory_path' => null,
|
'temporary_directory_path' => env('MEDIA_LIBRARY_TEMP_PATH', storage_path('media-library/temp')),
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The engine that should perform the image conversions.
|
* The engine that should perform the image conversions.
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::table('shop_articles', function (Blueprint $table) {
|
||||||
|
$table->dropUnique('ref');
|
||||||
|
$table->unique(['ref', 'deleted_at'], 'shop_articles_ref_deleted_at_unique');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('shop_articles', function (Blueprint $table) {
|
||||||
|
$table->dropUnique('shop_articles_ref_deleted_at_unique');
|
||||||
|
$table->unique('ref');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
9
resources/lang/en/fg.php
Normal file
9
resources/lang/en/fg.php
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'confirmdelete' => 'Do you confirm the deletion?',
|
||||||
|
'deletesuccess' => 'Deleted successfully.',
|
||||||
|
'mail_the_selection' => 'Mail the selection',
|
||||||
|
'mail_the_complete_list' => 'Mail the complete list',
|
||||||
|
];
|
||||||
|
|
||||||
9
resources/lang/fr/fg.php
Normal file
9
resources/lang/fr/fg.php
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'confirmdelete' => 'Confirmez-vous la suppression ?',
|
||||||
|
'deletesuccess' => 'La suppression a été effectuée.',
|
||||||
|
'mail_the_selection' => 'Envoyer la sélection',
|
||||||
|
'mail_the_complete_list' => 'Envoyer toute la liste',
|
||||||
|
];
|
||||||
|
|
||||||
@@ -112,3 +112,33 @@ body {
|
|||||||
.bg-darker {
|
.bg-darker {
|
||||||
background-color: rgba(0,0,0,0.05)!important;
|
background-color: rgba(0,0,0,0.05)!important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Header action buttons aligned with page title */
|
||||||
|
.content-header .form-buttons {
|
||||||
|
margin-left: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-header .form-buttons .btn {
|
||||||
|
height: 32px;
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
padding-top: 4px;
|
||||||
|
padding-bottom: 4px;
|
||||||
|
line-height: 1.1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 575.98px) {
|
||||||
|
.content-header .form-buttons {
|
||||||
|
margin-left: 0;
|
||||||
|
margin-top: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-header .form-buttons .btn {
|
||||||
|
height: 28px;
|
||||||
|
padding-top: 2px;
|
||||||
|
padding-bottom: 2px;
|
||||||
|
padding-left: 8px;
|
||||||
|
padding-right: 8px;
|
||||||
|
font-size: 0.75rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -311,6 +311,52 @@ div.megamenu ul.megamenu li.megamenu.level1
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.category-title {
|
||||||
|
font-size: 2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.category-description {
|
||||||
|
font-size: 1.2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.breadcrumb-title {
|
||||||
|
font-size: 1.6em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.breadcrumb-current {
|
||||||
|
font-size: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 767.98px){
|
||||||
|
.category-title {
|
||||||
|
font-size: 1.5em;
|
||||||
|
}
|
||||||
|
.category-description {
|
||||||
|
font-size: 1.05em;
|
||||||
|
}
|
||||||
|
.breadcrumb-title {
|
||||||
|
font-size: 1.4em;
|
||||||
|
}
|
||||||
|
.breadcrumb-current {
|
||||||
|
font-size: 0.95em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 575.98px){
|
||||||
|
.category-title {
|
||||||
|
font-size: 1.35em;
|
||||||
|
}
|
||||||
|
.category-description {
|
||||||
|
font-size: 0.95em;
|
||||||
|
}
|
||||||
|
.breadcrumb-title {
|
||||||
|
font-size: 1.2em;
|
||||||
|
}
|
||||||
|
.breadcrumb-current {
|
||||||
|
font-size: 0.9em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'noto_sanscondensed';
|
font-family: 'noto_sanscondensed';
|
||||||
src: url('/fonts/notosans-condensed/notosans-condensed-webfont.eot');
|
src: url('/fonts/notosans-condensed/notosans-condensed-webfont.eot');
|
||||||
@@ -349,3 +395,39 @@ div.megamenu ul.megamenu li.megamenu.level1
|
|||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (max-width: 991.98px){
|
||||||
|
#navbarContentMobile .navbar-nav {
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
#navbarContentMobile .navbar-nav .col {
|
||||||
|
flex: 0 0 100%;
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
|
#navbarContentMobile .dropdown-menu {
|
||||||
|
display: block;
|
||||||
|
position: static;
|
||||||
|
float: none;
|
||||||
|
box-shadow: none;
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
#navbarContentMobile .dropdown-toggle::after {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
#navbarContentMobile .dropdown-menu .container,
|
||||||
|
#navbarContentMobile .dropdown-menu .row {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
#navbarContentMobile .dropdown-menu .shadow {
|
||||||
|
box-shadow: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.category-card .card-body {
|
||||||
|
font-size: 0.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Supprimer les grandes marges du container en affichage mobile/tablette */
|
||||||
|
.container {
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -32,12 +32,14 @@ $(document).on('click', '.dropdown-menu', function (e) {
|
|||||||
// make it as accordion for smaller screens
|
// make it as accordion for smaller screens
|
||||||
if ($(window).width() < 992) {
|
if ($(window).width() < 992) {
|
||||||
$('.dropdown-menu a').click(function(e) {
|
$('.dropdown-menu a').click(function(e) {
|
||||||
e.preventDefault();
|
var $submenu = $(this).next('.submenu');
|
||||||
if ($(this).next('.submenu').length) {
|
if ($submenu.length) {
|
||||||
$(this).next('.submenu').toggle();
|
e.preventDefault();
|
||||||
|
$submenu.toggle();
|
||||||
}
|
}
|
||||||
$('.dropdown').on('hide.bs.dropdown', function () {
|
});
|
||||||
$(this).find('.submenu').hide();
|
|
||||||
});
|
$('.dropdown').on('hide.bs.dropdown', function () {
|
||||||
|
$(this).find('.submenu').hide();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,5 +5,7 @@
|
|||||||
])
|
])
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
@include('Admin.Shop.Articles.form')
|
@include('Admin.Shop.Articles.form', [
|
||||||
|
'cancel_url' => route('Admin.Shop.Articles.index'),
|
||||||
|
])
|
||||||
@endsection
|
@endsection
|
||||||
|
|||||||
@@ -5,5 +5,13 @@
|
|||||||
])
|
])
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
@include('Admin.Shop.Articles.form')
|
@php
|
||||||
|
$duplicateUrl = \Route::has('Admin.Shop.Articles.duplicate')
|
||||||
|
? route('Admin.Shop.Articles.duplicate', $article['id'] ?? null)
|
||||||
|
: null;
|
||||||
|
@endphp
|
||||||
|
@include('Admin.Shop.Articles.form', [
|
||||||
|
'duplicate_url' => $duplicateUrl,
|
||||||
|
'cancel_url' => route('Admin.Shop.Articles.index'),
|
||||||
|
])
|
||||||
@endsection
|
@endsection
|
||||||
|
|||||||
@@ -5,10 +5,29 @@
|
|||||||
'files' => true,
|
'files' => true,
|
||||||
]) }}
|
]) }}
|
||||||
<input type="hidden" name="id" id="id" value="{{ $article['id'] ?? null }}">
|
<input type="hidden" name="id" id="id" value="{{ $article['id'] ?? null }}">
|
||||||
|
|
||||||
|
@php
|
||||||
|
$articlePublicUrl = null;
|
||||||
|
if (!empty($article['slug'] ?? null)) {
|
||||||
|
$articlePublicUrl = route('Shop.Articles.slug', ['slug' => $article['slug']]);
|
||||||
|
} elseif (!empty($article['id'] ?? null)) {
|
||||||
|
$articlePublicUrl = route('Shop.Articles.show', ['id' => $article['id']]);
|
||||||
|
}
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
@if ($articlePublicUrl)
|
||||||
|
<div class="d-flex justify-content-end mb-3">
|
||||||
|
<a href="{{ $articlePublicUrl }}" class="btn btn-outline-primary" target="_blank" rel="noopener">
|
||||||
|
Voir la page publique
|
||||||
|
<i class="fa fa-external-link"></i>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
@include('Admin.Shop.Articles.partials.characteristics')
|
@include('Admin.Shop.Articles.partials.characteristics')
|
||||||
{{ Form::close() }}
|
{{ Form::close() }}
|
||||||
|
|
||||||
<x-save />
|
<x-save :cancel-url="$cancel_url ?? null" :duplicate-url="$duplicate_url ?? null" />
|
||||||
|
|
||||||
@include('load.form.appender')
|
@include('load.form.appender')
|
||||||
@include('load.form.editor')
|
@include('load.form.editor')
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
@component('components.layout.box-collapse', [
|
@component('components.layout.box-collapse', [
|
||||||
'id' => 'product_description_box',
|
'id' => 'product_description_box',
|
||||||
'title' => 'Informations héritées',
|
'title' => 'Informations héritées',
|
||||||
'collapsed' => $collapsed ?? false,
|
'collapsed' => $collapsed ?? true,
|
||||||
])
|
])
|
||||||
@foreach ($article['inherited'] as $inherited)
|
@foreach ($article['inherited'] as $inherited)
|
||||||
@component('components.card', ['title' => $inherited['name'], 'class' => 'mb-3'])
|
@component('components.card', ['title' => $inherited['name'], 'class' => 'mb-3'])
|
||||||
|
|||||||
@@ -1,8 +1,17 @@
|
|||||||
{{ Form::open(['route' => 'Admin.Shop.Offers.store', 'id' => 'offer-form', 'autocomplete' => 'off']) }}
|
{{ Form::open(['route' => 'Admin.Shop.Offers.store', 'id' => 'offer-form', 'autocomplete' => 'off']) }}
|
||||||
<input type="hidden" name="id" value="{{ $offer['id'] ?? false }}">
|
<input type="hidden" name="id" value="{{ $offer['id'] ?? false }}">
|
||||||
|
|
||||||
|
@if (($offer['id'] ?? false) && ($offer['article_id'] ?? false))
|
||||||
|
<div class="d-flex justify-content-end mb-3">
|
||||||
|
<a href="{{ route('Shop.Articles.show', ['id' => $offer['article_id']]) }}" class="btn btn-outline-primary" target="_blank" rel="noopener">
|
||||||
|
Voir la page publique de l'article
|
||||||
|
<i class="fa fa-external-link"></i>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<div class="col-8">
|
<div class="col-12">
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
@include('components.form.select', [
|
@include('components.form.select', [
|
||||||
@@ -96,13 +105,6 @@
|
|||||||
</div>
|
</div>
|
||||||
@endcomponent
|
@endcomponent
|
||||||
</div>
|
</div>
|
||||||
<div class="col-4">
|
|
||||||
@component('components.card', ['title' => 'Previsualisation'])
|
|
||||||
<div id="preview-article"></div>
|
|
||||||
<div id="preview-variation"></div>
|
|
||||||
<div id="preview-tariff"></div>
|
|
||||||
@endcomponent
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -117,59 +119,8 @@
|
|||||||
{!! JsValidator::formRequest('App\Http\Requests\Admin\Shop\StoreOfferPost', '#offer-form') !!}
|
{!! JsValidator::formRequest('App\Http\Requests\Admin\Shop\StoreOfferPost', '#offer-form') !!}
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
function handleArticle() {
|
|
||||||
$('.select_article').change(function() {
|
|
||||||
previewArticle($(this).val());
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
function previewArticle(id) {
|
|
||||||
var url = '{{ route('Admin.Shop.Offers.previewArticle') }}/' + id;
|
|
||||||
$('#preview-article').load(url, function() {
|
|
||||||
initChevron();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleVariation() {
|
|
||||||
$('.select_variation').change(function() {
|
|
||||||
previewVariation($(this).val());
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
function previewVariation(id) {
|
|
||||||
var url = '{{ route('Admin.Shop.Offers.previewVariation') }}/' + id;
|
|
||||||
$('#preview-variation').load(url, function() {
|
|
||||||
initChevron();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleTariff() {
|
|
||||||
$('.select_tariffs').change(function() {
|
|
||||||
previewTariff($(this).val());
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
function previewTariff(id) {
|
|
||||||
var url = '{{ route('Admin.Shop.Offers.previewTariff') }}/' + id;
|
|
||||||
$('#preview-tariff').load(url, function() {
|
|
||||||
initChevron();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function initPreview() {
|
|
||||||
previewArticle("{{ $offer['article_id'] ?? null }}");
|
|
||||||
previewVariation("{{ $offer['variation_id'] ?? null }}");
|
|
||||||
previewTariff("{{ $offer['tariff_id'] ?? null }}");
|
|
||||||
}
|
|
||||||
|
|
||||||
handleArticle();
|
|
||||||
handleVariation();
|
|
||||||
handleTariff();
|
|
||||||
initChevron();
|
initChevron();
|
||||||
initSaveForm('#offer-form');
|
initSaveForm('#offer-form');
|
||||||
initSelect2();
|
initSelect2();
|
||||||
@if ($offer['id'] ?? false)
|
|
||||||
initPreview();
|
|
||||||
@endif
|
|
||||||
</script>
|
</script>
|
||||||
@endpush
|
@endpush
|
||||||
|
|||||||
@@ -15,4 +15,9 @@
|
|||||||
<td>
|
<td>
|
||||||
@include('components.form.inputs.money', ['name' => 'price_list_values[' . $index . '][price_taxed]', 'value' => $price_list_value['price_taxed'] ?? null, 'required' => true, 'class' => 'price_taxed'])
|
@include('components.form.inputs.money', ['name' => 'price_list_values[' . $index . '][price_taxed]', 'value' => $price_list_value['price_taxed'] ?? null, 'required' => true, 'class' => 'price_taxed'])
|
||||||
</td>
|
</td>
|
||||||
|
<td class="text-center align-middle">
|
||||||
|
<button type="button" class="btn btn-outline-danger btn-xs remove-price" title="{{ __('Supprimer') }}">
|
||||||
|
<i class="fa fa-trash"></i>
|
||||||
|
</button>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -30,12 +30,18 @@
|
|||||||
<th>Unit. HT</th>
|
<th>Unit. HT</th>
|
||||||
<th>TVA</th>
|
<th>TVA</th>
|
||||||
<th>Unit. TTC</th>
|
<th>Unit. TTC</th>
|
||||||
|
<th class="text-center" style="width: 60px;">Actions</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@foreach ($price_list['price_list_values'] as $price_list_value)
|
@php($priceListValues = $price_list['price_list_values'] ?? [])
|
||||||
@include('Admin.Shop.PriceListValues.partials.row_price', ['index' => $loop->index])
|
@php($nextIndex = count($priceListValues))
|
||||||
|
|
||||||
|
@foreach ($priceListValues as $index => $price_list_value)
|
||||||
|
@include('Admin.Shop.PriceListValues.partials.row_price', ['index' => $index, 'price_list_value' => $price_list_value])
|
||||||
@endforeach
|
@endforeach
|
||||||
|
|
||||||
|
@include('Admin.Shop.PriceListValues.partials.row_price', ['index' => $nextIndex, 'price_list_value' => []])
|
||||||
</tbody>
|
</tbody>
|
||||||
<tfoot>
|
<tfoot>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -49,21 +55,30 @@
|
|||||||
</tfoot>
|
</tfoot>
|
||||||
</table>
|
</table>
|
||||||
@endcomponent
|
@endcomponent
|
||||||
|
<div id="deleted-price-list-values"></div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
var priceRowIndex = 0;
|
||||||
|
var lastRemovedIndex = null;
|
||||||
|
|
||||||
function handleAddPrice() {
|
function handleAddPrice() {
|
||||||
$('#add_price').click( function () {
|
$('#add_price').click( function () {
|
||||||
var index = $('#prices-table tbody tr').length;
|
addEmptyPriceRow();
|
||||||
$.get("{{ route('Admin.Shop.PriceListValues.addPrice') }}/" + index, function(data) {
|
|
||||||
$("#prices-table").append(data);
|
|
||||||
})
|
|
||||||
handlePrices();
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function addEmptyPriceRow() {
|
||||||
|
var index = nextPriceRowIndex();
|
||||||
|
$.get("{{ route('Admin.Shop.PriceListValues.addPrice') }}/" + index, function(data) {
|
||||||
|
$("#prices-table tbody").append(data);
|
||||||
|
handlePrices();
|
||||||
|
handleRemovePrice();
|
||||||
|
lastRemovedIndex = null;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function handle_prices() {
|
function handle_prices() {
|
||||||
$('.price').change(function() {
|
$('.price').change(function() {
|
||||||
$col_tax = $(this).parent().parent().find('.tax');
|
$col_tax = $(this).parent().parent().find('.tax');
|
||||||
@@ -101,9 +116,82 @@
|
|||||||
handle_prices_taxed();
|
handle_prices_taxed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleRemovePrice() {
|
||||||
|
$('#prices-table').off('click', '.remove-price').on('click', '.remove-price', function() {
|
||||||
|
var $row = $(this).closest('tr');
|
||||||
|
var idx = extractRowIndex($row);
|
||||||
|
var id = $row.find('input[name$="[id]"]').val();
|
||||||
|
if (id) {
|
||||||
|
registerDeletedPrice(id);
|
||||||
|
}
|
||||||
|
$row.remove();
|
||||||
|
lastRemovedIndex = idx;
|
||||||
|
ensureAtLeastOneRow();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function registerDeletedPrice(id) {
|
||||||
|
var $container = $('#deleted-price-list-values');
|
||||||
|
if ($container.find('input[value="' + id + '"]').length === 0) {
|
||||||
|
$container.append('<input type="hidden" name="deleted_price_list_value_ids[]" value="' + id + '">');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function ensureAtLeastOneRow() {
|
||||||
|
if ($('#prices-table tbody tr').length === 0) {
|
||||||
|
if (lastRemovedIndex !== null) {
|
||||||
|
$.get("{{ route('Admin.Shop.PriceListValues.addPrice') }}/" + lastRemovedIndex, function(data) {
|
||||||
|
$("#prices-table tbody").append(data);
|
||||||
|
handlePrices();
|
||||||
|
handleRemovePrice();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
addEmptyPriceRow();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function computeStartingIndex() {
|
||||||
|
var maxIndex = -1;
|
||||||
|
$('#prices-table tbody tr').each(function() {
|
||||||
|
var $idInput = $(this).find('input[name$="[id]"]');
|
||||||
|
var name = $idInput.attr('name');
|
||||||
|
if (name) {
|
||||||
|
var matches = name.match(/price_list_values\[(\d+)\]\[id\]/);
|
||||||
|
if (matches && matches[1]) {
|
||||||
|
var idx = parseInt(matches[1], 10);
|
||||||
|
if (!isNaN(idx) && idx > maxIndex) {
|
||||||
|
maxIndex = idx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return maxIndex + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
function nextPriceRowIndex() {
|
||||||
|
return priceRowIndex++;
|
||||||
|
}
|
||||||
|
|
||||||
|
function extractRowIndex($row) {
|
||||||
|
var $idInput = $row.find('input[name$="[id]"]');
|
||||||
|
var name = $idInput.attr('name');
|
||||||
|
if (!name) {
|
||||||
|
return priceRowIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
var matches = name.match(/price_list_values\[(\d+)\]\[id\]/);
|
||||||
|
|
||||||
|
return matches && matches[1] ? parseInt(matches[1], 10) : priceRowIndex;
|
||||||
|
}
|
||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
|
priceRowIndex = computeStartingIndex();
|
||||||
handleAddPrice();
|
handleAddPrice();
|
||||||
handlePrices();
|
handlePrices();
|
||||||
|
handleRemovePrice();
|
||||||
|
ensureAtLeastOneRow();
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,37 +1,59 @@
|
|||||||
@if ($article['offers']['semences'] ?? false)
|
@php
|
||||||
@include('Shop.Articles.partials.addBasket', [
|
// Check if article is not visible OR has no offers at all
|
||||||
'data' => $article['offers']['semences'],
|
$hasNoOffers = empty($article['offers']['semences'] ?? false)
|
||||||
'title' => 'Semences',
|
&& empty($article['offers']['plants'] ?? false)
|
||||||
'model' => 'semences',
|
&& empty($article['offers']['legumes'] ?? false)
|
||||||
'bgClass' => 'bg-green-light',
|
&& empty($article['offers']['marchandise'] ?? false);
|
||||||
])
|
$shouldShowComingSoon = !($article['visible'] ?? true) || $hasNoOffers;
|
||||||
@endif
|
@endphp
|
||||||
|
|
||||||
@if ($article['offers']['plants'] ?? false)
|
@if ($shouldShowComingSoon)
|
||||||
@include('Shop.Articles.partials.addBasket', [
|
{{-- Display "Coming Soon" box when article is not visible or has no offers --}}
|
||||||
'data' => $article['offers']['plants'],
|
<div class="card border-info">
|
||||||
'title' => 'Plants',
|
<div class="card-body text-center p-4">
|
||||||
'model' => 'plants',
|
<h4 class="text-info mb-3">
|
||||||
'bgClass' => 'bg-green-light',
|
<i class="fas fa-clock"></i>
|
||||||
])
|
</h4>
|
||||||
@endif
|
<h5 class="card-title mb-0">Bientôt disponible</h5>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@else
|
||||||
|
{{-- Display normal offers for visible articles with available offers --}}
|
||||||
|
@if ($article['offers']['semences'] ?? false)
|
||||||
|
@include('Shop.Articles.partials.addBasket', [
|
||||||
|
'data' => $article['offers']['semences'],
|
||||||
|
'title' => 'Semences',
|
||||||
|
'model' => 'semences',
|
||||||
|
'bgClass' => 'bg-green-light',
|
||||||
|
])
|
||||||
|
@endif
|
||||||
|
|
||||||
@if ($article['offers']['legumes'] ?? false)
|
@if ($article['offers']['plants'] ?? false)
|
||||||
@include('Shop.Articles.partials.addBasket', [
|
@include('Shop.Articles.partials.addBasket', [
|
||||||
'data' => $article['offers']['legumes'],
|
'data' => $article['offers']['plants'],
|
||||||
'title' => 'Légumes',
|
'title' => 'Plants',
|
||||||
'model' => 'legumes',
|
'model' => 'plants',
|
||||||
'bgClass' => 'bg-green-light',
|
'bgClass' => 'bg-green-light',
|
||||||
])
|
])
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@if ($article['offers']['marchandise'] ?? false)
|
@if ($article['offers']['legumes'] ?? false)
|
||||||
@include('Shop.Articles.partials.addBasket', [
|
@include('Shop.Articles.partials.addBasket', [
|
||||||
'data' => $article['offers']['marchandise'],
|
'data' => $article['offers']['legumes'],
|
||||||
'title' => 'Marchandises',
|
'title' => 'Légumes',
|
||||||
'model' => 'marchandise',
|
'model' => 'legumes',
|
||||||
'bgClass' => 'bg-green-light',
|
'bgClass' => 'bg-green-light',
|
||||||
])
|
])
|
||||||
|
@endif
|
||||||
|
|
||||||
|
@if ($article['offers']['marchandise'] ?? false)
|
||||||
|
@include('Shop.Articles.partials.addBasket', [
|
||||||
|
'data' => $article['offers']['marchandise'],
|
||||||
|
'title' => 'Marchandises',
|
||||||
|
'model' => 'marchandise',
|
||||||
|
'bgClass' => 'bg-green-light',
|
||||||
|
])
|
||||||
|
@endif
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@include('load.basket')
|
@include('load.basket')
|
||||||
|
|||||||
@@ -18,9 +18,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-5 col-xs-12 text-justify">
|
<div class="col-lg-5 col-xs-12 text-justify">
|
||||||
|
{!! $article['description']['variety'] ?? null !!}
|
||||||
{!! $article['description']['semences'] ?? null !!}
|
{!! $article['description']['semences'] ?? null !!}
|
||||||
{!! $article['description']['plants'] ?? null !!}
|
{!! $article['description']['plants'] ?? null !!}
|
||||||
{!! $article['description']['variety'] ?? null !!}
|
|
||||||
{!! $article['description']['merchandise'] ?? null !!}
|
{!! $article['description']['merchandise'] ?? null !!}
|
||||||
|
|
||||||
@if ($article['description']['plus'] ?? false)
|
@if ($article['description']['plus'] ?? false)
|
||||||
@@ -48,9 +48,18 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-3 col-xs-12">
|
<div class="col-lg-3 col-xs-12">
|
||||||
@if (config('app.debug') && !empty($article['available_sale_channels']))
|
@if (auth('web')->check() && !empty($article['available_sale_channels']))
|
||||||
<div class="alert alert-info p-2 mb-3">
|
<div id="article-admin-offers" class="alert alert-info p-2 mb-3">
|
||||||
<strong class="d-block">Offres :</strong>
|
<div class="d-flex justify-content-between align-items-center">
|
||||||
|
<strong class="d-block mb-0">Offres :</strong>
|
||||||
|
<a href="{{ route('Admin.Shop.Articles.edit', $article['id']) }}" class="text-dark d-inline-flex align-items-center gap-1" style="font-size: 0.95rem;" title="Ouvrir la fiche article en admin" target="_blank" rel="noopener">
|
||||||
|
<svg aria-hidden="true" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||||
|
<path d="M12 20h9" />
|
||||||
|
<path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4Z" />
|
||||||
|
</svg>
|
||||||
|
<span class="sr-only">Éditer l'article</span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
<ul class="list-unstyled mb-0 small">
|
<ul class="list-unstyled mb-0 small">
|
||||||
@php
|
@php
|
||||||
$currentSaleChannelId = $article['current_sale_channel']['id'] ?? null;
|
$currentSaleChannelId = $article['current_sale_channel']['id'] ?? null;
|
||||||
@@ -82,16 +91,61 @@
|
|||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
@if ($priceTaxed !== null)
|
@if ($priceTaxed !== null)
|
||||||
<span class="ml-2 text-nowrap text-right {{ $nameClass }}">
|
@php
|
||||||
{{ number_format($priceTaxed, 2, ',', ' ') }} € TTC
|
$tariffId = $channel['tariff_id'] ?? null;
|
||||||
@if (! empty($quantity))
|
@endphp
|
||||||
<span class="d-block text-muted" style="font-size: 0.85em;">Qté min. {{ $quantity }}</span>
|
@if ($tariffId)
|
||||||
@endif
|
<a href="{{ route('Admin.Shop.Tariffs.edit', $tariffId) }}" target="_blank" rel="noopener" title="Ouvrir le tarif" class="ml-2 text-nowrap text-right {{ $nameClass }} text-decoration-none text-reset d-inline-block admin-link-group admin-price-link">
|
||||||
</span>
|
{{ number_format($priceTaxed, 2, ',', ' ') }} € TTC
|
||||||
|
@if (! empty($quantity))
|
||||||
|
<span class="d-block text-muted" style="font-size: 0.85em;">Qté min. {{ $quantity }}</span>
|
||||||
|
@endif
|
||||||
|
</a>
|
||||||
|
@else
|
||||||
|
<span class="ml-2 text-nowrap text-right {{ $nameClass }}">
|
||||||
|
{{ number_format($priceTaxed, 2, ',', ' ') }} € TTC
|
||||||
|
@if (! empty($quantity))
|
||||||
|
<span class="d-block text-muted" style="font-size: 0.85em;">Qté min. {{ $quantity }}</span>
|
||||||
|
@endif
|
||||||
|
</span>
|
||||||
|
@endif
|
||||||
@else
|
@else
|
||||||
<span class="ml-2 text-muted">–</span>
|
<span class="ml-2 text-muted">–</span>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
@if (!empty($channel['all_offers']))
|
||||||
|
<ul class="list-unstyled mb-0 mt-1" style="padding-left: 0.75em;">
|
||||||
|
@foreach ($channel['all_offers'] as $offer)
|
||||||
|
@php
|
||||||
|
$isSelectedOffer = $offer['id'] === $channel['offer_id'];
|
||||||
|
$offerClass = $offer['is_active'] ? 'text-dark' : 'text-muted';
|
||||||
|
$stockClass = $offer['stock_current'] > 0 ? 'text-success' : 'text-danger';
|
||||||
|
@endphp
|
||||||
|
<li class="small {{ $offerClass }}" style="font-size: 0.85em;">
|
||||||
|
<a href="{{ route('Admin.Shop.Offers.edit', $offer['id']) }}" target="_blank" rel="noopener" title="Ouvrir l'offre" class="text-decoration-none {{ $offerClass }} admin-link-group admin-offer-link">
|
||||||
|
<div class="d-flex justify-content-between align-items-start">
|
||||||
|
<div>
|
||||||
|
<span style="opacity: 0.5;">{{ $isSelectedOffer ? '▸' : '○' }}</span>
|
||||||
|
@if ($offer['variation_name'])
|
||||||
|
{{ $offer['variation_name'] }}
|
||||||
|
@endif
|
||||||
|
- Stock: <strong class="{{ $stockClass }}">{{ $offer['stock_current'] }}</strong>
|
||||||
|
@if (!$offer['is_active'])
|
||||||
|
<span class="text-muted">(inactive)</span>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
<div class="text-right text-nowrap ml-2">
|
||||||
|
{{ number_format($offer['price_taxed'], 2, ',', ' ') }} €
|
||||||
|
@if ($offer['quantity'] > 1)
|
||||||
|
<span class="text-muted">(min {{ $offer['quantity'] }})</span>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
@endforeach
|
||||||
|
</ul>
|
||||||
|
@endif
|
||||||
</li>
|
</li>
|
||||||
@endforeach
|
@endforeach
|
||||||
</ul>
|
</ul>
|
||||||
@@ -103,3 +157,67 @@
|
|||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
@include('load.layout.modal')
|
@include('load.layout.modal')
|
||||||
|
|
||||||
|
@if (auth('web')->check() && !empty($article['available_sale_channels']))
|
||||||
|
@push('styles')
|
||||||
|
<style>
|
||||||
|
#article-admin-offers .admin-link-group {
|
||||||
|
transition: background-color 0.15s ease;
|
||||||
|
border-radius: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#article-admin-offers .admin-price-link {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 2px 4px;
|
||||||
|
margin: -2px -4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#article-admin-offers .admin-offer-link {
|
||||||
|
display: block;
|
||||||
|
padding: 2px 4px;
|
||||||
|
margin: -2px -4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#article-admin-offers .admin-link-group:hover,
|
||||||
|
#article-admin-offers .admin-link-group:focus,
|
||||||
|
#article-admin-offers .admin-link-group.linked-hover {
|
||||||
|
background-color: rgba(0, 123, 255, 0.1);
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
@endpush
|
||||||
|
|
||||||
|
@push('scripts')
|
||||||
|
<script>
|
||||||
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
|
const container = document.getElementById('article-admin-offers');
|
||||||
|
if (!container) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const links = Array.from(container.querySelectorAll('a.admin-link-group[href]'));
|
||||||
|
const grouped = new Map();
|
||||||
|
|
||||||
|
links.forEach((link) => {
|
||||||
|
const href = link.getAttribute('href');
|
||||||
|
if (!grouped.has(href)) {
|
||||||
|
grouped.set(href, []);
|
||||||
|
}
|
||||||
|
grouped.get(href).push(link);
|
||||||
|
});
|
||||||
|
|
||||||
|
grouped.forEach((group) => {
|
||||||
|
group.forEach((link) => {
|
||||||
|
const addHighlight = () => group.forEach((item) => item.classList.add('linked-hover'));
|
||||||
|
const removeHighlight = () => group.forEach((item) => item.classList.remove('linked-hover'));
|
||||||
|
|
||||||
|
link.addEventListener('mouseenter', addHighlight);
|
||||||
|
link.addEventListener('mouseleave', removeHighlight);
|
||||||
|
link.addEventListener('focus', addHighlight);
|
||||||
|
link.addEventListener('blur', removeHighlight);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
@endpush
|
||||||
|
@endif
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
<h1 style="font-size: 1.5em;">
|
<h1 class="breadcrumb-title">
|
||||||
@foreach($breadcrumb ?? [] as $parent)
|
@foreach($breadcrumb ?? [] as $parent)
|
||||||
<a href="{{ route('Shop.Categories.show', ['id' => $parent['id']]) }}" style="text-decoration: none; color: inherit;">{{ $parent['name'] }}</a> /
|
<a href="{{ route('Shop.Categories.show', ['id' => $parent['id']]) }}" class="breadcrumb-link">{{ $parent['name'] }}</a> /
|
||||||
@endforeach
|
@endforeach
|
||||||
<span style="font-size: 1.4em;">
|
<span class="breadcrumb-current">{{ $category['name'] }}</span>
|
||||||
{{ $category['name'] }}
|
|
||||||
</span>
|
|
||||||
</h1>
|
</h1>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-8">
|
<div class="col-8">
|
||||||
<h1 style="font-size: 2em;">{{ $category['name'] }}</h1>
|
<h1 class="category-title">{{ $category['name'] }}</h1>
|
||||||
<h3 style="font-size: 1.2em;">{!! $category['description'] !!}</h3>
|
<h3 class="category-description">{!! $category['description'] !!}</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-4">
|
<div class="col-4">
|
||||||
@include('Shop.layout.partials.category_add')
|
@include('Shop.layout.partials.category_add')
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<div class="row">
|
<div class="row mx-n1">
|
||||||
@if ($articles ?? false)
|
@if ($articles ?? false)
|
||||||
@foreach ($articles as $product_name => $article)
|
@foreach ($articles as $product_name => $article)
|
||||||
<div class="col-lg-3 col-xs-12 mb-3">
|
<div class="category-card col-6 col-md-4 col-lg-3 mb-2 px-1">
|
||||||
@include('Shop.Articles.partials.article')
|
@include('Shop.Articles.partials.article')
|
||||||
</div>
|
</div>
|
||||||
@endforeach
|
@endforeach
|
||||||
@@ -46,4 +46,3 @@
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
@endpush
|
@endpush
|
||||||
|
|
||||||
|
|||||||
@@ -1,18 +1,28 @@
|
|||||||
<div class="row bg-light">
|
<div class="row bg-light align-items-center">
|
||||||
|
|
||||||
<div class="col-sm-12 col-lg-5">
|
<div class="col-6 col-lg-5 d-flex align-items-center">
|
||||||
<a href="/"><img src="/img/logo.png" height="52" alt="Jardin'Envie"></a>
|
<a href="/"><img src="/img/logo.png" height="52" alt="Jardin'Envie"></a>
|
||||||
<span class="green ml-3">Variétés Paysannes de la Semence à l'Assiette</span>
|
<span class="green ml-3 d-none d-md-inline">Variétés Paysannes de la Semence à l'Assiette</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-sm-12 col-lg-4 pt-2">
|
<div class="col-12 col-lg-4 pt-2 order-3 order-lg-2">
|
||||||
@include('Shop.layout.partials.search')
|
@include('Shop.layout.partials.search')
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-sm-12 col-lg-3 pt-2 text-right">
|
<div class="col-6 col-lg-3 pt-2 text-right order-2 order-lg-3 d-flex justify-content-end align-items-center">
|
||||||
@include('Shop.layout.partials.header-catalog')
|
@include('Shop.layout.partials.header-catalog')
|
||||||
@include('Shop.layout.partials.header-profile')
|
@include('Shop.layout.partials.header-profile')
|
||||||
@include('Shop.layout.partials.header-basket')
|
@include('Shop.layout.partials.header-basket')
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="row d-lg-none bg-green-dark">
|
||||||
|
<div class="col-12 p-0">
|
||||||
|
<div class="collapse" id="navbarContentMobile">
|
||||||
|
<nav class="navbar navbar-dark p-0">
|
||||||
|
@include('Shop.layout.partials.sections-menu-list')
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|||||||
@@ -10,6 +10,13 @@
|
|||||||
<div class="input-group-append">
|
<div class="input-group-append">
|
||||||
<span class="input-group-text"><i class="btn btn-sm fa fa-search"></i></span>
|
<span class="input-group-text"><i class="btn btn-sm fa fa-search"></i></span>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="input-group-append d-lg-none">
|
||||||
|
<button class="navbar-toggler navbar-light" type="button" data-toggle="collapse"
|
||||||
|
data-target="#navbarContentMobile" aria-controls="navbarContentMobile" aria-expanded="false"
|
||||||
|
aria-label="Menu catégories">
|
||||||
|
<span class="navbar-toggler-icon"></span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<ul class="navbar-nav w-100">
|
||||||
|
@foreach ($categories as $menu)
|
||||||
|
<li class="nav-item dropdown megamenu p-2 col
|
||||||
|
@if (in_array($menu['id'], [$category['id'] ?? false, $category['parent_id'] ?? false, $category['parent']['parent_id'] ?? false])) active @endif">
|
||||||
|
@if ($menu['children'] ?? false)
|
||||||
|
<a id="megamenu_{{ $menu['id'] }}" href="{{ route('Shop.Categories.show', ['id' => $menu['id']]) }}" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" class="nav-link dropdown-toggle text-uppercase">
|
||||||
|
{{ $menu['name'] }}
|
||||||
|
</a>
|
||||||
|
<div aria-labelledby="megamenu_{{ $menu['id'] }}" class="dropdown-menu border-0 p-0 m-0">
|
||||||
|
@include('Shop.layout.partials.megamenu')
|
||||||
|
</div>
|
||||||
|
@else
|
||||||
|
<a href="{{ route('Shop.Categories.show', ['id' => $menu['id']]) }}" class="nav-link text-uppercase text-white">
|
||||||
|
{{ $menu['name'] }}
|
||||||
|
</a>
|
||||||
|
@endif
|
||||||
|
</li>
|
||||||
|
@endforeach
|
||||||
|
</ul>
|
||||||
@@ -1,26 +1,8 @@
|
|||||||
<div class="row mb-3 bg-green-dark">
|
<div class="row mb-3 bg-green-dark d-none d-lg-block">
|
||||||
<div class="col-12 pl-0 pr-0">
|
<div class="col-12 pl-0 pr-0">
|
||||||
<nav class="navbar navbar-expand-lg p-0">
|
<nav class="navbar navbar-expand-lg navbar-dark p-0">
|
||||||
<div class="collapse navbar-collapse" id="navbarContent">
|
<div class="navbar-collapse show" id="navbarContent">
|
||||||
<ul class="navbar-nav w-100">
|
@include('Shop.layout.partials.sections-menu-list')
|
||||||
@foreach ($categories as $menu)
|
|
||||||
<li class="nav-item dropdown megamenu p-2 col
|
|
||||||
@if (in_array($menu['id'], [$category['id'] ?? false, $category['parent_id'] ?? false, $category['parent']['parent_id'] ?? false])) active @endif">
|
|
||||||
@if ($menu['children'] ?? false)
|
|
||||||
<a id="megamenu_{{ $menu['id'] }}" href="{{ route('Shop.Categories.show', ['id' => $menu['id']]) }}" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" class="nav-link dropdown-toggle text-uppercase">
|
|
||||||
{{ $menu['name'] }}
|
|
||||||
</a>
|
|
||||||
<div aria-labelledby="megamenu_{{ $menu['id'] }}" class="dropdown-menu border-0 p-0 m-0">
|
|
||||||
@include('Shop.layout.partials.megamenu')
|
|
||||||
</div>
|
|
||||||
@else
|
|
||||||
<a href="{{ route('Shop.Categories.show', ['id' => $menu['id']]) }}" class="nav-link text-uppercase text-white">
|
|
||||||
{{ $menu['name'] }}
|
|
||||||
</a>
|
|
||||||
@endif
|
|
||||||
</li>
|
|
||||||
@endforeach
|
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -15,7 +15,20 @@
|
|||||||
@isset($trigger) data-trigger="{{ $trigger }}" @endisset
|
@isset($trigger) data-trigger="{{ $trigger }}" @endisset
|
||||||
@isset($container) data-container="{{ $container }}" @endisset
|
@isset($container) data-container="{{ $container }}" @endisset
|
||||||
@isset($html) data-html="true" @endisset
|
@isset($html) data-html="true" @endisset
|
||||||
@isset($metadata) {{ $metadata }} @endisset>
|
@isset($metadata) {{ $metadata }} @endisset
|
||||||
|
@isset($attr)
|
||||||
|
@if (is_array($attr))
|
||||||
|
@foreach ($attr as $key => $value)
|
||||||
|
@if ($value === true)
|
||||||
|
{{ $key }}
|
||||||
|
@elseif ($value !== false && $value !== null)
|
||||||
|
{{ $key }}="{{ $value }}"
|
||||||
|
@endif
|
||||||
|
@endforeach
|
||||||
|
@else
|
||||||
|
{{ $attr }}
|
||||||
|
@endif
|
||||||
|
@endisset>
|
||||||
<i class="fa fa-fw {{ $icon ?? '' }}"></i>
|
<i class="fa fa-fw {{ $icon ?? '' }}"></i>
|
||||||
{{ $txt ?? '' }}
|
{{ $txt ?? '' }}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
@include('components.form.button', [
|
||||||
|
'class' => 'btn-info duplicate ' . ($class ?? ''),
|
||||||
|
'icon' => 'fa-copy',
|
||||||
|
'txt' => __('Dupliquer'),
|
||||||
|
'attr' => ['data-url' => $duplicate_url ?? $duplicateUrl ?? null],
|
||||||
|
])
|
||||||
@@ -1,7 +1,33 @@
|
|||||||
|
@php
|
||||||
|
$cancelUrl = $cancel_url ?? $cancelUrl ?? null;
|
||||||
|
$duplicateUrl = $duplicate_url ?? $duplicateUrl ?? null;
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
@push('header-actions')
|
||||||
|
<div class="form-buttons d-flex align-items-center ml-3">
|
||||||
|
@include('components.form.buttons.button-cancel', [
|
||||||
|
'class' => 'btn-sm mr-2',
|
||||||
|
'url' => $cancelUrl,
|
||||||
|
])
|
||||||
|
@if($duplicateUrl)
|
||||||
|
@include('components.form.buttons.button-duplicate', [
|
||||||
|
'class' => 'btn-sm mr-2',
|
||||||
|
'duplicate_url' => $duplicateUrl,
|
||||||
|
])
|
||||||
|
@endif
|
||||||
|
@include('components.form.buttons.button-save', [
|
||||||
|
'class' => 'btn-sm',
|
||||||
|
])
|
||||||
|
</div>
|
||||||
|
@endpush
|
||||||
|
|
||||||
<div class="row pt-0 pb-3">
|
<div class="row pt-0 pb-3">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div class="text-right form-buttons">
|
<div class="text-right form-buttons">
|
||||||
@include('components.form.buttons.button-cancel')
|
@include('components.form.buttons.button-cancel', ['url' => $cancelUrl])
|
||||||
|
@if($duplicateUrl)
|
||||||
|
@include('components.form.buttons.button-duplicate', ['duplicate_url' => $duplicateUrl])
|
||||||
|
@endif
|
||||||
@include('components.form.buttons.button-save')
|
@include('components.form.buttons.button-save')
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,15 +1,18 @@
|
|||||||
<div class="content-header pt-2 pb-1">
|
<div class="content-header pt-2 pb-1">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<div class="row mb-2 align-items-end">
|
<div class="row mb-2 align-items-center">
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-8">
|
||||||
<h1 class="m-0 text-dark">
|
<div class="d-flex align-items-center flex-wrap">
|
||||||
{{ $title ?? null}}
|
<h1 class="m-0 text-dark d-flex align-items-center flex-grow-1">
|
||||||
@isset($subtitle)
|
{{ $title ?? null}}
|
||||||
<small class="font-weight-light ml-1 text-md">{{ $subtitle }}</small>
|
@isset($subtitle)
|
||||||
@endisset
|
<small class="font-weight-light ml-1 text-md">{{ $subtitle }}</small>
|
||||||
</h1>
|
@endisset
|
||||||
|
</h1>
|
||||||
|
@stack('header-actions')
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-4">
|
||||||
<ol class="breadcrumb float-sm-right text-sm">
|
<ol class="breadcrumb float-sm-right text-sm">
|
||||||
<li class="breadcrumb-item">
|
<li class="breadcrumb-item">
|
||||||
<a href="{{ route('boilerplate.dashboard') }}">
|
<a href="{{ route('boilerplate.dashboard') }}">
|
||||||
|
|||||||
@@ -94,6 +94,18 @@
|
|||||||
|
|
||||||
@stack('scripts')
|
@stack('scripts')
|
||||||
@stack('js')
|
@stack('js')
|
||||||
|
<script>
|
||||||
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
|
document.querySelectorAll('.form-buttons .duplicate').forEach(function(btn) {
|
||||||
|
btn.addEventListener('click', function() {
|
||||||
|
var url = this.dataset.url || this.getAttribute('data-url');
|
||||||
|
if (url) {
|
||||||
|
window.location = url;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
''); // Empty tags
|
''); // Empty tags
|
||||||
},
|
},
|
||||||
skin: "oxide",
|
skin: "oxide",
|
||||||
content_css: 'oxide',
|
content_css: 'default',
|
||||||
language: '{{ App::getLocale() }}',
|
language: '{{ App::getLocale() }}',
|
||||||
file_picker_callback: function(callback, value, meta) {
|
file_picker_callback: function(callback, value, meta) {
|
||||||
var x = window.innerWidth || document.documentElement.clientWidth || document.getElementsByTagName(
|
var x = window.innerWidth || document.documentElement.clientWidth || document.getElementsByTagName(
|
||||||
|
|||||||
@@ -9,14 +9,16 @@
|
|||||||
var selector = (typeof(sel) == 'undefined') ? '.save' : sel;
|
var selector = (typeof(sel) == 'undefined') ? '.save' : sel;
|
||||||
$(selector).off().click(function(e) {
|
$(selector).off().click(function(e) {
|
||||||
if (typeof initValidator === 'function') {
|
if (typeof initValidator === 'function') {
|
||||||
console.log('click');
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if ($(form).valid()) {
|
if ($(form).valid()) {
|
||||||
$(this).prop("disabled", true);
|
$(this).prop("disabled", true);
|
||||||
$(this).html($(this).data('loading-text'));
|
$(this).html($(this).data('loading-text'));
|
||||||
$(form).submit();
|
$(form).submit();
|
||||||
} else {
|
} else {
|
||||||
console.log('erreur');
|
const $firstInvalid = $(form).find(':invalid, .error').first();
|
||||||
|
if ($firstInvalid.length) {
|
||||||
|
$firstInvalid.focus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$(form).submit();
|
$(form).submit();
|
||||||
|
|||||||
@@ -75,12 +75,12 @@
|
|||||||
if (typeof(tinyMCE) != 'undefined') {
|
if (typeof(tinyMCE) != 'undefined') {
|
||||||
tinyMCE.triggerSave();
|
tinyMCE.triggerSave();
|
||||||
}
|
}
|
||||||
$('form ' + form_id).submit();
|
getModalForm(form_id).trigger('submit');
|
||||||
status = 1;
|
status = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
function handlePostModal(form_id, url_save, callback) {
|
function handlePostModal(form_id, url_save, callback) {
|
||||||
$('form ' + form_id).submit(function(e) {
|
getModalForm(form_id).off('submit').on('submit', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var formData = new FormData(this);
|
var formData = new FormData(this);
|
||||||
$.ajax({
|
$.ajax({
|
||||||
@@ -98,6 +98,15 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getModalForm(form_id) {
|
||||||
|
var $form = $(form_id);
|
||||||
|
if (! $form.length) {
|
||||||
|
$form = $('form' + form_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $form;
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
@endpush
|
@endpush
|
||||||
|
|
||||||
|
|||||||
@@ -14,4 +14,5 @@ Route::prefix('Articles')->name('Articles.')->group(function () {
|
|||||||
Route::get('getProductImages/{product_id?}/{model?}', 'ArticleController@getProductImages')->name('getProductImages');
|
Route::get('getProductImages/{product_id?}/{model?}', 'ArticleController@getProductImages')->name('getProductImages');
|
||||||
Route::post('toggleVisible', 'ArticleController@toggleVisible')->name('toggleVisible');
|
Route::post('toggleVisible', 'ArticleController@toggleVisible')->name('toggleVisible');
|
||||||
Route::post('toggleHomepage', 'ArticleController@toggleHomepage')->name('toggleHomepage');
|
Route::post('toggleHomepage', 'ArticleController@toggleHomepage')->name('toggleHomepage');
|
||||||
|
Route::get('duplicate/{id}', 'ArticleController@duplicate')->name('duplicate');
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
Route::middleware('auth')->prefix('Admin')->namespace('Admin')->name('Admin.')->group(function () {
|
Route::middleware('auth')->prefix('Admin')->namespace('Admin')->name('Admin.')->group(function () {
|
||||||
Route::get('{period?}', 'HomeController@index')->name('home');
|
|
||||||
include __DIR__.'/Botanic/route.php';
|
include __DIR__.'/Botanic/route.php';
|
||||||
include __DIR__.'/Core/route.php';
|
include __DIR__.'/Core/route.php';
|
||||||
include __DIR__.'/Shop/route.php';
|
include __DIR__.'/Shop/route.php';
|
||||||
|
Route::get('{period?}', 'HomeController@index')->name('home');
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
Route::prefix('Offres')->name('Offers.')->group(function () {
|
Route::prefix('Offres')->name('Offers.')->group(function () {
|
||||||
Route::get('show/{id}', 'OfferController@show')->name('show');
|
// Public offer pages are not exposed; keep the route returning 404 to avoid leaking data.
|
||||||
|
Route::get('show/{id}', function () {
|
||||||
|
abort(404);
|
||||||
|
})->name('show');
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user