Merge branch '1910-informe_consumo' of verdnatura/salix into dev
gitea/salix/dev This commit looks good Details

This commit is contained in:
Joan Sanchez 2020-02-11 12:58:28 +00:00 committed by Gitea
commit cbc5ea7a00
4 changed files with 80 additions and 22 deletions

View File

@ -70,4 +70,35 @@
</div> </div>
<!-- SMS Dialog --> <!-- SMS Dialog -->
<vn-client-sms vn-id="sms" sms="$ctrl.newSMS"></vn-client-sms> <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>

View File

@ -2,12 +2,13 @@ import ngModule from '../module';
import Component from 'core/lib/component'; import Component from 'core/lib/component';
class Controller extends Component { class Controller extends Component {
constructor($element, $) { constructor($element, $, $httpParamSerializer) {
super($element, $); super($element, $);
this.$httpParamSerializer = $httpParamSerializer;
this.moreOptions = [ this.moreOptions = [
{name: 'Simple ticket', callback: this.newTicket}, {name: 'Simple ticket', callback: this.newTicket},
{name: 'Send SMS', callback: this.showSMSDialog}, {name: 'Send SMS', callback: this.showSMSDialog},
{name: 'Send consumer report', callback: this.showConsumerReportDialog}
]; ];
} }
@ -63,9 +64,22 @@ class Controller extends Component {
}; };
this.$.sms.open(); 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', { ngModule.component('vnClientDescriptor', {
template: require('./index.html'), template: require('./index.html'),

View File

@ -1 +1,2 @@
Simple ticket: Ticket simple Simple ticket: Ticket simple
Send consumer report: Enviar informe de consumo

View File

@ -57,27 +57,39 @@
<table class="column-oriented"> <table class="column-oriented">
<thead> <thead>
<tr> <tr>
<th class="number">{{$t('Code')}}</th> <th>{{$t('Code')}}</th>
<th class="number">{{$t('Quantity')}}</th> <th class="number">{{$t('Quantity')}}</th>
<th>{{$t('Concept')}}</th> <th>{{$t('Concept')}}</th>
</tr> </tr>
</thead> </thead>
<tbody class="row-oriented bottom-line"> <tbody>
<tr v-for="sale in sales"> <template v-for="sale in sales">
<td class="number">{{sale.itemFk}}</td> <tr class="font bold">
<td class="number">{{Math.trunc(sale.subtotal)}}</td> <td>{{sale.itemFk}}</td>
<td> <td class="number">{{Math.trunc(sale.subtotal)}}</td>
{{sale.concept}} <span class="font gray">{{sale.subName | uppercase}}</span> <td>{{sale.concept}}</td>
<section> </tr>
<span class="font gray">{{sale.tag5}}</span> <tr class="description">
<span>{{sale.value5}}</span> <td class="centered">
<span class="font gray">{{sale.tag6}}</span> <div v-if="sale.value5">
<span>{{sale.value6}}</span> <strong class="font gray">{{sale.tag5}}</strong>
<span class="font gray">{{sale.tag7}}</span> <span>{{sale.value5}}</span>
<span>{{sale.value7}}</span> </div>
</section> </td>
</td> <td class="centered">
</tr> <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> </tbody>
</table> </table>
</div> </div>