champs unites de commande, de facturation
souplesse du load Inco quand on a récupéré les data d'ailleurs et que les json de valeur nutritionnel sont incomplets.
This commit is contained in:
parent
3cb5cd9736
commit
78be8cceef
12 changed files with 223 additions and 48 deletions
36
app/Enums/InvoicingUnit.php
Normal file
36
app/Enums/InvoicingUnit.php
Normal 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 InvoicingUnit 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;
|
||||
}
|
||||
}
|
||||
36
app/Enums/OrderUnit.php
Normal file
36
app/Enums/OrderUnit.php
Normal 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 OrderUnit 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;
|
||||
}
|
||||
}
|
||||
|
|
@ -260,7 +260,7 @@ class OrdersController extends Controller
|
|||
{
|
||||
$activestep = 3;
|
||||
|
||||
$magasin = Magasin::first();
|
||||
$magasin = Magasin::all(); //first();
|
||||
|
||||
$availCreneaux = array();
|
||||
//plus besoin car chargé par le composant vue.
|
||||
|
|
|
|||
|
|
@ -232,7 +232,9 @@ class ProductsController extends Controller
|
|||
$picture = $request->picture;
|
||||
$picture_large = $request->picture_large;
|
||||
$price = $request->price;
|
||||
$invoicing_unit = $request->invoicing_unit;
|
||||
$priceBuy = $request->price_buy;
|
||||
$order_unit = $request->order_unit;
|
||||
$stock = $request->stock;
|
||||
$reference = $request->reference;
|
||||
$sell_unit = $request->sell_unit;
|
||||
|
|
@ -307,7 +309,9 @@ class ProductsController extends Controller
|
|||
|
||||
$product->description = $description;
|
||||
$product->price = $price;
|
||||
$product->invoicing_unit = $invoicing_unit;
|
||||
$product->price_buy = $priceBuy;
|
||||
$product->order_unit = $order_unit;
|
||||
$product->stock = $stock;
|
||||
$product->reference = $reference;
|
||||
$product->sell_unit = $sell_unit;
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ class CsvOrderWrite extends CsvJobs
|
|||
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)
|
||||
$unité_commande = $product->order_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
|
||||
|
|
|
|||
|
|
@ -243,6 +243,8 @@ return [
|
|||
'LogType' => \App\Enums\LogType::class,
|
||||
'SettingRegisterMode' => \App\Enums\SettingRegisterMode::class,
|
||||
'SellUnit' => \App\Enums\SellUnit::class,
|
||||
'OrderUnit' => \App\Enums\OrderUnit::class,
|
||||
'InvoicingUnit' => \App\Enums\InvoicingUnit::class,
|
||||
],
|
||||
|
||||
];
|
||||
|
|
|
|||
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddRequiredForOrderExportFieldsToProductsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('products', function (Blueprint $table) {
|
||||
//add order_unit
|
||||
$table->string('order_unit')->nullable()->after('sell_unit'); //unité de commande
|
||||
//add invoicing_unit
|
||||
$table->string('invoicing_unit')->nullable()->after('price'); //unité de facturation
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('products', function (Blueprint $table) {
|
||||
$table->dropColumn('order_unit');
|
||||
$table->dropColumn('invoicing_unit');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -138,6 +138,9 @@ return [
|
|||
],
|
||||
'selectedcreneau' => [
|
||||
'required' => 'Vous devez choisir un horaire de retrait pour votre commande.',
|
||||
],
|
||||
'selectedmagasin' => [
|
||||
'required' => 'Vous devez choisir un point de retrait pour votre commande.',
|
||||
]
|
||||
],
|
||||
|
||||
|
|
|
|||
|
|
@ -54,20 +54,40 @@
|
|||
<div class="form-group col"></div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
@if (config('bosettings.regate_orders'))
|
||||
<div class="form-group col">
|
||||
<label for="order_unit">Unité de commande
|
||||
<span class="tipped"
|
||||
data-tippy-content="Unité utilisée lors de la transmission de commande à Regate">
|
||||
<i class="fas fa-question-circle"></i>
|
||||
</span>
|
||||
</label>
|
||||
<select class="custom-select col-md-9" id="order_unit" name="order_unit">
|
||||
@foreach (OrderUnit::toArray() as $orderunit_type)
|
||||
<option value="{{$orderunit_type->value}}" @if (old('order_unit') == $orderunit_type->value)selected @endif>{{$orderunit_type->label}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
@endif
|
||||
<div class="form-group col">
|
||||
<label for="stock">Stock</label>
|
||||
<input type="number" id="stock" name="stock" class="form-control" min="0" value="{{ old('stock') }}">
|
||||
</div>
|
||||
<div class="form-group col">
|
||||
<label for="reference">Référence</label>
|
||||
<input type="text" id="reference" name="reference" class="form-control" value="{{ old('reference') }}">
|
||||
<label for="reference">Référence @if (config('bosettings.regate_orders')) * @endif</label>
|
||||
<input type="text" id="reference" name="reference" class="form-control" value="{{ old('reference') }}" @if (config('bosettings.regate_orders')) required @endif>
|
||||
</div>
|
||||
<div class="form-group col"></div>
|
||||
<div class="form-group col"></div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col">
|
||||
<label for="sell_unit">Unité de vente</label>
|
||||
<label for="sell_unit">Unité de vente
|
||||
<span class="tipped"
|
||||
data-tippy-content="Unité de vente consommateur">
|
||||
<i class="fas fa-question-circle"></i>
|
||||
</span>
|
||||
</label>
|
||||
@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)
|
||||
|
|
|
|||
|
|
@ -103,6 +103,19 @@
|
|||
<label for="price">Prix en € *</label>
|
||||
<input type="number" id="price" name="price" min="0" step=".01" class="form-control" value="{{ old('price', $product->price)}}" required>
|
||||
</div>
|
||||
<div class="form-group col">
|
||||
<label for="invoicing_unit">Unité de facturation
|
||||
<span class="tipped"
|
||||
data-tippy-content="Unité de base permettant d'établir le prix">
|
||||
<i class="fas fa-question-circle"></i>
|
||||
</span>
|
||||
</label>
|
||||
<select class="custom-select col-md-9" id="invoicing_unit" name="invoicing_unit">
|
||||
@foreach (InvoicingUnit::toArray() as $invoicingunit_type)
|
||||
<option value="{{$invoicingunit_type->value}}" @if (old('invoicing_unit', $product->invoicing_unit) == $invoicingunit_type->value)selected @endif>{{$invoicingunit_type->label}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col">
|
||||
<label for="price_buy">Prix d'achat en €</label>
|
||||
<input type="number" id="price_buy" name="price_buy" min="0" step=".01" class="form-control" value="{{ old('price_buy', $product->price_buy)}}">
|
||||
|
|
@ -118,20 +131,40 @@
|
|||
<div class="form-group col"></div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
@if (config('bosettings.regate_orders'))
|
||||
<div class="form-group col">
|
||||
<label for="order_unit">Unité de commande
|
||||
<span class="tipped"
|
||||
data-tippy-content="Unité utilisée lors de la transmission de commande à Regate">
|
||||
<i class="fas fa-question-circle"></i>
|
||||
</span>
|
||||
</label>
|
||||
<select class="custom-select col-md-9" id="order_unit" name="order_unit">
|
||||
@foreach (OrderUnit::toArray() as $orderunit_type)
|
||||
<option value="{{$orderunit_type->value}}" @if (old('order_unit', $product->order_unit) == $orderunit_type->value)selected @endif>{{$orderunit_type->label}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
@endif
|
||||
<div class="form-group col">
|
||||
<label for="stock">Stock</label>
|
||||
<input type="number" id="stock" name="stock" class="form-control" min="0" value="{{ old('stock', $product->stock)}}">
|
||||
</div>
|
||||
<div class="form-group col">
|
||||
<label for="reference">Référence</label>
|
||||
<input type="text" id="reference" name="reference" class="form-control" value="{{ old('reference', $product->reference)}}">
|
||||
<label for="reference">Référence @if (config('bosettings.regate_orders')) * @endif</label>
|
||||
<input type="text" id="reference" name="reference" class="form-control" value="{{ old('reference', $product->reference)}}" @if (config('bosettings.regate_orders')) required @endif>
|
||||
</div>
|
||||
<div class="form-group col"></div>
|
||||
<div class="form-group col"></div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col">
|
||||
<label for="sell_unit">Unité de vente</label>
|
||||
<label for="sell_unit">Unité de vente
|
||||
<span class="tipped"
|
||||
data-tippy-content="Unité de vente consommateur">
|
||||
<i class="fas fa-question-circle"></i>
|
||||
</span>
|
||||
</label>
|
||||
@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)
|
||||
|
|
|
|||
|
|
@ -16,54 +16,54 @@
|
|||
var dataInco = @json($xmlInco);
|
||||
function loadInco() {
|
||||
//map all data
|
||||
$('[name="description"]').val(dataInco['descriptif']);
|
||||
window['descriptionEditor'].setData(dataInco['descriptif']);
|
||||
$('[name="description"]').val(dataInco['descriptif'] ?? '');
|
||||
window['descriptionEditor'].setData(dataInco['descriptif'] ?? '');
|
||||
|
||||
$('[name="ingredients"]').val(dataInco['lst_ing']);
|
||||
window['ingredientsEditor'].setData(dataInco['lst_ing']);
|
||||
$('[name="allergens"]').val(dataInco['lib_allergene']);
|
||||
$('[name="ingredients"]').val(dataInco['lst_ing'] ?? '');
|
||||
window['ingredientsEditor'].setData(dataInco['lst_ing'] ?? '');
|
||||
$('[name="allergens"]').val(dataInco['lib_allergene'] ?? '');
|
||||
|
||||
$('[name="preparation"]').val(dataInco['conseil_prepa']);
|
||||
window['preparationEditor'].setData(dataInco['conseil_prepa']);
|
||||
$('[name="selling_argument"]').val(dataInco['arg_vente']);
|
||||
window['selling_argumentEditor'].setData(dataInco['arg_vente']);
|
||||
$('[name="preparation"]').val(dataInco['conseil_prepa'] ?? '');
|
||||
window['preparationEditor'].setData(dataInco['conseil_prepa'] ?? '');
|
||||
$('[name="selling_argument"]').val(dataInco['arg_vente'] ?? '');
|
||||
window['selling_argumentEditor'].setData(dataInco['arg_vente'] ?? '');
|
||||
|
||||
|
||||
$('[name="servings"]').val(dataInco['nb_portion']); // problem les types de correspondent pas numeric = string (exemple this->nb_portion = '1/2')
|
||||
$('[name="servings"]').val(dataInco['nb_portion'] ?? ''); // problem les types de correspondent pas numeric = string (exemple this->nb_portion = '1/2')
|
||||
|
||||
$('[name="nv_ref_weight_g"]').val(dataInco['nutritional_values']['taille_ref']);
|
||||
$('[name="nv_kj"]').val(dataInco['nutritional_values']['val_energ_kj_r']); //Energie Kj
|
||||
$('[name="nv_kcal"]').val(dataInco['nutritional_values']['val_energ_kcal_r']); //Energie Kcal
|
||||
$('[name="nv_fat_g"]').val(dataInco['nutritional_values']['mat_grass_r']); //graisses
|
||||
$('[name="nv_sat_fat_g"]').val(dataInco['nutritional_values']['ags_r']); //dont acides gras saturés
|
||||
$('[name="nv_carb_g"]').val(dataInco['nutritional_values']['glucides_r']); //Glucides
|
||||
$('[name="nv_sugar_g"]').val(dataInco['nutritional_values']['sucre_r']); //dont sucres
|
||||
$('[name="nv_fiber_g"]').val(dataInco['nutritional_values']['fib_alim_r']); //fibres alimentaires
|
||||
$('[name="nv_protein_g"]').val(dataInco['nutritional_values']['proteine_r']); //protéines
|
||||
$('[name="nv_salt_g"]').val(dataInco['nutritional_values']['sel_r']); //sel
|
||||
$('[name="nv_ref_weight_g"]').val(dataInco['nutritional_values']['taille_ref'] ?? '');
|
||||
$('[name="nv_kj"]').val(dataInco['nutritional_values']['val_energ_kj_r'] ?? ''); //Energie Kj
|
||||
$('[name="nv_kcal"]').val(dataInco['nutritional_values']['val_energ_kcal_r'] ?? ''); //Energie Kcal
|
||||
$('[name="nv_fat_g"]').val(dataInco['nutritional_values']['mat_grass_r'] ?? ''); //graisses
|
||||
$('[name="nv_sat_fat_g"]').val(dataInco['nutritional_values']['ags_r'] ?? ''); //dont acides gras saturés
|
||||
$('[name="nv_carb_g"]').val(dataInco['nutritional_values']['glucides_r'] ?? ''); //Glucides
|
||||
$('[name="nv_sugar_g"]').val(dataInco['nutritional_values']['sucre_r'] ?? ''); //dont sucres
|
||||
$('[name="nv_fiber_g"]').val(dataInco['nutritional_values']['fib_alim_r'] ?? ''); //fibres alimentaires
|
||||
$('[name="nv_protein_g"]').val(dataInco['nutritional_values']['proteine_r'] ?? ''); //protéines
|
||||
$('[name="nv_salt_g"]').val(dataInco['nutritional_values']['sel_r'] ?? ''); //sel
|
||||
|
||||
$('[name="nv_serving_size_g"]').val(dataInco['nutritional_values']['taille_port']); //taille portion en grammes
|
||||
$('[name="nv_serving_kj"]').val(dataInco['nutritional_values']['val_energ_kj_p']); //Energie Kj
|
||||
$('[name="nv_serving_kcal"]').val(dataInco['nutritional_values']['val_energ_kcal_p']); //Energie Kcal
|
||||
$('[name="nv_serving_fat_g"]').val(dataInco['nutritional_values']['mat_grass_p']); //graisses
|
||||
$('[name="nv_serving_sat_fat_g"]').val(dataInco['nutritional_values']['ags_p']); //dont acides gras saturés
|
||||
$('[name="nv_serving_carb_g"]').val(dataInco['nutritional_values']['glucides_p']); //Glucides
|
||||
$('[name="nv_serving_sugar_g"]').val(dataInco['nutritional_values']['sucre_p']); //dont sucres
|
||||
$('[name="nv_serving_fiber_g"]').val(dataInco['nutritional_values']['fib_alim_p']); //fibres alimentaires
|
||||
$('[name="nv_serving_protein_g"]').val(dataInco['nutritional_values']['proteine_p']); //protéines
|
||||
$('[name="nv_serving_salt_g"]').val(dataInco['nutritional_values']['sel_p']); //sel
|
||||
$('[name="nv_serving_size_g"]').val(dataInco['nutritional_values']['taille_port'] ?? ''); //taille portion en grammes
|
||||
$('[name="nv_serving_kj"]').val(dataInco['nutritional_values']['val_energ_kj_p'] ?? ''); //Energie Kj
|
||||
$('[name="nv_serving_kcal"]').val(dataInco['nutritional_values']['val_energ_kcal_p'] ?? ''); //Energie Kcal
|
||||
$('[name="nv_serving_fat_g"]').val(dataInco['nutritional_values']['mat_grass_p'] ?? ''); //graisses
|
||||
$('[name="nv_serving_sat_fat_g"]').val(dataInco['nutritional_values']['ags_p'] ?? ''); //dont acides gras saturés
|
||||
$('[name="nv_serving_carb_g"]').val(dataInco['nutritional_values']['glucides_p'] ?? ''); //Glucides
|
||||
$('[name="nv_serving_sugar_g"]').val(dataInco['nutritional_values']['sucre_p'] ?? ''); //dont sucres
|
||||
$('[name="nv_serving_fiber_g"]').val(dataInco['nutritional_values']['fib_alim_p'] ?? ''); //fibres alimentaires
|
||||
$('[name="nv_serving_protein_g"]').val(dataInco['nutritional_values']['proteine_p'] ?? ''); //protéines
|
||||
$('[name="nv_serving_salt_g"]').val(dataInco['nutritional_values']['sel_p'] ?? ''); //sel
|
||||
|
||||
$('[name="nv_daily_energy"]').val(dataInco['nutritional_values']['pourcent_apport_ref_kjo_r']); //Energie % recommandé
|
||||
$('[name="nv_daily_fat"]').val(dataInco['nutritional_values']['pourcent_apport_ref_fat_r']); //graisses
|
||||
$('[name="nv_daily_sat_fat"]').val(dataInco['nutritional_values']['pourcent_apport_ref_fatsat_r']); //dont acides gras saturés
|
||||
$('[name="nv_daily_carb"]').val(dataInco['nutritional_values']['pourcent_apport_ref_choval_r']); //Glucides
|
||||
$('[name="nv_daily_sugar"]').val(dataInco['nutritional_values']['pourcent_apport_ref_sugar_r']); //dont sucres
|
||||
$('[name="nv_daily_fiber"]').val(dataInco['nutritional_values']['pourcent_apport_ref_fibtg_r']); //fibres alimentaires
|
||||
$('[name="nv_daily_protein"]').val(dataInco['nutritional_values']['pourcent_apport_ref_pro_r']); //protéines
|
||||
$('[name="nv_daily_salt"]').val(dataInco['nutritional_values']['pourcent_apport_ref_salteq_r']); //sel
|
||||
$('[name="nv_daily_energy"]').val(dataInco['nutritional_values']['pourcent_apport_ref_kjo_r'] ?? ''); //Energie % recommandé
|
||||
$('[name="nv_daily_fat"]').val(dataInco['nutritional_values']['pourcent_apport_ref_fat_r'] ?? ''); //graisses
|
||||
$('[name="nv_daily_sat_fat"]').val(dataInco['nutritional_values']['pourcent_apport_ref_fatsat_r'] ?? ''); //dont acides gras saturés
|
||||
$('[name="nv_daily_carb"]').val(dataInco['nutritional_values']['pourcent_apport_ref_choval_r'] ?? ''); //Glucides
|
||||
$('[name="nv_daily_sugar"]').val(dataInco['nutritional_values']['pourcent_apport_ref_sugar_r'] ?? ''); //dont sucres
|
||||
$('[name="nv_daily_fiber"]').val(dataInco['nutritional_values']['pourcent_apport_ref_fibtg_r'] ?? ''); //fibres alimentaires
|
||||
$('[name="nv_daily_protein"]').val(dataInco['nutritional_values']['pourcent_apport_ref_pro_r'] ?? ''); //protéines
|
||||
$('[name="nv_daily_salt"]').val(dataInco['nutritional_values']['pourcent_apport_ref_salteq_r'] ?? ''); //sel
|
||||
|
||||
//nutriscore
|
||||
$('[name="nutriscore"]').val(dataInco['nutritional_values']['classement']);
|
||||
$('[name="nutriscore"]').val(dataInco['nutritional_values']['classement']) ?? '';
|
||||
|
||||
//then close the box
|
||||
$.fancybox.close();
|
||||
|
|
|
|||
|
|
@ -105,7 +105,8 @@
|
|||
Envoi des commandes à Regate
|
||||
<span class="tipped"
|
||||
data-tippy-content="Activez pour qu'une commande soit automatiquement envoyée à Regate au moment de la validation du créneau de collecte par le client.
|
||||
<br/>Activer ce paramètre va automatiquement activer le paramètre de gestion stricte des unités de vente ci-dessous.">
|
||||
<br/>Activer ce paramètre va rendre obligatoire la saisie de la référence (EAN13) dans les fiches produits.
|
||||
<br/>Activer ce paramètre va rendre obligatoire la saisie de l'unité de commande dans les fiches produits.">
|
||||
<i class="fas fa-question-circle"></i>
|
||||
</span>
|
||||
<div class="form-row">
|
||||
|
|
@ -152,6 +153,8 @@
|
|||
</div>
|
||||
@endsection
|
||||
|
||||
{{-- devenu inutile puisque le swicth envoi de commande active en fait le champs order_unit, et rend oligatoire le champ reference
|
||||
mais le champs sell unit reste un champs d'uvc qui peut prendre d'autres formes.
|
||||
@section('scripts')
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
|
|
@ -190,3 +193,4 @@
|
|||
});
|
||||
</script>
|
||||
@endsection
|
||||
--}}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue