diff --git a/app/Http/Controllers/ProductController.php b/app/Http/Controllers/ProductController.php
index bfcba2f..dacae6b 100644
--- a/app/Http/Controllers/ProductController.php
+++ b/app/Http/Controllers/ProductController.php
@@ -312,20 +312,20 @@ class ProductController extends Controller
public function checkGencode(Request $request)
{
if (
- isset($request->GENCODE) &&
- $request->GENCODE !== null &&
- ctype_digit($request->GENCODE) &&
- strlen($request->GENCODE) > 0
+ isset($request->GENCOD) &&
+ $request->GENCOD !== null &&
+ ctype_digit($request->GENCOD) &&
+ strlen($request->GENCOD) > 0
) {
if (
isset($request->ID) &&
$request->ID !== null &&
- intval($request->GENCODE) === Product::where('id', $request->ID)->firstOrFail()->gencod
+ intval($request->GENCOD) === Product::where('id', $request->ID)->firstOrFail()->gencod
) {
$result = null;
} else {
- $result = in_array(intval($request->GENCODE), Product::pluck('gencod')->toArray()) ?
- Product::orderBy('created_at', 'desc')->where('gencod', intval($request->GENCODE))->first() : null;
+ $result = in_array(intval($request->GENCOD), Product::pluck('gencod')->toArray()) ?
+ Product::orderBy('created_at', 'desc')->where('gencod', intval($request->GENCOD))->first() : null;
}
} else {
$result = null;
diff --git a/app/Http/Requests/Products/StoreProductRequest.php b/app/Http/Requests/Products/StoreProductRequest.php
index 8887dec..aae7317 100644
--- a/app/Http/Requests/Products/StoreProductRequest.php
+++ b/app/Http/Requests/Products/StoreProductRequest.php
@@ -44,6 +44,9 @@ class StoreProductRequest extends FormRequest
'is_tasted' => $this->is_tasted ? true : false,
'origins' => $this->origins ? $this->origins : [],
'claims' => $this->claims ? $this->claims : [],
+ 'picture_alt' => $this->name,
+ 'picture_title' => $this->name,
+ 'certification' => $this->certification == 0 ? null : $this->certification,
]);
$this->mergePicture('picture');
$this->mergeDocuments('docs');
@@ -88,7 +91,7 @@ class StoreProductRequest extends FormRequest
'product_range' => ['required', new Enum(RangeEnum::class)],
'geo_area' => ['required', new Enum(GeoAreaEnum::class)],
'weight' => 'nullable|integer',
- 'pvc' => 'nullable|integer',
+ 'pvc' => 'nullable|decimal:0,2',
'comment' => 'nullable|string|min:15',
'is_tasted' => 'required|boolean',
'tasters_number' => 'nullable|integer',
diff --git a/app/Models/Product.php b/app/Models/Product.php
index d0cb5e7..b47c85b 100644
--- a/app/Models/Product.php
+++ b/app/Models/Product.php
@@ -170,6 +170,7 @@ class Product extends Model
*/
private static function updateSpecifiedClaim(Product $model)
{
+ $check = false;
foreach ($model->claims as $claim) {
$check = (intval($claim['id']) === \App\Enums\Products\ClaimEnum::others->value) ? true : false;
}
@@ -212,14 +213,16 @@ class Product extends Model
*/
public static function deleteOldDocuments(self $model)
{
- foreach ($model->getOriginal('docs') as $document) {
- $originalPath = \ltrim(\urldecode($document), '/');
- if (\strpos($originalPath, 'storage') !== 0) {
- return;
- }
- $originalPath = ToolboxHelper::mbReplace('storage/', '', $originalPath);
- if (Storage::disk('public')->exists($originalPath)) {
- Storage::disk('public')->delete($originalPath);
+ if ($model->getOriginal('docs')) {
+ foreach ($model->getOriginal('docs') as $document) {
+ $originalPath = \ltrim(\urldecode($document), '/');
+ if (\strpos($originalPath, 'storage') !== 0) {
+ return;
+ }
+ $originalPath = ToolboxHelper::mbReplace('storage/', '', $originalPath);
+ if (Storage::disk('public')->exists($originalPath)) {
+ Storage::disk('public')->delete($originalPath);
+ }
}
}
}
diff --git a/database/migrations/2023_09_05_131123_change_products_pvc_from_int_to_decimal.php b/database/migrations/2023_09_05_131123_change_products_pvc_from_int_to_decimal.php
new file mode 100644
index 0000000..367fee5
--- /dev/null
+++ b/database/migrations/2023_09_05_131123_change_products_pvc_from_int_to_decimal.php
@@ -0,0 +1,32 @@
+decimal('pvc', 12, 2)->change();
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ *
+ * @return void
+ */
+ public function down(): void
+ {
+ Schema::table('products', function (Blueprint $table) {
+ $table->integer('pvc')->change();
+ });
+ }
+};
diff --git a/resources/lang/fr/models.php b/resources/lang/fr/models.php
index 6f12cf6..42342b1 100644
--- a/resources/lang/fr/models.php
+++ b/resources/lang/fr/models.php
@@ -3,6 +3,7 @@
return [
'classes' => [
'products' => 'Produits',
+ 'products_monitoring' => 'Veille produit|Veilles produit',
'brands' => 'Marques',
]
];
diff --git a/resources/sass/base/_common.scss b/resources/sass/base/_common.scss
index b666315..a52b4d5 100644
--- a/resources/sass/base/_common.scss
+++ b/resources/sass/base/_common.scss
@@ -3,7 +3,9 @@
}
.bo-image-preview {
- max-height: 60px;
+ // max-height: 60px;
+ width: 180px;
+ height: auto;
}
.text-ellipsis {
diff --git a/resources/ts/components/ButtonMultiPdfComponent.vue b/resources/ts/components/ButtonMultiPdfComponent.vue
index 1c04c62..7fe8fe8 100644
--- a/resources/ts/components/ButtonMultiPdfComponent.vue
+++ b/resources/ts/components/ButtonMultiPdfComponent.vue
@@ -13,17 +13,19 @@
{{ __('Aucune image enregistée') }}
@endif -