feat: ✨ size and packaging not required to send contact mail

This commit is contained in:
Nicolas Demangeat 2025-03-20 10:06:39 +01:00
parent 58f00f29dc
commit 67449aad40
5 changed files with 4 additions and 53 deletions

View file

@ -24,7 +24,7 @@ class AjaxAddProductBasket extends FormRequest
public function rules(): array
{
return [
'packaging' => 'required|array|min:1',
'packaging' => 'array',
'packaging.*' => [
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundBeforeLastUsed
function ($attribute, $value, $fail) {
@ -37,7 +37,7 @@ class AjaxAddProductBasket extends FormRequest
}
}
],
'caliber' => 'required|array|min:1',
'caliber' => 'array',
'caliber.*' => [
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundBeforeLastUsed
function ($attribute, $value, $fail) {

7
package-lock.json generated
View file

@ -35,7 +35,6 @@
"laravel-vite-plugin": "^0.8.1",
"postcss-discard-comments": "^6.0.0",
"prettier": "latest",
"print-js": "^1.6.0",
"resolve-url-loader": "^5.0.0",
"rollup-plugin-copy": "^3.5.0",
"sass": "latest",
@ -5651,12 +5650,6 @@
"url": "https://github.com/prettier/prettier?sponsor=1"
}
},
"node_modules/print-js": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/print-js/-/print-js-1.6.0.tgz",
"integrity": "sha512-BfnOIzSKbqGRtO4o0rnj/K3681BSd2QUrsIZy/+WdCIugjIswjmx3lDEZpXB2ruGf9d4b3YNINri81+J0FsBWg==",
"dev": true
},
"node_modules/proxy-from-env": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",

View file

@ -43,7 +43,6 @@
"laravel-vite-plugin": "^0.8.1",
"postcss-discard-comments": "^6.0.0",
"prettier": "latest",
"print-js": "^1.6.0",
"resolve-url-loader": "^5.0.0",
"rollup-plugin-copy": "^3.5.0",
"sass": "latest",

View file

@ -1,4 +1,3 @@
import printJS from "print-js";
window.addEventListener("DOMContentLoaded", () => {
// BOUTON HAMBURGER
@ -178,42 +177,4 @@ window.addEventListener("DOMContentLoaded", () => {
}
});
}
const eltsButtonPrintProd = document.getElementsByClassName(
"btn-printing"
) as HTMLCollectionOf<HTMLButtonElement>,
businessSheet = document.querySelector(
".business-wrap"
) as HTMLDivElement | null;
// @ts-ignore
window.printJS = printJS;
for (const eltButtonPrintProd of eltsButtonPrintProd) {
eltButtonPrintProd.addEventListener("click", function () {
if (businessSheet) {
const pathname = window.location.pathname;
const pathnameAsArray = pathname.split("/");
const itemName = pathnameAsArray[pathnameAsArray.length - 1];
setTimeout(() => {
// ! Seule solution: imprimer un pdf spécifique pour avoir le rendu souhaité.
// @ts-ignore
printJS({
printable:
"produit/" + itemName +
"/print-commercial-sheet",
type: "pdf",
showModal: true,
});
});
} else {
console.error(
"Could not find business sheet, printing window."
);
window.print();
}
});
}
// OVERRIDE BOOTSTRAP
});

View file

@ -15,11 +15,10 @@
:data-index="item.value"
class="packaging d-none input-pack input-checkbox-pack"
type="checkbox"
:checked="itemPackaging.length === 1"
>
<div class="butn-wrap user-select-none">
<label
:class="`label-checkbox label-interest butn-cinq fs-xsm position-relative mb-1 ${itemPackaging.length === 1 ? 'range-bg-color-checked' : ''}`"
class="label-checkbox label-interest butn-cinq fs-xsm position-relative mb-1"
role="button"
:for="`packaging-${String(index)}`"
>
@ -44,11 +43,10 @@
:data-index="item.value"
class="caliber d-none input-pack input-checkbox-pack"
type="checkbox"
:checked="itemCaliber.length === 1"
>
<div class="butn-wrap user-select-none">
<label
:class="`label-checkbox label-interest butn-cinq fs-xsm position-relative mb-1 ${itemCaliber.length === 1 ? 'range-bg-color-checked' : ''}`"
class="label-checkbox label-interest butn-cinq fs-xsm position-relative mb-1"
role="button"
:for="`caliber-${String(index)}`"
>