Tarea #383 En ticket.lines mostrar fotos 50x50

This commit is contained in:
gerard 2018-07-11 09:56:07 +02:00
parent 7ecefab8ce
commit 50f4ee85cc
4 changed files with 38 additions and 54 deletions

View File

@ -41,33 +41,39 @@
<table class="vn-grid">
<thead>
<tr>
<th></th>
<th number>
<vn-multi-check
data="$ctrl.sales"
disabled="!$ctrl.isEditable">
</vn-multi-check>
</th>
<th number translate>Item</th>
<th translate>Description</th>
<th></th>
<th style="text-align: center" translate>Item</th>
<th translate>Id</th>
<th style="text-align: center" translate>Description</th>
<th number translate>Quantity</th>
<th number translate>Price</th>
<th number translate>Discount</th>
<th number translate>Disc</th>
<th number translate>Amount</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="sale in $ctrl.sales">
<td>
<vn-icon ng-show="sale.visible" icon="warning" vn-tooltip="Visible: {{::sale.visible}}"></vn-icon>
<vn-icon ng-show="sale.avaible" icon="warning" vn-tooltip="Avaible: {{::sale.avaible}}"></vn-icon>
<vn-icon ng-show="sale.reserved" icon="icon-reserved"></vn-icon>
</td>
<td number>
<vn-check
field="sale.checked"
disabled="!$ctrl.isEditable">
</vn-check>
</td>
<td>
<vn-icon ng-show="sale.visible" icon="warning" vn-tooltip="Visible: {{::sale.visible}}"></vn-icon>
<vn-icon ng-show="sale.avaible" icon="warning" vn-tooltip="Avaible: {{::sale.avaible}}"></vn-icon>
<vn-icon ng-show="sale.reserved" icon="icon-reserved"></vn-icon>
</td>
<td style="text-align: center">
<img
ng-src="//verdnatura.es/vn-image-data/catalog/50x50/{{sale.image}}"
on-error-src/>
</td>
<td
pointer
@ -75,6 +81,7 @@
ng-click="$ctrl.showDescriptor($event, sale.itemFk)">
{{::sale.itemFk}}
</td>
<td><vn-fetched-tags sale="sale"/></td>
<td ng-if="!$ctrl.isEditable" number>{{sale.quantity}}</td>
<td ng-if="$ctrl.isEditable" number>
@ -108,11 +115,11 @@
<td number>{{(sale.quantity * sale.price) - ((sale.discount * (sale.quantity * sale.price))/100) | currency:' €':2}}</td>
</tr>
<tr ng-if="$ctrl.sales.length === 0 || !$ctrl.sales" class="list list-element">
<td colspan="8" style="text-align: center" translate>No results</td>
<td colspan="9" style="text-align: center" translate>No results</td>
</tr>
<tfoot>
<tr>
<td number colspan="8">
<td number colspan="9">
<section>
<p><vn-label translate>Subtotal</vn-label> {{$ctrl.subTotal | currency:' €':2}}</p>
<p><vn-label translate>VAT</vn-label> {{$ctrl.VAT | currency:' €':2}}</p>

View File

@ -27,19 +27,17 @@ class Controller {
});
}
$onChanges() {
if (this.ticket)
if (this.ticket && this.ticket.clientFk)
this.getSales(this.ticket.clientFk);
}
onMoreOpen() {
let options = this.moreOptions.filter(o => o.always || this.isChecked);
this.$.moreButton.data = options;
}
getTaxes() {
this.getSubTotal();
this.getVAT();
}
getSubTotal() {
let sales = this.sales;
@ -48,14 +46,12 @@ class Controller {
this.subTotal += (sale.quantity * sale.price) - ((sale.discount * (sale.quantity * sale.price)) / 100);
});
}
getVAT() {
this.$http.get(`/ticket/api/Tickets/${this.ticket.id}/getVAT`).then(res => {
this.VAT = res.data || 0;
this.total = this.subTotal + this.VAT;
});
}
get isEditable() {
try {
return !this.ticket.tracking.state.alertLevel;
@ -63,7 +59,6 @@ class Controller {
return true;
}
get isChecked() {
let data = this.sales;
if (data)
@ -73,7 +68,6 @@ class Controller {
return false;
}
getCheckedLines() {
let lines = [];
let data = this.sales;
@ -84,11 +78,9 @@ class Controller {
return lines;
}
onMoreChange(callback) {
callback.call(this);
}
// Change State
onStateOkClick() {
let filter = {where: {code: "OK"}, fields: ["id"]};
@ -97,7 +89,6 @@ class Controller {
this.onStateChange(res.data[0].id);
});
}
onStateChange(value) {
let params = {ticketFk: this.$state.params.id, stateFk: value};
this.$http.post(`/ticket/api/TicketTrackings/changeState`, params).then(() => {
@ -105,12 +96,10 @@ class Controller {
this.vnApp.showSuccess(this.translate.instant('Data saved!'));
});
}
// Add Turn
showAddTurnDialog() {
this.$.addTurn.show();
}
addTurn(day) {
let params = {ticketFk: this.$state.params.id, weekDay: day};
this.$http.patch(`/ticket/api/TicketWeeklies`, params).then(() => {
@ -118,24 +107,20 @@ class Controller {
this.vnApp.showSuccess(this.translate.instant('Data saved!'));
});
}
// Delete Ticket
showDeleteTicketDialog() {
this.$.deleteConfirmation.show();
}
returnDeleteTicketDialog(response) {
if (response === 'ACCEPT')
this.deleteTicket();
}
deleteTicket() {
let params = {id: this.$state.params.id};
this.$http.post(`/ticket/api/Tickets/deleted`, params).then(() => {
this.$state.go('ticket.list');
});
}
// Remove Lines
onRemoveLinesClick(response) {
if (response === 'ACCEPT') {
@ -147,17 +132,14 @@ class Controller {
});
}
}
removeInstances(instances) {
for (let i = instances.length - 1; i >= 0; i--) {
this.sales.splice(instances[i].instance, 1);
}
}
showRemoveLinesDialog() {
this.$.deleteLines.show();
}
// Move Lines
showTransferPopover(event) {
let filter = {clientFk: this.ticket.clientFk, ticketFk: this.ticket.id};
@ -169,7 +151,6 @@ class Controller {
this.$.transfer.parent = event.target;
this.$.transfer.show();
}
moveLines(ticketID) {
let sales = this.getCheckedLines();
@ -178,7 +159,6 @@ class Controller {
this.goToTicket(ticketID);
});
}
// In Progress
linesToNewTicket() {
let ticket = {
@ -198,11 +178,9 @@ class Controller {
this.getSales();
});
}
goToTicket(ticketID) {
this.$state.go("ticket.card.sale", {id: ticketID});
}
// Focus First Input
focusFirstInput(e) {
let firstFocusable = e.querySelector('input, textarea');
@ -215,7 +193,6 @@ class Controller {
}, 200);
}
}
// Slesperson Mana
getManaSalespersonMana() {
this.$http.get(`/api/Tickets/${this.$state.params.id}/getSalesPersonMana`).then(res => {
@ -228,11 +205,9 @@ class Controller {
this.$.descriptor.parent = event.target;
this.$.descriptor.show();
}
onDescriptorLoad() {
this.$.popover.relocate();
}
// Edit Line
showEditPricePopover(event, sale) {
this.sale = sale;
@ -246,7 +221,6 @@ class Controller {
this.$.editPricePopover.show();
this.focusFirstInput(this.$.editPricePopover.$element[0]);
}
updatePrice() {
if (this.editedPrice != this.sale.price) {
this.$http.post(`/ticket/api/Sales/updatePrice`, {id: this.edit.id, price: this.editedPrice, ticketFk: this.ticket.id}).then(() => {
@ -256,7 +230,6 @@ class Controller {
}
this.$.editPricePopover.hide();
}
showEditPopover(event, sale) {
this.sale = sale;
this.edit = [{
@ -270,23 +243,19 @@ class Controller {
this.$.editPopover.show();
this.focusFirstInput(this.$.editPopover.$element[0]);
}
showEditDialog() {
this.edit = this.getCheckedLines();
this.$.editDialog.show();
this.focusFirstInput(this.$.editDialog.$element[0]);
}
hideEditDialog() {
this.getSales();
this.$.editDialog.hide();
}
hideEditPopover() {
this.getSales();
this.$.editPopover.hide();
}
updateQuantity(id, quantity) {
this.$http.post(`/ticket/api/Sales/${id}/updateQuantity`, {quantity: parseInt(quantity)}).then(() => {
this.vnApp.showSuccess(this.translate.instant('Data saved!'));

View File

@ -14,3 +14,4 @@ Continue anyway?: ¿Estás seguro?
The new quantity should be smaller than the old one: La nueva cantidad debe de ser menor que la anterior
You have to allow pop-ups in your web browser to use this functionality:
Debes permitir los pop-pups en tu navegador para que esta herramienta funcione correctamente
Disc: Dto

View File

@ -1,25 +1,25 @@
@import "colors";
vn-ticket-sale {
vn-popover.edit {
& div.popover{
div.popover{
width: 200px;
}
& vn-horizontal.header{
vn-horizontal.header{
background-color: $main-01;
& h5{
h5{
color: white;
margin: 0 auto;
}
}
& p.simulatorTitle{
p.simulatorTitle{
margin-bottom: 0px;
font-size: 12px;
color: $main-01;
}
& vn-label-value{
vn-label-value{
padding-bottom: 20px;
}
@ -45,7 +45,7 @@ vn-ticket-sale {
}
vn-ticket-sale{
& tr .mdl-textfield{
tr .mdl-textfield{
width: inherit;
max-width: 100%;
}
@ -63,23 +63,30 @@ vn-ticket-sale {
}
vn-dialog.ticket-create{
& vn-button[label=Cancel]{
vn-button[label=Cancel]{
display: none;
}
& vn-card.vn-ticket-create{
vn-card.vn-ticket-create{
padding: 0!important;
}
}
table {
& vn-textfield {
vn-textfield {
max-width: 100px;
float: right;
margin: 0!important;
input {
text-align: right;
}
}
img {
border-radius: 50%;
}
}
vn-textfield {
& span.filter {
span.filter {
padding-top: 3px;
padding-right: 3px;
color: $main-font-color