Suppression du JS fontawesome en BO, mise à dispo dans public de webfonts pour usage back et front

Unités de ventes strictes (ENUM) et paramètre back office d'application
modification de la directive fmt_sellunit pour prise en compte du paramètre
Gestion en objet date de la date de livraison pour export commande
capacité de rotation daily des logs (pour LOG_CHANNEL=stackProd)
This commit is contained in:
Olivier Legat 2021-07-26 14:09:29 +02:00
parent 0461ef76b9
commit 0799267b6e
14 changed files with 292 additions and 4502 deletions

36
app/Enums/SellUnit.php Normal file
View file

@ -0,0 +1,36 @@
<?php
namespace App\Enums;
use Kwaadpepper\Enum\BaseEnum;
/**
* @method static self pce()
* @method static self kgm()
* @method static self colis()
*/
final class SellUnit extends BaseEnum
{
protected static function values(): array
{
return [
'pce' => 'PCE',
'kgm' => 'KGM',
'colis' => 'COLIS',
];
}
protected static function labels(): array
{
return [
'pce' => __('Pièce'),
'kgm' => __('Kg'),
'colis' => __('Colis'),
];
}
public function __toString(): string
{
return (string)$this->label;
}
}

View file

@ -2,6 +2,7 @@
namespace App\Jobs;
use Illuminate\Support\Carbon;
use App\Models\Order;
use App\Models\OrderLine;
use App\Models\Customers;
@ -15,6 +16,9 @@ class CsvOrderWrite extends CsvJobs
/** @var Order */
private $order;
/**
* en-têtes
*/
private $header = [
"CodeArt",
"Client livré code",
@ -28,6 +32,9 @@ class CsvOrderWrite extends CsvJobs
"Num Cde Client",
];
/**
* correspondance unité d'appro/mode de commande
*/
private $mode_commande = [
"COLIS" => "UEA",
"KGM" => "KGM",
@ -63,23 +70,31 @@ class CsvOrderWrite extends CsvJobs
/** @var Timeslot */
$timeslot = $this->order->timeslot;
//insertion de la ligne d'en-têtes
$csvlines[] = $this->header;
foreach ($orderlines as $orderline) {
$product = $orderline->product;
$unité_commande = $product->sell_unit ?? 'PCE'; //COLIS, KGM, PCE (faut il introduire un nouveau champs type unité de commande)
$code_client = preg_replace('/[^\d]/', '', $customer->salarie->matricule); //matricule rh transmis sans les lettres de l'identifiant windows
//convert to date object
$datLivraison = Carbon::createFromFormat('d/m/Y H:i', $timeslot->day . " " . $timeslot->time);
//on enleve un jour pour avoir le produit la veille
$datLivraison = $datLivraison->subDay();
$oneline = [
$product->foodProduct->no_art . ".000", //manque le .000 pcb
$customer->salarie->matricule, //attention matricule a transmettre sans les lettres
$code_client,
$product->reference,
"commande ferme",
$unité_commande,
$this->mode_commande[$unité_commande], //UEA,KGM,UB (respectivement selon le champ précédent)
"000", //pcb
$timeslot->day, //dd/mm/yyyy (attention ça c'est le jour de collecte, peut être qu'il faut livrer un jour avant au point de collecte)
$orderline->quantity, //
$datLivraison->format('d/m/Y'), //dd/mm/yyyy
$orderline->quantity,
$this->order->reference,
];

View file

@ -2,6 +2,7 @@
namespace App\Providers;
use App\Enums\SellUnit;
use App\Models\Range;
use App\Models\Tag;
use App\Models\Setting;
@ -86,7 +87,11 @@ class AppServiceProvider extends ServiceProvider
});
Blade::directive('fmt_sellunit', function ($expression) {
return "<?php if(!empty($expression)) { echo sprintf('/ %s', $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); } ?>";
}
});
Blade::directive('excerpt_product_title', function($expression) {

View file

@ -242,6 +242,7 @@ return [
//Enums
'LogType' => \App\Enums\LogType::class,
'SettingRegisterMode' => \App\Enums\SettingRegisterMode::class,
'SellUnit' => \App\Enums\SellUnit::class,
],
];

View file

@ -41,12 +41,25 @@ return [
'ignore_exceptions' => false,
],
'stackProd' => [
'driver' => 'stack',
'channels' => ['dailyProd'],
'ignore_exceptions' => false,
],
'single' => [
'driver' => 'single',
'path' => storage_path('logs/laravel.log'),
'level' => env('LOG_LEVEL', 'debug'),
],
'dailyProd' => [
'driver' => 'daily',
'path' => storage_path('logs/laravel.log'),
'level' => 'notice',
'days' => 60,
],
'daily' => [
'driver' => 'daily',
'path' => storage_path('logs/laravel.log'),

100
public/b-o/css/app.css vendored
View file

@ -15,7 +15,7 @@
}
.fa-lg{
font-size:1.33333em;
font-size:1.3333333333em;
line-height:0.75em;
vertical-align:-0.0667em;
}
@ -78,7 +78,6 @@
margin-left:2.5em;
padding-left:0;
}
.fa-ul > li{
position:relative;
}
@ -112,7 +111,6 @@
.fab.fa-pull-left{
margin-right:0.3em;
}
.fa.fa-pull-right,
.fas.fa-pull-right,
.far.fa-pull-right,
@ -123,12 +121,12 @@
.fa-spin{
-webkit-animation:fa-spin 2s infinite linear;
animation:fa-spin 2s infinite linear;
animation:fa-spin 2s infinite linear;
}
.fa-pulse{
-webkit-animation:fa-spin 1s infinite steps(8);
animation:fa-spin 1s infinite steps(8);
animation:fa-spin 1s infinite steps(8);
}
@-webkit-keyframes fa-spin{
@ -139,6 +137,7 @@
transform:rotate(360deg);
}
}
@keyframes fa-spin{
0%{
transform:rotate(0deg);
@ -6069,6 +6068,43 @@
position:static;
width:auto;
}
@font-face{
font-family:"Font Awesome 5 Free";
font-style:normal;
font-weight:400;
font-display:block;
src:url("../../webfonts/fa-regular-400.eot");
src:url("../../webfonts/fa-regular-400.eot?#iefix") format("embedded-opentype"), url("../../webfonts/fa-regular-400.woff2") format("woff2"), url("../../webfonts/fa-regular-400.woff") format("woff"), url("../../webfonts/fa-regular-400.ttf") format("truetype"), url("../../webfonts/fa-regular-400.svg#fontawesome") format("svg");
}
.far{
font-family:"Font Awesome 5 Free";
font-weight:400;
}
@font-face{
font-family:"Font Awesome 5 Free";
font-style:normal;
font-weight:900;
font-display:block;
src:url("../../webfonts/fa-solid-900.eot");
src:url("../../webfonts/fa-solid-900.eot?#iefix") format("embedded-opentype"), url("../../webfonts/fa-solid-900.woff2") format("woff2"), url("../../webfonts/fa-solid-900.woff") format("woff"), url("../../webfonts/fa-solid-900.ttf") format("truetype"), url("../../webfonts/fa-solid-900.svg#fontawesome") format("svg");
}
.fa,
.fas{
font-family:"Font Awesome 5 Free";
font-weight:900;
}
@font-face{
font-family:"Font Awesome 5 Brands";
font-style:normal;
font-weight:400;
font-display:block;
src:url("../../webfonts/fa-brands-400.eot");
src:url("../../webfonts/fa-brands-400.eot?#iefix") format("embedded-opentype"), url("../../webfonts/fa-brands-400.woff2") format("woff2"), url("../../webfonts/fa-brands-400.woff") format("woff"), url("../../webfonts/fa-brands-400.ttf") format("truetype"), url("../../webfonts/fa-brands-400.svg#fontawesome") format("svg");
}
.fab{
font-family:"Font Awesome 5 Brands";
font-weight:400;
}
body.compensate-for-scrollbar{
overflow:hidden;
@ -17132,4 +17168,58 @@ body{
max-width:15rem;
overflow:scroll;
overflow-y:auto;
}
.switch{
position:relative;
display:inline-block;
width:60px;
height:34px;
}
.switch input{
opacity:0;
width:0;
height:0;
}
.slider{
position:absolute;
cursor:pointer;
top:0;
left:0;
right:0;
bottom:0;
background-color:#ccc;
transition:0.4s;
}
.slider::before{
position:absolute;
content:"";
height:26px;
width:26px;
left:4px;
bottom:4px;
background-color:white;
transition:0.4s;
}
input:checked + .slider{
background-color:#2196F3;
}
input:focus + .slider{
box-shadow:0 0 1px #2196F3;
}
input:checked + .slider:before{
transform:translateX(26px);
}
.slider.round{
border-radius:34px;
}
.slider.round:before{
border-radius:50%;
}
.inco_data{
height:initial;
}

4486
public/b-o/js/app.js vendored

File diff suppressed because one or more lines are too long

View file

@ -11,7 +11,7 @@ import Popper from 'popper.js'
import tippy, {createSingleton} from 'tippy.js';
//window.Popper = require('popper.js').default;
window.$ = window.jQuery = require('jquery');
require('@fortawesome/fontawesome-free/js/all');
//require('@fortawesome/fontawesome-free/js/all');
require('bootstrap');
window.Popper = Popper;
window.tippy = tippy;

65
resources/sass/_forms.scss vendored Normal file
View file

@ -0,0 +1,65 @@
/* The switch - the box around the slider */
.switch {
position: relative;
display: inline-block;
width: 60px;
height: 34px;
/* Hide default HTML checkbox */
input {
opacity: 0;
width: 0;
height: 0;
}
}
/* The slider */
.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
-webkit-transition: .4s;
transition: .4s;
&::before {
position: absolute;
content: "";
height: 26px;
width: 26px;
left: 4px;
bottom: 4px;
background-color: white;
-webkit-transition: .4s;
transition: .4s;
}
}
input:checked + .slider {
background-color: #2196F3;
}
input:focus + .slider {
box-shadow: 0 0 1px #2196F3;
}
input:checked + .slider:before {
-webkit-transform: translateX(26px);
-ms-transform: translateX(26px);
transform: translateX(26px);
}
/* Rounded sliders */
.slider.round {
border-radius: 34px;
}
.slider.round:before {
border-radius: 50%;
}
.inco_data{
height: initial;
}

View file

@ -2,7 +2,13 @@
@import url('https://fonts.googleapis.com/css?family=Nunito');
//libs
@import "@fortawesome/fontawesome-free";
//@import "@fortawesome/fontawesome-free";
$fa-font-path: "../../webfonts";
// Font-Awesome
@import "@fortawesome/fontawesome-free/scss/fontawesome";
@import "@fortawesome/fontawesome-free/scss/regular";
@import "@fortawesome/fontawesome-free/scss/solid";
@import "@fortawesome/fontawesome-free/scss/brands";
@import "@fancyapps/fancybox/dist/jquery.fancybox";
@import '~tippy.js/dist/tippy.css';
@import '~tippy.js/animations/scale.css';
@ -24,3 +30,4 @@
@import 'dashboard';
@import './smoothdnd.scss';
@import 'forms.scss';

View file

@ -68,7 +68,15 @@
<div class="form-row">
<div class="form-group col">
<label for="sell_unit">Unité de vente</label>
<input type="text" id="sell_unit" name="sell_unit" class="form-control" value="{{ old('sell_unit') }}">
@if (config('bosettings.sell_unit_management') == "strict")
<select class="custom-select col-md-9" id="sell_unit" name="sell_unit">
@foreach (SellUnit::toArray() as $sellunit_type)
<option value="{{$sellunit_type->value}}" @if (old('sell_unit') == $sellunit_type->value)selected @endif>{{$sellunit_type->label}}</option>
@endforeach
</select>
@else
<input type="text" id="sell_unit" name="sell_unit" class="form-control" value="{{ old('sell_unit') }}">
@endif
</div>
<div class="form-group col">
<label for="weight">Poids de l'article</label>

View file

@ -132,7 +132,15 @@
<div class="form-row">
<div class="form-group col">
<label for="sell_unit">Unité de vente</label>
<input type="text" id="sell_unit" name="sell_unit" class="form-control" value="{{ old('sell_unit', $product->sell_unit)}}">
@if (config('bosettings.sell_unit_management') == "strict")
<select class="custom-select col-md-9" id="sell_unit" name="sell_unit">
@foreach (SellUnit::toArray() as $sellunit_type)
<option value="{{$sellunit_type->value}}" @if (old('sell_unit', $product->sell_unit) == $sellunit_type->value)selected @endif>{{$sellunit_type->label}}</option>
@endforeach
</select>
@else
<input type="text" id="sell_unit" name="sell_unit" class="form-control" value="{{ old('sell_unit', $product->sell_unit)}}">
@endif
</div>
<div class="form-group col">
<label for="weight">Poids de l'article</label>

View file

@ -97,6 +97,28 @@
@endif
@endforeach
</div>
<div class="form-group">
Gestion stricte des unités de commande
<span class="tipped"
data-tippy-content="Activer pour limiter les valeurs possibles dans les unités de commandes.
<br/>Il est indispensable de cocher cette case pour normaliser les envois de commande à Regate
<br/>Les valeurs autorisée seront :
<ul>
@foreach(SellUnit::toArray() as $sellunit)
<li>
{{ $sellunit->label }}
</li>
@endforeach
</ul>">
<i class="fas fa-question-circle"></i>
</span>
<div class="form-row">
<label class="col-form-label switch">
<input type="checkbox" name="sell_unit_management" value="strict" @if($settingsToPrint['sell_unit_management'] ?? 0)checked @endif>
<span class="slider round"></span>
</label>
</div>
</div>
</form>
@endsection

12
webpack.mix.js vendored
View file

@ -22,7 +22,11 @@ const mix = require('laravel-mix');
mix.js('resources/js/app.js', 'public/b-o/js')
.sass('resources/sass/app.scss', 'public/b-o/css');
.sass('resources/sass/app.scss', 'public/b-o/css')
.copy(
'node_modules/@fortawesome/fontawesome-free/webfonts',
'public/webfonts'
);
//add front theme mix
mix.js('resources/views/front/'+process.env.APP_THEME+'/js/app.js', 'public/'+process.env.APP_THEME+'/js')
@ -32,8 +36,4 @@ mix.js('resources/views/front/'+process.env.APP_THEME+'/js/app.js', 'public/'+pr
});
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/')
.copy(
'node_modules/@fortawesome/fontawesome-free/webfonts',
'public/'+process.env.APP_THEME+'/webfonts'
);
.copyDirectory('resources/views/front/'+process.env.APP_THEME+'/fonts', 'public/'+process.env.APP_THEME+'/fonts/');