salix/modules/ticket/front/sale/index.html

388 lines
15 KiB
HTML
Raw Normal View History

2018-11-27 14:02:54 +00:00
<vn-crud-model auto-load="false"
2018-07-17 06:44:31 +00:00
vn-id="model"
url="Tickets/{{$ctrl.$stateParams.id}}/getSales"
2018-10-22 06:23:10 +00:00
data="$ctrl.sales">
2018-07-17 06:44:31 +00:00
</vn-crud-model>
<vn-watcher
vn-id="watcher"
data="$ctrl.sales">
</vn-watcher>
2019-11-10 10:08:44 +00:00
<vn-vertical class="vn-w-xl">
<vn-card class="vn-pa-lg">
<vn-vertical>
2019-02-06 10:42:22 +00:00
<vn-horizontal class="header">
<vn-tool-bar class="vn-mb-md">
2019-06-05 11:39:15 +00:00
<vn-button
disabled="!$ctrl.isEditable"
label="Ok"
2019-06-20 11:50:58 +00:00
vn-http-click="$ctrl.onStateOkClick()"
2019-02-06 10:42:22 +00:00
vn-tooltip="Change ticket state to 'Ok'">
</vn-button>
2019-06-05 11:39:15 +00:00
<vn-button-menu
2019-02-06 10:42:22 +00:00
disabled="!$ctrl.isEditable"
label="State"
2019-06-27 07:44:19 +00:00
value-field="id"
url="States/editableStates"
2019-02-06 10:42:22 +00:00
on-change="$ctrl.onStateChange(value)">
</vn-button-menu>
<vn-button-menu
ng-show="$ctrl.isChecked"
vn-id="more-button"
label="More"
show-filter="false"
value-field="callback"
translate-fields="['name']"
on-change="$ctrl.onMoreChange(value)"
on-open="$ctrl.onMoreOpen()">
</vn-button-menu>
<vn-button
disabled="!$ctrl.isChecked || !$ctrl.isEditable"
2019-06-05 11:39:15 +00:00
ng-click="$ctrl.showRemoveLinesDialog()"
vn-tooltip="Remove lines"
2019-02-06 10:42:22 +00:00
icon="delete">
</vn-button>
2019-06-05 11:39:15 +00:00
<vn-button
2019-02-06 10:42:22 +00:00
disabled="!$ctrl.isChecked || !$ctrl.isEditable"
2019-06-05 11:39:15 +00:00
ng-click="$ctrl.showTransferPopover($event);"
vn-tooltip="Transfer lines"
2019-02-06 10:42:22 +00:00
icon="call_split">
</vn-button>
</vn-tool-bar>
<vn-one class="taxes" ng-if="$ctrl.sales.length > 0">
<p><vn-label translate>Subtotal</vn-label> {{$ctrl.subtotal | currency: 'EUR':2}}</p>
2019-02-06 10:42:22 +00:00
<p><vn-label translate>VAT</vn-label> {{$ctrl.VAT | currency: 'EUR':2}}</p>
<p><vn-label><strong>Total</strong></vn-label> <strong>{{$ctrl.total | currency: 'EUR':2}}</strong></p>
</vn-one>
</vn-horizontal>
2018-07-17 06:44:31 +00:00
<vn-table model="model">
<vn-thead>
<vn-tr>
2019-02-20 13:34:16 +00:00
<vn-th shrink>
2019-06-05 11:39:15 +00:00
<vn-multi-check
model="model">
</vn-multi-check>
2018-07-17 06:44:31 +00:00
</vn-th>
2019-02-20 13:34:16 +00:00
<vn-th shrink></vn-th>
<vn-th shrink></vn-th>
2018-07-17 06:44:31 +00:00
<vn-th number>Id</vn-th>
2019-02-20 16:52:36 +00:00
<vn-th>Quantity</vn-th>
2019-02-20 13:34:16 +00:00
<vn-th>Item</vn-th>
2018-07-17 06:44:31 +00:00
<vn-th number>Price</vn-th>
<vn-th number>Disc</vn-th>
<vn-th number>Amount</vn-th>
</vn-tr>
</vn-thead>
<vn-tbody>
2018-10-22 06:23:10 +00:00
<vn-tr ng-repeat="sale in $ctrl.sales">
2019-02-20 13:34:16 +00:00
<vn-td shrink>
<vn-check
2019-10-09 22:47:29 +00:00
ng-model="sale.checked">
</vn-check>
2018-07-17 06:44:31 +00:00
</vn-td>
2019-02-20 13:34:16 +00:00
<vn-td shrink>
<a ui-sref="claim.card.basicData({id: sale.claim.claimFk})">
<vn-icon
ng-show="sale.claim.claimFk"
icon="icon-claims"
vn-tooltip="{{::$ctrl.$translate.instant('Claim')}}: {{::sale.claim.claimFk}}">
</vn-icon>
</a>
2018-07-17 06:44:31 +00:00
<vn-icon
2019-09-06 09:43:15 +00:00
ng-show="sale.visible < 0 || sale.available < 0"
2019-02-08 16:49:51 +00:00
color-main
2018-07-17 11:04:47 +00:00
icon="warning"
2018-09-06 10:33:37 +00:00
vn-tooltip="Visible: {{::sale.visible || 0}} <br> {{::$ctrl.$translate.instant('Available')}}: {{::sale.available || 0}}">
2018-07-17 06:44:31 +00:00
</vn-icon>
2019-01-15 12:22:31 +00:00
<vn-icon ng-show="sale.reserved"
icon="icon-reserve"
vn-tooltip="{{::$ctrl.$translate.instant('Reserved')}}">
</vn-icon>
2018-07-17 06:44:31 +00:00
</vn-td>
<vn-td shrink>
<img
ng-src="{{::$ctrl.imagesPath}}/50x50/{{sale.image}}"
zoom-image="{{::$ctrl.imagesPath}}/1600x900/{{sale.image}}"
on-error-src/>
</vn-td>
2019-09-06 09:43:15 +00:00
<vn-td vn-focus number>
<span class="link" ng-if="sale.itemFk"
ng-click="$ctrl.showDescriptor($event, sale.itemFk)">
{{sale.itemFk | zeroFill:6}}
</span>
<vn-autocomplete
ng-if="!sale.itemFk"
vn-focus
vn-one
url="Items"
2019-10-09 22:47:29 +00:00
ng-model="sale.itemFk"
2019-09-06 09:43:15 +00:00
show-field="name"
value-field="id"
search-function="{or: [{id: $search}, {name: {like: '%' + $search + '%'}}]}"
order="id DESC">
<tpl-item>
{{id}} - {{name}}
</tpl-item>
</vn-autocomplete>
</vn-td>
<vn-td-editable ng-if="sale.id" disabled="!$ctrl.isEditable" number>
<text>{{sale.quantity}}</text>
<field>
2019-10-21 12:21:52 +00:00
<vn-input-number class="dense"
vn-focus
2019-10-09 22:47:29 +00:00
ng-model="sale.quantity"
on-change="$ctrl.onChangeQuantity(sale)">
</vn-input-number>
</field>
</vn-td-editable>
2019-09-06 09:43:15 +00:00
<vn-td ng-if="!sale.id" number>
<vn-input-number
2019-10-09 22:47:29 +00:00
ng-model="sale.quantity"
2019-09-06 09:43:15 +00:00
on-change="$ctrl.onChangeQuantity(sale)">
</vn-input-number>
</vn-td>
<vn-td-editable disabled="!sale.id || !$ctrl.isEditable" expand>
<text>
2019-02-20 16:52:36 +00:00
<vn-fetched-tags
max-length="6"
item="sale.item"
name="sale.concept"
sub-name="sale.subName">
2019-02-20 16:52:36 +00:00
</vn-fetched-tags>
</text>
<field>
2019-10-09 22:47:29 +00:00
<vn-textfield
vn-id="concept"
ng-model="sale.concept"
on-change="$ctrl.updateConcept(sale)">
</vn-textfield>
</field>
</vn-td-editable>
<vn-td number>
<span ng-class="{'link': $ctrl.isEditable}"
title="{{$ctrl.isEditable ? 'Edit price' : ''}}"
ng-click="$ctrl.showEditPricePopover($event, sale)">
{{sale.price | currency: 'EUR':2}}
</span>
</vn-td>
<vn-td number>
<span ng-class="{'link': $ctrl.isEditable}"
title="{{$ctrl.isEditable ? 'Edit discount' : ''}}"
ng-click="$ctrl.showEditDiscountPopover($event, sale)">
2020-01-29 10:09:42 +00:00
{{(sale.discount / 100) | percentage}}
</span>
</vn-td>
<vn-td number>
{{$ctrl.getSaleTotal(sale) | currency: 'EUR':2}}
</vn-td>
</vn-tr>
</vn-tbody>
</vn-table>
<vn-one>
<vn-icon-button vn-none
vn-tooltip="Add item"
vn-bind="+"
icon="add_circle"
ng-click="$ctrl.add()"
disabled="!$ctrl.isEditable">
</vn-icon-button>
</vn-one>
2018-03-22 17:02:48 +00:00
</vn-card>
2019-10-11 15:38:04 +00:00
</vn-vertical>
<vn-float-button
ng-show="$ctrl.isEditable"
ng-click="$ctrl.newOrderFromTicket()"
icon="add"
vn-tooltip="Add item"
vn-bind="+"
fixed-bottom-right>
</vn-float-button>
<vn-item-descriptor-popover
vn-id="descriptor"
quicklinks="$ctrl.quicklinks">
</vn-item-descriptor-popover>
2019-10-11 15:38:04 +00:00
<!-- Edit Price Popover -->
2019-10-26 23:30:01 +00:00
<vn-popover
2019-10-11 15:38:04 +00:00
vn-id="edit-price-popover"
on-open="$ctrl.getManaSalespersonMana()"
on-close="$ctrl.mana = null">
<div class="edit-price">
2019-02-26 16:32:32 +00:00
<vn-spinner
ng-if="$ctrl.mana == null"
style="padding: 1em;"
enable="true">
</vn-spinner>
<div ng-if="$ctrl.mana != null">
<section class="header vn-pa-md">
2019-02-26 16:32:32 +00:00
<h5>MANÁ: {{$ctrl.mana | currency: 'EUR':0}}</h5>
</section>
<div class="vn-pa-md">
2019-05-29 10:41:26 +00:00
<vn-input-number
2019-02-26 16:32:32 +00:00
vn-focus
label="Price"
2019-10-09 22:47:29 +00:00
ng-model="$ctrl.editedPrice"
2019-02-26 16:32:32 +00:00
type="text"
2019-05-29 10:41:26 +00:00
step="0.01"
on-change="$ctrl.updatePrice()"
suffix="€">
2019-05-29 10:41:26 +00:00
</vn-input-number>
2019-02-26 16:32:32 +00:00
<div class="simulator">
<p class="simulatorTitle" translate>New price</p>
<p>{{$ctrl.newPrice | currency: 'EUR':2}}</p>
2019-02-26 16:32:32 +00:00
</div>
</div>
</div>
2019-10-11 15:38:04 +00:00
</div>
</vn-popover>
2019-10-11 15:38:04 +00:00
<!-- Edit Popover -->
2019-10-26 23:30:01 +00:00
<vn-popover
2019-10-11 15:38:04 +00:00
vn-id="edit-popover"
on-open="$ctrl.getManaSalespersonMana()"
on-close="$ctrl.mana = null">
<div class="edit-price">
2019-02-26 16:32:32 +00:00
<vn-spinner
ng-if="$ctrl.mana == null"
style="padding: 1em;"
enable="true">
</vn-spinner>
<vn-ticket-sale-edit-discount
ng-if="$ctrl.mana != null"
mana="$ctrl.mana"
bulk="false"
edit="$ctrl.edit"
on-hide="$ctrl.hideEditPopover()">
</vn-ticket-sale-edit-discount>
2019-10-11 15:38:04 +00:00
</div>
</vn-popover>
2019-10-11 15:38:04 +00:00
<!-- Transfer Popover -->
<vn-popover vn-id="transfer">
<div class="vn-pa-md transfer">
<vn-horizontal>
<vn-one>
<h4 translate>Sales to transfer</h4>
<vn-table>
<vn-thead>
<vn-tr>
<vn-th number shrink>Id</vn-th>
<vn-th>Item</vn-th>
<vn-th number shrink>Quantity</vn-th>
</vn-tr>
</vn-thead>
<vn-tbody>
<vn-tr ng-repeat="sale in $ctrl.transfer.sales">
<vn-td number shrink>{{::sale.itemFk | zeroFill:6}}</vn-td>
<vn-td>
<span title="{{::sale.concept}}">{{::sale.concept}}</span>
</vn-td>
<vn-td-editable number shrink>
<text>{{sale.quantity}}</text>
<field>
<vn-input-number
vn-focus
ng-model="sale.quantity">
</vn-input-number>
</field>
</vn-td-editable>
</vn-tr>
</vn-tbody>
</vn-table>
</vn-one>
<vn-one>
<vn-horizontal>
2019-10-11 15:38:04 +00:00
<h4 vn-one translate>Destination ticket</h4>
<vn-icon vn-none
2019-11-10 10:08:44 +00:00
color-marginal
2019-10-11 15:38:04 +00:00
vn-tooltip="You have to allow pop-ups in your web browser to use this functionality"
icon="info">
</vn-icon>
</vn-horizontal>
2019-10-11 15:38:04 +00:00
<table class="vn-table">
<thead>
<tr>
<th number>Id</th>
<th number>F. envio</th>
<th number>Agencia</th>
<th number>Almacen</th>
</tr>
</thead>
<tbody>
<tr ng-if="$ctrl.transfer.lastActiveTickets.length === 0" >
<td colspan="4" style="text-align: center" translate>No results</td>
</tr>
<tr
class="clickable"
ng-repeat="ticket in $ctrl.transfer.lastActiveTickets track by ticket.id"
ng-click="$ctrl.transferSales(ticket.id)">
<td number>{{::ticket.id}}</td>
<td number>{{::ticket.shipped | date: 'dd/MM/yyyy'}}</td>
2019-10-11 15:38:04 +00:00
<td number>{{::ticket.agencyName}}</td>
<td number>{{::ticket.warehouseName}}</td>
</tr>
</tbody>
</table>
<vn-horizontal class="vn-py-md">
2020-02-10 13:32:52 +00:00
<vn-input-number vn-none
2019-10-11 15:38:04 +00:00
label="Transfer to ticket"
ng-model="$ctrl.transfer.ticketId"
type="number">
2020-02-10 13:32:52 +00:00
</vn-input-number>
<vn-icon-button vn-none
2019-10-11 15:38:04 +00:00
icon="arrow_forward_ios"
ng-click="$ctrl.transferSales($ctrl.transfer.ticketId)">
</vn-icon-button>
</vn-horizontal>
<vn-horizontal class="vn-py-md">
<vn-button
label="New ticket"
ng-click="$ctrl.transferSales()">
</vn-button>
</vn-horizontal>
</vn-one>
</vn-horizontal>
</div>
</vn-popover>
<!-- Edit Dialog -->
<vn-dialog
vn-id="editDialog"
class="edit"
on-open="$ctrl.getManaSalespersonMana()"
on-close="$ctrl.mana = null">
<tpl-body>
<vn-spinner
ng-if="$ctrl.mana == null"
style="padding: 1em;"
enable="true">
</vn-spinner>
<vn-ticket-sale-edit-discount
ng-if="$ctrl.mana != null"
mana="$ctrl.mana"
bulk="true"
edit="$ctrl.edit"
on-hide="$ctrl.hideEditDialog()">
</vn-ticket-sale-edit-discount>
</tpl-body>
</vn-dialog>
<!-- SMS Dialog -->
2020-02-10 08:36:40 +00:00
<vn-ticket-sms
2019-10-11 15:38:04 +00:00
vn-id="sms"
sms="$ctrl.newSMS">
2020-02-10 08:36:40 +00:00
</vn-ticket-sms>
2019-06-05 11:39:15 +00:00
<vn-confirm
vn-id="delete-lines"
question="You are going to delete lines of the ticket"
message="Continue anyway?"
2019-10-30 15:57:14 +00:00
on-response="$ctrl.onRemoveLinesClick($response)">
</vn-confirm>
2019-10-11 15:38:04 +00:00
2019-06-05 11:39:15 +00:00
<vn-confirm
vn-id="delete-ticket"
question="Do you want to delete it?"
message="This ticket is now empty"
2019-10-30 15:57:14 +00:00
on-response="$ctrl.transferSales($ctrl.transfer.ticketId, $response)">
2019-10-11 15:38:04 +00:00
</vn-confirm>