ticket line basico

This commit is contained in:
Javi Gallego 2018-03-22 18:02:48 +01:00
parent ee6137c8e0
commit 46a6b0fb70
9 changed files with 115 additions and 20 deletions

View File

@ -10,15 +10,19 @@
<vn-card pad-large> <vn-card pad-large>
<vn-title>Create client</vn-title> <vn-title>Create client</vn-title>
<vn-horizontal> <vn-horizontal>
<vn-textfield vn-one label="Name" field="$ctrl.client.name" vn-focus></vn-textfield> <vn-textfield vn-two label="Business name" field="$ctrl.client.socialName"></vn-textfield>
<vn-textfield vn-one label="Tax number" field="$ctrl.client.fi"></vn-textfield> <vn-textfield vn-one label="Tax number" field="$ctrl.client.fi"></vn-textfield>
<vn-check
vn-one
label="Is equalizated"
field="$ctrl.client.isEqualizated">
</vn-check>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>
<vn-textfield vn-one label="Business name" field="$ctrl.client.socialName"></vn-textfield> <vn-textfield vn-two label="Comercial Name" field="$ctrl.client.name" vn-focus></vn-textfield>
<vn-textfield vn-one label="Web user" field="$ctrl.client.userName"></vn-textfield> <vn-textfield vn-one label="Web user" field="$ctrl.client.userName"></vn-textfield>
</vn-horizontal> <vn-textfield vn-two label="Email" field="$ctrl.client.email" info="You can save multiple emails"></vn-textfield>
<vn-horizontal>
<vn-textfield vn-one label="Email" field="$ctrl.client.email" info="You can save multiple emails"></vn-textfield>
<vn-autocomplete vn-one <vn-autocomplete vn-one
field="$ctrl.client.salesPersonFk" field="$ctrl.client.salesPersonFk"
url="/client/api/Clients/activeSalesPerson" url="/client/api/Clients/activeSalesPerson"
@ -29,6 +33,32 @@
where="{or: [{firstName: {regexp: 'search'}}, {name: {regexp: 'search'}}]}"> where="{or: [{firstName: {regexp: 'search'}}, {name: {regexp: 'search'}}]}">
</vn-autocomplete> </vn-autocomplete>
</vn-horizontal> </vn-horizontal>
<vn-horizontal>
<vn-textfield
vn-one
label="Postcode"
field="$ctrl.client.postcode">
</vn-textfield>
<vn-textfield
vn-two
label="Street"
field="$ctrl.client.street">
</vn-textfield>
<vn-textfield
vn-two
label="City"
field="$ctrl.client.city">
</vn-textfield>
<vn-autocomplete
vn-one
initial-data="$ctrl.client.province"
field="$ctrl.client.provinceFk"
url="/client/api/Provinces"
show-field="name"
value-field="id"
label="Province">
</vn-autocomplete>
</vn-horizontal>
</vn-card> </vn-card>
<vn-button-bar> <vn-button-bar>
<vn-submit label="Create"></vn-submit> <vn-submit label="Create"></vn-submit>

View File

@ -0,0 +1 @@
import './style.scss';

View File

@ -0,0 +1,16 @@
.vn-grid {
border-collapse: collapse;
td, th{
text-align: left;
padding: 10px;
}
& > thead, & > tbody {
border-bottom: 3px solid #9D9D9D;
}
& > tbody > tr{
border-bottom: 1px solid #9D9D9D;
}
td[number], th[number]{
text-align: right;
}
}

View File

@ -16,6 +16,7 @@ import './drop-down/drop-down';
import './menu/menu'; import './menu/menu';
import './column-header/column-header'; import './column-header/column-header';
import './grid-header/grid-header'; import './grid-header/grid-header';
import './grid/grid';
import './multi-check/multi-check'; import './multi-check/multi-check';
import './date-picker/date-picker'; import './date-picker/date-picker';
import './button/button'; import './button/button';

View File

@ -23,14 +23,14 @@
<tpl-item>{{code}} : {{name}}</tpl-item> <tpl-item>{{code}} : {{name}}</tpl-item>
</vn-autocomplete> </vn-autocomplete>
<vn-autocomplete vn-one <vn-autocomplete vn-one
url="/item/api/Intrastats" url="/item/api/Intrastats"
label="Intrastat" label="Intrastat"
show-field="description" show-field="description"
value-field="id" value-field="id"
field="$ctrl.item.intrastatFk" field="$ctrl.item.intrastatFk"
where="{or: [{id: {regexp: 'search'}}, {description: {regexp: 'search'}}]}"> where="{or: [{id: {regexp: 'search'}}, {description: {regexp: 'search'}}]}">
<tpl-item>{{id}} : {{description}}</tpl-item> <tpl-item>{{id}} : {{description}}</tpl-item>
</vn-autocomplete> </vn-autocomplete>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>
<vn-autocomplete vn-one <vn-autocomplete vn-one
@ -40,12 +40,6 @@
value-field="id" value-field="id"
field="$ctrl.item.originFk"> field="$ctrl.item.originFk">
</vn-autocomplete> </vn-autocomplete>
<vn-autocomplete vn-one
url="/item/api/Expences"
label="Expence"
field="$ctrl.item.expenceFk"
initial-data="$ctrl.item.expence">
</vn-autocomplete>
</vn-horizontal> </vn-horizontal>
</vn-card> </vn-card>
<vn-button-bar> <vn-button-bar>

View File

@ -0,0 +1,39 @@
<mg-ajax path="/ticket/api/sales/filter" options="vnIndex"></mg-ajax>
<vn-vertical>
<vn-card pad-large>
<vn-vertical>
<vn-title>Sale</vn-title>
<table class="vn-grid">
<thead>
<tr>
<th number translate>Item</th>
<th translate style="text-align:center">Description</th>
<th number translate>Quantity</th>
<th number translate>Price</th>
<th number translate>Discount</th>
<th number translate>Amount</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="sale in index.model.instances track by sale.id">
<td number>{{::sale.itemFk}}</td>
<td>
<vn-vertical style="text-align:center">
<vn-one>{{::sale.concept}}</vn-one>
<vn-one>
<vn-one ng-repeat="fetchedTag in sale.itemTag track by $index">
<vn-label>{{::fetchedTag.tag.name}} </vn-label>{{::fetchedTag.value}}
</vn-one>
</vn-one>
</vn-vertical>
</td>
<td number>{{::sale.quantity}}</td>
<td number>{{::sale.price | currency:'€':2}}</td>
<td number>{{::sale.discount}} %</td>
<td number>{{::sale.quantity * sale.price | currency:'€':2}}</td>
</tr>
</tbody>
</table>
</vn-vertical>
</vn-card>
</vn-vertical>

View File

@ -0,0 +1,7 @@
import ngModule from '../module';
import FilterTicketList from '../filter-ticket-list';
ngModule.component('vnTicketSale', {
template: require('./sale.html'),
controller: FilterTicketList
});

View File

@ -10,5 +10,7 @@
"Ya existe un usuario con ese nombre": "Ya existe un usuario con ese nombre", "Ya existe un usuario con ese nombre": "Ya existe un usuario con ese nombre",
"ValidationError: The `Item` instance is not valid. Details: `originFk` Cannot be blank (value: undefined).": "ValidationError: The `Item` instance is not valid. Details: `originFk` Cannot be blank (value: undefined).", "ValidationError: The `Item` instance is not valid. Details: `originFk` Cannot be blank (value: undefined).": "ValidationError: The `Item` instance is not valid. Details: `originFk` Cannot be blank (value: undefined).",
"Error: ER_NO_REFERENCED_ROW_2: Cannot add or update a child row: a foreign key constraint fails (`vn2008`.`Articles`, CONSTRAINT `Articles_ibfk_5` FOREIGN KEY (`tipo_id`) REFERENCES `Tipos` (`tipo_id`) ON UPDATE CASCADE)": "Error: ER_NO_REFERENCED_ROW_2: Cannot add or update a child row: a foreign key constraint fails (`vn2008`.`Articles`, CONSTRAINT `Articles_ibfk_5` FOREIGN KEY (`tipo_id`) REFERENCES `Tipos` (`tipo_id`) ON UPDATE CASCADE)", "Error: ER_NO_REFERENCED_ROW_2: Cannot add or update a child row: a foreign key constraint fails (`vn2008`.`Articles`, CONSTRAINT `Articles_ibfk_5` FOREIGN KEY (`tipo_id`) REFERENCES `Tipos` (`tipo_id`) ON UPDATE CASCADE)": "Error: ER_NO_REFERENCED_ROW_2: Cannot add or update a child row: a foreign key constraint fails (`vn2008`.`Articles`, CONSTRAINT `Articles_ibfk_5` FOREIGN KEY (`tipo_id`) REFERENCES `Tipos` (`tipo_id`) ON UPDATE CASCADE)",
"Error: ER_NO_REFERENCED_ROW_2: Cannot add or update a child row: a foreign key constraint fails (`vn2008`.`Articles`, CONSTRAINT `expenceFk` FOREIGN KEY (`expenceFk`) REFERENCES `Gastos` (`Id_Gasto`) ON UPDATE CASCADE)": "Error: ER_NO_REFERENCED_ROW_2: Cannot add or update a child row: a foreign key constraint fails (`vn2008`.`Articles`, CONSTRAINT `expenceFk` FOREIGN KEY (`expenceFk`) REFERENCES `Gastos` (`Id_Gasto`) ON UPDATE CASCADE)" "Error: ER_NO_REFERENCED_ROW_2: Cannot add or update a child row: a foreign key constraint fails (`vn2008`.`Articles`, CONSTRAINT `expenceFk` FOREIGN KEY (`expenceFk`) REFERENCES `Gastos` (`Id_Gasto`) ON UPDATE CASCADE)": "Error: ER_NO_REFERENCED_ROW_2: Cannot add or update a child row: a foreign key constraint fails (`vn2008`.`Articles`, CONSTRAINT `expenceFk` FOREIGN KEY (`expenceFk`) REFERENCES `Gastos` (`Id_Gasto`) ON UPDATE CASCADE)",
"INVALID_USER_NAME": "INVALID_USER_NAME",
"La razón social debe ser única": "La razón social debe ser única"
} }

View File

@ -35,7 +35,12 @@ module.exports = function(Self) {
fi: data.fi, fi: data.fi,
socialName: data.socialName, socialName: data.socialName,
email: data.email, email: data.email,
salesPersonFk: data.salesPersonFk salesPersonFk: data.salesPersonFk,
postcode: data.postcode,
street: data.street,
city: data.city,
provinceFk: data.provinceFk,
isEqualizated: data.isEqualizated
}; };
newClient = await Self.create(client, {transaction}); newClient = await Self.create(client, {transaction});
await transaction.commit(); await transaction.commit();