From 7f8aa04bdcc641443faba464ac60b8710c516595 Mon Sep 17 00:00:00 2001 From: Zabir Anik Date: Wed, 29 Dec 2021 12:48:17 +0600 Subject: [PATCH 1/2] feat/further improvements (#94) * fix: alignment, typos, docblock * add: gateway manager * add: admin dependency notice for woocommerce * update: wepos_get_template function * update: phpdoc, alignments * add: settings getter * chore: udpated to composer 2 * update: docblock * fix: requested changes * fix: cleanup * add: font family consistancy * chore: sweetalert introduced * add: wepos sweetalert functions * fix: z index mismatch for components * update: toast timer * add: stock support for pos product * fix: variation product all variations can not be seen * add: variable product stock support * add: process payment vuex support * add: limited time promotion for holiday * remove: holiday promotion * fix: can process payment button disabled * fix: requested changes --- assets/js/bootstrap.js | 174 +++++++---- assets/less/style.less | 275 +++++++++--------- assets/src/frontend/components/Home.vue | 56 +++- assets/src/utils/Bootstrap.js | 6 + assets/src/utils/Mixin.js | 70 ++++- .../src/utils/store/modules/Order.module.js | 23 +- package-lock.json | 15 +- package.json | 1 + 8 files changed, 413 insertions(+), 207 deletions(-) diff --git a/assets/js/bootstrap.js b/assets/js/bootstrap.js index cb5b067c..076211f2 100644 --- a/assets/js/bootstrap.js +++ b/assets/js/bootstrap.js @@ -1,6 +1,6 @@ pluginWebpack([2],{ -/***/ 139: +/***/ 141: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -185,7 +185,7 @@ pluginWebpack([2],{ /***/ }), -/***/ 140: +/***/ 142: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -261,7 +261,7 @@ pluginWebpack([2],{ /***/ }), -/***/ 141: +/***/ 143: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -302,7 +302,7 @@ pluginWebpack([2],{ /***/ }), -/***/ 224: +/***/ 225: /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -317,68 +317,79 @@ var _vue = __webpack_require__(14); var _vue2 = _interopRequireDefault(_vue); -var _vueRouter = __webpack_require__(93); +var _vueRouter = __webpack_require__(94); var _vueRouter2 = _interopRequireDefault(_vueRouter); -var _vuex = __webpack_require__(94); +var _vuex = __webpack_require__(96); var _vuex2 = _interopRequireDefault(_vuex); -var _Api = __webpack_require__(225); +var _Api = __webpack_require__(226); var _Api2 = _interopRequireDefault(_Api); -var _lodash = __webpack_require__(226); +var _lodash = __webpack_require__(227); var _lodash2 = _interopRequireDefault(_lodash); -var _Mixin = __webpack_require__(366); +var _Mixin = __webpack_require__(367); var _Mixin2 = _interopRequireDefault(_Mixin); -var _vueJsPopover = __webpack_require__(91); +var _vueJsPopover = __webpack_require__(92); var _vueJsPopover2 = _interopRequireDefault(_vueJsPopover); -var _TextEditor = __webpack_require__(368); +var _TextEditor = __webpack_require__(369); var _TextEditor2 = _interopRequireDefault(_TextEditor); -var _vTooltip = __webpack_require__(90); +var _vTooltip = __webpack_require__(91); -var _vHotkey = __webpack_require__(28); +var _vHotkey = __webpack_require__(29); var _vHotkey2 = _interopRequireDefault(_vHotkey); -var _vueMultiselect = __webpack_require__(92); +var _vueMultiselect = __webpack_require__(93); var _vueMultiselect2 = _interopRequireDefault(_vueMultiselect); -var _Modal = __webpack_require__(370); +var _Modal = __webpack_require__(371); var _Modal2 = _interopRequireDefault(_Modal); -var _Switches = __webpack_require__(373); +var _Switches = __webpack_require__(374); var _Switches2 = _interopRequireDefault(_Switches); -__webpack_require__(376); +__webpack_require__(377); -var _dayjs = __webpack_require__(33); +var _dayjs = __webpack_require__(34); var _dayjs2 = _interopRequireDefault(_dayjs); -var _vueDatepicker = __webpack_require__(88); +var _vueSweetalert = __webpack_require__(95); + +var _vueSweetalert2 = _interopRequireDefault(_vueSweetalert); + +__webpack_require__(380); + +var _vueDatepicker = __webpack_require__(89); var _vueDatepicker2 = _interopRequireDefault(_vueDatepicker); -__webpack_require__(379); +__webpack_require__(382); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } window.dayjs = _dayjs2.default; +// Vue Sweet Alert + + +_vue2.default.use(_vueSweetalert2.default); + _vue2.default.use(_vueDatepicker2.default, { lang: 'en' }); @@ -454,7 +465,7 @@ wepos.addFilter = function (hookName, namespace, component) { /***/ }), -/***/ 225: +/***/ 226: /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -542,7 +553,7 @@ exports.default = WePos_API; /***/ }), -/***/ 226: +/***/ 227: /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -552,23 +563,23 @@ Object.defineProperty(exports, "__esModule", { value: true }); -var _core = __webpack_require__(228); +var _core = __webpack_require__(229); var _core2 = _interopRequireDefault(_core); -var _findindex = __webpack_require__(229); +var _findindex = __webpack_require__(230); var _findindex2 = _interopRequireDefault(_findindex); -var _truncate = __webpack_require__(292); +var _truncate = __webpack_require__(293); var _truncate2 = _interopRequireDefault(_truncate); -var _includes = __webpack_require__(303); +var _includes = __webpack_require__(304); var _includes2 = _interopRequireDefault(_includes); -var _debounce = __webpack_require__(363); +var _debounce = __webpack_require__(364); var _debounce2 = _interopRequireDefault(_debounce); @@ -581,18 +592,18 @@ _.includes = _includes2.default; _.debounce = _debounce2.default; exports.default = _; -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(227))) +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(228))) /***/ }), -/***/ 227: +/***/ 228: /***/ (function(module, exports) { module.exports = window.wepos._; /***/ }), -/***/ 366: +/***/ 367: /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -602,7 +613,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); -var _i18n = __webpack_require__(367); +var _i18n = __webpack_require__(368); exports.default = { methods: { @@ -668,6 +679,71 @@ exports.default = { } } return match; + }, + weposConfirmAlert: function weposConfirmAlert(_ref) { + var _ref$title = _ref.title, + title = _ref$title === undefined ? '' : _ref$title, + _ref$text = _ref.text, + text = _ref$text === undefined ? '' : _ref$text; + + return this.$swal.fire({ + title: title, + text: text, + type: 'warning', + showCancelButton: true, + confirmButtonColor: '#3b80f4', + cancelButtonColor: '#e34d4d', + confirmButtonText: this.__('Confirm', 'wepos') + }); + }, + weposToast: function weposToast(_ref2) { + var title = _ref2.title, + _ref2$type = _ref2.type, + type = _ref2$type === undefined ? '' : _ref2$type, + _ref2$position = _ref2.position, + position = _ref2$position === undefined ? '' : _ref2$position; + + var toast = this.$swal.mixin({ + toast: true, + position: 'top-right', + showConfirmButton: false, + timer: 1500, + timerProgressBar: true, + animation: true + }); + + switch (type) { + case 'success': + toast.fire({ + icon: 'success', + title: title + }); + break; + case 'error': + toast.fire({ + icon: 'error', + title: title + }); + break; + case 'warning': + toast.fire({ + icon: 'warning', + title: title + }); + break; + case 'info': + toast.fire({ + icon: 'info', + title: title + }); + break; + default: + toast.fire({ + icon: 'success', + title: title + }); + break; + } } }, @@ -693,7 +769,7 @@ exports.default = { /***/ }), -/***/ 367: +/***/ 368: /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -818,14 +894,14 @@ var sprintf = exports.sprintf = Jed.sprintf; /***/ }), -/***/ 368: +/***/ 369: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_TextEditor_vue__ = __webpack_require__(139); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_TextEditor_vue__ = __webpack_require__(141); /* empty harmony namespace reexport */ -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_1b8977ca_hasScoped_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_TextEditor_vue__ = __webpack_require__(369); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_1b8977ca_hasScoped_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_TextEditor_vue__ = __webpack_require__(370); var disposed = false var normalizeComponent = __webpack_require__(0) /* script */ @@ -872,7 +948,7 @@ if (false) {(function () { /***/ }), -/***/ 369: +/***/ 370: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -898,18 +974,18 @@ if (false) { /***/ }), -/***/ 370: +/***/ 371: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_Modal_vue__ = __webpack_require__(140); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_Modal_vue__ = __webpack_require__(142); /* empty harmony namespace reexport */ -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_e7f44b2a_hasScoped_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_Modal_vue__ = __webpack_require__(372); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_e7f44b2a_hasScoped_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_Modal_vue__ = __webpack_require__(373); var disposed = false function injectStyle (ssrContext) { if (disposed) return - __webpack_require__(371) + __webpack_require__(372) } var normalizeComponent = __webpack_require__(0) /* script */ @@ -956,14 +1032,14 @@ if (false) {(function () { /***/ }), -/***/ 371: +/***/ 372: /***/ (function(module, exports) { // removed by extract-text-webpack-plugin /***/ }), -/***/ 372: +/***/ 373: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -1037,18 +1113,18 @@ if (false) { /***/ }), -/***/ 373: +/***/ 374: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_Switches_vue__ = __webpack_require__(141); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_Switches_vue__ = __webpack_require__(143); /* empty harmony namespace reexport */ -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_71008314_hasScoped_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_Switches_vue__ = __webpack_require__(375); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_71008314_hasScoped_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_Switches_vue__ = __webpack_require__(376); var disposed = false function injectStyle (ssrContext) { if (disposed) return - __webpack_require__(374) + __webpack_require__(375) } var normalizeComponent = __webpack_require__(0) /* script */ @@ -1095,14 +1171,14 @@ if (false) {(function () { /***/ }), -/***/ 374: +/***/ 375: /***/ (function(module, exports) { // removed by extract-text-webpack-plugin /***/ }), -/***/ 375: +/***/ 376: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -1134,4 +1210,4 @@ if (false) { /***/ }) -},[224]); \ No newline at end of file +},[225]); \ No newline at end of file diff --git a/assets/less/style.less b/assets/less/style.less index 414dbb5f..fedea3bf 100644 --- a/assets/less/style.less +++ b/assets/less/style.less @@ -3,21 +3,21 @@ body { padding: 0; background-color: #F0F2F4; font-size: 14px; - font-family: "-apple-system, BlinkMacSystemFont, San Francisco, Ubuntu, Helvetica Neue, Helvetica, Roboto, Lato, Noto, Segoe UI, Arial", sans-serif; + font-family: -apple-system, "system-ui", "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; } [v-cloak] { - display: none; + display: none; } .wepos-clearfix:before, .wepos-clearfix:after { - display: table; - content: " "; + display: table; + content: " "; } .wepos-clearfix:after { - clear: both; + clear: both; } .wepos-right { @@ -85,41 +85,41 @@ body { .spinner.spinner-loading { - @keyframes scale-2 { - 0% { - transform: scale(0); - opacity: 0; + @keyframes scale-2 { + 0% { + transform: scale(0); + opacity: 0; + } + + 50% { + transform: scale(0.7); + opacity: 1; + } + + 100% { + transform: scale(1); + opacity: 0; + } } - 50% { - transform: scale(0.7); - opacity: 1; + &:before { + width: 117px; + height: 117px; + border-color: #3b80f4; + top: 0px; + left: 0px; + animation: scale-2 1s linear 0s infinite; } - 100% { - transform: scale(1); - opacity: 0; + &:after { + width: 117px; + height: 117px; + border-color: #3b80f4; + top: 0; + left: 0; + opacity: 0; + animation: scale-2 1s linear 0.5s infinite; } - } - - &:before { - width: 117px; - height: 117px; - border-color: #3b80f4; - top: 0px; - left: 0px; - animation: scale-2 1s linear 0s infinite; - } - - &:after { - width: 117px; - height: 117px; - border-color: #3b80f4; - top: 0; - left: 0; - opacity: 0; - animation: scale-2 1s linear 0.5s infinite; - } } .lds-ripple { @@ -242,15 +242,15 @@ body { } .list-item { - display: inline-block; - margin-right: 10px; + display: inline-block; + margin-right: 10px; } .list-enter-active, .list-leave-active { - transition: all 1s; + transition: all 1s; } .list-enter, .list-leave-to /* .list-leave-active below version 2.1.8 */ { - opacity: 0; - transform: translateY(30px); + opacity: 0; + transform: translateY(30px); } .wepos-zindex { @@ -794,110 +794,111 @@ div:focus, span:focus, button:focus, input:focus { } .tooltip { - display: block !important; - z-index: 10000; - - .tooltip-inner { - background: black; - color: white; - border-radius: 16px; - max-width: 300px; - } - - .tooltip-arrow { - width: 0; - height: 0; - border-style: solid; - position: absolute; - margin: 5px; - border-color: black; - z-index: 1; - } - - &[x-placement^="top"] { - margin-bottom: 5px; + display: block !important; + z-index: 100; + + .tooltip-inner { + background: black; + color: white; + border-radius: 16px; + max-width: 300px; + } .tooltip-arrow { - border-width: 5px 5px 0 5px; - border-left-color: transparent !important; - border-right-color: transparent !important; - border-bottom-color: transparent !important; - bottom: -5px; - left: calc(50% - 5px); - margin-top: 0; - margin-bottom: 0; + width: 0; + height: 0; + border-style: solid; + position: absolute; + margin: 5px; + border-color: black; + z-index: 1; } - } - &[x-placement^="bottom"] { - margin-top: 5px; + &[x-placement^="top"] { + margin-bottom: 5px; - .tooltip-arrow { - border-width: 0 5px 5px 5px; - border-left-color: transparent !important; - border-right-color: transparent !important; - border-top-color: transparent !important; - top: -5px; - left: calc(50% - 5px); - margin-top: 0; - margin-bottom: 0; + .tooltip-arrow { + border-width: 5px 5px 0 5px; + border-left-color: transparent !important; + border-right-color: transparent !important; + border-bottom-color: transparent !important; + bottom: -5px; + left: calc(50% - 5px); + margin-top: 0; + margin-bottom: 0; + } } - } - &[x-placement^="right"] { - margin-left: 5px; + &[x-placement^="bottom"] { + margin-top: 5px; - .tooltip-arrow { - border-width: 5px 5px 5px 0; - border-left-color: transparent !important; - border-top-color: transparent !important; - border-bottom-color: transparent !important; - left: -5px; - top: calc(50% - 5px); - margin-left: 0; - margin-right: 0; + .tooltip-arrow { + border-width: 0 5px 5px 5px; + border-left-color: transparent !important; + border-right-color: transparent !important; + border-top-color: transparent !important; + top: -5px; + left: calc(50% - 5px); + margin-top: 0; + margin-bottom: 0; + } } - } - &[x-placement^="left"] { - margin-right: 5px; - - .tooltip-arrow { - border-width: 5px 0 5px 5px; - border-top-color: transparent !important; - border-right-color: transparent !important; - border-bottom-color: transparent !important; - right: -5px; - top: calc(50% - 5px); - margin-left: 0; - margin-right: 0; + &[x-placement^="right"] { + margin-left: 5px; + + .tooltip-arrow { + border-width: 5px 5px 5px 0; + border-left-color: transparent !important; + border-top-color: transparent !important; + border-bottom-color: transparent !important; + left: -5px; + top: calc(50% - 5px); + margin-left: 0; + margin-right: 0; + } } - } - - &.popover { - color: #f9f9f9; - .popover-inner { - background: #fff; - color: #212121; - border-radius: 5px; - box-shadow: 0 5px 30px rgba(0,0,0, .1); + + &[x-placement^="left"] { + margin-right: 5px; + + .tooltip-arrow { + border-width: 5px 0 5px 5px; + border-top-color: transparent !important; + border-right-color: transparent !important; + border-bottom-color: transparent !important; + right: -5px; + top: calc(50% - 5px); + margin-left: 0; + margin-right: 0; + } } - .popover-arrow { - border-color: #f9f9f9; + + &.popover { + color: #f9f9f9; + .popover-inner { + height: auto; + background: #fff; + color: #212121; + border-radius: 5px; + box-shadow: 0 5px 30px rgba(0,0,0, .1); + } + .popover-arrow { + border-color: #f9f9f9; + } } - } - &[aria-hidden='true'] { - visibility: hidden; - opacity: 0; - transition: opacity .15s, visibility .15s; - } + &[aria-hidden='true'] { + visibility: hidden; + opacity: 0; + transition: opacity .15s, visibility .15s; + } - &[aria-hidden='false'] { - visibility: visible; - opacity: 1; - transition: opacity .15s; - } + &[aria-hidden='false'] { + visibility: visible; + opacity: 1; + transition: opacity .15s; + } } .wepos-multiselect { @@ -946,7 +947,7 @@ div:focus, span:focus, button:focus, input:focus { } - &.multiselect--active { + &.multiselect--active { .multiselect__input { width: 100% !important; font-size: 13px; @@ -1010,7 +1011,7 @@ div:focus, span:focus, button:focus, input:focus { min-height: 360px; background: #000; opacity: 0.2; - z-index: 99999; + z-index: 200; } .wepos-modal { @@ -1106,24 +1107,24 @@ div:focus, span:focus, button:focus, input:focus { } } - .switch { +.switch { position: relative; display: inline-block; width: 38px; height: 20px; input { - display: none; - &:checked + .slider { + display: none; + &:checked + .slider { background-color: #3B80F4; &:before { -webkit-transform: translateX(17px); -ms-transform: translateX(17px); transform: translateX(17px); } - } - &:focus + .slider { + } + &:focus + .slider { box-shadow: 0 0 1px #2196F3; - } + } } .slider { position: absolute; diff --git a/assets/src/frontend/components/Home.vue b/assets/src/frontend/components/Home.vue index 87923c71..8eb7c93f 100644 --- a/assets/src/frontend/components/Home.vue +++ b/assets/src/frontend/components/Home.vue @@ -56,15 +56,13 @@