Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into dev
This commit is contained in:
commit
5ef524559e
|
@ -1,7 +1,8 @@
|
||||||
import selectors from '../../helpers/selectors.js';
|
import selectors from '../../helpers/selectors.js';
|
||||||
import createNightmare from '../../helpers/nightmare';
|
import createNightmare from '../../helpers/nightmare';
|
||||||
|
|
||||||
describe('Ticket Edit sale path', () => {
|
// #1152 refactor ticket.sale, update price no funciona correctamente.
|
||||||
|
xdescribe('Ticket Edit sale path', () => {
|
||||||
const nightmare = createNightmare();
|
const nightmare = createNightmare();
|
||||||
|
|
||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
|
@ -156,8 +157,7 @@ describe('Ticket Edit sale path', () => {
|
||||||
it('should update the price', async() => {
|
it('should update the price', async() => {
|
||||||
const result = await nightmare
|
const result = await nightmare
|
||||||
.waitToClick(selectors.ticketSales.firstSalePrice)
|
.waitToClick(selectors.ticketSales.firstSalePrice)
|
||||||
.write(selectors.ticketSales.firstSalePriceInput, 5)
|
.write(selectors.ticketSales.firstSalePriceInput, '5\u000d')
|
||||||
.write('body', '\u000d') // simulates enter
|
|
||||||
.waitForLastSnackbar();
|
.waitForLastSnackbar();
|
||||||
|
|
||||||
expect(result).toEqual('Data saved!');
|
expect(result).toEqual('Data saved!');
|
||||||
|
@ -181,8 +181,8 @@ describe('Ticket Edit sale path', () => {
|
||||||
const result = await nightmare
|
const result = await nightmare
|
||||||
.waitToClick(selectors.ticketSales.firstSaleDiscount)
|
.waitToClick(selectors.ticketSales.firstSaleDiscount)
|
||||||
.wait('vn-textfield[label="Discount"] > div[class="container selected"]') // a function selects the text after it's loaded
|
.wait('vn-textfield[label="Discount"] > div[class="container selected"]') // a function selects the text after it's loaded
|
||||||
.write(selectors.ticketSales.firstSaleDiscountInput, 50)
|
.write(selectors.ticketSales.firstSaleDiscountInput, '50\u000d')
|
||||||
.write('body', '\u000d') // simulates enter
|
// .write('body', '\u000d') // simulates enter
|
||||||
.waitForLastSnackbar();
|
.waitForLastSnackbar();
|
||||||
|
|
||||||
expect(result).toEqual('Data saved!');
|
expect(result).toEqual('Data saved!');
|
||||||
|
@ -318,7 +318,7 @@ describe('Ticket Edit sale path', () => {
|
||||||
it('should go back to the original ticket sales section', async() => {
|
it('should go back to the original ticket sales section', async() => {
|
||||||
const url = await nightmare
|
const url = await nightmare
|
||||||
.waitToClick(selectors.itemsIndex.goBackToModuleIndexButton)
|
.waitToClick(selectors.itemsIndex.goBackToModuleIndexButton)
|
||||||
.write(selectors.ticketsIndex.searchTicketInput, 'id:16')
|
.write(selectors.ticketsIndex.searchTicketInput, '16')
|
||||||
.waitToClick(selectors.ticketsIndex.searchButton)
|
.waitToClick(selectors.ticketsIndex.searchButton)
|
||||||
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
|
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
|
||||||
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21')
|
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21')
|
||||||
|
@ -488,7 +488,7 @@ describe('Ticket Edit sale path', () => {
|
||||||
|
|
||||||
it('should now search for a specific ticket', async() => {
|
it('should now search for a specific ticket', async() => {
|
||||||
const result = await nightmare
|
const result = await nightmare
|
||||||
.write(selectors.ticketsIndex.searchTicketInput, 'id:16')
|
.write(selectors.ticketsIndex.searchTicketInput, '16')
|
||||||
.waitToClick(selectors.ticketsIndex.searchButton)
|
.waitToClick(selectors.ticketsIndex.searchButton)
|
||||||
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
|
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
|
||||||
.countElement(selectors.ticketsIndex.searchResult);
|
.countElement(selectors.ticketsIndex.searchResult);
|
||||||
|
@ -574,7 +574,7 @@ describe('Ticket Edit sale path', () => {
|
||||||
|
|
||||||
it('should once again search for a specific ticket', async() => {
|
it('should once again search for a specific ticket', async() => {
|
||||||
const result = await nightmare
|
const result = await nightmare
|
||||||
.write(selectors.ticketsIndex.searchTicketInput, 'id:16')
|
.write(selectors.ticketsIndex.searchTicketInput, '16')
|
||||||
.waitToClick(selectors.ticketsIndex.searchButton)
|
.waitToClick(selectors.ticketsIndex.searchButton)
|
||||||
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
|
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
|
||||||
.countElement(selectors.ticketsIndex.searchResult);
|
.countElement(selectors.ticketsIndex.searchResult);
|
||||||
|
|
|
@ -89,12 +89,33 @@ module.exports = Self => {
|
||||||
filter = {
|
filter = {
|
||||||
where: {claimFk: id},
|
where: {claimFk: id},
|
||||||
include: [
|
include: [
|
||||||
{relation: 'claimResponsible'},
|
{
|
||||||
{relation: 'worker'},
|
relation: 'claimResponsible'
|
||||||
{relation: 'claimDestination'},
|
},
|
||||||
{relation: 'claimReason'},
|
{
|
||||||
{relation: 'claimResult'},
|
relation: 'worker',
|
||||||
{relation: 'claimRedelivery'}
|
scope: {
|
||||||
|
fields: ['userFk'],
|
||||||
|
include: {
|
||||||
|
relation: 'user',
|
||||||
|
scope: {
|
||||||
|
fields: ['nickname']
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
relation: 'claimDestination'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
relation: 'claimReason'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
relation: 'claimResult'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
relation: 'claimRedelivery'
|
||||||
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
promises.push(Self.app.models.ClaimDevelopment.find(filter));
|
promises.push(Self.app.models.ClaimDevelopment.find(filter));
|
||||||
|
|
|
@ -37,12 +37,18 @@
|
||||||
ui-sref="claim.card.summary({id: claim.id})">
|
ui-sref="claim.card.summary({id: claim.id})">
|
||||||
<vn-td number>{{::claim.id}}</vn-td>
|
<vn-td number>{{::claim.id}}</vn-td>
|
||||||
<vn-td expand>
|
<vn-td expand>
|
||||||
<span class="link" ng-click="$ctrl.showDescriptor($event, claim.client.id)">
|
<span class="link" ng-click="$ctrl.showClientDescriptor($event, claim.client.id)">
|
||||||
{{::claim.client.name}}
|
{{::claim.client.name}}
|
||||||
</span>
|
</span>
|
||||||
</vn-td>
|
</vn-td>
|
||||||
<vn-td center>{{::claim.created | date:'dd/MM/yyyy'}}</vn-td>
|
<vn-td center>{{::claim.created | date:'dd/MM/yyyy'}}</vn-td>
|
||||||
<vn-td expand>{{::claim.worker.user.nickname}}</vn-td>
|
<vn-td expand>
|
||||||
|
<span
|
||||||
|
class="link"
|
||||||
|
ng-click="$ctrl.showWorkerDescriptor($event, claim.worker.user.id)">
|
||||||
|
{{::claim.worker.user.nickname}}
|
||||||
|
</span>
|
||||||
|
</vn-td>
|
||||||
<vn-td>
|
<vn-td>
|
||||||
<span class="chip {{::$ctrl.stateColor(claim)}}">
|
<span class="chip {{::$ctrl.stateColor(claim)}}">
|
||||||
{{::claim.claimState.description}}
|
{{::claim.claimState.description}}
|
||||||
|
@ -67,7 +73,11 @@
|
||||||
</vn-card>
|
</vn-card>
|
||||||
<vn-pagination model="model"></vn-pagination>
|
<vn-pagination model="model"></vn-pagination>
|
||||||
</div>
|
</div>
|
||||||
<vn-client-descriptor-popover vn-id="descriptor"></vn-client-descriptor-popover>
|
<vn-client-descriptor-popover vn-id="clientDescriptor"></vn-client-descriptor-popover>
|
||||||
|
<vn-worker-descriptor-popover
|
||||||
|
vn-id="workerDescriptor"
|
||||||
|
worker-fk="$ctrl.selectedWorker">
|
||||||
|
</vn-worker-descriptor-popover>
|
||||||
<vn-dialog class="dialog-summary"
|
<vn-dialog class="dialog-summary"
|
||||||
vn-id="dialog-summary-claim">
|
vn-id="dialog-summary-claim">
|
||||||
<tpl-body>
|
<tpl-body>
|
||||||
|
|
|
@ -65,14 +65,22 @@ export default class Controller {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
showDescriptor(event, clientFk) {
|
showClientDescriptor(event, clientFk) {
|
||||||
this.$.descriptor.clientFk = clientFk;
|
this.$.clientDescriptor.clientFk = clientFk;
|
||||||
this.$.descriptor.parent = event.target;
|
this.$.clientDescriptor.parent = event.target;
|
||||||
this.$.descriptor.show();
|
this.$.clientDescriptor.show();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopImmediatePropagation();
|
event.stopImmediatePropagation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
showWorkerDescriptor(event, userId) {
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopImmediatePropagation();
|
||||||
|
this.selectedWorker = userId;
|
||||||
|
this.$.workerDescriptor.parent = event.target;
|
||||||
|
this.$.workerDescriptor.show();
|
||||||
|
}
|
||||||
|
|
||||||
preview(event, claim) {
|
preview(event, claim) {
|
||||||
this.claimSelected = claim;
|
this.claimSelected = claim;
|
||||||
this.$.dialogSummaryClaim.show();
|
this.$.dialogSummaryClaim.show();
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
"name": "Claims",
|
"name": "Claims",
|
||||||
"icon": "icon-claims",
|
"icon": "icon-claims",
|
||||||
"validations": true,
|
"validations": true,
|
||||||
"dependencies": ["item", "client"],
|
"dependencies": ["worker", "item", "client"],
|
||||||
"menu": [
|
"menu": [
|
||||||
{"state": "claim.card.basicData", "icon": "settings"},
|
{"state": "claim.card.basicData", "icon": "settings"},
|
||||||
{"state": "claim.card.detail", "icon": "icon-details"},
|
{"state": "claim.card.detail", "icon": "icon-details"},
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
<vn-tr ng-repeat="saleClaimed in $ctrl.summary.salesClaimed">
|
<vn-tr ng-repeat="saleClaimed in $ctrl.summary.salesClaimed">
|
||||||
<vn-td number>
|
<vn-td number>
|
||||||
<span
|
<span
|
||||||
ng-click="$ctrl.showDescriptor($event, saleClaimed.sale.itemFk)"
|
ng-click="$ctrl.showItemDescriptor($event, saleClaimed.sale.itemFk)"
|
||||||
class="link">
|
class="link">
|
||||||
{{saleClaimed.sale.itemFk | zeroFill:6}}
|
{{saleClaimed.sale.itemFk | zeroFill:6}}
|
||||||
</span>
|
</span>
|
||||||
|
@ -90,7 +90,13 @@
|
||||||
<vn-td>{{development.claimReason.description}}</vn-td>
|
<vn-td>{{development.claimReason.description}}</vn-td>
|
||||||
<vn-td>{{development.claimResult.description}}</vn-td>
|
<vn-td>{{development.claimResult.description}}</vn-td>
|
||||||
<vn-td>{{development.claimResponsible.description}}</vn-td>
|
<vn-td>{{development.claimResponsible.description}}</vn-td>
|
||||||
<vn-td>{{development.worker.firstName}}</vn-td>
|
<vn-td expand>
|
||||||
|
<span
|
||||||
|
class="link"
|
||||||
|
ng-click="$ctrl.showWorkerDescriptor($event, development.worker.user.id)">
|
||||||
|
{{::development.worker.user.nickname}}
|
||||||
|
</span>
|
||||||
|
</vn-td>
|
||||||
<vn-td>{{development.claimRedelivery.description}}</vn-td>
|
<vn-td>{{development.claimRedelivery.description}}</vn-td>
|
||||||
</vn-tr>
|
</vn-tr>
|
||||||
</vn-tbody>
|
</vn-tbody>
|
||||||
|
@ -115,7 +121,7 @@
|
||||||
<vn-tr ng-repeat="action in $ctrl.summary.actions">
|
<vn-tr ng-repeat="action in $ctrl.summary.actions">
|
||||||
<vn-td number>
|
<vn-td number>
|
||||||
<span
|
<span
|
||||||
ng-click="$ctrl.showDescriptor($event, action.sale.itemFk)"
|
ng-click="$ctrl.showItemDescriptor($event, action.sale.itemFk)"
|
||||||
class="link">
|
class="link">
|
||||||
{{action.sale.itemFk | zeroFill:6}}
|
{{action.sale.itemFk | zeroFill:6}}
|
||||||
</span>
|
</span>
|
||||||
|
@ -138,6 +144,10 @@
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
</vn-card>
|
</vn-card>
|
||||||
<vn-item-descriptor-popover
|
<vn-item-descriptor-popover
|
||||||
vn-id="descriptor"
|
vn-id="itemDescriptor"
|
||||||
quicklinks="$ctrl.quicklinks">
|
quicklinks="$ctrl.quicklinks">
|
||||||
</vn-item-descriptor-popover>
|
</vn-item-descriptor-popover>
|
||||||
|
<vn-worker-descriptor-popover
|
||||||
|
vn-id="workerDescriptor"
|
||||||
|
worker-fk="$ctrl.selectedWorker">
|
||||||
|
</vn-worker-descriptor-popover>
|
|
@ -1,7 +1,7 @@
|
||||||
import ngModule from '../module';
|
import ngModule from '../module';
|
||||||
|
|
||||||
class Controller {
|
class Controller {
|
||||||
constructor($http, $scope) {
|
constructor($scope, $http) {
|
||||||
this.$http = $http;
|
this.$http = $http;
|
||||||
this.$ = $scope;
|
this.$ = $scope;
|
||||||
}
|
}
|
||||||
|
@ -17,8 +17,7 @@ class Controller {
|
||||||
this.getSummary();
|
this.getSummary();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Item Descriptor
|
showItemDescriptor(event, itemFk) {
|
||||||
showDescriptor(event, itemFk) {
|
|
||||||
this.quicklinks = {
|
this.quicklinks = {
|
||||||
btnThree: {
|
btnThree: {
|
||||||
icon: 'icon-transaction',
|
icon: 'icon-transaction',
|
||||||
|
@ -28,13 +27,21 @@ class Controller {
|
||||||
tooltip: 'Item diary'
|
tooltip: 'Item diary'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
this.$.descriptor.itemFk = itemFk;
|
this.$.itemDescriptor.itemFk = itemFk;
|
||||||
this.$.descriptor.parent = event.target;
|
this.$.itemDescriptor.parent = event.target;
|
||||||
this.$.descriptor.show();
|
this.$.itemDescriptor.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
showWorkerDescriptor(event, userId) {
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopImmediatePropagation();
|
||||||
|
this.selectedWorker = userId;
|
||||||
|
this.$.workerDescriptor.parent = event.target;
|
||||||
|
this.$.workerDescriptor.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Controller.$inject = ['$http', '$scope'];
|
Controller.$inject = ['$scope', '$http'];
|
||||||
|
|
||||||
ngModule.component('vnClaimSummary', {
|
ngModule.component('vnClaimSummary', {
|
||||||
template: require('./index.html'),
|
template: require('./index.html'),
|
||||||
|
|
|
@ -72,6 +72,7 @@ module.exports = Self => {
|
||||||
i.size, i.tag5, i.value5, i.tag6, i.value6,
|
i.size, i.tag5, i.value5, i.tag6, i.value6,
|
||||||
i.tag7, i.value7, i.tag8, i.value8, i.isActive,
|
i.tag7, i.value7, i.tag8, i.value8, i.isActive,
|
||||||
t.name type, u.nickname userNickname,
|
t.name type, u.nickname userNickname,
|
||||||
|
t.name type, u.id userId,
|
||||||
intr.description AS intrastat, i.stems,
|
intr.description AS intrastat, i.stems,
|
||||||
ori.code AS origin, t.name AS type,
|
ori.code AS origin, t.name AS type,
|
||||||
ic.name AS category, i.density, tc.description AS taxClass
|
ic.name AS category, i.density, tc.description AS taxClass
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
<vn-thead>
|
<vn-thead>
|
||||||
<vn-tr>
|
<vn-tr>
|
||||||
<vn-th>Date</vn-th>
|
<vn-th>Date</vn-th>
|
||||||
<vn-th number order="DESC">Id</vn-th>
|
<vn-th number order="DESC">Ticket/Entry</vn-th>
|
||||||
<vn-th>State</vn-th>
|
<vn-th>State</vn-th>
|
||||||
<vn-th>Reference</vn-th>
|
<vn-th>Reference</vn-th>
|
||||||
<vn-th>Client</vn-th>
|
<vn-th>Client</vn-th>
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
In: Entrada
|
In: Entrada
|
||||||
Out: Salida
|
Out: Salida
|
||||||
Visible quantity: Cantidad visible
|
Visible quantity: Cantidad visible
|
||||||
|
Ticket/Entry: Ticket/Entrada
|
|
@ -46,7 +46,13 @@
|
||||||
ng-click="$ctrl.stopEvent($event)"
|
ng-click="$ctrl.stopEvent($event)"
|
||||||
on-error-src/>
|
on-error-src/>
|
||||||
</vn-td>
|
</vn-td>
|
||||||
<vn-td number>{{::item.id | zeroFill:6}}</vn-td>
|
<vn-td expand>
|
||||||
|
<span
|
||||||
|
class="link"
|
||||||
|
ng-click="$ctrl.showItemDescriptor($event, item.id)">
|
||||||
|
{{::item.id | zeroFill:6}}
|
||||||
|
</span>
|
||||||
|
</vn-td>
|
||||||
<vn-td expand>
|
<vn-td expand>
|
||||||
<vn-fetched-tags
|
<vn-fetched-tags
|
||||||
max-length="6"
|
max-length="6"
|
||||||
|
@ -59,7 +65,14 @@
|
||||||
<vn-td>{{::item.category}}</vn-td>
|
<vn-td>{{::item.category}}</vn-td>
|
||||||
<vn-td>{{::item.intrastat}}</vn-td>
|
<vn-td>{{::item.intrastat}}</vn-td>
|
||||||
<vn-td>{{::item.origin}}</vn-td>
|
<vn-td>{{::item.origin}}</vn-td>
|
||||||
<vn-td>{{::item.userNickname}}</vn-td>
|
<vn-td expand>
|
||||||
|
<span
|
||||||
|
class="link"
|
||||||
|
ng-click="$ctrl.showWorkerDescriptor($event, item.userId)">
|
||||||
|
{{::item.userNickname}}
|
||||||
|
</span>
|
||||||
|
</vn-td>
|
||||||
|
<vn-td>{{::item.density}}</vn-td>
|
||||||
<vn-td number>{{::item.density}}</vn-td>
|
<vn-td number>{{::item.density}}</vn-td>
|
||||||
<vn-td>{{::item.taxClass}}</vn-td>
|
<vn-td>{{::item.taxClass}}</vn-td>
|
||||||
<vn-td>
|
<vn-td>
|
||||||
|
@ -102,3 +115,9 @@
|
||||||
question="Do you want to clone this item?"
|
question="Do you want to clone this item?"
|
||||||
message="All it's properties will be copied">
|
message="All it's properties will be copied">
|
||||||
</vn-confirm>
|
</vn-confirm>
|
||||||
|
<vn-item-descriptor-popover vn-id="itemDescriptor">
|
||||||
|
</vn-item-descriptor-popover>
|
||||||
|
<vn-worker-descriptor-popover
|
||||||
|
vn-id="workerDescriptor"
|
||||||
|
worker-fk="$ctrl.selectedWorker">
|
||||||
|
</vn-worker-descriptor-popover>
|
|
@ -28,21 +28,36 @@ class Controller {
|
||||||
this.$.model.clear();
|
this.$.model.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
showDescriptor(event, itemFk) {
|
showItemDescriptor(event, itemFk) {
|
||||||
|
if (event.defaultPrevented) return;
|
||||||
|
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
|
||||||
this.quicklinks = {
|
this.quicklinks = {
|
||||||
btnThree: {
|
btnThree: {
|
||||||
icon: 'icon-transaction',
|
icon: 'icon-transaction',
|
||||||
state: `item.card.diary({
|
state: `item.card.diary({
|
||||||
id: ${itemFk},
|
id: ${itemFk},
|
||||||
warehouseFk: ${this.ticket.warehouseFk},
|
|
||||||
ticketFk: ${this.ticket.id}
|
|
||||||
})`,
|
})`,
|
||||||
tooltip: 'Item diary'
|
tooltip: 'Item diary'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
this.$scope.descriptor.itemFk = itemFk;
|
this.$.itemDescriptor.itemFk = itemFk;
|
||||||
this.$scope.descriptor.parent = event.target;
|
this.$.itemDescriptor.parent = event.target;
|
||||||
this.$scope.descriptor.show();
|
this.$.itemDescriptor.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
showWorkerDescriptor(event, userId) {
|
||||||
|
if (event.defaultPrevented) return;
|
||||||
|
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
|
||||||
|
this.selectedWorker = userId;
|
||||||
|
this.$.workerDescriptor.parent = event.target;
|
||||||
|
this.$.workerDescriptor.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
cloneItem(event, item) {
|
cloneItem(event, item) {
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
"name": "Items",
|
"name": "Items",
|
||||||
"icon": "inbox",
|
"icon": "inbox",
|
||||||
"validations" : true,
|
"validations" : true,
|
||||||
"dependencies": ["client", "ticket"],
|
"dependencies": ["worker", "client", "ticket"],
|
||||||
"menu": [
|
"menu": [
|
||||||
{"state": "item.card.data", "icon": "settings"},
|
{"state": "item.card.data", "icon": "settings"},
|
||||||
{"state": "item.card.tags", "icon": "icon-tags"},
|
{"state": "item.card.tags", "icon": "icon-tags"},
|
||||||
|
|
|
@ -36,11 +36,17 @@
|
||||||
ui-sref="order.card.summary({id: {{::order.id}}})">
|
ui-sref="order.card.summary({id: {{::order.id}}})">
|
||||||
<vn-td number>{{::order.id}}</vn-td>
|
<vn-td number>{{::order.id}}</vn-td>
|
||||||
<vn-td expand>
|
<vn-td expand>
|
||||||
<span class="link" ng-click="$ctrl.showDescriptor($event, order.clientFk)">
|
<span class="link" ng-click="$ctrl.showClientDescriptor($event, order.clientFk)">
|
||||||
{{::order.client.name}}
|
{{::order.client.name}}
|
||||||
</span>
|
</span>
|
||||||
</vn-td>
|
</vn-td>
|
||||||
<vn-td>{{::order.client.salesPerson.user.nickname}}</vn-td>
|
<vn-td expand>
|
||||||
|
<span
|
||||||
|
class="link"
|
||||||
|
ng-click="$ctrl.showWorkerDescriptor($event, order.client.salesPerson.user.id)">
|
||||||
|
{{::order.client.salesPerson.user.nickname | dashIfEmpty}}
|
||||||
|
</span>
|
||||||
|
</vn-td>
|
||||||
<vn-td center>
|
<vn-td center>
|
||||||
<vn-check
|
<vn-check
|
||||||
field="order.isConfirmed"
|
field="order.isConfirmed"
|
||||||
|
@ -71,8 +77,12 @@
|
||||||
<vn-float-button icon="add"></vn-float-button>
|
<vn-float-button icon="add"></vn-float-button>
|
||||||
</a>
|
</a>
|
||||||
<vn-client-descriptor-popover
|
<vn-client-descriptor-popover
|
||||||
vn-id="descriptor">
|
vn-id="clientDescriptor">
|
||||||
</vn-client-descriptor-popover>
|
</vn-client-descriptor-popover>
|
||||||
|
<vn-worker-descriptor-popover
|
||||||
|
vn-id="workerDescriptor"
|
||||||
|
worker-fk="$ctrl.selectedWorker">
|
||||||
|
</vn-worker-descriptor-popover>
|
||||||
<vn-dialog
|
<vn-dialog
|
||||||
vn-id="summary"
|
vn-id="summary"
|
||||||
class="dialog-summary">
|
class="dialog-summary">
|
||||||
|
|
|
@ -2,7 +2,7 @@ import ngModule from '../module';
|
||||||
|
|
||||||
export default class Controller {
|
export default class Controller {
|
||||||
constructor($scope) {
|
constructor($scope) {
|
||||||
this.$scope = $scope;
|
this.$ = $scope;
|
||||||
this.ticketSelected = null;
|
this.ticketSelected = null;
|
||||||
this.filter = {
|
this.filter = {
|
||||||
include: [
|
include: [
|
||||||
|
@ -51,23 +51,31 @@ export default class Controller {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
showDescriptor(event, clientFk) {
|
showClientDescriptor(event, clientFk) {
|
||||||
this.$scope.descriptor.clientFk = clientFk;
|
this.$.clientDescriptor.clientFk = clientFk;
|
||||||
this.$scope.descriptor.parent = event.target;
|
this.$.clientDescriptor.parent = event.target;
|
||||||
this.$scope.descriptor.show();
|
this.$.clientDescriptor.show();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopImmediatePropagation();
|
event.stopImmediatePropagation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
showWorkerDescriptor(event, userId) {
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopImmediatePropagation();
|
||||||
|
this.selectedWorker = userId;
|
||||||
|
this.$.workerDescriptor.parent = event.target;
|
||||||
|
this.$.workerDescriptor.show();
|
||||||
|
}
|
||||||
|
|
||||||
onDescriptorLoad() {
|
onDescriptorLoad() {
|
||||||
this.$scope.popover.relocate();
|
this.$.popover.relocate();
|
||||||
}
|
}
|
||||||
|
|
||||||
preview(event, order) {
|
preview(event, order) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopImmediatePropagation();
|
event.stopImmediatePropagation();
|
||||||
this.selectedOrder = order;
|
this.selectedOrder = order;
|
||||||
this.$scope.summary.show();
|
this.$.summary.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
"name": "Orders",
|
"name": "Orders",
|
||||||
"icon": "shopping_cart",
|
"icon": "shopping_cart",
|
||||||
"validations": true,
|
"validations": true,
|
||||||
"dependencies": ["item", "ticket"],
|
"dependencies": ["worker", "item", "ticket"],
|
||||||
"menu": [
|
"menu": [
|
||||||
{"state": "order.card.basicData", "icon": "settings"},
|
{"state": "order.card.basicData", "icon": "settings"},
|
||||||
{"state": "order.card.catalog", "icon": "shopping_cart"},
|
{"state": "order.card.catalog", "icon": "shopping_cart"},
|
||||||
|
|
|
@ -33,14 +33,15 @@ module.exports = Self => {
|
||||||
e.checked,
|
e.checked,
|
||||||
i2.name nameBox,
|
i2.name nameBox,
|
||||||
e.itemFk,
|
e.itemFk,
|
||||||
w.name nameWorker,
|
u.nickname userNickname,
|
||||||
w.firstName,
|
u.id userId,
|
||||||
e.created
|
e.created
|
||||||
FROM
|
FROM
|
||||||
vn.expedition e
|
vn.expedition e
|
||||||
LEFT JOIN vn.item i2 ON i2.id = e.itemFk
|
LEFT JOIN vn.item i2 ON i2.id = e.itemFk
|
||||||
INNER JOIN vn.item i1 ON i1.id = e.isBox
|
INNER JOIN vn.item i1 ON i1.id = e.isBox
|
||||||
LEFT JOIN vn.worker w ON w.id = e.workerFk
|
LEFT JOIN vn.worker w ON w.id = e.workerFk
|
||||||
|
JOIN account.user u ON u.id = w.id
|
||||||
`);
|
`);
|
||||||
stmt.merge(Self.buildSuffix(filter, 'e'));
|
stmt.merge(Self.buildSuffix(filter, 'e'));
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@ module.exports = Self => {
|
||||||
st.created,
|
st.created,
|
||||||
st.workerFk,
|
st.workerFk,
|
||||||
u.nickname userNickname,
|
u.nickname userNickname,
|
||||||
|
u.id userId,
|
||||||
ste.name AS state
|
ste.name AS state
|
||||||
FROM saleTracking st
|
FROM saleTracking st
|
||||||
JOIN sale s ON s.id = st.saleFk
|
JOIN sale s ON s.id = st.saleFk
|
||||||
|
|
|
@ -183,7 +183,8 @@ module.exports = Self => {
|
||||||
ts.stateFk as stateFk,
|
ts.stateFk as stateFk,
|
||||||
ts.alertLevel as alertLevel,
|
ts.alertLevel as alertLevel,
|
||||||
ts.code as alertLevelCode,
|
ts.code as alertLevelCode,
|
||||||
u.nickname userNickname
|
u.nickname userNickname,
|
||||||
|
u.id userId
|
||||||
FROM ticket t
|
FROM ticket t
|
||||||
LEFT JOIN address a ON a.id = t.addressFk
|
LEFT JOIN address a ON a.id = t.addressFk
|
||||||
LEFT JOIN province p ON p.id = a.provinceFk
|
LEFT JOIN province p ON p.id = a.provinceFk
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
<vn-td number>
|
<vn-td number>
|
||||||
<span
|
<span
|
||||||
ng-class="{link: expedition.itemFk}"
|
ng-class="{link: expedition.itemFk}"
|
||||||
ng-click="$ctrl.showDescriptor($event, expedition.itemFk)">
|
ng-click="$ctrl.showItemDescriptor($event, expedition.itemFk)">
|
||||||
{{expedition.itemFk | zeroFill:6}}
|
{{expedition.itemFk | zeroFill:6}}
|
||||||
</span>
|
</span>
|
||||||
</vn-td>
|
</vn-td>
|
||||||
|
@ -41,7 +41,14 @@
|
||||||
<vn-td>{{::expedition.nameBox}}</vn-td>
|
<vn-td>{{::expedition.nameBox}}</vn-td>
|
||||||
<vn-td number>{{::expedition.counter}}</vn-td>
|
<vn-td number>{{::expedition.counter}}</vn-td>
|
||||||
<vn-td number>{{::expedition.checked}}</vn-td>
|
<vn-td number>{{::expedition.checked}}</vn-td>
|
||||||
<vn-td>{{::expedition.firstName}} {{::expedition.nameWorker}}</vn-td>
|
<vn-td>{{::expedition.userNickname}}</vn-td>
|
||||||
|
<vn-td expand>
|
||||||
|
<span
|
||||||
|
class="link"
|
||||||
|
ng-click="$ctrl.showWorkerDescriptor($event, expedition.userId)">
|
||||||
|
{{::expedition.userNickname | dashIfEmpty}}
|
||||||
|
</span>
|
||||||
|
</vn-td>
|
||||||
<vn-td>{{::expedition.created | date:'dd/MM/yyyy HH:mm'}}</vn-td>
|
<vn-td>{{::expedition.created | date:'dd/MM/yyyy HH:mm'}}</vn-td>
|
||||||
</vn-tr>
|
</vn-tr>
|
||||||
</vn-tbody>
|
</vn-tbody>
|
||||||
|
@ -51,9 +58,14 @@
|
||||||
</vn-card>
|
</vn-card>
|
||||||
|
|
||||||
</vn-vertical>
|
</vn-vertical>
|
||||||
<vn-item-descriptor-popover vn-id="descriptor"
|
<vn-item-descriptor-popover
|
||||||
|
vn-id="itemDescriptor"
|
||||||
quicklinks="$ctrl.quicklinks">
|
quicklinks="$ctrl.quicklinks">
|
||||||
</vn-item-descriptor-popover>
|
</vn-item-descriptor-popover>
|
||||||
|
<vn-worker-descriptor-popover
|
||||||
|
vn-id="workerDescriptor"
|
||||||
|
worker-fk="$ctrl.selectedWorker">
|
||||||
|
</vn-worker-descriptor-popover>
|
||||||
<vn-confirm
|
<vn-confirm
|
||||||
vn-id="delete-expedition"
|
vn-id="delete-expedition"
|
||||||
on-response="$ctrl.returnDialog(response)"
|
on-response="$ctrl.returnDialog(response)"
|
||||||
|
|
|
@ -2,25 +2,25 @@ import ngModule from '../module';
|
||||||
|
|
||||||
class Controller {
|
class Controller {
|
||||||
constructor($scope, $stateParams, $http) {
|
constructor($scope, $stateParams, $http) {
|
||||||
this.$scope = $scope;
|
this.$ = $scope;
|
||||||
this.$stateParams = $stateParams;
|
this.$stateParams = $stateParams;
|
||||||
this.$http = $http;
|
this.$http = $http;
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteExpedition(expedition) {
|
deleteExpedition(expedition) {
|
||||||
this.expeditionId = expedition.id;
|
this.expeditionId = expedition.id;
|
||||||
this.$scope.deleteExpedition.show();
|
this.$.deleteExpedition.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
returnDialog(response) {
|
returnDialog(response) {
|
||||||
if (response === 'ACCEPT') {
|
if (response === 'ACCEPT') {
|
||||||
this.$http.delete(`/ticket/api/Expeditions/${this.expeditionId}`).then(
|
this.$http.delete(`/ticket/api/Expeditions/${this.expeditionId}`).then(
|
||||||
() => this.$scope.model.refresh()
|
() => this.$.model.refresh()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
showDescriptor(event, itemFk) {
|
showItemDescriptor(event, itemFk) {
|
||||||
if (!itemFk) return;
|
if (!itemFk) return;
|
||||||
this.quicklinks = {
|
this.quicklinks = {
|
||||||
btnThree: {
|
btnThree: {
|
||||||
|
@ -33,13 +33,21 @@ class Controller {
|
||||||
tooltip: 'Item diary',
|
tooltip: 'Item diary',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
this.$scope.descriptor.itemFk = itemFk;
|
this.$.itemDescriptor.itemFk = itemFk;
|
||||||
this.$scope.descriptor.parent = event.target;
|
this.$.itemDescriptor.parent = event.target;
|
||||||
this.$scope.descriptor.show();
|
this.$.itemDescriptor.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
showWorkerDescriptor(event, userId) {
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopImmediatePropagation();
|
||||||
|
this.selectedWorker = userId;
|
||||||
|
this.$.workerDescriptor.parent = event.target;
|
||||||
|
this.$.workerDescriptor.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
onDescriptorLoad() {
|
onDescriptorLoad() {
|
||||||
this.$scope.popover.relocate();
|
this.$.popover.relocate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,13 @@
|
||||||
</vn-icon>
|
</vn-icon>
|
||||||
</vn-td>
|
</vn-td>
|
||||||
<vn-td number>{{::ticket.id}}</vn-td>
|
<vn-td number>{{::ticket.id}}</vn-td>
|
||||||
<vn-td>{{::ticket.userNickname | dashIfEmpty}}</vn-td>
|
<vn-td expand>
|
||||||
|
<span
|
||||||
|
class="link"
|
||||||
|
ng-click="$ctrl.showWorkerDescriptor($event, ticket.userId)">
|
||||||
|
{{::ticket.userNickname | dashIfEmpty}}
|
||||||
|
</span>
|
||||||
|
</vn-td>
|
||||||
<vn-td>
|
<vn-td>
|
||||||
<span class="chip {{$ctrl.compareDate(ticket.shipped)}}">
|
<span class="chip {{$ctrl.compareDate(ticket.shipped)}}">
|
||||||
{{::ticket.shipped | dateTime: 'dd/MM/yyyy'}}
|
{{::ticket.shipped | dateTime: 'dd/MM/yyyy'}}
|
||||||
|
@ -69,7 +75,7 @@
|
||||||
<vn-td expand>
|
<vn-td expand>
|
||||||
<span
|
<span
|
||||||
class="link"
|
class="link"
|
||||||
ng-click="$ctrl.showDescriptor($event, ticket.clientFk)">
|
ng-click="$ctrl.showClientDescriptor($event, ticket.clientFk)">
|
||||||
{{::ticket.nickname}}
|
{{::ticket.nickname}}
|
||||||
</span>
|
</span>
|
||||||
</vn-td>
|
</vn-td>
|
||||||
|
@ -110,5 +116,9 @@
|
||||||
<vn-ticket-summary ticket="$ctrl.selectedTicket"></vn-ticket-summary>
|
<vn-ticket-summary ticket="$ctrl.selectedTicket"></vn-ticket-summary>
|
||||||
</tpl-body>
|
</tpl-body>
|
||||||
</vn-dialog>
|
</vn-dialog>
|
||||||
<vn-client-descriptor-popover vn-id="descriptor">
|
<vn-client-descriptor-popover vn-id="clientDescriptor">
|
||||||
</vn-client-descriptor-popover>
|
</vn-client-descriptor-popover>
|
||||||
|
<vn-worker-descriptor-popover
|
||||||
|
vn-id="workerDescriptor"
|
||||||
|
worker-fk="$ctrl.selectedWorker">
|
||||||
|
</vn-worker-descriptor-popover>
|
|
@ -88,12 +88,20 @@ export default class Controller {
|
||||||
return 'alert';
|
return 'alert';
|
||||||
}
|
}
|
||||||
|
|
||||||
showDescriptor(event, clientFk) {
|
showClientDescriptor(event, clientFk) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopImmediatePropagation();
|
event.stopImmediatePropagation();
|
||||||
this.$.descriptor.clientFk = clientFk;
|
this.$.clientDescriptor.clientFk = clientFk;
|
||||||
this.$.descriptor.parent = event.target;
|
this.$.clientDescriptor.parent = event.target;
|
||||||
this.$.descriptor.show();
|
this.$.clientDescriptor.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
showWorkerDescriptor(event, userId) {
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopImmediatePropagation();
|
||||||
|
this.selectedWorker = userId;
|
||||||
|
this.$.workerDescriptor.parent = event.target;
|
||||||
|
this.$.workerDescriptor.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
preview(event, ticket) {
|
preview(event, ticket) {
|
||||||
|
|
|
@ -14,12 +14,13 @@ describe('Component vnTicketIndex', () => {
|
||||||
}];
|
}];
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
ngModule('worker');
|
||||||
ngModule('client');
|
ngModule('client');
|
||||||
ngModule('item');
|
ngModule('item');
|
||||||
ngModule('ticket');
|
ngModule('ticket');
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(inject(($compile, $rootScope, $httpBackend, _$window_) => {
|
beforeEach(inject(($compile, $rootScope, _$window_) => {
|
||||||
$window = _$window_;
|
$window = _$window_;
|
||||||
$element = $compile('<vn-ticket-index></vn-ticket-index>')($rootScope);
|
$element = $compile('<vn-ticket-index></vn-ticket-index>')($rootScope);
|
||||||
controller = $element.controller('vnTicketIndex');
|
controller = $element.controller('vnTicketIndex');
|
||||||
|
@ -54,18 +55,18 @@ describe('Component vnTicketIndex', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('showDescriptor()', () => {
|
describe('showClientDescriptor()', () => {
|
||||||
it('should show the descriptor popover', () => {
|
it('should show the client descriptor popover', () => {
|
||||||
spyOn(controller.$.descriptor, 'show');
|
spyOn(controller.$.clientDescriptor, 'show');
|
||||||
|
|
||||||
let event = new MouseEvent('click', {
|
let event = new MouseEvent('click', {
|
||||||
view: $window,
|
view: $window,
|
||||||
bubbles: true,
|
bubbles: true,
|
||||||
cancelable: true
|
cancelable: true
|
||||||
});
|
});
|
||||||
controller.showDescriptor(event, tickets[0].clientFk);
|
controller.showClientDescriptor(event, tickets[0].clientFk);
|
||||||
|
|
||||||
expect(controller.$.descriptor.show).toHaveBeenCalledWith();
|
expect(controller.$.clientDescriptor.show).toHaveBeenCalledWith();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -35,14 +35,26 @@
|
||||||
<vn-td number>{{::request.id}}</vn-td>
|
<vn-td number>{{::request.id}}</vn-td>
|
||||||
<vn-td expand>{{::request.description}}</vn-td>
|
<vn-td expand>{{::request.description}}</vn-td>
|
||||||
<vn-td number>{{::request.created | dateTime: 'dd/MM/yyyy'}}</vn-td>
|
<vn-td number>{{::request.created | dateTime: 'dd/MM/yyyy'}}</vn-td>
|
||||||
<vn-td>{{::request.requester.user.nickname}}</vn-td>
|
<vn-td expand>
|
||||||
<vn-td>{{::request.atender.user.nickname}}</vn-td>
|
<span
|
||||||
|
class="link"
|
||||||
|
ng-click="$ctrl.showWorkerDescriptor($event, request.requester.user.id)">
|
||||||
|
{{::request.requester.user.nickname | dashIfEmpty}}
|
||||||
|
</span>
|
||||||
|
</vn-td>
|
||||||
|
<vn-td expand>
|
||||||
|
<span
|
||||||
|
class="link"
|
||||||
|
ng-click="$ctrl.showWorkerDescriptor($event, request.atender.user.id)">
|
||||||
|
{{::request.atender.user.nickname | dashIfEmpty}}
|
||||||
|
</span>
|
||||||
|
</vn-td>
|
||||||
<vn-td number>{{::request.quantity}}</vn-td>
|
<vn-td number>{{::request.quantity}}</vn-td>
|
||||||
<vn-td number>{{::request.price | currency: 'EUR': 2}}</vn-td>
|
<vn-td number>{{::request.price | currency: 'EUR': 2}}</vn-td>
|
||||||
<vn-td number>
|
<vn-td number>
|
||||||
<span
|
<span
|
||||||
ng-show="::request.saleFk"
|
ng-show="::request.saleFk"
|
||||||
ng-click="$ctrl.showDescriptor($event, request.sale)"
|
ng-click="$ctrl.showItemDescriptor($event, request.sale)"
|
||||||
class="link">
|
class="link">
|
||||||
{{request.saleFk | zeroFill:6}}
|
{{request.saleFk | zeroFill:6}}
|
||||||
</span>
|
</span>
|
||||||
|
@ -69,9 +81,13 @@
|
||||||
</vn-card>
|
</vn-card>
|
||||||
</form>
|
</form>
|
||||||
<vn-item-descriptor-popover
|
<vn-item-descriptor-popover
|
||||||
vn-id="descriptor"
|
vn-id="itemDescriptor"
|
||||||
quicklinks="$ctrl.quicklinks">
|
quicklinks="$ctrl.quicklinks">
|
||||||
</vn-item-descriptor-popover>
|
</vn-item-descriptor-popover>
|
||||||
|
<vn-worker-descriptor-popover
|
||||||
|
vn-id="workerDescriptor"
|
||||||
|
worker-fk="$ctrl.selectedWorker">
|
||||||
|
</vn-worker-descriptor-popover>
|
||||||
<a ui-sref="ticket.card.request.create"
|
<a ui-sref="ticket.card.request.create"
|
||||||
vn-tooltip="New request"
|
vn-tooltip="New request"
|
||||||
vn-bind="+"
|
vn-bind="+"
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import ngModule from '../../module';
|
import ngModule from '../../module';
|
||||||
|
|
||||||
class Controller {
|
class Controller {
|
||||||
constructor($stateParams, $scope) {
|
constructor($scope, $stateParams) {
|
||||||
this.$stateParams = $stateParams;
|
this.$stateParams = $stateParams;
|
||||||
this.$scope = $scope;
|
this.$ = $scope;
|
||||||
this.filter = {
|
this.filter = {
|
||||||
include: [
|
include: [
|
||||||
{
|
{
|
||||||
|
@ -36,15 +36,15 @@ class Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
removeLine(index) {
|
removeLine(index) {
|
||||||
this.$scope.model.remove(index);
|
this.$.model.remove(index);
|
||||||
this.$scope.watcher.check();
|
this.$.watcher.check();
|
||||||
this.$scope.model.save().then(() => {
|
this.$.model.save().then(() => {
|
||||||
this.$scope.watcher.notifySaved();
|
this.$.watcher.notifySaved();
|
||||||
this.$scope.watcher.updateOriginalData();
|
this.$.watcher.updateOriginalData();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// Item Descriptor
|
|
||||||
showDescriptor(event, sale) {
|
showItemDescriptor(event, sale) {
|
||||||
this.quicklinks = {
|
this.quicklinks = {
|
||||||
btnThree: {
|
btnThree: {
|
||||||
icon: 'icon-transaction',
|
icon: 'icon-transaction',
|
||||||
|
@ -55,13 +55,21 @@ class Controller {
|
||||||
tooltip: 'Item diary'
|
tooltip: 'Item diary'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
this.$scope.descriptor.itemFk = sale.itemFk;
|
this.$.itemDescriptor.itemFk = sale.itemFk;
|
||||||
this.$scope.descriptor.parent = event.target;
|
this.$.itemDescriptor.parent = event.target;
|
||||||
this.$scope.descriptor.show();
|
this.$.itemDescriptor.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
showWorkerDescriptor(event, userId) {
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopImmediatePropagation();
|
||||||
|
this.selectedWorker = userId;
|
||||||
|
this.$.workerDescriptor.parent = event.target;
|
||||||
|
this.$.workerDescriptor.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Controller.$inject = ['$stateParams', '$scope'];
|
Controller.$inject = ['$scope', '$stateParams'];
|
||||||
|
|
||||||
ngModule.component('vnTicketRequestIndex', {
|
ngModule.component('vnTicketRequestIndex', {
|
||||||
template: require('./index.html'),
|
template: require('./index.html'),
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
"name": "Tickets",
|
"name": "Tickets",
|
||||||
"icon": "icon-ticket",
|
"icon": "icon-ticket",
|
||||||
"validations": true,
|
"validations": true,
|
||||||
"dependencies": ["item", "client"],
|
"dependencies": ["worker", "item", "client"],
|
||||||
"menu": [
|
"menu": [
|
||||||
{"state": "ticket.card.data.stepOne", "icon": "settings"},
|
{"state": "ticket.card.data.stepOne", "icon": "settings"},
|
||||||
{"state": "ticket.card.sale", "icon": "icon-lines"},
|
{"state": "ticket.card.sale", "icon": "icon-lines"},
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
</vn-td>
|
</vn-td>
|
||||||
<vn-td number>
|
<vn-td number>
|
||||||
<span
|
<span
|
||||||
ng-click="$ctrl.showDescriptor($event, sale.itemFk)"
|
ng-click="$ctrl.showItemDescriptor($event, sale.itemFk)"
|
||||||
class="link">
|
class="link">
|
||||||
{{sale.itemFk | zeroFill:6}}
|
{{sale.itemFk | zeroFill:6}}
|
||||||
</span>
|
</span>
|
||||||
|
@ -40,9 +40,12 @@
|
||||||
<vn-td><vn-fetched-tags max-length="6" item="sale.item"/></vn-td>
|
<vn-td><vn-fetched-tags max-length="6" item="sale.item"/></vn-td>
|
||||||
<vn-td>{{::sale.quantity}}</vn-td>
|
<vn-td>{{::sale.quantity}}</vn-td>
|
||||||
<vn-td>{{::sale.originalQuantity}}</vn-td>
|
<vn-td>{{::sale.originalQuantity}}</vn-td>
|
||||||
<vn-td title="{{::sale.firstName}} {{::sale.name}}"
|
<vn-td expand>
|
||||||
class="ellipsize" style="max-width: 5em">
|
<span
|
||||||
{{::sale.userNickname}}
|
class="link"
|
||||||
|
ng-click="$ctrl.showWorkerDescriptor($event, sale.userId)">
|
||||||
|
{{::sale.userNickname | dashIfEmpty}}
|
||||||
|
</span>
|
||||||
</vn-td>
|
</vn-td>
|
||||||
<vn-td>{{::sale.state}}</vn-td>
|
<vn-td>{{::sale.state}}</vn-td>
|
||||||
<vn-td>{{::sale.created | date: 'dd/MM/yyyy HH:mm'}}</vn-td>
|
<vn-td>{{::sale.created | date: 'dd/MM/yyyy HH:mm'}}</vn-td>
|
||||||
|
@ -53,6 +56,10 @@
|
||||||
<vn-pagination model="model"></vn-pagination>
|
<vn-pagination model="model"></vn-pagination>
|
||||||
</vn-card>
|
</vn-card>
|
||||||
</vn-vertical>
|
</vn-vertical>
|
||||||
<vn-item-descriptor-popover vn-id="descriptor"
|
<vn-item-descriptor-popover vn-id="itemDescriptor"
|
||||||
quicklinks="$ctrl.quicklinks">
|
quicklinks="$ctrl.quicklinks">
|
||||||
</vn-item-descriptor-popover>
|
</vn-item-descriptor-popover>
|
||||||
|
<vn-worker-descriptor-popover
|
||||||
|
vn-id="workerDescriptor"
|
||||||
|
worker-fk="$ctrl.selectedWorker">
|
||||||
|
</vn-worker-descriptor-popover>
|
|
@ -2,11 +2,11 @@ import ngModule from '../module';
|
||||||
|
|
||||||
class Controller {
|
class Controller {
|
||||||
constructor($scope, $stateParams) {
|
constructor($scope, $stateParams) {
|
||||||
this.$scope = $scope;
|
this.$ = $scope;
|
||||||
this.$stateParams = $stateParams;
|
this.$stateParams = $stateParams;
|
||||||
}
|
}
|
||||||
|
|
||||||
showDescriptor(event, itemFk) {
|
showItemDescriptor(event, itemFk) {
|
||||||
this.quicklinks = {
|
this.quicklinks = {
|
||||||
btnThree: {
|
btnThree: {
|
||||||
icon: 'icon-transaction',
|
icon: 'icon-transaction',
|
||||||
|
@ -18,13 +18,21 @@ class Controller {
|
||||||
tooltip: 'Item diary',
|
tooltip: 'Item diary',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
this.$scope.descriptor.itemFk = itemFk;
|
this.$.itemDescriptor.itemFk = itemFk;
|
||||||
this.$scope.descriptor.parent = event.target;
|
this.$.itemDescriptor.parent = event.target;
|
||||||
this.$scope.descriptor.show();
|
this.$.itemDescriptor.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
showWorkerDescriptor(event, userId) {
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopImmediatePropagation();
|
||||||
|
this.selectedWorker = userId;
|
||||||
|
this.$.workerDescriptor.parent = event.target;
|
||||||
|
this.$.workerDescriptor.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
onDescriptorLoad() {
|
onDescriptorLoad() {
|
||||||
this.$scope.popover.relocate();
|
this.$.popover.relocate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
limit="20"
|
limit="20"
|
||||||
data="trackings">
|
data="trackings">
|
||||||
</vn-crud-model>
|
</vn-crud-model>
|
||||||
|
|
||||||
<vn-vertical compact>
|
<vn-vertical compact>
|
||||||
<vn-card pad-large>
|
<vn-card pad-large>
|
||||||
<vn-vertical>
|
<vn-vertical>
|
||||||
|
@ -22,7 +21,13 @@
|
||||||
<vn-tbody>
|
<vn-tbody>
|
||||||
<vn-tr ng-repeat="tracking in trackings">
|
<vn-tr ng-repeat="tracking in trackings">
|
||||||
<vn-td>{{::tracking.state.name}}</vn-td>
|
<vn-td>{{::tracking.state.name}}</vn-td>
|
||||||
<vn-td>{{::tracking.worker.firstName}} {{ticket.worker.name}}</vn-td>
|
<vn-td expand>
|
||||||
|
<span
|
||||||
|
class="link"
|
||||||
|
ng-click="$ctrl.showWorkerDescriptor($event, tracking.worker.user.id)">
|
||||||
|
{{::tracking.worker.user.nickname | dashIfEmpty}}
|
||||||
|
</span>
|
||||||
|
</vn-td>
|
||||||
<vn-td>{{::tracking.created | date:'dd/MM/yyyy HH:mm'}}</vn-td>
|
<vn-td>{{::tracking.created | date:'dd/MM/yyyy HH:mm'}}</vn-td>
|
||||||
</vn-tr>
|
</vn-tr>
|
||||||
</vn-tbody>
|
</vn-tbody>
|
||||||
|
@ -34,3 +39,7 @@
|
||||||
<a ui-sref="ticket.card.tracking.edit" vn-bind="+" fixed-bottom-right>
|
<a ui-sref="ticket.card.tracking.edit" vn-bind="+" fixed-bottom-right>
|
||||||
<vn-float-button icon="add"></vn-float-button>
|
<vn-float-button icon="add"></vn-float-button>
|
||||||
</a>
|
</a>
|
||||||
|
<vn-worker-descriptor-popover
|
||||||
|
vn-id="workerDescriptor"
|
||||||
|
worker-fk="$ctrl.selectedWorker">
|
||||||
|
</vn-worker-descriptor-popover>
|
|
@ -1,14 +1,21 @@
|
||||||
import ngModule from '../../module';
|
import ngModule from '../../module';
|
||||||
|
|
||||||
class Controller {
|
class Controller {
|
||||||
constructor($stateParams) {
|
constructor($scope, $stateParams) {
|
||||||
|
this.$ = $scope;
|
||||||
this.$stateParams = $stateParams;
|
this.$stateParams = $stateParams;
|
||||||
this.filter = {
|
this.filter = {
|
||||||
include: [
|
include: [
|
||||||
{
|
{
|
||||||
relation: 'worker',
|
relation: 'worker',
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['firstName', 'name']
|
fields: ['userFk'],
|
||||||
|
include: {
|
||||||
|
relation: 'user',
|
||||||
|
scope: {
|
||||||
|
fields: ['nickname']
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -20,9 +27,17 @@ class Controller {
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
showWorkerDescriptor(event, userId) {
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopImmediatePropagation();
|
||||||
|
this.selectedWorker = userId;
|
||||||
|
this.$.workerDescriptor.parent = event.target;
|
||||||
|
this.$.workerDescriptor.show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Controller.$inject = ['$stateParams'];
|
Controller.$inject = ['$scope', '$stateParams'];
|
||||||
|
|
||||||
ngModule.component('vnTicketTrackingIndex', {
|
ngModule.component('vnTicketTrackingIndex', {
|
||||||
template: require('./index.html'),
|
template: require('./index.html'),
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
<vn-popover vn-id="popover">
|
||||||
|
<vn-spinner
|
||||||
|
ng-if="$ctrl.worker == null"
|
||||||
|
style="padding: 1em;"
|
||||||
|
enable="true">
|
||||||
|
</vn-spinner>
|
||||||
|
<vn-worker-descriptor
|
||||||
|
ng-if="$ctrl.worker"
|
||||||
|
worker="$ctrl.worker"
|
||||||
|
quicklinks="$ctrl.quicklinks">
|
||||||
|
</vn-worker-descriptor>
|
||||||
|
</vn-popover>
|
|
@ -0,0 +1,73 @@
|
||||||
|
import ngModule from '../module';
|
||||||
|
import Component from 'core/lib/component';
|
||||||
|
import './style.scss';
|
||||||
|
|
||||||
|
class Controller extends Component {
|
||||||
|
constructor($element, $scope, $http, $timeout, $q) {
|
||||||
|
super($element, $scope);
|
||||||
|
this.$timeout = $timeout;
|
||||||
|
this.$http = $http;
|
||||||
|
this.$q = $q;
|
||||||
|
this.worker = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
set workerFk(id) {
|
||||||
|
if (id == this._workerFk) return;
|
||||||
|
|
||||||
|
this._workerFk = id;
|
||||||
|
this.worker = null;
|
||||||
|
this.loadData();
|
||||||
|
}
|
||||||
|
|
||||||
|
get workerFk() {
|
||||||
|
return this._workerFk;
|
||||||
|
}
|
||||||
|
|
||||||
|
set quicklinks(value = {}) {
|
||||||
|
this._quicklinks = Object.assign(value, this._quicklinks);
|
||||||
|
}
|
||||||
|
|
||||||
|
get quicklinks() {
|
||||||
|
return this._quicklinks;
|
||||||
|
}
|
||||||
|
|
||||||
|
show() {
|
||||||
|
this.$.popover.parent = this.parent;
|
||||||
|
this.$.popover.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
loadData() {
|
||||||
|
let query = `api/Workers/${this._workerFk}`;
|
||||||
|
let filter = {
|
||||||
|
include: [
|
||||||
|
{
|
||||||
|
relation: 'user',
|
||||||
|
scope: {fields: ['name', 'email']}
|
||||||
|
}, {
|
||||||
|
relation: 'client',
|
||||||
|
scope: {fields: ['fi']}
|
||||||
|
}, {
|
||||||
|
relation: 'sip',
|
||||||
|
scope: {fields: ['extension']}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$http.get(query, {params: {filter}}).then(res => {
|
||||||
|
this.worker = res.data;
|
||||||
|
this.$.$applyAsync(() => {
|
||||||
|
this.$.popover.relocate();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Controller.$inject = ['$element', '$scope', '$http', '$timeout', '$q'];
|
||||||
|
|
||||||
|
ngModule.component('vnWorkerDescriptorPopover', {
|
||||||
|
template: require('./index.html'),
|
||||||
|
controller: Controller,
|
||||||
|
bindings: {
|
||||||
|
workerFk: '<',
|
||||||
|
quicklinks: '<'
|
||||||
|
}
|
||||||
|
});
|
|
@ -0,0 +1,87 @@
|
||||||
|
import './index.js';
|
||||||
|
|
||||||
|
describe('worker Component vnWorkerDescriptorPopover', () => {
|
||||||
|
let $httpBackend;
|
||||||
|
let $httpParamSerializer;
|
||||||
|
let $scope;
|
||||||
|
let controller;
|
||||||
|
let $element;
|
||||||
|
|
||||||
|
beforeEach(ngModule('worker'));
|
||||||
|
|
||||||
|
beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_, _$httpParamSerializer_) => {
|
||||||
|
$httpBackend = _$httpBackend_;
|
||||||
|
$httpParamSerializer = _$httpParamSerializer_;
|
||||||
|
$element = angular.element(`<div></div>`);
|
||||||
|
$scope = $rootScope.$new();
|
||||||
|
$scope.popover = {relocate: () => {}, show: () => {}};
|
||||||
|
controller = $componentController('vnWorkerDescriptorPopover', {$scope, $element});
|
||||||
|
}));
|
||||||
|
|
||||||
|
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;
|
||||||
|
spyOn(controller, 'loadData');
|
||||||
|
controller.workerFk = 1;
|
||||||
|
|
||||||
|
expect(controller.worker).toEqual('I exist!');
|
||||||
|
expect(controller._workerFk).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;
|
||||||
|
spyOn(controller, 'loadData');
|
||||||
|
controller.workerFk = 999;
|
||||||
|
|
||||||
|
expect(controller.worker).toBeNull();
|
||||||
|
expect(controller._workerFk).toEqual(999);
|
||||||
|
expect(controller.loadData).toHaveBeenCalledWith();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('show()', () => {
|
||||||
|
it(`should call the show()`, () => {
|
||||||
|
spyOn(controller.$.popover, 'show');
|
||||||
|
controller.show();
|
||||||
|
|
||||||
|
expect(controller.$.popover.show).toHaveBeenCalledWith();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('loadData()', () => {
|
||||||
|
it(`should perform a get query to store the worker data into the controller`, () => {
|
||||||
|
controller.workerFk = 1;
|
||||||
|
controller.canceler = null;
|
||||||
|
let response = {};
|
||||||
|
|
||||||
|
let config = {
|
||||||
|
filter: {
|
||||||
|
include: [
|
||||||
|
{
|
||||||
|
relation: 'user',
|
||||||
|
scope: {fields: ['name', 'email']}
|
||||||
|
}, {
|
||||||
|
relation: 'client',
|
||||||
|
scope: {fields: ['fi']}
|
||||||
|
}, {
|
||||||
|
relation: 'sip',
|
||||||
|
scope: {fields: ['extension']}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
let json = $httpParamSerializer(config);
|
||||||
|
|
||||||
|
$httpBackend.whenGET(`api/Workers/${controller._workerFk}?${json}`).respond(response);
|
||||||
|
$httpBackend.expectGET(`api/Workers/${controller._workerFk}?${json}`);
|
||||||
|
controller.loadData();
|
||||||
|
$httpBackend.flush();
|
||||||
|
|
||||||
|
expect(controller.worker).toEqual(response);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,11 @@
|
||||||
|
vn-ticket-descriptor-popover {
|
||||||
|
vn-ticket-descriptor {
|
||||||
|
display: block;
|
||||||
|
width: 16em;
|
||||||
|
max-height: 28em;
|
||||||
|
|
||||||
|
& > vn-card {
|
||||||
|
margin: 0!important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,5 +4,6 @@ import './index/';
|
||||||
import './summary';
|
import './summary';
|
||||||
import './card';
|
import './card';
|
||||||
import './descriptor';
|
import './descriptor';
|
||||||
|
import './descriptor-popover';
|
||||||
import './search-panel';
|
import './search-panel';
|
||||||
import './basic-data';
|
import './basic-data';
|
||||||
|
|
|
@ -657,8 +657,8 @@ INSERT INTO `vn`.`saleComponent`(`saleFk`, `componentFk`, `value`)
|
||||||
|
|
||||||
INSERT INTO `vn`.`saleTracking`(`saleFk`, `isChecked`, `created`, `originalQuantity`, `workerFk`, `actionFk`, `id`, `stateFk`)
|
INSERT INTO `vn`.`saleTracking`(`saleFk`, `isChecked`, `created`, `originalQuantity`, `workerFk`, `actionFk`, `id`, `stateFk`)
|
||||||
VALUES
|
VALUES
|
||||||
( 1, 0, CURDATE(), 5, 40, 3, 1, 14),
|
( 1, 0, CURDATE(), 5, 55, 3, 1, 14),
|
||||||
( 1, 1, CURDATE(), 5, 40, 3, 2, 8),
|
( 1, 1, CURDATE(), 5, 54, 3, 2, 8),
|
||||||
( 2, 1, CURDATE(), 10, 40, 4, 3, 8),
|
( 2, 1, CURDATE(), 10, 40, 4, 3, 8),
|
||||||
( 3, 1, CURDATE(), 2, 40, 4, 4, 8);
|
( 3, 1, CURDATE(), 2, 40, 4, 4, 8);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue