Client summary updated

This commit is contained in:
Joan Sanchez 2018-03-05 10:56:51 +01:00
parent 03cc30d680
commit 24abbffba7
6 changed files with 266 additions and 49 deletions

View File

@ -1,4 +1,5 @@
Since: Desde
Employee: Empleado
No results: Sin resultados
To: Hasta
To: Hasta
Recovery: Recobros

View File

@ -2,45 +2,154 @@
<vn-card class="summary">
<vn-vertical pad-medium>
<vn-auto>
<h5 text-center pad-small-v class="tittle">{{$ctrl.client.name}} - {{$ctrl.client.id}} - {{$ctrl.client.salesPerson.name}}</h5>
<h5 text-center pad-small-v class="tittle">{{$ctrl.summary.name}} - {{$ctrl.summary.id}} - {{$ctrl.summary.salesPerson.name}}</h5>
</vn-auto>
<vn-horizontal vn-one>
<vn-one margin-medium>
<h5 translate>Basic data</h5>
<p><span translate>Commercial name</span>: <b>{{$ctrl.client.name}}</b></p>
<p><span translate>Contact</span>: <b>{{$ctrl.client.contact}}</b></p>
<p><span translate>Phone</span>: <b>{{$ctrl.client.phone}}</b></p>
<p><span translate>Mobile</span>: <b>{{$ctrl.client.mobile}}</b></p>
<p><span translate>Email</span>: <b>{{$ctrl.client.email}}</b></p>
<p><span translate>Salesperson</span>: <b>{{$ctrl.client.salesPerson}}</b></p>
<p><span translate>Channel</span>: <b>{{$ctrl.client.contactChannel}}</b></p>
<p><vn-label translate>Comercial Name</vn-label> {{$ctrl.summary.name}}</p>
<p><vn-label translate>Contact</vn-label> {{$ctrl.summary.contact}}</p>
<p><vn-label translate>Phone</vn-label> {{$ctrl.summary.phone}}</p>
<p><vn-label translate>Mobile</vn-label> {{$ctrl.summary.mobile}}</p>
<p><vn-label translate>Email</vn-label> {{$ctrl.summary.email}}</p>
<p><vn-label translate>Salesperson</vn-label> {{$ctrl.summary.salesPerson.name}}</p>
<p><vn-label translate>Channel</vn-label> {{$ctrl.summary.contactChannel.name}}</p>
</vn-one>
<vn-one margin-medium>
<h5 translate>Fiscal data</h5>
<p><span translate>Social name</span>: <b>{{$ctrl.client.socialName}}</b></p>
<p><span translate>NIF / CIF</span>: <b>{{$ctrl.client.fi}}</b></p>
<p><span translate>Fiscal address</span>: <b>{{$ctrl.client.street}}</b></p>
<p><span translate>City</span>: <b>{{$ctrl.client.city}}</b></p>
<p><span translate>Postcode</span>: <b>{{$ctrl.client.postcode}}</b></p>
<p><span translate>Province</span>: <b>{{$ctrl.client.province}}</b></p>
<p><span translate>Country</span>: <b>{{$ctrl.client.country}}</b></p>
<p><vn-label translate>Social name</vn-label> {{$ctrl.summary.socialName}}</p>
<p><vn-label translate>NIF / CIF</vn-label> {{$ctrl.summary.fi}}</p>
<p><vn-label translate>Street</vn-label> {{$ctrl.summary.street}}</p>
<p><vn-label translate>City</vn-label> {{$ctrl.summary.city}}</p>
<p><vn-label translate>Postcode</vn-label> {{$ctrl.summary.postcode}}</p>
<p><vn-label translate>Province</vn-label> {{$ctrl.summary.province.name}}</p>
<p><vn-label translate>Country</vn-label> {{$ctrl.summary.country.country}}</p>
<p>
<vn-check
label="Is equalizated"
field="$ctrl.summary.isEqualizated"
disabled="true">
</vn-check>
</p>
<p>
<vn-check
label="Active"
field="$ctrl.summary.isActive"
disabled="true">
</vn-check>
</p>
<p>
<vn-check
label="Invoice by address"
field="$ctrl.summary.hasToInvoiceByAddress"
disabled="true">
</vn-check>
</p>
<p>
<vn-check
label="Verified data"
field="$ctrl.summary.isTaxDataChecked"
disabled="true">
</vn-check>
</p>
<p>
<vn-check
label="Has to invoice"
field="$ctrl.summary.hasToInvoice"
disabled="true">
</vn-check>
</p>
<p>
<vn-check
label="Invoice by mail"
field="$ctrl.summary.isToBeMailed"
disabled="true">
</vn-check>
</p>
<p>
<vn-check
label="Vies"
field="$ctrl.summary.isVies"
disabled="true">
</vn-check>
</p>
</vn-one>
<vn-one margin-medium>
<h5 translate>Pay method</h5>
<p><span translate>Pay method</span>: <b>{{$ctrl.client.payMethodFk}}</b></p>
<p><vn-label translate>Pay method</vn-label> {{$ctrl.summary.payMethod.name}}</p>
<p><vn-label translate>IBAN</vn-label> {{$ctrl.summary.iban}}</p>
<p><vn-label translate>Due day</vn-label> {{$ctrl.summary.dueDay}}</p>
<p>
<vn-check
label="Received core VNH"
field="$ctrl.summary.hasCoreVnh"
disabled="true">
</vn-check>
</p>
<p>
<vn-check
label="Received core VNL"
field="$ctrl.summary.hasCoreVnl"
disabled="true">
</vn-check>
</p>
<p>
<vn-check
label="Received B2B VNL"
field="$ctrl.summary.hasSepaVnl"
disabled="true">
</vn-check>
</p>
</vn-one>
</vn-horizontal>
<vn-horizontal vn-one>
<vn-one margin-medium>
<h5 translate>Address</h5>
<h5 translate>Default address</h5>
<p>{{$ctrl.address.nickname}}</p>
<p><span>{{$ctrl.address.street}}</span></p>
<p><span>{{$ctrl.address.city}}</span></p>
</vn-one>
<vn-one margin-medium>
<h5 translate>Credit</h5>
<h5 translate>Web access</h5>
<p><vn-label translate>User</vn-label> {{$ctrl.summary.account.name}}</p>
<p>
<vn-check
label="Enable web access"
field="$ctrl.summary.account.active"
disabled="true">
</vn-check>
</p>
</vn-one>
<vn-one margin-medium>
<h5 translate>Greuge</h5>
<h5 translate>Recovery</h5>
<vn-vertical ng-if="$ctrl.recovery">
<p><vn-label translate>Since</vn-label> {{$ctrl.recovery.started}}</p>
<p><vn-label translate>To</vn-label> {{$ctrl.recovery.finished}}</p>
<p><vn-label translate>Amount</vn-label> {{$ctrl.recovery.amount | currency:'€':2}}</p>
<p><vn-label translate>Period</vn-label> {{$ctrl.recovery.period}}</p>
</vn-vertical>
</vn-one>
</vn-horizontal>
<vn-horizontal vn-one>
<vn-one margin-medium>
<h5 translate>Total greuge</h5>
<p><vn-label translate>Total</vn-label> {{$ctrl.greuge.sumAmount | currency:'€':2}}</p>
</vn-one>
<vn-one margin-medium>
<h5 translate>Credit</h5>
<p>
<vn-label translate>Credit</vn-label>
{{$ctrl.summary.credit | currency:'€':2}}
</p>
<p>
<vn-label translate>Secured credit</vn-label>
<b ng-if="!$ctrl.summary.creditInsurance">-</b>
<b ng-if="$ctrl.summary.creditInsurance">{{$ctrl.summary.creditInsurance | currency:'€':2}}
</p>
</vn-one>
</vn-horizontal>
</vn-vertical>
</vn-card>
</vn-vertical>

View File

@ -1,24 +1,92 @@
import ngModule from '../module';
class ClientSummary {
constructor($http) {
this.$http = $http;
}
getRelations() {
let filter = {
include: ['account', 'salesPerson', 'province']
};
let url = `/client/api/Clients/${this.client.id}?filter=${JSON.stringify(filter)}`;
this.$http.get(encodeURIComponent(url)).then(res => {
if (res.data)
this.client = res.data;
set client(value) {
if (!value)
return;
let filter = {
include: [
{
relation: 'account',
scope: {
fields: ['name', 'active']
}
},
{
relation: 'salesPerson',
scope: {
fields: ['name']
}
},
{
relation: 'country',
scope: {
fields: ['country']
}
},
{
relation: 'province',
scope: {
fields: ['name']
}
},
{
relation: 'contactChannel',
scope: {
fields: ['name']
}
},
{
relation: 'payMethod',
scope: {
fields: ['name']
}
},
{
relation: 'addresses',
scope: {
where: {isDefaultAddress: true},
fields: ['nickname', 'street', 'city', 'postalCode']
}
}
]
};
let clientSummary = `/client/api/Clients/${value.id}?filter=${JSON.stringify(filter)}`;
this.$http.get(encodeURIComponent(clientSummary)).then(res => {
if (res.data) {
this.summary = res.data;
this.address = res.data.addresses[0];
}
});
let greugeSum = `/client/api/Greuges/${value.id}/sumAmount`;
this.$http.get(encodeURIComponent(greugeSum)).then(res => {
if (res.data)
this.greuge = res.data;
});
let recoveryFilter = {
where: {
and: [{clientFk: value.id}, {or: [{finished: null}, {finished: {gt: Date.now()}}]}]
},
limit: 1
};
let recovery = `/client/api/Recoveries?filter=${JSON.stringify(recoveryFilter)}`;
this.$http.get(encodeURIComponent(recovery)).then(res => {
if (res.data)
this.recovery = res.data[0];
});
}
$onChanges(changesObj) {
if (this.client && this.client.id && !this.client.salesPerson) {
this.getRelations();
}
}
}
ClientSummary.$inject = ['$http'];

View File

@ -0,0 +1,2 @@
Default address: Consignatario pred.
Total greuge: Greuge total

View File

@ -3,6 +3,7 @@
.summary{
h5 {
border-bottom: 2px solid $color-orange;
margin: 0 0 5px 0
}
h5.tittle {
border: none;
@ -10,24 +11,55 @@
color: $color-white;
}
p {
margin: 0 0 5px 0;
margin: 0 0 5px 0
}
p:after {
content: ' ';
overflow: hidden;
display: block;
clear: both
}
}
.vn-dialog.dialog-summary {
vn-card {
border: none;
box-shadow: none;
}
.vn-dialog.dialog-summary > div {
border: none;
background: transparent;
box-shadow: none;
}
.vn-dialog.dialog-summary > div > button.close > vn-icon {
color: $color-orange;
}
.vn-dialog.dialog-summary tpl-body {
width:auto;
background-color: transparent;
}
.vn-dialog.dialog-summary form {
min-width: 680px;
margin-left: -20px;
vn-vertical {
padding: 0 !important
}
& > div > button.close > vn-icon {
color: $color-orange;
}
& > div {
padding: 0
}
tpl-body {
width:auto;
background-color: transparent;
padding: 0 2em
}
.body {
overflow: auto;
margin-top: 2em;
max-height: 700px;
}
form {
min-width: 680px;
}
.buttons {
margin: 0
}
vn-check label span {
font-size: .9em
}
}

View File

@ -147,6 +147,11 @@
"type": "hasMany",
"model": "Address",
"foreignKey": "clientFk"
},
"greuge": {
"type": "hasMany",
"model": "Greuge",
"foreignKey": "clientFk"
}
}
}