Fixed some requests from the provided excel document

This commit is contained in:
Noah Lancien 2023-09-05 15:28:55 +02:00
parent 97623ce240
commit 8a3058e7bc
28 changed files with 283 additions and 210 deletions

View file

@ -312,20 +312,20 @@ class ProductController extends Controller
public function checkGencode(Request $request) public function checkGencode(Request $request)
{ {
if ( if (
isset($request->GENCODE) && isset($request->GENCOD) &&
$request->GENCODE !== null && $request->GENCOD !== null &&
ctype_digit($request->GENCODE) && ctype_digit($request->GENCOD) &&
strlen($request->GENCODE) > 0 strlen($request->GENCOD) > 0
) { ) {
if ( if (
isset($request->ID) && isset($request->ID) &&
$request->ID !== null && $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; $result = null;
} else { } else {
$result = in_array(intval($request->GENCODE), Product::pluck('gencod')->toArray()) ? $result = in_array(intval($request->GENCOD), Product::pluck('gencod')->toArray()) ?
Product::orderBy('created_at', 'desc')->where('gencod', intval($request->GENCODE))->first() : null; Product::orderBy('created_at', 'desc')->where('gencod', intval($request->GENCOD))->first() : null;
} }
} else { } else {
$result = null; $result = null;

View file

@ -44,6 +44,9 @@ class StoreProductRequest extends FormRequest
'is_tasted' => $this->is_tasted ? true : false, 'is_tasted' => $this->is_tasted ? true : false,
'origins' => $this->origins ? $this->origins : [], 'origins' => $this->origins ? $this->origins : [],
'claims' => $this->claims ? $this->claims : [], 'claims' => $this->claims ? $this->claims : [],
'picture_alt' => $this->name,
'picture_title' => $this->name,
'certification' => $this->certification == 0 ? null : $this->certification,
]); ]);
$this->mergePicture('picture'); $this->mergePicture('picture');
$this->mergeDocuments('docs'); $this->mergeDocuments('docs');
@ -88,7 +91,7 @@ class StoreProductRequest extends FormRequest
'product_range' => ['required', new Enum(RangeEnum::class)], 'product_range' => ['required', new Enum(RangeEnum::class)],
'geo_area' => ['required', new Enum(GeoAreaEnum::class)], 'geo_area' => ['required', new Enum(GeoAreaEnum::class)],
'weight' => 'nullable|integer', 'weight' => 'nullable|integer',
'pvc' => 'nullable|integer', 'pvc' => 'nullable|decimal:0,2',
'comment' => 'nullable|string|min:15', 'comment' => 'nullable|string|min:15',
'is_tasted' => 'required|boolean', 'is_tasted' => 'required|boolean',
'tasters_number' => 'nullable|integer', 'tasters_number' => 'nullable|integer',

View file

@ -170,6 +170,7 @@ class Product extends Model
*/ */
private static function updateSpecifiedClaim(Product $model) private static function updateSpecifiedClaim(Product $model)
{ {
$check = false;
foreach ($model->claims as $claim) { foreach ($model->claims as $claim) {
$check = (intval($claim['id']) === \App\Enums\Products\ClaimEnum::others->value) ? true : false; $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) public static function deleteOldDocuments(self $model)
{ {
foreach ($model->getOriginal('docs') as $document) { if ($model->getOriginal('docs')) {
$originalPath = \ltrim(\urldecode($document), '/'); foreach ($model->getOriginal('docs') as $document) {
if (\strpos($originalPath, 'storage') !== 0) { $originalPath = \ltrim(\urldecode($document), '/');
return; if (\strpos($originalPath, 'storage') !== 0) {
} return;
$originalPath = ToolboxHelper::mbReplace('storage/', '', $originalPath); }
if (Storage::disk('public')->exists($originalPath)) { $originalPath = ToolboxHelper::mbReplace('storage/', '', $originalPath);
Storage::disk('public')->delete($originalPath); if (Storage::disk('public')->exists($originalPath)) {
Storage::disk('public')->delete($originalPath);
}
} }
} }
} }

View file

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up(): void
{
Schema::table('products', function (Blueprint $table) {
$table->decimal('pvc', 12, 2)->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down(): void
{
Schema::table('products', function (Blueprint $table) {
$table->integer('pvc')->change();
});
}
};

View file

@ -3,6 +3,7 @@
return [ return [
'classes' => [ 'classes' => [
'products' => 'Produits', 'products' => 'Produits',
'products_monitoring' => 'Veille produit|Veilles produit',
'brands' => 'Marques', 'brands' => 'Marques',
] ]
]; ];

View file

@ -3,7 +3,9 @@
} }
.bo-image-preview { .bo-image-preview {
max-height: 60px; // max-height: 60px;
width: 180px;
height: auto;
} }
.text-ellipsis { .text-ellipsis {

View file

@ -13,17 +13,19 @@
</template> </template>
<template v-else> <template v-else>
<FontAwesomeIcon icon="fa-solid fa-plus" /> <FontAwesomeIcon icon="fa-solid fa-plus" />
&nbsp;
<FontAwesomeIcon icon="fa-solid fa-file-pdf" />
</template> </template>
</button> </button>
</div> </div>
</template> </template>
<script lang="ts"> <script lang="ts">
import { defineComponent } from "vue";
import trans from "./../modules/trans";
import route from "./../modules/route";
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome"; import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
import Tooltip from "bootstrap/js/dist/tooltip"; import Tooltip from "bootstrap/js/dist/tooltip";
import { defineComponent } from "vue";
import route from "./../modules/route";
import trans from "./../modules/trans";
export default defineComponent({ export default defineComponent({
mixins: [trans, route], mixins: [trans, route],

View file

@ -111,7 +111,7 @@
</label> </label>
<img <img
v-if="intValue" v-if="intValue"
class="img-fluid" class="img-fluid img-preview"
:src="intValue" :src="intValue"
:alt="__('Image placeholder')" :alt="__('Image placeholder')"
:aria-describedby="`PreviewHelp${intId}`" :aria-describedby="`PreviewHelp${intId}`"
@ -400,10 +400,10 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { defineComponent } from "vue";
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome"; import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
import Cropper from "cropperjs";
import { Tooltip } from "bootstrap"; import { Tooltip } from "bootstrap";
import Cropper from "cropperjs";
import { defineComponent } from "vue";
import trans from "./../modules/trans"; import trans from "./../modules/trans";
const UNITS = [ const UNITS = [
@ -952,6 +952,10 @@ export default defineComponent({
transform: translateX(-50%) translateY(-50%); transform: translateX(-50%) translateY(-50%);
} }
} }
.img-preview {
width: 180px;
height: auto;
}
.right-aligned { .right-aligned {
overflow: hidden !important; overflow: hidden !important;
direction: ltr !important; direction: ltr !important;

View file

@ -53,7 +53,7 @@
class="col-form-label" class="col-form-label"
for="commentEvaluation" for="commentEvaluation"
> >
<b>{{ __("Évaluation du produit") }} *</b> <b>{{ __("Appréciation globale") }} *</b>
</label> </label>
<InputTextAutoComponent <InputTextAutoComponent
:id="'commentEvaluation' + commentIndex" :id="'commentEvaluation' + commentIndex"
@ -77,7 +77,7 @@
> >
{{ {{
__( __(
"Doit détailler l'évaluation du produit (3 caractères minimum, 255 maximum)." "Doit détailler l'appéciation globale (3 caractères minimum, 255 maximum)."
) )
}} }}
</small> </small>
@ -227,9 +227,9 @@
<script lang="ts"> <script lang="ts">
import { defineComponent } from "vue"; import { defineComponent } from "vue";
import InputTextAutoComponent from "./InputTextAutoComponent.vue";
import parseLaravelErrorMessages from "../modules/parseLaravelErrorMessages"; import parseLaravelErrorMessages from "../modules/parseLaravelErrorMessages";
import trans from "../modules/trans"; import trans from "../modules/trans";
import InputTextAutoComponent from "./InputTextAutoComponent.vue";
export default defineComponent({ export default defineComponent({
components: { components: {

View file

@ -44,19 +44,6 @@
:disabled="intValues.length >= intItemLimit[1]" :disabled="intValues.length >= intItemLimit[1]"
readonly readonly
> >
<button
class="btn btn-primary btn-collapse collapsed"
type="button"
:title="__('Rouler/Dérouler la liste des documents')"
data-bs-tooltip="tooltip"
data-bs-toggle="collapse"
data-bs-target="#multiple-documents"
aria-expanded="false"
aria-controls="multiple-documents"
:disabled="!intHasDocuments"
>
<i class="fa fa-arrow-down" />
</button>
<button <button
v-if="intValues.length > intItemLimit[0]" v-if="intValues.length > intItemLimit[0]"
@click.prevent="removeFiles" @click.prevent="removeFiles"
@ -72,9 +59,8 @@
</div> </div>
</div> </div>
<!-- End main buttons --> <!-- End main buttons -->
<!-- Content collapse --> <!-- Documents list -->
<div <div
class="collapse"
id="multiple-documents" id="multiple-documents"
> >
<div class="row w-100 mx-auto my-2"> <div class="row w-100 mx-auto my-2">
@ -211,7 +197,7 @@
</div> </div>
</div> </div>
</div> </div>
<!-- End content collapse --> <!-- End documents list -->
<small <small
:id="`Help${intId}`" :id="`Help${intId}`"
class="form-text text-muted" class="form-text text-muted"
@ -222,8 +208,8 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { defineComponent } from "vue";
import { Tooltip } from "bootstrap"; import { Tooltip } from "bootstrap";
import { defineComponent } from "vue";
import error from "./../modules/parseLaravelErrorMessages"; import error from "./../modules/parseLaravelErrorMessages";
import trans from "./../modules/trans"; import trans from "./../modules/trans";
@ -249,7 +235,6 @@ export default defineComponent({
intValues: string[]; intValues: string[];
intHelper: string; intHelper: string;
intTooltipList: HTMLButtonElement[]; intTooltipList: HTMLButtonElement[];
intBtnCollapse: HTMLButtonElement | null;
intLoopLoadDocuments: number; intLoopLoadDocuments: number;
intViewerLoadDocument: boolean; intViewerLoadDocument: boolean;
intInputDocuments: HTMLInputElement[]; intInputDocuments: HTMLInputElement[];
@ -265,7 +250,6 @@ export default defineComponent({
intOriginalFileName: [], intOriginalFileName: [],
intValues: [], intValues: [],
intHelper: "", intHelper: "",
intBtnCollapse: null,
intTooltipList: [], intTooltipList: [],
intLoopLoadDocuments: 0, intLoopLoadDocuments: 0,
intViewerLoadDocument: false, intViewerLoadDocument: false,
@ -294,9 +278,6 @@ export default defineComponent({
*/ */
initComponent() { initComponent() {
if (this.intValues.length > 0) { if (this.intValues.length > 0) {
this.intBtnCollapse = document.querySelector(
"[data-bs-target=\"#multiple-documents\"]"
);
this.intValues.forEach((element, index) => { this.intValues.forEach((element, index) => {
element.charAt(0) != "/" ? "/".concat(element) : ""; element.charAt(0) != "/" ? "/".concat(element) : "";
this.intValues.splice(index, 1, element.replace(/^\/|^/, "/")); this.intValues.splice(index, 1, element.replace(/^\/|^/, "/"));
@ -462,9 +443,6 @@ export default defineComponent({
this.intLoopLoadDocuments = this.intValues.length; this.intLoopLoadDocuments = this.intValues.length;
this.loadDocuments([].slice.call(el.files)); this.loadDocuments([].slice.call(el.files));
this.intHasDocuments = true; this.intHasDocuments = true;
if (this.intBtnCollapse?.classList.contains("collapsed")) {
this.intBtnCollapse?.click();
}
}, },
/** /**
* Update inputs file. * Update inputs file.

View file

@ -12,13 +12,17 @@
class="form-select source-select" class="form-select source-select"
:name="intName" :name="intName"
:aria-describedby="`${intId}Help`" :aria-describedby="`${intId}Help`"
@change="setSelectedValue()" @change="setSelectedValue(0)"
> >
<option
:value="null"
:selected="intSelectedValue === 0"
/>
<option <option
v-for="(itemEnum, indexEnum) in intSourceEnum" v-for="(itemEnum, indexEnum) in intSourceEnum"
:key="indexEnum" :key="indexEnum"
:value="itemEnum.value" :value="itemEnum.value"
:selected="itemEnum.value === intModel?.source" :selected="itemEnum.value === intModel?.source || itemEnum.value === intSelectedValue "
> >
{{ itemEnum.label }} {{ itemEnum.label }}
</option> </option>
@ -40,9 +44,9 @@
class="form-control" class="form-control"
name="catalogue" name="catalogue"
type="text" type="text"
placeholder="Nom du catalogue" placeholder=""
list="productsCatalog" list="productsCatalog"
:value="intModel?.catalogue" :value="intModel?.catalogue ?? intOldDetails"
> >
<datalist id="productsCatalog"> <datalist id="productsCatalog">
<option <option
@ -75,9 +79,9 @@
class="form-control" class="form-control"
name="shop" name="shop"
type="text" type="text"
placeholder="Nom du magasin" placeholder=""
list="productsShop" list="productsShop"
:value="intModel?.shop" :value="intModel?.shop ?? intOldDetails"
> >
<datalist id="productsShop"> <datalist id="productsShop">
<option <option
@ -110,9 +114,9 @@
class="form-control" class="form-control"
name="fair" name="fair"
type="text" type="text"
placeholder="Nom du salon" placeholder=""
list="productsFair" list="productsFair"
:value="intModel?.fair" :value="intModel?.fair ?? intOldDetails"
> >
<datalist id="productsFair"> <datalist id="productsFair">
<option <option
@ -151,7 +155,9 @@ export default defineComponent({
this.intProductsCatalog = data.productsCatalog; this.intProductsCatalog = data.productsCatalog;
this.intSourceEnum = data.sourceEnum; this.intSourceEnum = data.sourceEnum;
this.intHelper = data.helper; this.intHelper = data.helper;
this.setSelectedValue(); this.intSelectedValue = data.oldValue;
this.intOldDetails = data.oldDetails;
this.setSelectedValue(data.oldValue);
}, },
data(): { data(): {
intId: string; intId: string;
@ -167,6 +173,7 @@ export default defineComponent({
intSourceMagazin: boolean; intSourceMagazin: boolean;
intSourceShow: boolean; intSourceShow: boolean;
intHelper: string; intHelper: string;
intOldDetails: string;
} { } {
return { return {
intId: "", intId: "",
@ -182,18 +189,20 @@ export default defineComponent({
intSourceMagazin: false, intSourceMagazin: false,
intSourceShow: false, intSourceShow: false,
intHelper: "", intHelper: "",
intOldDetails: "",
}; };
}, },
methods: { methods: {
/** /**
* Set selected source variables. * Set selected source variables.
*/ */
setSelectedValue() { setSelectedValue(oldValue: number) {
this.$nextTick(() => { this.$nextTick(() => {
const select = document.querySelector( const select = document.querySelector(
".source-select" ".source-select"
) as HTMLSelectElement; ) as HTMLSelectElement;
this.intSelectedValue = Number(select.value); this.intSelectedValue = isNaN(Number(select.value)) ? Number(oldValue) : Number(select.value) ;
console.log("là", this.intSelectedValue);
this.updateVue(); this.updateVue();
}); });
}, },

View file

@ -13,7 +13,7 @@
<b>{{ intLabel1 }} {{ intRequired1 ? "*" : "" }}</b> <b>{{ intLabel1 }} {{ intRequired1 ? "*" : "" }}</b>
</label> </label>
<input <input
@click="updateBoolean()" @click="updateBoolean(null)"
class="form-check-input" class="form-check-input"
:name="intName1" :name="intName1"
type="checkbox" type="checkbox"
@ -75,8 +75,8 @@
<script lang="ts"> <script lang="ts">
import { defineComponent } from "vue"; import { defineComponent } from "vue";
import MultipleCommentsComponent from "./MultipleCommentsComponent.vue";
import trans from "../modules/trans"; import trans from "../modules/trans";
import MultipleCommentsComponent from "./MultipleCommentsComponent.vue";
export default defineComponent({ export default defineComponent({
components: { components: {
@ -149,7 +149,9 @@ export default defineComponent({
? this.intOldModel[this.intName1] ? this.intOldModel[this.intName1]
: false : false
) { ) {
this.updateBoolean(); this.updateBoolean(data.oldCheck);
} else {
this.intIsTasted = data.oldCheck;
} }
this.intCommentModel = this.intCommentModel =
data.commentOldModel.length > 0 data.commentOldModel.length > 0
@ -158,7 +160,8 @@ export default defineComponent({
this.intAllErrors = data.errors; this.intAllErrors = data.errors;
}, },
methods: { methods: {
updateBoolean() { updateBoolean(test:any) {
console.log(test);
this.intIsTasted = this.intIsTasted ? false : true; this.intIsTasted = this.intIsTasted ? false : true;
}, },
}, },

View file

@ -12,7 +12,7 @@
:name="intName" :name="intName"
type="text" type="text"
:value="intValue" :value="intValue"
:placeholder="__('112233445566')" placeholder=""
class="form-control input-gencode" class="form-control input-gencode"
:class="[ :class="[
intResult != undefined ? [intResult ? 'is-invalid' : 'is-valid'] : '', intResult != undefined ? [intResult ? 'is-invalid' : 'is-valid'] : '',
@ -43,9 +43,9 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { defineComponent } from "vue";
import { Tooltip } from "bootstrap";
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome"; import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
import { Tooltip } from "bootstrap";
import { defineComponent } from "vue";
import route from "./../modules/route"; import route from "./../modules/route";
import trans from "./../modules/trans"; import trans from "./../modules/trans";
@ -161,7 +161,7 @@ export default defineComponent({
this.intCode = inputCode.value; this.intCode = inputCode.value;
window.axios window.axios
.post(this.getRouteProductGencode(), { .post(this.getRouteProductGencode(), {
GENCODE: this.intCode, GENCOD: this.intCode,
ID: this.intModel?.id, ID: this.intModel?.id,
}) })
.then((reponse) => { .then((reponse) => {

View file

@ -1,42 +1,43 @@
import { dom, library, config } from "~/@fortawesome/fontawesome-svg-core"; import { config, dom, library } from "~/@fortawesome/fontawesome-svg-core";
import { import {
faEraser,
faArrowLeftLong,
faPlus,
faMinus,
faTrash,
faEye,
faFolderOpen,
faCrop,
faQuestionCircle,
faCheck,
faUndoAlt,
faRedoAlt,
faSyncAlt,
faSearchPlus,
faSearchMinus,
faArrowLeft,
faArrowRight,
faArrowUp,
faArrowDown,
faArrowsAltH,
faArrowsAltV,
faWandMagic,
faPencil,
faTimes,
faBackspace,
faSearch,
faArrowRightFromBracket,
faArrowAltCircleDown, faArrowAltCircleDown,
faArrowAltCircleUp, faArrowAltCircleUp,
faQuestion, faArrowDown,
faXmark, faArrowLeft,
faArrowLeftLong,
faArrowRight,
faArrowRightFromBracket,
faArrowUp,
faArrowsAltH,
faArrowsAltV,
faBackspace,
faCheck,
faCopy, faCopy,
faFile, faCrop,
faLink,
faPrint,
faImage,
faDownload, faDownload,
faEraser,
faEye,
faFile,
faFilePdf,
faFolderOpen,
faImage,
faLink,
faMinus,
faPencil,
faPlus,
faPrint,
faQuestion,
faQuestionCircle,
faRedoAlt,
faSearch,
faSearchMinus,
faSearchPlus,
faSyncAlt,
faTimes,
faTrash,
faUndoAlt,
faWandMagic,
faXmark,
} from "~/@fortawesome/free-solid-svg-icons"; } from "~/@fortawesome/free-solid-svg-icons";
config.autoReplaceSvg = false; config.autoReplaceSvg = false;
@ -77,5 +78,6 @@ library.add(faLink);
library.add(faPrint); library.add(faPrint);
library.add(faImage); library.add(faImage);
library.add(faDownload); library.add(faDownload);
library.add(faFilePdf);
dom.watch(); dom.watch();

View file

@ -5,12 +5,14 @@
{{-- CONTENT --}} {{-- CONTENT --}}
<table width="100%"> <table width="100%">
<tr> <tr>
@if (isset($product->picture) && !empty($product->picture))
<td class="table-cell-text-center" width="30%"> <td class="table-cell-text-center" width="30%">
@if (isset($product->picture))
<img src="{{ public_path($product->picture) }}" alt="{{ $product->picture_alt }}" alt="{{ $product->picture_title }}"> <img src="{{ public_path($product->picture) }}" alt="{{ $product->picture_alt }}" alt="{{ $product->picture_title }}">
@endif
</td> </td>
<td width="70%"> <td width="70%">
@else
<td width="100%">
@endif
@if (isset($product->brand_id->name)) @if (isset($product->brand_id->name))
<h2><strong>{{ __('Marque du produit : ') }}</strong><span>{{ $product->brand_id->name }}</span></h2> <h2><strong>{{ __('Marque du produit : ') }}</strong><span>{{ $product->brand_id->name }}</span></h2>
@endif @endif
@ -21,10 +23,10 @@
<p><strong>{{ __('Certification : ') }}</strong>{{ $product->certification }}</p> <p><strong>{{ __('Certification : ') }}</strong>{{ $product->certification }}</p>
@endif @endif
@if (isset($product->origins)) @if (isset($product->origins))
<p><strong>{{ __('Origines : ') }}</strong>{{ $product->origins }}</p> <p><strong>{{ __('Origines : ') }}</strong>{{ Str::replaceLast(', ', '', $product->origins) }}</p>
@endif @endif
@if (isset($product->claims)) @if (isset($product->claims))
<p><strong>{{ __('Allégations : ') }}</strong>{{ $product->claims }}</p> <p><strong>{{ __('Allégations : ') }}</strong>{{ Str::replaceLast(', ', '', $product->claims) }}</p>
@endif @endif
<table class="table" width="100%"> <table class="table" width="100%">
<tr class="table-header"> <tr class="table-header">
@ -49,11 +51,14 @@
@if (isset($product->pvc)) @if (isset($product->pvc))
<td class="table-cell-text-center">{{ $product->pvc }}€</td> <td class="table-cell-text-center">{{ $product->pvc }}€</td>
@endif @endif
<td class="table-cell-text-center">--,--€</td> @php
$priceKg = 1000 * $product->pvc / $product->weight;
@endphp
<td class="table-cell-text-center">{{ number_format(round($priceKg, 2), 2, ',', ' ') }}€</td>
</tr> </tr>
</table> </table>
@if (isset($product->productKeywords)) @if (isset($product->productKeywords))
<p><strong>{{ __('Tendances identifiées : ') }}</strong>{{ $product->productKeywords }}</p> <p><strong>{{ __('Tendances identifiées : ') }}</strong>{{ Str::replaceLast(', ', '', $product->productKeywords) }}</p>
@endif @endif
@if (isset($product->distribution_network)) @if (isset($product->distribution_network))
<p><strong>{{ __('Réseau de distribution : ') }}</strong>{{ $product->distribution_network }}</p> <p><strong>{{ __('Réseau de distribution : ') }}</strong>{{ $product->distribution_network }}</p>
@ -103,7 +108,7 @@
</td> </td>
@endif @endif
@if (isset($product->source)) @if (isset($product->source))
<td class="table-cell-text-center" width="50%"> <td class="table-cell-text-start" width="50%">
<p><strong>{{ __('Vu le : ') }}</strong>{{ $product->saw_at }}</p> <p><strong>{{ __('Vu le : ') }}</strong>{{ $product->saw_at }}</p>
<p><strong>{{ __('Lieu : ') }}</strong>{{ $product->source }},&nbsp;{{ $product->fair }}{{ $product->shop }}{{ $product->catalogue }}</p> <p><strong>{{ __('Lieu : ') }}</strong>{{ $product->source }},&nbsp;{{ $product->fair }}{{ $product->shop }}{{ $product->catalogue }}</p>
<p><strong>{{ __('Par : ') }}</strong>{{ $product->user_id->firstname }}&nbsp;{{ $product->user_id->lastname }}</p> <p><strong>{{ __('Par : ') }}</strong>{{ $product->user_id->firstname }}&nbsp;{{ $product->user_id->lastname }}</p>

View file

@ -33,7 +33,6 @@
h2 { h2 {
font-weight: lighter; font-weight: lighter;
text-transform: uppercase;
margin-bottom: 1rem; margin-bottom: 1rem;
} }
@ -61,11 +60,11 @@
} }
.table-header { .table-header {
background-color: black; background-color: #FFFFFF;
} }
.table-header td { .table-header td {
color: white; color: #000000;
} }
.table-body td { .table-body td {
@ -75,6 +74,10 @@
.table-cell-text-center { .table-cell-text-center {
text-align: center; text-align: center;
} }
.table-cell-text-start {
text-align: start;
}
</style> </style>
</head> </head>

View file

@ -15,10 +15,10 @@
<li> <li>
<a class="dropdown-item @if(request()->routeIs('products.*')) active @endif" <a class="dropdown-item @if(request()->routeIs('products.*')) active @endif"
href="{{ route('products.index') }}" href="{{ route('products.index') }}"
title="{{ __('Administrer les :model', ['model' => __('models.classes.products')]) }}" title="{{ __('Administrer les :model', ['model' => trans_choice('models.classes.products_monitoring', 2)]) }}"
data-bs="tooltip" data-bs="tooltip"
data-bs-placement="right"> data-bs-placement="right">
{{ __('models.classes.products') }} {{ trans_choice('models.classes.products_monitoring', 2) }}
</a> </a>
</li> </li>
</ul> </ul>

View file

@ -12,7 +12,6 @@ $ignore = (isset($ignore) and is_array($ignore)) ? $ignore : [];
@endphp @endphp
{{-- NO Sort for order column --}} {{-- NO Sort for order column --}}
@if($col === 'order' or in_array($col, $ignore)) @if($col === 'order' or in_array($col, $ignore))
@if(!$noOrder or $rst)
@if ($col === 'multi_pdf') @if ($col === 'multi_pdf')
<th scope="col" class="text-center @if(isset($mobileHide) and is_array($mobileHide) and in_array($col, $mobileHide)) d-none d-md-table-cell @endif"> <th scope="col" class="text-center @if(isset($mobileHide) and is_array($mobileHide) and in_array($col, $mobileHide)) d-none d-md-table-cell @endif">
<span>{{ $colname }}</span> <span>{{ $colname }}</span>
@ -35,7 +34,6 @@ $ignore = (isset($ignore) and is_array($ignore)) ? $ignore : [];
<span>{{ $colname }}</span> <span>{{ $colname }}</span>
</th> </th>
@endif @endif
@endif
@continue @continue
@endif @endif
<th scope="col" class="text-center @if(isset($mobileHide) and is_array($mobileHide) and in_array($col, $mobileHide)) d-none d-md-table-cell @endif"> <th scope="col" class="text-center @if(isset($mobileHide) and is_array($mobileHide) and in_array($col, $mobileHide)) d-none d-md-table-cell @endif">

View file

@ -16,14 +16,14 @@
<div class="card-body"> <div class="card-body">
<div class="d-flex flex-column flex-lg-row justify-content-between align-items-center"> <div class="d-flex flex-column flex-lg-row justify-content-between align-items-center">
<div class="text-center text-lg-start pb-2 p-lg-0"> <div class="text-center text-lg-start pb-2 p-lg-0">
<h5 class="card-title">{{ __('models.classes.products') }}</h5> <h5 class="card-title">{{ trans_choice('models.classes.products_monitoring', 2) }}</h5>
<p class="card-text text-muted fst-italic">{{ __('- accéder à l\'ensemble des produits enregistrés') }}</p> <p class="card-text text-muted fst-italic">{{ __('- accéder à l\'ensemble des produits enregistrés') }}</p>
</div> </div>
<a href="{{ route('products.index') }}" <a href="{{ route('products.index') }}"
class="btn btn-primary" class="btn btn-primary"
title="{{ __('Accéder à la liste des :model', ['model' => __('models.classes.products')]) }}" title="{{ __('Accéder à la liste des :model', ['model' => trans_choice('models.classes.products_monitoring', 2)]) }}"
data-bs="tooltip"> data-bs="tooltip">
{{ __('Voir la liste') }} {{ __('Consulter/Insérer une :model', ['model' => trans_choice('models.classes.products_monitoring', 1)]) }}
</a> </a>
</div> </div>
</div> </div>

View file

@ -1,6 +1,6 @@
@extends('layout') @extends('layout')
@section('title', sprintf('%s - %s', __('models.classes.products'), Str::ucfirst(__('création')))) @section('title', sprintf('%s - %s', trans_choice('models.classes.products_monitoring', 1), Str::ucfirst(__('création'))))
@section('description', __('Création d\'un produit')) @section('description', __('Création d\'un produit'))
@section('breadcrumb', 'no') @section('breadcrumb', 'no')
@ -14,17 +14,17 @@
class="btn btn-primary text-decoration-none m-0" class="btn btn-primary text-decoration-none m-0"
data-bs="tooltip" data-bs="tooltip"
data-bs-placement="top" data-bs-placement="top"
title="{{ __('Retourner sur la liste des :model', ['model' => __('models.classes.products')]) }}" title="{{ __('Retourner sur la liste des :model', ['model' => trans_choice('models.classes.products_monitoring', 2)]) }}"
data-bs="tooltip"> data-bs="tooltip">
<i class="fa-solid fa-arrow-left"></i> <i class="fa-solid fa-arrow-left"></i>
</a> </a>
<span class="fw-bold">{{ Str::singular(__('models.classes.products')) }}</span>&nbsp;<small class="text-muted">{{ Str::ucfirst(__('création')) }}</small> <span class="fw-bold">{{ trans_choice('models.classes.products_monitoring', 1) }}</span>&nbsp;<small class="text-muted">{{ Str::ucfirst(__('création')) }}</small>
</h1> </h1>
</div> </div>
<div class="col-12 col-md-4 d-flex justify-content-center justify-content-md-end align-items-center"> <div class="col-12 col-md-4 d-flex justify-content-center justify-content-md-end align-items-center">
<button id="formSubmitClone" <button id="formSubmitClone"
class="btn btn-primary pull-end" class="btn btn-success pull-end"
title="{{ __('Sauvegarder ce :model', ['model' => Str::singular(__('models.classes.products'))]) }}" title="{{ __('Sauvegarder cette :model', ['model' => trans_choice('models.classes.products_monitoring', 1)]) }}"
data-bs="tooltip"> data-bs="tooltip">
{{ __('Sauvegarder') }} {{ __('Sauvegarder') }}
</button> </button>
@ -39,8 +39,8 @@
<div class="col text-center"> <div class="col text-center">
<button id="formSubmit" <button id="formSubmit"
type="submit" type="submit"
class="btn btn-primary" class="btn btn-success"
title="{{ __('Sauvegarder ce :model', ['model' => Str::singular(__('models.classes.products'))]) }}" title="{{ __('Sauvegarder cette :model', ['model' => trans_choice('models.classes.products_monitoring', 1)]) }}"
data-bs="tooltip">{{ __('Sauvegarder') }}</button> data-bs="tooltip">{{ __('Sauvegarder') }}</button>
</div> </div>
</div> </div>

View file

@ -1,6 +1,6 @@
@extends('layout') @extends('layout')
@section('title', sprintf('%s - %s', __('models.classes.products'), Str::ucfirst(__('édition')))) @section('title', sprintf('%s - %s', trans_choice('models.classes.products_monitoring', 1), Str::ucfirst(__('édition'))))
@section('description', __('Édition d\'un produit')) @section('description', __('Édition d\'un produit'))
@section('breadcrumb', 'no') @section('breadcrumb', 'no')
@ -14,11 +14,11 @@
class="btn btn-primary text-decoration-none m-0" class="btn btn-primary text-decoration-none m-0"
data-bs="tooltip" data-bs="tooltip"
data-bs-placement="top" data-bs-placement="top"
title="{{ __('Retourner sur la liste des :model', ['model' => __('models.classes.products')]) }}" title="{{ __('Retourner sur la liste des :model', ['model' => trans_choice('models.classes.products_monitoring', 2)]) }}"
data-bs="tooltip"> data-bs="tooltip">
<i class="fa-solid fa-arrow-left"></i> <i class="fa-solid fa-arrow-left"></i>
</a> </a>
<span class="fw-bold">{{ Str::singular(__('models.classes.products')) }}</span>&nbsp;<small class="text-muted">{{ Str::ucfirst(__('édition')) }}</small> <span class="fw-bold">{{ trans_choice('models.classes.products_monitoring', 1) }}</span>&nbsp;<small class="text-muted">{{ Str::ucfirst(__('édition')) }}</small>
</h1> </h1>
</div> </div>
<div class="col-12 col-md-4 d-flex justify-content-center justify-content-md-end align-items-center"> <div class="col-12 col-md-4 d-flex justify-content-center justify-content-md-end align-items-center">
@ -28,13 +28,13 @@
<div class="btn-group" role="group"> <div class="btn-group" role="group">
<button id="formSubmitClone" <button id="formSubmitClone"
type="button" type="button"
class="btn btn-primary pull-end" class="btn btn-success pull-end"
title="{{ __('Sauvegarder ce :model', ['model' => Str::singular(__('models.classes.products'))]) }}" title="{{ __('Sauvegarder cette :model', ['model' => trans_choice('models.classes.products_monitoring', 1)]) }}"
data-bs="tooltip"> data-bs="tooltip">
{{ __('Sauvegarder') }} {{ __('Sauvegarder') }}
</button> </button>
<button class="btn btn-danger" <button class="btn btn-danger"
title="{{ __('Supprimer ce :model', ['model' => Str::singular(__('models.classes.products'))]) }}" title="{{ __('Supprimer cette :model', ['model' => trans_choice('models.classes.products_monitoring', 1)]) }}"
data-bs="tooltip"> data-bs="tooltip">
<i class="fa-solid fa-trash"></i> <i class="fa-solid fa-trash"></i>
</button> </button>
@ -52,8 +52,8 @@
<div class="col text-center"> <div class="col text-center">
<button id="formSubmit" <button id="formSubmit"
type="submit" type="submit"
class="btn btn-primary" class="btn btn-success"
title="{{ __('Sauvegarder ce :model', ['model' => Str::singular(__('models.classes.products'))]) }}" title="{{ __('Sauvegarder cette :model', ['model' => trans_choice('models.classes.products_monitoring', 1)]) }}"
data-bs="tooltip"> data-bs="tooltip">
{{ __('Sauvegarder') }} {{ __('Sauvegarder') }}
</button> </button>

View file

@ -2,16 +2,17 @@
{{-- TITLE --}} {{-- TITLE --}}
<div class="col-12 col-md-6 mb-3"> <div class="col-12 col-md-6 mb-3">
<fieldset class="border h-100 bg-white p-3"> <fieldset class="border h-100 bg-white p-3">
<legend>{{ __('Titre') }}</legend> <legend>{{ __('Nom') }}</legend>
<div class="row"> <div class="row">
<div class="col-12 mb-3"> <div class="col-12 mb-3">
@include('partials.inputs.varchar', [ @include('partials.inputs.varchar', [
'id' => 'productName', 'id' => 'productName',
'label' => __('Titre du :model', ['model' => Str::singular(__('models.classes.products'))]), 'label' => __('Nom du :model', ['model' => Str::singular(__('models.classes.products'))]),
'hasWordCounter' => true, 'hasWordCounter' => true,
'name' => 'name', 'name' => 'name',
'required' => true, 'required' => true,
'model' => $productModel ?? null, 'model' => $productModel ?? null,
'placeholder' => '',
'helper' => __('Doit décrire précisément le produit (3 caractères minimum, 255 maximum).'), 'helper' => __('Doit décrire précisément le produit (3 caractères minimum, 255 maximum).'),
]) ])
</div> </div>
@ -30,7 +31,7 @@
'name' => 'brand_id', 'name' => 'brand_id',
'model' => $productModel ?? null, 'model' => $productModel ?? null,
'associatedModels' => $brands, 'associatedModels' => $brands,
'helper' => trans('Selectionnez un(e) :model parmis la liste.', ['model' => Str::singular(trans('models.classes.brands'))]), 'helper' => trans('Selectionnez un(e) :model parmi la liste.', ['model' => Str::singular(trans('models.classes.brands'))]),
]) ])
</div> </div>
</div> </div>
@ -43,24 +44,26 @@
@php @php
$data = [ $data = [
'id' => 'productSource', 'id' => 'productSource',
'label' => __('Source associé(e)'), 'label' => __('Source'),
'name' => 'source', 'name' => 'source',
'model' => $productModel ?? null, 'model' => $productModel ?? null,
'sourceEnum' => \App\Enums\Products\SourceEnum::toArray(), 'sourceEnum' => \App\Enums\Products\SourceEnum::toArray(),
'productsFair' => $productsFair, 'productsFair' => $productsFair,
'productsShop' => $productsShop, 'productsShop' => $productsShop,
'productsCatalog' => $productsCatalog, 'productsCatalog' => $productsCatalog,
'helper' => __('Selectionnez un(e) Source maximum parmis la liste.') 'oldValue' => old('source') ?? $productModel->source ?? 0,
'oldDetails' => old('shop', old('fair', old('catalogue'))) ?? '',
'helper' => __('Selectionnez un(e) Source maximum parmi la liste.')
]; ];
@endphp @endphp
<div class="source-inputs" data-json='@json($data)'></div> <div class="source-inputs" data-json='@json($data)'></div>
@include('modules.input-error', ['inputName' => 'source']) @include('modules.input-error', ['inputName' => 'source'])
</fieldset> </fieldset>
</div> </div>
{{-- GENCODE --}} {{-- GENCOD --}}
<div class="col-12 col-md-6 mb-3"> <div class="col-12 col-md-6 mb-3">
<fieldset class="border h-100 bg-white p-3"> <fieldset class="border h-100 bg-white p-3">
<legend>{{ __('GENCODE') }}</legend> <legend>{{ __('GENCOD') }}</legend>
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
@php @php
@ -94,7 +97,7 @@
'name' => 'url', 'name' => 'url',
'required' => false, 'required' => false,
'model' => $productModel ?? null, 'model' => $productModel ?? null,
'placeholder' => __('https://google.com'), 'placeholder' => '',
'helper' => __('Doit être une url valide.'), 'helper' => __('Doit être une url valide.'),
]) ])
</div> </div>
@ -104,32 +107,8 @@
{{-- IMAGE --}} {{-- IMAGE --}}
<div class="col-12 mb-3"> <div class="col-12 mb-3">
<fieldset class="border h-100 bg-white p-3"> <fieldset class="border h-100 bg-white p-3">
<legend>{{ __('Image') }}</legend> <legend>{{ __('Visuel de référence') }}</legend>
<div class="row"> <div class="row">
{{-- PICTURE_ALT --}}
<div class="col-12 col-md-6 mb-3">
@include('partials.inputs.varchar', [
'id' => 'homePart3PictureAlt',
'label' => __('Texte alternatif de :model', ['model' => Str::singular(__('models.classes.products'))]),
'hasWordCounter' => true,
'name' => 'picture_alt',
'required' => true,
'model' => $productModel ?? null,
'helper' => __('Doit décrire votre image pour les moteurs de recherches et les non voyants (5 à 6 mots, minimum 3 caractères).'),
])
</div>
{{-- PICTURE_TITLE --}}
<div class="col-12 col-md-6 mb-3">
@include('partials.inputs.varchar', [
'id' => 'homePart3PictureTitle',
'label' => __('Titre de :model', ['model' => Str::singular(__('models.classes.products'))]),
'hasWordCounter' => true,
'name' => 'picture_title',
'required' => true,
'model' => $productModel ?? null,
'helper' => __('Utile pour les utilisateurs, s\'affiche en passant la souris sur l\'image (minimum 3 caractères).'),
])
</div>
<div class="col-12"> <div class="col-12">
@include('partials.inputs.varchar-picture', [ @include('partials.inputs.varchar-picture', [
'id' => 'productImage', 'id' => 'productImage',
@ -148,7 +127,7 @@
{{-- DOCUMENTS --}} {{-- DOCUMENTS --}}
<div class="col-12 mb-3"> <div class="col-12 mb-3">
<fieldset class="border h-100 bg-white p-3"> <fieldset class="border h-100 bg-white p-3">
<legend>{{ __('Documents') }}</legend> <legend>{{ __('Documents complémentaires') }}</legend>
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
@php @php
@ -179,7 +158,7 @@
'model' => $productModel ?? null, 'model' => $productModel ?? null,
'require' => false, 'require' => false,
'associatedModels' => \App\Enums\Products\CertificationEnum::toArray(), 'associatedModels' => \App\Enums\Products\CertificationEnum::toArray(),
'helper' => trans('Selectionnez une Certification parmis la liste.'), 'helper' => trans('Selectionnez une Certification parmi la liste.'),
]) ])
</div> </div>
</div> </div>
@ -188,17 +167,17 @@
{{-- ORIGINS --}} {{-- ORIGINS --}}
<div class="col-12 col-md-6 mb-3"> <div class="col-12 col-md-6 mb-3">
<fieldset class="border h-100 bg-white p-3"> <fieldset class="border h-100 bg-white p-3">
<legend>{{ __('Origines') }}</legend> <legend>{{ __('Origine') }}</legend>
<div class="row"> <div class="row">
@include('partials.inputs.select-multiple-enum', [ @include('partials.inputs.select-multiple-enum', [
'id' => 'productOrigins', 'id' => 'productOrigins',
'label' => __('Origines associées'), 'label' => __('Origine associée'),
'name' => 'origins', 'name' => 'origins',
'itemsSelected' => old('origins', $productModel->origins ?? []), 'itemsSelected' => old('origins', $productModel->origins ?? []),
'itemsList' => collect(\App\Enums\Products\OriginEnum::toArray())->values(), 'itemsList' => collect(\App\Enums\Products\OriginEnum::toArray())->values(),
'itemLimit' => [0, count(\App\Enums\Products\OriginEnum::toArray())], 'itemLimit' => [0, count(\App\Enums\Products\OriginEnum::toArray())],
'placeholder' => __('Recherchez une Origine a associer.'), 'placeholder' => '',
'helper' => __('Les Origines associées au produit.'), 'helper' => __('L\'origine associée au produit.'),
'require' => false, 'require' => false,
]) ])
</div> </div>
@ -219,13 +198,13 @@
'showSpecificItem' => [ 'showSpecificItem' => [
'name' => 'specified_claim', 'name' => 'specified_claim',
'label' => 'Précision de l\'allégation', 'label' => 'Précision de l\'allégation',
'placeholder' => 'Sans sucre ajouté', 'placeholder' => '',
'value' => $productModel->specified_claim ?? null, 'value' => old('specified_claim', $productModel->claims ?? null),
'showId' => 99, 'showId' => 99,
'helper' => __('Doit décrire précisément l\'allégation (3 caractères minimum, 255 maximum).') 'helper' => __('Doit décrire précisément l\'allégation (3 caractères minimum, 255 maximum).')
], ],
'model' => $productModel ?? null, 'model' => $productModel ?? null,
'placeholder' => __('Recherchez une Allégation a associer.'), 'placeholder' => '',
'require' => false, 'require' => false,
'helper' => __('Les Allégations associées au produit.'), 'helper' => __('Les Allégations associées au produit.'),
]) ])
@ -245,7 +224,7 @@
'model' => $productModel ?? null, 'model' => $productModel ?? null,
'require' => true, 'require' => true,
'associatedModels' => \App\Enums\Products\DistributionNetworkEnum::toArray(), 'associatedModels' => \App\Enums\Products\DistributionNetworkEnum::toArray(),
'helper' => trans('Selectionnez un Réseau de distribution parmis la liste.'), 'helper' => trans('Selectionnez un Réseau de distribution parmi la liste.'),
]) ])
</div> </div>
</div> </div>
@ -264,7 +243,7 @@
'model' => $productModel ?? null, 'model' => $productModel ?? null,
'require' => true, 'require' => true,
'associatedModels' => \App\Enums\Products\RayEnum::toArray(), 'associatedModels' => \App\Enums\Products\RayEnum::toArray(),
'helper' => trans('Selectionnez un Rayon parmis la liste.'), 'helper' => trans('Selectionnez un Rayon parmi la liste.'),
]) ])
</div> </div>
</div> </div>
@ -283,7 +262,7 @@
'model' => $productModel ?? null, 'model' => $productModel ?? null,
'require' => true, 'require' => true,
'associatedModels' => \App\Enums\Products\RangeEnum::toArray(), 'associatedModels' => \App\Enums\Products\RangeEnum::toArray(),
'helper' => trans('Selectionnez une Famille de produit parmis la liste.'), 'helper' => trans('Selectionnez une Famille de produit parmi la liste.'),
]) ])
</div> </div>
</div> </div>
@ -302,7 +281,7 @@
'model' => $productModel ?? null, 'model' => $productModel ?? null,
'require' => true, 'require' => true,
'associatedModels' => \App\Enums\Products\GeoAreaEnum::toArray(), 'associatedModels' => \App\Enums\Products\GeoAreaEnum::toArray(),
'helper' => trans('Selectionnez une Zone géographique parmis la liste.'), 'helper' => trans('Selectionnez une Zone géographique parmi la liste.'),
]) ])
</div> </div>
</div> </div>
@ -334,11 +313,12 @@
<div class="row"> <div class="row">
<div class="col-12 mb-3"> <div class="col-12 mb-3">
@include('partials.inputs.int-number', [ @include('partials.inputs.int-number', [
'id' => 'productWeight', 'id' => 'productPvc',
'label' => __('PVC de l\'UVC'), 'label' => __('PVC de l\'UVC'),
'name' => 'pvc', 'name' => 'pvc',
'model' => $productModel ?? null, 'model' => $productModel ?? null,
'min' => 0, 'min' => 0,
'step' => 0.01,
'required' => false, 'required' => false,
'helper' => trans('Le prix doit être en euro (€).'), 'helper' => trans('Le prix doit être en euro (€).'),
]) ])
@ -346,6 +326,32 @@
</div> </div>
</fieldset> </fieldset>
</div> </div>
{{-- Prix au kilo --}}
<div class="col-12 col-md-6 mb-3">
<fieldset class="border h-100 bg-white p-3">
<legend>{{ __('Prix au kilo') }}</legend>
<div class="row">
<div class="col-12 mb-3">
@php
$priceKg = 0;
if ($productModel && $productModel->weight != 0) {
$priceKg = 1000 * $productModel->pvc / $productModel->weight;
}
@endphp
@include('partials.inputs.int-number', [
'id' => 'productPriceKg',
'label' => __('Prix au kilo du produit'),
'name' => 'priceKg',
'model' => null,
'required' => false,
'disabled' => true,
'value' => $priceKg,
'helper' => trans('Le prix au kilo est calculé automatiquement.'),
])
</div>
</div>
</fieldset>
</div>
{{-- COMMENT --}} {{-- COMMENT --}}
<div class="col-12 mb-3"> <div class="col-12 mb-3">
<fieldset class="border h-100 bg-white p-3"> <fieldset class="border h-100 bg-white p-3">
@ -359,7 +365,7 @@
'model' => $productModel ?? null, 'model' => $productModel ?? null,
'required' => false, 'required' => false,
'helper' => __(' Doit décrire précisément le contenu du produit, requiert entre 50 et 160 caractères, balise <meta> description.'), 'helper' => __(' Doit décrire précisément le contenu du produit, requiert entre 50 et 160 caractères, balise <meta> description.'),
'placeholder' => __('Une description du contenu du produit pour les moteurs de recherche.'), 'placeholder' => '',
]) ])
</div> </div>
</div> </div>
@ -368,7 +374,7 @@
{{-- KEYWORDS --}} {{-- KEYWORDS --}}
<div class="col-12 mb-3"> <div class="col-12 mb-3">
<fieldset class="border h-100 bg-white p-3"> <fieldset class="border h-100 bg-white p-3">
<legend>{{ __('Tendances') }}</legend> <legend>{{ __('Précisez la ou les tendances') }}</legend>
<div class="row"> <div class="row">
@include('partials.inputs.pivot-taggable', [ @include('partials.inputs.pivot-taggable', [
'name' => 'productKeywords', 'name' => 'productKeywords',
@ -376,7 +382,7 @@
'itemLimit' => [0, count($keywords)], 'itemLimit' => [0, count($keywords)],
'itemsList' => $keywords, 'itemsList' => $keywords,
'helper' => __('Les Tendances associées au produit.'), 'helper' => __('Les Tendances associées au produit.'),
'placeholder' => __('Recherchez une Tendance a associer.'), 'placeholder' => '',
]) ])
</div> </div>
</fieldset> </fieldset>
@ -400,6 +406,7 @@
'title1' => __("Dégustation"), 'title1' => __("Dégustation"),
'label1' => __('Produit dégusté ?'), 'label1' => __('Produit dégusté ?'),
'name1' => 'is_tasted', 'name1' => 'is_tasted',
'oldCheck' => boolval(old('is_tasted', null)),
'model' => $productModel ?? null, 'model' => $productModel ?? null,
'oldModel' => session()->getOldInput(), 'oldModel' => session()->getOldInput(),
'max' => 15, 'max' => 15,
@ -429,5 +436,21 @@
event.preventDefault(); event.preventDefault();
submit.click(''); submit.click('');
}) })
const priceKgInput = document.getElementById('productPriceKg');
const priceInput = document.getElementById('productPvc');
const weightInput = document.getElementById('productWeight');
priceInput.addEventListener("change", updatePriceKg);
weightInput.addEventListener("change", updatePriceKg);
function updatePriceKg() {
if (weightInput.value != 0) {
$priceKg = 1000 * priceInput.value / weightInput.value;
priceKgInput.value = $priceKg.toFixed(2);
} else {
priceKgInput.value = 0;
}
}
}); });
</script> </script>

View file

@ -1,6 +1,6 @@
@extends('layout') @extends('layout')
@section('title', sprintf('%s - %s', __('models.classes.products'), Str::ucfirst(__('liste')))) @section('title', sprintf('%s - %s', trans_choice('models.classes.products_monitoring', 2), Str::ucfirst(__('liste'))))
@section('description', __('Liste des produits publiés')) @section('description', __('Liste des produits publiés'))
@section('breadcrumb', 'no') @section('breadcrumb', 'no')
@ -10,14 +10,14 @@
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<h1 class="text-center text-md-start h2"> <h1 class="text-center text-md-start h2">
<span class="fw-bold">{{ __('models.classes.products') }}</span>&nbsp;<span class="text-muted">{{ Str::ucfirst(__('liste')) }}</span> <span class="fw-bold">{{ trans_choice('models.classes.products_monitoring', 2) }}</span>&nbsp;<span class="text-muted">{{ Str::ucfirst(__('liste')) }}</span>
</h1> </h1>
</div> </div>
<div class="col-md-3"> <div class="col-md-3">
<div class="input-group justify-content-end"> <div class="input-group justify-content-end">
<a href="{{ route('products.create') }}" <a href="{{ route('products.create') }}"
class="btn btn-primary" class="btn btn-success"
title="{{ __('Ajouter un :model', ['model' => Str::singular(__('models.classes.products'))]) }}" title="{{ __('Ajouter une :model', ['model' => trans_choice('models.classes.products_monitoring', 1)]) }}"
data-bs="tooltip"> data-bs="tooltip">
<i class="fa-solid fa-plus"></i> <i class="fa-solid fa-plus"></i>
</a> </a>

View file

@ -6,8 +6,7 @@
'name' => __('Nom'), 'name' => __('Nom'),
'brand_id' => __('Marque'), 'brand_id' => __('Marque'),
'picture' => __('Image'), 'picture' => __('Image'),
'updated_at' => __('Mis à jour le'), 'multi_pdf' => __('Générer en pdf la sélection'),
'multi_pdf' => __('Multi .pdf'),
]; ];
$routeName = request()->route()->getName(); $routeName = request()->route()->getName();
$rst = !is_null(request()->rst) || !Session::has("$routeName.sorted"); $rst = !is_null(request()->rst) || !Session::has("$routeName.sorted");
@ -37,12 +36,7 @@
<p class="text-muted">{{ __('Aucune image enregistée') }}</p> <p class="text-muted">{{ __('Aucune image enregistée') }}</p>
@endif @endif
</td> </td>
<td class="align-middle text-center"> {{-- @if(!$noOrder or $rst) --}}
<span class="badge bg-secondary text-wrap">
{{ $productModel->updated_at->formatLocalized('%d/%m/%Y à %I:%M') }}
</span>
</td>
@if(!$noOrder or $rst)
<td class="align-middle text-center"> <td class="align-middle text-center">
@php @php
$data = [ $data = [
@ -53,7 +47,7 @@
@endphp @endphp
<div class="button-multi-pdf" data-json='@json($data)'></div> <div class="button-multi-pdf" data-json='@json($data)'></div>
</td> </td>
@endif {{-- @endif --}}
<td class="align-middle text-end"> <td class="align-middle text-end">
<form action="{{ route('products.destroy', $productModel->id) }}" method="POST" class="d-inline confirmDeleteJS"> <form action="{{ route('products.destroy', $productModel->id) }}" method="POST" class="d-inline confirmDeleteJS">
@method('DELETE') @method('DELETE')
@ -62,38 +56,38 @@
<a class="btn btn-sm btn-info glightbox" type="button" <a class="btn btn-sm btn-info glightbox" type="button"
href="{{ asset($productModel->picture) }}" target="_blank" href="{{ asset($productModel->picture) }}" target="_blank"
data-gallery="product{{ $productModel->id }}" data-gallery="product{{ $productModel->id }}"
data-bs-title="{{ __('Visionner l\'image du :model', ['model' => Str::singular(__('models.classes.products'))]) }}" data-bs-title="{{ __('Visionner l\'image de la :model', ['model' => trans_choice('models.classes.products_monitoring', 1)]) }}"
data-bs="tooltip"> data-bs="tooltip">
<i class="fa-solid fa-image"></i> <i class="fa-solid fa-image"></i>
</a> </a>
<a class="btn btn-sm btn-warning" type="button" <a class="btn btn-sm btn-warning" type="button"
href="{{ route('products.download', $productModel) }}" href="{{ route('products.download', $productModel) }}"
title="{{ __('Télécharger les annexes du :model', ['model' => Str::singular(__('models.classes.products'))]) }}" title="{{ __('Télécharger les annexes de la :model', ['model' => trans_choice('models.classes.products_monitoring', 1)]) }}"
data-bs="tooltip"> data-bs="tooltip">
<i class="fa-solid fa-download"></i> <i class="fa-solid fa-download"></i>
</a> </a>
<a class="btn btn-sm btn-secondary btn-printing" type="button" <a class="btn btn-sm btn-secondary btn-printing" type="button"
href="{{ route('products.pdf.show', $productModel) }}" href="{{ route('products.pdf.show', $productModel) }}"
target="blank" target="blank"
title="{{ __('Fichier .pdf du :model', ['model' => Str::singular(__('models.classes.products'))]) }}" title="{{ __('Fichier .pdf de la :model', ['model' => trans_choice('models.classes.products_monitoring', 1)]) }}"
data-bs="tooltip" data-bs="tooltip"
data-id="{{ $productModel->id }}"> data-id="{{ $productModel->id }}">
<i class="fa-solid fa-print"></i> <i class="fa-solid fa-print"></i>
</a> </a>
<a class="btn btn-sm btn-success" <a class="btn btn-sm btn-success"
href="{{ route('products.duplicate', $productModel) }}" href="{{ route('products.duplicate', $productModel) }}"
title="{{ __('Dupliquer ce :model', ['model' => Str::singular(__('models.classes.products'))]) }}" title="{{ __('Dupliquer cette :model', ['model' => trans_choice('models.classes.products_monitoring', 1)]) }}"
data-bs="tooltip"> data-bs="tooltip">
<i class="fa-solid fa-copy"></i> <i class="fa-solid fa-copy"></i>
</a> </a>
<a class="btn btn-sm btn-primary" <a class="btn btn-sm btn-primary"
href="{{ route('products.edit', $productModel) }}" href="{{ route('products.edit', $productModel) }}"
title="{{ __('Modifier ce :model', ['model' => Str::singular(__('models.classes.products'))]) }}" title="{{ __('Modifier cette :model', ['model' => trans_choice('models.classes.products_monitoring', 1)]) }}"
data-bs="tooltip"> data-bs="tooltip">
<i class="fa-solid fa-pencil"></i> <i class="fa-solid fa-pencil"></i>
</a> </a>
<button class="btn btn-sm btn-danger" <button class="btn btn-sm btn-danger"
title="{{ __('Supprimer ce :model', ['model' => Str::singular(__('models.classes.products'))]) }}" title="{{ __('Supprimer cette :model', ['model' => trans_choice('models.classes.products_monitoring', 1)]) }}"
data-bs="tooltip"> data-bs="tooltip">
<i class="fa-solid fa-trash"></i> <i class="fa-solid fa-trash"></i>
</button> </button>
@ -106,7 +100,7 @@
<tr> <tr>
<td colspan="{{ count($cols)+1 }}" class="text-center"> <td colspan="{{ count($cols)+1 }}" class="text-center">
<span <span
class="h3">{{ __('Aucun résultat pour les :models', ['models' => __('models.classes.products')]) }} class="h3">{{ __('Aucun résultat pour les :models', ['models' => trans_choice('models.classes.products_monitoring', 2)]) }}
</span> </span>
</td> </td>
</tr> </tr>

View file

@ -33,7 +33,7 @@
</select> </select>
</div> </div>
<div class="col-12 col-md-6 mt-1"> <div class="col-12 col-md-6 mt-1">
<input name="gencod" type="text" class="form-control" placeholder="GENCODE" value="{{ $queryParameters['gencod'] ?? null }}"> <input name="gencod" type="text" class="form-control" placeholder="GENCOD" value="{{ $queryParameters['gencod'] ?? null }}">
</div> </div>
</div> </div>
<!-- SOURCE --> <!-- SOURCE -->

View file

@ -1,9 +1,12 @@
@if(!empty($label)) @if(!empty($label))
<label for="{{ $name }}" class="col-form-label"><b>{{ $label }} *</b></label> <label for="{{ $name }}" class="col-form-label"><b>{{ $label }} *</b></label>
@endif @endif
{{-- @dd($model->{$name}) --}}
<select id="{{ $name }}" class="form-select" name="{{ $name }}" aria-describedby="{{ $id }}Help" @if(!empty($label))required @endif> <select id="{{ $name }}" class="form-select" name="{{ $name }}" aria-describedby="{{ $id }}Help" @if(!empty($label))required @endif>
<option value="0" @if (!old($name, $model->{$name}->id ?? $value ?? null)) selected @endif>
</option>
@foreach ($associatedModels as $associatedModel) @foreach ($associatedModels as $associatedModel)
<option value="{{ $associatedModel->id }}" @if (old($name, $model->{$name} ?? 1) == $associatedModel->id) selected @endif> <option value="{{ $associatedModel->id }}" @if (old($name, $model->{$name} ?? $value ?? null) == $associatedModel->id) selected @endif>
{{ $associatedModel->name }} {{ $associatedModel->name }}
</option> </option>
@endforeach @endforeach

View file

@ -7,10 +7,14 @@
id="{{ $id }}" id="{{ $id }}"
name="{{ $name }}" name="{{ $name }}"
type="number" type="number"
value="{{ old($name, $model->{$name} ?? 0) }}" value="{{ old($name, $model->{$name} ?? $value ?? null) }}"
class="form-control" class="form-control"
aria-describedby="{{ $id }}Help" aria-describedby="{{ $id }}Help"
@if(!empty($step))
step="{{ $step }}"
@else
step="1" step="1"
@endif
@if(!empty($max)) @if(!empty($max))
max="{{ $max }}" max="{{ $max }}"
@else @else
@ -22,6 +26,8 @@
min="{{ !empty($unsigned) ? '0' : '-2147483648' }}" min="{{ !empty($unsigned) ? '0' : '-2147483648' }}"
@endif @endif
@if(!empty($required))required @endif @if(!empty($required))required @endif
@if(!empty($disabled))disabled @endif
@if(!empty($readonly))readonly @endif
> >
@include('modules.input-error', [ @include('modules.input-error', [
'inputName' => $name, 'inputName' => $name,

View file

@ -2,8 +2,10 @@
<label for="{{ $name }}" class="col-form-label"><b>{{ $label }}@if(!empty($required)) * @endif</b></label> <label for="{{ $name }}" class="col-form-label"><b>{{ $label }}@if(!empty($required)) * @endif</b></label>
@endif @endif
<select id="{{ $name }}" class="form-select" name="{{ $name }}" aria-describedby="{{ $id }}Help" @if(!empty($require))required @endif> <select id="{{ $name }}" class="form-select" name="{{ $name }}" aria-describedby="{{ $id }}Help" @if(!empty($require))required @endif>
<option value="0" @if (!old($name, $model->{$name}->value ?? $value ?? null)) selected @endif>
</option>
@foreach ($associatedModels as $associatedModel) @foreach ($associatedModels as $associatedModel)
<option value="{{ $associatedModel->value}}" @if (old($name, $model->{$name}->value ?? $value ?? 1) == $associatedModel->value) selected @endif> <option value="{{ $associatedModel->value}}" @if (old($name, $model->{$name}->value ?? $value ?? null) == $associatedModel->value) selected @endif>
{{ $associatedModel->label }} {{ $associatedModel->label }}
</option> </option>
@endforeach @endforeach