diff --git a/back/models/account.js b/back/models/account.js index 40b7e9c12..9e6ecba45 100644 --- a/back/models/account.js +++ b/back/models/account.js @@ -23,15 +23,13 @@ module.exports = Self => { description: 'Gets the current user data', accepts: [ { - arg: 'context', - type: 'object', - http: function(ctx) { - return ctx; - } + arg: 'ctx', + type: 'Object', + http: {source: 'context'} } ], returns: { - type: 'object', + type: 'Object', root: true }, http: { @@ -41,12 +39,18 @@ module.exports = Self => { }); Self.getCurrentUserData = async function(ctx) { - let filter = {fields: ['name']}; let userId = ctx.req.accessToken.userId; - let account = await Self.findById(userId, filter); - let worker = await Self.app.models.Worker.findOne({where: {userFk: userId}, fields: ['id']}); - return {accountName: account.name, workerId: worker.id}; + let account = await Self.findById(userId, { + fields: ['id', 'name', 'nickname'] + }); + + let worker = await Self.app.models.Worker.findOne({ + fields: ['id'], + where: {userFk: userId} + }); + + return Object.assign(account, {workerId: worker.id}); }; /** diff --git a/front/core/components/date-picker/style.scss b/front/core/components/date-picker/style.scss index c982dba62..d33f27b5d 100644 --- a/front/core/components/date-picker/style.scss +++ b/front/core/components/date-picker/style.scss @@ -23,4 +23,4 @@ vn-date-picker { .flatpickr-weekdays, span.flatpickr-weekday { background-color: $color-main; -} \ No newline at end of file +} diff --git a/front/core/components/index.js b/front/core/components/index.js index 1cfb18dca..b6533d504 100644 --- a/front/core/components/index.js +++ b/front/core/components/index.js @@ -39,6 +39,7 @@ import './field'; import './input-number'; import './input-time'; import './input-file'; +import './list'; import './radio'; import './table'; import './td-editable'; diff --git a/front/core/components/list/index.js b/front/core/components/list/index.js new file mode 100644 index 000000000..423b033ce --- /dev/null +++ b/front/core/components/list/index.js @@ -0,0 +1 @@ +import './style.scss'; diff --git a/front/salix/styles/list.scss b/front/core/components/list/style.scss similarity index 100% rename from front/salix/styles/list.scss rename to front/core/components/list/style.scss diff --git a/front/salix/components/app/style.scss b/front/salix/components/app/style.scss index fa9f0706f..062205978 100644 --- a/front/salix/components/app/style.scss +++ b/front/salix/components/app/style.scss @@ -3,7 +3,8 @@ body { background-color: $color-bg; overflow: auto; - height: 100% + height: 100%; + font-family: vn-font; } vn-app { height: inherit; diff --git a/front/salix/components/descriptor/index.js b/front/salix/components/descriptor/index.js new file mode 100644 index 000000000..423b033ce --- /dev/null +++ b/front/salix/components/descriptor/index.js @@ -0,0 +1 @@ +import './style.scss'; diff --git a/front/salix/styles/descriptor.scss b/front/salix/components/descriptor/style.scss similarity index 100% rename from front/salix/styles/descriptor.scss rename to front/salix/components/descriptor/style.scss diff --git a/front/salix/components/index.js b/front/salix/components/index.js index a5ce18e4c..a61b037b0 100644 --- a/front/salix/components/index.js +++ b/front/salix/components/index.js @@ -7,3 +7,5 @@ import './side-menu/side-menu'; import './left-menu/left-menu'; import './topbar/topbar'; import './user-configuration-popover'; +import './descriptor'; +import './summary'; diff --git a/front/salix/components/main-menu/main-menu.html b/front/salix/components/main-menu/main-menu.html index 2e7d70c59..2b88da113 100644 --- a/front/salix/components/main-menu/main-menu.html +++ b/front/salix/components/main-menu/main-menu.html @@ -3,7 +3,7 @@ ng-click="$ctrl.openUserConfiguration($event)" id="user" class="unselectable"> - {{currentUserName}} + {{$root.user.nickname}} { - this.$.currentUserName = json.data.accountName; - window.localStorage.currentUserWorkerId = json.data.workerId; - }); + this.$http.get('/api/Accounts/getCurrentUserData').then(json => { + this.$.$root.user = json.data; + window.localStorage.currentUserWorkerId = json.data.workerId; + }); } openUserConfiguration(event) { diff --git a/front/salix/components/main-menu/main-menu.spec.js b/front/salix/components/main-menu/main-menu.spec.js index 5df681b4e..b695e2795 100644 --- a/front/salix/components/main-menu/main-menu.spec.js +++ b/front/salix/components/main-menu/main-menu.spec.js @@ -16,12 +16,12 @@ describe('Component vnMainMenu', () => { describe('getCurrentUserName()', () => { it(`should set the user name property in the controller`, () => { - $httpBackend.when('GET', `/api/Accounts/getCurrentUserData`).respond({accountName: 'Batman'}); + $httpBackend.when('GET', `/api/Accounts/getCurrentUserData`).respond({name: 'batman'}); $httpBackend.expect('GET', `/api/Accounts/getCurrentUserData`); controller.getCurrentUserName(); $httpBackend.flush(); - expect(controller.$.currentUserName).toEqual('Batman'); + expect(controller.$.$root.user.name).toEqual('batman'); }); }); }); diff --git a/front/salix/components/summary/index.js b/front/salix/components/summary/index.js new file mode 100644 index 000000000..423b033ce --- /dev/null +++ b/front/salix/components/summary/index.js @@ -0,0 +1 @@ +import './style.scss'; diff --git a/front/salix/styles/summary.scss b/front/salix/components/summary/style.scss similarity index 100% rename from front/salix/styles/summary.scss rename to front/salix/components/summary/style.scss diff --git a/front/salix/components/user-configuration-popover/index.html b/front/salix/components/user-configuration-popover/index.html index 8b83e2270..9e002150c 100644 --- a/front/salix/components/user-configuration-popover/index.html +++ b/front/salix/components/user-configuration-popover/index.html @@ -11,7 +11,23 @@ order="code"> - + +
+ +
+
+
+ {{$root.user.nickname}} +
+
+ {{$root.user.name}} +
+
+ + + +
+
.profile-card { + display: flex; + align-items: center; + + & > vn-icon { + font-size: 60px; + border-radius: 50%; + color: $color-font-dark; + background: $color-secondary; + padding: .1em; + } + & > div { + display: flex; + flex-direction: column; + justify-content: space-between; + flex: 1; + + & > .user { + max-width: 10em; + padding-bottom: .5em; + } + } + } } \ No newline at end of file diff --git a/front/salix/styles/background.scss b/front/salix/styles/background.scss index fe74c8291..93bf1a98c 100644 --- a/front/salix/styles/background.scss +++ b/front/salix/styles/background.scss @@ -8,4 +8,4 @@ } .item-disabled { opacity: $color-disabled; -} +} diff --git a/front/salix/styles/display.scss b/front/salix/styles/display.scss deleted file mode 100644 index 8c5827194..000000000 --- a/front/salix/styles/display.scss +++ /dev/null @@ -1,35 +0,0 @@ -.display-block { - display: block; -} - -.form-group { - margin-bottom: 15px; -} - -/* Label del popover */ -.popover-button { - padding: 3px 3px 3px 0px; - height: auto; - min-width: auto; -} - -.popover-label { - font-family: vn-font-bold; - color: black; - padding-top:5px; -} - -/* Icon cuadrado */ -.icon-square{ - min-width: 0px; - height: 46px; - line-height: 0px; -} - -input[type="submit"]:disabled, button:disabled { - opacity: 0.7; -} - -.descriptor-icon{ - font-size:60px; -} diff --git a/front/salix/styles/font-style.scss b/front/salix/styles/font-style.scss deleted file mode 100644 index 90960bb0f..000000000 --- a/front/salix/styles/font-style.scss +++ /dev/null @@ -1,16 +0,0 @@ -@import "./variables"; -@import "./font-family"; - -body { - color: $color-font; - font-family: vn-font; -} -html [uppercase], .uppercase { - text-transform: uppercase; -} -html [color-main], .color-main { - color: $color-main; -} -html [color-secondary], .color-secondary { - color: $color-secondary; -} diff --git a/front/salix/styles/index.js b/front/salix/styles/index.js index d4c026f9f..b6eebb716 100644 --- a/front/salix/styles/index.js +++ b/front/salix/styles/index.js @@ -1,18 +1,14 @@ import './responsive.scss'; -import './title.scss'; import './layout.scss'; -import './display.scss'; import './margin.scss'; import './padding.scss'; import './border.scss'; import './background.scss'; -import './font-style.scss'; +import './font-family.scss'; +import './text.scss'; import './misc.scss'; import './effects.scss'; import './order-product.scss'; -import './summary.scss'; -import './descriptor.scss'; -import './list.scss'; import './modal-form.scss'; import './photo-list.scss'; import './width.scss'; diff --git a/front/salix/styles/misc.scss b/front/salix/styles/misc.scss index 4ecd4fbd6..5bc3d54db 100644 --- a/front/salix/styles/misc.scss +++ b/front/salix/styles/misc.scss @@ -60,24 +60,6 @@ html [fixed-bottom-right] { bottom: 2em; right: 2em; } -html [text-center], .text-center { - text-align: center; -} -html [text-right], .text-right { - text-align: right; -} -html [text-left], .text-left { - text-align: left; -} -html [vn-right], .vn-right { - float: right; -} -html [vn-left], .vn-left { - float: left; -} -html [vn-center], .vn-center { - justify-content: center; -} .list > vn-none { min-width: 60px; } @@ -89,9 +71,6 @@ html [vn-center], .vn-center { color: $color-main; } } -.flatpickr-month, .flatpickr-weekdays, span.flatpickr-weekday { - background-color: $color-main; -} html [pointer], .pointer{ cursor: pointer; } @@ -112,6 +91,9 @@ vn-tool-bar { margin-right: .6em; } } +input[type="submit"]:disabled, button:disabled { + opacity: 0.7; +} /** START - FORM ELEMENTS DISABLED **/ @@ -197,4 +179,25 @@ vn-empty-rows { text-align: center; padding: 1.5em; box-sizing: border-box; -} \ No newline at end of file +} + +/* XXX: Deprecated, use classes with text prefix */ + +[color-main] { + color: $color-main; +} +[color-secondary] { + color: $color-secondary; +} +[uppercase], .uppercase { + text-transform: uppercase; +} +html [text-center], .text-center { + text-align: center; +} +html [text-right], .text-right { + text-align: right; +} +html [text-left], .text-left { + text-align: left; +} diff --git a/front/salix/styles/photo-list.scss b/front/salix/styles/photo-list.scss index b4e6ec698..da3e460ba 100644 --- a/front/salix/styles/photo-list.scss +++ b/front/salix/styles/photo-list.scss @@ -1,4 +1,5 @@ @import "./variables"; + .photo-list { justify-content: center; align-items: flex-start; diff --git a/front/salix/styles/text.scss b/front/salix/styles/text.scss new file mode 100644 index 000000000..bb82fa2a0 --- /dev/null +++ b/front/salix/styles/text.scss @@ -0,0 +1,72 @@ +@import "./variables"; +@import "./font-family"; + +/* Headings */ + +.text-h1, h1 { + font-size: 32pt; +} +.text-h2, h2 { + font-size: 28pt; +} +.text-h3, h3 { + font-size: 24pt; +} +.text-h4, h4 { + font-size: 20pt; +} +.text-h5, h5 { + font-size: 16pt; +} +.text-h6, h6 { + font-size: 14pt; +} +.text-subtitle1 { + font-size: 13pt; +} +.text-subtitle2 { + font-size: 12pt; +} +.text-body1 { + font-size: 11pt; +} +.text-body2 { + font-size: 11pt; +} +.text-caption { + font-size: 11pt; +} +.text-overline { + font-size: 10pt; +} + +h1, h2, h3, h4, h5, h6 { + padding: 0; + margin-top: 0; + margin-bottom: .2em; + font-family: vn-font-bold; +} + +/* Colors */ + +.text-primary { + color: $color-font; +} +.text-secondary { + color: $color-font-secondary; +} + +/* Helpers */ + +.text-uppercase { + text-transform: uppercase; +} +.text-center { + text-align: center; +} +.text-right { + text-align: right; +} +.text-left { + text-align: left; +} diff --git a/front/salix/styles/title.scss b/front/salix/styles/title.scss deleted file mode 100644 index 53a1c2c54..000000000 --- a/front/salix/styles/title.scss +++ /dev/null @@ -1,28 +0,0 @@ -@import "./variables"; - -h1 { - font-size: 32pt; -} -h2 { - font-size: 28pt; -} -h3 { - font-size: 24pt; -} -h4 { - font-size: 20pt; -} -h5 { - font-size: 16pt; -} -h6 { - font-size: 12pt; -} - -h1, h2, h3, h4, h5, h6 { - padding: 0; - margin-top: 0; - margin-bottom: .2em; - font-family: vn-font-bold; - color: $color-font -} \ No newline at end of file