This commit is contained in:
Carlos Jimenez Ruiz 2019-02-21 07:40:38 +01:00
commit 1ac820478e
28 changed files with 189 additions and 158 deletions

2
Jenkinsfile vendored
View File

@ -151,7 +151,7 @@ pipeline {
if (!env.COMMITTER_EMAIL) return if (!env.COMMITTER_EMAIL) return
try { try {
mail( mail(
to: env.GIT_COMMITTER_EMAIL, to: env.COMMITTER_EMAIL,
subject: "Pipeline: ${env.JOB_NAME} (${env.BUILD_NUMBER}): ${currentBuild.currentResult}", subject: "Pipeline: ${env.JOB_NAME} (${env.BUILD_NUMBER}): ${currentBuild.currentResult}",
body: "Check status at ${env.BUILD_URL}" body: "Check status at ${env.BUILD_URL}"
) )

View File

@ -273,7 +273,7 @@ export default {
sale: 'vn-ticket-summary [name="sales"] vn-table > div > vn-tbody > vn-tr', sale: 'vn-ticket-summary [name="sales"] vn-table > div > vn-tbody > vn-tr',
firstSaleItemId: 'vn-ticket-summary [name="sales"] vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(2) > span', firstSaleItemId: 'vn-ticket-summary [name="sales"] vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(2) > span',
popoverDiaryButton: 'vn-ticket-summary vn-item-descriptor-popover vn-item-descriptor vn-icon[icon="icon-transaction"]', popoverDiaryButton: 'vn-ticket-summary vn-item-descriptor-popover vn-item-descriptor vn-icon[icon="icon-transaction"]',
firstSaleQuantity: 'vn-ticket-summary [name="sales"] vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(4)', firstSaleQuantity: 'vn-ticket-summary [name="sales"] vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(3)',
firstSaleDiscount: 'vn-ticket-summary [name="sales"] vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(6)' firstSaleDiscount: 'vn-ticket-summary [name="sales"] vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(6)'
}, },
ticketsIndex: { ticketsIndex: {
@ -341,18 +341,18 @@ export default {
firstSaleQuantity: `vn-textfield[model="sale.quantity"]:nth-child(1) input`, firstSaleQuantity: `vn-textfield[model="sale.quantity"]:nth-child(1) input`,
firstSaleQuantityClearInput: `vn-textfield[model="sale.quantity"] div.suffix > i`, firstSaleQuantityClearInput: `vn-textfield[model="sale.quantity"] div.suffix > i`,
firstSaleID: 'vn-ticket-sale:nth-child(1) vn-td:nth-child(4) > span', firstSaleID: 'vn-ticket-sale:nth-child(1) vn-td:nth-child(4) > span',
firstSalePrice: 'vn-ticket-sale:nth-child(1) vn-td:nth-child(7)', firstSalePrice: 'vn-ticket-sale:nth-child(1) vn-tr:nth-child(1) > vn-td:nth-child(7) > span',
firstSalePriceInput: 'vn-ticket-sale:nth-child(1) > vn-vertical > vn-popover.edit.dialog-summary.ng-isolate-scope.vn-popover.shown > div > div.content > div > vn-textfield', firstSalePriceInput: 'vn-ticket-sale:nth-child(1) > vn-vertical > vn-popover.edit.dialog-summary.ng-isolate-scope.vn-popover.shown > div > div.content > div > vn-textfield',
firstSaleDiscount: 'vn-ticket-sale:nth-child(1) vn-td:nth-child(8)', firstSaleDiscount: 'vn-ticket-sale:nth-child(1) vn-td:nth-child(8) > span',
firstSaleDiscountInput: 'vn-ticket-sale:nth-child(1) vn-ticket-sale-edit-discount > div > vn-textfield > div > div > div.infix > input.ng-not-empty', firstSaleDiscountInput: 'vn-ticket-sale:nth-child(1) vn-ticket-sale-edit-discount > div > vn-textfield > div > div > div.infix > input.ng-not-empty',
firstSaleImport: 'vn-ticket-sale:nth-child(1) vn-td:nth-child(9)', firstSaleImport: 'vn-ticket-sale:nth-child(1) vn-td:nth-child(9)',
firstSaleReservedIcon: 'vn-ticket-sale vn-tr:nth-child(1) > vn-td:nth-child(2) > vn-icon:nth-child(3)', firstSaleReservedIcon: 'vn-ticket-sale vn-tr:nth-child(1) > vn-td:nth-child(2) > vn-icon:nth-child(3)',
firstSaleColour: `vn-ticket-sale vn-tr:nth-child(1) vn-td:nth-child(5) section:nth-child(1)`, firstSaleColour: `vn-ticket-sale vn-tr:nth-child(1) vn-td:nth-child(6) section:nth-child(1)`,
firstSaleLength: `vn-ticket-sale vn-tr:nth-child(1) vn-td:nth-child(5) section:nth-child(3)`, firstSaleLength: `vn-ticket-sale vn-tr:nth-child(1) vn-td:nth-child(6) section:nth-child(3)`,
firstSaleCheckbox: `vn-ticket-sale vn-tr:nth-child(1) vn-check[field="sale.checked"] md-checkbox`, firstSaleCheckbox: `vn-ticket-sale vn-tr:nth-child(1) vn-check[field="sale.checked"] md-checkbox`,
secondSaleClaimIcon: 'vn-ticket-sale > vn-vertical > vn-card > div > vn-vertical > vn-table > div > vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(2) > a > vn-icon', secondSaleClaimIcon: 'vn-ticket-sale > vn-vertical > vn-card > div > vn-vertical > vn-table > div > vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(2) > a > vn-icon',
secondSaleColour: `vn-ticket-sale vn-tr:nth-child(2) vn-td:nth-child(5) section:nth-child(5)`, secondSaleColour: `vn-ticket-sale vn-tr:nth-child(2) vn-td:nth-child(6) section:nth-child(5)`,
secondSalePrice: `vn-ticket-sale vn-tr:nth-child(2) vn-td:nth-child(7)`, secondSalePrice: `vn-ticket-sale vn-tr:nth-child(2) vn-td:nth-child(7) > span`,
secondSaleDiscount: `vn-ticket-sale vn-tr:nth-child(2) vn-td:nth-child(8)`, secondSaleDiscount: `vn-ticket-sale vn-tr:nth-child(2) vn-td:nth-child(8)`,
secondSaleImport: `vn-ticket-sale vn-tr:nth-child(2) vn-td:nth-child(9)`, secondSaleImport: `vn-ticket-sale vn-tr:nth-child(2) vn-td:nth-child(9)`,
secondSaleText: `vn-table div > vn-tbody > vn-tr:nth-child(2)`, secondSaleText: `vn-table div > vn-tbody > vn-tr:nth-child(2)`,

View File

@ -538,16 +538,16 @@ xdescribe('Ticket Edit sale path', () => {
describe('when state is preparation and loged as Production', () => { describe('when state is preparation and loged as Production', () => {
it(`should not be able to edit the sale price`, async() => { it(`should not be able to edit the sale price`, async() => {
const result = await nightmare const result = await nightmare
.waitToClick(selectors.ticketSales.firstSalePrice) .wait(selectors.ticketSales.firstSaleID)
.exists(selectors.ticketSales.firstSalePriceInput); .exists(selectors.ticketSales.firstSalePrice);
expect(result).toBeFalsy(); expect(result).toBeFalsy();
}); });
it(`should not be able to edit the sale discount`, async() => { it(`should not be able to edit the sale discount`, async() => {
const result = await nightmare const result = await nightmare
.waitToClick(selectors.ticketSales.firstSaleDiscount) .waitToClick(selectors.ticketSales.firstSaleID)
.exists(selectors.ticketSales.firstSaleDiscountInput); .exists(selectors.ticketSales.firstSaleDiscount);
expect(result).toBeFalsy(); expect(result).toBeFalsy();
}); });

View File

@ -1,5 +1,5 @@
vn-button { vn-button {
& i[class="material-icons"] { & > button > vn-icon {
margin-top: 6px; vertical-align: middle;
} }
} }

View File

@ -1,38 +0,0 @@
@import "variables";
vn-fetched-tags {
&.noTitle vn-one {
display: none !important;
}
& > vn-horizontal {
align-items: center;
@media screen and (max-width: 1600px) {
flex-direction: column;
text-align: center;
& > vn-one {
padding-bottom: .2em;
}
}
& > vn-one {
min-width: 12em;
}
& > vn-auto > .inline-tag {
display: inline-block;
color: $color-font-secondary;
margin-right: .4em;
text-align: center;
font-size: .8em;
height: 1.25em;
padding: .1em;
border-radius: .1em;
width: 4em;
border: 1px solid $color-font-secondary;
&.empty {
border: 1px solid $color-bg;
}
}
}
}

View File

@ -40,7 +40,6 @@ import './input-range';
import './chip'; import './chip';
import './input-number'; import './input-number';
import './input-time'; import './input-time';
import './fetched-tags';
import './log'; import './log';
import './treeview'; import './treeview';
import './treeview/child'; import './treeview/child';

View File

@ -72,10 +72,11 @@ vn-table {
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
max-width: 6em; max-width: 5em;
&[number] { &[number] {
text-align: right; text-align: right;
width: 6em;
} }
&[center] { &[center] {
text-align: center; text-align: center;
@ -85,7 +86,7 @@ vn-table {
text-align: center; text-align: center;
} }
&[expand] { &[expand] {
max-width: 40em; max-width: 10em;
min-width: 0; min-width: 0;
} }
vn-icon.bright, i.bright { vn-icon.bright, i.bright {

View File

@ -1,3 +1,4 @@
import './md-override.scss';
import './mdl-override.scss'; import './mdl-override.scss';
import './mdi-override.css'; import './mdi-override.css';
import './zoom-image.scss'; import './zoom-image.scss';

View File

@ -0,0 +1,11 @@
html {
background-color: initial;
}
// Disable ng-repeat effects
.ng-enter,
.ng-leave {
transition: none !important;
}

View File

@ -20,7 +20,7 @@ body {
.mdl-textfield--floating-label.has-placeholder .mdl-textfield__label { .mdl-textfield--floating-label.has-placeholder .mdl-textfield__label {
color: $color-main !important; color: $color-main !important;
} }
.mdl-checkbox.is-checked .mdl-checkbox__box-outline, { .mdl-checkbox.is-checked .mdl-checkbox__box-outline {
border: 2px solid $color-main; border: 2px solid $color-main;
} }
fieldset[disabled] .mdl-checkbox .mdl-checkbox__box-outline, .mdl-checkbox.is-disabled .mdl-checkbox__box-outline { fieldset[disabled] .mdl-checkbox .mdl-checkbox__box-outline, .mdl-checkbox.is-disabled .mdl-checkbox__box-outline {

View File

@ -23,9 +23,3 @@
background-color: $color-active; background-color: $color-active;
color: $color-active-font; color: $color-active-font;
} }
// Disable ng-repeat effects
.ng-enter, .ng-leave {
-webkit-transition: none !important;
transition: none !important
}

View File

@ -1,17 +1,4 @@
html, body {
height: 100%;
margin: 0px;
padding: 0px;
}
html [full-height], .full-height {
height: 100%;
}
html [self-scroll], .self-scroll {
overflow: auto;
}
/* Horizontal & vertical */ /* Horizontal & vertical */
html [vn-horizontal], vn-horizontal, .vn-horizontal, html [vn-horizontal], vn-horizontal, .vn-horizontal,

View File

@ -1,6 +1,11 @@
@import "./variables"; @import "./variables";
@import "./effects"; @import "./effects";
html, body {
margin: 0;
padding: 0;
}
a:focus, a:focus,
input:focus, input:focus,
button:focus { button:focus {

View File

@ -22,12 +22,12 @@ module.exports = function(Self) {
oldInstance = await fkToValue(oldInstanceFk, ctx); oldInstance = await fkToValue(oldInstanceFk, ctx);
if (ctx.where && !ctx.currentInstance) { if (ctx.where && !ctx.currentInstance) {
let fields = Object.keys(ctx.data); let fields = Object.keys(ctx.data);
ctx.oldInstances = await Self.modelBuilder.models[ctx.Model.definition.name].find({where: ctx.where, fields: fields}); ctx.oldInstances = await ctx.Model.app.models[ctx.Model.definition.name].find({where: ctx.where, fields: fields});
} }
} }
if (ctx.isNewInstance) { if (ctx.isNewInstance)
newInstance = await fkToValue(ctx.instance.__data, ctx); newInstance = await fkToValue(ctx.instance.__data, ctx);
}
ctx.hookState.oldInstance = oldInstance; ctx.hookState.oldInstance = oldInstance;
ctx.hookState.newInstance = newInstance; ctx.hookState.newInstance = newInstance;
}); });
@ -36,7 +36,7 @@ module.exports = function(Self) {
if (ctx.where) { if (ctx.where) {
let affectedModel = ctx.Model.definition.name; let affectedModel = ctx.Model.definition.name;
let definition = ctx.Model.definition; let definition = ctx.Model.definition;
let deletedInstances = await Self.modelBuilder.models[affectedModel].find({where: ctx.where}); let deletedInstances = await ctx.Model.app.models[affectedModel].find({where: ctx.where});
let relation = definition.settings.log.relation; let relation = definition.settings.log.relation;
if (relation) { if (relation) {
@ -81,12 +81,11 @@ module.exports = function(Self) {
}; };
let transaction = {}; let transaction = {};
if (ctx.options && ctx.options.transaction) { if (ctx.options && ctx.options.transaction)
transaction = ctx.options.transaction; transaction = ctx.options.transaction;
}
let logModel = definition.settings.log.model; let logModel = definition.settings.log.model;
await Self.modelBuilder.models[logModel].create(logRecord, transaction); await ctx.Model.app.models[logModel].create(logRecord, transaction);
}); });
} }
@ -147,25 +146,23 @@ module.exports = function(Self) {
if (changedModelValue && (!ctx.instance || !ctx.instance[changedModelValue])) { if (changedModelValue && (!ctx.instance || !ctx.instance[changedModelValue])) {
var where = []; var where = [];
changedModelId = []; changedModelId = [];
let changedInstances = await Self.modelBuilder.models[definition.name].find({where: ctx.where, fields: ['id', changedModelValue]}); let changedInstances = await ctx.Model.app.models[definition.name].find({where: ctx.where, fields: ['id', changedModelValue]});
changedInstances.forEach(element => { changedInstances.forEach(element => {
where.push(element[changedModelValue]); where.push(element[changedModelValue]);
changedModelId.push(element.id); changedModelId.push(element.id);
}); });
} else if (ctx.hookState.oldInstance) { } else if (ctx.hookState.oldInstance)
where = ctx.instance[changedModelValue]; where = ctx.instance[changedModelValue];
}
// Set oldInstance, newInstance, userFk and action // Set oldInstance, newInstance, userFk and action
let oldInstance = {}; let oldInstance = {};
if (ctx.hookState.oldInstance) { if (ctx.hookState.oldInstance)
Object.assign(oldInstance, ctx.hookState.oldInstance); Object.assign(oldInstance, ctx.hookState.oldInstance);
}
let newInstance = {}; let newInstance = {};
if (ctx.hookState.newInstance) { if (ctx.hookState.newInstance)
Object.assign(newInstance, ctx.hookState.newInstance); Object.assign(newInstance, ctx.hookState.newInstance);
}
let userFk; let userFk;
if (loopBackContext) if (loopBackContext)
@ -189,17 +186,16 @@ module.exports = function(Self) {
let logModel = definition.settings.log.model; let logModel = definition.settings.log.model;
let transaction = {}; let transaction = {};
if (ctx.options && ctx.options.transaction) { if (ctx.options && ctx.options.transaction)
transaction = ctx.options.transaction; transaction = ctx.options.transaction;
}
await Self.modelBuilder.models[logModel].create(logsToSave, transaction); await ctx.Model.app.models[logModel].create(logsToSave, transaction);
} }
// this function retuns all the instances changed in case this is an updateAll // this function retuns all the instances changed in case this is an updateAll
function setLogsToSave(changedInstances, changedInstancesIds, logRecord, ctx) { function setLogsToSave(changedInstances, changedInstancesIds, logRecord, ctx) {
let promises = []; let promises = [];
if (changedInstances && typeof changedInstances == "object") { if (changedInstances && typeof changedInstances == 'object') {
for (let i = 0; i < changedInstances.length; i++) { for (let i = 0; i < changedInstances.length; i++) {
logRecord.changedModelId = changedInstancesIds[i]; logRecord.changedModelId = changedInstancesIds[i];
logRecord.changedModelValue = changedInstances[i]; logRecord.changedModelValue = changedInstances[i];
@ -207,9 +203,9 @@ module.exports = function(Self) {
logRecord.oldInstance = ctx.oldInstances[i]; logRecord.oldInstance = ctx.oldInstances[i];
promises.push(JSON.parse(JSON.stringify(logRecord))); promises.push(JSON.parse(JSON.stringify(logRecord)));
} }
} else { } else
return logRecord; return logRecord;
}
return promises; return promises;
} }
@ -217,11 +213,11 @@ module.exports = function(Self) {
let oldInstance = ctx.hookState.oldInstance; let oldInstance = ctx.hookState.oldInstance;
let newInstance = ctx.hookState.newInstance; let newInstance = ctx.hookState.newInstance;
if (oldInstance && newInstance) { if (oldInstance && newInstance)
return 'update'; return 'update';
} else if (!oldInstance && newInstance) { else if (!oldInstance && newInstance)
return 'insert'; return 'insert';
}
return 'delete'; return 'delete';
} }
}; };

View File

@ -0,0 +1,12 @@
<vn-horizontal>
<vn-one>{{::$ctrl.title}}</vn-one>
<vn-auto>
<section
class="inline-tag ellipsize"
ng-class="::{empty: !fetchedTag.value}"
ng-repeat="fetchedTag in $ctrl.tags track by $index"
title="{{::fetchedTag.name}}: {{::fetchedTag.value}}">
{{::fetchedTag.value}}
</section>
</vn-auto>
</vn-horizontal>

View File

@ -1,4 +1,4 @@
import ngModule from '../../module'; import ngModule from '../module';
import './style.scss'; import './style.scss';
export default class FetchedTags { export default class FetchedTags {

View File

@ -0,0 +1,56 @@
@import "variables";
vn-fetched-tags {
&.noTitle vn-one {
display: none !important;
}
& > vn-horizontal {
align-items: center;
& > vn-one {
overflow: hidden;
text-overflow: ellipsis;
min-width: 5em;
}
& > vn-auto {
display: flex;
padding-left: .4em;
min-width: 12em;
& > .inline-tag {
display: inline-block;
color: $color-font-secondary;
margin-left: .4em;
text-align: center;
font-size: .8em;
height: 1.25em;
padding: .1em;
border-radius: .1em;
width: 4em;
min-width: 4em;
border: 1px solid $color-spacer;
&.empty {
border: 1px solid $color-spacer-light;
}
}
}
@media screen and (max-width: 1600px) {
flex-direction: column;
& > vn-one {
padding-bottom: .2em;
}
& > vn-auto {
white-space: initial;
padding-left: 0;
flex-wrap: wrap;
justify-content: center;
& > .inline-tag {
margin: .1em;
}
}
}
}
}

View File

@ -8,6 +8,7 @@ import './card';
import './descriptor'; import './descriptor';
import './descriptor-popover'; import './descriptor-popover';
import './data'; import './data';
import './fetched-tags';
import './tags'; import './tags';
import './tax'; import './tax';
// import './history'; // import './history';

View File

@ -23,15 +23,15 @@
<vn-th th-id="picture"></vn-th> <vn-th th-id="picture"></vn-th>
<vn-th field="id" number>Id</vn-th> <vn-th field="id" number>Id</vn-th>
<vn-th th-id="description" style="text-align: center">Description</vn-th> <vn-th th-id="description" style="text-align: center">Description</vn-th>
<vn-th th-id="stems">Stems</vn-th> <vn-th th-id="stems" number>Stems</vn-th>
<vn-th th-id="type">Type</vn-th> <vn-th th-id="type">Type</vn-th>
<vn-th th-id="category">Category</vn-th> <vn-th th-id="category">Category</vn-th>
<vn-th th-id="intrastat">Intrastat</vn-th> <vn-th th-id="intrastat">Intrastat</vn-th>
<vn-th th-id="origin">Origin</vn-th> <vn-th th-id="origin">Origin</vn-th>
<vn-th th-id="salesperson">Sales person</vn-th> <vn-th th-id="salesperson">Sales person</vn-th>
<vn-th th-id="density">Density</vn-th> <vn-th th-id="density" number>Density</vn-th>
<vn-th th-id="taxClass">Tax class</vn-th> <vn-th th-id="taxClass">Tax class</vn-th>
<vn-th th-id="active">Active</vn-th> <vn-th th-id="active" shrink>Active</vn-th>
<vn-th></vn-th> <vn-th></vn-th>
</vn-tr> </vn-tr>
</vn-thead> </vn-thead>
@ -46,7 +46,7 @@
ng-click="$ctrl.stopEvent($event)" ng-click="$ctrl.stopEvent($event)"
on-error-src/> on-error-src/>
</vn-td> </vn-td>
<vn-td expand> <vn-td number>
<span <span
class="link" class="link"
ng-click="$ctrl.showItemDescriptor($event, item.id)"> ng-click="$ctrl.showItemDescriptor($event, item.id)">
@ -74,7 +74,7 @@
</vn-td> </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 shrink>
<vn-check <vn-check
disabled="true" disabled="true"
field="::item.isActive"> field="::item.isActive">
@ -97,7 +97,7 @@
</a> </a>
</vn-tbody> </vn-tbody>
</vn-table> </vn-table>
<vn-card margin-medium-v> </vn-card>
<vn-pagination model="model"></vn-pagination> <vn-pagination model="model"></vn-pagination>
</div> </div>
<a ui-sref="item.create" vn-tooltip="New item" vn-bind="+" fixed-bottom-right> <a ui-sref="item.create" vn-tooltip="New item" vn-bind="+" fixed-bottom-right>

View File

@ -3,21 +3,21 @@ const app = require('vn-loopback/server/server');
describe('ticket deleted()', () => { describe('ticket deleted()', () => {
let ticket; let ticket;
beforeAll(async () => { beforeAll(async() => {
let originalTicket = await app.models.Ticket.findOne({where: {id: 16}}); let originalTicket = await app.models.Ticket.findOne({where: {id: 16}});
originalTicket.id = null; originalTicket.id = null;
ticket = await app.models.Ticket.create(originalTicket); ticket = await app.models.Ticket.create(originalTicket);
}); });
afterAll(async () => { afterAll(async() => {
await app.models.Ticket.destroyById(ticket.id); await app.models.Ticket.destroyById(ticket.id);
}); });
it('should make sure the ticket is not deleted yet', async () => { it('should make sure the ticket is not deleted yet', async() => {
expect(ticket.isDeleted).toEqual(false); expect(ticket.isDeleted).toEqual(false);
}); });
it('should set a ticket to deleted and log the change on TicketState table', async () => { it('should set a ticket to deleted and log the change on TicketState table', async() => {
let ctx = {req: {accessToken: {userId: 9}}}; let ctx = {req: {accessToken: {userId: 9}}};
let params = {id: ticket.id}; let params = {id: ticket.id};
await app.models.Ticket.deleted(ctx, params); await app.models.Ticket.deleted(ctx, params);
@ -29,7 +29,7 @@ describe('ticket deleted()', () => {
expect(changedState.stateFk).toEqual(17); expect(changedState.stateFk).toEqual(17);
}); });
it('should throw an error if the given ticket has a claim', async () => { it('should throw an error if the given ticket has a claim', async() => {
let ctx = {req: {accessToken: {userId: 9}}}; let ctx = {req: {accessToken: {userId: 9}}};
let params = {id: 16}; let params = {id: 16};
let error; let error;

View File

@ -135,14 +135,15 @@ module.exports = Self => {
relation: 'user' relation: 'user'
} }
} }
}, }, {
{
relation: 'atender', relation: 'atender',
scope: { scope: {
include: { include: {
relation: 'user' relation: 'user'
} }
} }
}, {
relation: 'sale'
} }
] ]
}; };

View File

@ -1,6 +1,9 @@
{ {
"name": "Ticket", "name": "Ticket",
"base": "VnModel", "base": "Loggable",
"log": {
"model":"TicketLog"
},
"options": { "options": {
"mysql": { "mysql": {
"table": "ticket" "table": "ticket"

View File

@ -11,7 +11,7 @@ class Controller {
{callback: this.showAddTurnDialog, name: 'Add turn', show: true}, {callback: this.showAddTurnDialog, name: 'Add turn', show: true},
{callback: this.showAddStowaway, name: 'Add stowaway', show: () => this.isTicketModule()}, {callback: this.showAddStowaway, name: 'Add stowaway', show: () => this.isTicketModule()},
{callback: this.showRemoveStowaway, name: 'Remove stowaway', show: () => this.shouldShowRemoveStowaway()}, {callback: this.showRemoveStowaway, name: 'Remove stowaway', show: () => this.shouldShowRemoveStowaway()},
{callback: this.showDeliveryNote, name: 'Show Delivery Note', show: true}, /* {callback: this.showDeliveryNote, name: 'Show Delivery Note', show: true}, */
{callback: this.showDeleteTicketDialog, name: 'Delete ticket', show: true}, {callback: this.showDeleteTicketDialog, name: 'Delete ticket', show: true},
/* callback: this.showChangeShipped, name: 'Change shipped hour', show: true} */ /* callback: this.showChangeShipped, name: 'Change shipped hour', show: true} */
]; ];

View File

@ -54,7 +54,7 @@
<vn-td number> <vn-td number>
<span <span
ng-show="::request.saleFk" ng-show="::request.saleFk"
ng-click="$ctrl.showItemDescriptor($event, request.sale)" ng-click="$ctrl.showItemDescriptor($event, request.sale.itemFk)"
class="link"> class="link">
{{request.saleFk | zeroFill:6}} {{request.saleFk | zeroFill:6}}
</span> </span>

View File

@ -44,18 +44,18 @@ class Controller {
}); });
} }
showItemDescriptor(event, sale) { showItemDescriptor(event, itemFk) {
this.quicklinks = { this.quicklinks = {
btnThree: { btnThree: {
icon: 'icon-transaction', icon: 'icon-transaction',
state: `item.card.diary({ state: `item.card.diary({
id: ${sale.itemFk}, id: ${itemFk},
ticketFk: ${this.$stateParams.id} ticketFk: ${this.$stateParams.id}
})`, })`,
tooltip: 'Item diary' tooltip: 'Item diary'
} }
}; };
this.$.itemDescriptor.itemFk = sale.itemFk; this.$.itemDescriptor.itemFk = itemFk;
this.$.itemDescriptor.parent = event.target; this.$.itemDescriptor.parent = event.target;
this.$.itemDescriptor.show(); this.$.itemDescriptor.show();
} }

View File

@ -54,16 +54,16 @@
<vn-table model="model"> <vn-table model="model">
<vn-thead> <vn-thead>
<vn-tr> <vn-tr>
<vn-th number> <vn-th shrink>
<vn-multi-check <vn-multi-check
data="$ctrl.sales"> data="$ctrl.sales">
</vn-multi-check> </vn-multi-check>
</vn-th> </vn-th>
<vn-th></vn-th> <vn-th shrink></vn-th>
<vn-th style="text-align: center">Item</vn-th> <vn-th shrink></vn-th>
<vn-th number>Id</vn-th> <vn-th number>Id</vn-th>
<vn-th>Description</vn-th> <vn-th>Quantity</vn-th>
<vn-th number>Quantity</vn-th> <vn-th>Item</vn-th>
<vn-th number>Price</vn-th> <vn-th number>Price</vn-th>
<vn-th number>Disc</vn-th> <vn-th number>Disc</vn-th>
<vn-th number>Amount</vn-th> <vn-th number>Amount</vn-th>
@ -71,12 +71,12 @@
</vn-thead> </vn-thead>
<vn-tbody> <vn-tbody>
<vn-tr ng-repeat="sale in $ctrl.sales"> <vn-tr ng-repeat="sale in $ctrl.sales">
<vn-td number > <vn-td shrink>
<vn-check <vn-check
field="sale.checked"> field="sale.checked">
</vn-check> </vn-check>
</vn-td> </vn-td>
<vn-td> <vn-td shrink>
<a ui-sref="claim.card.basicData({id: sale.claim.claimFk})"> <a ui-sref="claim.card.basicData({id: sale.claim.claimFk})">
<vn-icon <vn-icon
ng-show="sale.claim.claimFk" ng-show="sale.claim.claimFk"
@ -94,7 +94,7 @@
icon="icon-reserve" icon="icon-reserve"
vn-tooltip="{{::$ctrl.$translate.instant('Reserved')}}"></vn-icon> vn-tooltip="{{::$ctrl.$translate.instant('Reserved')}}"></vn-icon>
</vn-td> </vn-td>
<vn-td style="text-align: center"> <vn-td shrink>
<img <img
ng-src="{{::$ctrl.imagesPath}}/50x50/{{::sale.image}}" ng-src="{{::$ctrl.imagesPath}}/50x50/{{::sale.image}}"
zoom-image="{{::$ctrl.imagesPath}}/1600x900/{{::sale.image}}" zoom-image="{{::$ctrl.imagesPath}}/1600x900/{{::sale.image}}"
@ -107,13 +107,6 @@
{{::sale.itemFk | zeroFill:6}} {{::sale.itemFk | zeroFill:6}}
</span> </span>
</vn-td> </vn-td>
<vn-td expand>
<vn-fetched-tags
max-length="6"
item="::sale.tags"
title="::sale.concept">
</vn-fetched-tags>
</vn-td>
<vn-td ng-if="!$ctrl.isEditable" number>{{sale.quantity}}</vn-td> <vn-td ng-if="!$ctrl.isEditable" number>{{sale.quantity}}</vn-td>
<vn-td ng-if="$ctrl.isEditable" number> <vn-td ng-if="$ctrl.isEditable" number>
<vn-textfield <vn-textfield
@ -122,22 +115,29 @@
type="text"> type="text">
</vn-textfield> </vn-textfield>
</vn-td> </vn-td>
<vn-td number <vn-td expand>
ng-if="$ctrl.isEditable" <vn-fetched-tags
class="link" max-length="6"
ng-click="$ctrl.showEditPricePopover($event, sale)" item="::sale.tags"
vn-tooltip="Edit price"> title="::sale.concept">
{{sale.price | currency: 'EUR':2}} </vn-fetched-tags>
</vn-td>
<vn-td number ng-if="$ctrl.isEditable">
<span class="link"
vn-tooltip="Edit price"
ng-click="$ctrl.showEditPricePopover($event, sale)">
{{sale.price | currency: 'EUR':2}}
</span>
</vn-td> </vn-td>
<vn-td number ng-if="!$ctrl.isEditable"> <vn-td number ng-if="!$ctrl.isEditable">
{{sale.price | currency: 'EUR':2}} {{sale.price | currency: 'EUR':2}}
</vn-td> </vn-td>
<vn-td number <vn-td number ng-if="$ctrl.isEditable">
ng-if="$ctrl.isEditable" <span class="link"
class="link" vn-tooltip="Edit discount"
ng-click="$ctrl.showEditPopover($event, sale)" ng-click="$ctrl.showEditPopover($event, sale)">
vn-tooltip="Edit discount"> {{sale.discount}} %
{{sale.discount}} % </span>
</vn-td> </vn-td>
<vn-td number <vn-td number
ng-if="!$ctrl.isEditable"> ng-if="!$ctrl.isEditable">
@ -158,7 +158,7 @@
<!-- Edit Price Popover --> <!-- Edit Price Popover -->
<vn-popover <vn-popover
class="edit dialog-summary" class="edit dialog-summary"
vn-id="editPricePopover" vn-id="edit-price-popover"
on-open="$ctrl.getManaSalespersonMana()"> on-open="$ctrl.getManaSalespersonMana()">
<vn-horizontal pad-medium class="header"> <vn-horizontal pad-medium class="header">
<h5>MANÁ: {{$ctrl.mana | currency: 'EUR':0}}</h5> <h5>MANÁ: {{$ctrl.mana | currency: 'EUR':0}}</h5>
@ -185,7 +185,7 @@
<!-- Edit Popover --> <!-- Edit Popover -->
<vn-popover <vn-popover
class="edit dialog-summary" class="edit dialog-summary"
vn-id="editPopover" vn-id="edit-popover"
on-open="$ctrl.getManaSalespersonMana()"> on-open="$ctrl.getManaSalespersonMana()">
<vn-ticket-sale-edit-discount <vn-ticket-sale-edit-discount
mana="$ctrl.mana" mana="$ctrl.mana"

View File

@ -55,10 +55,10 @@
<vn-table class="vn-grid"> <vn-table class="vn-grid">
<vn-thead> <vn-thead>
<vn-tr> <vn-tr>
<vn-th></vn-th> <vn-th shrink></vn-th>
<vn-th number>Item</vn-th> <vn-th number>Item</vn-th>
<vn-th>Description</vn-th>
<vn-th number>Quantity</vn-th> <vn-th number>Quantity</vn-th>
<vn-th>Description</vn-th>
<vn-th number>Price</vn-th> <vn-th number>Price</vn-th>
<vn-th number>Discount</vn-th> <vn-th number>Discount</vn-th>
<vn-th number>Amount</vn-th> <vn-th number>Amount</vn-th>
@ -66,7 +66,7 @@
</vn-thead> </vn-thead>
<vn-tbody> <vn-tbody>
<vn-tr ng-repeat="sale in $ctrl.summary.sales track by sale.id"> <vn-tr ng-repeat="sale in $ctrl.summary.sales track by sale.id">
<vn-td> <vn-td shrink>
<a ui-sref="claim.card.basicData({id: sale.claimBeginning.claimFk})"> <a ui-sref="claim.card.basicData({id: sale.claimBeginning.claimFk})">
<vn-icon <vn-icon
ng-show="sale.claimBeginning.claimFk" ng-show="sale.claimBeginning.claimFk"
@ -89,8 +89,8 @@
{{sale.itemFk | zeroFill:6}} {{sale.itemFk | zeroFill:6}}
</span> </span>
</vn-td> </vn-td>
<vn-td expand><vn-fetched-tags max-length="6" item="sale.item" title="sale.concept"/></vn-td>
<vn-td number>{{::sale.quantity}}</vn-td> <vn-td number>{{::sale.quantity}}</vn-td>
<vn-td expand><vn-fetched-tags max-length="6" item="sale.item" title="sale.concept"/></vn-td>
<vn-td number>{{::sale.price | currency: 'EUR':2}}</vn-td> <vn-td number>{{::sale.price | currency: 'EUR':2}}</vn-td>
<vn-td number>{{::sale.discount}} %</vn-td> <vn-td number>{{::sale.discount}} %</vn-td>
<vn-td number>{{::sale.quantity * sale.price | currency: 'EUR':2}}</vn-td> <vn-td number>{{::sale.quantity * sale.price | currency: 'EUR':2}}</vn-td>
@ -123,8 +123,8 @@
<vn-thead> <vn-thead>
<vn-tr> <vn-tr>
<vn-th number>Id</vn-th> <vn-th number>Id</vn-th>
<vn-th>Description</vn-th>
<vn-th number>Quantity</vn-th> <vn-th number>Quantity</vn-th>
<vn-th>Description</vn-th>
<vn-th number>Price</vn-th> <vn-th number>Price</vn-th>
<vn-th>Tax class</vn-th> <vn-th>Tax class</vn-th>
</vn-tr> </vn-tr>
@ -132,8 +132,8 @@
<vn-tbody> <vn-tbody>
<vn-tr ng-repeat="service in $ctrl.summary.services"> <vn-tr ng-repeat="service in $ctrl.summary.services">
<vn-td number>{{::service.id}}</vn-td> <vn-td number>{{::service.id}}</vn-td>
<vn-td expand>{{::service.description}}</vn-td>
<vn-td number>{{::service.quantity}}</vn-td> <vn-td number>{{::service.quantity}}</vn-td>
<vn-td expand>{{::service.description}}</vn-td>
<vn-td number>{{::service.price}}</vn-td> <vn-td number>{{::service.price}}</vn-td>
<vn-td>{{::service.taxClass.description}}</vn-td> <vn-td>{{::service.taxClass.description}}</vn-td>
</vn-tr> </vn-tr>
@ -151,7 +151,7 @@
<vn-th>Atender</vn-th> <vn-th>Atender</vn-th>
<vn-th number>Quantity</vn-th> <vn-th number>Quantity</vn-th>
<vn-th number>Price</vn-th> <vn-th number>Price</vn-th>
<vn-th number>Sale id</vn-th> <vn-th number>Item</vn-th>
<vn-th number>Ok</vn-th> <vn-th number>Ok</vn-th>
</vn-tr> </vn-tr>
</vn-thead> </vn-thead>
@ -166,9 +166,9 @@
<vn-td number> <vn-td number>
<span <span
ng-show="::request.saleFk" ng-show="::request.saleFk"
ng-click="$ctrl.showDescriptor($event, request.saleFk)" ng-click="$ctrl.showDescriptor($event, request.sale.itemFk)"
class="link"> class="link">
{{request.saleFk | zeroFill:6}} {{request.sale.itemFk | zeroFill:6}}
</span> </span>
</vn-td> </vn-td>
<vn-td number> <vn-td number>

View File

@ -1029,8 +1029,10 @@ INSERT INTO `hedera`.`tpvTransaction`(`id`,`merchantFk`, `clientFk`,`receiptFk`,
VALUES VALUES
(1, 1, 101, NULL, 2000, NULL, 'SIS0042', 'ok', CURDATE()), (1, 1, 101, NULL, 2000, NULL, 'SIS0042', 'ok', CURDATE()),
(2, 1, 101, NULL, 1000, NULL, 'SIS0051', 'started', CURDATE()), (2, 1, 101, NULL, 1000, NULL, 'SIS0051', 'started', CURDATE()),
(3, 2, 101, NULL, 7268, 0, NULL, 'ok', CURDATE()), (3, 2, 101, NULL, 7268, NULL, NULL, 'ok', CURDATE()),
(4, 2, 101, NULL, 4698, 100, NULL, 'started', CURDATE()); (4, 2, 101, NULL, 4698, NULL, NULL, 'started', CURDATE()),
(5, 1, 104, NULL, 2000, NULL, 'SIS0043', 'ok', CURDATE()),
(6, 2, 104, NULL, 4000, NULL, 'SIS0044', 'started', CURDATE());
INSERT INTO `vn`.`orderTicket`(`orderFk`, `ticketFk`) INSERT INTO `vn`.`orderTicket`(`orderFk`, `ticketFk`)
VALUES VALUES