From 17152c928534268422d120aea61e33cfb6619ab4 Mon Sep 17 00:00:00 2001 From: Noah Lancien Date: Mon, 10 Jul 2023 15:31:10 +0200 Subject: [PATCH 01/10] Replace first by firstOrFail to get the first shop --- app/Http/Controllers/ContactController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/ContactController.php b/app/Http/Controllers/ContactController.php index c5a6ad9b..198c703a 100644 --- a/app/Http/Controllers/ContactController.php +++ b/app/Http/Controllers/ContactController.php @@ -24,7 +24,7 @@ class ContactController extends Controller $status = $request->session()->get('status'); // 1er magasin en base pour le moment - $magasin = Magasin::first(); + $magasin = Magasin::firstOrFail(); $content = Content::where('key', 'contact')->first(); return view('contact', compact('status', 'magasin', 'content')); From 44f72a32590c6b8ba41a15e6c4e65049413e10b0 Mon Sep 17 00:00:00 2001 From: "noah.lancien" Date: Mon, 10 Jul 2023 15:09:06 +0000 Subject: [PATCH 02/10] Reminder mail --- app/Console/Kernel.php | 2 + app/Jobs/SendReminderMail.php | 37 +++ app/Mail/OrderConfirmAdminMail.php | 8 +- app/Mail/OrderTodayReminderMail.php | 48 ++++ app/Models/Product.php | 13 +- app/Providers/AppServiceProvider.php | 38 +++- .../emails/order-confirm-admin.blade.php | 47 +--- .../views/emails/order-reminder.blade.php | 215 ++++++++++++++++++ .../front/sable/mails/order-confirm.blade.php | 107 +++------ .../front/sable/mails/order-status.blade.php | 6 +- 10 files changed, 386 insertions(+), 135 deletions(-) create mode 100644 app/Jobs/SendReminderMail.php create mode 100644 app/Mail/OrderTodayReminderMail.php create mode 100644 resources/views/emails/order-reminder.blade.php diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index b5075e69..391fbc84 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -2,6 +2,7 @@ namespace App\Console; +use App\Jobs\SendReminderMail; use App\Jobs\XmlIncoReader as JobsXmlIncoReader; use Illuminate\Console\Scheduling\Schedule; use Illuminate\Foundation\Console\Kernel as ConsoleKernel; @@ -26,6 +27,7 @@ class Kernel extends ConsoleKernel { $schedule->command('ldcweb:statuschecker')->everyFifteenMinutes(); $schedule->job(JobsXmlIncoReader::class)->name('xml-inco-reader')->onOneServer()->dailyAt('15:00'); + $schedule->job(SendReminderMail::class)->onOneServer()->dailyAt('7:00'); } /** diff --git a/app/Jobs/SendReminderMail.php b/app/Jobs/SendReminderMail.php new file mode 100644 index 00000000..4bfc4bb3 --- /dev/null +++ b/app/Jobs/SendReminderMail.php @@ -0,0 +1,37 @@ +where('day', now()->format('d/m/Y')); + })->get(); + + foreach ($orders as $order) { + Mail::to($order->customer->email)->queue(new OrderTodayReminderMail($order)); + } + } +} diff --git a/app/Mail/OrderConfirmAdminMail.php b/app/Mail/OrderConfirmAdminMail.php index 1e021183..e9f72afe 100644 --- a/app/Mail/OrderConfirmAdminMail.php +++ b/app/Mail/OrderConfirmAdminMail.php @@ -7,6 +7,7 @@ use App\Models\Order; use Illuminate\Bus\Queueable; use Illuminate\Mail\Mailable; use Illuminate\Queue\SerializesModels; +use Illuminate\Support\Str; class OrderConfirmAdminMail extends Mailable { @@ -43,7 +44,12 @@ class OrderConfirmAdminMail extends Mailable $magasin = Magasin::find($order->timeslot->magasin->id); return $this->subject( - "Nouvelle Commande - " . config('theme.site_name') + \sprintf( + 'Nouvelle commande de %s %s - %s', + $order->customer->salarie->prenom, + Str::upper($order->customer->salarie->nom), + config('theme.site_name') + ) )->view('emails.order-confirm-admin', compact('order', 'magasin')); } } diff --git a/app/Mail/OrderTodayReminderMail.php b/app/Mail/OrderTodayReminderMail.php new file mode 100644 index 00000000..00a66e13 --- /dev/null +++ b/app/Mail/OrderTodayReminderMail.php @@ -0,0 +1,48 @@ +order = $order; + } + + /** + * Build the message. + * + * @return $this + */ + public function build() + { + $order = $this->order; + $magasin = Magasin::find($order->timeslot->magasin->id); + + return $this->subject( + "Votre commande est prête - " . config('theme.site_name') + )->view('emails.order-reminder', compact('order', 'magasin')); + } +} diff --git a/app/Models/Product.php b/app/Models/Product.php index d69085c4..7483fb5a 100644 --- a/app/Models/Product.php +++ b/app/Models/Product.php @@ -261,18 +261,9 @@ class Product extends Model implements Buyable } } $showPrice = $this->priceKgTtc; - }//end if + } //end if - // Prix transmis en fonction du setting show_prices. - if (config('bosettings.show_prices_authenticated') == "authenticated") { - if (Auth::guard('customer')->check()) { - return $showPrice; - } - } - if (config('bosettings.show_prices_guest') == "guest") { - return $showPrice; - } - return "-.--"; + return $showPrice; } /** diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 5653b9d9..02d4a4bc 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -9,6 +9,7 @@ use Illuminate\Support\Facades\View; use Illuminate\Support\ServiceProvider; use Illuminate\Support\Facades\Blade; use Illuminate\Pagination\Paginator; +use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\URL; @@ -70,7 +71,7 @@ class AppServiceProvider extends ServiceProvider View::share('published_tags', $tags); } - Blade::directive('fmt_currency', function ($expression) { + Blade::directive('fmt_currency_without_auth', function ($expression) { return ""; }); + Blade::directive('fmt_currency', function ($expression) { + // Prix transmis en fonction du setting show_prices. + if ( + (config('bosettings.show_prices_authenticated') === "authenticated" && Auth::guard('customer')->check()) + || config('bosettings.show_prices_guest') == "guest" + ) { + return ""; + } + return "-.--"; + }); + Blade::directive('fmt_currency_without_ttc', function ($expression) { - return ""; + // Prix transmis en fonction du setting show_prices. + if ( + (config('bosettings.show_prices_authenticated') === "authenticated" && Auth::guard('customer')->check()) + || config('bosettings.show_prices_guest') == "guest" + ) { + return ""; + } + return "-.--"; }); Blade::directive('fmt_sellunit', function ($expression) { diff --git a/resources/views/emails/order-confirm-admin.blade.php b/resources/views/emails/order-confirm-admin.blade.php index 4c273d65..4abe3019 100644 --- a/resources/views/emails/order-confirm-admin.blade.php +++ b/resources/views/emails/order-confirm-admin.blade.php @@ -168,29 +168,7 @@ - - - - - - @@ -199,35 +177,18 @@ - + @foreach ($order->lines as $line) - + @endforeach
-
Bonjour,

La commande {{ $order->reference }} est confirmée
-
-

-

- -
-
Détail de la Commande :

+
Bonjour,

La commande {{ $order->reference }} de {{ $order->customer->salarie->prenom }} {{ Str::upper($order->customer->salarie->nom) }} est confirmée
Produit QuantitéTotalTotal TTC
{{ $line->product->name }} {{ $line->quantity }}@fmt_currency($line->total_ttc)@fmt_currency_without_auth($line->total_ttc)
- - -

-

- - - -
Total de la commande : @fmt_currency($order->total)
+
Total estimé : @fmt_currency_without_auth($order->total) TTC
diff --git a/resources/views/emails/order-reminder.blade.php b/resources/views/emails/order-reminder.blade.php new file mode 100644 index 00000000..eb9e5180 --- /dev/null +++ b/resources/views/emails/order-reminder.blade.php @@ -0,0 +1,215 @@ + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ +
+ + + + + + + +
+ + + + + + +
+ +
+
+
VOTRE COMMANDE EST PRÊTE !
+
+
+ +
+
+ +
+ + + + + + +
+ +
+ + + + + + + + + + +
+
+ Bonjour {{ $order->customer->salarie->prenom }} {{ Str::upper($order->customer->salarie->nom) }}, +

+ Votre commande {{ $order->reference }} est disponible +
+ N'oubliez pas de la récupérer aujourd'hui dans votre point relais : +
+
+
+ Point de retrait {{$magasin->name}}, {{$magasin->address}}, {{$magasin->postcode}} {{$magasin->city}} +
+
+
+
L'équipe {{ config('theme.site_name') }}
+
+
+ +
+
+ +
+ + + diff --git a/resources/views/front/sable/mails/order-confirm.blade.php b/resources/views/front/sable/mails/order-confirm.blade.php index 81a0293d..f7a5155c 100644 --- a/resources/views/front/sable/mails/order-confirm.blade.php +++ b/resources/views/front/sable/mails/order-confirm.blade.php @@ -167,29 +167,7 @@ - - - - - - @@ -198,8 +176,8 @@ - - + + @foreach ($order->lines as $line) @@ -208,29 +186,19 @@ - + @endforeach
-
Bonjour,

Votre commande {{ $order->reference }} est confirmée
-
-

-

- -
-
Détail de votre Commande :
+
Bonjour {{ $order->customer->salarie->prenom }} {{ Str::upper($order->customer->salarie->nom) }},

Votre commande {{ $order->reference }} est confirmée
Produit QuantitéPrix kiloTotalPrix kilo TTCTotal TTC
{{ $line->quantity }} - @if ($line->product->weight_variable) @fmt_currency($line->product->priceKgTtc) @endif + @if ($line->product->weight_variable) @fmt_currency_without_auth($line->product->priceKgTtc) @endif @fmt_currency($line->total_ttc)@fmt_currency_without_auth($line->total_ttc)
- -

-

- + +
+ Total estimé de la commande : @fmt_currency_without_auth($order->total) TTC +
@@ -240,10 +208,20 @@ - -

NB: Nous faisons le maximum pour vous livrer l'intégralité de votre commande, malheureusement certains produits peuvent - être en rupture. Vous ne serez pas facturé des produits non livrés.
- Pour toutes questions contactez-nous.

+ +

+

+ @@ -266,41 +244,30 @@
- Total estimé de la commande : @fmt_currency($order->total) TTC -
- - - - -

-

- - - - - -
- A retirer le {{$order->timeslot->day}} à {{$order->timeslot->time}}, à l’adresse suivante :

+ A retirer le {{$order->timeslot->day}} à {{$order->timeslot->time}}, à l'adresse suivante :

Mon point de retrait {{$magasin->name}}, {{$magasin->address}}, {{$magasin->postcode}} {{$magasin->city}}
+ + +

NB: Nous faisons le maximum pour vous livrer l'intégralité de votre commande, malheureusement certains produits peuvent + être en rupture. Vous ne serez pas facturé des produits non livrés.

+ +

L'équipe {{ config('theme.site_name') }}
+ + +
+ Pour toutes questions liées à votre commande, merci de contacter l'accueil par téléphone ou par notre rubrique contactez-nous +
+ + - + @if(config('app.env') === 'local') diff --git a/resources/views/front/sable/layouts/layout.blade.php b/resources/views/front/sable/layouts/layout.blade.php index 2440e800..090f2958 100644 --- a/resources/views/front/sable/layouts/layout.blade.php +++ b/resources/views/front/sable/layouts/layout.blade.php @@ -15,7 +15,7 @@ @include('layouts.footer') - + @yield('scripts') @include('partials.cookie') diff --git a/resources/views/front/sable/legal-notice.blade.php b/resources/views/front/sable/legal-notice.blade.php index cce8373a..efae014a 100644 --- a/resources/views/front/sable/legal-notice.blade.php +++ b/resources/views/front/sable/legal-notice.blade.php @@ -13,7 +13,7 @@ @if ($content !== null)
- {!! $content->value !!} + {!! clean($content->value) !!}
@endif diff --git a/resources/views/front/sable/privacy.blade.php b/resources/views/front/sable/privacy.blade.php index 891a2257..e94b1b1f 100644 --- a/resources/views/front/sable/privacy.blade.php +++ b/resources/views/front/sable/privacy.blade.php @@ -13,7 +13,7 @@ @if ($content !== null)
- {!! $content->value !!} + {!! clean($content->value) !!}
@endif diff --git a/resources/views/front/sable/sass/fo/base/_common.scss b/resources/views/front/sable/sass/fo/base/_common.scss index 5b893626..77ee6a87 100644 --- a/resources/views/front/sable/sass/fo/base/_common.scss +++ b/resources/views/front/sable/sass/fo/base/_common.scss @@ -180,6 +180,27 @@ img { } } +.contact { + &-content { + form { + width: 100%; + max-width: 25rem; + + .form-control { + width: 20rem; + } + + img { + height: 5rem; + } + + textarea { + resize: none; + } + } + } +} + .pagination { .page-link { background-color: #f6c500; diff --git a/resources/views/front/sable/terms.blade.php b/resources/views/front/sable/terms.blade.php index 5e13489d..81e3f9b0 100644 --- a/resources/views/front/sable/terms.blade.php +++ b/resources/views/front/sable/terms.blade.php @@ -12,8 +12,8 @@

{{ $content->title }}

@if ($content !== null)
-
- {!! $content->value !!} +
+ {!! clean($content->value) !!}
@endif diff --git a/webpack.mix.js b/webpack.mix.js index 918dbce5..14d5eff1 100644 --- a/webpack.mix.js +++ b/webpack.mix.js @@ -32,7 +32,9 @@ mix.js('resources/views/front/' + process.env.APP_THEME + '/js/app.js', 'public/ .sass('resources/views/front/' + process.env.APP_THEME + '/sass/app.scss', 'public/' + process.env.APP_THEME + '/css') .options({ processCssUrls: false - }); + }) + .version(); + mix.copyDirectory('resources/views/front/' + process.env.APP_THEME + '/img', 'public/' + process.env.APP_THEME + '/img/') .copyDirectory('resources/views/front/' + process.env.APP_THEME + '/fonts', 'public/' + process.env.APP_THEME + '/fonts/'); From b47e04cf2681f4da0afe351266b07ad3ff135c8e Mon Sep 17 00:00:00 2001 From: Nicolas Demangeat Date: Mon, 24 Jul 2023 09:26:54 +0000 Subject: [PATCH 07/10] change navbar toggler icon color to dark --- resources/views/front/sable/layouts/navbar.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/front/sable/layouts/navbar.blade.php b/resources/views/front/sable/layouts/navbar.blade.php index 41e3ef6d..4187a0da 100644 --- a/resources/views/front/sable/layouts/navbar.blade.php +++ b/resources/views/front/sable/layouts/navbar.blade.php @@ -1,4 +1,4 @@ - diff --git a/routes/web-bo.php b/routes/web-bo.php index 4d15f4c6..6e25761c 100644 --- a/routes/web-bo.php +++ b/routes/web-bo.php @@ -14,6 +14,7 @@ use App\Http\Controllers\Bo\MagasinsController; use App\Http\Controllers\Bo\ProductsController; use App\Http\Controllers\Bo\SlidesController; use App\Http\Controllers\Bo\TagsController; +use App\Http\Controllers\Bo\SalariesController; /* * -------------------------------------------------------------------------- @@ -42,6 +43,14 @@ Route::namespace('App\Http\Controllers\Bo') ->middleware(['auth', 'is-admin']) ->group( function () { + Route::middleware(['is-super-admin']) + ->group( + function () { + // Salaries. + Route::get('/salaries', [SalariesController::class, 'index'])->name('salaries.index'); + Route::post('/salaries/file', [SalariesController::class, 'import'])->name('salaries.file'); + } + ); Route::get('/', [DashboardController::class, 'index'])->name('dashboard'); Route::match(['get', 'put'], '/content/{key}', [ContentController::class, 'manage'])->name('content'); Route::match(['get', 'put'], '/settings', [SettingsController::class, 'manage'])->name('settings');