Merge branch 'develop' into trunk
This commit is contained in:
commit
2c0961dcc3
8 changed files with 181 additions and 94 deletions
|
|
@ -26,7 +26,7 @@ class Kernel extends ConsoleKernel
|
|||
protected function schedule(Schedule $schedule)
|
||||
{
|
||||
$schedule->job(JobsXmlIncoReader::class)->name('xml-inco-reader')->onOneServer()->dailyAt('15:00');
|
||||
$schedule->job(SendReminderMail::class)->onOneServer()->dailyAt('7:00');
|
||||
$schedule->job(SendReminderMail::class)->onOneServer()->dailyAt('10:00');
|
||||
$schedule->job(GetPublicHolidayForNextYear::class)->onOneServer()->yearlyOn(11, 1, '7:30');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,6 +15,11 @@ use Kwaadpepper\Enum\BaseEnumRoutable;
|
|||
* @method static self marie()
|
||||
* @method static self tregalette()
|
||||
* @method static self esprirestauration()
|
||||
* @method static self lepetitmarchedeloue()
|
||||
* @method static self lesaccessibles()
|
||||
* @method static self legauloisvegetal()
|
||||
* @method static self natureandrespect()
|
||||
* @method static self reghalal()
|
||||
*
|
||||
*/
|
||||
class ProductBrand extends BaseEnumRoutable
|
||||
|
|
@ -27,13 +32,18 @@ class ProductBrand extends BaseEnumRoutable
|
|||
public static function labels()
|
||||
{
|
||||
return [
|
||||
'none' => 'Sans marque',
|
||||
'loue' => 'Loué',
|
||||
'legaulois' => 'Le Gaulois',
|
||||
'legauloispro' => 'Le Gaulois Professionnel',
|
||||
'marie' => 'Marie',
|
||||
'tregalette' => 'Trégalette',
|
||||
'esprirestauration' => 'Espri Restauration',
|
||||
'none' => 'Sans marque',
|
||||
'loue' => 'Loué',
|
||||
'legaulois' => 'Le Gaulois',
|
||||
'legauloispro' => 'Le Gaulois Professionnel',
|
||||
'marie' => 'Marie',
|
||||
'tregalette' => 'Trégalette',
|
||||
'esprirestauration' => 'Espri Restauration',
|
||||
'lepetitmarchedeloue' => 'Le petit marché de Loué',
|
||||
'lesaccessibles' => 'Les Accessibles',
|
||||
'legauloisvegetal' => 'Le Gaulois végétal',
|
||||
'natureandrespect' => 'Nature & Respect',
|
||||
'reghalal' => 'Réghalal'
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
80
app/Helpers/BladeDirectivesHelper.php
Normal file
80
app/Helpers/BladeDirectivesHelper.php
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
<?php
|
||||
|
||||
namespace App\Helpers;
|
||||
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use App\Models\SellUnit;
|
||||
use \Illuminate\Support\Str;
|
||||
|
||||
class BladeDirectivesHelper
|
||||
{
|
||||
/**
|
||||
* Format specific value.
|
||||
* Used for blade directive @fmt_currency_without_auth.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @return string
|
||||
*/
|
||||
private static function formatPriceValue($value): string
|
||||
{
|
||||
if (is_float($value)) {
|
||||
return sprintf('%s €', number_format($value, 2, ',', ' '));
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the formated value only if authorized.
|
||||
* Used for blade directive @fmt_currency and @fmt_currency_without_ttc.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @return string
|
||||
*/
|
||||
public static function formatCurrency($value): string
|
||||
{
|
||||
if (!self::shouldShowPrices()) {
|
||||
return '-.--';
|
||||
}
|
||||
return self::formatPriceValue($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if prices must be shown or not.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private static function shouldShowPrices(): bool
|
||||
{
|
||||
return (config('bosettings.show_prices_authenticated') === "authenticated" && Auth::guard('customer')->check())
|
||||
|| config('bosettings.show_prices_guest') == "guest";
|
||||
}
|
||||
|
||||
/**
|
||||
* Format the sales unit according to configuration.
|
||||
* Used for blade directive @fmt_sellunit.
|
||||
*
|
||||
* @param mixed $expression
|
||||
* @return string
|
||||
*/
|
||||
public static function formatSellUnit($expression): string
|
||||
{
|
||||
if (config('bosettings.sell_unit_management') == "strict") {
|
||||
return !empty($expression) ? sprintf('/ %s', SellUnit::make($expression)->label) : '';
|
||||
}
|
||||
return !empty($expression) ? sprintf('/ %s', $expression) : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract a title produced according to the theme configuration.
|
||||
* Used for blade directive @excerpt_product_title.
|
||||
*
|
||||
* @param string $expression
|
||||
* @param int|null $limit
|
||||
* @return string
|
||||
*/
|
||||
public static function excerptTitle(string $expression, $limit = null): string
|
||||
{
|
||||
$limit = $limit ?? config('theme.max_product_title_length');
|
||||
return Str::limit($expression, $limit);
|
||||
}
|
||||
}
|
||||
|
|
@ -27,7 +27,7 @@ class SendReminderMail implements ShouldQueue
|
|||
public function handle()
|
||||
{
|
||||
$orders = Order::whereHas('timeslot', function (Builder $query) {
|
||||
$query->where('day', now()->format('d/m/Y'));
|
||||
$query->where('day', now()->format('Y-m-d'));
|
||||
})->get();
|
||||
|
||||
foreach ($orders as $order) {
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ class OrderTodayReminderMail extends Mailable
|
|||
$magasin = Magasin::find($order->timeslot->magasin->id);
|
||||
|
||||
return $this->subject(
|
||||
"Votre commande est prête - " . config('theme.site_name')
|
||||
"Vous avez une commande à retirer aujourd'hui - " . config('theme.site_name')
|
||||
)->view('emails.order-reminder', compact('order', 'magasin'));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,58 +71,21 @@ class AppServiceProvider extends ServiceProvider
|
|||
View::share('published_tags', $tags);
|
||||
}
|
||||
|
||||
// Use blade directives helper to prevent blade files from being cached.
|
||||
Blade::directive('fmt_currency_without_auth', function ($expression) {
|
||||
return "<?php
|
||||
if(is_float($expression)) {
|
||||
echo sprintf('%s €', number_format($expression, 2, ',', ' '));
|
||||
} else {
|
||||
echo $expression;
|
||||
} ?>";
|
||||
return "<?php echo \App\Helpers\BladeDirectivesHelper::formatPriceValue($expression); ?>";
|
||||
});
|
||||
|
||||
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 "<?php
|
||||
if(is_float($expression)) {
|
||||
echo sprintf('%s €', number_format($expression, 2, ',', ' '));
|
||||
} else {
|
||||
echo $expression;
|
||||
} ?>";
|
||||
}
|
||||
return "-.--";
|
||||
return "<?php echo \App\Helpers\BladeDirectivesHelper::formatCurrency($expression); ?>";
|
||||
});
|
||||
|
||||
Blade::directive('fmt_currency_without_ttc', 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 "<?php
|
||||
if(is_float($expression)) {
|
||||
echo sprintf('%s €', number_format($expression, 2, ',', ' '));
|
||||
} else {
|
||||
echo $expression;
|
||||
} ?>";
|
||||
}
|
||||
return "-.--";
|
||||
return "<?php echo \App\Helpers\BladeDirectivesHelper::formatCurrency($expression); ?>";
|
||||
});
|
||||
|
||||
Blade::directive('fmt_sellunit', function ($expression) {
|
||||
if (config('bosettings.sell_unit_management') == "strict") {
|
||||
return "<?php if(!empty($expression)) { echo sprintf('/ %s', SellUnit::make($expression)->label); } ?>";
|
||||
} else {
|
||||
return "<?php if(!empty($expression)) { echo sprintf('/ %s', $expression); } ?>";
|
||||
}
|
||||
return "<?php echo \App\Helpers\BladeDirectivesHelper::formatSellUnit($expression); ?>";
|
||||
});
|
||||
|
||||
Blade::directive('excerpt_product_title', function ($expression) {
|
||||
$limit = config('theme.max_product_title_length');
|
||||
return "<?php echo Illuminate\Support\Str::limit($expression,$limit) ?>";
|
||||
return "<?php echo \App\Helpers\BladeDirectivesHelper::excerptTitle($expression); ?>";
|
||||
});
|
||||
|
||||
// Default paginator template for back Office.
|
||||
|
|
|
|||
1
package-lock.json
generated
1
package-lock.json
generated
|
|
@ -4,7 +4,6 @@
|
|||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "srcs",
|
||||
"devDependencies": {
|
||||
"@fancyapps/fancybox": "^3.5.7",
|
||||
"@fortawesome/fontawesome-free": "^6.2.0",
|
||||
|
|
|
|||
|
|
@ -2,46 +2,49 @@
|
|||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
|
||||
|
||||
<head>
|
||||
<title>
|
||||
</title>
|
||||
<!--[if !mso]><!-- -->
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<!--<![endif]-->
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style type="text/css">
|
||||
#outlook a {
|
||||
padding: 0;
|
||||
}
|
||||
<title></title>
|
||||
<!--[if !mso]><!-- -->
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<!--<![endif]-->
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style type="text/css">
|
||||
#outlook a {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
-webkit-text-size-adjust: 100%;
|
||||
-ms-text-size-adjust: 100%;
|
||||
}
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
-webkit-text-size-adjust: 100%;
|
||||
-ms-text-size-adjust: 100%;
|
||||
}
|
||||
|
||||
table,
|
||||
td {
|
||||
border-collapse: collapse;
|
||||
mso-table-lspace: 0pt;
|
||||
mso-table-rspace: 0pt;
|
||||
}
|
||||
table,
|
||||
td {
|
||||
border-collapse: collapse;
|
||||
mso-table-lspace: 0pt;
|
||||
mso-table-rspace: 0pt;
|
||||
}
|
||||
|
||||
img {
|
||||
border: 0;
|
||||
height: auto;
|
||||
line-height: 100%;
|
||||
outline: none;
|
||||
text-decoration: none;
|
||||
-ms-interpolation-mode: bicubic;
|
||||
}
|
||||
img {
|
||||
border: 0;
|
||||
height: auto;
|
||||
line-height: 100%;
|
||||
outline: none;
|
||||
text-decoration: none;
|
||||
-ms-interpolation-mode: bicubic;
|
||||
}
|
||||
|
||||
p {
|
||||
display: block;
|
||||
margin: 13px 0;
|
||||
}
|
||||
</style>
|
||||
p {
|
||||
display: block;
|
||||
margin: 13px 0;
|
||||
}
|
||||
|
||||
.tbl-line {
|
||||
padding-bottom: 8px;
|
||||
}
|
||||
</style>
|
||||
<!--[if mso]>
|
||||
<xml>
|
||||
<o:OfficeDocumentSettings>
|
||||
|
|
@ -122,7 +125,9 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td align="center" style="font-size:0px;padding:10px 25px;word-break:break-word;">
|
||||
<div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:25px;font-weight:bold;line-height:1;text-align:center;text-transform:uppercase;color:black;">VOTRE COMMANDE EST PRÊTE !</div>
|
||||
<div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:25px;font-weight:bold;line-height:1;text-align:center;text-transform:uppercase;color:black;">
|
||||
VOTRE COMMANDE EST À RÉCUPÉRER AUJOURD'HUI DANS VOTRE POINT DE RETRAIT !
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
|
@ -171,16 +176,46 @@
|
|||
<div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:20px;line-height:1;text-align:left;color:black;">
|
||||
Bonjour {{ $order->customer->salarie->prenom }} {{ Str::upper($order->customer->salarie->nom) }},
|
||||
<br><br>
|
||||
Votre commande {{ $order->reference }} est disponible
|
||||
Votre commande {{ $order->reference }} est confirmée
|
||||
<br><br>
|
||||
<table style="border-collapse: separate">
|
||||
<thead>
|
||||
<th scope="col" style="width: 40%">Produit</th>
|
||||
<th scope="col">Quantité</th>
|
||||
<th scope="col">Prix kilo TTC</th>
|
||||
<th scope="col">Total TTC</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($order->lines as $line)
|
||||
<tr>
|
||||
<td class="tbl-line">{{ $line->product->name }}</td>
|
||||
<td class="tbl-line">{{ $line->quantity }}</td>
|
||||
<td class="tbl-line">{{ number_format($line->product->priceKgTtc, 2, ',', ' ') }}€</td>
|
||||
<td class="tbl-line">{{ number_format($line->total_ttc, 2, ',', ' ') }}€</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
<br>
|
||||
N'oubliez pas de la récupérer aujourd'hui dans votre point relais :
|
||||
Total estimé de la commande : {{ number_format($order->total, 2, ',', ' ') }}€ TTC
|
||||
<br><br>
|
||||
*Produit vendu au kilo. Le prix sera recalculé en fonction du poids du produit livré lors de la remise de votre commande. Le prix est donc susceptible de varier sur votre facture.
|
||||
<br><br>
|
||||
À retirer le {{ $order->timeslot->day->format('d/m/Y') }} à {{ $order->timeslot->time }}, à l'adresse suivante :
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" style="font-size:0px;padding:10px 25px;word-break:break-word;">
|
||||
<div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:20px;line-height:1;text-align:left;color:black;">
|
||||
<b>Point de retrait {{$magasin->name}}, {{$magasin->address}}, {{$magasin->postcode}} {{$magasin->city}}</b>
|
||||
<b>Mon point de retrait {{$magasin->name}}, {{$magasin->address}}, {{$magasin->postcode}} {{$magasin->city}}</b>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" style="font-size:0px;padding:10px 25px;word-break:break-word;">
|
||||
<div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:20px;line-height:1;text-align:left;color:black;">
|
||||
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.
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue