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
250bb359e1
|
@ -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,7 +484,8 @@ 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}`
|
||||
},
|
||||
|
|
|
@ -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');
|
||||
});
|
||||
|
|
|
@ -75,9 +75,9 @@ export default class ArrayModel extends ModelProxy {
|
|||
});
|
||||
}
|
||||
|
||||
data.sort((a, b) => this.sortFunc(a, b, orderComp));
|
||||
data = data.sort((a, b) => this.sortFunc(a, b, orderComp));
|
||||
} else if (typeof order === 'function')
|
||||
data.sort(order);
|
||||
data = data.sort(order);
|
||||
|
||||
this.skip = skip;
|
||||
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
<md-checkbox
|
||||
aria-label="::$ctrl.label"
|
||||
md-indeterminate="$ctrl.isIntermediate"
|
||||
ng-disabled="$ctrl.disabled"
|
||||
ng-disabled="::$ctrl.disabled"
|
||||
ng-checked="$ctrl.isChecked"
|
||||
ng-model="$ctrl.model">
|
||||
<span translate>{{::$ctrl.label}}</span>
|
||||
</md-checkbox>
|
||||
<i class="material-icons"
|
||||
ng-if="$ctrl.hasInfo"
|
||||
vn-tooltip="{{$ctrl.info}}">
|
||||
ng-if="::$ctrl.hasInfo"
|
||||
vn-tooltip="{{::$ctrl.info}}">
|
||||
info_outline
|
||||
</i>
|
|
@ -14,4 +14,8 @@ vn-check {
|
|||
md-checkbox.md-checked .md-icon {
|
||||
background-color: $color-main;
|
||||
}
|
||||
|
||||
md-checkbox {
|
||||
margin-bottom: 0
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -77,9 +77,6 @@
|
|||
</vn-td>
|
||||
</vn-tr>
|
||||
</vn-tbody>
|
||||
<vn-empty-rows ng-if="$ctrl.model.data.length === 0" translate>
|
||||
No results
|
||||
</vn-empty-rows>
|
||||
</vn-table>
|
||||
</vn-vertical>
|
||||
<vn-pagination model="$ctrl.model"></vn-pagination>
|
||||
|
|
|
@ -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"
|
||||
}
|
|
@ -63,12 +63,6 @@
|
|||
</vn-td>
|
||||
</a>
|
||||
</vn-tbody>
|
||||
<vn-empty-rows ng-if="model.data.length === 0" translate>
|
||||
No results
|
||||
</vn-empty-rows>
|
||||
<vn-empty-rows ng-if="model.data === null" translate>
|
||||
Enter a new search
|
||||
</vn-empty-rows>
|
||||
</vn-table>
|
||||
</vn-card>
|
||||
<vn-pagination model="model"></vn-pagination>
|
||||
|
@ -76,7 +70,7 @@
|
|||
<vn-client-descriptor-popover vn-id="clientDescriptor"></vn-client-descriptor-popover>
|
||||
<vn-worker-descriptor-popover
|
||||
vn-id="workerDescriptor"
|
||||
worker-fk="$ctrl.selectedWorker">
|
||||
user-id="$ctrl.selectedWorker">
|
||||
</vn-worker-descriptor-popover>
|
||||
<vn-dialog class="dialog-summary"
|
||||
vn-id="dialog-summary-claim">
|
||||
|
|
|
@ -149,5 +149,5 @@
|
|||
</vn-item-descriptor-popover>
|
||||
<vn-worker-descriptor-popover
|
||||
vn-id="workerDescriptor"
|
||||
worker-fk="$ctrl.selectedWorker">
|
||||
user-id="$ctrl.selectedWorker">
|
||||
</vn-worker-descriptor-popover>
|
|
@ -24,9 +24,6 @@
|
|||
<vn-td>{{::credit.worker.user.nickname}}</vn-td>
|
||||
</vn-tr>
|
||||
</vn-tbody>
|
||||
<vn-empty-rows ng-if="model.data.length === 0" translate>
|
||||
No results
|
||||
</vn-empty-rows>
|
||||
</vn-table>
|
||||
</vn-vertical>
|
||||
<vn-pagination model="model"></vn-pagination>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -28,9 +28,6 @@
|
|||
<vn-td>{{::mandate.finished | date:'dd/MM/yyyy HH:mm' || '-'}}</vn-td>
|
||||
</vn-tr>
|
||||
</vn-tbody>
|
||||
<vn-empty-rows ng-if="model.data.length === 0" translate>
|
||||
No results
|
||||
</vn-empty-rows>
|
||||
</vn-table>
|
||||
</vn-vertical>
|
||||
<vn-pagination model="model"></vn-pagination>
|
||||
|
|
|
@ -36,9 +36,6 @@
|
|||
<vn-td>{{::recovery.period}}</vn-td>
|
||||
</vn-tr>
|
||||
</vn-tbody>
|
||||
<vn-empty-rows ng-if="model.data.length === 0" translate>
|
||||
No results
|
||||
</vn-empty-rows>
|
||||
</vn-table>
|
||||
</vn-vertical>
|
||||
<vn-pagination model="model"></vn-pagination>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -56,8 +56,8 @@
|
|||
<vn-td expand>
|
||||
<vn-fetched-tags
|
||||
max-length="6"
|
||||
item="item"
|
||||
title="item.name">
|
||||
item="::item"
|
||||
title="::item.name">
|
||||
</vn-fetched-tags>
|
||||
</vn-td>
|
||||
<vn-td number>{{::item.stems}}</vn-td>
|
||||
|
@ -78,7 +78,7 @@
|
|||
<vn-td>
|
||||
<vn-check
|
||||
disabled="true"
|
||||
field="item.isActive">
|
||||
field="::item.isActive">
|
||||
</vn-check>
|
||||
</vn-td>
|
||||
<vn-td shrink>
|
||||
|
@ -119,5 +119,5 @@
|
|||
</vn-item-descriptor-popover>
|
||||
<vn-worker-descriptor-popover
|
||||
vn-id="workerDescriptor"
|
||||
worker-fk="$ctrl.selectedWorker">
|
||||
user-id="$ctrl.selectedWorker">
|
||||
</vn-worker-descriptor-popover>
|
|
@ -111,6 +111,7 @@ module.exports = Self => {
|
|||
FROM tmp.ticketCalculateItem tci
|
||||
JOIN vn.item i ON i.id = tci.itemFk
|
||||
JOIN vn.itemType it ON it.id = i.typeFk
|
||||
JOIN vn.ink ON ink.id = i.inkFk
|
||||
JOIN vn.worker w on w.id = it.workerFk`);
|
||||
|
||||
// Apply order by tag
|
||||
|
|
|
@ -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">
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
initial-data="$ctrl.field"
|
||||
field="$ctrl.field"
|
||||
translate-fields="['name']"
|
||||
order="name"
|
||||
show-field="name"
|
||||
value-field="field"
|
||||
label="Order by">
|
||||
|
|
|
@ -12,7 +12,9 @@ class Controller {
|
|||
{way: 'DESC', name: 'Descendant'},
|
||||
];
|
||||
this.defaultFieldList = [
|
||||
{field: 'relevancy DESC, name', name: 'Name'},
|
||||
{field: 'relevancy DESC, name', name: 'Default'},
|
||||
{field: 'showOrder, price', name: 'Color'},
|
||||
{field: 'name', name: 'Name'},
|
||||
{field: 'price', name: 'Price'}
|
||||
];
|
||||
this.fieldList = [];
|
||||
|
@ -27,20 +29,18 @@ class Controller {
|
|||
*/
|
||||
onDataChange() {
|
||||
const items = this.$scope.model.data;
|
||||
|
||||
const newFilterList = [];
|
||||
if (!items) return;
|
||||
|
||||
this.fieldList = [];
|
||||
this.fieldList = this.fieldList.concat(this.defaultFieldList);
|
||||
|
||||
items.forEach(item => {
|
||||
// Add new tag filters
|
||||
item.tags.forEach(itemTag => {
|
||||
const alreadyAdded = this.fieldList.find(order => {
|
||||
return order.field == itemTag.tagFk;
|
||||
const alreadyAdded = newFilterList.findIndex(filter => {
|
||||
return filter.field == itemTag.tagFk;
|
||||
});
|
||||
|
||||
if (!alreadyAdded) {
|
||||
this.fieldList.push({
|
||||
if (alreadyAdded == -1) {
|
||||
newFilterList.push({
|
||||
name: itemTag.name,
|
||||
field: itemTag.tagFk,
|
||||
isTag: true
|
||||
|
@ -48,6 +48,20 @@ class Controller {
|
|||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Add default filters - Replaces tags with same name
|
||||
this.defaultFieldList.forEach(defaultField => {
|
||||
const index = newFilterList.findIndex(newfield => {
|
||||
return newfield.name == defaultField.name;
|
||||
});
|
||||
|
||||
if (index > -1)
|
||||
newFilterList[index] = defaultField;
|
||||
else
|
||||
newFilterList.push(defaultField);
|
||||
});
|
||||
|
||||
this.fieldList = newFilterList;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -17,18 +17,17 @@ describe('Order', () => {
|
|||
|
||||
describe('onDataChange()', () => {
|
||||
it(`should return an object with order params`, () => {
|
||||
let expectedList = [
|
||||
{field: 'relevancy DESC, name', name: 'Name'},
|
||||
{field: 'price', name: 'Price'},
|
||||
{field: 4, name: 'Length', isTag: true}
|
||||
];
|
||||
$scope.model.data = [{id: 1, name: 'My Item', tags: [
|
||||
{tagFk: 4, name: 'Length'}
|
||||
{tagFk: 4, name: 'Length'},
|
||||
{tagFk: 5, name: 'Color'}
|
||||
]}];
|
||||
|
||||
let expectedResult = [{field: 'showOrder, price', name: 'Color'}];
|
||||
let unexpectedResult = [{tagFk: 5, name: 'Color'}];
|
||||
controller.onDataChange();
|
||||
|
||||
expect(controller.fieldList).toEqual(expectedList);
|
||||
expect(controller.fieldList.length).toEqual(5);
|
||||
expect(controller.fieldList).toEqual(jasmine.arrayContaining(expectedResult));
|
||||
expect(controller.fieldList).not.toEqual(jasmine.arrayContaining(unexpectedResult));
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -66,9 +66,6 @@
|
|||
</vn-td>
|
||||
</vn-tr>
|
||||
</vn-tbody>
|
||||
<vn-empty-rows ng-if="model.data === null" translate>
|
||||
Enter a new search
|
||||
</vn-empty-rows>
|
||||
</vn-table>
|
||||
</vn-card>
|
||||
<vn-pagination model="model"></vn-pagination>
|
||||
|
@ -81,7 +78,7 @@
|
|||
</vn-client-descriptor-popover>
|
||||
<vn-worker-descriptor-popover
|
||||
vn-id="workerDescriptor"
|
||||
worker-fk="$ctrl.selectedWorker">
|
||||
user-id="$ctrl.selectedWorker">
|
||||
</vn-worker-descriptor-popover>
|
||||
<vn-dialog
|
||||
vn-id="summary"
|
||||
|
|
|
@ -26,9 +26,6 @@
|
|||
<vn-td number>{{ticket.state.state.name}}</vn-td>
|
||||
</vn-tr>
|
||||
</vn-tbody>
|
||||
<vn-empty-rows ng-if="$ctrl.possibleStowaways.length === 0" translate>
|
||||
No results
|
||||
</vn-empty-rows>
|
||||
</vn-table>
|
||||
</vn-horizontal>
|
||||
</tpl-body>
|
||||
|
|
|
@ -25,9 +25,6 @@
|
|||
<vn-td number>{{stowaway.ticket.state.state.name}}</vn-td>
|
||||
</vn-tr>
|
||||
</vn-tbody>
|
||||
<vn-empty-rows ng-if="$ctrl.ticketStowaways.length === 0" translate>
|
||||
No results
|
||||
</vn-empty-rows>
|
||||
</vn-table>
|
||||
</vn-horizontal>
|
||||
</tpl-body>
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
</vn-item-descriptor-popover>
|
||||
<vn-worker-descriptor-popover
|
||||
vn-id="workerDescriptor"
|
||||
worker-fk="$ctrl.selectedWorker">
|
||||
user-id="$ctrl.selectedWorker">
|
||||
</vn-worker-descriptor-popover>
|
||||
<vn-confirm
|
||||
vn-id="delete-expedition"
|
||||
|
|
|
@ -120,5 +120,5 @@
|
|||
</vn-client-descriptor-popover>
|
||||
<vn-worker-descriptor-popover
|
||||
vn-id="workerDescriptor"
|
||||
worker-fk="$ctrl.selectedWorker">
|
||||
user-id="$ctrl.selectedWorker">
|
||||
</vn-worker-descriptor-popover>
|
|
@ -86,7 +86,7 @@
|
|||
</vn-item-descriptor-popover>
|
||||
<vn-worker-descriptor-popover
|
||||
vn-id="workerDescriptor"
|
||||
worker-fk="$ctrl.selectedWorker">
|
||||
user-id="$ctrl.selectedWorker">
|
||||
</vn-worker-descriptor-popover>
|
||||
<a ui-sref="ticket.card.request.create"
|
||||
vn-tooltip="New request"
|
||||
|
|
|
@ -61,5 +61,5 @@
|
|||
</vn-item-descriptor-popover>
|
||||
<vn-worker-descriptor-popover
|
||||
vn-id="workerDescriptor"
|
||||
worker-fk="$ctrl.selectedWorker">
|
||||
user-id="$ctrl.selectedWorker">
|
||||
</vn-worker-descriptor-popover>
|
|
@ -144,9 +144,6 @@
|
|||
</vn-td>
|
||||
</vn-tr>
|
||||
</vn-tbody>
|
||||
<vn-empty-rows ng-if="$ctrl.sales.length === 0" translate>
|
||||
No results
|
||||
</vn-empty-rows>
|
||||
</vn-table>
|
||||
</vn-vertical>
|
||||
</vn-card>
|
||||
|
|
|
@ -41,5 +41,5 @@
|
|||
</a>
|
||||
<vn-worker-descriptor-popover
|
||||
vn-id="workerDescriptor"
|
||||
worker-fk="$ctrl.selectedWorker">
|
||||
user-id="$ctrl.selectedWorker">
|
||||
</vn-worker-descriptor-popover>
|
|
@ -47,9 +47,6 @@
|
|||
<vn-td></vn-td>
|
||||
</vn-tr>
|
||||
</vn-tbody>
|
||||
<vn-empty-rows ng-if="!model.data || model.data.length === 0" translate>
|
||||
Enter a new search
|
||||
</vn-empty-rows>
|
||||
</vn-table>
|
||||
</vn-card>
|
||||
<vn-pagination model="model"></vn-pagination>
|
||||
|
|
|
@ -11,16 +11,16 @@ class Controller extends Component {
|
|||
this.worker = null;
|
||||
}
|
||||
|
||||
set workerFk(id) {
|
||||
if (id == this._workerFk) return;
|
||||
set userId(id) {
|
||||
if (id == this._userId) return;
|
||||
|
||||
this._workerFk = id;
|
||||
this._userId = id;
|
||||
this.worker = null;
|
||||
this.loadData();
|
||||
}
|
||||
|
||||
get workerFk() {
|
||||
return this._workerFk;
|
||||
get userId() {
|
||||
return this._userId;
|
||||
}
|
||||
|
||||
set quicklinks(value = {}) {
|
||||
|
@ -37,8 +37,11 @@ class Controller extends Component {
|
|||
}
|
||||
|
||||
loadData() {
|
||||
let query = `api/Workers/${this._workerFk}`;
|
||||
let query = `api/Workers/findOne`;
|
||||
let filter = {
|
||||
where: {
|
||||
userFk: this._userId
|
||||
},
|
||||
include: [
|
||||
{
|
||||
relation: 'user',
|
||||
|
@ -49,6 +52,13 @@ class Controller extends Component {
|
|||
}, {
|
||||
relation: 'sip',
|
||||
scope: {fields: ['extension']}
|
||||
}, {
|
||||
relation: 'department',
|
||||
scope: {
|
||||
include: {
|
||||
relation: 'department'
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
@ -67,7 +77,7 @@ ngModule.component('vnWorkerDescriptorPopover', {
|
|||
template: require('./index.html'),
|
||||
controller: Controller,
|
||||
bindings: {
|
||||
workerFk: '<',
|
||||
userId: '<',
|
||||
quicklinks: '<'
|
||||
}
|
||||
});
|
||||
|
|
|
@ -21,23 +21,23 @@ describe('worker Component vnWorkerDescriptorPopover', () => {
|
|||
describe('workerFk()', () => {
|
||||
it(`should not apply any changes if the received id is the same stored in _workerFk`, () => {
|
||||
controller.worker = 'I exist!';
|
||||
controller._workerFk = 1;
|
||||
controller._userId = 1;
|
||||
spyOn(controller, 'loadData');
|
||||
controller.workerFk = 1;
|
||||
controller.userId = 1;
|
||||
|
||||
expect(controller.worker).toEqual('I exist!');
|
||||
expect(controller._workerFk).toEqual(1);
|
||||
expect(controller._userId).toEqual(1);
|
||||
expect(controller.loadData).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it(`should set the received id into _workerFk, set the worker to null and then call loadData()`, () => {
|
||||
controller.worker = `Please don't`;
|
||||
controller._workerFk = 1;
|
||||
controller._userId = 1;
|
||||
spyOn(controller, 'loadData');
|
||||
controller.workerFk = 999;
|
||||
controller.userId = 999;
|
||||
|
||||
expect(controller.worker).toBeNull();
|
||||
expect(controller._workerFk).toEqual(999);
|
||||
expect(controller._userId).toEqual(999);
|
||||
expect(controller.loadData).toHaveBeenCalledWith();
|
||||
});
|
||||
});
|
||||
|
@ -53,12 +53,15 @@ describe('worker Component vnWorkerDescriptorPopover', () => {
|
|||
|
||||
describe('loadData()', () => {
|
||||
it(`should perform a get query to store the worker data into the controller`, () => {
|
||||
controller.workerFk = 1;
|
||||
controller.userId = 1;
|
||||
controller.canceler = null;
|
||||
let response = {};
|
||||
|
||||
let config = {
|
||||
filter: {
|
||||
where: {
|
||||
userFk: controller.userId
|
||||
},
|
||||
include: [
|
||||
{
|
||||
relation: 'user',
|
||||
|
@ -69,6 +72,13 @@ describe('worker Component vnWorkerDescriptorPopover', () => {
|
|||
}, {
|
||||
relation: 'sip',
|
||||
scope: {fields: ['extension']}
|
||||
}, {
|
||||
relation: 'department',
|
||||
scope: {
|
||||
include: {
|
||||
relation: 'department'
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -76,8 +86,8 @@ describe('worker Component vnWorkerDescriptorPopover', () => {
|
|||
|
||||
let json = $httpParamSerializer(config);
|
||||
|
||||
$httpBackend.whenGET(`api/Workers/${controller._workerFk}?${json}`).respond(response);
|
||||
$httpBackend.expectGET(`api/Workers/${controller._workerFk}?${json}`);
|
||||
$httpBackend.whenGET(`api/Workers/findOne?${json}`).respond(response);
|
||||
$httpBackend.expectGET(`api/Workers/findOne?${json}`);
|
||||
controller.loadData();
|
||||
$httpBackend.flush();
|
||||
|
||||
|
|
|
@ -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