fixes on merchandise

This commit is contained in:
Ludovic CANDELLIER
2022-05-02 08:34:40 +02:00
parent 2ee339a022
commit 439a339027
13 changed files with 230 additions and 18 deletions

View File

@@ -29,7 +29,7 @@ class SpeciesDataTable extends DataTable
->editColumn('tags2', function (Specie $specie) {
$html = '';
foreach ($specie->tags as $tag) {
$html .= '<span class="btn btn-xs btn-secondary pb-2">' . $tag->slug . '</span> ';
$html .= Tags::getTagHtml($tag);
}
return $html;
})

View File

@@ -6,6 +6,7 @@ use Yajra\DataTables\Html\Column;
use App\Datatables\ParentDataTable as DataTable;
use App\Models\Botanic\Variety;
use App\Repositories\Botanic\Varieties;
use App\Repositories\Shop\Tags;
class VarietiesDataTable extends DataTable
{
@@ -17,7 +18,6 @@ class VarietiesDataTable extends DataTable
return $this->buildQuery($model);
}
public function modifier($datatables)
{
$datatables
@@ -27,7 +27,7 @@ class VarietiesDataTable extends DataTable
->editColumn('tags2', function (Variety $variety) {
$html = '';
foreach ($variety->tags as $tag) {
$html .= '<span class="btn btn-xs btn-secondary pb-2">' . $tag->slug . '</span> ';
$html .= Tags::getTagHtml($tag);
}
return $html;
})

View File

@@ -76,7 +76,7 @@ class ArticlesDataTable extends DataTable
->editColumn('tags2', function (Article $article) {
$html = '';
foreach ($article->tags as $tag) {
$html .= '<span class="btn btn-xs btn-success pb-2 mb-1" style="font-size: 0.8em;">' . Tags::getFullnameByTag($tag) . '</span> ';
$html .= Tags::getTagHtml($tag);
}
return $html;
})

View File

@@ -6,6 +6,7 @@ use Yajra\DataTables\Html\Column;
use App\Datatables\ParentDataTable as DataTable;
use App\Models\Shop\Merchandise;
use App\Repositories\Shop\Merchandises;
use App\Repositories\Shop\Tags;
class MerchandisesDataTable extends DataTable
{
@@ -27,7 +28,7 @@ class MerchandisesDataTable extends DataTable
->editColumn('tags2', function (Merchandise $merchandise) {
$html = '';
foreach ($merchandise->tags as $tag) {
$html .= '<span class="btn btn-xs btn-secondary pb-2">' . $tag->slug . '</span> ';
$html .= Tags::getTagHtml($tag);
}
return $html;
})

View File

@@ -6,6 +6,7 @@ use Yajra\DataTables\Html\Column;
use App\Datatables\ParentDataTable as DataTable;
use App\Models\Shop\Producer;
use App\Repositories\Shop\Producers;
use App\Repositories\Shop\Tags;
class ProducersDataTable extends DataTable
{
@@ -27,7 +28,7 @@ class ProducersDataTable extends DataTable
->editColumn('tags2', function (Producer $producer) {
$html = '';
foreach ($producer->tags as $tag) {
$html .= '<span class="btn btn-xs btn-secondary pb-2">' . $tag->slug . '</span> ';
$html .= Tags::getTagHtml($tag);
}
return $html;
})

View File

@@ -50,21 +50,22 @@ class Merchandises
return Merchandise::find($id);
}
public static function getFull($id)
{
$data = self::get($id)->toArray();
return $data;
}
public static function getTags($id)
{
return self::get($id)->tags;
}
public static function storeTags($merchandise, $tags)
{
return Tag::storeTags($merchandise, $tags);
}
public static function store($data)
{
$id = isset($data['id']) ? $data['id'] : false;
$item = $id ? self::update($data, $id) : self::create($data);
return $item->id;
return $item;
}
public static function storeFull($data)
@@ -79,6 +80,11 @@ class Merchandises
return $merchandise;
}
public static function storeTags($merchandise, $tags)
{
return Tag::storeTags($merchandise, $tags);
}
public static function create($data)
{
return Merchandise::create($data);

View File

@@ -8,6 +8,11 @@ use App\Models\Shop\Tag;
class Tags
{
public static function getTagHtml($tag)
{
return '<span class="btn btn-xs btn-secondary pb-2">' . self::getFullnameByTag($tag) . '</span>';
}
public static function getOptions()
{
return Tag::pluck('name', 'id')->toArray();

20
config/cookie-consent.php Normal file
View File

@@ -0,0 +1,20 @@
<?php
return [
/*
* Use this setting to enable the cookie consent dialog.
*/
'enabled' => env('COOKIE_CONSENT_ENABLED', true),
/*
* The name of the cookie in which we store if the user
* has agreed to accept the conditions.
*/
'cookie_name' => 'laravel_cookie_consent',
/*
* Set the cookie duration in days. Default is 365 * 20.
*/
'cookie_lifetime' => 365 * 20,
];

101
config/seo.php Normal file
View File

@@ -0,0 +1,101 @@
<?php
use RalphJSmit\Laravel\SEO\Models\SEO;
return [
/**
* The SEO model. You can use this setting to override the model used by the package.
* Make sure to always extend the old model, so that you'll not lose functionality during upgrades.
*/
'model' => SEO::class,
/**
* Use this setting to specify the site name that will be used in OpenGraph tags.
*/
'site_name' => null,
/**
* Use this setting to specify the path to the sitemap of your website. This exact path will outputted, so
* you can use both a hardcoded url and a relative path. We recommend the later.
*
* Example: '/storage/sitemap.xml'
* Do not forget the slash at the start. This will tell the search engine that the path is relative
* to the root domain and not relative to the current URL. The `spatie/laravel-sitemap` package
* is a great package to generate sitemaps for your application.
*/
'sitemap' => null,
/**
* Use this setting to specify whether you want self-referencing `<link rel="canonical" href="$url">` tags to
* be added to the head of every page. There has been some debate whether this a good practice, but experts
* from Google and Yoast say that this is the best strategy.
* See https://yoast.com/rel-canonical/.
*/
'canonical_link' => true,
/**
* Use this setting to specify the path to the favicon for your website. The url to it will be generated using the `secure_url()` function,
* so make sure to make the favicon accessibly from the `public` folder.
*
* You can use the following filetypes: ico, png, gif, jpeg, svg.
*/
'favicon' => null,
'title' => [
/**
* Use this setting to let the package automatically infer a title from the url, if no other title
* was given. This will be very useful on pages where you don't have an Eloquent model for, or where you
* don't want to hardcode the title.
*
* For example, if you have a with the url '/foo/about-me', we'll automatically set the title to 'About me' and append the site suffix.
*/
'infer_title_from_url' => true,
/**
* Use this setting to provide a suffix that will be added after the title on each page.
* If you don't want a suffix, you should specify an empty string.
*/
'suffix' => '',
/**
* Use this setting to provide a custom title for the homepage. We will not use the suffix on the homepage,
* so you'll need to add the suffix manually if you want that. If set to null, we'll determine the title
* just like the other pages.
*/
'homepage_title' => null,
],
'description' => [
/**
* Use this setting to specify a fallback description, which will be used on places
* where we don't have a description set via an associated ->seo model or via
* the ->getDynamicSEOData() method.
*/
'fallback' => null,
],
'image' => [
/**
* Use this setting to specify a fallback image, which will be used on places where you
* don't have an image set via an associated ->seo model or via the ->getDynamicSEOData() method.
* This should be a path to an image. The url to the path is generated using the `secure_url()` function (`secure_url($yourProvidedPath)`).
*/
'fallback' => null,
],
'author' => [
/**
* Use this setting to specify a fallback author, which will be used on places where you
* don't have an author set via an associated ->seo model or via the ->getDynamicSEOData() method.
*/
'fallback' => null,
],
'twitter' => [
/**
* Use this setting to enter your username and include that with the Twitter Card tags.
* Enter the username like 'yourUserName', so without the '@'.
*/
'@username' => null,
],
];

54
config/snooze.php Normal file
View File

@@ -0,0 +1,54 @@
<?php
use Thomasjohnkane\Snooze\Models\ScheduledNotification;
return [
/*
* The table the scheduled notifications are stored in
*/
'table' => 'scheduled_notifications',
/*
* The ScheduledNotification model to use.
* If you need to customise the model you can override this
*/
'model' => ScheduledNotification::class,
/*
* The frequency at which to send notifications
*
* Available options are everyMinute, everyFiveMinutes, everyTenMinutes,
* everyFifteenMinutes, everyThirtyMinutes, hourly, and daily.
*/
'sendFrequency' => env('SCHEDULED_NOTIFICATION_SEND_FREQUENCY', 'everyMinute'),
/*
* The tolerance at which to look for old notifications waiting to be sent, in seconds.
* This is to prevent sending a large amount of notifications if the command stops
* running. By default it's set to 24 hours
*/
'sendTolerance' => env('SCHEDULED_NOTIFICATION_SEND_TOLERANCE', 60 * 60 * 24),
/*
* The age at which to prune sent/cancelled notifications, in days.
* If set to null, pruning will be turned off. By default it's turned off
*/
'pruneAge' => env('SCHEDULED_NOTIFICATION_PRUNE_AGE', null),
/*
* Disable sending of scheduled notifications
* You will still be able to schedule notifications,
* and they will be sent once the scheduler is enabled.
*/
'disabled' => env('SCHEDULED_NOTIFICATIONS_DISABLED', false),
/*
* Should the snooze commands utilise the Laravel onOneServer functionality
*/
'onOneServer' => env('SCHEDULED_NOTIFICATIONS_ONE_SERVER', false),
/*
* Should snooze automatically schedule the snooze:send and snooze:prune commands
*/
'scheduleCommands' => env('SCHEDULED_NOTIFICATIONS_SCHEDULE_COMMANDS', true),
];

View File

@@ -0,0 +1,24 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up()
{
Schema::create('seo', function (Blueprint $table) {
$table->id();
$table->morphs('model');
$table->longText('description')->nullable();
$table->string('title')->nullable();
$table->string('image')->nullable();
$table->string('author')->nullable();
$table->timestamps();
});
}
};

View File

@@ -1,4 +1,4 @@
<div class="row basket-row" id="basket_offer-{{ $item['id'] }}" data-id={{ $item['id'] }}>
<div class="row basket-row mb-3" id="basket_offer-{{ $item['id'] }}" data-id={{ $item['id'] }}>
<div class="col-2 text-center">
<img src="{{ $item['image'] }}" class="img-fluid border border-success">
</div>
@@ -10,7 +10,7 @@
{{ $item['variation'] }}<br/>
<div class="row">
<div class="col-6">
<span class="basket-price">{{ $item['price'] }}</span> / unité
<span class="basket-price">{{ number_format($item['price'],2) }}</span> / unité
</div>
<div class="col-2">
@include('components.form.inputs.number', [
@@ -21,8 +21,8 @@
])
</div>
<div class="col-4 text-right" style="font-size: 2em;" id="basket_total-{{ $item['id'] }}">
<span class="basket-total-row">{{ $item['quantity'] * $item['price'] }}</span>
<i class="btn btn-success fa fa-trash basket-delete ml-3 mb-2" data-id={{ $item['id'] }}></i>
<span class="basket-total-row">{{ number_format($item['quantity'] * $item['price'],2) }}</span>
<i class="btn btn-warning fa fa-trash basket-delete ml-3 mb-2" data-id={{ $item['id'] }}></i>
</div>
</div>
</div>

View File

@@ -1,5 +1,5 @@
<div class="row">
<div class="col-5">
<div class="col-6">
<div class="row">
<div class="col-6">
<img src="{{ $offer['article']['image'] }}" class="card-img-top" alt="...">
@@ -23,7 +23,7 @@
</div>
</div>
</div>
<div class="col-7">
<div class="col-6">
<div>
Il y a {{ $basket['quantity'] ?? 0 }} articles dans votre panier.
</div>