From ed4d37c8fb75d8f3352f038a7c9719e4e7a235ed Mon Sep 17 00:00:00 2001 From: Ahmed Bouhuolia Date: Fri, 13 Sep 2019 20:24:09 +0200 Subject: [PATCH] Custom fields feature. --- client/src/components/SvgIcon/index.vue | 58 ++++ client/src/lang/en/app.js | 17 + client/src/main.js | 7 +- client/src/mixins/Reloadable.js | 20 ++ client/src/pages/Auth/Auth.vue | 44 --- client/src/pages/Auth/AuthContainer.vue | 207 ++++++++++++ client/src/pages/Auth/AuthFooter.vue | 15 + client/src/pages/Auth/AuthMedia.vue | 11 + client/src/pages/Auth/ForgetPassword.vue | 5 + client/src/pages/Auth/Login.vue | 30 +- .../pages/Dashboard/Accounts/AccountForm.vue | 14 + .../AccountsList.vue} | 6 +- client/src/pages/Dashboard/Items/ItemForm.vue | 34 ++ .../pages/Dashboard/Items/ItemsDatatable.vue | 55 ++++ .../src/pages/Dashboard/Items/ItemsList.vue | 27 ++ .../ItemsCategories/ItemCategoryForm.vue | 18 + .../ItemsCategories/ItemsCategories.vue | 42 +++ .../pages/Dashboard/Products/ProductForm.vue | 3 - client/src/pages/Dashboard/Roles/RoleForm.vue | 0 .../src/pages/Dashboard/Roles/RolesList.vue | 0 client/src/pages/Dashboard/Users/UserForm.vue | 0 .../src/pages/Dashboard/Users/UsersList.vue | 14 + client/src/plugins/api-service.js | 8 +- client/src/plugins/icons.js | 9 + client/src/router/routes.js | 54 ++- client/src/store/modules/app.js | 17 +- client/src/store/modules/auth.js | 2 +- client/src/store/modules/customers.js | 4 +- client/src/store/modules/errorLog.js | 28 ++ client/src/store/modules/items.js | 48 +++ client/src/store/modules/roles.js | 0 client/src/store/modules/sidebar.js | 44 ++- client/src/utils.js | 38 +++ client/src/views/Dialogs/SearchDialog.vue | 14 + client/src/views/Sidebar/SidebarItem.vue | 3 +- client/src/views/Sidebar/index.vue | 2 +- client/src/views/Topbar.vue | 16 +- server/package-lock.json | 159 +++++++-- server/package.json | 1 + server/src/database/factories/index.js | 47 +++ ...0822214905_create_resource_fields_table.js | 16 + .../20190822214905_create_views_columns.js | 10 + ...20190822214905_create_views_roles_table.js | 13 + .../20190822214905_create_views_table.js | 11 + .../http/controllers/AccountOpeningBalance.js | 9 +- server/src/http/controllers/Accounts.js | 25 +- server/src/http/controllers/Authentication.js | 2 +- server/src/http/controllers/Fields.js | 246 ++++++++++++++ server/src/http/controllers/ItemCategories.js | 28 +- server/src/http/controllers/Views.js | 194 +++++++++++ server/src/http/index.js | 4 + server/src/models/Account.js | 5 + server/src/models/Resource.js | 12 +- server/src/models/ResourceField.js | 37 +++ server/src/models/View.js | 38 +++ server/src/models/ViewColumn.js | 19 ++ server/src/models/ViewRole.js | 22 ++ server/src/models/bookshelf.js | 2 + server/tests/models/Resource.test.js | 25 ++ server/tests/models/ResourceField.test.js | 18 + server/tests/models/View.test.js | 42 +++ server/tests/routes/fields.test.js | 215 ++++++++++++ server/tests/routes/roles.test.js | 4 +- server/tests/routes/views.test.js | 310 ++++++++++++++++++ 64 files changed, 2307 insertions(+), 121 deletions(-) create mode 100644 client/src/components/SvgIcon/index.vue create mode 100644 client/src/mixins/Reloadable.js delete mode 100644 client/src/pages/Auth/Auth.vue create mode 100644 client/src/pages/Auth/AuthContainer.vue create mode 100644 client/src/pages/Auth/AuthFooter.vue create mode 100644 client/src/pages/Auth/AuthMedia.vue create mode 100644 client/src/pages/Dashboard/Accounts/AccountForm.vue rename client/src/pages/Dashboard/{Products/ProductsList.vue => Accounts/AccountsList.vue} (57%) create mode 100644 client/src/pages/Dashboard/Items/ItemForm.vue create mode 100644 client/src/pages/Dashboard/Items/ItemsDatatable.vue create mode 100644 client/src/pages/Dashboard/Items/ItemsList.vue create mode 100644 client/src/pages/Dashboard/ItemsCategories/ItemCategoryForm.vue create mode 100644 client/src/pages/Dashboard/ItemsCategories/ItemsCategories.vue delete mode 100644 client/src/pages/Dashboard/Products/ProductForm.vue create mode 100644 client/src/pages/Dashboard/Roles/RoleForm.vue create mode 100644 client/src/pages/Dashboard/Roles/RolesList.vue create mode 100644 client/src/pages/Dashboard/Users/UserForm.vue create mode 100644 client/src/pages/Dashboard/Users/UsersList.vue create mode 100644 client/src/plugins/icons.js create mode 100644 client/src/store/modules/errorLog.js create mode 100644 client/src/store/modules/roles.js create mode 100644 client/src/utils.js create mode 100644 client/src/views/Dialogs/SearchDialog.vue create mode 100644 server/src/database/migrations/20190822214905_create_resource_fields_table.js create mode 100644 server/src/database/migrations/20190822214905_create_views_columns.js create mode 100644 server/src/database/migrations/20190822214905_create_views_roles_table.js create mode 100644 server/src/database/migrations/20190822214905_create_views_table.js create mode 100644 server/src/http/controllers/Fields.js create mode 100644 server/src/http/controllers/Views.js create mode 100644 server/src/models/ResourceField.js create mode 100644 server/src/models/View.js create mode 100644 server/src/models/ViewColumn.js create mode 100644 server/src/models/ViewRole.js create mode 100644 server/tests/models/ResourceField.test.js create mode 100644 server/tests/models/View.test.js create mode 100644 server/tests/routes/fields.test.js create mode 100644 server/tests/routes/views.test.js diff --git a/client/src/components/SvgIcon/index.vue b/client/src/components/SvgIcon/index.vue new file mode 100644 index 000000000..0ecc1286d --- /dev/null +++ b/client/src/components/SvgIcon/index.vue @@ -0,0 +1,58 @@ + + + + + diff --git a/client/src/lang/en/app.js b/client/src/lang/en/app.js index 4412d942a..a377e1f56 100644 --- a/client/src/lang/en/app.js +++ b/client/src/lang/en/app.js @@ -2,4 +2,21 @@ export default { login: 'Login', password: 'Password', username_password: 'Username or Email', + with_your_account: 'With your Ratteb account.', + if_you_forget_your_password: 'If you forgot your password, well, enter your Moosher ID than secret key to reset your password.', + sign_in: 'Sign in', + dashboard: 'Dashboard', + reset_the_password: 'Reset the Password', + enter_your_new_password: 'Enter You New Password', + reset_password_link_is_invalid: 'The link is invalid or expired. Please reset your password again.', + your_password_has_been_changed: 'Success Your password has been changed.', + username_password_do_not_match: 'The username and password you entered did not match our records.', + the_account_suspended_please_contact: 'This account is suspended, Please contact the administrator.', + email_has_been_sent: 'An e-mail has been sent to {email} with further instructions.', + there_is_no_email_with_that_address: 'There is no email with that address, Please try again.', + reset_your_password: 'Reset Your Password', + return_to_login: 'Return to Login', + forget_password: 'Forget your password?', + reset_password: 'Reset Password', + email_password_do_not_match: 'Email and password do not match.', }; diff --git a/client/src/main.js b/client/src/main.js index 0dc34143d..840eda872 100644 --- a/client/src/main.js +++ b/client/src/main.js @@ -1,8 +1,9 @@ import Vue from 'vue'; -import {Form, FormItem, Input} from 'element-ui'; +import {Form, FormItem, Input, Tabs, TabPane, Button, Alert} from 'element-ui'; import App from '@/App'; import router from '@/router'; import store from '@/store'; +import '@/plugins/icons'; // Plugins import '@/plugins/i18n'; @@ -12,6 +13,10 @@ Vue.config.productionTip = false; Vue.use(Form); Vue.use(FormItem); Vue.use(Input); +Vue.use(Tabs); +Vue.use(TabPane); +Vue.use(Button); +Vue.use(Alert); const app = new Vue({ el: '#app', diff --git a/client/src/mixins/Reloadable.js b/client/src/mixins/Reloadable.js new file mode 100644 index 000000000..d1fed55d7 --- /dev/null +++ b/client/src/mixins/Reloadable.js @@ -0,0 +1,20 @@ +import Vue from 'vue'; + +export default Vue.extend({ + name: 'reloadable', + created() { + this.$eventBus.$on('reload-data', this.onReloadData); + }, + methods: { + async onReloadData() { + this.$nprogress.start(); + await this.reloadData(); + this.$nprogress.done(); + }, + + reloadData() {}, + }, + beforeDestroy() { + this.$eventBus.$off('reload-data', this.onReloadData); + }, +}); \ No newline at end of file diff --git a/client/src/pages/Auth/Auth.vue b/client/src/pages/Auth/Auth.vue deleted file mode 100644 index 4d1544682..000000000 --- a/client/src/pages/Auth/Auth.vue +++ /dev/null @@ -1,44 +0,0 @@ - - - - - diff --git a/client/src/pages/Auth/AuthContainer.vue b/client/src/pages/Auth/AuthContainer.vue new file mode 100644 index 000000000..0484e80f6 --- /dev/null +++ b/client/src/pages/Auth/AuthContainer.vue @@ -0,0 +1,207 @@ + + + + + diff --git a/client/src/pages/Auth/AuthFooter.vue b/client/src/pages/Auth/AuthFooter.vue new file mode 100644 index 000000000..48fac7722 --- /dev/null +++ b/client/src/pages/Auth/AuthFooter.vue @@ -0,0 +1,15 @@ + + + diff --git a/client/src/pages/Auth/AuthMedia.vue b/client/src/pages/Auth/AuthMedia.vue new file mode 100644 index 000000000..d9bf188f4 --- /dev/null +++ b/client/src/pages/Auth/AuthMedia.vue @@ -0,0 +1,11 @@ + + + \ No newline at end of file diff --git a/client/src/pages/Auth/ForgetPassword.vue b/client/src/pages/Auth/ForgetPassword.vue index 606fcb1d5..d8154d0bc 100644 --- a/client/src/pages/Auth/ForgetPassword.vue +++ b/client/src/pages/Auth/ForgetPassword.vue @@ -1,5 +1,10 @@