diff --git a/resources/js/Global/components/Inputs/Slide-Button.vue b/resources/js/Global/components/Inputs/Slide-Button.vue index 20c3ea8..7ecda81 100644 --- a/resources/js/Global/components/Inputs/Slide-Button.vue +++ b/resources/js/Global/components/Inputs/Slide-Button.vue @@ -1,16 +1,21 @@ - - \ No newline at end of file diff --git a/resources/js/Global/mixins/commingSoon.js b/resources/js/Global/mixins/commingSoon.js index 201f642..5ccbca5 100644 --- a/resources/js/Global/mixins/commingSoon.js +++ b/resources/js/Global/mixins/commingSoon.js @@ -12,7 +12,8 @@ var CommingSoonArray = [ "client_export", "blog-videos", "roll-staff", - "service-specialInfo" + "service-specialInfo", + 'store-registerOrder' ]; const commingSoon = { methods: { diff --git a/resources/js/Global/services/errorHandler.services.js b/resources/js/Global/services/errorHandler.services.js index 4703607..a3f6edd 100644 --- a/resources/js/Global/services/errorHandler.services.js +++ b/resources/js/Global/services/errorHandler.services.js @@ -16,7 +16,6 @@ function errorResponseHandler(error) { ) { return Promise.reject(error); } - // if has response show the error if (error.response) { if(error.response.status === 401) { @@ -37,8 +36,10 @@ function errorResponseHandler(error) { } } else if(error.response.status === 500) { toast.error('مشکل از سمت سرور', 'خطا'); + return Promise.reject(error); } } + return Promise.reject(error.response); } function successHandler(response) { if(response.status === 200 || response.status === 201) { @@ -52,4 +53,3 @@ function successHandler(response) { // apply interceptor on response axios.interceptors.response.use(successHandler, errorResponseHandler); Vue.prototype.$axios = axios; - diff --git a/resources/js/Global/services/storage.services.js b/resources/js/Global/services/storage.services.js index ae8b7c5..c2eb0d7 100644 --- a/resources/js/Global/services/storage.services.js +++ b/resources/js/Global/services/storage.services.js @@ -33,7 +33,7 @@ const CategoryNameService = { }, save(category_name = null) { - category_name = qs.stringify(category_name); + category_name = qs.stringify(category_name); localStorage.setItem(CATEGORYNAME, category_name) }, @@ -51,7 +51,7 @@ const UserService = { }, save(user = null) { - user = qs.stringify(user); + user = qs.stringify(user); localStorage.setItem(USER, user) }, @@ -69,7 +69,7 @@ const PermissionService = { }, save(permission = null) { - permission = qs.stringify(permission); + permission = qs.stringify(permission); localStorage.setItem(PERMISSION, permission) }, @@ -94,5 +94,66 @@ const VirtualActivityService = { localStorage.removeItem(PERMISSION) }, } +const Paginate = { -export { TokenService, UserService, PermissionService, VirtualActivityService, CategoryNameService } + get(SERVICE) { + if (localStorage.getItem(SERVICE)) { + let service = qs.parse(localStorage.getItem(SERVICE), { strictNullHandling: true }); + if (typeof service.pagination !== 'undefined' && service.pagination) { + let pagination = {}; + for(let key in service.pagination) { + pagination[key] = Number(service.pagination[key]) + } + return pagination + } + } + return null; + }, + + save(SERVICE, pagination = null ) { + let service = null; + if (localStorage.getItem(SERVICE)) { + service = qs.parse(localStorage.getItem(SERVICE)); + } else { + service = {}; + } + service['pagination'] = pagination; + let service_paginate = qs.stringify(service); + localStorage.setItem(SERVICE, service_paginate) + }, + + remove(SERVICE) { + this.save(SERVICE); + }, +}; + +const Sort = { + get(SERVICE) { + if (localStorage.getItem(SERVICE)) { + let service = qs.parse(localStorage.getItem(SERVICE), { strictNullHandling: true }); + if (typeof service.sort !== 'undefined' && service.sort) { + return service.sort + } + } + return null; + }, + + save(SERVICE, sort = '') { + let service = null; + if (localStorage.getItem(SERVICE)) { + service = qs.parse(localStorage.getItem(SERVICE)); + } else { + service = {}; + } + service['sort'] = sort; + let service_sort = qs.stringify(service); + localStorage.setItem(SERVICE, service_sort) + }, + + remove(SERVICE) { + this.save(SERVICE); + }, +}; + + +export { TokenService, UserService, PermissionService, VirtualActivityService, CategoryNameService, Paginate, Sort } diff --git a/resources/js/Global/utils/common/addToTags.js b/resources/js/Global/utils/common/addToTags.js new file mode 100644 index 0000000..4d5ee4a --- /dev/null +++ b/resources/js/Global/utils/common/addToTags.js @@ -0,0 +1,12 @@ +export const addToTags = (data, tagItems) => { + if (!data.tags || typeof data.tags !== 'object') { + data.tags = []; + } + for (const tagItem of tagItems) { + if (data[tagItem] && !data.tags.includes(data[tagItem])) { + data.tags.push(data[tagItem]); + } + } + + return data; +}; diff --git a/tsconfig.json b/tsconfig.json deleted file mode 100644 index 437c213..0000000 --- a/tsconfig.json +++ /dev/null @@ -1,32 +0,0 @@ -//{ -// "compilerOptions": { -// "module": "commonjs", -// "target": "es5", -// "noImplicitAny": false, -// "sourceMap": false -// } -//} -{ - "compilerOptions": { - "lib": ["dom", "es5", "es2015"], - "target": "es5", - "module": "commonjs", - "noImplicitAny": false, - "moduleResolution": "node", - "sourceMap": true, - "allowSyntheticDefaultImports": true, - "paths": { - "@JS/*": ["./resources/js/*"], - "@Global/*": ["./resources/js/Global/*"], - "@Home/*": ["./resources/js/Home/*"], - "@CRM/*": ["./modules/wm-crm/resources/js/*"], - "@Common/*": ["./modules/wm-common/resources/js/*"], - "@Core/*": ["./modules/wm-core/resources/js/*"], - "@User/*": ["./modules/wm-core/resources/js/Modules/User/*"], - "@Auth/*": ["./modules/wm-core/resources/js/Modules/Authentication/*"], - "@Service/*": ["./modules/wm-service/resources/js/*"], - "@Product/*": ["./modules/wm-product/resources/js/*"], - "@Blog/*": ["./modules/wm-blog/resources/js/*"] - } - } -}