refactor
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
facaee6f95
commit
61b0aa079a
|
@ -1,4 +1,16 @@
|
|||
<h3 ng-if="$ctrl.packageInvoicing" translate style="text-align: center;">{{'Calculating packages to invoice...'}}</h3>
|
||||
<vn-card class="vn-w-lg">
|
||||
<h5 ng-if="$ctrl.packageInvoicing" translate text-center class="vn-pa-md">{{'Calculating packages to invoice...'}}</h5>
|
||||
<vn-vertical ng-if="$ctrl.lastClientId" text-center class="vn-pa-md">
|
||||
<h5 translate>Invoicing</h5>
|
||||
<div>
|
||||
{{'Id Client' | translate}}: {{$ctrl.currentClientId}}
|
||||
{{'of' | translate}} {{::$ctrl.lastClientId}}
|
||||
</div>
|
||||
<div>
|
||||
{{($ctrl.percentage / 100) | percentage: 0}}
|
||||
</div>
|
||||
</vn-vertical>
|
||||
</vn-card>
|
||||
<vn-card class="vn-w-lg">
|
||||
<vn-table ng-if="data.length">
|
||||
<vn-thead>
|
||||
|
@ -64,18 +76,6 @@
|
|||
order="code">
|
||||
</vn-crud-model>
|
||||
<form class="vn-pa-md">
|
||||
<vn-vertical text-center
|
||||
class="progress vn-my-sm"
|
||||
ng-if="$ctrl.lastClientId">
|
||||
<h5 class="vn-mb-md vn-mt-lg" translate>Invoicing</h5>
|
||||
<div>
|
||||
{{'Id Client' | translate}}: {{$ctrl.currentClientId}}
|
||||
{{'of' | translate}} {{::$ctrl.lastClientId}}
|
||||
</div>
|
||||
<div>
|
||||
{{($ctrl.percentage / 100) | percentage: 0}}
|
||||
</div>
|
||||
</vn-vertical>
|
||||
<vn-vertical>
|
||||
<vn-date-picker
|
||||
vn-one
|
||||
|
@ -87,39 +87,6 @@
|
|||
label="Max date"
|
||||
ng-model="$ctrl.invoice.maxShipped">
|
||||
</vn-date-picker>
|
||||
<vn-radio
|
||||
label="All clients"
|
||||
val="allClients"
|
||||
ng-model="$ctrl.clientsNumber"
|
||||
ng-click="$ctrl.$onInit()">
|
||||
</vn-radio>
|
||||
<vn-radio
|
||||
label="Clients range"
|
||||
val="clientsRange"
|
||||
ng-model="$ctrl.clientsNumber">
|
||||
</vn-radio>
|
||||
</vn-vertical>
|
||||
<vn-vertical ng-show="$ctrl.clientsNumber == 'clientsRange'">
|
||||
<vn-autocomplete
|
||||
url="Clients"
|
||||
label="From client"
|
||||
search-function="{or: [{id: $search}, {name: {like: '%'+$search+'%'}}]}"
|
||||
order="id"
|
||||
show-field="name"
|
||||
value-field="id"
|
||||
ng-model="$ctrl.invoice.fromClientId">
|
||||
<tpl-item>{{::id}} - {{::name}}</tpl-item>
|
||||
</vn-autocomplete>
|
||||
<vn-autocomplete
|
||||
url="Clients"
|
||||
label="To client"
|
||||
search-function="{or: [{id: $search}, {name: {like: '%'+$search+'%'}}]}"
|
||||
order="id"
|
||||
show-field="name"
|
||||
value-field="id"
|
||||
ng-model="$ctrl.invoice.toClientId">
|
||||
<tpl-item>{{::id}} - {{::name}}</tpl-item>
|
||||
</vn-autocomplete>
|
||||
</vn-vertical>
|
||||
<vn-vertical>
|
||||
<vn-autocomplete
|
||||
|
@ -139,7 +106,6 @@
|
|||
</vn-autocomplete>
|
||||
</vn-vertical>
|
||||
<vn-submit vn-id="invoiceButton" ng-click="$ctrl.makeInvoice()" label="Invoice" class="vn-mt-sm" ></vn-submit>
|
||||
<vn-button ng-click="$ctrl.clean()" label="Clean" class="vn-mt-sm" disabled="!data.length"></vn-button>
|
||||
</form>
|
||||
</vn-side-menu>
|
||||
|
||||
|
|
|
@ -10,8 +10,6 @@ class Controller extends Section {
|
|||
maxShipped: new Date(),
|
||||
companyFk: this.vnConfig.companyFk
|
||||
};
|
||||
this.clientsNumber = 'allClients';
|
||||
this.currentClient = 0;
|
||||
}
|
||||
|
||||
$onInit() {
|
||||
|
@ -45,7 +43,6 @@ class Controller extends Section {
|
|||
}
|
||||
|
||||
restartValues() {
|
||||
this.lastClientId = null;
|
||||
this.$.invoiceButton.disabled = false;
|
||||
this.packageInvoicing = false;
|
||||
}
|
||||
|
@ -100,9 +97,6 @@ class Controller extends Section {
|
|||
if (!this.invoice.invoiceDate || !this.invoice.maxShipped)
|
||||
throw new Error('Invoice date and the max date should be filled');
|
||||
|
||||
if (!this.invoice.fromClientId || !this.invoice.toClientId)
|
||||
throw new Error('Choose a valid clients range');
|
||||
|
||||
if (!this.invoice.companyFk)
|
||||
throw new Error('Choose a valid company');
|
||||
|
||||
|
@ -123,6 +117,7 @@ class Controller extends Section {
|
|||
this.clients = [];
|
||||
for (const clientAndAddress of clientsAndAddresses)
|
||||
this.clients.push(clientAndAddress.clientId);
|
||||
this.currentClient = 0;
|
||||
this.lastClientId = clientsAndAddresses[clientsAndAddresses.length - 1].clientId;
|
||||
|
||||
return this.invoiceOut(invoice, clientsAndAddresses);
|
||||
|
@ -135,10 +130,6 @@ class Controller extends Section {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
clean() {
|
||||
this.$.data = this.$.data.filter(client => client.status == 'error');
|
||||
}
|
||||
}
|
||||
|
||||
Controller.$inject = ['$element', '$scope', '$transclude'];
|
||||
|
|
|
@ -8,7 +8,3 @@ vn-td {
|
|||
color: $color-success;
|
||||
}
|
||||
}
|
||||
|
||||
h5{
|
||||
color: $color-primary;
|
||||
}
|
||||
|
|
|
@ -68,24 +68,13 @@
|
|||
</vn-card>
|
||||
</vn-data-viewer>
|
||||
<div fixed-bottom-right>
|
||||
<vn-vertical style="align-items: center;">
|
||||
<vn-button class="round sm vn-mb-sm"
|
||||
icon="add"
|
||||
ng-click="invoicingOptions.show($event)"
|
||||
ng-click="manualInvoicing.show()"
|
||||
vn-tooltip="Make invoice..."
|
||||
tooltip-position="left"
|
||||
vn-acl="invoicing"
|
||||
vn-acl-action="remove">
|
||||
</vn-button>
|
||||
|
||||
<vn-menu vn-id="invoicingOptions">
|
||||
<vn-item translate
|
||||
name="manualInvoice"
|
||||
ng-click="manualInvoicing.show()">
|
||||
Manual invoicing
|
||||
</vn-item>
|
||||
</vn-menu>
|
||||
</vn-vertical>
|
||||
</div>
|
||||
<vn-popup vn-id="summary">
|
||||
<vn-invoice-out-summary
|
||||
|
|
Loading…
Reference in New Issue