diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 77ecc3867..d4a5fea0e 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -262,7 +262,7 @@ export default { itemDiary: { thirdTicketId: 'vn-item-diary vn-tbody > vn-tr:nth-child(3) > vn-td:nth-child(2) > span', firstBalance: 'vn-item-diary vn-tbody > vn-tr:nth-child(1) > vn-td.balance', - fifthBalance: 'vn-item-diary vn-tbody > vn-tr.ng-scope.isToday.isIn > vn-td.balance > span', + fifthBalance: 'vn-item-diary vn-tbody > vn-tr:nth-child(5) > vn-td.balance', warehouseAutocomplete: 'vn-item-diary vn-autocomplete[field="$ctrl.warehouseFk"]', }, ticketSummary: { @@ -484,12 +484,13 @@ export default { orderByAutocomplete: `vn-autocomplete[label="Order by"]`, }, orderBasicData: { - clientAutocomplete: `vn-autocomplete[label=Client]`, + clientAutocomplete: `vn-autocomplete[label="Client"]`, + addressAutocomplete: `vn-autocomplete[label="Address"]`, observationInput: `vn-textarea[label="Observation"] textarea`, saveButton: `${components.vnSubmit}` }, orderLine: { - orderSubtotal: 'vn-order-line > vn-vertical > vn-card > div > vn-vertical > vn-horizontal > div > span', + orderSubtotal: 'vn-order-line vn-horizontal.header p:nth-child(1)', firstLineDeleteButton: 'vn-order-line vn-tbody > vn-tr:nth-child(1) vn-icon[icon="delete"]', confirmOrder: 'vn-order-line > vn-vertical > vn-button-bar > vn-button > button', confirmButton: 'vn-order-line > vn-confirm button[response="ACCEPT"]', diff --git a/e2e/paths/order-module/01_edit_basic_data.spec.js b/e2e/paths/order-module/01_edit_basic_data.spec.js index 2f24cf94a..0efcc4f8c 100644 --- a/e2e/paths/order-module/01_edit_basic_data.spec.js +++ b/e2e/paths/order-module/01_edit_basic_data.spec.js @@ -1,8 +1,7 @@ import selectors from '../../helpers/selectors.js'; import createNightmare from '../../helpers/nightmare'; -// Bug #808 order.basic-data -xdescribe('Order edit basic data path', () => { +describe('Order edit basic data path', () => { const nightmare = createNightmare(); describe('when confirmed order', () => { beforeAll(() => { @@ -15,11 +14,12 @@ xdescribe('Order edit basic data path', () => { it('should not be able to change the client', async() => { const result = await nightmare .autocompleteSearch(selectors.orderBasicData.clientAutocomplete, 'Tony Stark') + .autocompleteSearch(selectors.orderBasicData.addressAutocomplete, 'Tony Stark') .waitToClick(selectors.orderBasicData.saveButton) .waitForLastSnackbar(); expect(result).toEqual(`You can't make changes on the basic data of an confirmed order or with rows`); - }); + }, 15000); }); describe('when order with rows', () => { @@ -63,6 +63,7 @@ xdescribe('Order edit basic data path', () => { it('should be able to modify all the properties', async() => { const result = await nightmare .autocompleteSearch(selectors.orderBasicData.clientAutocomplete, 'Tony Stark') + .autocompleteSearch(selectors.orderBasicData.addressAutocomplete, 'Tony Stark') .clearInput(selectors.orderBasicData.observationInput) .write(selectors.orderBasicData.observationInput, 'Observation modified') .waitToClick(selectors.orderBasicData.saveButton) diff --git a/e2e/paths/ticket-module/11_ticket_diary.spec.js b/e2e/paths/ticket-module/11_ticket_diary.spec.js index f5bb6fbc7..933628e5d 100644 --- a/e2e/paths/ticket-module/11_ticket_diary.spec.js +++ b/e2e/paths/ticket-module/11_ticket_diary.spec.js @@ -50,7 +50,7 @@ describe('Ticket diary path', () => { it(`should check the fifth line balance is marked as counter`, async() => { const result = await nightmare - .waitToGetProperty(selectors.itemDiary.fifthBalance, 'className'); + .waitToGetProperty(`${selectors.itemDiary.fifthBalance} > span`, 'className'); expect(result).toContain('counter'); }); diff --git a/front/core/components/fetched-tags/index.html b/front/core/components/fetched-tags/index.html index 3b1dc54f6..546e5d67d 100644 --- a/front/core/components/fetched-tags/index.html +++ b/front/core/components/fetched-tags/index.html @@ -4,8 +4,8 @@ + ng-repeat="fetchedTag in $ctrl.tags track by $index" + title="{{::fetchedTag.name}}: {{::fetchedTag.value}}"> {{::fetchedTag.value}} diff --git a/front/salix/styles/variables.scss b/front/salix/styles/variables.scss index b794d5610..36a1a14db 100644 --- a/front/salix/styles/variables.scss +++ b/front/salix/styles/variables.scss @@ -32,6 +32,7 @@ $color-font: #222222; $color-font-secondary: #9b9b9b; $color-font-dark: white; $color-font-bg: rgba(0, 0, 0, .7); +$color-font-link: #005a9a; $color-active: #3d3d3d; $color-active-font: white; $color-bg-panel: white; @@ -40,6 +41,7 @@ $color-secondary: #ccc; $color-success: #a3d131; $color-notice: #32b1ce; $color-alert: #f42121; + $color-spacer: rgba(0, 0, 0, .3); $color-spacer-light: rgba(0, 0, 0, .12); $color-input-underline: rgba(0, 0, 0, .12); @@ -49,7 +51,6 @@ $color-hover-cd: rgba(0, 0, 0, .1); $color-hover-dc: .7; $color-disabled: .6; -$color-font-link: darken($color-main, 10%); $color-main-medium: lighten($color-main, 20%); $color-main-light: lighten($color-main, 35%); $color-success-medium: lighten($color-success, 20%); @@ -68,6 +69,7 @@ $color-font: white; $color-font-secondary: #777; $color-font-dark: white; $color-font-bg: rgba(0, 0, 0, .8); +$color-font-link: #005a9a; $color-active: #666; $color-active-font: white; $color-bg-panel: #3c3b3b; diff --git a/loopback/locale/en.json b/loopback/locale/en.json index b56b03a38..ac9e6b132 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -36,5 +36,6 @@ "The warehouse can't be repeated": "The warehouse can't be repeated", "Barcode must be unique": "Barcode must be unique", "You don't have enough privileges to do that": "You don't have enough privileges to do that", - "You can't create a ticket for a frozen client": "You can't create a ticket for a frozen client" + "You can't create a ticket for a frozen client": "You can't create a ticket for a frozen client", + "can't be blank": "can't be blank" } \ No newline at end of file diff --git a/modules/client/front/index/index.html b/modules/client/front/index/index.html index 32f01c7e4..5a964cfe5 100644 --- a/modules/client/front/index/index.html +++ b/modules/client/front/index/index.html @@ -22,14 +22,6 @@ ng-repeat="client in clients track by client.id" client="::client"> - - No results - - - Enter a new search - diff --git a/modules/item/back/methods/item/getCard.js b/modules/item/back/methods/item/getCard.js index b9be274e1..9780c5601 100644 --- a/modules/item/back/methods/item/getCard.js +++ b/modules/item/back/methods/item/getCard.js @@ -60,16 +60,6 @@ module.exports = Self => { }; [item] = await Self.app.models.Item.find(filter); - // Visible Avaible - let query = ` - CALL vn.getItemVisibleAvailable(?,curdate(),?,?)`; - - let options = [item.id, item.itemType().warehouseFk, false]; - let [res] = await Self.rawSql(query, options); - - item.available = res[0].available ? res[0].available : '-'; - item.visible = res[0].visible ? res[0].visible : '-'; - return item; }; }; diff --git a/modules/item/back/methods/item/getVisibleAvailable.js b/modules/item/back/methods/item/getVisibleAvailable.js new file mode 100644 index 000000000..fecdb736b --- /dev/null +++ b/modules/item/back/methods/item/getVisibleAvailable.js @@ -0,0 +1,37 @@ +module.exports = Self => { + Self.remoteMethod('getVisibleAvailable', { + description: 'Returns visible and available for params', + accessType: '', + accepts: [ + { + arg: 'id', + type: 'Number', + required: true, + }, + { + arg: 'warehouseFk', + type: 'Number', + required: true, + }], + returns: { + type: ['object'], + root: true + }, + http: { + path: `/:id/getVisibleAvailable`, + verb: 'GET' + } + }); + + Self.getVisibleAvailable = async(itemFk, warehouseFk) => { + let query = ` + CALL vn.getItemVisibleAvailable(?,curdate(),?,?)`; + + let options = [itemFk, warehouseFk, false]; + [res] = await Self.rawSql(query, options); + + return { + available: res[0].available, + visible: res[0].visible}; + }; +}; diff --git a/modules/item/back/methods/item/regularize.js b/modules/item/back/methods/item/regularize.js index 12c28144c..a9644cc1d 100644 --- a/modules/item/back/methods/item/regularize.js +++ b/modules/item/back/methods/item/regularize.js @@ -28,7 +28,7 @@ module.exports = Self => { } }); - Self.regularize = async (ctx, itemFk, quantity, warehouseFk) => { + Self.regularize = async(ctx, itemFk, quantity, warehouseFk) => { const userId = ctx.req.accessToken.userId; const models = Self.app.models; diff --git a/modules/item/back/models/item.js b/modules/item/back/models/item.js index e34b2eec5..628bd5a03 100644 --- a/modules/item/back/models/item.js +++ b/modules/item/back/models/item.js @@ -9,6 +9,7 @@ module.exports = Self => { require('../methods/item/getSummary')(Self); require('../methods/item/getCard')(Self); require('../methods/item/regularize')(Self); + require('../methods/item/getVisibleAvailable')(Self); require('../methods/item/new')(Self); Self.validatesPresenceOf('originFk', {message: 'Cannot be blank'}); diff --git a/modules/item/front/descriptor/index.html b/modules/item/front/descriptor/index.html index 02e1267dc..a0d6404f5 100644 --- a/modules/item/front/descriptor/index.html +++ b/modules/item/front/descriptor/index.html @@ -34,11 +34,11 @@ Visible - {{$ctrl.item.visible}} + {{$ctrl.visible | dashIfEmpty}} Available - {{$ctrl.item.available}} + {{$ctrl.available | dashIfEmpty}} diff --git a/modules/item/front/descriptor/index.js b/modules/item/front/descriptor/index.js index 79e669b87..922ca4814 100644 --- a/modules/item/front/descriptor/index.js +++ b/modules/item/front/descriptor/index.js @@ -25,7 +25,6 @@ class Controller { if (value) this._warehouseFk = value; } - get warehouseFk() { if (!this._warehouseFk) this._warehouseFk = parseInt(window.localStorage.defaultWarehouseFk); @@ -33,6 +32,31 @@ class Controller { return this._warehouseFk; } + set item(value) { + this._item = value; + this.updateStock(); + } + + get item() { + return this._item; + } + + updateStock() { + this.available = null; + this.visible = null; + if (this._item && this._item.id) { + let options = { + params: { + warehouseFk: this._warehouseFk + } + }; + this.$http.get(`/item/api/Items/${this._item.id}/getVisibleAvailable`, options).then(response => { + this.available = response.data.available; + this.visible = response.data.visible; + }); + } + } + onMoreChange(callback) { callback.call(this); } @@ -57,6 +81,7 @@ class Controller { warehouseFk: this.warehouseFk }).then(res => { this.vnApp.showSuccess(this.$translate.instant('Data saved!')); + this.updateStock(); }); } } diff --git a/modules/item/front/diary/index.html b/modules/item/front/diary/index.html index 0e1accd05..6a03d8505 100644 --- a/modules/item/front/diary/index.html +++ b/modules/item/front/diary/index.html @@ -35,14 +35,14 @@ - + {{::sale.date | date:'dd/MM/yyyy' }} diff --git a/modules/order/front/basic-data/index.html b/modules/order/front/basic-data/index.html index 50e8c9901..672ae92fa 100644 --- a/modules/order/front/basic-data/index.html +++ b/modules/order/front/basic-data/index.html @@ -29,9 +29,10 @@ diff --git a/modules/order/front/line/index.html b/modules/order/front/line/index.html index c59154e45..d8b27efe3 100644 --- a/modules/order/front/line/index.html +++ b/modules/order/front/line/index.html @@ -5,17 +5,12 @@ - - - Subtotal - {{$ctrl.subtotal | currency: 'EUR':2}} - - VAT - {{$ctrl.VAT | currency: 'EUR':2}} - - Total - {{$ctrl.order.total | currency: 'EUR':2}} - + + + Subtotal {{$ctrl.subtotal | currency: 'EUR':2}} + VAT {{$ctrl.VAT | currency: 'EUR':2}} + Total {{$ctrl.order.total | currency: 'EUR':2}} + diff --git a/modules/order/front/line/style.scss b/modules/order/front/line/style.scss index 31a13d592..6f06532e0 100644 --- a/modules/order/front/line/style.scss +++ b/modules/order/front/line/style.scss @@ -6,4 +6,20 @@ vn-order-line{ height: 50px; } } + .taxes { + max-width: 10em; + border: .1em solid #CCC; + text-align: right; + padding: .5em !important; + + + & > p { + font-size: 1.2em; + margin: .2em; + } + } + vn-horizontal.header { + justify-content: flex-end; + margin-bottom: 0.5em; + } } \ No newline at end of file diff --git a/modules/worker/front/index/index.html b/modules/worker/front/index/index.html index a4c2a6f25..53d16ccea 100644 --- a/modules/worker/front/index/index.html +++ b/modules/worker/front/index/index.html @@ -48,10 +48,6 @@ - - Enter a new search - diff --git a/package-lock.json b/package-lock.json index 292328e11..7d81c13c7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7840,7 +7840,7 @@ "karma-chrome-launcher": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/karma-chrome-launcher/-/karma-chrome-launcher-2.2.0.tgz", - "integrity": "sha1-zxudBxNswY/iOTJ9JGVMPbw2is8=", + "integrity": "sha512-uf/ZVpAabDBPvdPdveyk1EPgbnloPvFFGgmRhYLTDH7gEB4nZdSBk8yTU47w1g/drLSx5uMOkjKk7IWKfWg/+w==", "dev": true, "requires": { "fs-access": "^1.0.0",
Visible
{{$ctrl.item.visible}}
{{$ctrl.visible | dashIfEmpty}}
Available
{{$ctrl.item.available}}
{{$ctrl.available | dashIfEmpty}}
- VAT - {{$ctrl.VAT | currency: 'EUR':2}} -
Subtotal {{$ctrl.subtotal | currency: 'EUR':2}}
VAT {{$ctrl.VAT | currency: 'EUR':2}}
Total {{$ctrl.order.total | currency: 'EUR':2}}