From 9d84ae169276e26580b77ff055a27caa5ab6597f Mon Sep 17 00:00:00 2001 From: Olivier Legat Date: Thu, 25 Mar 2021 15:48:07 +0100 Subject: [PATCH] panier phase 1 --- app/Http/Controllers/BasketController.php | 34 +- app/Providers/AppServiceProvider.php | 28 - config/cart.php | 2 +- package-lock.json | 21 +- package.json | 9 +- public/b-o/js/app.js | 191 +- public/canard/css/app.css | 12 +- public/canard/js/app.js | 2141 +++++++++++++++-- .../{ => front/basic}/auth/login.blade.php | 0 .../{ => front/basic}/auth/register.blade.php | 0 .../basic}/auth/reset-password.blade.php | 0 .../views/front/canard/auth/login.blade.php | 54 + .../front/canard/auth/register.blade.php | 83 + .../canard/auth/reset-password.blade.php | 5 + resources/views/front/canard/js/app.js | 45 +- .../canard/js/components/BasketPanel.vue | 186 +- .../front/canard/layouts/layout.blade.php | 2 +- .../front/canard/partials/header.blade.php | 2 +- .../canard/partials/products-list.blade.php | 8 +- .../views/front/canard/product.blade.php | 8 +- resources/views/front/canard/sass/cart.scss | 14 +- routes/breadcrumbs.php | 10 + routes/web.php | 3 + 23 files changed, 2463 insertions(+), 395 deletions(-) rename resources/views/{ => front/basic}/auth/login.blade.php (100%) rename resources/views/{ => front/basic}/auth/register.blade.php (100%) rename resources/views/{ => front/basic}/auth/reset-password.blade.php (100%) create mode 100644 resources/views/front/canard/auth/login.blade.php create mode 100644 resources/views/front/canard/auth/register.blade.php create mode 100644 resources/views/front/canard/auth/reset-password.blade.php diff --git a/app/Http/Controllers/BasketController.php b/app/Http/Controllers/BasketController.php index e76ce49..7cb4f55 100644 --- a/app/Http/Controllers/BasketController.php +++ b/app/Http/Controllers/BasketController.php @@ -4,6 +4,7 @@ namespace App\Http\Controllers; use App\Models\Product; use Illuminate\Http\Request; +use Illuminate\Support\Collection; use Gloudemans\Shoppingcart\Facades\Cart; class BasketController extends Controller @@ -18,11 +19,28 @@ class BasketController extends Controller $product = Product::find($request->id); Cart::add($product, $request->qty); + return $this->getCart(); + } - $dbpanier = new \Illuminate\Support\Collection(); + public function removeFromCart(Request $request) + { + $rowId = $request->rowId; + Cart::remove($rowId); + return $this->getCart(); + } + + public function emptyCart() { + Cart::destroy(); + return $this->getCart(); + } + + public function getCart() { + + $dbpanier = new Collection(); foreach (Cart::content() as $row) { $product = $row->model; $product->additionnalProductInfo = $product->additionnalProductInfo($product->product_type); + $cartextendedItem = array( 'cartItem' => $row, 'product' => $product @@ -30,6 +48,18 @@ class BasketController extends Controller $dbpanier->add($cartextendedItem); } - return $dbpanier; + $cartInfos = array( + "totalTTC" => Cart::total(), + 'totalTVA' => Cart::tax(), //total des taxes + 'totalHT' => Cart::subtotal(), //total sans les taxes + 'totalweight' => Cart::weight(), //poids total des items + 'totalHTbefore' => Cart::priceTotal(), //total avant taxes et remises + 'totaldiscount' => Cart::discount(), //total des remises + 'countItems' => Cart::count(), //nb de produits dans le cart + ); + + $cartReturn = array($dbpanier,$cartInfos); + + return $cartReturn; } } diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 990acfb..463a67c 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -2,15 +2,9 @@ namespace App\Providers; -use App\Models\Product; use App\Models\Range; use Illuminate\Support\Facades\View; use Illuminate\Support\ServiceProvider; -use Gloudemans\Shoppingcart\Facades\Cart; -use Illuminate\Database\Eloquent\Collection; -use Illuminate\Support\Facades\Config; -use Illuminate\Support\Facades\Cache; -use stdClass; class AppServiceProvider extends ServiceProvider { @@ -38,27 +32,5 @@ class AppServiceProvider extends ServiceProvider // on partage les ranges (gammes produit) $ranges = Range::all(); View::share('ranges', $ranges); - - - $product = Product::find(6); - Cart::add($product, 1); - $product = Product::find(2); - Cart::add($product, 1); - Cart::add($product, 1); - $product = Product::find(5); - Cart::add($product, 1); - - $dbpanier = new \Illuminate\Support\Collection(); - foreach (Cart::content() as $row) { - $product = $row->model; - $product->additionnalProductInfo = $product->additionnalProductInfo($product->product_type); - $cartextendedItem = array( - 'cartItem' => $row, - 'product' => $product - ); - $dbpanier->add($cartextendedItem); - } - - View::share('dbpanier', $dbpanier); } } diff --git a/config/cart.php b/config/cart.php index 94b065c..b5222cc 100644 --- a/config/cart.php +++ b/config/cart.php @@ -24,7 +24,7 @@ return [ | */ - 'tax' => 21, + 'tax' => 20, /* |-------------------------------------------------------------------------- diff --git a/package-lock.json b/package-lock.json index 7f63e78..5582ecf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1641,12 +1641,20 @@ } }, "axios": { - "version": "0.19.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.19.2.tgz", - "integrity": "sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA==", + "version": "0.21.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz", + "integrity": "sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==", "dev": true, "requires": { - "follow-redirects": "1.5.10" + "follow-redirects": "^1.10.0" + }, + "dependencies": { + "follow-redirects": { + "version": "1.13.3", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.13.3.tgz", + "integrity": "sha512-DUgl6+HDzB0iEptNQEXLx/KhTmDb8tZUHSeLqpnjpknR70H0nC2t9N73BK6fN4hOvJ84pKlIQVQ4k5FFlBedKA==", + "dev": true + } } }, "babel-code-frame": { @@ -9368,6 +9376,11 @@ "integrity": "sha512-4gDntzrifFnCEvyoO8PqyJDmguXgVPxKiIxrBKjIowvL9l+N66196+72XVYR8BBf1Uv1Fgt3bGevJ+sEmxfZzw==", "dev": true }, + "vuex": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/vuex/-/vuex-3.6.2.tgz", + "integrity": "sha512-ETW44IqCgBpVomy520DT5jf8n0zoCac+sxWnn+hMe/CzaSejb/eVw2YToiXYX+Ex/AuHHia28vWTq4goAexFbw==" + }, "watchpack": { "version": "1.7.5", "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.7.5.tgz", diff --git a/package.json b/package.json index 0a6c0f4..f15dee5 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --config=node_modules/laravel-mix/setup/webpack.config.js" }, "devDependencies": { - "axios": "^0.19", + "axios": "^0.21.1", "bootstrap": "^4.5.0", "cross-env": "^7.0", "jquery": "^3.6", @@ -19,11 +19,12 @@ "popper.js": "^1.12", "resolve-url-loader": "^3.1.0", "sass-loader": "^8.0.2", - "vue-template-compiler": "^2.6.12", - "swiper": "^6.3.4" + "swiper": "^6.3.4", + "vue-template-compiler": "^2.6.12" }, "dependencies": { "sass": "^1.28.0", - "vue": "^2.6.12" + "vue": "^2.6.12", + "vuex": "^3.6.2" } } diff --git a/public/b-o/js/app.js b/public/b-o/js/app.js index 37a407d..259c352 100644 --- a/public/b-o/js/app.js +++ b/public/b-o/js/app.js @@ -109,6 +109,7 @@ module.exports = __webpack_require__(/*! ./lib/axios */ "./node_modules/axios/li var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); var settle = __webpack_require__(/*! ./../core/settle */ "./node_modules/axios/lib/core/settle.js"); +var cookies = __webpack_require__(/*! ./../helpers/cookies */ "./node_modules/axios/lib/helpers/cookies.js"); var buildURL = __webpack_require__(/*! ./../helpers/buildURL */ "./node_modules/axios/lib/helpers/buildURL.js"); var buildFullPath = __webpack_require__(/*! ../core/buildFullPath */ "./node_modules/axios/lib/core/buildFullPath.js"); var parseHeaders = __webpack_require__(/*! ./../helpers/parseHeaders */ "./node_modules/axios/lib/helpers/parseHeaders.js"); @@ -129,7 +130,7 @@ module.exports = function xhrAdapter(config) { // HTTP basic authentication if (config.auth) { var username = config.auth.username || ''; - var password = config.auth.password || ''; + var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : ''; requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password); } @@ -210,8 +211,6 @@ module.exports = function xhrAdapter(config) { // This is only done if running in a standard browser environment. // Specifically not if we're in a web worker, or react-native. if (utils.isStandardBrowserEnv()) { - var cookies = __webpack_require__(/*! ./../helpers/cookies */ "./node_modules/axios/lib/helpers/cookies.js"); - // Add xsrf header var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ? cookies.read(config.xsrfCookieName) : @@ -277,7 +276,7 @@ module.exports = function xhrAdapter(config) { }); } - if (requestData === undefined) { + if (!requestData) { requestData = null; } @@ -346,6 +345,9 @@ axios.all = function all(promises) { }; axios.spread = __webpack_require__(/*! ./helpers/spread */ "./node_modules/axios/lib/helpers/spread.js"); +// Expose isAxiosError +axios.isAxiosError = __webpack_require__(/*! ./helpers/isAxiosError */ "./node_modules/axios/lib/helpers/isAxiosError.js"); + module.exports = axios; // Allow use of default import syntax in TypeScript @@ -554,9 +556,10 @@ Axios.prototype.getUri = function getUri(config) { utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) { /*eslint func-names:0*/ Axios.prototype[method] = function(url, config) { - return this.request(utils.merge(config || {}, { + return this.request(mergeConfig(config || {}, { method: method, - url: url + url: url, + data: (config || {}).data })); }; }); @@ -564,7 +567,7 @@ utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { /*eslint func-names:0*/ Axios.prototype[method] = function(url, data, config) { - return this.request(utils.merge(config || {}, { + return this.request(mergeConfig(config || {}, { method: method, url: url, data: data @@ -824,7 +827,7 @@ module.exports = function enhanceError(error, config, code, request, response) { error.response = response; error.isAxiosError = true; - error.toJSON = function() { + error.toJSON = function toJSON() { return { // Standard message: this.message, @@ -873,59 +876,73 @@ module.exports = function mergeConfig(config1, config2) { config2 = config2 || {}; var config = {}; - var valueFromConfig2Keys = ['url', 'method', 'params', 'data']; - var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy']; + var valueFromConfig2Keys = ['url', 'method', 'data']; + var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy', 'params']; var defaultToConfig2Keys = [ - 'baseURL', 'url', 'transformRequest', 'transformResponse', 'paramsSerializer', - 'timeout', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName', - 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', - 'maxContentLength', 'validateStatus', 'maxRedirects', 'httpAgent', - 'httpsAgent', 'cancelToken', 'socketPath' + 'baseURL', 'transformRequest', 'transformResponse', 'paramsSerializer', + 'timeout', 'timeoutMessage', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName', + 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'decompress', + 'maxContentLength', 'maxBodyLength', 'maxRedirects', 'transport', 'httpAgent', + 'httpsAgent', 'cancelToken', 'socketPath', 'responseEncoding' ]; + var directMergeKeys = ['validateStatus']; + + function getMergedValue(target, source) { + if (utils.isPlainObject(target) && utils.isPlainObject(source)) { + return utils.merge(target, source); + } else if (utils.isPlainObject(source)) { + return utils.merge({}, source); + } else if (utils.isArray(source)) { + return source.slice(); + } + return source; + } + + function mergeDeepProperties(prop) { + if (!utils.isUndefined(config2[prop])) { + config[prop] = getMergedValue(config1[prop], config2[prop]); + } else if (!utils.isUndefined(config1[prop])) { + config[prop] = getMergedValue(undefined, config1[prop]); + } + } utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) { - if (typeof config2[prop] !== 'undefined') { - config[prop] = config2[prop]; + if (!utils.isUndefined(config2[prop])) { + config[prop] = getMergedValue(undefined, config2[prop]); } }); - utils.forEach(mergeDeepPropertiesKeys, function mergeDeepProperties(prop) { - if (utils.isObject(config2[prop])) { - config[prop] = utils.deepMerge(config1[prop], config2[prop]); - } else if (typeof config2[prop] !== 'undefined') { - config[prop] = config2[prop]; - } else if (utils.isObject(config1[prop])) { - config[prop] = utils.deepMerge(config1[prop]); - } else if (typeof config1[prop] !== 'undefined') { - config[prop] = config1[prop]; - } - }); + utils.forEach(mergeDeepPropertiesKeys, mergeDeepProperties); utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) { - if (typeof config2[prop] !== 'undefined') { - config[prop] = config2[prop]; - } else if (typeof config1[prop] !== 'undefined') { - config[prop] = config1[prop]; + if (!utils.isUndefined(config2[prop])) { + config[prop] = getMergedValue(undefined, config2[prop]); + } else if (!utils.isUndefined(config1[prop])) { + config[prop] = getMergedValue(undefined, config1[prop]); + } + }); + + utils.forEach(directMergeKeys, function merge(prop) { + if (prop in config2) { + config[prop] = getMergedValue(config1[prop], config2[prop]); + } else if (prop in config1) { + config[prop] = getMergedValue(undefined, config1[prop]); } }); var axiosKeys = valueFromConfig2Keys .concat(mergeDeepPropertiesKeys) - .concat(defaultToConfig2Keys); + .concat(defaultToConfig2Keys) + .concat(directMergeKeys); var otherKeys = Object - .keys(config2) + .keys(config1) + .concat(Object.keys(config2)) .filter(function filterAxiosKeys(key) { return axiosKeys.indexOf(key) === -1; }); - utils.forEach(otherKeys, function otherKeysDefaultToConfig2(prop) { - if (typeof config2[prop] !== 'undefined') { - config[prop] = config2[prop]; - } else if (typeof config1[prop] !== 'undefined') { - config[prop] = config1[prop]; - } - }); + utils.forEach(otherKeys, mergeDeepProperties); return config; }; @@ -954,7 +971,7 @@ var createError = __webpack_require__(/*! ./createError */ "./node_modules/axios */ module.exports = function settle(resolve, reject, response) { var validateStatus = response.config.validateStatus; - if (!validateStatus || validateStatus(response.status)) { + if (!response.status || !validateStatus || validateStatus(response.status)) { resolve(response); } else { reject(createError( @@ -1086,6 +1103,7 @@ var defaults = { xsrfHeaderName: 'X-XSRF-TOKEN', maxContentLength: -1, + maxBodyLength: -1, validateStatus: function validateStatus(status) { return status >= 200 && status < 300; @@ -1149,7 +1167,6 @@ var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/util function encode(val) { return encodeURIComponent(val). - replace(/%40/gi, '@'). replace(/%3A/gi, ':'). replace(/%24/g, '$'). replace(/%2C/gi, ','). @@ -1333,6 +1350,29 @@ module.exports = function isAbsoluteURL(url) { }; +/***/ }), + +/***/ "./node_modules/axios/lib/helpers/isAxiosError.js": +/*!********************************************************!*\ + !*** ./node_modules/axios/lib/helpers/isAxiosError.js ***! + \********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/** + * Determines whether the payload is an error thrown by Axios + * + * @param {*} payload The value to test + * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false + */ +module.exports = function isAxiosError(payload) { + return (typeof payload === 'object') && (payload.isAxiosError === true); +}; + + /***/ }), /***/ "./node_modules/axios/lib/helpers/isURLSameOrigin.js": @@ -1658,6 +1698,21 @@ function isObject(val) { return val !== null && typeof val === 'object'; } +/** + * Determine if a value is a plain Object + * + * @param {Object} val The value to test + * @return {boolean} True if value is a plain Object, otherwise false + */ +function isPlainObject(val) { + if (toString.call(val) !== '[object Object]') { + return false; + } + + var prototype = Object.getPrototypeOf(val); + return prototype === null || prototype === Object.prototype; +} + /** * Determine if a value is a Date * @@ -1814,34 +1869,12 @@ function forEach(obj, fn) { function merge(/* obj1, obj2, obj3, ... */) { var result = {}; function assignValue(val, key) { - if (typeof result[key] === 'object' && typeof val === 'object') { + if (isPlainObject(result[key]) && isPlainObject(val)) { result[key] = merge(result[key], val); - } else { - result[key] = val; - } - } - - for (var i = 0, l = arguments.length; i < l; i++) { - forEach(arguments[i], assignValue); - } - return result; -} - -/** - * Function equal to merge with the difference being that no reference - * to original objects is kept. - * - * @see merge - * @param {Object} obj1 Object to merge - * @returns {Object} Result of all merge properties - */ -function deepMerge(/* obj1, obj2, obj3, ... */) { - var result = {}; - function assignValue(val, key) { - if (typeof result[key] === 'object' && typeof val === 'object') { - result[key] = deepMerge(result[key], val); - } else if (typeof val === 'object') { - result[key] = deepMerge({}, val); + } else if (isPlainObject(val)) { + result[key] = merge({}, val); + } else if (isArray(val)) { + result[key] = val.slice(); } else { result[key] = val; } @@ -1872,6 +1905,19 @@ function extend(a, b, thisArg) { return a; } +/** + * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM) + * + * @param {string} content with BOM + * @return {string} content value without BOM + */ +function stripBOM(content) { + if (content.charCodeAt(0) === 0xFEFF) { + content = content.slice(1); + } + return content; +} + module.exports = { isArray: isArray, isArrayBuffer: isArrayBuffer, @@ -1881,6 +1927,7 @@ module.exports = { isString: isString, isNumber: isNumber, isObject: isObject, + isPlainObject: isPlainObject, isUndefined: isUndefined, isDate: isDate, isFile: isFile, @@ -1891,9 +1938,9 @@ module.exports = { isStandardBrowserEnv: isStandardBrowserEnv, forEach: forEach, merge: merge, - deepMerge: deepMerge, extend: extend, - trim: trim + trim: trim, + stripBOM: stripBOM }; diff --git a/public/canard/css/app.css b/public/canard/css/app.css index d4f893b..8668ab9 100644 --- a/public/canard/css/app.css +++ b/public/canard/css/app.css @@ -2408,6 +2408,16 @@ BODY.cartOpened { vertical-align: top; transition: all 0.2s linear; } +.ds-button.ds-button--secondary { + border: 0.0625rem solid #a8be36; + background-color: #a8be36; + color: black; +} +.ds-button.ds-button--tertiary { + border: 0.0625rem solid #1a3441; + background-color: white; + color: #a8be36; +} .basket-panel__title-wrapper { display: flex; @@ -2838,7 +2848,7 @@ svg:not(:root) { background-color: #a8be36; border: 1px solid #a8be36; color: #fff; - border-radius: 25px; + border-radius: 0.25rem; padding: 0.375rem 1.5rem; display: inline-block; letter-spacing: 0.5px; diff --git a/public/canard/js/app.js b/public/canard/js/app.js index 18bcc86..09e0c5b 100644 --- a/public/canard/js/app.js +++ b/public/canard/js/app.js @@ -109,6 +109,7 @@ module.exports = __webpack_require__(/*! ./lib/axios */ "./node_modules/axios/li var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); var settle = __webpack_require__(/*! ./../core/settle */ "./node_modules/axios/lib/core/settle.js"); +var cookies = __webpack_require__(/*! ./../helpers/cookies */ "./node_modules/axios/lib/helpers/cookies.js"); var buildURL = __webpack_require__(/*! ./../helpers/buildURL */ "./node_modules/axios/lib/helpers/buildURL.js"); var buildFullPath = __webpack_require__(/*! ../core/buildFullPath */ "./node_modules/axios/lib/core/buildFullPath.js"); var parseHeaders = __webpack_require__(/*! ./../helpers/parseHeaders */ "./node_modules/axios/lib/helpers/parseHeaders.js"); @@ -129,7 +130,7 @@ module.exports = function xhrAdapter(config) { // HTTP basic authentication if (config.auth) { var username = config.auth.username || ''; - var password = config.auth.password || ''; + var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : ''; requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password); } @@ -210,8 +211,6 @@ module.exports = function xhrAdapter(config) { // This is only done if running in a standard browser environment. // Specifically not if we're in a web worker, or react-native. if (utils.isStandardBrowserEnv()) { - var cookies = __webpack_require__(/*! ./../helpers/cookies */ "./node_modules/axios/lib/helpers/cookies.js"); - // Add xsrf header var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ? cookies.read(config.xsrfCookieName) : @@ -277,7 +276,7 @@ module.exports = function xhrAdapter(config) { }); } - if (requestData === undefined) { + if (!requestData) { requestData = null; } @@ -346,6 +345,9 @@ axios.all = function all(promises) { }; axios.spread = __webpack_require__(/*! ./helpers/spread */ "./node_modules/axios/lib/helpers/spread.js"); +// Expose isAxiosError +axios.isAxiosError = __webpack_require__(/*! ./helpers/isAxiosError */ "./node_modules/axios/lib/helpers/isAxiosError.js"); + module.exports = axios; // Allow use of default import syntax in TypeScript @@ -554,9 +556,10 @@ Axios.prototype.getUri = function getUri(config) { utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) { /*eslint func-names:0*/ Axios.prototype[method] = function(url, config) { - return this.request(utils.merge(config || {}, { + return this.request(mergeConfig(config || {}, { method: method, - url: url + url: url, + data: (config || {}).data })); }; }); @@ -564,7 +567,7 @@ utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { /*eslint func-names:0*/ Axios.prototype[method] = function(url, data, config) { - return this.request(utils.merge(config || {}, { + return this.request(mergeConfig(config || {}, { method: method, url: url, data: data @@ -824,7 +827,7 @@ module.exports = function enhanceError(error, config, code, request, response) { error.response = response; error.isAxiosError = true; - error.toJSON = function() { + error.toJSON = function toJSON() { return { // Standard message: this.message, @@ -873,59 +876,73 @@ module.exports = function mergeConfig(config1, config2) { config2 = config2 || {}; var config = {}; - var valueFromConfig2Keys = ['url', 'method', 'params', 'data']; - var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy']; + var valueFromConfig2Keys = ['url', 'method', 'data']; + var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy', 'params']; var defaultToConfig2Keys = [ - 'baseURL', 'url', 'transformRequest', 'transformResponse', 'paramsSerializer', - 'timeout', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName', - 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', - 'maxContentLength', 'validateStatus', 'maxRedirects', 'httpAgent', - 'httpsAgent', 'cancelToken', 'socketPath' + 'baseURL', 'transformRequest', 'transformResponse', 'paramsSerializer', + 'timeout', 'timeoutMessage', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName', + 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'decompress', + 'maxContentLength', 'maxBodyLength', 'maxRedirects', 'transport', 'httpAgent', + 'httpsAgent', 'cancelToken', 'socketPath', 'responseEncoding' ]; + var directMergeKeys = ['validateStatus']; + + function getMergedValue(target, source) { + if (utils.isPlainObject(target) && utils.isPlainObject(source)) { + return utils.merge(target, source); + } else if (utils.isPlainObject(source)) { + return utils.merge({}, source); + } else if (utils.isArray(source)) { + return source.slice(); + } + return source; + } + + function mergeDeepProperties(prop) { + if (!utils.isUndefined(config2[prop])) { + config[prop] = getMergedValue(config1[prop], config2[prop]); + } else if (!utils.isUndefined(config1[prop])) { + config[prop] = getMergedValue(undefined, config1[prop]); + } + } utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) { - if (typeof config2[prop] !== 'undefined') { - config[prop] = config2[prop]; + if (!utils.isUndefined(config2[prop])) { + config[prop] = getMergedValue(undefined, config2[prop]); } }); - utils.forEach(mergeDeepPropertiesKeys, function mergeDeepProperties(prop) { - if (utils.isObject(config2[prop])) { - config[prop] = utils.deepMerge(config1[prop], config2[prop]); - } else if (typeof config2[prop] !== 'undefined') { - config[prop] = config2[prop]; - } else if (utils.isObject(config1[prop])) { - config[prop] = utils.deepMerge(config1[prop]); - } else if (typeof config1[prop] !== 'undefined') { - config[prop] = config1[prop]; - } - }); + utils.forEach(mergeDeepPropertiesKeys, mergeDeepProperties); utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) { - if (typeof config2[prop] !== 'undefined') { - config[prop] = config2[prop]; - } else if (typeof config1[prop] !== 'undefined') { - config[prop] = config1[prop]; + if (!utils.isUndefined(config2[prop])) { + config[prop] = getMergedValue(undefined, config2[prop]); + } else if (!utils.isUndefined(config1[prop])) { + config[prop] = getMergedValue(undefined, config1[prop]); + } + }); + + utils.forEach(directMergeKeys, function merge(prop) { + if (prop in config2) { + config[prop] = getMergedValue(config1[prop], config2[prop]); + } else if (prop in config1) { + config[prop] = getMergedValue(undefined, config1[prop]); } }); var axiosKeys = valueFromConfig2Keys .concat(mergeDeepPropertiesKeys) - .concat(defaultToConfig2Keys); + .concat(defaultToConfig2Keys) + .concat(directMergeKeys); var otherKeys = Object - .keys(config2) + .keys(config1) + .concat(Object.keys(config2)) .filter(function filterAxiosKeys(key) { return axiosKeys.indexOf(key) === -1; }); - utils.forEach(otherKeys, function otherKeysDefaultToConfig2(prop) { - if (typeof config2[prop] !== 'undefined') { - config[prop] = config2[prop]; - } else if (typeof config1[prop] !== 'undefined') { - config[prop] = config1[prop]; - } - }); + utils.forEach(otherKeys, mergeDeepProperties); return config; }; @@ -954,7 +971,7 @@ var createError = __webpack_require__(/*! ./createError */ "./node_modules/axios */ module.exports = function settle(resolve, reject, response) { var validateStatus = response.config.validateStatus; - if (!validateStatus || validateStatus(response.status)) { + if (!response.status || !validateStatus || validateStatus(response.status)) { resolve(response); } else { reject(createError( @@ -1086,6 +1103,7 @@ var defaults = { xsrfHeaderName: 'X-XSRF-TOKEN', maxContentLength: -1, + maxBodyLength: -1, validateStatus: function validateStatus(status) { return status >= 200 && status < 300; @@ -1149,7 +1167,6 @@ var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/util function encode(val) { return encodeURIComponent(val). - replace(/%40/gi, '@'). replace(/%3A/gi, ':'). replace(/%24/g, '$'). replace(/%2C/gi, ','). @@ -1333,6 +1350,29 @@ module.exports = function isAbsoluteURL(url) { }; +/***/ }), + +/***/ "./node_modules/axios/lib/helpers/isAxiosError.js": +/*!********************************************************!*\ + !*** ./node_modules/axios/lib/helpers/isAxiosError.js ***! + \********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/** + * Determines whether the payload is an error thrown by Axios + * + * @param {*} payload The value to test + * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false + */ +module.exports = function isAxiosError(payload) { + return (typeof payload === 'object') && (payload.isAxiosError === true); +}; + + /***/ }), /***/ "./node_modules/axios/lib/helpers/isURLSameOrigin.js": @@ -1658,6 +1698,21 @@ function isObject(val) { return val !== null && typeof val === 'object'; } +/** + * Determine if a value is a plain Object + * + * @param {Object} val The value to test + * @return {boolean} True if value is a plain Object, otherwise false + */ +function isPlainObject(val) { + if (toString.call(val) !== '[object Object]') { + return false; + } + + var prototype = Object.getPrototypeOf(val); + return prototype === null || prototype === Object.prototype; +} + /** * Determine if a value is a Date * @@ -1814,34 +1869,12 @@ function forEach(obj, fn) { function merge(/* obj1, obj2, obj3, ... */) { var result = {}; function assignValue(val, key) { - if (typeof result[key] === 'object' && typeof val === 'object') { + if (isPlainObject(result[key]) && isPlainObject(val)) { result[key] = merge(result[key], val); - } else { - result[key] = val; - } - } - - for (var i = 0, l = arguments.length; i < l; i++) { - forEach(arguments[i], assignValue); - } - return result; -} - -/** - * Function equal to merge with the difference being that no reference - * to original objects is kept. - * - * @see merge - * @param {Object} obj1 Object to merge - * @returns {Object} Result of all merge properties - */ -function deepMerge(/* obj1, obj2, obj3, ... */) { - var result = {}; - function assignValue(val, key) { - if (typeof result[key] === 'object' && typeof val === 'object') { - result[key] = deepMerge(result[key], val); - } else if (typeof val === 'object') { - result[key] = deepMerge({}, val); + } else if (isPlainObject(val)) { + result[key] = merge({}, val); + } else if (isArray(val)) { + result[key] = val.slice(); } else { result[key] = val; } @@ -1872,6 +1905,19 @@ function extend(a, b, thisArg) { return a; } +/** + * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM) + * + * @param {string} content with BOM + * @return {string} content value without BOM + */ +function stripBOM(content) { + if (content.charCodeAt(0) === 0xFEFF) { + content = content.slice(1); + } + return content; +} + module.exports = { isArray: isArray, isArrayBuffer: isArrayBuffer, @@ -1881,6 +1927,7 @@ module.exports = { isString: isString, isNumber: isNumber, isObject: isObject, + isPlainObject: isPlainObject, isUndefined: isUndefined, isDate: isDate, isFile: isFile, @@ -1891,9 +1938,9 @@ module.exports = { isStandardBrowserEnv: isStandardBrowserEnv, forEach: forEach, merge: merge, - deepMerge: deepMerge, extend: extend, - trim: trim + trim: trim, + stripBOM: stripBOM }; @@ -2211,20 +2258,89 @@ __webpack_require__.r(__webpack_exports__); // // // +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// /* harmony default export */ __webpack_exports__["default"] = ({ - props: ['dbpanier'], + props: [], computed: { emptybasket: function emptybasket() { - return _.isEmpty(this.panier); + return _.isEmpty(this.$store.state.panier); + }, + panier: function panier() { + return this.$store.state.panier; + }, + cartTotals: function cartTotals() { + return this.$store.state.cartTotals; } }, watch: {}, data: function data() { return { - panier: {}, processing: false, success: false, errors: false, + showConfirmEmpty: false, response: '' }; }, @@ -2234,40 +2350,93 @@ __webpack_require__.r(__webpack_exports__); }, methods: { init: function init() { - this.panier = JSON.parse(this.dbpanier); + var _this = this; + + axios.post('/ajax/get-cart').then(function (response) { + var result = response.data; + + _this.updateStore(result); + })["catch"](function (error) { + console.log(error); + }); }, addtocart: function addtocart(product_id, qtty) { - var current; + var _this2 = this; + + var breaker = false; this.panier.forEach(function (element) { if (element.cartItem.id == product_id) { - current = element; + element.cartItem.qty += qtty; + } + + if (element.cartItem.qty == 0) { + _this2.removeItem(element.cartItem.rowId); + + breaker = true; } }); - current.cartItem.qty += qtty; - axios.post('/ajax/add-to-cart', { - id: product_id, - qty: qtty - }).then(function (response) {// let result = response.data; - // switch (result) { - // case 0: case 2: - // // 0 = Supprimé, 2 = Pas encore en base, supprimer juste dans la vue - // this.response = "Suppression terminée !"; - // this.myobjectives.splice(index, 1); - // this.processing = false; - // break; - // case 3: - // // 1 = Non supprimer car pa autorisé - // this.response = "Erreur : Suppression impossible"; - // setTimeout(function() { - // this.processing = false; - // }.bind(this), 1500); - // break; - // } + + if (!breaker) { + axios.post('/ajax/add-to-cart', { + id: product_id, + qty: qtty + }).then(function (response) { + var result = response.data; + + _this2.updateStore(result); + })["catch"](function (error) { + console.log(error); + this.response = "Erreur lors de la modification du panier."; + this.processing = false; + }); + } + }, + removeItem: function removeItem(rowId) { + var _this3 = this; + + axios.post('/ajax/remove-from-cart', { + rowId: rowId + }).then(function (response) { + var result = response.data; + + _this3.updateStore(result); })["catch"](function (error) { console.log(error); this.response = "Erreur lors de la modification du panier."; this.processing = false; }); + }, + emptyCart: function emptyCart() { + var _this4 = this; + + //masquer la modale + this.showConfirmEmpty = false; + axios.post('/ajax/empty-cart', {}).then(function (response) { + var result = response.data; + + _this4.updateStore(result); + })["catch"](function (error) { + console.log(error); + this.response = "Erreur lors de la modification du panier."; + this.processing = false; + }); + }, + confirmEmpty: function confirmEmpty() { + //afficher la modale + this.showConfirmEmpty = true; + }, + updateStore: function updateStore(result) { + if (result[0].length != this.panier.length) { + this.$store.commit({ + type: 'updatePanier', + panier: result[0] + }); + } + + this.$store.commit({ + type: 'updateCartTotals', + cartTotals: result[1] + }); } } }); @@ -40804,7 +40973,7 @@ var render = function() { d: "M67.4825143,78.9167 C67.1623695,75.2609992 63.9936654,72.5223307 60.3301407,72.7349996 C56.666616,72.9476685 53.8360896,76.0345943 53.9410992,79.7027838 C54.0461088,83.3709734 57.0485945,86.290917 60.7182857,86.2936571 C60.9149914,86.2936571 61.1142171,86.2852829 61.3142657,86.2677029 C65.0455789,85.9373988 67.8051492,82.6486842 67.4825143,78.9167 L67.4825143,78.9167 Z M60.72498,75.7225057 C62.7822657,75.7244759 64.4609671,77.3699124 64.5041075,79.4267467 C64.5472479,81.483581 62.9390159,83.1979583 60.8836221,83.2861886 C58.8282283,83.3744189 57.0789994,81.8041647 56.9457217,79.7511997 C56.812444,77.6982346 58.3439652,75.9149954 60.3935143,75.7367343 C60.5048571,75.7275286 60.6153257,75.7225057 60.72498,75.7225057 L60.72498,75.7225057 Z", id: "Shape", - fill: "#095BA5", + fill: "#a8be36", "fill-rule": "nonzero" } }), @@ -40823,7 +40992,7 @@ var render = function() { d: "M92.1237,77.21162 C91.8041941,73.5554324 88.6354676,70.8159573 84.9714933,71.0282865 C81.307519,71.2406158 78.4764495,74.3277824 78.5814201,77.9964024 C78.6863908,81.6650224 81.6893508,84.5852592 85.3594714,84.5877371 C85.5561771,84.5877371 85.7553943,84.5793714 85.9554514,84.5617914 C89.6862934,84.2312527 92.4456064,80.9432167 92.1237,77.21162 L92.1237,77.21162 Z M85.3670057,74.0174257 C87.4240987,74.0202982 89.1019847,75.6661962 89.1444478,77.7228528 C89.1869109,79.7795095 87.5783904,81.4932608 85.5231691,81.5810388 C83.4679477,81.6688168 81.7191636,80.0984551 81.5861133,78.0456674 C81.453063,75.9928797 82.9845031,74.2099122 85.03386,74.0316543 C85.146,74.0216171 85.2565114,74.0174257 85.3670057,74.0174257 L85.3670057,74.0174257 Z", id: "Shape", - fill: "#095BA5", + fill: "#a8be36", "fill-rule": "nonzero" } }), @@ -40868,7 +41037,7 @@ var render = function() { attrs: { d: "M102.496466,20.7774714 C101.176696,19.3739105 99.2874161,18.6511315 97.3678371,18.81542 L36.4152771,23.8871429 C34.0360432,24.0735451 31.8918619,25.3934501 30.6538371,27.4337429 C30.6421114,27.4521543 30.6312343,27.4706 30.6203486,27.4889857 L29.7774429,25.4336 L26.0985857,17.40584 C24.8631842,14.3865739 22.4304508,12.0152173 19.3806086,10.8573543 C19.2355106,9.29582331 18.1587245,7.97791436 16.6574657,7.52442286 L5.43926571,4.14396286 C3.39963316,3.52911608 1.24775249,4.68413316 0.632905714,6.72376571 C0.018058937,8.76339827 1.17307602,10.9152789 3.21270857,11.5301257 L14.4309,14.91056 C15.895449,15.3549549 17.4839357,14.8842165 18.4698943,13.7136286 C20.6902631,14.6144705 22.4502183,16.377494 23.3471914,18.5994286 L27.0260486,26.6271886 L29.92812,33.7078229 C29.9808514,33.8647714 30.0386057,34.0207429 30.1013829,34.1757371 L31.3787314,37.3105057 C31.4133271,37.3949714 31.455343,37.4762036 31.5042857,37.5532486 L42.5433429,64.4833914 C43.6104623,67.1123374 46.1664564,68.8304612 49.0037229,68.8260286 C49.2088029,68.8260286 49.4163857,68.8168143 49.6248171,68.7984029 L93.0561771,64.9990143 C96.2940927,64.7252758 98.9133024,62.2505026 99.3700714,59.0333 L104.150486,26.01572 C104.43193,24.1083549 103.822202,22.177356 102.496466,20.7774714 Z M64.1744657,64.5144629 L54.8674886,25.36238 L80.1663857,23.2572371 L77.8059,63.3219629 L64.1744657,64.5144629 Z M49.3636371,65.81012 C47.6203783,65.9657102 45.979622,64.9656964 45.3189943,63.3449771 L32.7514886,32.6891429 C32.3456441,31.3885638 32.5522698,29.9740603 33.3131857,28.8439176 C34.0741015,27.7137748 35.3069939,26.9902482 36.6647143,26.8770629 L51.8443714,25.6139514 L61.1544943,64.7786429 L49.3636371,65.81012 Z M101.182286,25.5855114 L96.4010314,58.6030829 C96.1399459,60.4404711 94.6442385,61.8539057 92.7950314,62.0107314 L80.8268571,63.0577143 L83.1865114,23.0058971 L97.6189886,21.8049371 C98.6271159,21.7196868 99.6190517,22.0990713 100.312986,22.8353072 C101.006921,23.5715431 101.327014,24.584168 101.182329,25.5854943 L101.182286,25.5855114 Z", - fill: "#095BA5", + fill: "#a8be36", "fill-rule": "nonzero" } }) @@ -40889,19 +41058,7 @@ var render = function() { _vm._v(" "), _c("h2", { staticClass: "title" }, [ _vm._v("Votre panier est vide...") - ]), - _vm._v(" "), - _c("div", { staticClass: "cart-item__text" }, [ - _vm._v( - "\n Besoin d’idées pour commencer ?\n " - ) - ]), - _vm._v(" "), - _c("button", { staticClass: "btn btn_blue" }, [ - _vm._v("Voir mes achats fréquents") - ]), - _vm._v(" "), - _vm._m(1) + ]) ]) ] ), @@ -40919,7 +41076,7 @@ var render = function() { ], staticClass: "basket-panel__header" }, - [_vm._m(2), _vm._v(" "), _vm._m(3)] + [_vm._m(1), _vm._v(" "), _vm._m(2)] ), _vm._v(" "), _c( @@ -40935,7 +41092,7 @@ var render = function() { ], staticClass: "message-box" }, - [_vm._m(4)] + [_vm._m(3)] ), _vm._v(" "), _c("div", { @@ -41043,8 +41200,6 @@ var render = function() { attrs: { id: "boissons" } }, [ - _vm._m(5), - _vm._v(" "), _c("div", [ _c( "ol", @@ -41066,9 +41221,34 @@ var render = function() { } }, [ - _vm._m(6, true), + _c( + "div", + { + staticClass: + "ds-product-card--largehorizontal-icons" + }, + [ + _c("div", { + staticClass: + "product-card-delete", + attrs: { + title: "Supprimer" + }, + on: { + click: function( + $event + ) { + return _vm.removeItem( + item.cartItem + .rowId + ) + } + } + }) + ] + ), _vm._v(" "), - _vm._m(7, true), + _vm._m(4, true), _vm._v(" "), _c( "div", @@ -41150,6 +41330,20 @@ var render = function() { _c( "div", { + directives: [ + { + name: + "show", + rawName: + "v-show", + value: + item + .cartItem + .weight, + expression: + "item.cartItem.weight" + } + ], staticClass: "ds-format ds-product-card__shimzone--small" }, @@ -41161,6 +41355,12 @@ var render = function() { .cartItem .weight ) + + " " + + _vm._s( + item + .product + .weight_unit + ) + "\n " ) ] @@ -41463,7 +41663,7 @@ var render = function() { " " ), _vm._m( - 8, + 5, true ) ] @@ -41491,10 +41691,223 @@ var render = function() { ] ) ] - ) + ), + _vm._v(" "), + _c("div", { staticClass: "products-brief" }, [ + _c("section", { + staticClass: "products-brief__top-section" + }), + _vm._v(" "), + _c("div", {}, [ + _c("section", { staticClass: "products-brief__box" }, [ + _c( + "dl", + { + staticClass: + "products-brief-data products-brief--items" + }, + [ + _vm._m(6), + _vm._v(" "), + _c("dd", [ + _c( + "div", + { + staticClass: + "ds-body-text ds-body-text--weight-bold ds-body-text--size-m" + }, + [ + _vm._v( + "\n " + + _vm._s(_vm.cartTotals.totalTTC) + + " €\n " + ) + ] + ) + ]) + ] + ), + _vm._v(" "), + _c("div", { staticClass: "products-brief__slot" }, [ + _c( + "div", + { + staticClass: + "checkout-clear-basket basket-panel__clear-basket" + }, + [ + _c( + "div", + { + staticClass: + "checkout-clear-basket__actions", + attrs: { id: "data-clear-basket" } + }, + [ + _c( + "button", + { + staticClass: + "pl-button checkout-clear-basket__cta pl-button--tertiary pl-button--small", + on: { + click: function($event) { + return _vm.confirmEmpty() + } + } + }, + [ + _c( + "span", + { staticClass: "pl-button__label" }, + [ + _c( + "svg", + { + staticClass: + "checkout-clear-basket__icon svg-icon svg-icon--m svg-icon--color-interactive-1", + attrs: { "aria-hidden": "true" } + }, + [ + _c("use", { + attrs: { + "xlink:href": "#i13" + } + }) + ] + ), + _vm._v( + "\n Vider le panier\n " + ) + ] + ) + ] + ) + ] + ), + _vm._v(" "), + _c( + "div", + { + staticClass: "checkout-clear-basket__modal", + attrs: { id: "empty-basket-modal" } + }, + [ + _c( + "div", + { + directives: [ + { + name: "show", + rawName: "v-show", + value: _vm.showConfirmEmpty, + expression: "showConfirmEmpty" + } + ], + staticClass: "modal" + }, + [ + _c( + "div", + { staticClass: "modal__container" }, + [ + _vm._m(7), + _vm._v(" "), + _c( + "div", + { staticClass: "modal__action" }, + [ + _c("div", [ + _c( + "button", + { + staticClass: "ds-button", + attrs: { + id: + "checkout-empty-basket-confirm" + } + }, + [ + _c( + "span", + { + staticClass: + "ds-button__label", + on: { + click: function( + $event + ) { + return _vm.emptyCart() + } + } + }, + [ + _vm._v( + "\n Oui, vider mon panier\n " + ) + ] + ) + ] + ), + _vm._v(" "), + _vm._m(8) + ]) + ] + ) + ] + ) + ] + ) + ] + ) + ] + ) + ]), + _vm._v(" "), + _vm._m(9) + ]) + ]) + ]) ]), _vm._v(" "), - _vm._m(9) + _c( + "div", + { + staticClass: "cart-tile__bottom cart-tile__bottom--fixed" + }, + [ + _c("div", { staticClass: "cart-tile__price" }, [ + _c( + "h2", + { + staticClass: + "ds-title ds-title--bold ds-title--s ds-title--bright" + }, + [ + _vm._v( + "\n Total\n " + ) + ] + ), + _vm._v(" "), + _c( + "h2", + { + staticClass: + "ds-title ds-title--bold ds-title--m ds-title--bright" + }, + [ + _vm._v( + "\n " + + _vm._s(_vm.cartTotals.totalTTC) + + " €\n " + ) + ] + ) + ]), + _vm._v(" "), + _vm._m(10) + ] + ) ] ) ] @@ -41571,20 +41984,6 @@ var staticRenderFns = [ ] ) }, - function() { - var _vm = this - var _h = _vm.$createElement - var _c = _vm._self._c || _h - return _c("div", { staticClass: "empty-basket__action" }, [ - _c("button", { staticClass: "btn btn_white" }, [ - _c("span", {}, [_vm._v("Commencer mes courses")]) - ]), - _vm._v(" "), - _c("button", { staticClass: "btn btn_white" }, [ - _c("span", {}, [_vm._v("voir les promotions")]) - ]) - ]) - }, function() { var _vm = this var _h = _vm.$createElement @@ -41636,13 +42035,13 @@ var staticRenderFns = [ _vm._v(" "), _c("div", { staticClass: "message-box__actions" }, [ _c("div", [ - _c("a", { attrs: { href: "/mon-compte/login" } }, [ + _c("a", { attrs: { href: "/se-connecter" } }, [ _vm._v( "\n Me connecter\n " ) ]), _vm._v(" "), - _c("a", { attrs: { href: "/mon-compte/inscription" } }, [ + _c("a", { attrs: { href: "/inscription" } }, [ _vm._v( "\n Créer mon compte\n " ) @@ -41651,59 +42050,6 @@ var staticRenderFns = [ ]) ]) }, - function() { - var _vm = this - var _h = _vm.$createElement - var _c = _vm._self._c || _h - return _c( - "div", - { - staticClass: - "category-heading__header category-heading__header--collapsable" - }, - [ - _c("h2", { staticClass: "category-heading__title title title_xs" }, [ - _vm._v( - "\n Boissons " - ) - ]), - _vm._v(" "), - _c("div", { staticClass: "category-heading__left-content" }, [ - _c( - "div", - { - staticClass: "ds-badge category-heading__badge", - attrs: { "data-testid": "category-quantity-badge" } - }, - [ - _vm._v( - "\n 1 " - ) - ] - ), - _vm._v(" "), - _c("span", { - staticClass: "ds-chevron category-heading__chevron ds-chevron--s" - }) - ]) - ] - ) - }, - function() { - var _vm = this - var _h = _vm.$createElement - var _c = _vm._self._c || _h - return _c( - "div", - { staticClass: "ds-product-card--largehorizontal-icons" }, - [ - _c("div", { - staticClass: "product-card-delete", - attrs: { title: "Supprimer" } - }) - ] - ) - }, function() { var _vm = this var _h = _vm.$createElement @@ -41741,55 +42087,80 @@ var staticRenderFns = [ [_c("span", { staticClass: "promotion-feedback__content" })] ) }, + function() { + var _vm = this + var _h = _vm.$createElement + var _c = _vm._self._c || _h + return _c("dt", [ + _c("div", { staticClass: "ds-body-text ds-body-text--size-m" }, [ + _vm._v("Total produits") + ]) + ]) + }, + function() { + var _vm = this + var _h = _vm.$createElement + var _c = _vm._self._c || _h + return _c("div", { staticClass: "modal__body" }, [ + _c("div", { staticClass: "checkout-clear-basket__modal__title" }, [ + _vm._v( + "\n Voulez-vous réellement vider votre panier ?\n " + ) + ]) + ]) + }, + function() { + var _vm = this + var _h = _vm.$createElement + var _c = _vm._self._c || _h + return _c( + "button", + { + staticClass: "ds-button ds-button--tertiary", + attrs: { id: "checkout-empty-basket-cancel" } + }, + [_c("span", { staticClass: "ds-button__label" }, [_vm._v("Annuler")])] + ) + }, function() { var _vm = this var _h = _vm.$createElement var _c = _vm._self._c || _h return _c( "div", - { staticClass: "cart-tile__bottom cart-tile__bottom--fixed" }, + { + staticClass: "checkout-loyalty-info", + staticStyle: { display: "none" }, + attrs: { "loyalties-desactivated": "true" } + }, [ - _c("div", { staticClass: "cart-tile__price" }, [ - _c( - "h2", - { - staticClass: - "ds-title ds-title--bold ds-title--s ds-title--bright" - }, - [ + _c("div", { staticClass: "checkout-loyalty-info__loyalty" }, [ + _c("section", { staticClass: "checkout-loyalty-info__top-section" }, [ + _c("h3", { staticClass: "ds-title ds-title--bold ds-title--xs" }, [ _vm._v( - "\n Total\n " + "\n Avantages fidélité\n " ) - ] - ), - _vm._v(" "), - _c( - "h2", - { - staticClass: - "ds-title ds-title--bold ds-title--m ds-title--bright" - }, - [ - _vm._v( - "\n 50,64€\n " - ) - ] - ) - ]), - _vm._v(" "), - _c( - "button", - { staticClass: "pl-button pl-button--primary pl-button--light" }, - [ - _c("a", { attrs: { href: "tunnel-1.php" } }, [ - _c("span", { staticClass: "pl-button__label" }, [ - _vm._v( - "\n Commander\n " - ) - ]) ]) - ] - ) + ]) + ]) + ] + ) + }, + function() { + var _vm = this + var _h = _vm.$createElement + var _c = _vm._self._c || _h + return _c( + "button", + { staticClass: "pl-button pl-button--primary pl-button--light" }, + [ + _c("a", { attrs: { href: "tunnel-1.php" } }, [ + _c("span", { staticClass: "pl-button__label" }, [ + _vm._v( + "\n Commander\n " + ) + ]) + ]) ] ) } @@ -54050,6 +54421,1271 @@ if (false) {} else { } +/***/ }), + +/***/ "./node_modules/vuex/dist/vuex.esm.js": +/*!********************************************!*\ + !*** ./node_modules/vuex/dist/vuex.esm.js ***! + \********************************************/ +/*! exports provided: default, Store, createLogger, createNamespacedHelpers, install, mapActions, mapGetters, mapMutations, mapState */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* WEBPACK VAR INJECTION */(function(global) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Store", function() { return Store; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createLogger", function() { return createLogger; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createNamespacedHelpers", function() { return createNamespacedHelpers; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "install", function() { return install; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mapActions", function() { return mapActions; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mapGetters", function() { return mapGetters; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mapMutations", function() { return mapMutations; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mapState", function() { return mapState; }); +/*! + * vuex v3.6.2 + * (c) 2021 Evan You + * @license MIT + */ +function applyMixin (Vue) { + var version = Number(Vue.version.split('.')[0]); + + if (version >= 2) { + Vue.mixin({ beforeCreate: vuexInit }); + } else { + // override init and inject vuex init procedure + // for 1.x backwards compatibility. + var _init = Vue.prototype._init; + Vue.prototype._init = function (options) { + if ( options === void 0 ) options = {}; + + options.init = options.init + ? [vuexInit].concat(options.init) + : vuexInit; + _init.call(this, options); + }; + } + + /** + * Vuex init hook, injected into each instances init hooks list. + */ + + function vuexInit () { + var options = this.$options; + // store injection + if (options.store) { + this.$store = typeof options.store === 'function' + ? options.store() + : options.store; + } else if (options.parent && options.parent.$store) { + this.$store = options.parent.$store; + } + } +} + +var target = typeof window !== 'undefined' + ? window + : typeof global !== 'undefined' + ? global + : {}; +var devtoolHook = target.__VUE_DEVTOOLS_GLOBAL_HOOK__; + +function devtoolPlugin (store) { + if (!devtoolHook) { return } + + store._devtoolHook = devtoolHook; + + devtoolHook.emit('vuex:init', store); + + devtoolHook.on('vuex:travel-to-state', function (targetState) { + store.replaceState(targetState); + }); + + store.subscribe(function (mutation, state) { + devtoolHook.emit('vuex:mutation', mutation, state); + }, { prepend: true }); + + store.subscribeAction(function (action, state) { + devtoolHook.emit('vuex:action', action, state); + }, { prepend: true }); +} + +/** + * Get the first item that pass the test + * by second argument function + * + * @param {Array} list + * @param {Function} f + * @return {*} + */ +function find (list, f) { + return list.filter(f)[0] +} + +/** + * Deep copy the given object considering circular structure. + * This function caches all nested objects and its copies. + * If it detects circular structure, use cached copy to avoid infinite loop. + * + * @param {*} obj + * @param {Array} cache + * @return {*} + */ +function deepCopy (obj, cache) { + if ( cache === void 0 ) cache = []; + + // just return if obj is immutable value + if (obj === null || typeof obj !== 'object') { + return obj + } + + // if obj is hit, it is in circular structure + var hit = find(cache, function (c) { return c.original === obj; }); + if (hit) { + return hit.copy + } + + var copy = Array.isArray(obj) ? [] : {}; + // put the copy into cache at first + // because we want to refer it in recursive deepCopy + cache.push({ + original: obj, + copy: copy + }); + + Object.keys(obj).forEach(function (key) { + copy[key] = deepCopy(obj[key], cache); + }); + + return copy +} + +/** + * forEach for object + */ +function forEachValue (obj, fn) { + Object.keys(obj).forEach(function (key) { return fn(obj[key], key); }); +} + +function isObject (obj) { + return obj !== null && typeof obj === 'object' +} + +function isPromise (val) { + return val && typeof val.then === 'function' +} + +function assert (condition, msg) { + if (!condition) { throw new Error(("[vuex] " + msg)) } +} + +function partial (fn, arg) { + return function () { + return fn(arg) + } +} + +// Base data struct for store's module, package with some attribute and method +var Module = function Module (rawModule, runtime) { + this.runtime = runtime; + // Store some children item + this._children = Object.create(null); + // Store the origin module object which passed by programmer + this._rawModule = rawModule; + var rawState = rawModule.state; + + // Store the origin module's state + this.state = (typeof rawState === 'function' ? rawState() : rawState) || {}; +}; + +var prototypeAccessors = { namespaced: { configurable: true } }; + +prototypeAccessors.namespaced.get = function () { + return !!this._rawModule.namespaced +}; + +Module.prototype.addChild = function addChild (key, module) { + this._children[key] = module; +}; + +Module.prototype.removeChild = function removeChild (key) { + delete this._children[key]; +}; + +Module.prototype.getChild = function getChild (key) { + return this._children[key] +}; + +Module.prototype.hasChild = function hasChild (key) { + return key in this._children +}; + +Module.prototype.update = function update (rawModule) { + this._rawModule.namespaced = rawModule.namespaced; + if (rawModule.actions) { + this._rawModule.actions = rawModule.actions; + } + if (rawModule.mutations) { + this._rawModule.mutations = rawModule.mutations; + } + if (rawModule.getters) { + this._rawModule.getters = rawModule.getters; + } +}; + +Module.prototype.forEachChild = function forEachChild (fn) { + forEachValue(this._children, fn); +}; + +Module.prototype.forEachGetter = function forEachGetter (fn) { + if (this._rawModule.getters) { + forEachValue(this._rawModule.getters, fn); + } +}; + +Module.prototype.forEachAction = function forEachAction (fn) { + if (this._rawModule.actions) { + forEachValue(this._rawModule.actions, fn); + } +}; + +Module.prototype.forEachMutation = function forEachMutation (fn) { + if (this._rawModule.mutations) { + forEachValue(this._rawModule.mutations, fn); + } +}; + +Object.defineProperties( Module.prototype, prototypeAccessors ); + +var ModuleCollection = function ModuleCollection (rawRootModule) { + // register root module (Vuex.Store options) + this.register([], rawRootModule, false); +}; + +ModuleCollection.prototype.get = function get (path) { + return path.reduce(function (module, key) { + return module.getChild(key) + }, this.root) +}; + +ModuleCollection.prototype.getNamespace = function getNamespace (path) { + var module = this.root; + return path.reduce(function (namespace, key) { + module = module.getChild(key); + return namespace + (module.namespaced ? key + '/' : '') + }, '') +}; + +ModuleCollection.prototype.update = function update$1 (rawRootModule) { + update([], this.root, rawRootModule); +}; + +ModuleCollection.prototype.register = function register (path, rawModule, runtime) { + var this$1 = this; + if ( runtime === void 0 ) runtime = true; + + if ((true)) { + assertRawModule(path, rawModule); + } + + var newModule = new Module(rawModule, runtime); + if (path.length === 0) { + this.root = newModule; + } else { + var parent = this.get(path.slice(0, -1)); + parent.addChild(path[path.length - 1], newModule); + } + + // register nested modules + if (rawModule.modules) { + forEachValue(rawModule.modules, function (rawChildModule, key) { + this$1.register(path.concat(key), rawChildModule, runtime); + }); + } +}; + +ModuleCollection.prototype.unregister = function unregister (path) { + var parent = this.get(path.slice(0, -1)); + var key = path[path.length - 1]; + var child = parent.getChild(key); + + if (!child) { + if ((true)) { + console.warn( + "[vuex] trying to unregister module '" + key + "', which is " + + "not registered" + ); + } + return + } + + if (!child.runtime) { + return + } + + parent.removeChild(key); +}; + +ModuleCollection.prototype.isRegistered = function isRegistered (path) { + var parent = this.get(path.slice(0, -1)); + var key = path[path.length - 1]; + + if (parent) { + return parent.hasChild(key) + } + + return false +}; + +function update (path, targetModule, newModule) { + if ((true)) { + assertRawModule(path, newModule); + } + + // update target module + targetModule.update(newModule); + + // update nested modules + if (newModule.modules) { + for (var key in newModule.modules) { + if (!targetModule.getChild(key)) { + if ((true)) { + console.warn( + "[vuex] trying to add a new module '" + key + "' on hot reloading, " + + 'manual reload is needed' + ); + } + return + } + update( + path.concat(key), + targetModule.getChild(key), + newModule.modules[key] + ); + } + } +} + +var functionAssert = { + assert: function (value) { return typeof value === 'function'; }, + expected: 'function' +}; + +var objectAssert = { + assert: function (value) { return typeof value === 'function' || + (typeof value === 'object' && typeof value.handler === 'function'); }, + expected: 'function or object with "handler" function' +}; + +var assertTypes = { + getters: functionAssert, + mutations: functionAssert, + actions: objectAssert +}; + +function assertRawModule (path, rawModule) { + Object.keys(assertTypes).forEach(function (key) { + if (!rawModule[key]) { return } + + var assertOptions = assertTypes[key]; + + forEachValue(rawModule[key], function (value, type) { + assert( + assertOptions.assert(value), + makeAssertionMessage(path, key, type, value, assertOptions.expected) + ); + }); + }); +} + +function makeAssertionMessage (path, key, type, value, expected) { + var buf = key + " should be " + expected + " but \"" + key + "." + type + "\""; + if (path.length > 0) { + buf += " in module \"" + (path.join('.')) + "\""; + } + buf += " is " + (JSON.stringify(value)) + "."; + return buf +} + +var Vue; // bind on install + +var Store = function Store (options) { + var this$1 = this; + if ( options === void 0 ) options = {}; + + // Auto install if it is not done yet and `window` has `Vue`. + // To allow users to avoid auto-installation in some cases, + // this code should be placed here. See #731 + if (!Vue && typeof window !== 'undefined' && window.Vue) { + install(window.Vue); + } + + if ((true)) { + assert(Vue, "must call Vue.use(Vuex) before creating a store instance."); + assert(typeof Promise !== 'undefined', "vuex requires a Promise polyfill in this browser."); + assert(this instanceof Store, "store must be called with the new operator."); + } + + var plugins = options.plugins; if ( plugins === void 0 ) plugins = []; + var strict = options.strict; if ( strict === void 0 ) strict = false; + + // store internal state + this._committing = false; + this._actions = Object.create(null); + this._actionSubscribers = []; + this._mutations = Object.create(null); + this._wrappedGetters = Object.create(null); + this._modules = new ModuleCollection(options); + this._modulesNamespaceMap = Object.create(null); + this._subscribers = []; + this._watcherVM = new Vue(); + this._makeLocalGettersCache = Object.create(null); + + // bind commit and dispatch to self + var store = this; + var ref = this; + var dispatch = ref.dispatch; + var commit = ref.commit; + this.dispatch = function boundDispatch (type, payload) { + return dispatch.call(store, type, payload) + }; + this.commit = function boundCommit (type, payload, options) { + return commit.call(store, type, payload, options) + }; + + // strict mode + this.strict = strict; + + var state = this._modules.root.state; + + // init root module. + // this also recursively registers all sub-modules + // and collects all module getters inside this._wrappedGetters + installModule(this, state, [], this._modules.root); + + // initialize the store vm, which is responsible for the reactivity + // (also registers _wrappedGetters as computed properties) + resetStoreVM(this, state); + + // apply plugins + plugins.forEach(function (plugin) { return plugin(this$1); }); + + var useDevtools = options.devtools !== undefined ? options.devtools : Vue.config.devtools; + if (useDevtools) { + devtoolPlugin(this); + } +}; + +var prototypeAccessors$1 = { state: { configurable: true } }; + +prototypeAccessors$1.state.get = function () { + return this._vm._data.$$state +}; + +prototypeAccessors$1.state.set = function (v) { + if ((true)) { + assert(false, "use store.replaceState() to explicit replace store state."); + } +}; + +Store.prototype.commit = function commit (_type, _payload, _options) { + var this$1 = this; + + // check object-style commit + var ref = unifyObjectStyle(_type, _payload, _options); + var type = ref.type; + var payload = ref.payload; + var options = ref.options; + + var mutation = { type: type, payload: payload }; + var entry = this._mutations[type]; + if (!entry) { + if ((true)) { + console.error(("[vuex] unknown mutation type: " + type)); + } + return + } + this._withCommit(function () { + entry.forEach(function commitIterator (handler) { + handler(payload); + }); + }); + + this._subscribers + .slice() // shallow copy to prevent iterator invalidation if subscriber synchronously calls unsubscribe + .forEach(function (sub) { return sub(mutation, this$1.state); }); + + if ( + ( true) && + options && options.silent + ) { + console.warn( + "[vuex] mutation type: " + type + ". Silent option has been removed. " + + 'Use the filter functionality in the vue-devtools' + ); + } +}; + +Store.prototype.dispatch = function dispatch (_type, _payload) { + var this$1 = this; + + // check object-style dispatch + var ref = unifyObjectStyle(_type, _payload); + var type = ref.type; + var payload = ref.payload; + + var action = { type: type, payload: payload }; + var entry = this._actions[type]; + if (!entry) { + if ((true)) { + console.error(("[vuex] unknown action type: " + type)); + } + return + } + + try { + this._actionSubscribers + .slice() // shallow copy to prevent iterator invalidation if subscriber synchronously calls unsubscribe + .filter(function (sub) { return sub.before; }) + .forEach(function (sub) { return sub.before(action, this$1.state); }); + } catch (e) { + if ((true)) { + console.warn("[vuex] error in before action subscribers: "); + console.error(e); + } + } + + var result = entry.length > 1 + ? Promise.all(entry.map(function (handler) { return handler(payload); })) + : entry[0](payload); + + return new Promise(function (resolve, reject) { + result.then(function (res) { + try { + this$1._actionSubscribers + .filter(function (sub) { return sub.after; }) + .forEach(function (sub) { return sub.after(action, this$1.state); }); + } catch (e) { + if ((true)) { + console.warn("[vuex] error in after action subscribers: "); + console.error(e); + } + } + resolve(res); + }, function (error) { + try { + this$1._actionSubscribers + .filter(function (sub) { return sub.error; }) + .forEach(function (sub) { return sub.error(action, this$1.state, error); }); + } catch (e) { + if ((true)) { + console.warn("[vuex] error in error action subscribers: "); + console.error(e); + } + } + reject(error); + }); + }) +}; + +Store.prototype.subscribe = function subscribe (fn, options) { + return genericSubscribe(fn, this._subscribers, options) +}; + +Store.prototype.subscribeAction = function subscribeAction (fn, options) { + var subs = typeof fn === 'function' ? { before: fn } : fn; + return genericSubscribe(subs, this._actionSubscribers, options) +}; + +Store.prototype.watch = function watch (getter, cb, options) { + var this$1 = this; + + if ((true)) { + assert(typeof getter === 'function', "store.watch only accepts a function."); + } + return this._watcherVM.$watch(function () { return getter(this$1.state, this$1.getters); }, cb, options) +}; + +Store.prototype.replaceState = function replaceState (state) { + var this$1 = this; + + this._withCommit(function () { + this$1._vm._data.$$state = state; + }); +}; + +Store.prototype.registerModule = function registerModule (path, rawModule, options) { + if ( options === void 0 ) options = {}; + + if (typeof path === 'string') { path = [path]; } + + if ((true)) { + assert(Array.isArray(path), "module path must be a string or an Array."); + assert(path.length > 0, 'cannot register the root module by using registerModule.'); + } + + this._modules.register(path, rawModule); + installModule(this, this.state, path, this._modules.get(path), options.preserveState); + // reset store to update getters... + resetStoreVM(this, this.state); +}; + +Store.prototype.unregisterModule = function unregisterModule (path) { + var this$1 = this; + + if (typeof path === 'string') { path = [path]; } + + if ((true)) { + assert(Array.isArray(path), "module path must be a string or an Array."); + } + + this._modules.unregister(path); + this._withCommit(function () { + var parentState = getNestedState(this$1.state, path.slice(0, -1)); + Vue.delete(parentState, path[path.length - 1]); + }); + resetStore(this); +}; + +Store.prototype.hasModule = function hasModule (path) { + if (typeof path === 'string') { path = [path]; } + + if ((true)) { + assert(Array.isArray(path), "module path must be a string or an Array."); + } + + return this._modules.isRegistered(path) +}; + +Store.prototype.hotUpdate = function hotUpdate (newOptions) { + this._modules.update(newOptions); + resetStore(this, true); +}; + +Store.prototype._withCommit = function _withCommit (fn) { + var committing = this._committing; + this._committing = true; + fn(); + this._committing = committing; +}; + +Object.defineProperties( Store.prototype, prototypeAccessors$1 ); + +function genericSubscribe (fn, subs, options) { + if (subs.indexOf(fn) < 0) { + options && options.prepend + ? subs.unshift(fn) + : subs.push(fn); + } + return function () { + var i = subs.indexOf(fn); + if (i > -1) { + subs.splice(i, 1); + } + } +} + +function resetStore (store, hot) { + store._actions = Object.create(null); + store._mutations = Object.create(null); + store._wrappedGetters = Object.create(null); + store._modulesNamespaceMap = Object.create(null); + var state = store.state; + // init all modules + installModule(store, state, [], store._modules.root, true); + // reset vm + resetStoreVM(store, state, hot); +} + +function resetStoreVM (store, state, hot) { + var oldVm = store._vm; + + // bind store public getters + store.getters = {}; + // reset local getters cache + store._makeLocalGettersCache = Object.create(null); + var wrappedGetters = store._wrappedGetters; + var computed = {}; + forEachValue(wrappedGetters, function (fn, key) { + // use computed to leverage its lazy-caching mechanism + // direct inline function use will lead to closure preserving oldVm. + // using partial to return function with only arguments preserved in closure environment. + computed[key] = partial(fn, store); + Object.defineProperty(store.getters, key, { + get: function () { return store._vm[key]; }, + enumerable: true // for local getters + }); + }); + + // use a Vue instance to store the state tree + // suppress warnings just in case the user has added + // some funky global mixins + var silent = Vue.config.silent; + Vue.config.silent = true; + store._vm = new Vue({ + data: { + $$state: state + }, + computed: computed + }); + Vue.config.silent = silent; + + // enable strict mode for new vm + if (store.strict) { + enableStrictMode(store); + } + + if (oldVm) { + if (hot) { + // dispatch changes in all subscribed watchers + // to force getter re-evaluation for hot reloading. + store._withCommit(function () { + oldVm._data.$$state = null; + }); + } + Vue.nextTick(function () { return oldVm.$destroy(); }); + } +} + +function installModule (store, rootState, path, module, hot) { + var isRoot = !path.length; + var namespace = store._modules.getNamespace(path); + + // register in namespace map + if (module.namespaced) { + if (store._modulesNamespaceMap[namespace] && ("development" !== 'production')) { + console.error(("[vuex] duplicate namespace " + namespace + " for the namespaced module " + (path.join('/')))); + } + store._modulesNamespaceMap[namespace] = module; + } + + // set state + if (!isRoot && !hot) { + var parentState = getNestedState(rootState, path.slice(0, -1)); + var moduleName = path[path.length - 1]; + store._withCommit(function () { + if ((true)) { + if (moduleName in parentState) { + console.warn( + ("[vuex] state field \"" + moduleName + "\" was overridden by a module with the same name at \"" + (path.join('.')) + "\"") + ); + } + } + Vue.set(parentState, moduleName, module.state); + }); + } + + var local = module.context = makeLocalContext(store, namespace, path); + + module.forEachMutation(function (mutation, key) { + var namespacedType = namespace + key; + registerMutation(store, namespacedType, mutation, local); + }); + + module.forEachAction(function (action, key) { + var type = action.root ? key : namespace + key; + var handler = action.handler || action; + registerAction(store, type, handler, local); + }); + + module.forEachGetter(function (getter, key) { + var namespacedType = namespace + key; + registerGetter(store, namespacedType, getter, local); + }); + + module.forEachChild(function (child, key) { + installModule(store, rootState, path.concat(key), child, hot); + }); +} + +/** + * make localized dispatch, commit, getters and state + * if there is no namespace, just use root ones + */ +function makeLocalContext (store, namespace, path) { + var noNamespace = namespace === ''; + + var local = { + dispatch: noNamespace ? store.dispatch : function (_type, _payload, _options) { + var args = unifyObjectStyle(_type, _payload, _options); + var payload = args.payload; + var options = args.options; + var type = args.type; + + if (!options || !options.root) { + type = namespace + type; + if (( true) && !store._actions[type]) { + console.error(("[vuex] unknown local action type: " + (args.type) + ", global type: " + type)); + return + } + } + + return store.dispatch(type, payload) + }, + + commit: noNamespace ? store.commit : function (_type, _payload, _options) { + var args = unifyObjectStyle(_type, _payload, _options); + var payload = args.payload; + var options = args.options; + var type = args.type; + + if (!options || !options.root) { + type = namespace + type; + if (( true) && !store._mutations[type]) { + console.error(("[vuex] unknown local mutation type: " + (args.type) + ", global type: " + type)); + return + } + } + + store.commit(type, payload, options); + } + }; + + // getters and state object must be gotten lazily + // because they will be changed by vm update + Object.defineProperties(local, { + getters: { + get: noNamespace + ? function () { return store.getters; } + : function () { return makeLocalGetters(store, namespace); } + }, + state: { + get: function () { return getNestedState(store.state, path); } + } + }); + + return local +} + +function makeLocalGetters (store, namespace) { + if (!store._makeLocalGettersCache[namespace]) { + var gettersProxy = {}; + var splitPos = namespace.length; + Object.keys(store.getters).forEach(function (type) { + // skip if the target getter is not match this namespace + if (type.slice(0, splitPos) !== namespace) { return } + + // extract local getter type + var localType = type.slice(splitPos); + + // Add a port to the getters proxy. + // Define as getter property because + // we do not want to evaluate the getters in this time. + Object.defineProperty(gettersProxy, localType, { + get: function () { return store.getters[type]; }, + enumerable: true + }); + }); + store._makeLocalGettersCache[namespace] = gettersProxy; + } + + return store._makeLocalGettersCache[namespace] +} + +function registerMutation (store, type, handler, local) { + var entry = store._mutations[type] || (store._mutations[type] = []); + entry.push(function wrappedMutationHandler (payload) { + handler.call(store, local.state, payload); + }); +} + +function registerAction (store, type, handler, local) { + var entry = store._actions[type] || (store._actions[type] = []); + entry.push(function wrappedActionHandler (payload) { + var res = handler.call(store, { + dispatch: local.dispatch, + commit: local.commit, + getters: local.getters, + state: local.state, + rootGetters: store.getters, + rootState: store.state + }, payload); + if (!isPromise(res)) { + res = Promise.resolve(res); + } + if (store._devtoolHook) { + return res.catch(function (err) { + store._devtoolHook.emit('vuex:error', err); + throw err + }) + } else { + return res + } + }); +} + +function registerGetter (store, type, rawGetter, local) { + if (store._wrappedGetters[type]) { + if ((true)) { + console.error(("[vuex] duplicate getter key: " + type)); + } + return + } + store._wrappedGetters[type] = function wrappedGetter (store) { + return rawGetter( + local.state, // local state + local.getters, // local getters + store.state, // root state + store.getters // root getters + ) + }; +} + +function enableStrictMode (store) { + store._vm.$watch(function () { return this._data.$$state }, function () { + if ((true)) { + assert(store._committing, "do not mutate vuex store state outside mutation handlers."); + } + }, { deep: true, sync: true }); +} + +function getNestedState (state, path) { + return path.reduce(function (state, key) { return state[key]; }, state) +} + +function unifyObjectStyle (type, payload, options) { + if (isObject(type) && type.type) { + options = payload; + payload = type; + type = type.type; + } + + if ((true)) { + assert(typeof type === 'string', ("expects string as the type, but found " + (typeof type) + ".")); + } + + return { type: type, payload: payload, options: options } +} + +function install (_Vue) { + if (Vue && _Vue === Vue) { + if ((true)) { + console.error( + '[vuex] already installed. Vue.use(Vuex) should be called only once.' + ); + } + return + } + Vue = _Vue; + applyMixin(Vue); +} + +/** + * Reduce the code which written in Vue.js for getting the state. + * @param {String} [namespace] - Module's namespace + * @param {Object|Array} states # Object's item can be a function which accept state and getters for param, you can do something for state and getters in it. + * @param {Object} + */ +var mapState = normalizeNamespace(function (namespace, states) { + var res = {}; + if (( true) && !isValidMap(states)) { + console.error('[vuex] mapState: mapper parameter must be either an Array or an Object'); + } + normalizeMap(states).forEach(function (ref) { + var key = ref.key; + var val = ref.val; + + res[key] = function mappedState () { + var state = this.$store.state; + var getters = this.$store.getters; + if (namespace) { + var module = getModuleByNamespace(this.$store, 'mapState', namespace); + if (!module) { + return + } + state = module.context.state; + getters = module.context.getters; + } + return typeof val === 'function' + ? val.call(this, state, getters) + : state[val] + }; + // mark vuex getter for devtools + res[key].vuex = true; + }); + return res +}); + +/** + * Reduce the code which written in Vue.js for committing the mutation + * @param {String} [namespace] - Module's namespace + * @param {Object|Array} mutations # Object's item can be a function which accept `commit` function as the first param, it can accept another params. You can commit mutation and do any other things in this function. specially, You need to pass anthor params from the mapped function. + * @return {Object} + */ +var mapMutations = normalizeNamespace(function (namespace, mutations) { + var res = {}; + if (( true) && !isValidMap(mutations)) { + console.error('[vuex] mapMutations: mapper parameter must be either an Array or an Object'); + } + normalizeMap(mutations).forEach(function (ref) { + var key = ref.key; + var val = ref.val; + + res[key] = function mappedMutation () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + // Get the commit method from store + var commit = this.$store.commit; + if (namespace) { + var module = getModuleByNamespace(this.$store, 'mapMutations', namespace); + if (!module) { + return + } + commit = module.context.commit; + } + return typeof val === 'function' + ? val.apply(this, [commit].concat(args)) + : commit.apply(this.$store, [val].concat(args)) + }; + }); + return res +}); + +/** + * Reduce the code which written in Vue.js for getting the getters + * @param {String} [namespace] - Module's namespace + * @param {Object|Array} getters + * @return {Object} + */ +var mapGetters = normalizeNamespace(function (namespace, getters) { + var res = {}; + if (( true) && !isValidMap(getters)) { + console.error('[vuex] mapGetters: mapper parameter must be either an Array or an Object'); + } + normalizeMap(getters).forEach(function (ref) { + var key = ref.key; + var val = ref.val; + + // The namespace has been mutated by normalizeNamespace + val = namespace + val; + res[key] = function mappedGetter () { + if (namespace && !getModuleByNamespace(this.$store, 'mapGetters', namespace)) { + return + } + if (( true) && !(val in this.$store.getters)) { + console.error(("[vuex] unknown getter: " + val)); + return + } + return this.$store.getters[val] + }; + // mark vuex getter for devtools + res[key].vuex = true; + }); + return res +}); + +/** + * Reduce the code which written in Vue.js for dispatch the action + * @param {String} [namespace] - Module's namespace + * @param {Object|Array} actions # Object's item can be a function which accept `dispatch` function as the first param, it can accept anthor params. You can dispatch action and do any other things in this function. specially, You need to pass anthor params from the mapped function. + * @return {Object} + */ +var mapActions = normalizeNamespace(function (namespace, actions) { + var res = {}; + if (( true) && !isValidMap(actions)) { + console.error('[vuex] mapActions: mapper parameter must be either an Array or an Object'); + } + normalizeMap(actions).forEach(function (ref) { + var key = ref.key; + var val = ref.val; + + res[key] = function mappedAction () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + // get dispatch function from store + var dispatch = this.$store.dispatch; + if (namespace) { + var module = getModuleByNamespace(this.$store, 'mapActions', namespace); + if (!module) { + return + } + dispatch = module.context.dispatch; + } + return typeof val === 'function' + ? val.apply(this, [dispatch].concat(args)) + : dispatch.apply(this.$store, [val].concat(args)) + }; + }); + return res +}); + +/** + * Rebinding namespace param for mapXXX function in special scoped, and return them by simple object + * @param {String} namespace + * @return {Object} + */ +var createNamespacedHelpers = function (namespace) { return ({ + mapState: mapState.bind(null, namespace), + mapGetters: mapGetters.bind(null, namespace), + mapMutations: mapMutations.bind(null, namespace), + mapActions: mapActions.bind(null, namespace) +}); }; + +/** + * Normalize the map + * normalizeMap([1, 2, 3]) => [ { key: 1, val: 1 }, { key: 2, val: 2 }, { key: 3, val: 3 } ] + * normalizeMap({a: 1, b: 2, c: 3}) => [ { key: 'a', val: 1 }, { key: 'b', val: 2 }, { key: 'c', val: 3 } ] + * @param {Array|Object} map + * @return {Object} + */ +function normalizeMap (map) { + if (!isValidMap(map)) { + return [] + } + return Array.isArray(map) + ? map.map(function (key) { return ({ key: key, val: key }); }) + : Object.keys(map).map(function (key) { return ({ key: key, val: map[key] }); }) +} + +/** + * Validate whether given map is valid or not + * @param {*} map + * @return {Boolean} + */ +function isValidMap (map) { + return Array.isArray(map) || isObject(map) +} + +/** + * Return a function expect two param contains namespace and map. it will normalize the namespace and then the param's function will handle the new namespace and the map. + * @param {Function} fn + * @return {Function} + */ +function normalizeNamespace (fn) { + return function (namespace, map) { + if (typeof namespace !== 'string') { + map = namespace; + namespace = ''; + } else if (namespace.charAt(namespace.length - 1) !== '/') { + namespace += '/'; + } + return fn(namespace, map) + } +} + +/** + * Search a special module from store by namespace. if module not exist, print error message. + * @param {Object} store + * @param {String} helper + * @param {String} namespace + * @return {Object} + */ +function getModuleByNamespace (store, helper, namespace) { + var module = store._modulesNamespaceMap[namespace]; + if (( true) && !module) { + console.error(("[vuex] module namespace not found in " + helper + "(): " + namespace)); + } + return module +} + +// Credits: borrowed code from fcomb/redux-logger + +function createLogger (ref) { + if ( ref === void 0 ) ref = {}; + var collapsed = ref.collapsed; if ( collapsed === void 0 ) collapsed = true; + var filter = ref.filter; if ( filter === void 0 ) filter = function (mutation, stateBefore, stateAfter) { return true; }; + var transformer = ref.transformer; if ( transformer === void 0 ) transformer = function (state) { return state; }; + var mutationTransformer = ref.mutationTransformer; if ( mutationTransformer === void 0 ) mutationTransformer = function (mut) { return mut; }; + var actionFilter = ref.actionFilter; if ( actionFilter === void 0 ) actionFilter = function (action, state) { return true; }; + var actionTransformer = ref.actionTransformer; if ( actionTransformer === void 0 ) actionTransformer = function (act) { return act; }; + var logMutations = ref.logMutations; if ( logMutations === void 0 ) logMutations = true; + var logActions = ref.logActions; if ( logActions === void 0 ) logActions = true; + var logger = ref.logger; if ( logger === void 0 ) logger = console; + + return function (store) { + var prevState = deepCopy(store.state); + + if (typeof logger === 'undefined') { + return + } + + if (logMutations) { + store.subscribe(function (mutation, state) { + var nextState = deepCopy(state); + + if (filter(mutation, prevState, nextState)) { + var formattedTime = getFormattedTime(); + var formattedMutation = mutationTransformer(mutation); + var message = "mutation " + (mutation.type) + formattedTime; + + startMessage(logger, message, collapsed); + logger.log('%c prev state', 'color: #9E9E9E; font-weight: bold', transformer(prevState)); + logger.log('%c mutation', 'color: #03A9F4; font-weight: bold', formattedMutation); + logger.log('%c next state', 'color: #4CAF50; font-weight: bold', transformer(nextState)); + endMessage(logger); + } + + prevState = nextState; + }); + } + + if (logActions) { + store.subscribeAction(function (action, state) { + if (actionFilter(action, state)) { + var formattedTime = getFormattedTime(); + var formattedAction = actionTransformer(action); + var message = "action " + (action.type) + formattedTime; + + startMessage(logger, message, collapsed); + logger.log('%c action', 'color: #03A9F4; font-weight: bold', formattedAction); + endMessage(logger); + } + }); + } + } +} + +function startMessage (logger, message, collapsed) { + var startMessage = collapsed + ? logger.groupCollapsed + : logger.group; + + // render + try { + startMessage.call(logger, message); + } catch (e) { + logger.log(message); + } +} + +function endMessage (logger) { + try { + logger.groupEnd(); + } catch (e) { + logger.log('—— log end ——'); + } +} + +function getFormattedTime () { + var time = new Date(); + return (" @ " + (pad(time.getHours(), 2)) + ":" + (pad(time.getMinutes(), 2)) + ":" + (pad(time.getSeconds(), 2)) + "." + (pad(time.getMilliseconds(), 3))) +} + +function repeat (str, times) { + return (new Array(times + 1)).join(str) +} + +function pad (num, maxLength) { + return repeat('0', maxLength - num.toString().length) + num +} + +var index = { + Store: Store, + install: install, + version: '3.6.2', + mapState: mapState, + mapMutations: mapMutations, + mapGetters: mapGetters, + mapActions: mapActions, + createNamespacedHelpers: createNamespacedHelpers, + createLogger: createLogger +}; + +/* harmony default export */ __webpack_exports__["default"] = (index); + + +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js"))) + /***/ }), /***/ "./node_modules/webpack/buildin/global.js": @@ -54127,17 +55763,58 @@ module.exports = function(module) { __webpack_require__.r(__webpack_exports__); /* harmony import */ var swiper_swiper_bundle__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! swiper/swiper-bundle */ "./node_modules/swiper/swiper-bundle.js"); /* harmony import */ var swiper_swiper_bundle__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(swiper_swiper_bundle__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var vuex__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! vuex */ "./node_modules/vuex/dist/vuex.esm.js"); __webpack_require__(/*! ./bootstrap */ "./resources/views/front/canard/js/bootstrap.js"); __webpack_require__(/*! ./cart.js */ "./resources/views/front/canard/js/cart.js"); -window.Vue = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.common.js"); +window.Vue = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.common.js"); // Vuex + + Vue.component('timeslot-picker', __webpack_require__(/*! ./components/TimeSlotPicker.vue */ "./resources/views/front/canard/js/components/TimeSlotPicker.vue")["default"]); Vue.component('basket-panel', __webpack_require__(/*! ./components/BasketPanel.vue */ "./resources/views/front/canard/js/components/BasketPanel.vue")["default"]); +Vue.component('basket-counter', { + computed: { + count: function count() { + return this.$store.state.cartTotals.countItems; // let panier; + // panier = this.$store.state.panier; + // console.log(this.$store.state.panier); + // console.log(panier); + // console.log(panier.length); + // return panier[panier.length - 1].countItems; + } + }, + mounted: function mounted() { + console.log('Basket Counter Component mounted.'); + }, + template: '{{ count }}' +}); +var store = new vuex__WEBPACK_IMPORTED_MODULE_1__["default"].Store({ + state: { + panier: {}, + cartTotals: {} + }, + mutations: { + Reload: function Reload(state, payload) { + state.reload = payload.reload; + }, + updatePanier: function updatePanier(state, payload) { + state.panier = payload.panier; + }, + updateCartTotals: function updateCartTotals(state, payload) { + state.cartTotals = payload.cartTotals; + } + } +}); var app = new Vue({ el: '#app', + store: store, + data: { + num: 1 //for the numeric stepper on product pages + + }, methods: { addtocart: function addtocart(product, qtty) { console.log('root add'); diff --git a/resources/views/auth/login.blade.php b/resources/views/front/basic/auth/login.blade.php similarity index 100% rename from resources/views/auth/login.blade.php rename to resources/views/front/basic/auth/login.blade.php diff --git a/resources/views/auth/register.blade.php b/resources/views/front/basic/auth/register.blade.php similarity index 100% rename from resources/views/auth/register.blade.php rename to resources/views/front/basic/auth/register.blade.php diff --git a/resources/views/auth/reset-password.blade.php b/resources/views/front/basic/auth/reset-password.blade.php similarity index 100% rename from resources/views/auth/reset-password.blade.php rename to resources/views/front/basic/auth/reset-password.blade.php diff --git a/resources/views/front/canard/auth/login.blade.php b/resources/views/front/canard/auth/login.blade.php new file mode 100644 index 0000000..c570089 --- /dev/null +++ b/resources/views/front/canard/auth/login.blade.php @@ -0,0 +1,54 @@ +@extends('layouts.layout') + +@section('title', __('Connexion')) + +@section('content') +
+
+ +
+
+ + +@endsection diff --git a/resources/views/front/canard/auth/register.blade.php b/resources/views/front/canard/auth/register.blade.php new file mode 100644 index 0000000..43a59b3 --- /dev/null +++ b/resources/views/front/canard/auth/register.blade.php @@ -0,0 +1,83 @@ +@extends('layouts.layout') + +@section('title', __('Inscription')) + +@section('content') +
+
+ +
+
+ + +@endsection diff --git a/resources/views/front/canard/auth/reset-password.blade.php b/resources/views/front/canard/auth/reset-password.blade.php new file mode 100644 index 0000000..7158fec --- /dev/null +++ b/resources/views/front/canard/auth/reset-password.blade.php @@ -0,0 +1,5 @@ +@extends('layouts.layout') + +@section('content') +

Mot de passe oublié ?

+@endsection diff --git a/resources/views/front/canard/js/app.js b/resources/views/front/canard/js/app.js index 80103f9..a30c5b6 100644 --- a/resources/views/front/canard/js/app.js +++ b/resources/views/front/canard/js/app.js @@ -4,20 +4,61 @@ require('./cart.js'); window.Vue = require('vue'); +// Vuex +import Vuex from 'vuex'; + Vue.component('timeslot-picker', require('./components/TimeSlotPicker.vue').default); Vue.component('basket-panel', require('./components/BasketPanel.vue').default); +Vue.component('basket-counter', { + computed: { + count() { + return this.$store.state.cartTotals.countItems; + // let panier; + // panier = this.$store.state.panier; + // console.log(this.$store.state.panier); + // console.log(panier); + // console.log(panier.length); + // return panier[panier.length - 1].countItems; + } + }, + mounted: function() { + console.log('Basket Counter Component mounted.'); + }, + template: '{{ count }}' +}); + +const store = new Vuex.Store({ + state: { + panier: {}, + cartTotals: {}, + }, + mutations: { + Reload (state,payload) { + state.reload = payload.reload; + }, + updatePanier (state, payload) { + state.panier = payload.panier; + }, + updateCartTotals (state, payload) { + state.cartTotals = payload.cartTotals; + }, + } +}); const app = new Vue({ el: '#app', + store, + data: { + num: 1 //for the numeric stepper on product pages + }, methods: { addtocart(product,qtty) { console.log('root add'); this.$refs.basketpanel.addtocart(product,qtty); - } + }, }, }); - $(document).ready(function(){ //document is ready we can free css transitions $('.preload').removeClass("preload"); diff --git a/resources/views/front/canard/js/components/BasketPanel.vue b/resources/views/front/canard/js/components/BasketPanel.vue index c66ec19..49506dd 100644 --- a/resources/views/front/canard/js/components/BasketPanel.vue +++ b/resources/views/front/canard/js/components/BasketPanel.vue @@ -19,14 +19,14 @@ - + - + - + @@ -35,7 +35,7 @@

Votre panier est vide...

-
+
@@ -72,9 +72,9 @@
-
+
Me connecter - + Créer mon compte
@@ -116,14 +116,14 @@
- + + Boissons
- 1 + 1
@@ -134,7 +134,7 @@
  • -
    +
    @@ -163,8 +163,8 @@ Produit Bio Produit Bio
  • --> -
    - {{ item.cartItem.weight }} +
    + {{ item.cartItem.weight }} {{ item.product.weight_unit }}
    @@ -264,6 +264,69 @@
    +
    +
    +
    +
    +
    +
    +
    +
    Total produits
    +
    +
    +
    + {{cartTotals.totalTTC}} € +
    +
    +
    +
    +
    +
    + +
    +
    + +
    +
    +
    + +
    +
    +
    @@ -272,7 +335,7 @@ Total

    - 50,64€ + {{cartTotals.totalTTC}} €