diff --git a/CHANGELOG.md b/CHANGELOG.md index 95b3028de..bafedc760 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,9 +8,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [2302.01] - 2023-01-12 ### Added - -- +- [General](Inicio) Permite recuperar la contraseña ### Changed -- \ No newline at end of file + +### Removed +- [Tickets](Control clientes) Eliminada sección diff --git a/db/changes/230201/.gitkeep b/db/changes/230201/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/db/changes/230201/00-kkearSaleChecked.sql b/db/changes/230201/00-kkearSaleChecked.sql new file mode 100644 index 000000000..03e854bbd --- /dev/null +++ b/db/changes/230201/00-kkearSaleChecked.sql @@ -0,0 +1,2 @@ +DELETE FROM `salix`.`ACL` WHERE model="SaleChecked"; +DROP TABLE IF EXISTS `vn`.`saleChecked`; diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index f6a299011..e1792ea7b 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -30,7 +30,7 @@ export default { firstModuleRemovePinIcon: 'vn-home a:nth-child(1) vn-icon[icon="remove_circle"]' }, recoverPassword: { - recoverPasswordButton: 'vn-login a[ui-sref="recoverPassword"]', + recoverPasswordButton: 'vn-login a[ui-sref="recover-password"]', email: 'vn-recover-password vn-textfield[ng-model="$ctrl.email"]', sendEmailButton: 'vn-recover-password vn-submit', }, diff --git a/e2e/paths/01-salix/04_recoverPassword.spec.js b/e2e/paths/01-salix/04_recoverPassword.spec.js index 67e6362d3..e6cb02ab1 100644 --- a/e2e/paths/01-salix/04_recoverPassword.spec.js +++ b/e2e/paths/01-salix/04_recoverPassword.spec.js @@ -1,8 +1,7 @@ import selectors from '../../helpers/selectors'; import getBrowser from '../../helpers/puppeteer'; -// https://redmine.verdnatura.es/issues/4995 fix login -xdescribe('RecoverPassword path', async() => { +describe('RecoverPassword path', async() => { let browser; let page; @@ -11,7 +10,7 @@ xdescribe('RecoverPassword path', async() => { page = browser.page; await page.waitToClick(selectors.recoverPassword.recoverPasswordButton); - await page.waitForState('recoverPassword'); + await page.waitForState('recover-password'); }); afterAll(async() => { diff --git a/front/core/services/auth.js b/front/core/services/auth.js index 04520cd0b..c15a34d94 100644 --- a/front/core/services/auth.js +++ b/front/core/services/auth.js @@ -24,7 +24,7 @@ export default class Auth { initialize() { let criteria = { to: state => { - const outLayout = ['login', 'recoverPassword', 'resetPassword']; + const outLayout = ['login', 'recover-password', 'reset-password']; return !outLayout.some(ol => ol == state.name); } }; diff --git a/front/salix/components/app/app.html b/front/salix/components/app/app.html index d32c9f68b..d6169308a 100644 --- a/front/salix/components/app/app.html +++ b/front/salix/components/app/app.html @@ -1,9 +1,3 @@ - - - - + diff --git a/front/salix/components/app/app.js b/front/salix/components/app/app.js index 91a8d2215..97384d1e1 100644 --- a/front/salix/components/app/app.js +++ b/front/salix/components/app/app.js @@ -19,12 +19,6 @@ export default class App extends Component { this.vnApp.logger = this; } - get showLayout() { - const state = this.$state.current.name || this.$location.$$path.substring(1).replace('/', '.'); - const outLayout = ['login', 'recoverPassword', 'resetPassword', 'reset-password']; - return state && !outLayout.some(ol => ol == state); - } - $onDestroy() { this.deregisterCallback(); this.vnApp.logger = null; diff --git a/front/salix/components/index.js b/front/salix/components/index.js index 3bd24d32f..f6727fadf 100644 --- a/front/salix/components/index.js +++ b/front/salix/components/index.js @@ -5,10 +5,10 @@ import './descriptor-popover'; import './home/home'; import './layout'; import './left-menu/left-menu'; -import './login/index'; -import './login/login'; -import './login/recover-password'; -import './login/reset-password'; +import './login'; +import './outLayout'; +import './recover-password'; +import './reset-password'; import './module-card'; import './module-main'; import './side-menu/side-menu'; diff --git a/front/salix/components/login/index.html b/front/salix/components/login/index.html index 186979f8c..963c23061 100644 --- a/front/salix/components/login/index.html +++ b/front/salix/components/login/index.html @@ -1,6 +1,27 @@ -
- -
- -
+ + + + + + + diff --git a/front/salix/components/login/index.js b/front/salix/components/login/index.js index f0e21fa29..150e896a1 100644 --- a/front/salix/components/login/index.js +++ b/front/salix/components/login/index.js @@ -1,16 +1,43 @@ import ngModule from '../../module'; -import Component from 'core/lib/component'; import './style.scss'; -export default class OutLayout extends Component { - constructor($element, $scope) { - super($element, $scope); +/** + * A simple login form. + */ +export default class Controller { + constructor($, $element, vnAuth) { + Object.assign(this, { + $, + $element, + vnAuth, + user: localStorage.getItem('lastUser'), + remember: true + }); + } + + submit() { + this.loading = true; + this.vnAuth.login(this.user, this.password, this.remember) + .then(() => { + localStorage.setItem('lastUser', this.user); + this.loading = false; + }) + .catch(err => { + this.loading = false; + this.password = ''; + this.focusUser(); + throw err; + }); + } + + focusUser() { + this.$.userField.select(); + this.$.userField.focus(); } } +Controller.$inject = ['$scope', '$element', 'vnAuth']; -OutLayout.$inject = ['$element', '$scope']; - -ngModule.vnComponent('vnOutLayout', { +ngModule.vnComponent('vnLogin', { template: require('./index.html'), - controller: OutLayout + controller: Controller }); diff --git a/front/salix/components/login/locale/es.yml b/front/salix/components/login/locale/es.yml index e3a5815c1..c34861bfb 100644 --- a/front/salix/components/login/locale/es.yml +++ b/front/salix/components/login/locale/es.yml @@ -1,16 +1,5 @@ User: Usuario Password: Contraseña -Email: Correo electrónico Do not close session: No cerrar sesión Enter: Entrar I do not remember my password: No recuerdo mi contraseña -Recover password: Recuperar contraseña -We will sent you an email to recover your password: Te enviaremos un correo para restablecer tu contraseña -Notification sent!: ¡Notificación enviada! -Reset password: Restrablecer contraseña -New password: Nueva contraseña -Repeat password: Repetir contraseña -Password requirements: > - La contraseña debe tener al menos {{ length }} caracteres de longitud, - {{nAlpha}} caracteres alfabéticos, {{nUpper}} letras mayúsculas, {{nDigits}} - dígitos y {{nPunct}} símbolos (Ej: $%&.) diff --git a/front/salix/components/login/login.html b/front/salix/components/login/login.html deleted file mode 100644 index 807e4b284..000000000 --- a/front/salix/components/login/login.html +++ /dev/null @@ -1,32 +0,0 @@ -
- -
- - - - - - - -
-
diff --git a/front/salix/components/login/login.js b/front/salix/components/login/login.js deleted file mode 100644 index b5f8c1e7d..000000000 --- a/front/salix/components/login/login.js +++ /dev/null @@ -1,43 +0,0 @@ -import ngModule from '../../module'; -import './style.scss'; - -/** - * A simple login form. - */ -export default class Controller { - constructor($, $element, vnAuth) { - Object.assign(this, { - $, - $element, - vnAuth, - user: localStorage.getItem('lastUser'), - remember: true - }); - } - - submit() { - this.loading = true; - this.vnAuth.login(this.user, this.password, this.remember) - .then(() => { - localStorage.setItem('lastUser', this.user); - this.loading = false; - }) - .catch(err => { - this.loading = false; - this.password = ''; - this.focusUser(); - throw err; - }); - } - - focusUser() { - this.$.userField.select(); - this.$.userField.focus(); - } -} -Controller.$inject = ['$scope', '$element', 'vnAuth']; - -ngModule.vnComponent('vnLogin', { - template: require('./login.html'), - controller: Controller -}); diff --git a/front/salix/components/login/style.scss b/front/salix/components/login/style.scss index 5a7e72245..f13c9cf86 100644 --- a/front/salix/components/login/style.scss +++ b/front/salix/components/login/style.scss @@ -1,8 +1,6 @@ @import "variables"; -vn-login, -vn-reset-password, -vn-recover-password{ +vn-login{ .footer { margin-top: 32px; text-align: center; @@ -24,69 +22,3 @@ vn-recover-password{ } } } - -vn-login{ - position: absolute; - height: 100%; - width: 100%; - margin: 0; - padding: 0; - color: $color-font; - font-size: 1.1rem; - font-weight: normal; - background-color: $color-bg-dark; - display: flex; - justify-content: center; - align-items: center; - overflow: auto; - - & > .box { - box-sizing: border-box; - position: absolute; - max-width: 304px; - min-width: 240px; - padding: 48px; - background-color: $color-bg-panel; - box-shadow: 0 0 16px 0 rgba(0, 0, 0, .6); - border-radius: 8px; - - & > img { - width: 100%; - padding-bottom: 16px; - } - & > form { - & > .vn-textfield { - width: 100%; - } - & > .vn-check { - display: block; - .md-label { - white-space: inherit; - } - } - } - - h5{ - color: $color-primary; - } - - .text-secondary{ - text-align: center; - padding-bottom: 16px; - } - - } - - @media screen and (max-width: 600px) { - background-color: $color-bg-panel; - - & > .box { - padding: 16px; - box-shadow: none; - } - } - - a{ - color: $color-primary; - } -} diff --git a/front/salix/components/outLayout/index.html b/front/salix/components/outLayout/index.html new file mode 100644 index 000000000..186979f8c --- /dev/null +++ b/front/salix/components/outLayout/index.html @@ -0,0 +1,6 @@ +
+ +
+ +
+
diff --git a/front/salix/components/outLayout/index.js b/front/salix/components/outLayout/index.js new file mode 100644 index 000000000..f0e21fa29 --- /dev/null +++ b/front/salix/components/outLayout/index.js @@ -0,0 +1,16 @@ +import ngModule from '../../module'; +import Component from 'core/lib/component'; +import './style.scss'; + +export default class OutLayout extends Component { + constructor($element, $scope) { + super($element, $scope); + } +} + +OutLayout.$inject = ['$element', '$scope']; + +ngModule.vnComponent('vnOutLayout', { + template: require('./index.html'), + controller: OutLayout +}); diff --git a/front/salix/components/login/logo.svg b/front/salix/components/outLayout/logo.svg similarity index 100% rename from front/salix/components/login/logo.svg rename to front/salix/components/outLayout/logo.svg diff --git a/front/salix/components/outLayout/style.scss b/front/salix/components/outLayout/style.scss new file mode 100644 index 000000000..aa94fefb3 --- /dev/null +++ b/front/salix/components/outLayout/style.scss @@ -0,0 +1,67 @@ +@import "variables"; + +vn-out-layout{ + position: absolute; + height: 100%; + width: 100%; + margin: 0; + padding: 0; + color: $color-font; + font-size: 1.1rem; + font-weight: normal; + background-color: $color-bg-dark; + display: flex; + justify-content: center; + align-items: center; + overflow: auto; + + & > .box { + box-sizing: border-box; + position: absolute; + max-width: 304px; + min-width: 240px; + padding: 48px; + background-color: $color-bg-panel; + box-shadow: 0 0 16px 0 rgba(0, 0, 0, .6); + border-radius: 8px; + + & > img { + width: 100%; + padding-bottom: 16px; + } + & > form { + & > .vn-textfield { + width: 100%; + } + & > .vn-check { + display: block; + .md-label { + white-space: inherit; + } + } + } + + h5{ + color: $color-primary; + } + + .text-secondary{ + text-align: center; + padding-bottom: 16px; + } + + } + + @media screen and (max-width: 600px) { + background-color: $color-bg-panel; + + & > .box { + padding: 16px; + box-shadow: none; + } + } + + a{ + color: $color-primary; + } +} diff --git a/front/salix/components/login/recover-password.html b/front/salix/components/recover-password/index.html similarity index 100% rename from front/salix/components/login/recover-password.html rename to front/salix/components/recover-password/index.html diff --git a/front/salix/components/login/recover-password.js b/front/salix/components/recover-password/index.js similarity index 94% rename from front/salix/components/login/recover-password.js rename to front/salix/components/recover-password/index.js index fa9bfc459..3de7f3266 100644 --- a/front/salix/components/login/recover-password.js +++ b/front/salix/components/recover-password/index.js @@ -32,6 +32,6 @@ export default class Controller { Controller.$inject = ['$scope', '$element', '$http', 'vnApp', '$translate', '$state']; ngModule.vnComponent('vnRecoverPassword', { - template: require('./recover-password.html'), + template: require('./index.html'), controller: Controller }); diff --git a/front/salix/components/recover-password/locale/es.yml b/front/salix/components/recover-password/locale/es.yml new file mode 100644 index 000000000..b71c71415 --- /dev/null +++ b/front/salix/components/recover-password/locale/es.yml @@ -0,0 +1,3 @@ +Recover password: Recuperar contraseña +We will sent you an email to recover your password: Te enviaremos un correo para restablecer tu contraseña +Notification sent!: ¡Notificación enviada! diff --git a/front/salix/components/recover-password/style.scss b/front/salix/components/recover-password/style.scss new file mode 100644 index 000000000..d3c6f594e --- /dev/null +++ b/front/salix/components/recover-password/style.scss @@ -0,0 +1,24 @@ +@import "variables"; + +vn-recover-password{ + .footer { + margin-top: 32px; + text-align: center; + position: relative; + & > .vn-submit { + display: block; + + & > input { + display: block; + width: 100%; + } + } + & > .spinner-wrapper { + position: absolute; + width: 0; + top: 3px; + right: -8px; + overflow: visible; + } + } +} diff --git a/front/salix/components/login/reset-password.html b/front/salix/components/reset-password/index.html similarity index 100% rename from front/salix/components/login/reset-password.html rename to front/salix/components/reset-password/index.html diff --git a/front/salix/components/login/reset-password.js b/front/salix/components/reset-password/index.js similarity index 96% rename from front/salix/components/login/reset-password.js rename to front/salix/components/reset-password/index.js index 9ee1fdb62..20c6c34fe 100644 --- a/front/salix/components/login/reset-password.js +++ b/front/salix/components/reset-password/index.js @@ -43,6 +43,6 @@ export default class Controller { Controller.$inject = ['$scope', '$element', '$http', 'vnApp', '$translate', '$state', '$location']; ngModule.vnComponent('vnResetPassword', { - template: require('./reset-password.html'), + template: require('./index.html'), controller: Controller }); diff --git a/front/salix/components/login/locale/en.yml b/front/salix/components/reset-password/locale/en.yml similarity index 71% rename from front/salix/components/login/locale/en.yml rename to front/salix/components/reset-password/locale/en.yml index 1ddd454b7..e5419e1c8 100644 --- a/front/salix/components/login/locale/en.yml +++ b/front/salix/components/reset-password/locale/en.yml @@ -1,7 +1,3 @@ -User: User -Password: Password -Do not close session: Do not close session -Enter: Enter Password requirements: > The password must have at least {{ length }} length characters, {{nAlpha}} alphabetic characters, {{nUpper}} capital letters, {{nDigits}} diff --git a/front/salix/components/reset-password/locale/es.yml b/front/salix/components/reset-password/locale/es.yml new file mode 100644 index 000000000..0771d5dc3 --- /dev/null +++ b/front/salix/components/reset-password/locale/es.yml @@ -0,0 +1,8 @@ +Reset password: Restrablecer contraseña +New password: Nueva contraseña +Repeat password: Repetir contraseñaç +Password changed!: ¡Contraseña cambiada! +Password requirements: > + La contraseña debe tener al menos {{ length }} caracteres de longitud, + {{nAlpha}} caracteres alfabéticos, {{nUpper}} letras mayúsculas, {{nDigits}} + dígitos y {{nPunct}} símbolos (Ej: $%&.) diff --git a/front/salix/components/reset-password/style.scss b/front/salix/components/reset-password/style.scss new file mode 100644 index 000000000..87e4adc8c --- /dev/null +++ b/front/salix/components/reset-password/style.scss @@ -0,0 +1,24 @@ +@import "variables"; + +vn-reset-password{ + .footer { + margin-top: 32px; + text-align: center; + position: relative; + & > .vn-submit { + display: block; + + & > input { + display: block; + width: 100%; + } + } + & > .spinner-wrapper { + position: absolute; + width: 0; + top: 3px; + right: -8px; + overflow: visible; + } + } +} diff --git a/front/salix/routes.js b/front/salix/routes.js index 613dc7288..f32c143ef 100644 --- a/front/salix/routes.js +++ b/front/salix/routes.js @@ -3,27 +3,38 @@ import getMainRoute from 'core/lib/get-main-route'; config.$inject = ['$stateProvider', '$urlRouterProvider']; function config($stateProvider, $urlRouterProvider) { - $urlRouterProvider.otherwise('/'); + $urlRouterProvider + .otherwise('/'); $stateProvider + .state('layout', { + abstract: true, + template: '', + }) + .state('outLayout', { + abstract: true, + template: '', + }) .state('login', { + parent: 'outLayout', url: '/login?continue', description: 'Login', - views: { - 'login': {template: ''}, - } + template: '' }) - .state('recoverPassword', { + .state('recover-password', { + parent: 'outLayout', url: '/recover-password', - description: 'Recover-password', - template: 'asd' + description: 'Recover password', + template: '' }) - .state('resetPassword', { + .state('reset-password', { + parent: 'outLayout', url: '/reset-password', - description: 'Reset-password', + description: 'Reset password', template: '' }) .state('home', { + parent: 'layout', url: '/', description: 'Home', template: '' @@ -54,6 +65,10 @@ function config($stateProvider, $urlRouterProvider) { }; if (route.abstract) configRoute.abstract = true; + + if (!route.state.includes('.')) + configRoute.parent = 'layout'; + if (route.routeParams) configRoute.params = route.routeParams; diff --git a/modules/entry/front/buy/index/index.js b/modules/entry/front/buy/index/index.js index 6d9ee5760..322b81d4e 100644 --- a/modules/entry/front/buy/index/index.js +++ b/modules/entry/front/buy/index/index.js @@ -73,6 +73,12 @@ export default class Controller extends Section { this.vnApp.showSuccess(this.$t('Data saved!')); }); } + + itemSearchFunc($search) { + return /^\d+$/.test($search) + ? {id: $search} + : {name: {like: '%' + $search + '%'}}; + } } ngModule.vnComponent('vnEntryBuyIndex', { diff --git a/modules/ticket/back/model-config.json b/modules/ticket/back/model-config.json index d9f9fcccb..50cfbd08a 100644 --- a/modules/ticket/back/model-config.json +++ b/modules/ticket/back/model-config.json @@ -32,9 +32,6 @@ "Sale": { "dataSource": "vn" }, - "SaleChecked": { - "dataSource": "vn" - }, "SaleCloned": { "dataSource": "vn" }, diff --git a/modules/ticket/back/models/sale-checked.json b/modules/ticket/back/models/sale-checked.json deleted file mode 100644 index 96d790505..000000000 --- a/modules/ticket/back/models/sale-checked.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name": "SaleChecked", - "base": "VnModel", - "options": { - "mysql": { - "table": "saleChecked" - } - }, - "properties": { - "isChecked": { - "type": "number" - }, - "saleFk": { - "id": true - } - }, - "relations": { - "sale": { - "type": "belongsTo", - "model": "Sale", - "foreignKey": "saleFk" - } - } -} \ No newline at end of file diff --git a/modules/ticket/back/models/sale.json b/modules/ticket/back/models/sale.json index e18f0291f..b30954ad1 100644 --- a/modules/ticket/back/models/sale.json +++ b/modules/ticket/back/models/sale.json @@ -56,11 +56,6 @@ "foreignKey": "ticketFk", "required": true }, - "isChecked": { - "type": "hasOne", - "model": "SaleChecked", - "foreignKey": "saleFk" - }, "components": { "type": "hasMany", "model": "SaleComponent", @@ -80,6 +75,6 @@ "type": "hasOne", "model": "ItemShelvingSale", "foreignKey": "saleFk" - } + } } } diff --git a/modules/ticket/front/index.js b/modules/ticket/front/index.js index 5be9980c3..029dc16a4 100644 --- a/modules/ticket/front/index.js +++ b/modules/ticket/front/index.js @@ -20,7 +20,6 @@ import './package/index'; import './sale'; import './tracking/index'; import './tracking/edit'; -import './sale-checked'; import './services'; import './component'; import './sale-tracking'; diff --git a/modules/ticket/front/routes.json b/modules/ticket/front/routes.json index f3099bbb2..c86b3a1ef 100644 --- a/modules/ticket/front/routes.json +++ b/modules/ticket/front/routes.json @@ -23,7 +23,6 @@ {"state": "ticket.card.expedition", "icon": "icon-package"}, {"state": "ticket.card.service", "icon": "icon-services"}, {"state": "ticket.card.package", "icon": "icon-bucket"}, - {"state": "ticket.card.saleChecked", "icon": "assignment"}, {"state": "ticket.card.components", "icon": "icon-components"}, {"state": "ticket.card.saleTracking", "icon": "assignment"}, {"state": "ticket.card.dms.index", "icon": "cloud_download"}, @@ -159,15 +158,6 @@ }, "acl": ["production", "administrative", "salesPerson"] }, - { - "url" : "/sale-checked", - "state": "ticket.card.saleChecked", - "component": "vn-ticket-sale-checked", - "description": "Sale checked", - "params": { - "ticket": "$ctrl.ticket" - } - }, { "url" : "/components", "state": "ticket.card.components", diff --git a/modules/ticket/front/sale-checked/index.html b/modules/ticket/front/sale-checked/index.html deleted file mode 100644 index 1bc6f1f68..000000000 --- a/modules/ticket/front/sale-checked/index.html +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - - Is checked - Item - Description - Quantity - - - - - - - - - - - {{::sale.itemFk | zeroFill:6}} - - - -
- {{::sale.item.name}} - -

{{::sale.item.subName}}

-
-
- - -
- {{::sale.quantity}} -
-
-
-
-
- - diff --git a/modules/ticket/front/sale-checked/index.js b/modules/ticket/front/sale-checked/index.js deleted file mode 100644 index 857ac49e3..000000000 --- a/modules/ticket/front/sale-checked/index.js +++ /dev/null @@ -1,42 +0,0 @@ -import ngModule from '../module'; -import Section from 'salix/components/section'; - -class Controller extends Section { - constructor($element, $) { - super($element, $); - this.filter = { - include: [ - { - relation: 'item' - }, { - relation: 'isChecked', - scope: { - fields: ['isChecked'] - } - } - ] - }; - } - showItemDescriptor(event, sale) { - this.quicklinks = { - btnThree: { - icon: 'icon-transaction', - state: `item.card.diary({ - id: ${sale.itemFk}, - warehouseFk: ${this.ticket.warehouseFk}, - lineFk: ${sale.id} - })`, - tooltip: 'Item diary' - } - }; - this.$.itemDescriptor.show(event.target, sale.itemFk); - } -} - -ngModule.vnComponent('vnTicketSaleChecked', { - template: require('./index.html'), - controller: Controller, - bindings: { - ticket: '<' - } -});