2744-invoiceIn-module_rdy_n_summary #602

Merged
joan merged 10 commits from 2744-invoiceIn-module_rdy_n_summary into dev 2021-04-15 10:06:35 +00:00
7 changed files with 129 additions and 38 deletions
Showing only changes of commit 38f43eca3b - Show all commits

View File

@ -0,0 +1,84 @@
<mg-ajax path="InvoiceIns/{{patch.params.id}}" options="vnPatch"></mg-ajax>
<vn-watcher
vn-id="watcher"
data="$ctrl.invoiceIn"
form="form"
save="patch">
</vn-watcher>
<form name="form" ng-submit="watcher.submit()" class="vn-w-md">
<vn-card class="vn-pa-lg">
<vn-horizontal>
<vn-date-picker
vn-one
label="Expedition date"
ng-model="$ctrl.invoiceIn.issued">
</vn-date-picker>
<vn-date-picker
vn-one
label="Operation date"
ng-model="$ctrl.invoiceIn.operated">
</vn-date-picker>
</vn-horizontal>
<vn-horizontal>
<vn-autocomplete
vn-one
ng-model="$ctrl.invoiceIn.supplierFk"
url="Suppliers"
show-field="nickname"
search-function="{or: [{id: $search}, {nickname: {like: '%'+ $search +'%'}}]}"
value-field="id"
order="nickname"
label="Supplier"
required="true">
<tpl-item>
{{::id}} - {{::nickname}}
</tpl-item>
</vn-autocomplete>
<vn-textfield
label="Supplier ref"
ng-model="$ctrl.invoiceIn.supplierRef">
</vn-textfield>
</vn-horizontal>
<vn-horizontal>
<vn-date-picker
vn-one
label="Entry date"
ng-model="$ctrl.invoiceIn.bookEntried">
</vn-date-picker>
<vn-date-picker
vn-one
label="Accounted date"
ng-model="$ctrl.invoiceIn.booked">
</vn-date-picker>
</vn-horizontal>
<vn-horizontal>
<vn-autocomplete
vn-one
label="Currency"
ng-model="$ctrl.invoiceIn.currencyFk"
url="Currencies"
show-field="name"
value-field="id">
</vn-autocomplete>
<vn-autocomplete
url="Companies"
label="Company"
show-field="code"
value-field="id"
ng-model="$ctrl.invoiceIn.companyFk">
</vn-autocomplete>
</vn-horizontal>
</vn-card>
<vn-button-bar>
<vn-submit
disabled="!watcher.dataChanged()"
label="Save">
</vn-submit>
<vn-button
class="cancel"
label="Undo changes"
disabled="!watcher.dataChanged()"
ng-click="watcher.loadOriginalData()">
</vn-button>
</vn-button-bar>
</form>

View File

@ -0,0 +1,10 @@
import ngModule from '../module';
import Section from 'salix/components/section';
ngModule.vnComponent('vnInvoiceInBasicData', {
template: require('./index.html'),
controller: Section,
bindings: {
invoiceIn: '<'
}
});

View File

@ -10,6 +10,9 @@ class Controller extends ModuleCard {
}, },
{ {
relation: 'invoiceInDueDay' relation: 'invoiceInDueDay'
},
{
relation: 'company'
} }
]}; ]};

View File

@ -3,7 +3,12 @@ import './index.js';
describe('vnInvoiceIn', () => { describe('vnInvoiceIn', () => {
let controller; let controller;
let $httpBackend; let $httpBackend;
let data = {id: 1, name: 'fooName'}; const expectedAmount = 99;
const data = {
id: 1,
name: 'fooName',
invoiceInDueDay: [{amount: expectedAmount}]
};
beforeEach(ngModule('invoiceIn')); beforeEach(ngModule('invoiceIn'));
@ -21,7 +26,8 @@ describe('vnInvoiceIn', () => {
controller.reload(); controller.reload();
$httpBackend.flush(); $httpBackend.flush();
expect(controller.invoiceIn).toEqual(data); expect(controller.invoiceIn).toBeDefined();
expect(controller.invoiceIn.amount).toEqual(expectedAmount);
}); });
}); });

View File

@ -69,38 +69,6 @@
</vn-data-viewer> </vn-data-viewer>
<vn-popup vn-id="summary"> <vn-popup vn-id="summary">
<vn-invoice-in-summary <vn-invoice-in-summary
invoice-in="$ctrl.selectedinvoiceIn"> invoice-in="$ctrl.selectedInvoiceIn">
</vn-invoice-in-summary> </vn-invoice-in-summary>
</vn-popup> </vn-popup>
<!-- <vn-supplier-descriptor-popover
vn-id="supplierDescriptor">
</vn-supplier-descriptor-popover>
<vn-contextmenu vn-id="contextmenu" targets="['vn-data-viewer']" model="model"
expr-builder="$ctrl.exprBuilder(param, value)">
<slot-menu>
<vn-item translate
ng-if="contextmenu.isFilterAllowed()"
ng-click="contextmenu.filterBySelection()">
Filter by selection
</vn-item>
<vn-item translate
ng-if="contextmenu.isFilterAllowed()"
ng-click="contextmenu.excludeSelection()">
Exclude selection
</vn-item>
<vn-item translate
ng-if="contextmenu.isFilterAllowed()"
ng-click="contextmenu.removeFilter()">
Remove filter
</vn-item>
<vn-item translate
ng-click="contextmenu.removeAllFilters()">
Remove all filters
</vn-item>
<vn-item translate
ng-if="contextmenu.isActionAllowed()"
ng-click="contextmenu.copyValue()">
Copy value
</vn-item>
</slot-menu>
</vn-contextmenu> -->

View File

@ -34,6 +34,11 @@ export default class Controller extends Section {
return [minHour, maxHour]; return [minHour, maxHour];
} }
preview(invoiceIn) {
this.selectedInvoiceIn = invoiceIn;
this.$.summary.show();
}
} }
ngModule.vnComponent('vnInvoiceInIndex', { ngModule.vnComponent('vnInvoiceInIndex', {

View File

@ -7,6 +7,12 @@
"menus": { "menus": {
"main": [ "main": [
{"state": "invoiceIn.index", "icon": "icon-invoiceIn"} {"state": "invoiceIn.index", "icon": "icon-invoiceIn"}
],
"card": [
{
"state": "invoiceIn.card.basicData",
"icon": "settings"
}
] ]
}, },
"routes": [ "routes": [
@ -36,9 +42,18 @@
"component": "vn-invoice-in-summary", "component": "vn-invoice-in-summary",
"description": "Summary", "description": "Summary",
"params": { "params": {
"invoice-In": "$ctrl.invoiceIn" "invoice-in": "$ctrl.invoiceIn"
}, },
"acl": ["developer"] "acl": ["administrative"]
},
{
"url": "/basic-data",
"state": "invoiceIn.card.basicData",
"component": "vn-invoice-in-basic-data",
"description": "Basic data",
"params": {
"invoice-in": "$ctrl.invoiceIn"
}
} }
] ]
} }