From 6b6b9a3652f7ff1f13f53f84e4d76cc718cb8270 Mon Sep 17 00:00:00 2001 From: sedmedgh Date: Thu, 30 Dec 2021 16:13:42 +0330 Subject: [PATCH] update 1400-10-09 --- package.json | 2 +- src/App.vue | 11 +- src/assets/css/main.css | 27 + src/axios.js | 68 ++- src/components/SingleUploadInput.vue | 8 +- src/components/UploadInput.vue | 6 + src/components/new-x-table/Readme.md | 69 +++ src/components/new-x-table/XTable.vue | 448 ++++++++++++++ src/components/new-x-table/assets/excel.svg | 48 ++ src/components/new-x-table/assets/json.svg | 79 +++ src/components/new-x-table/assets/print.svg | 14 + src/components/new-x-table/assets/search.svg | 1 + .../components/DateXTableFilter.vue | 30 + .../components/NumberXTableFilter.vue | 27 + .../components/QuerySelectTableFilter.vue | 62 ++ .../components/SelectOptionXTableFilter.vue | 34 ++ .../components/SwitchXTableFilter.vue | 25 + .../components/TextXTableFilter.vue | 30 + .../new-x-table/components/XFilterRow.vue | 164 ++++++ src/components/new-x-table/index.js | 6 + src/components/new-x-table/index__.ts | 30 + src/components/new-x-table/model/XTbl.js | 62 ++ src/components/new-x-table/model/Xtc.js | 106 ++++ src/components/new-x-table/run.sh | 1 + src/components/new-x-table/test.js | 15 + src/components/x-table/XTable.vue | 2 +- src/fake-db/data/apps/calendar/index.js | 2 +- src/fake-db/data/apps/email/index.js | 8 +- src/fake-db/data/apps/todo/index.js | 2 +- src/fake-db/data/data-list/index.js | 2 +- src/fake-db/data/user-management/index.js | 2 +- .../vertical-nav-menu/VerticalNavMenu.vue | 29 +- .../vertical-nav-menu/navMenuItems.js | 13 + src/main.js | 21 + src/router.js | 47 +- src/store/access/access.js | 28 +- src/store/auth/moduleAuthActions.js | 2 +- src/store/data-list/moduleDataListActions.js | 8 +- src/store/eCommerce/moduleECommerceState.js | 2 +- .../moduleUserManagementActions.js | 2 +- src/views/ad/tablePackage.js | 2 +- src/views/adv/AdvEdit.vue | 4 +- src/views/adv/AdvImagesComponent.vue | 4 +- src/views/apps/calendar/SimpleCalendar.vue | 2 +- src/views/apps/customer/tableCustomer.js | 2 +- .../apps/eCommerce/ECommerceCheckout.vue | 14 +- src/views/apps/todo/TodoAddNew.vue | 2 +- src/views/apps/todo/TodoFilters.vue | 2 +- src/views/auth/Login.vue | 13 +- src/views/config/Config.vue | 26 +- src/views/config/jobTbl.js | 12 +- src/views/dashboard/DashboardAnalytics.vue | 216 ++++--- .../contractTerminationCurrentMonthTbl.js | 13 +- .../contractTerminationPastMonthTbl.js | 13 +- .../dashboard/personelCurrentmonthTbl.js | 10 +- .../personelEndContractCurrentmonthTbl.js | 13 +- .../personelEndContractNextmonthTbl.js | 5 +- .../personelEndContractPastmonthTbl.js | 13 +- src/views/dashboard/personelPastmonthTbl.js | 10 +- src/views/dashboard/workChart.js | 11 + .../forms/form-wizard/FormWizardIconTab.vue | 6 +- .../forms/form-wizard/FormWizardNumberTab.vue | 6 +- .../form-wizard/FormWizardValidation.vue | 6 +- src/views/permission/Access.vue | 125 ++-- src/views/personel/Personel.vue | 550 +++++++++++++---- src/views/personel/personelTbl.js | 10 +- src/views/price/CollectionPrice.vue | 2 +- src/views/price/DepositPriceListModel.js | 2 +- src/views/price/IpcPrice.vue | 2 +- src/views/price/StorePrice.vue | 2 +- src/views/proposal/Proposal.vue | 556 +++++++++++++++++- src/views/proposal/proposalTbl.js | 12 +- src/views/register/Register.vue | 49 ++ src/views/register/RegisterPersonnel.vue | 48 ++ .../ui-elements/grid/vuesax/GridOverview.vue | 2 +- src/views/users/create.vue | 131 +++++ src/views/users/users.vue | 267 +++++++++ src/views/users/usersTbl.js | 10 + vue.config.js | 2 +- 79 files changed, 3323 insertions(+), 395 deletions(-) create mode 100644 src/components/new-x-table/Readme.md create mode 100644 src/components/new-x-table/XTable.vue create mode 100644 src/components/new-x-table/assets/excel.svg create mode 100644 src/components/new-x-table/assets/json.svg create mode 100644 src/components/new-x-table/assets/print.svg create mode 100644 src/components/new-x-table/assets/search.svg create mode 100644 src/components/new-x-table/components/DateXTableFilter.vue create mode 100644 src/components/new-x-table/components/NumberXTableFilter.vue create mode 100644 src/components/new-x-table/components/QuerySelectTableFilter.vue create mode 100644 src/components/new-x-table/components/SelectOptionXTableFilter.vue create mode 100644 src/components/new-x-table/components/SwitchXTableFilter.vue create mode 100644 src/components/new-x-table/components/TextXTableFilter.vue create mode 100644 src/components/new-x-table/components/XFilterRow.vue create mode 100644 src/components/new-x-table/index.js create mode 100644 src/components/new-x-table/index__.ts create mode 100644 src/components/new-x-table/model/XTbl.js create mode 100644 src/components/new-x-table/model/Xtc.js create mode 100644 src/components/new-x-table/run.sh create mode 100644 src/components/new-x-table/test.js create mode 100644 src/views/dashboard/workChart.js create mode 100644 src/views/users/create.vue create mode 100644 src/views/users/users.vue create mode 100644 src/views/users/usersTbl.js diff --git a/package.json b/package.json index 83d67f8..2318535 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "vue-i18n": "^8.11.2", "vue-instantsearch": "^2.2.1", "vue-perfect-scrollbar": "^0.1.0", - "vue-persian-datetime-picker": "^2.4.0", + "vue-persian-datetime-picker": "^2.10.2", "vue-prism-component": "^1.1.1", "vue-property-decorator": "^8.1.1", "vue-quill-editor": "^3.0.6", diff --git a/src/App.vue b/src/App.vue index 07b3e37..2169f84 100644 --- a/src/App.vue +++ b/src/App.vue @@ -21,7 +21,7 @@ +``` + +Feature road map +- [x] Date filter +- [x] Select filter +- [x] Multiple filter +- [x] Switch filter +- [x] Numeric filter +- [x] JSON export +- [x] Print export +- [x] Excel export +- [x] Auto translate columns in export mode +- [x] Auto set title for print report +- [ ] Sort in joined table +- [ ] Exception Handlers for server and client +- [ ] Reset Table Engine feature +- [ ] Store current view in localstorage +- [ ] Add scope to filter diff --git a/src/components/new-x-table/XTable.vue b/src/components/new-x-table/XTable.vue new file mode 100644 index 0000000..5f16d51 --- /dev/null +++ b/src/components/new-x-table/XTable.vue @@ -0,0 +1,448 @@ + + + + + diff --git a/src/components/new-x-table/assets/excel.svg b/src/components/new-x-table/assets/excel.svg new file mode 100644 index 0000000..4ddc8e0 --- /dev/null +++ b/src/components/new-x-table/assets/excel.svg @@ -0,0 +1,48 @@ + + + + + + + + + + +]> + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/components/new-x-table/assets/json.svg b/src/components/new-x-table/assets/json.svg new file mode 100644 index 0000000..17ae513 --- /dev/null +++ b/src/components/new-x-table/assets/json.svg @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/components/new-x-table/assets/print.svg b/src/components/new-x-table/assets/print.svg new file mode 100644 index 0000000..fe65237 --- /dev/null +++ b/src/components/new-x-table/assets/print.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/components/new-x-table/assets/search.svg b/src/components/new-x-table/assets/search.svg new file mode 100644 index 0000000..8710306 --- /dev/null +++ b/src/components/new-x-table/assets/search.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/components/new-x-table/components/DateXTableFilter.vue b/src/components/new-x-table/components/DateXTableFilter.vue new file mode 100644 index 0000000..4454af7 --- /dev/null +++ b/src/components/new-x-table/components/DateXTableFilter.vue @@ -0,0 +1,30 @@ + + + + diff --git a/src/components/new-x-table/components/NumberXTableFilter.vue b/src/components/new-x-table/components/NumberXTableFilter.vue new file mode 100644 index 0000000..d1bc3cb --- /dev/null +++ b/src/components/new-x-table/components/NumberXTableFilter.vue @@ -0,0 +1,27 @@ + + + diff --git a/src/components/new-x-table/components/QuerySelectTableFilter.vue b/src/components/new-x-table/components/QuerySelectTableFilter.vue new file mode 100644 index 0000000..37f8127 --- /dev/null +++ b/src/components/new-x-table/components/QuerySelectTableFilter.vue @@ -0,0 +1,62 @@ + + + diff --git a/src/components/new-x-table/components/SelectOptionXTableFilter.vue b/src/components/new-x-table/components/SelectOptionXTableFilter.vue new file mode 100644 index 0000000..e9d8930 --- /dev/null +++ b/src/components/new-x-table/components/SelectOptionXTableFilter.vue @@ -0,0 +1,34 @@ + + + diff --git a/src/components/new-x-table/components/SwitchXTableFilter.vue b/src/components/new-x-table/components/SwitchXTableFilter.vue new file mode 100644 index 0000000..b1f727f --- /dev/null +++ b/src/components/new-x-table/components/SwitchXTableFilter.vue @@ -0,0 +1,25 @@ + + + diff --git a/src/components/new-x-table/components/TextXTableFilter.vue b/src/components/new-x-table/components/TextXTableFilter.vue new file mode 100644 index 0000000..7f9329f --- /dev/null +++ b/src/components/new-x-table/components/TextXTableFilter.vue @@ -0,0 +1,30 @@ + + + diff --git a/src/components/new-x-table/components/XFilterRow.vue b/src/components/new-x-table/components/XFilterRow.vue new file mode 100644 index 0000000..7d73657 --- /dev/null +++ b/src/components/new-x-table/components/XFilterRow.vue @@ -0,0 +1,164 @@ + + + + + diff --git a/src/components/new-x-table/index.js b/src/components/new-x-table/index.js new file mode 100644 index 0000000..5f14548 --- /dev/null +++ b/src/components/new-x-table/index.js @@ -0,0 +1,6 @@ +import Xtc from "./model/Xtc"; +import XTbl from "./model/XTbl"; + +export {Xtc}; +export default XTbl; + diff --git a/src/components/new-x-table/index__.ts b/src/components/new-x-table/index__.ts new file mode 100644 index 0000000..d29b327 --- /dev/null +++ b/src/components/new-x-table/index__.ts @@ -0,0 +1,30 @@ +export interface Xtc { + title: string; + key: string; + + filter(): Xtc; + + filterSwitch(): Xtc; + + filterSelect(items: {}[]): Xtc; + + filterDate(): Xtc; + + filterNumber(): Xtc; + + renderSlot(slotName: string): Xtc; + + export(): {}; +} + +export interface XTbl { + + title: string; + url: string; + cols: Xtc[]; + + addCol(col: Xtc): void; + + addAll(cols: Xtc[]): void; + +} diff --git a/src/components/new-x-table/model/XTbl.js b/src/components/new-x-table/model/XTbl.js new file mode 100644 index 0000000..0435f6d --- /dev/null +++ b/src/components/new-x-table/model/XTbl.js @@ -0,0 +1,62 @@ +import Xtc from './Xtc' + +export default class XTbl { + title; + url; + cols; + opt; + + constructor(url, title) { + this.url = url; + this.title = title; + } + + add(col) { + if (!this.cols) { + this.cols = []; + } + this.cols.push(col); + } + + + addOpt(col, slotEdit, slotDelete, ridEdit, ridDelete) { + this.opt = new Xtc('opt', 'عملیات').noSort(); + this.opt.opt = true; + this.opt.slotEdit = slotEdit; + this.opt.slotDelete = slotDelete; + this.cols.push(this.opt) + return this; + } + + + hidePagination() { + this._hidePageination = true; + return this; + } + + + getSortFields() { + return this.cols.filter((item) => item.__sorter) + } + + hideSearch() { + this._hidePageination = true; + return this; + } + + addExtraBtn(btn) { + this._hidePageination = true; + return this; + } + + noSearch() { + this._noSearch = true; + return this; + } + + noSettings() { + this._noSettings = true; + return this; + } +} + diff --git a/src/components/new-x-table/model/Xtc.js b/src/components/new-x-table/model/Xtc.js new file mode 100644 index 0000000..af28984 --- /dev/null +++ b/src/components/new-x-table/model/Xtc.js @@ -0,0 +1,106 @@ +export default class Xtc { + constructor(key, title) { + this.key = key; + this.title = title; + this.dataIndex = key; + this.show = true; + this.__sorter = true; + } + + export() { + let exp = {}; + exp['key'] = this.key; + exp['__key'] = this.__fkey; + exp['dataIndex'] = this.key; + exp['title'] = this.title; + if (this._slots) { + if(!this._slots.filterIcon){ + this._slots.filterIcon = 'filterIcon'; + } + exp['scopedSlots'] = this._slots; + } + if (this.filter) { + this.filter = this.filterType; + this.filtered = true; + } + return exp; + } + + filterKey(key){ + this.__fkey = key; + this.master = key; + return this; + } + + renderSlot(name) { + this._slots = { + customRender: name + }; + if (!this.scopedSlots) { + this.scopedSlots = {} + } + this.scopedSlots.customRender = name; + return this; + } + + __filter() { + this.filtered = true; + if (!this._slots) { + this.scopedSlots = {}; + } + this.scopedSlots.filterDropdown = `${this.key}_filterDropdown`; + this.scopedSlots.filterIcon = `${this.key}_filterIcon`; + } + + filterText() { + this.__filter(); + this.filterType = 'default'; + return this; + } + + filterSwitch() { + this.__filter(); + + this.filterType = 'switch'; + return this; + } + + + filterQuery(action) { + this.__filter(); + this.filterType = 'query'; + this.filterAction = action; + return this; + } + + filterDate() { + this.__filter(); + this.filterType = 'date'; + return this; + } + + filterSelect(items) { + this.__filter(); + this.filterType = 'select'; + this.filterItems = items; + return this; + } + + filterNumber() { + this.__filter(); + this.filterType = 'number'; + return this; + } + + noSort() { + this.__sorter = false; + return this; + } + + hidden() { + this.show = false; + return this; + } + +} + diff --git a/src/components/new-x-table/run.sh b/src/components/new-x-table/run.sh new file mode 100644 index 0000000..2e91c20 --- /dev/null +++ b/src/components/new-x-table/run.sh @@ -0,0 +1 @@ +git add . && git commit -m "Auto" && git push \ No newline at end of file diff --git a/src/components/new-x-table/test.js b/src/components/new-x-table/test.js new file mode 100644 index 0000000..5873690 --- /dev/null +++ b/src/components/new-x-table/test.js @@ -0,0 +1,15 @@ +import XTbl, {Xtc} from './index'; + +const tbl = new XTbl('http://kheyr.flut.ir/api/get-person', 'جدول مشتریان'); +tbl.add(new Xtc('id', 'آیدی').filterNumber()); +tbl.add(new Xtc('title', 'عنوان').filterText()) +tbl.add(new Xtc('fname', 'نام کوچک').filterText()) +tbl.add(new Xtc('lname', 'نام بزرگ').filterText()) +tbl.add(new Xtc('ncode', 'کد ملی').filterText().hidden().noSort()) +tbl.add(new Xtc('birth_date', 'تاریخ تولد').filterDate().hidden().noSort()) +tbl.add(new Xtc('sts_str', 'وضعیت').renderSlot('sts_str').filterSelect({1: 'گزینه اول'}).noSort()) +tbl.add(new Xtc('active', 'فعال').filterSwitch().hidden().noSort()) +tbl.add(new Xtc('wow', 'فعال').filterSwitch().renderSlot('wow').noSort()) +tbl.addOpt() + +export default tbl; diff --git a/src/components/x-table/XTable.vue b/src/components/x-table/XTable.vue index 5300fa2..1e334f9 100644 --- a/src/components/x-table/XTable.vue +++ b/src/components/x-table/XTable.vue @@ -238,7 +238,7 @@ }, mounted() { this.fetch(); - console.log("this.model ==> ", this.model); + // console.log("this.model ==> ", this.model); } } diff --git a/src/fake-db/data/apps/calendar/index.js b/src/fake-db/data/apps/calendar/index.js index 8416c73..d07ceaa 100644 --- a/src/fake-db/data/apps/calendar/index.js +++ b/src/fake-db/data/apps/calendar/index.js @@ -37,7 +37,7 @@ mock.onGet('/api/apps/calendar/events').reply(() => { return [200, data.events] }) -// POST : Add new events +// POST : Add new-x-table events mock.onPost('/api/apps/calendar/events/').reply((request) => { // Get event from post data diff --git a/src/fake-db/data/apps/email/index.js b/src/fake-db/data/apps/email/index.js index c395656..29e0486 100644 --- a/src/fake-db/data/apps/email/index.js +++ b/src/fake-db/data/apps/email/index.js @@ -677,13 +677,13 @@ mock.onPost('/api/apps/email/set-starred').reply((request) => { // let event = data.events.find((event) => event.id == eventId) // const payload = JSON.parse(request.data).payload -// const draggedDateStart = new Date(payload.date) +// const draggedDateStart = new-x-table Date(payload.date) -// const eventStartDate = new Date(event.startDate).getTime() -// const eventEndDate = new Date(event.endDate).getTime() +// const eventStartDate = new-x-table Date(event.startDate).getTime() +// const eventEndDate = new-x-table Date(event.endDate).getTime() // const diff = draggedDateStart - eventStartDate -// const newEndDate = new Date(eventEndDate + diff) +// const newEndDate = new-x-table Date(eventEndDate + diff) // event.startDate = draggedDateStart // event.endDate = newEndDate diff --git a/src/fake-db/data/apps/todo/index.js b/src/fake-db/data/apps/todo/index.js index 28e0e52..aefb31d 100644 --- a/src/fake-db/data/apps/todo/index.js +++ b/src/fake-db/data/apps/todo/index.js @@ -132,7 +132,7 @@ const data = { ] } -// POST : Add new Tasks +// POST : Add new-x-table Tasks mock.onPost('/api/apps/todo/tasks/').reply((request) => { // Get task from post data diff --git a/src/fake-db/data/data-list/index.js b/src/fake-db/data/data-list/index.js index 90db831..e1503b5 100644 --- a/src/fake-db/data/data-list/index.js +++ b/src/fake-db/data/data-list/index.js @@ -910,7 +910,7 @@ mock.onGet('/api/data-list/products').reply(() => { return [200, JSON.parse(JSON.stringify(data.products)).reverse()] }) -// POST : Add new Item +// POST : Add new-x-table Item mock.onPost('/api/data-list/products/').reply((request) => { // Get event from post data diff --git a/src/fake-db/data/user-management/index.js b/src/fake-db/data/user-management/index.js index 633be74..23570b2 100644 --- a/src/fake-db/data/user-management/index.js +++ b/src/fake-db/data/user-management/index.js @@ -666,7 +666,7 @@ mock.onGet(/\/api\/user-management\/users\/\d+/).reply((request) => { return user ? [200, JSON.parse(JSON.stringify(user))] : [404] }) -// // POST : Add new Item +// // POST : Add new-x-table Item // mock.onPost("/api/data-list/products/").reply((request) => { // // Get event from post data diff --git a/src/layouts/components/vertical-nav-menu/VerticalNavMenu.vue b/src/layouts/components/vertical-nav-menu/VerticalNavMenu.vue index 4f89a99..3353b4d 100644 --- a/src/layouts/components/vertical-nav-menu/VerticalNavMenu.vue +++ b/src/layouts/components/vertical-nav-menu/VerticalNavMenu.vue @@ -167,7 +167,32 @@ export default { } }, menuItemsUpdated () { - const clone = this.navMenuItems.slice() + let new_item = [] + // const clone = th + // .filter(item=> item.items) + const per = this.$store.state.access.permissions + // console.log(per,'perererererer') + if(per != undefined){ + this.navMenuItems.map( menus=> { + // item=>item.items.map(menus=>{ + if (menus.submenu) { + let submenu = menus.submenu.filter(menu => (menu.permissionId && per.includes(menu.permissionId))) + menus.submenu = submenu + if (submenu.length) new_item.push(menus) + } else { + if ((menus.permissionId && per.includes(menus.permissionId))) { + new_item.push(menus) + } + } + // }) + }) + return new_item + } + + // console.log(new_item,'new_item') + + + /*const clone = this.navMenuItems.slice() for (const [index, item] of this.navMenuItems.entries()) { if (item.header && item.items.length && (index || 1)) { @@ -181,7 +206,7 @@ export default { console.log(clone ) - return clone + return clone*/ }, isVerticalNavMenuActive: { get () { return this.$store.state.isVerticalNavMenuActive }, diff --git a/src/layouts/components/vertical-nav-menu/navMenuItems.js b/src/layouts/components/vertical-nav-menu/navMenuItems.js index 18739da..43099da 100644 --- a/src/layouts/components/vertical-nav-menu/navMenuItems.js +++ b/src/layouts/components/vertical-nav-menu/navMenuItems.js @@ -6,12 +6,14 @@ export default [ icon: 'HomeIcon', i18n: 'داشبورد', slug: "config", + permissionId:'home' }, { url: '/config', icon: 'LayersIcon', i18n: 'پیکربندی', slug: 'config', + permissionId:'config' }, { url: "/proposal", @@ -19,6 +21,7 @@ export default [ slug: "proposal", icon: "AlignJustifyIcon", i18n: "درخواست ها", + permissionId:'request' }, { url: "/personel", @@ -26,6 +29,7 @@ export default [ slug: "personel", icon: "AlignJustifyIcon", i18n: "اطلاعات پرسنلی", + permissionId:'personnel' }, { url: "/permission", @@ -33,6 +37,15 @@ export default [ slug: "permission", icon: "AlignJustifyIcon", i18n: "سطح دسترسی", + permissionId:'permission.show' + }, + { + url: "/users", + name: "users", + slug: "users", + icon: "UserIcon", + i18n: "کاربران", + permissionId:'user' } ] diff --git a/src/main.js b/src/main.js index 5a8842c..80e18e7 100644 --- a/src/main.js +++ b/src/main.js @@ -132,6 +132,27 @@ require('./assets/css/iconfont.css') // Note: In latest version you have to add it separately // import 'vue-select/dist/vue-select.css'; +//permission functions +Vue.prototype.$getAccess = (rid)=>{ + const roles = store.state.access.permissions + if(roles){ + return roles.includes(rid) + } +} +import VuePersianDatetimePicker from 'vue-persian-datetime-picker'; +Vue.use(VuePersianDatetimePicker, { + name: 'date-picker', + props: { + format: 'YYYY-MM-DD HH:mm', + displayFormat: 'jYYYY-jMM-jDD HH:mm', + editable: false, + inputClass: '', + placeholder: 'انتخاب کنید', + altFormat: 'YYYY-MM-DD HH:mm', + color: '#1DA57A', + autoSubmit: true, + } +}); Vue.config.productionTip = false diff --git a/src/router.js b/src/router.js index e3dcf3f..cd74431 100644 --- a/src/router.js +++ b/src/router.js @@ -49,7 +49,10 @@ const router = new Router({ { path: '/', name: 'dashboard', - redirect: '/dashboard' + redirect: '/dashboard', + meta: { + rule: 'editor' + } }, { path: '/dashboard', @@ -86,6 +89,24 @@ const router = new Router({ parent: 'main' } }, + { + path: '/users', + name: 'users', + component: () => import('./views/users/users.vue'), + meta: { + rule: 'editor', + parent: 'main' + } + }, + { + path: '/register/users', + name: 'register-users', + component: () => import('./views/users/create.vue'), + meta: { + rule: 'editor', + parent: 'main' + } + }, { path: '/register/personnel', name: 'register-personnel', @@ -106,6 +127,23 @@ const router = new Router({ }, ] }, + + { + path: '/pages/error-404', + name: 'error-404', + component: () => import('./views/pages/Error404'), + meta: { + rule: 'editor' + } + }, + { + path: '/pages/error-403', + name: 'error-403', + component: () => import('./views/pages/NotAuthorized'), + meta: { + rule: 'editor' + } + }, { path: '*', redirect: '/pages/error-404' @@ -125,21 +163,20 @@ router.beforeEach((to, from, next) => { let isLogin = sessionStorage.getItem('accessToken'); //console.log("to.path ==> ", to.path); if ( - ( to.path === "/register/form" || to.path === "/auth/login" || to.path === "/auth/register" || to.path === "/pages/error-404" || + to.path === "/pages/error-403" || to.path === "/auth/forgot-password" - ) - ) { + ) { /* if (isLogin) { router.push({path: '/'}); }*/ return next(); } - if (!isLogin) { + else if (!isLogin) { router.push({path: '/auth/login'}); return; } else { diff --git a/src/store/access/access.js b/src/store/access/access.js index ac552a1..edbfadf 100644 --- a/src/store/access/access.js +++ b/src/store/access/access.js @@ -1,13 +1,34 @@ import axios from '@/axios' +function getParents(keys) { + let parents = [] + while (keys.length > 1) { + keys.pop() + parents.push(keys.join('.')) + } + return parents +} + const state = { loading: false, - access_id:undefined + access_id:undefined, + permissions:undefined }; const actions = { - + setPermissions({commit}, payload){ + let rid = payload + payload.map(x => { + const keys = x.split('.') + if (keys.length > 1) { + const set1 = new Set([...rid, ...getParents(keys)]) + rid = [...set1] + } + }) + console.log("rid",rid) + commit('SetPermissions', rid); + }, async save({commit}, payload) { try { commit('LOADING', true); @@ -33,6 +54,9 @@ const actions = { } const mutations = { + SetPermissions(state, payload) { + state.permissions = payload; + }, LOADING(state, payload) { state.loading = payload; }, diff --git a/src/store/auth/moduleAuthActions.js b/src/store/auth/moduleAuthActions.js index b2d248b..b57a3f7 100644 --- a/src/store/auth/moduleAuthActions.js +++ b/src/store/auth/moduleAuthActions.js @@ -174,7 +174,7 @@ export default { // if username update is not required // just reload the page to get fresh data - // set new user data in localstorage + // set new-x-table user data in localstorage if (!isUsernameUpdateRequired) { router.push(router.currentRoute.query.to || '/') commit('UPDATE_USER_INFO', result.user.providerData[0], {root: true}) diff --git a/src/store/data-list/moduleDataListActions.js b/src/store/data-list/moduleDataListActions.js index e063bca..d4fd8ca 100644 --- a/src/store/data-list/moduleDataListActions.js +++ b/src/store/data-list/moduleDataListActions.js @@ -31,7 +31,7 @@ export default { }) }, // fetchEventLabels({ commit }) { - // return new Promise((resolve, reject) => { + // return new-x-table Promise((resolve, reject) => { // axios.get("/api/apps/calendar/labels") // .then((response) => { // commit('SET_LABELS', response.data) @@ -61,14 +61,14 @@ export default { }) } // eventDragged({ commit }, payload) { - // return new Promise((resolve, reject) => { + // return new-x-table Promise((resolve, reject) => { // axios.post(`/api/apps/calendar/event/dragged/${payload.event.id}`, {payload: payload}) // .then((response) => { // // Convert Date String to Date Object // let event = response.data - // event.startDate = new Date(event.startDate) - // event.endDate = new Date(event.endDate) + // event.startDate = new-x-table Date(event.startDate) + // event.endDate = new-x-table Date(event.endDate) // commit('UPDATE_EVENT', event) // resolve(response) diff --git a/src/store/eCommerce/moduleECommerceState.js b/src/store/eCommerce/moduleECommerceState.js index 97250af..ab39f62 100644 --- a/src/store/eCommerce/moduleECommerceState.js +++ b/src/store/eCommerce/moduleECommerceState.js @@ -15,7 +15,7 @@ export default { { "name": "Beats by Dr. Dre - Geek Squad Certified Refurbished Beats Studio Wireless On-Ear Headphones - Red", "description": "Rock out to your favorite songs with these Beats by Dr. Dre Beats Studio Wireless GS-MH8K2AM/A headphones that feature a Beats Acoustic Engine and DSP software for enhanced clarity. ANC (Adaptive Noise Cancellation) allows you to focus on your tunes.", "brand": "Beats by Dr. Dre", "categories": ["Audio", "Headphones", "All Headphones"], "hierarchicalCategories": { "lvl0": "Audio", "lvl1": "Audio > Headphones", "lvl2": "Audio > Headphones > All Headphones" }, "type": "Refurbished beats", "price": 379.99, "price_range": "200 - 500", "image": "https://cdn-demo.algolia.com/bestbuy-0118/4784058_sb.jpg", "url": "https://api.bestbuy.com/click/-/4784058/pdp", "free_shipping": false, "rating": 4, "popularity": 15883, "objectID": "4784058", "_highlightResult": { "name": { "value": "Beats by Dr. Dre - Geek Squad Certified Refurbished Beats Studio Wireless On-Ear Headphones - Red", "matchLevel": "full", "fullyHighlighted": false, "matchedWords": ["beats", "by", "dr"] }, "description": { "value": "Rock out to your favorite songs with these Beats by Dr. Dre Beats Studio Wireless GS-MH8K2AM/A headphones that feature a Beats Acoustic Engine and DSP software for enhanced clarity. ANC (Adaptive Noise Cancellation) allows you to focus on your tunes.", "matchLevel": "full", "fullyHighlighted": false, "matchedWords": ["beats", "by", "dr"] }, "brand": { "value": "Beats by Dr. Dre", "matchLevel": "full", "fullyHighlighted": false, "matchedWords": ["beats", "by", "dr"] }, "categories": [{ "value": "Audio", "matchLevel": "none", "matchedWords": [] }, { "value": "Headphones", "matchLevel": "none", "matchedWords": [] }, { "value": "All Headphones", "matchLevel": "none", "matchedWords": [] }] }, "quantity": 1, "discount_in_percentage": 12, "offers_count": 3, "delivery_date": "Wed Apr 9" }, { "name": "Sony - PlayStation 4 Pro Console", "description": "PS4 Pro Dynamic 4K Gaming & 4K Entertainment* PS4 Pro gets you closer to your game. Heighten your experiences. Enrich your adventures. Let the super-charged PS4 Pro lead the way.** GREATNESS AWAITS", "brand": "Sony", "categories": ["Video Games", "PlayStation 4", "PS4 Consoles"], "hierarchicalCategories": { "lvl0": "Video Games", "lvl1": "Video Games > PlayStation 4", "lvl2": "Video Games > PlayStation 4 > PS4 Consoles" }, "type": "Playstation 4 hw", "price": 399.99, "price_range": "200 - 500", "image": "https://cdn-demo.algolia.com/bestbuy-0118/5388900_sb.jpg", "url": "https://api.bestbuy.com/click/-/5388900/pdp", "free_shipping": true, "rating": 4, "popularity": 21402, "objectID": "5388900", "_highlightResult": { "name": { "value": "Sony - PlayStation 4 Pro Console", "matchLevel": "full", "fullyHighlighted": false, "matchedWords": ["sony", "pla"] }, "description": { "value": "PS4 Pro Dynamic 4K Gaming & 4K Entertainment* PS4 Pro gets you closer to your game. Heighten your experiences. Enrich your adventures. Let the super-charged PS4 Pro lead the way.** GREATNESS AWAITS", "matchLevel": "none", "matchedWords": [] }, "brand": { "value": "Sony", "matchLevel": "partial", "fullyHighlighted": true, "matchedWords": ["sony"] }, "categories": [{ "value": "Video Games", "matchLevel": "none", "matchedWords": [] }, { "value": "PlayStation 4", "matchLevel": "partial", "fullyHighlighted": false, "matchedWords": ["pla"] }, { "value": "PS4 Consoles", "matchLevel": "none", "matchedWords": [] }] }, "quantity": 1, "discount_in_percentage": 3, "offers_count": 1, "delivery_date": "Wed Apr 12" }, { "name": "Apple - Macbook® (Latest Model) - 12\" Display - Intel Core M5 - 8GB Memory - 512GB Flash Storage - Space Gray", "description": "MacBook delivers a full-size experience in the lightest and most compact Mac notebook ever. With a full-size keyboard, force-sensing trackpad, 12-inch Retina display,1 sixth-generation Intel Core M processor, multifunctional USB-C port, and now up to 10 hours of battery life,2 MacBook features big thinking in an impossibly compact form.", "brand": "Apple", "categories": ["Computers & Tablets", "Laptops", "All Laptops", "MacBooks"], "hierarchicalCategories": { "lvl0": "Computers & Tablets", "lvl1": "Computers & Tablets > Laptops", "lvl2": "Computers & Tablets > Laptops > All Laptops", "lvl3": "Computers & Tablets > Laptops > All Laptops > MacBooks" }, "type": "Apple", "price": 1599.99, "price_range": "500 - 2000", "image": "https://cdn-demo.algolia.com/bestbuy-0118/5229600_sb.jpg", "url": "https://api.bestbuy.com/click/-/5229600/pdp", "free_shipping": true, "rating": 4, "popularity": 19609, "objectID": "5229600", "_highlightResult": { "name": { "value": "Apple - Macbook® (Latest Model) - 12" Display - Intel Core M5 - 8GB Memory - 512GB Flash Storage - Space Gray", "matchLevel": "partial", "fullyHighlighted": false, "matchedWords": ["apple"] }, "description": { "value": "MacBook delivers a full-size experience in the lightest and most compact Mac notebook ever. With a full-size keyboard, force-sensing trackpad, 12-inch Retina display,1 sixth-generation Intel Core M processor, multifunctional USB-C port, and now up to 10 hours of battery life,2 MacBook features big thinking in an impossibly compact form.", "matchLevel": "none", "matchedWords": [] }, "brand": { "value": "Apple", "matchLevel": "partial", "fullyHighlighted": true, "matchedWords": ["apple"] }, "categories": [{ "value": "Computers & Tablets", "matchLevel": "none", "matchedWords": [] }, { "value": "Laptops", "matchLevel": "partial", "fullyHighlighted": true, "matchedWords": ["laptop"] }, { "value": "All Laptops", "matchLevel": "partial", "fullyHighlighted": false, "matchedWords": ["laptop"] }, { "value": "MacBooks", "matchLevel": "none", "matchedWords": [] }] }, "quantity": 1, "discount_in_percentage": 7, "offers_count": 1, "delivery_date": "Wed Apr 14" }, - { "name": "Apple - Apple Watch Series 1 42mm Space Gray Aluminum Case Black Sport Band - Space Gray Aluminum", "description": "Durable, lightweight aluminum cases in silver, space gray, gold, and rose gold. Sport Band in a variety of colors. All the features of the original Apple Watch, plus a new dual-core processor for faster performance. All models run watchOS 3. Requires an iPhone 5 or later.", "brand": "Apple", "categories": ["Wearable Technology", "Apple Watch", "Apple Watch Series 1"], "hierarchicalCategories": { "lvl0": "Wearable Technology", "lvl1": "Wearable Technology > Apple Watch", "lvl2": "Wearable Technology > Apple Watch > Apple Watch Series 1" }, "type": "Standard apple watch", "price": 299, "price_range": "200 - 500", "image": "https://cdn-demo.algolia.com/bestbuy-0118/5546604_sb.jpg", "url": "https://api.bestbuy.com/click/-/5546604/pdp", "free_shipping": true, "rating": 4, "popularity": 21419, "objectID": "5546604", "_highlightResult": { "name": { "value": "Apple - Apple Watch Series 1 42mm Space Gray Aluminum Case Black Sport Band - Space Gray Aluminum", "matchLevel": "full", "fullyHighlighted": false, "matchedWords": ["apple"] }, "description": { "value": "Durable, lightweight aluminum cases in silver, space gray, gold, and rose gold. Sport Band in a variety of colors. All the features of the original Apple Watch, plus a new dual-core processor for faster performance. All models run watchOS 3. Requires an iPhone 5 or later.", "matchLevel": "full", "fullyHighlighted": false, "matchedWords": ["apple"] }, "brand": { "value": "Apple", "matchLevel": "full", "fullyHighlighted": true, "matchedWords": ["apple"] }, "categories": [{ "value": "Wearable Technology", "matchLevel": "none", "matchedWords": [] }, { "value": "Apple Watch", "matchLevel": "full", "fullyHighlighted": false, "matchedWords": ["apple"] }, { "value": "Apple Watch Series 1", "matchLevel": "full", "fullyHighlighted": false, "matchedWords": ["apple"] }], "type": { "value": "Standard apple watch", "matchLevel": "full", "fullyHighlighted": false, "matchedWords": ["apple"] } }, "quantity": 1, "discount_in_percentage": 17, "offers_count": 4, "delivery_date": "Wed Apr 15" }, + { "name": "Apple - Apple Watch Series 1 42mm Space Gray Aluminum Case Black Sport Band - Space Gray Aluminum", "description": "Durable, lightweight aluminum cases in silver, space gray, gold, and rose gold. Sport Band in a variety of colors. All the features of the original Apple Watch, plus a new-x-table dual-core processor for faster performance. All models run watchOS 3. Requires an iPhone 5 or later.", "brand": "Apple", "categories": ["Wearable Technology", "Apple Watch", "Apple Watch Series 1"], "hierarchicalCategories": { "lvl0": "Wearable Technology", "lvl1": "Wearable Technology > Apple Watch", "lvl2": "Wearable Technology > Apple Watch > Apple Watch Series 1" }, "type": "Standard apple watch", "price": 299, "price_range": "200 - 500", "image": "https://cdn-demo.algolia.com/bestbuy-0118/5546604_sb.jpg", "url": "https://api.bestbuy.com/click/-/5546604/pdp", "free_shipping": true, "rating": 4, "popularity": 21419, "objectID": "5546604", "_highlightResult": { "name": { "value": "Apple - Apple Watch Series 1 42mm Space Gray Aluminum Case Black Sport Band - Space Gray Aluminum", "matchLevel": "full", "fullyHighlighted": false, "matchedWords": ["apple"] }, "description": { "value": "Durable, lightweight aluminum cases in silver, space gray, gold, and rose gold. Sport Band in a variety of colors. All the features of the original Apple Watch, plus a new-x-table dual-core processor for faster performance. All models run watchOS 3. Requires an iPhone 5 or later.", "matchLevel": "full", "fullyHighlighted": false, "matchedWords": ["apple"] }, "brand": { "value": "Apple", "matchLevel": "full", "fullyHighlighted": true, "matchedWords": ["apple"] }, "categories": [{ "value": "Wearable Technology", "matchLevel": "none", "matchedWords": [] }, { "value": "Apple Watch", "matchLevel": "full", "fullyHighlighted": false, "matchedWords": ["apple"] }, { "value": "Apple Watch Series 1", "matchLevel": "full", "fullyHighlighted": false, "matchedWords": ["apple"] }], "type": { "value": "Standard apple watch", "matchLevel": "full", "fullyHighlighted": false, "matchedWords": ["apple"] } }, "quantity": 1, "discount_in_percentage": 17, "offers_count": 4, "delivery_date": "Wed Apr 15" }, ], wishList: [ { "name": "Bowers & Wilkins - CM10 S2 Triple 6-1/2\" 3-Way Floorstanding Speaker (Each) - Gloss Black", "description": "Featuring triple 6-1/2\" bass cones, a 6\" midrange cone and a 1\" tweeter, this Bowers & Wilkins CM10 S2 floorstanding speaker fills a large room with stunning, true-to-life audio. The tweeter-on-top design ensures studio-grade sound is emitted.", "brand": "Bowers & Wilkins", "categories": ["Audio", "Home Audio", "Speakers", "Floor Speakers"], "hierarchicalCategories": { "lvl0": "Audio", "lvl1": "Audio > Home Audio", "lvl2": "Audio > Home Audio > Speakers", "lvl3": "Audio > Home Audio > Speakers > Floor Speakers" }, "type": "Mht floor speakers", "price": 1999.98, "price_range": "500 - 2000", "image": "https://cdn-demo.algolia.com/bestbuy-0118/8434275_sb.jpg", "url": "https://api.bestbuy.com/click/-/8434275/pdp", "free_shipping": false, "rating": 5, "popularity": 17253, "objectID": "8434275", "_highlightResult": { "name": { "value": "Bowers & Wilkins - CM10 S2 Triple 6-1/2" 3-Way Floorstanding Speaker (Each) - Gloss Black", "matchLevel": "none", "matchedWords": [] }, "description": { "value": "Featuring triple 6-1/2" bass cones, a 6" midrange cone and a 1" tweeter, this Bowers & Wilkins CM10 S2 floorstanding speaker fills a large room with stunning, true-to-life audio. The tweeter-on-top design ensures studio-grade sound is emitted.", "matchLevel": "none", "matchedWords": [] }, "brand": { "value": "Bowers & Wilkins", "matchLevel": "none", "matchedWords": [] }, "categories": [{ "value": "Audio", "matchLevel": "none", "matchedWords": [] }, { "value": "Home Audio", "matchLevel": "none", "matchedWords": [] }, { "value": "Speakers", "matchLevel": "none", "matchedWords": [] }, { "value": "Floor Speakers", "matchLevel": "none", "matchedWords": [] }] } }, diff --git a/src/store/user-management/moduleUserManagementActions.js b/src/store/user-management/moduleUserManagementActions.js index 6f765db..f5b4ffe 100644 --- a/src/store/user-management/moduleUserManagementActions.js +++ b/src/store/user-management/moduleUserManagementActions.js @@ -11,7 +11,7 @@ import axios from '@/axios.js' export default { // addItem({ commit }, item) { - // return new Promise((resolve, reject) => { + // return new-x-table Promise((resolve, reject) => { // axios.post("/api/data-list/products/", {item: item}) // .then((response) => { // commit('ADD_ITEM', Object.assign(item, {id: response.data.id})) diff --git a/src/views/ad/tablePackage.js b/src/views/ad/tablePackage.js index 2efef12..97563fd 100644 --- a/src/views/ad/tablePackage.js +++ b/src/views/ad/tablePackage.js @@ -1,4 +1,4 @@ -import XTbl,{Xtc} from '../../components/x-table/index'; +import XTbl,{Xtc} from '../../components/new-x-table/index'; const tbl = new XTbl('/admin/ipc/table', 'لسیت بسته ها'); tbl.add(new Xtc('title', 'نام بسته').filterText()) diff --git a/src/views/adv/AdvEdit.vue b/src/views/adv/AdvEdit.vue index 268e33e..ded401e 100644 --- a/src/views/adv/AdvEdit.vue +++ b/src/views/adv/AdvEdit.vue @@ -271,13 +271,13 @@ const {data} = await axios.get('site/city'); console.log(data,'city') this.cities = data; - // this.provinces = new Set(Object.values(data).map((item) => item[0])); + // this.provinces = new-x-table Set(Object.values(data).map((item) => item[0])); }, // async getCity() { // const {data} = await axios.get('site/city'); // this.provinceCities = data; - // this.provinces = new Set(Object.values(data).map((item) => item[0])); + // this.provinces = new-x-table Set(Object.values(data).map((item) => item[0])); // }, // // changeProvinces(value) { diff --git a/src/views/adv/AdvImagesComponent.vue b/src/views/adv/AdvImagesComponent.vue index 9de2817..5f33964 100644 --- a/src/views/adv/AdvImagesComponent.vue +++ b/src/views/adv/AdvImagesComponent.vue @@ -25,8 +25,8 @@ +--> diff --git a/src/views/personel/Personel.vue b/src/views/personel/Personel.vue index 013cf0c..780854f 100644 --- a/src/views/personel/Personel.vue +++ b/src/views/personel/Personel.vue @@ -4,7 +4,7 @@
- + ثبت پرسنل جدید - + + - - + +
- + example @@ -37,7 +48,8 @@
-
@@ -212,12 +224,27 @@
+
+ + + +
+
+ + + + {{ item }} + + + +
+
- افزودن اطلاعات خانوادگی + افزودن اطلاعات خانوادگی
-