Merge branch 'dev' into 2579-worker_time_control
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Bernat Exposito 2020-11-20 12:36:01 +00:00
commit d25dafc6b1
24 changed files with 238 additions and 81 deletions

View File

@ -421,6 +421,10 @@ export default {
moreMenuRestoreTicket: '.vn-menu [name="restoreTicket"]',
moreMenuMakeInvoice: '.vn-menu [name="makeInvoice"]',
moreMenuChangeShippedHour: '.vn-menu [name="changeShipped"]',
moreMenuPaymentSMS: '.vn-menu [name="sendPaymentSms"]',
moreMenuSendImportSms: '.vn-menu [name="sendImportSms"]',
SMStext: 'textarea[name="message"]',
sendSMSbutton: 'button[response="accept"]',
changeShippedHourDialog: '.vn-dialog.shown',
changeShippedHour: '.vn-dialog.shown vn-input-time[ng-model="$ctrl.newShipped"]',
addStowawayDialogFirstTicket: '.vn-dialog.shown vn-table vn-tbody vn-tr',
@ -936,7 +940,7 @@ export default {
},
supplierBasicData: {
alias: 'vn-supplier-basic-data vn-textfield[ng-model="$ctrl.supplier.nickname"]',
isOfficial: 'vn-supplier-basic-data vn-check[ng-model="$ctrl.supplier.isOfficial"]',
isSerious: 'vn-supplier-basic-data vn-check[ng-model="$ctrl.supplier.isSerious"]',
isActive: 'vn-supplier-basic-data vn-check[ng-model="$ctrl.supplier.isActive"]',
notes: 'vn-supplier-basic-data vn-textarea[ng-model="$ctrl.supplier.note"]',
saveButton: 'vn-supplier-basic-data button[type="submit"]',

View File

@ -39,7 +39,7 @@ describe('Ticket descriptor path', () => {
expect(result).toContain('08:15');
});
it('should delete the ticket using the descriptor more menu', async() => {
it('should delete the ticket using the descriptor menu', async() => {
await page.waitToClick(selectors.ticketDescriptor.moreMenu);
await page.waitToClick(selectors.ticketDescriptor.moreMenuDeleteTicket);
await page.waitToClick(selectors.ticketDescriptor.acceptDialog);
@ -64,7 +64,7 @@ describe('Ticket descriptor path', () => {
});
describe('Restore ticket', () => {
it('should restore the ticket using the descriptor more menu', async() => {
it('should restore the ticket using the descriptor menu', async() => {
await page.waitToClick(selectors.ticketDescriptor.moreMenu);
await page.waitToClick(selectors.ticketDescriptor.moreMenuRestoreTicket);
await page.waitToClick(selectors.ticketDescriptor.acceptDialog);
@ -148,7 +148,7 @@ describe('Ticket descriptor path', () => {
expect(result).toEqual('-');
});
it('should invoice the ticket using the descriptor more menu', async() => {
it('should invoice the ticket using the descriptor menu', async() => {
await page.waitToClick(selectors.ticketDescriptor.moreMenu);
await page.waitForContentLoaded();
await page.waitToClick(selectors.ticketDescriptor.moreMenuMakeInvoice);
@ -165,4 +165,30 @@ describe('Ticket descriptor path', () => {
expect(result).toEqual('T4444445');
});
});
describe('SMS', () => {
it('should send the payment SMS using the descriptor menu', async() => {
await page.waitToClick(selectors.ticketDescriptor.moreMenu);
await page.waitForContentLoaded();
await page.waitToClick(selectors.ticketDescriptor.moreMenuPaymentSMS);
await page.waitForSelector(selectors.ticketDescriptor.SMStext);
await page.waitPropertyLength(selectors.ticketDescriptor.SMStext, 'value', 128);
await page.waitToClick(selectors.ticketDescriptor.sendSMSbutton);
const message = await page.waitForSnackbar();
expect(message.text).toContain('SMS sent!');
});
it('should send the import SMS using the descriptor menu', async() => {
await page.waitToClick(selectors.ticketDescriptor.moreMenu);
await page.waitForContentLoaded();
await page.waitToClick(selectors.ticketDescriptor.moreMenuSendImportSms);
await page.waitForSelector(selectors.ticketDescriptor.SMStext);
await page.waitPropertyLength(selectors.ticketDescriptor.SMStext, 'value', 144);
await page.waitToClick(selectors.ticketDescriptor.sendSMSbutton);
const message = await page.waitForSnackbar();
expect(message.text).toContain('SMS sent!');
});
});
});

View File

@ -20,7 +20,7 @@ describe('Supplier basic data path', () => {
it('should edit the basic data', async() => {
await page.clearInput(selectors.supplierBasicData.alias);
await page.write(selectors.supplierBasicData.alias, 'Plants Nick SL');
await page.waitToClick(selectors.supplierBasicData.isOfficial);
await page.waitToClick(selectors.supplierBasicData.isSerious);
await page.waitToClick(selectors.supplierBasicData.isActive);
await page.write(selectors.supplierBasicData.notes, 'Some notes');
@ -40,8 +40,8 @@ describe('Supplier basic data path', () => {
expect(result).toEqual('Plants Nick SL');
});
it('should check the isOffical checkbox is now unchecked', async() => {
const result = await page.checkboxState(selectors.supplierBasicData.isOfficial);
it('should check the isSerious checkbox is now unchecked', async() => {
const result = await page.checkboxState(selectors.supplierBasicData.isSerious);
expect(result).toBe('unchecked');
});

View File

@ -79,13 +79,20 @@
</vn-quick-link>
</div>
<div ng-transclude="btnTwo">
<vn-quick-link
tooltip="Client invoices list"
state="['invoiceOut.index', {q: $ctrl.filter}]"
icon="icon-invoices">
</vn-quick-link>
</div>
<div ng-transclude="btnThree">
<vn-quick-link
tooltip="New order"
state="['order.create', {clientFk: $ctrl.id}]"
icon="icon-basketadd">
</vn-quick-link>
</div>
<div ng-transclude="btnThree">
<div ng-transclude="btnFour">
<vn-quick-link
tooltip="Go to user"
state="['account.card.summary', {id: $ctrl.id}]"

View File

@ -3,3 +3,4 @@ View consumer report: Ver informe de consumo
From date: Fecha desde
To date: Fecha hasta
Go to user: Ir al usuario
Client invoices list: Listado de facturas del cliente

View File

@ -8,6 +8,14 @@ export default class Controller extends Section {
const hasContactData = this.client.email || this.client.phone || this.client.mobile;
const hasChangedTaxData = !orgData.isTaxDataChecked && this.client.isTaxDataChecked;
const shouldInvoice = this.client.isActive && !this.client.hasToInvoice;
const clientActivation = this.client.isActive && (orgData.isActive != this.client.isActive);
if (shouldInvoice && clientActivation) {
this.client.hasToInvoice = true;
this.vnApp.showMessage(this.$t('Client invoices enabled'));
}
if (hasChangedTaxData && hasContactData)
this.checkExistingClient();
else this.save();

View File

@ -50,6 +50,16 @@ describe('Client', () => {
expect(controller.save).not.toHaveBeenCalledWith();
expect(controller.checkExistingClient).toHaveBeenCalledWith();
});
it('should enable the hasToInvoice property any time the form activates the client with isActive', () => {
$scope.watcher.orgData.isActive = false;
controller.client.isActive = true;
controller.client.hasToInvoice = false;
controller.onSubmit();
expect(controller.client.hasToInvoice).toBe(true);
});
});
describe('checkExistingClient()', () => {

View File

@ -25,7 +25,7 @@ module.exports = Self => {
'id',
'name',
'nickname',
'isOfficial',
'isSerious',
'isActive',
'note',
'nif',
@ -39,6 +39,9 @@ module.exports = Self => {
'payDay',
'account',
'isFarmer',
'sageTaxTypeFk',
'sageTransactionTypeFk',
'sageWithholdingFk',
],
include: [
{
@ -64,10 +67,27 @@ module.exports = Self => {
scope: {
fields: ['id', 'payDem']
}
},
{
relation: 'sageTaxType',
scope: {
fields: ['id', 'vat']
}
},
{
relation: 'sageTransactionType',
scope: {
fields: ['id', 'transaction']
}
},
{
relation: 'sageWithholding',
scope: {
fields: ['id', 'withholding']
}
}
]
};
let supplier = await Self.app.models.Supplier.findOne(filter);
return supplier;
};

View File

@ -1,6 +1,10 @@
{
"name": "SupplierContact",
"base": "VnModel",
"base": "Loggable",
"log": {
"model":"SupplierLog",
"relation": "supplier"
},
"options": {
"mysql": {
"table": "supplierContact"

View File

@ -51,6 +51,9 @@
"isOfficial": {
"type": "Boolean"
},
"isSerious": {
"type": "Boolean"
},
"note": {
"type": "String"
},
@ -123,7 +126,22 @@
"model": "Client",
"foreignKey": "nif",
"primaryKey": "fi"
}
},
"sageTaxType": {
"type": "belongsTo",
"model": "SageTaxType",
"foreignKey": "sageTaxTypeFk"
},
"sageTransactionType": {
"type": "belongsTo",
"model": "SageTransactionType",
"foreignKey": "sageTransactionTypeFk"
},
"sageWithholding": {
"type": "belongsTo",
"model": "SageWithholding",
"foreignKey": "sageWithholdingFk"
}
},
"acls": [
{

View File

@ -18,8 +18,8 @@
</vn-horizontal>
<vn-horizontal>
<vn-check
label="Official"
ng-model="$ctrl.supplier.isOfficial">
label="Verified"
ng-model="$ctrl.supplier.isSerious">
</vn-check>
<vn-check
label="Active"

View File

@ -1,3 +1,3 @@
Notes: Notas
Active: Activo
Official: Oficial
Verified: Verificado

View File

@ -34,7 +34,7 @@
rule="SupplierContact">
</vn-textfield>
<vn-textfield
vn-one
vn-two
label="Email"
ng-model="contact.email"
rule="SupplierContact">

View File

@ -29,9 +29,9 @@
ng-class="{bright: $ctrl.supplier.isActive == false}">
</vn-icon>
<vn-icon
vn-tooltip="Official supplier"
icon="icon-net"
ng-class="{bright: $ctrl.supplier.isOfficial == false}">
vn-tooltip="Verified supplier"
icon="verified_user"
ng-class="{bright: $ctrl.supplier.isSerious == true}">
</vn-icon>
</div>
<div class="quicklinks">

View File

@ -40,7 +40,7 @@ class Controller extends Descriptor {
'payDemFk',
'payDay',
'isActive',
'isOfficial',
'isSerious',
'account'
],
include: [

View File

@ -26,7 +26,7 @@ describe('Supplier Component vnSupplierDescriptor', () => {
'payDemFk',
'payDay',
'isActive',
'isOfficial',
'isSerious',
'account'
],
include: [

View File

@ -1,5 +1,5 @@
Tax number: NIF / CIF
All entries with current supplier: Todas las entradas con el proveedor actual
Go to client: Ir al cliente
Official supplier: Proveedor oficial
Verified supplier: Proveedor verificado
Inactive supplier: Proveedor inactivo

View File

@ -90,6 +90,15 @@
rule>
</vn-autocomplete>
</vn-horizontal>
<vn-horizontal>
<vn-textfield
vn-one
label="Street"
ng-model="$ctrl.supplier.street"
rule
vn-focus>
</vn-textfield>
</vn-horizontal>
<vn-horizontal>
<vn-datalist vn-one
label="Postcode"

View File

@ -54,7 +54,7 @@
</div>
</vn-card>
</vn-data-viewer>
<vn-popup vn-id="dialog-summary-client">
<vn-popup vn-id="dialog-summary-supplier">
<vn-supplier-summary
supplier="$ctrl.supplierSelected">
</vn-supplier-summary>

View File

@ -1,7 +1,16 @@
import ngModule from '../module';
import Section from 'salix/components/section';
export default class Controller extends Section {}
export default class Controller extends Section {
openSummary(supplier, event) {
if (event.defaultPrevented) return;
event.preventDefault();
event.stopPropagation();
this.supplierSelected = supplier;
this.$.dialogSummarySupplier.show();
}
}
ngModule.vnComponent('vnSupplierIndex', {
template: require('./index.html'),

View File

@ -1,8 +1,7 @@
<vn-crud-model
vn-id="model"
url="Suppliers/filter"
limit="20"
auto-load="true">
limit="20">
</vn-crud-model>
<vn-portal slot="topbar">
<vn-searchbar

View File

@ -1,65 +1,50 @@
<vn-card class="summary">
<h5>{{$ctrl.summary.name}} - {{$ctrl.summary.id}}</h5>
<h5>{{::$ctrl.summary.name}} - {{::$ctrl.summary.id}}</h5>
<vn-horizontal>
<vn-one>
<h4 translate>Basic data</h4>
<vn-label-value label="Id"
value="{{$ctrl.summary.id}}">
</vn-label-value>
<vn-label-value label="Alias"
value="{{$ctrl.summary.nickname}}">
</vn-label-value>
<vn-check
label="Is official"
ng-model="$ctrl.summary.isOfficial"
disabled="true">
</vn-check>
<vn-check
label="Is active"
ng-model="$ctrl.summary.isActive"
disabled="true">
</vn-check>
<vn-label-value label="Notes"
value="{{$ctrl.summary.note}}">
</vn-label-value>
</vn-one>
<vn-one>
<h4 translate>Fiscal address</h4>
<vn-label-value label="Social name"
value="{{$ctrl.summary.name}}">
</vn-label-value>
<vn-label-value label="Tax number"
value="{{$ctrl.summary.nif}}">
</vn-label-value>
<vn-label-value label="Street" ellipsize="false"
value="{{$ctrl.summary.street}}">
</vn-label-value>
<vn-label-value label="City"
value="{{$ctrl.summary.city}}">
</vn-label-value>
<vn-label-value label="Postcode"
value="{{$ctrl.summary.postCode}}">
</vn-label-value>
<vn-label-value label="Province"
value="{{$ctrl.summary.province.name}}">
</vn-label-value>
<vn-label-value label="Country"
value="{{$ctrl.summary.country.country}}">
</vn-label-value>
<vn-vertical>
<vn-label-value
label="Id"
value="{{::$ctrl.summary.id}}">
</vn-label-value>
<vn-label-value
label="Alias"
value="{{::$ctrl.summary.nickname}}">
</vn-label-value>
<vn-check
label="Verified"
ng-model="$ctrl.summary.isSerious"
disabled="true">
</vn-check>
<vn-check
label="Is active"
ng-model="$ctrl.summary.isActive"
disabled="true">
</vn-check>
<vn-label-value
label="Notes"
value="{{::$ctrl.summary.note}}">
</vn-label-value>
</vn-vertical>
</vn-one>
<vn-one>
<h4 translate>Billing data</h4>
<vn-label-value label="Pay method"
value="{{$ctrl.summary.payMethod.name}}">
<vn-label-value
label="Pay method"
value="{{::$ctrl.summary.payMethod.name}}">
</vn-label-value>
<vn-label-value label="Payment deadline"
value="{{$ctrl.summary.payDem.payDem}}">
<vn-label-value
label="Payment deadline"
value="{{::$ctrl.summary.payDem.payDem}}">
</vn-label-value>
<vn-label-value label="Pay day"
value="{{$ctrl.summary.payDay}}">
<vn-label-value
label="Pay day"
value="{{::$ctrl.summary.payDay}}">
</vn-label-value>
<vn-label-value label="Account"
value="{{$ctrl.summary.account}}">
<vn-label-value
label="Account"
value="{{::$ctrl.summary.account}}">
</vn-label-value>
<vn-check
label="Is Farmer"
@ -68,6 +53,58 @@
</vn-check>
</vn-one>
</vn-horizontal>
<vn-horizontal>
<vn-one>
<h4 translate>Fiscal data</h4>
<vn-label-value
label="Sage tax type"
value="{{::$ctrl.summary.sageTaxType.vat}}">
</vn-label-value>
<vn-label-value
title="{{::$ctrl.summary.sageTransactionType.transaction}}"
label="Sage transaction type"
value="{{::$ctrl.summary.sageTransactionType.transaction}}">
</vn-label-value>
<vn-label-value
title="{{::$ctrl.summary.sageWithholding.withholding}}"
label="Sage withholding"
value="{{::$ctrl.summary.sageWithholding.withholding}}">
</vn-label-value>
</vn-one>
</vn-horizontal>
<vn-horizontal>
<vn-one>
<h4 translate>Fiscal address</h4>
<vn-label-value
label="Social name"
value="{{::$ctrl.summary.name}}">
</vn-label-value>
<vn-label-value
label="Tax number"
value="{{::$ctrl.summary.nif}}">
</vn-label-value>
<vn-label-value
label="Street"
value="{{::$ctrl.summary.street}}">
</vn-label-value>
<vn-label-value
label="City"
value="{{::$ctrl.summary.city}}">
</vn-label-value>
<vn-label-value
label="Postcode"
value="{{::$ctrl.summary.postCode}}">
</vn-label-value>
<vn-label-value
label="Province"
value="{{::$ctrl.summary.province.name}}">
</vn-label-value>
<vn-label-value
label="Country"
value="{{::$ctrl.summary.country.country}}">
</vn-label-value>
</vn-one>
</vn-horizontal>
</vn-card>
<vn-worker-descriptor-popover
vn-id="workerDescriptor">

View File

@ -1,5 +1,8 @@
Is official: Es oficial
Verified: Verificado
Country: País
Tax number: NIF / CIF
Search suppliers by id, name or alias: Busca proveedores por id, nombre o alias
Is Farmer: Es agrícola
Sage tax type: Tipo de impuesto Sage
Sage transaction type: Tipo de transacción Sage
Sage withholding: Retencion Sage

View File

@ -46,11 +46,13 @@
</vn-item>
<vn-item
ng-click="$ctrl.sendPaymentSms()"
name="sendPaymentSms"
translate>
SMS Pending payment
</vn-item>
<vn-item
ng-click="$ctrl.sendImportSms()"
name="sendImportSms"
translate>
SMS Minimum import
</vn-item>