edition code article inco au create
champs optionnels produit
This commit is contained in:
parent
a42aaf877c
commit
b2eb3a4bc4
5 changed files with 62 additions and 20 deletions
|
|
@ -52,6 +52,9 @@ class ProductsController extends Controller
|
|||
$priceBuy = $request->price_buy;
|
||||
$stock = $request->stock;
|
||||
$reference = $request->reference;
|
||||
$sell_unit = $request->sell_unit;
|
||||
$weight = $request->weight;
|
||||
$weight_unit = $request->weight_unit;
|
||||
$status = $request->status === null ? 0 : 1;
|
||||
$star = $request->star === null ? 0 : 1;
|
||||
$slug = Str::slug($name);
|
||||
|
|
@ -64,9 +67,6 @@ class ProductsController extends Controller
|
|||
config('theme.product_image_maxwidth') . ',max_height=' .
|
||||
config('theme.product_image_maxheight'),
|
||||
'price' => 'required|min:0|numeric',
|
||||
'price_buy' => 'required|min:0|numeric',
|
||||
'stock' => 'required|min:0|numeric',
|
||||
'reference' => 'required|max:255',
|
||||
]);
|
||||
|
||||
// Check si le slug existe déjà dans cette gamme de produits
|
||||
|
|
@ -89,6 +89,9 @@ class ProductsController extends Controller
|
|||
$product->price_buy = $priceBuy;
|
||||
$product->stock = $stock;
|
||||
$product->reference = $reference;
|
||||
$product->sell_unit = $sell_unit;
|
||||
$product->weight = $weight;
|
||||
$product->weight_unit = $weight_unit;
|
||||
$product->slug = $slug;
|
||||
$product->status = $status;
|
||||
$product->star = $star;
|
||||
|
|
@ -182,6 +185,9 @@ class ProductsController extends Controller
|
|||
$priceBuy = $request->price_buy;
|
||||
$stock = $request->stock;
|
||||
$reference = $request->reference;
|
||||
$sell_unit = $request->sell_unit;
|
||||
$weight = $request->weight;
|
||||
$weight_unit = $request->weight_unit;
|
||||
$status = $request->status === null ? 0 : 1;
|
||||
$star = $request->star === null ? 0 : 1;
|
||||
$slug = Str::slug($name);
|
||||
|
|
@ -198,9 +204,6 @@ class ProductsController extends Controller
|
|||
config('theme.product_image_large_maxwidth') . ',max-height=' .
|
||||
config('theme.product_image_large_maxheight'),
|
||||
'price' => 'required|min:0|numeric',
|
||||
'price_buy' => 'required|min:0|numeric',
|
||||
'stock' => 'required|min:0|numeric',
|
||||
'reference' => 'required|max:255',
|
||||
]);
|
||||
|
||||
// Check si le slug existe déjà dans cette gamme de produits
|
||||
|
|
@ -254,6 +257,9 @@ class ProductsController extends Controller
|
|||
$product->price_buy = $priceBuy;
|
||||
$product->stock = $stock;
|
||||
$product->reference = $reference;
|
||||
$product->sell_unit = $sell_unit;
|
||||
$product->weight = $weight;
|
||||
$product->weight_unit = $weight_unit;
|
||||
$product->slug = $slug;
|
||||
$product->status = $status;
|
||||
$product->star = $star;
|
||||
|
|
@ -350,7 +356,9 @@ class ProductsController extends Controller
|
|||
'product_id' => $product_id,
|
||||
]);
|
||||
|
||||
//$foodProduct->no_art = $request->no_art;
|
||||
if(!empty($request->no_art)) {
|
||||
$foodProduct->no_art = $request->no_art;
|
||||
}
|
||||
$foodProduct->ingredients = $request->ingredients;
|
||||
$foodProduct->preparation = $request->preparation;
|
||||
$foodProduct->servings = $request->servings;
|
||||
|
|
@ -395,6 +403,7 @@ class ProductsController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* helper method to create additionnal product info
|
||||
* foodProduct
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class ChangeOptionalFieldsInProductsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('products', function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('stock')->nullable()->change();
|
||||
$table->string('reference')->nullable()->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('products', function (Blueprint $table) {
|
||||
//
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -40,16 +40,16 @@
|
|||
<input type="number" id="price" name="price" min="0" step=".01" class="form-control" value="{{ old('price') }}" required>
|
||||
</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') }}" required>
|
||||
<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') }}">
|
||||
</div>
|
||||
<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') }}" required>
|
||||
<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') }}" required>
|
||||
<label for="reference">Référence</label>
|
||||
<input type="text" id="reference" name="reference" class="form-control" value="{{ old('reference') }}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
|
|
|
|||
|
|
@ -64,16 +64,16 @@
|
|||
<input type="number" id="price" name="price" min="0" step=".01" class="form-control" value="{{$product->price}}" required>
|
||||
</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="{{$product->price_buy}}" required>
|
||||
<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="{{$product->price_buy}}">
|
||||
</div>
|
||||
<div class="form-group col">
|
||||
<label for="stock">Stock *</label>
|
||||
<input type="number" id="stock" name="stock" class="form-control" min="0" value="{{$product->stock}}" required>
|
||||
<label for="stock">Stock</label>
|
||||
<input type="number" id="stock" name="stock" class="form-control" min="0" value="{{$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="{{$product->reference}}" required>
|
||||
<label for="reference">Référence</label>
|
||||
<input type="text" id="reference" name="reference" class="form-control" value="{{$product->reference}}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
<div class="form-row">
|
||||
<div class="form-group col">
|
||||
<label for="no_art">No Article</label>
|
||||
<input type="text" id="no_art" name="no_art" class="form-control" value="{{ old('no_art', $product->foodProduct->no_art) }}" disabled>
|
||||
<input type="text" id="no_art" name="no_art" class="form-control" value="{{ old('no_art', $product->foodProduct->no_art) }}" @if(!empty($product->id)) disabled @endif>
|
||||
</div>
|
||||
<div class="form-group col">
|
||||
<label for="servings">Portions</label>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue