From: Vincent Vanwaelscappel Date: Tue, 23 Apr 2024 05:30:03 +0000 (+0200) Subject: wip #6872 @1 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=28e58f3dbfda26ee2bcf5e1c3abba7e316f5565e;p=bastide-resah.git wip #6872 @1 --- diff --git a/app/Http/Controllers/CatalogController.php b/app/Http/Controllers/CatalogController.php index b6c8aa9..6bfff96 100644 --- a/app/Http/Controllers/CatalogController.php +++ b/app/Http/Controllers/CatalogController.php @@ -16,10 +16,10 @@ class CatalogController extends Controller $path = 'index.html'; } - $cpath = $forceGuest || auth()->guest() ? 'fluidbooks/catalogue_invite' : 'fluidbooks/catalogue'; + $cpath = $forceGuest || auth()->guard('client')->guest() ? 'fluidbooks/catalogue_invite' : 'fluidbooks/catalogue'; $relayPath = base_path($cpath) . '/' . $path; - return XSendFileController::sendfile($relayPath); + return XSendFileController::sendfileNoCache($relayPath); } public function guest($path = '') diff --git a/app/Http/Controllers/FluidbookController.php b/app/Http/Controllers/FluidbookController.php index 76c0745..9121575 100644 --- a/app/Http/Controllers/FluidbookController.php +++ b/app/Http/Controllers/FluidbookController.php @@ -49,7 +49,7 @@ class FluidbookController extends Controller protected function auth() { - return response((!Auth::guard('client')->guest()) ? '1' : '0')->header('Content-Type', 'text/plain'); + return response()->json(['data' => [['logged-in' => !Auth::guard('client')->guest()]]]); } protected function login() @@ -64,7 +64,7 @@ class FluidbookController extends Controller $request->session()->regenerate(); return response()->json(['success' => 'ok'])->setStatusCode(200); } else { - return response()->json(['success' => 'failed'])->setStatusCode(4031); + return response()->json(['success' => 'failed'])->setStatusCode(401); } } @@ -73,17 +73,72 @@ class FluidbookController extends Controller // } + + public static function loadData() + { + return json_decode(trim(file_get_contents(base_path('fluidbooks/catalogue/data/datas.js'), false, null, 13), "\ \n\r\t\v\0;"), true)['basketReferences']; + } + protected function order() { - $details = ''; + $data = self::loadData(); + + $details = []; + $quantity = 0; + $total = 0; + $cumul_tva = 0; + $cumul_ecotaxe = 0; foreach (request('details') as $i) { + $p = $data[$i['reference']]; + $quantity += $i['quantity']; + $ht = self::parseFloat($p['PV RESAH HT']); + $ecotaxe = self::parseFloat($p['ECOTAXE']); + $tht = ($ht + $ecotaxe) * $i['quantity']; + $tva = $ht * $i['quantity'] * 0.01 * self::parseFloat('TVA'); + $total += $ht; + + $cumul_tva += $tva; + $cumul_ecotaxe += $ecotaxe; + + $d = []; + foreach ($p as $k => $v) { + if (!$k || !$v) { + continue; + } + $d[] = $k . " : " . $v; + } + $d[] = '--'; + $d[] = 'QUANTITE : ' . $i['quantity']; + $d[] = 'TOTAL HT : ' . self::formatNumber($tht); + $details[] = implode("\n", $d); } + $details[] = 'TOTAL HT : ' . self::formatNumber($total) . "\n" + . 'TVA : ' . self::formatNumber($cumul_tva) . "\n" + . 'ECOTAXE : ' . self::formatNumber($cumul_ecotaxe) . "\n" + . 'TOTAL TTC : ' . self::formatNumber($total + $cumul_ecotaxe + $cumul_tva); + $order = new Order(); - $order->client = auth()->guard('client')->user(); - $order->details = $details; + $order->client = auth()->guard('client')->user()->id; + $order->details = implode("\n\n----\n\n", $details); + $order->quantity = $quantity; + $order->total_ht = $total; $order->save(); } + + protected static function formatNumber($n, $suffix = ' €') + { + return number_format($n, 2, '.', '') . $suffix; + } + + protected static function parseFloat($f) + { + $f = str_replace(' ', '', $f); + $f = str_replace('€', '', $f); + $f = str_replace('%', '', $f); + $f = str_replace(',', '', $f); + return (float)$f; + } } diff --git a/app/Http/Controllers/LandingController.php b/app/Http/Controllers/LandingController.php index eb866ae..2efa16c 100644 --- a/app/Http/Controllers/LandingController.php +++ b/app/Http/Controllers/LandingController.php @@ -21,6 +21,10 @@ class LandingController extends Controller if (str_ends_with($path, '.html')) { $html = file_get_contents($relayPath); $html = str_replace('', '', $html); + $user = Auth::guard('client')->user(); + if ($user) { + $html = str_replace('Prénom Nom', $user->firstname . ' ' . $user->name, $html); + } return response($html)->header('Content-Type', 'text/html'); } diff --git a/app/Models/Client.php b/app/Models/Client.php index 4de358c..1950a98 100644 --- a/app/Models/Client.php +++ b/app/Models/Client.php @@ -15,6 +15,9 @@ class Client extends CubistMagicAuthenticatable 'singular' => 'client', 'plural' => 'clients']; + protected $_enableClone = false; + protected $_enableBulk = false; + public function setFields() { parent::setFields(); @@ -22,9 +25,9 @@ class Client extends CubistMagicAuthenticatable $this->getField('enabled')->setAttribute('label', 'Activé'); $this->getField('password')->setAttribute('can', null); $this->addField('finess', Text::class, 'Numéro FINESS', ['tab' => 'Login']); - $this->addField('hospital', Text::class, 'Nom de l\'établissement', ['tab' => 'Login']); - $this->addField('firstname', Text::class, 'Prénom', ['tab' => 'Login']); - $this->addField('name', Text::class, 'Nom', ['tab' => 'Login']); + $this->addField('hospital', Text::class, 'Nom de l\'établissement', ['tab' => 'Login', 'column' => true]); + $this->addField('firstname', Text::class, 'Prénom', ['tab' => 'Login', 'column' => true]); + $this->addField('name', Text::class, 'Nom', ['tab' => 'Login', 'column' => true]); $this->addField('function', Text::class, 'Fonction', ['tab' => 'Login']); $this->addField('phone', Text::class, 'Numéro de téléphone', ['tab' => 'Login']); } diff --git a/app/Models/Order.php b/app/Models/Order.php index d3f4206..508acef 100644 --- a/app/Models/Order.php +++ b/app/Models/Order.php @@ -2,6 +2,11 @@ namespace App\Models; +use Cubist\Backpack\Magic\Fields\Date; +use Cubist\Backpack\Magic\Fields\Integer; +use Cubist\Backpack\Magic\Fields\Number; +use Cubist\Backpack\Magic\Fields\SelectFromModel; +use Cubist\Backpack\Magic\Fields\Textarea; use Cubist\Backpack\Magic\Models\CubistMagicAbstractModel; class Order extends CubistMagicAbstractModel @@ -10,4 +15,20 @@ class Order extends CubistMagicAbstractModel protected $_options = ['name' => 'order', 'singular' => 'commande', 'plural' => 'commandes']; + + protected $_enableClone = false; + protected $_enableBulk = false; + protected $_enableCreation = false; + + public function setFields() + { + parent::setFields(); + + + $this->addField('client', SelectFromModel::class, 'Client', ['optionsmodel' => Client::class, "column" => true, 'column_attribute' => 'hospital']); + $this->addField('details', Textarea::class, 'Détails'); + $this->addField('quantity', Integer::class, 'Nombre de produits', ['column' => true]); + $this->addField('total_ht', Number::class, 'Total HT', ['column' => true]); + $this->addField('created_at', Date::class, 'Date', ['column' => true]); + } } diff --git a/resources/webflow/charte-de-protection-des-donnees-personnelles.html b/resources/webflow/charte-de-protection-des-donnees-personnelles.html index 3195b39..bbb9677 100644 --- a/resources/webflow/charte-de-protection-des-donnees-personnelles.html +++ b/resources/webflow/charte-de-protection-des-donnees-personnelles.html @@ -1,5 +1,5 @@ - + diff --git a/resources/webflow/css/bastide-maquette.webflow.css b/resources/webflow/css/bastide-maquette.webflow.css index db92cbc..125c890 100644 --- a/resources/webflow/css/bastide-maquette.webflow.css +++ b/resources/webflow/css/bastide-maquette.webflow.css @@ -288,13 +288,12 @@ a:hover { flex-flow: row; justify-content: space-between; align-items: stretch; - width: 80%; - max-width: 1536px; + width: 100%; + max-width: 1680px; height: 100%; margin-left: auto; margin-right: auto; - padding-top: 1rem; - padding-bottom: 1rem; + padding: 1rem 4rem; display: flex; } @@ -419,6 +418,7 @@ a:hover { .paragraph-2 { color: var(--white); + margin-bottom: 0; } .logo-footer { @@ -432,7 +432,7 @@ a:hover { max-height: 1.5rem; } -.login-open-contain { +.login-link-contain { grid-column-gap: 2rem; grid-row-gap: 2rem; height: 3rem; @@ -453,7 +453,7 @@ a:hover { position: relative; } -.link-sign { +.login-link { color: var(--main-blue); text-transform: uppercase; margin-top: -1rem; @@ -551,6 +551,56 @@ a:hover { border-radius: 5px; } +.login-logged-contain { + z-index: 10; + grid-column-gap: .5rem; + grid-row-gap: .5rem; + flex-flow: column; + justify-content: flex-start; + align-items: flex-start; + width: 100%; + display: flex; + position: relative; +} + +.image-4 { + width: 2rem; +} + +.link-log-out { + color: var(--action-blue); + align-self: auto; + margin-left: 0; + margin-right: auto; + font-size: .9rem; + font-weight: 400; + position: relative; +} + +.link-log-out:hover { + color: var(--action-hover); +} + +.div-block-18 { + grid-column-gap: .5rem; + grid-row-gap: .5rem; + margin-bottom: .5rem; + display: flex; +} + +.login-wrap-logged { + background-color: var(--main-blue); + justify-content: center; + align-items: flex-start; + height: auto; + padding-top: 4rem; + padding-bottom: 4rem; + padding-left: 4rem; + display: flex; + position: relative; + top: 0; +} + @media screen and (max-width: 991px) { .main { flex-flow: column; @@ -612,7 +662,7 @@ a:hover { align-items: flex-start; } - .login-open-contain { + .login-link-contain { justify-content: flex-end; align-items: center; height: 4rem; @@ -625,7 +675,7 @@ a:hover { right: 4rem; } - .link-sign { + .login-link { margin-top: 0; position: relative; } @@ -642,6 +692,14 @@ a:hover { .section-footer.fixed { position: relative; } + + .login-wrap-logged { + margin-left: -4rem; + margin-right: -4rem; + padding-top: 4rem; + padding-right: 4rem; + display: block; + } } @media screen and (max-width: 767px) { @@ -722,7 +780,7 @@ a:hover { text-align: center; } - .login-open-contain { + .login-link-contain { grid-column-gap: 1rem; grid-row-gap: 1rem; flex-flow: row; @@ -738,7 +796,7 @@ a:hover { right: 0%; } - .link-sign { + .login-link { text-align: right; } @@ -759,6 +817,12 @@ a:hover { .sub, .sub-bold { margin-left: 0; } + + .login-wrap-logged { + margin-left: -2rem; + margin-right: -2rem; + padding: 2rem; + } } #w-node-d100f643-e903-8c7d-af5b-f27e805256d0-759afc4f { @@ -793,8 +857,24 @@ a:hover { grid-area: span 1 / span 6 / span 1 / span 6; } +#w-node-d100f643-e903-8c7d-af5b-f27e805256d0-674dc4db { + grid-area: span 1 / span 8 / span 1 / span 8; +} + +#w-node-_6f9956a3-e864-4d2e-ed2a-708f54eeb981-674dc4db { + grid-area: span 1 / span 5 / span 1 / span 5; +} + +#w-node-ecfbbec6-5d25-d8fb-0bfb-0e3780f4e730-674dc4db, #w-node-_2b36ab23-5dc7-0407-ff12-015028c2eea5-674dc4db { + grid-area: span 1 / span 6 / span 1 / span 6; +} + +#w-node-_32abe63d-96a1-8dcd-52e7-97d8c2ec03e0-674dc4db, #login.w-node-_12259778-be95-d71b-a8f2-39430d62a8fc-674dc4db { + grid-area: span 1 / span 4 / span 1 / span 4; +} + @media screen and (max-width: 991px) { - #w-node-d100f643-e903-8c7d-af5b-f27e805256d0-759afc4f, #w-node-d100f643-e903-8c7d-af5b-f27e805256d0-9bb8274d, #w-node-d100f643-e903-8c7d-af5b-f27e805256d0-25581eb0 { + #w-node-d100f643-e903-8c7d-af5b-f27e805256d0-759afc4f, #w-node-d100f643-e903-8c7d-af5b-f27e805256d0-9bb8274d, #w-node-d100f643-e903-8c7d-af5b-f27e805256d0-25581eb0, #w-node-d100f643-e903-8c7d-af5b-f27e805256d0-674dc4db { grid-column: span 12 / span 12; } } diff --git a/resources/webflow/home-logged.html b/resources/webflow/home-logged.html index 60143f4..73f43d0 100644 --- a/resources/webflow/home-logged.html +++ b/resources/webflow/home-logged.html @@ -1,2 +1,71 @@ -Voir le catalogue -Logout + + + + + + Home-logged + + + + + + + + + + + + + + + + + +
+
+
+
+ Bastide +
+
+
+

Bienvenue sur Bastide-resah.com

+

Avec notre catalogue interactif, sélectionnez vos produits, déterminez votre budget en instantané, et recevez un devis par le Resah dans les 72h.

+
+ Consulter le catalogue +
+
+
+
+ + +
+ + + + + + \ No newline at end of file diff --git a/resources/webflow/images/compo-pages-p-1080.png b/resources/webflow/images/compo-pages-p-1080.png index 88fb540..5d332cf 100644 Binary files a/resources/webflow/images/compo-pages-p-1080.png and b/resources/webflow/images/compo-pages-p-1080.png differ diff --git a/resources/webflow/images/compo-pages-p-1600.png b/resources/webflow/images/compo-pages-p-1600.png index a66daaf..e4a9e99 100644 Binary files a/resources/webflow/images/compo-pages-p-1600.png and b/resources/webflow/images/compo-pages-p-1600.png differ diff --git a/resources/webflow/images/compo-pages-p-500.png b/resources/webflow/images/compo-pages-p-500.png index 995770e..4af39a8 100644 Binary files a/resources/webflow/images/compo-pages-p-500.png and b/resources/webflow/images/compo-pages-p-500.png differ diff --git a/resources/webflow/images/compo-pages-p-800.png b/resources/webflow/images/compo-pages-p-800.png index a265a46..8bf39cc 100644 Binary files a/resources/webflow/images/compo-pages-p-800.png and b/resources/webflow/images/compo-pages-p-800.png differ diff --git a/resources/webflow/images/compo-pages.png b/resources/webflow/images/compo-pages.png index 57eaac4..a8425b2 100644 Binary files a/resources/webflow/images/compo-pages.png and b/resources/webflow/images/compo-pages.png differ diff --git a/resources/webflow/images/icon-user.svg b/resources/webflow/images/icon-user.svg new file mode 100644 index 0000000..5521182 --- /dev/null +++ b/resources/webflow/images/icon-user.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/resources/webflow/index.html b/resources/webflow/index.html index de43b54..5eed13e 100644 --- a/resources/webflow/index.html +++ b/resources/webflow/index.html @@ -1,5 +1,5 @@ - + @@ -28,8 +28,8 @@

Bienvenue sur Bastide-resah.com

-

Consultez notre catalogue, sélectionnez vos produits, déterminez votre budget en instantané, et recevez un devis par le Resah dans les 72h.

-
Catalogue Bastide Resah
+

Avec notre catalogue interactif, sélectionnez vos produits, déterminez votre budget en instantané, et recevez un devis par le Resah dans les 72h.

+
Consulter le catalogue
@@ -37,7 +37,7 @@
-