Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into dev
gitea/salix/dev This commit looks good
Details
gitea/salix/dev This commit looks good
Details
This commit is contained in:
commit
a33a63f866
|
@ -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"]',
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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');
|
||||
});
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
<section
|
||||
class="inline-tag ellipsize"
|
||||
ng-class="::{empty: !fetchedTag.value}"
|
||||
ng-repeat="fetchedTag in $ctrl.tags track by $index"
|
||||
vn-tooltip="{{::fetchedTag.name}}: {{::fetchedTag.value}}">
|
||||
ng-repeat="fetchedTag in $ctrl.tags track by $index"
|
||||
title="{{::fetchedTag.name}}: {{::fetchedTag.value}}">
|
||||
{{::fetchedTag.value}}
|
||||
</section>
|
||||
</vn-auto>
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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"
|
||||
}
|
|
@ -22,14 +22,6 @@
|
|||
ng-repeat="client in clients track by client.id"
|
||||
client="::client">
|
||||
</vn-item-client>
|
||||
<vn-empty-rows class="vn-list-item"
|
||||
ng-if="model.data.length === 0" translate>
|
||||
No results
|
||||
</vn-empty-rows>
|
||||
<vn-empty-rows class="vn-list-item"
|
||||
ng-if="model.data === null" translate>
|
||||
Enter a new search
|
||||
</vn-empty-rows>
|
||||
</vn-card>
|
||||
<vn-pagination model="model"></vn-pagination>
|
||||
</div>
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
};
|
||||
|
|
|
@ -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};
|
||||
};
|
||||
};
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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'});
|
||||
|
|
|
@ -34,11 +34,11 @@
|
|||
<vn-horizontal class="item-state">
|
||||
<vn-one>
|
||||
<p translate>Visible</p>
|
||||
<p>{{$ctrl.item.visible}}</p>
|
||||
<p>{{$ctrl.visible | dashIfEmpty}}</p>
|
||||
</vn-one>
|
||||
<vn-one>
|
||||
<p translate>Available</p>
|
||||
<p>{{$ctrl.item.available}}</p>
|
||||
<p>{{$ctrl.available | dashIfEmpty}}</p>
|
||||
</vn-one>
|
||||
</vn-horizontal>
|
||||
</div>
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,14 +35,14 @@
|
|||
<vn-tbody>
|
||||
<vn-tr
|
||||
ng-class="::{
|
||||
'isToday': $ctrl.isToday(sale.date),
|
||||
'isIn': sale.in,
|
||||
'balanceNegative': sale.balance < 0}"
|
||||
ng-repeat="sale in sales"
|
||||
vn-repeat-last
|
||||
on-last="$ctrl.scrollToLine()">
|
||||
<vn-td>
|
||||
<span class="chip date">
|
||||
<span class="chip"
|
||||
ng-class="::{warning: $ctrl.isToday(sale.date)}">
|
||||
{{::sale.date | date:'dd/MM/yyyy' }}
|
||||
</span>
|
||||
</vn-td>
|
||||
|
|
|
@ -29,9 +29,10 @@
|
|||
</vn-autocomplete>
|
||||
<vn-autocomplete
|
||||
vn-one
|
||||
fields="['id', 'nickname']"
|
||||
data="address"
|
||||
label="Address"
|
||||
search-function="{or: [{id: $search}, {nickname: {like: '%'+$search+'%'}}]}"
|
||||
search-function="$search"
|
||||
show-field="nickname"
|
||||
value-field="id"
|
||||
field="$ctrl.order.addressFk">
|
||||
|
|
|
@ -5,17 +5,12 @@
|
|||
<vn-vertical>
|
||||
<vn-card pad-large>
|
||||
<vn-vertical>
|
||||
<vn-horizontal>
|
||||
<div class="totalBox">
|
||||
<vn-label translate>Subtotal</vn-label>
|
||||
<span>{{$ctrl.subtotal | currency: 'EUR':2}}</span>
|
||||
<p>
|
||||
<vn-label translate>VAT</vn-label>
|
||||
<span>{{$ctrl.VAT | currency: 'EUR':2}}</span>
|
||||
</p>
|
||||
<vn-label><strong>Total</strong></vn-label>
|
||||
<strong>{{$ctrl.order.total | currency: 'EUR':2}}</strong>
|
||||
</div>
|
||||
<vn-horizontal class="header">
|
||||
<vn-one class="taxes" ng-if="$ctrl.rows.length > 0">
|
||||
<p><vn-label translate>Subtotal</vn-label> {{$ctrl.subtotal | currency: 'EUR':2}}</p>
|
||||
<p><vn-label translate>VAT</vn-label> {{$ctrl.VAT | currency: 'EUR':2}}</p>
|
||||
<p><vn-label><strong>Total</strong></vn-label> <strong>{{$ctrl.order.total | currency: 'EUR':2}}</strong></p>
|
||||
</vn-one>
|
||||
</vn-horizontal>
|
||||
<vn-table>
|
||||
<vn-thead>
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -48,10 +48,6 @@
|
|||
</vn-horizontal>
|
||||
</vn-horizontal>
|
||||
</a>
|
||||
<vn-empty-rows class="vn-list-item" style="text-align: center"
|
||||
ng-if="model.data === null" translate>
|
||||
Enter a new search
|
||||
</vn-empty-rows>
|
||||
</vn-card>
|
||||
<vn-pagination model="model"></vn-pagination>
|
||||
</div>
|
||||
|
|
|
@ -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",
|
||||
|
|
Loading…
Reference in New Issue