Merge branch 'dev' into 2961-summary_tickets
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Carlos Jimenez Ruiz 2021-06-16 10:18:47 +00:00
commit f5ad0c9c1c
23 changed files with 277 additions and 130 deletions

View File

@ -43,14 +43,14 @@ export default class Contextmenu {
get row() { get row() {
if (!this.target) return null; if (!this.target) return null;
return this.target.closest('vn-tr, .vn-tr'); return this.target.closest('[ng-repeat]');
} }
get rowIndex() { get rowIndex() {
if (!this.row) return null; if (!this.row) return null;
const table = this.row.closest('vn-table, .vn-table'); const table = this.row.closest('vn-table, .vn-table');
const tBody = table.querySelector('vn-tbody, .vn-tbody'); const rows = table.querySelectorAll('[ng-repeat]');
const rows = tBody.querySelectorAll('vn-tr, .vn-tr');
return Array.from(rows).findIndex( return Array.from(rows).findIndex(
rowItem => rowItem == this.row rowItem => rowItem == this.row

View File

@ -25,7 +25,7 @@
<vn-tr ng-repeat="transaction in transactions"> <vn-tr ng-repeat="transaction in transactions">
<vn-td shrink> <vn-td shrink>
<vn-icon <vn-icon
vn-tooltip="{{$ctrl.getFormattedMessage(transaction)}}" vn-tooltip="{{::$ctrl.getFormattedMessage(transaction)}}"
ng-show="::((transaction.errorMessage || transaction.responseMessage) && !transaction.isConfirmed)" ng-show="::((transaction.errorMessage || transaction.responseMessage) && !transaction.isConfirmed)"
icon="clear"> icon="clear">
</vn-icon> </vn-icon>

View File

@ -48,21 +48,15 @@ module.exports = Self => {
switch (field) { switch (field) {
case 'size': case 'size':
case 'density': case 'density':
case 'minPrice':
case 'description': case 'description':
case 'packingOut':
modelName = 'Item'; modelName = 'Item';
identifier = 'itemFk'; identifier = 'itemFk';
break; break;
case 'quantity':
case 'buyingValue':
case 'freightValue':
case 'packing': case 'packing':
case 'grouping': case 'grouping':
case 'groupingMode': case 'groupingMode':
case 'comissionValue':
case 'packageValue': case 'packageValue':
case 'price2':
case 'price3':
case 'weight': case 'weight':
modelName = 'Buy'; modelName = 'Buy';
identifier = 'id'; identifier = 'id';

View File

@ -10,54 +10,59 @@ module.exports = Self => {
accepts: [ accepts: [
{ {
arg: 'filter', arg: 'filter',
type: 'Object', type: 'object',
description: 'Filter defining where, order, offset, and limit - must be a JSON-encoded string', description: 'Filter defining where, order, offset, and limit - must be a JSON-encoded string',
}, },
{ {
arg: 'search', arg: 'search',
type: 'String', type: 'string',
description: `If it's and integer searchs by id, otherwise it searchs by name`, description: `If it's and integer searchs by id, otherwise it searchs by name`,
}, },
{ {
arg: 'id', arg: 'id',
type: 'Integer', type: 'integer',
description: 'Item id', description: 'Item id',
}, },
{ {
arg: 'tags', arg: 'tags',
type: ['Object'], type: ['object'],
description: 'List of tags to filter with', description: 'List of tags to filter with',
http: {source: 'query'} http: {source: 'query'}
}, },
{ {
arg: 'description', arg: 'description',
type: 'String', type: 'string',
description: 'The item description', description: 'The item description',
}, },
{ {
arg: 'salesPersonFk', arg: 'salesPersonFk',
type: 'Integer', type: 'integer',
description: 'The buyer of the item', description: 'The buyer of the item',
}, },
{ {
arg: 'active', arg: 'active',
type: 'Boolean', type: 'boolean',
description: 'Whether the item is or not active', description: 'Whether the item is or not active',
}, },
{ {
arg: 'visible', arg: 'visible',
type: 'Boolean', type: 'boolean',
description: 'Whether the item is or not visible', description: 'Whether the item is or not visible',
}, },
{ {
arg: 'typeFk', arg: 'typeFk',
type: 'Integer', type: 'integer',
description: 'Type id', description: 'Type id',
}, },
{ {
arg: 'categoryFk', arg: 'categoryFk',
type: 'Integer', type: 'integer',
description: 'Category id', description: 'Category id',
},
{
arg: 'packingOut',
type: 'integer',
description: 'the packingOut',
} }
], ],
returns: { returns: {
@ -84,7 +89,10 @@ module.exports = Self => {
? {'i.id': value} ? {'i.id': value}
: {'i.name': {like: `%${value}%`}}; : {'i.name': {like: `%${value}%`}};
case 'id': case 'id':
return {'i.id': value}; case 'packingOut':
case 'typeFk':
param = `i.${param}`;
return {[param]: value};
case 'description': case 'description':
return {'i.description': {like: `%${value}%`}}; return {'i.description': {like: `%${value}%`}};
case 'categoryFk': case 'categoryFk':
@ -93,8 +101,6 @@ module.exports = Self => {
return {'it.workerFk': value}; return {'it.workerFk': value};
case 'code': case 'code':
return {'it.code': value}; return {'it.code': value};
case 'typeFk':
return {'i.typeFk': value};
case 'active': case 'active':
return {'i.isActive': value}; return {'i.isActive': value};
case 'visible': case 'visible':
@ -126,6 +132,7 @@ module.exports = Self => {
i.description, i.description,
i.name, i.name,
i.subName, i.subName,
i.packingOut,
i.tag5, i.tag5,
i.value5, i.value5,
i.tag6, i.tag6,

View File

@ -57,6 +57,7 @@
<vn-th field="ektFk">Ekt</vn-th> <vn-th field="ektFk">Ekt</vn-th>
<vn-th field="weight">Weight</vn-th> <vn-th field="weight">Weight</vn-th>
<vn-th field="packageFk" expand>PackageName</vn-th> <vn-th field="packageFk" expand>PackageName</vn-th>
<vn-th field="packingOut" expand>PackingOut</vn-th>
</vn-tr> </vn-tr>
</vn-thead> </vn-thead>
<vn-tbody> <vn-tbody>
@ -147,6 +148,7 @@
<vn-td number>{{::buy.ektFk | dashIfEmpty}}</vn-td> <vn-td number>{{::buy.ektFk | dashIfEmpty}}</vn-td>
<vn-td number>{{::buy.weight}}</vn-td> <vn-td number>{{::buy.weight}}</vn-td>
<vn-td number>{{::buy.packageFk}}</vn-td> <vn-td number>{{::buy.packageFk}}</vn-td>
<vn-td number>{{::buy.packingOut}}</vn-td>
</a> </a>
</vn-tbody> </vn-tbody>
</vn-table> </vn-table>

View File

@ -16,20 +16,14 @@ export default class Controller extends Section {
if (this._columns) return this._columns; if (this._columns) return this._columns;
this._columns = [ this._columns = [
{field: 'quantity', displayName: this.$t('Quantity')},
{field: 'buyingValue', displayName: this.$t('Buying value')},
{field: 'freightValue', displayName: this.$t('Freight value')},
{field: 'packing', displayName: this.$t('Packing')}, {field: 'packing', displayName: this.$t('Packing')},
{field: 'grouping', displayName: this.$t('Grouping')}, {field: 'grouping', displayName: this.$t('Grouping')},
{field: 'comissionValue', displayName: this.$t('Commission value')},
{field: 'packageValue', displayName: this.$t('Package value')}, {field: 'packageValue', displayName: this.$t('Package value')},
{field: 'price2', displayName: this.$t('Grouping price')},
{field: 'price3', displayName: this.$t('Packing price')},
{field: 'weight', displayName: this.$t('Weight')}, {field: 'weight', displayName: this.$t('Weight')},
{field: 'description', displayName: this.$t('Description')}, {field: 'description', displayName: this.$t('Description')},
{field: 'minPrice', displayName: this.$t('Min price')},
{field: 'size', displayName: this.$t('Size')}, {field: 'size', displayName: this.$t('Size')},
{field: 'density', displayName: this.$t('Density')} {field: 'density', displayName: this.$t('Density')},
{field: 'packingOut', displayName: this.$t('PackingOut')}
]; ];
return this._columns; return this._columns;

View File

@ -13,4 +13,5 @@ Minimun amount: Cantidad mínima de compra
Field to edit: Campo a editar Field to edit: Campo a editar
PackageName: Cubo PackageName: Cubo
Edit: Editar Edit: Editar
buy(s): compra(s) buy(s): compra(s)
PackingOut: Packing envíos

View File

@ -137,6 +137,9 @@
"minPrice": { "minPrice": {
"type": "number" "type": "number"
}, },
"packingOut": {
"type": "number"
},
"hasMinPrice": { "hasMinPrice": {
"type": "boolean" "type": "boolean"
}, },

View File

@ -10,6 +10,11 @@
Clients on website Clients on website
</vn-one> </vn-one>
<vn-none> <vn-none>
<vn-icon class="arrow"
icon="keyboard_arrow_up"
vn-tooltip="Minimize/Maximize"
ng-click="$ctrl.main.toggle()">
</vn-icon>
<vn-icon <vn-icon
icon="refresh" icon="refresh"
vn-tooltip="Refresh" vn-tooltip="Refresh"
@ -17,7 +22,7 @@
</vn-icon> </vn-icon>
</vn-none> </vn-none>
</vn-horizontal> </vn-horizontal>
<vn-card> <vn-card vn-id="card">
<vn-table model="model" class="scrollable sm"> <vn-table model="model" class="scrollable sm">
<vn-thead> <vn-thead>
<vn-tr> <vn-tr>
@ -52,12 +57,6 @@
</vn-tr> </vn-tr>
</vn-tbody> </vn-tbody>
</vn-table> </vn-table>
<div
ng-if="!model.data.length"
class="empty-rows vn-pa-sm"
translate>
No results
</div>
<vn-pagination <vn-pagination
model="model" model="model"
class="vn-pt-xs" class="vn-pt-xs"

View File

@ -26,5 +26,8 @@ export default class Controller extends Section {
ngModule.vnComponent('vnMonitorSalesClients', { ngModule.vnComponent('vnMonitorSalesClients', {
template: require('./index.html'), template: require('./index.html'),
controller: Controller controller: Controller,
require: {
main: '^vnMonitorIndex'
}
}); });

View File

@ -1,11 +1,5 @@
<vn-horizontal> <vn-horizontal>
<vn-three class="vn-mr-sm"> <vn-monitor-sales-clients class="vn-mb-sm"></vn-monitor-sales-clients>
<vn-monitor-sales-tickets></vn-monitor-sales-tickets> <vn-monitor-sales-orders></vn-monitor-sales-orders>
</vn-three> </vn-horizontal>
<vn-one> <vn-monitor-sales-tickets></vn-monitor-sales-tickets>
<vn-vertical>
<vn-monitor-sales-clients class="vn-mb-sm"></vn-monitor-sales-clients>
<vn-monitor-sales-orders></vn-monitor-sales-orders>
</vn-vertical>
</vn-one>
</vn-horizontal>

View File

@ -2,7 +2,22 @@ import ngModule from '../module';
import Section from 'salix/components/section'; import Section from 'salix/components/section';
import './style.scss'; import './style.scss';
export default class Controller extends Section {
toggle() {
const monitor = this.element.querySelector('vn-horizontal');
const isHidden = monitor.classList.contains('hidden');
if (!isHidden)
monitor.classList.add('hidden');
else
monitor.classList.remove('hidden');
}
}
ngModule.vnComponent('vnMonitorIndex', { ngModule.vnComponent('vnMonitorIndex', {
template: require('./index.html'), template: require('./index.html'),
controller: Section controller: Controller,
require: {
main: '^vnMonitorIndex'
}
}); });

View File

@ -4,4 +4,5 @@ Recent order actions: Acciones recientes en pedidos
Search tickets: Buscar tickets Search tickets: Buscar tickets
Delete selected elements: Eliminar los elementos seleccionados Delete selected elements: Eliminar los elementos seleccionados
All the selected elements will be deleted. Are you sure you want to continue?: Todos los elementos seleccionados serán eliminados. ¿Seguro que quieres continuar? All the selected elements will be deleted. Are you sure you want to continue?: Todos los elementos seleccionados serán eliminados. ¿Seguro que quieres continuar?
Component lack: Faltan componentes Component lack: Faltan componentes
Minimize/Maximize: Minimizar/Maximizar

View File

@ -1,4 +1,4 @@
<vn-crud-model <vn-crud-model auto-load="true"
vn-id="model" vn-id="model"
url="SalesMonitors/ordersFilter" url="SalesMonitors/ordersFilter"
limit="6" limit="6"
@ -15,6 +15,11 @@
ng-if="$ctrl.totalChecked > 0" ng-if="$ctrl.totalChecked > 0"
ng-click="delete.show()"> ng-click="delete.show()">
</vn-icon> </vn-icon>
<vn-icon class="arrow"
icon="keyboard_arrow_up"
vn-tooltip="Minimize/Maximize"
ng-click="$ctrl.main.toggle()">
</vn-icon>
<vn-icon <vn-icon
icon="refresh" icon="refresh"
vn-tooltip="Refresh" vn-tooltip="Refresh"
@ -31,13 +36,13 @@
model="model"> model="model">
</vn-multi-check> </vn-multi-check>
</vn-th> </vn-th>
<vn-th field="date_make" shrink-datetime default-order="DESC">Date</vn-th> <vn-th field="date_send" shrink-datetime>Date</vn-th>
<vn-th field="clientFk">Client</vn-th> <vn-th field="clientFk">Client</vn-th>
<vn-th>Import</vn-th> <vn-th field="salesPersonFk" shrink>SalesPerson</vn-th>
</vn-tr> </vn-tr>
</vn-thead> </vn-thead>
<a ng-repeat="order in model.data" <a ng-repeat="order in model.data"
class="clickable vn-tbody search-result" class="clickable vn-tbody"
ui-sref="order.card.summary({id: {{::order.id}}})" target="_blank"> ui-sref="order.card.summary({id: {{::order.id}}})" target="_blank">
<vn-tr> <vn-tr>
<vn-td> <vn-td>
@ -47,7 +52,7 @@
</vn-check> </vn-check>
</vn-td> </vn-td>
<vn-td> <vn-td>
<span class="chip success"> <span class="chip {{::$ctrl.chipColor(order.date_send)}}">
{{::order.date_send | date: 'dd/MM/yyyy'}} {{::order.date_send | date: 'dd/MM/yyyy'}}
</span> </span>
</vn-td> </vn-td>
@ -59,11 +64,18 @@
{{::order.clientName}} {{::order.clientName}}
</span> </span>
</vn-td> </vn-td>
<vn-td number>{{::order.import | currency: 'EUR':2}}</vn-td> <vn-td>
<span
title="{{::order.salesPerson}}"
vn-click-stop="workerDescriptor.show($event, order.salesPersonFk)"
class="link">
{{::order.salesPerson | dashIfEmpty}}
</span>
</vn-td>
</vn-tr> </vn-tr>
<vn-tr> <vn-tr>
<vn-td></vn-td> <vn-td></vn-td>
<vn-td shrink-datetime> <vn-td>
<span> <span>
{{::order.date_make | date: 'dd/MM/yyyy HH:mm'}} {{::order.date_make | date: 'dd/MM/yyyy HH:mm'}}
</span> </span>
@ -74,22 +86,11 @@
</span> </span>
</vn-td> </vn-td>
<vn-td> <vn-td>
<span {{::order.import | currency: 'EUR':2}}
title="{{::order.salesPerson}}"
vn-click-stop="workerDescriptor.show($event, order.salesPersonFk)"
class="link">
{{::order.salesPerson | dashIfEmpty}}
</span>
</vn-td> </vn-td>
</vn-tr> </vn-tr>
</a> </a>
</vn-table> </vn-table>
<div
ng-if="!model.data.length"
class="empty-rows vn-pa-sm"
translate>
No results
</div>
<vn-pagination <vn-pagination
model="model" model="model"
class="vn-pt-xs" class="vn-pt-xs"
@ -103,6 +104,35 @@
<vn-client-descriptor-popover <vn-client-descriptor-popover
vn-id="clientDescriptor"> vn-id="clientDescriptor">
</vn-client-descriptor-popover> </vn-client-descriptor-popover>
<vn-contextmenu vn-id="contextmenu" targets="['vn-monitor-sales-orders vn-table']" model="model"
expr-builder="$ctrl.exprBuilder(param, value)">
<slot-menu>
<vn-item translate
ng-if="contextmenu.isFilterAllowed()"
ng-click="contextmenu.filterBySelection()">
Filter by selection
</vn-item>
<vn-item translate
ng-if="contextmenu.isFilterAllowed()"
ng-click="contextmenu.excludeSelection()">
Exclude selection
</vn-item>
<vn-item translate
ng-if="contextmenu.isFilterAllowed()"
ng-click="contextmenu.removeFilter()">
Remove filter
</vn-item>
<vn-item translate
ng-click="contextmenu.removeAllFilters()">
Remove all filters
</vn-item>
<vn-item translate
ng-if="contextmenu.isActionAllowed()"
ng-click="contextmenu.copyValue()">
Copy value
</vn-item>
</slot-menu>
</vn-contextmenu>
<vn-confirm <vn-confirm
vn-id="delete" vn-id="delete"
on-accept="$ctrl.onDelete()" on-accept="$ctrl.onDelete()"

View File

@ -24,9 +24,51 @@ export default class Controller extends Section {
this.$http.post(query, params).then( this.$http.post(query, params).then(
() => this.$.model.refresh()); () => this.$.model.refresh());
} }
chipColor(date) {
const today = new Date();
today.setHours(0, 0, 0, 0);
const orderLanded = new Date(date);
orderLanded.setHours(0, 0, 0, 0);
const difference = today - orderLanded;
if (difference == 0)
return 'warning';
if (difference < 0)
return 'success';
if (difference > 0)
return 'alert';
}
exprBuilder(param, value) {
switch (param) {
case 'date_send':
return {[`o.date_send`]: {
between: this.dateRange(value)}
};
case 'clientFk':
return {[`c.id`]: value};
case 'salesPersonFk':
return {[`c.${param}`]: value};
}
}
dateRange(value) {
const minHour = new Date(value);
minHour.setHours(0, 0, 0, 0);
const maxHour = new Date(value);
maxHour.setHours(23, 59, 59, 59);
return [minHour, maxHour];
}
} }
ngModule.vnComponent('vnMonitorSalesOrders', { ngModule.vnComponent('vnMonitorSalesOrders', {
template: require('./index.html'), template: require('./index.html'),
controller: Controller controller: Controller,
require: {
main: '^vnMonitorIndex'
}
}); });

View File

@ -2,7 +2,8 @@
vn-monitor-sales-orders { vn-monitor-sales-orders {
vn-table.scrollable { vn-table.scrollable {
max-height: 350px max-height: 350px;
overflow-x: hidden
} }
vn-table a.vn-tbody { vn-table a.vn-tbody {

View File

@ -21,36 +21,17 @@
ng-model="filter.orderFk"> ng-model="filter.orderFk">
</vn-textfield> </vn-textfield>
</vn-horizontal> </vn-horizontal>
<section class="vn-px-md"> <vn-horizontal class="vn-px-lg">
<vn-horizontal class="manifold-panel vn-pa-md"> <vn-input-number
<vn-date-picker vn-one
vn-one min="0"
label="From" step="1"
ng-model="filter.from" label="Days onward"
on-change="$ctrl.from = value"> ng-model="filter.scopeDays"
</vn-date-picker> on-change="$ctrl.scopeDays = value"
<vn-date-picker display-controls="true">
vn-one </vn-input-number>
label="To" </vn-horizontal>
ng-model="filter.to"
on-change="$ctrl.to = value">
</vn-date-picker>
<vn-none class="or vn-px-md" translate>Or</vn-none>
<vn-input-number
vn-one
min="0"
step="1"
label="Days onward"
ng-model="filter.scopeDays"
on-change="$ctrl.scopeDays = value"
display-controls="true">
</vn-input-number>
<vn-icon color-marginal
icon="info"
vn-tooltip="Cannot choose a range of dates and days onward at the same time">
</vn-icon>
</vn-horizontal>
</section>
<vn-horizontal class="vn-px-lg"> <vn-horizontal class="vn-px-lg">
<vn-textfield <vn-textfield
vn-one vn-one

View File

@ -3,54 +3,83 @@
vn-monitor-index { vn-monitor-index {
.header { .header {
padding: 12px 0; padding: 12px 0 5px 0;
color: gray; color: gray;
font-size: 1.2rem; font-size: 1.2rem;
border-bottom: 2px solid $color-font-secondary;
margin-bottom: 10px;
& > vn-none > vn-icon { & > vn-none > vn-icon {
@extend %clickable-light; @extend %clickable-light;
color: $color-button; color: $color-button;
font-size: 1.4rem; font-size: 1.4rem;
} }
}
.empty-rows { vn-none > .arrow {
color: $color-font-secondary; transition: transform 200ms;
text-align: center; }
} }
vn-vertical { vn-monitor-sales-clients {
position: fixed; vn-card {
width: 400px margin-right: 15px;
}
.header {
padding-right: 15px;
& > vn-none > .arrow {
display: none
}
}
}
vn-table.scrollable {
height: 300px
} }
vn-horizontal { vn-horizontal {
flex-wrap: wrap flex-wrap: wrap
} }
.hidden {
vn-card {
display: none
}
.header > vn-none > .arrow {
transform: rotate(180deg);
}
}
} }
@media (max-width:1500px) { @media (max-width:1150px) {
vn-monitor-index { vn-monitor-index {
& > vn-horizontal { & > vn-horizontal {
flex-direction: column-reverse; flex-direction: column;
vn-monitor-sales-clients,
vn-monitor-sales-orders {
width: 100%
}
vn-monitor-sales-clients {
margin-bottom: 15px
}
} }
& > vn-horizontal > vn-one { vn-monitor-sales-clients {
flex: none; vn-card {
width: 100%; margin-right: 0
}
& > vn-vertical { .header {
position: initial; padding-right: 0;
flex-direction: row;
width: 100%; & > vn-none > .arrow {
display: inline-block
vn-monitor-sales-clients {
margin-right: 15px
}
vn-table.scrollable {
height: 300px
} }
} }
} }
} }
} }

View File

@ -115,6 +115,14 @@ describe('Component vnMonitorSalesTickets', () => {
}); });
}); });
describe('totalPriceColor()', () => {
it('should return "warning" when the ticket amount is less than 50€', () => {
const result = controller.totalPriceColor({totalWithVat: '8.50'});
expect(result).toEqual('warning');
});
});
describe('preview()', () => { describe('preview()', () => {
it('should show the dialog summary', () => { it('should show the dialog summary', () => {
controller.$.summary = {show: () => {}}; controller.$.summary = {show: () => {}};

View File

@ -18,6 +18,13 @@
translate> translate>
Clone travel and his entries Clone travel and his entries
</vn-item> </vn-item>
<vn-item
id="delete"
ng-click="delete.show()"
ng-show="$ctrl.isBuyer && !$ctrl.entries.length"
translate>
Delete travel
</vn-item>
<a class="vn-item" <a class="vn-item"
ui-sref="entry.create({travelFk: $ctrl.travel.id})" ui-sref="entry.create({travelFk: $ctrl.travel.id})"
name="addEntry" name="addEntry"
@ -35,6 +42,14 @@
message="All it's properties will be copied"> message="All it's properties will be copied">
</vn-confirm> </vn-confirm>
<!-- Delete travel popup -->
<vn-confirm
vn-id="delete"
on-accept="$ctrl.onDeleteAccept()"
question="Do you want to delete this travel?"
message="The travel will be deleted">
</vn-confirm>
<!-- Clone travel popup --> <!-- Clone travel popup -->
<vn-confirm <vn-confirm
vn-id="cloneWithEntries" vn-id="cloneWithEntries"

View File

@ -44,14 +44,23 @@ class Controller extends Section {
} }
] ]
}; };
return this.$http.get(`Travels/${this.travelId}`, {filter}) this.$http.get(`Travels/${this.travelId}`, {filter})
.then(res => this.travel = res.data); .then(res => this.travel = res.data);
this.$http.get(`Travels/${this.travelId}/getEntries`)
.then(res => this.entries = res.data);
} }
get isBuyer() { get isBuyer() {
return this.aclService.hasAny(['buyer']); return this.aclService.hasAny(['buyer']);
} }
onDeleteAccept() {
this.$http.delete(`Travels/${this.travelId}`)
.then(() => this.$state.go('travel.index'))
.then(() => this.vnApp.showSuccess(this.$t('Travel deleted')));
}
onCloneAccept() { onCloneAccept() {
const params = JSON.stringify({ const params = JSON.stringify({
ref: this.travel.ref, ref: this.travel.ref,

View File

@ -40,6 +40,21 @@ describe('Travel Component vnTravelDescriptorMenu', () => {
}); });
}); });
describe('onDeleteAccept()', () => {
it('should perform a delete query', () => {
jest.spyOn(controller.$state, 'go').mockReturnValue('ok');
controller.travelId = 1;
$httpBackend.when('GET', `Travels/${controller.travelId}`).respond(200);
$httpBackend.when('GET', `Travels/${controller.travelId}/getEntries`).respond(200);
$httpBackend.expect('DELETE', `Travels/${controller.travelId}`).respond(200);
controller.onDeleteAccept();
$httpBackend.flush();
expect(controller.$state.go).toHaveBeenCalledWith('travel.index');
});
});
describe('onCloneWithEntriesAccept()', () => { describe('onCloneWithEntriesAccept()', () => {
it('should make an HTTP query and then call to the $state.go method with the returned id', () => { it('should make an HTTP query and then call to the $state.go method with the returned id', () => {
jest.spyOn(controller.$state, 'go').mockReturnValue('ok'); jest.spyOn(controller.$state, 'go').mockReturnValue('ok');

View File

@ -2,3 +2,7 @@ Clone travel: Clonar envío
Add entry: Añadir entrada Add entry: Añadir entrada
Clone travel and his entries: Clonar travel y sus entradas Clone travel and his entries: Clonar travel y sus entradas
Do you want to clone this travel and all containing entries?: ¿Quieres clonar este travel y todas las entradas que contiene? Do you want to clone this travel and all containing entries?: ¿Quieres clonar este travel y todas las entradas que contiene?
Delete travel: Eliminar envío
The travel will be deleted: El envío será eliminado
Do you want to delete this travel?: ¿Quieres eliminar este envío?
Travel deleted: Envío eliminado