refactor campaing report
gitea/salix/1910-informe_consumo This commit looks good
Details
gitea/salix/1910-informe_consumo This commit looks good
Details
This commit is contained in:
parent
e8ae2f5767
commit
1d73d9f89d
|
@ -70,4 +70,35 @@
|
|||
</div>
|
||||
<!-- SMS Dialog -->
|
||||
<vn-client-sms vn-id="sms" sms="$ctrl.newSMS"></vn-client-sms>
|
||||
<!-- SMS Dialog -->
|
||||
<!-- SMS Dialog -->
|
||||
<vn-dialog
|
||||
vn-id="consumerReportDialog"
|
||||
on-response="$ctrl.sendConsumerReport($response)">
|
||||
<tpl-body>
|
||||
<div>
|
||||
<h5 style="text-align: center">
|
||||
<span translate>From date</span>
|
||||
</h5>
|
||||
<vn-date-picker
|
||||
vn-id="from"
|
||||
vn-one
|
||||
ng-model="$ctrl.from"
|
||||
label="From hour"
|
||||
vn-focus>
|
||||
</vn-date-picker>
|
||||
<h5 style="text-align: center">
|
||||
<span translate>To date</span>
|
||||
</h5>
|
||||
<vn-date-picker
|
||||
vn-id="to"
|
||||
vn-one
|
||||
ng-model="$ctrl.to"
|
||||
label="To date">
|
||||
</vn-date-picker>
|
||||
</div>
|
||||
</tpl-body>
|
||||
<tpl-buttons>
|
||||
<input type="button" response="cancel" translate-attr="{value: 'Cancel'}"/>
|
||||
<button response="accept" translate>Accept</button>
|
||||
</tpl-buttons>
|
||||
</vn-dialog>
|
|
@ -2,12 +2,13 @@ import ngModule from '../module';
|
|||
import Component from 'core/lib/component';
|
||||
|
||||
class Controller extends Component {
|
||||
constructor($element, $) {
|
||||
constructor($element, $, $httpParamSerializer) {
|
||||
super($element, $);
|
||||
|
||||
this.$httpParamSerializer = $httpParamSerializer;
|
||||
this.moreOptions = [
|
||||
{name: 'Simple ticket', callback: this.newTicket},
|
||||
{name: 'Send SMS', callback: this.showSMSDialog},
|
||||
{name: 'Send consumer report', callback: this.showConsumerReportDialog}
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -63,9 +64,22 @@ class Controller extends Component {
|
|||
};
|
||||
this.$.sms.open();
|
||||
}
|
||||
|
||||
showConsumerReportDialog() {
|
||||
this.$.consumerReportDialog.show();
|
||||
}
|
||||
|
||||
sendConsumerReport(response) {
|
||||
if (response === 'accept') {
|
||||
const data = {from: this.from, to: this.to, clientId: this.client.id};
|
||||
const serializedParams = this.$httpParamSerializer(data);
|
||||
const url = `api/report/campaign-metrics?${serializedParams}`;
|
||||
window.open(url);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Controller.$inject = ['$element', '$scope'];
|
||||
Controller.$inject = ['$element', '$scope', '$httpParamSerializer'];
|
||||
|
||||
ngModule.component('vnClientDescriptor', {
|
||||
template: require('./index.html'),
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
Simple ticket: Ticket simple
|
||||
Simple ticket: Ticket simple
|
||||
Sendconsumer report: Enviar informe de consumo
|
|
@ -57,27 +57,39 @@
|
|||
<table class="column-oriented">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="number">{{$t('Code')}}</th>
|
||||
<th>{{$t('Code')}}</th>
|
||||
<th class="number">{{$t('Quantity')}}</th>
|
||||
<th>{{$t('Concept')}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="row-oriented bottom-line">
|
||||
<tr v-for="sale in sales">
|
||||
<td class="number">{{sale.itemFk}}</td>
|
||||
<td class="number">{{Math.trunc(sale.subtotal)}}</td>
|
||||
<td>
|
||||
{{sale.concept}} <span class="font gray">{{sale.subName | uppercase}}</span>
|
||||
<section>
|
||||
<span class="font gray">{{sale.tag5}}</span>
|
||||
<span>{{sale.value5}}</span>
|
||||
<span class="font gray">{{sale.tag6}}</span>
|
||||
<span>{{sale.value6}}</span>
|
||||
<span class="font gray">{{sale.tag7}}</span>
|
||||
<span>{{sale.value7}}</span>
|
||||
</section>
|
||||
</td>
|
||||
</tr>
|
||||
<tbody>
|
||||
<template v-for="sale in sales">
|
||||
<tr class="font bold">
|
||||
<td>{{sale.itemFk}}</td>
|
||||
<td class="number">{{Math.trunc(sale.subtotal)}}</td>
|
||||
<td>{{sale.concept}}</td>
|
||||
</tr>
|
||||
<tr class="description">
|
||||
<td class="centered">
|
||||
<div v-if="sale.value5">
|
||||
<strong class="font gray">{{sale.tag5}}</strong>
|
||||
<span>{{sale.value5}}</span>
|
||||
</div>
|
||||
</td>
|
||||
<td class="centered">
|
||||
<div v-if="sale.value6">
|
||||
<strong class="font gray">{{sale.tag6}}</strong>
|
||||
<span>{{sale.value6}}</span>
|
||||
</div>
|
||||
</td>
|
||||
<td class="centered">
|
||||
<div v-if="sale.value7">
|
||||
<strong class="font gray">{{sale.tag7}}</strong>
|
||||
<span>{{sale.value7}}</span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue