diff --git a/modules/item/front/last-entries/index.html b/modules/item/front/last-entries/index.html index e3b84655c8..bb78b8c16c 100644 --- a/modules/item/front/last-entries/index.html +++ b/modules/item/front/last-entries/index.html @@ -95,7 +95,14 @@ {{::entry.weight | dashIfEmpty}} {{::entry.packagingFk | dashIfEmpty}} - {{::entry.supplier | dashIfEmpty}} + + + + {{::entry.supplier | dashIfEmpty}} + + @@ -107,6 +114,10 @@ vn-id="entryDescriptor"> + + + diff --git a/modules/supplier/front/descriptor-popover/index.html b/modules/supplier/front/descriptor-popover/index.html new file mode 100644 index 0000000000..610bd128c6 --- /dev/null +++ b/modules/supplier/front/descriptor-popover/index.html @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/supplier/front/descriptor-popover/index.js b/modules/supplier/front/descriptor-popover/index.js new file mode 100644 index 0000000000..a30aa4829b --- /dev/null +++ b/modules/supplier/front/descriptor-popover/index.js @@ -0,0 +1,9 @@ +import ngModule from '../module'; +import DescriptorPopover from 'salix/components/descriptor-popover'; + +class Controller extends DescriptorPopover {} + +ngModule.vnComponent('vnSupplierDescriptorPopover', { + slotTemplate: require('./index.html'), + controller: Controller +}); diff --git a/modules/supplier/front/descriptor/index.html b/modules/supplier/front/descriptor/index.html new file mode 100644 index 0000000000..b3ba595ab4 --- /dev/null +++ b/modules/supplier/front/descriptor/index.html @@ -0,0 +1,66 @@ + + +
+ + + + + + + + + + + + +
+
+ + + + +
+ +
+
+ + + \ No newline at end of file diff --git a/modules/supplier/front/descriptor/index.js b/modules/supplier/front/descriptor/index.js new file mode 100644 index 0000000000..f84b4ef928 --- /dev/null +++ b/modules/supplier/front/descriptor/index.js @@ -0,0 +1,80 @@ +import ngModule from '../module'; +import Descriptor from 'salix/components/descriptor'; + +class Controller extends Descriptor { + get supplier() { + return this.entity; + } + + set supplier(value) { + this.entity = value; + } + + get entryFilter() { + if (!this.supplier) return null; + + const date = Date.vnNew(); + date.setHours(0, 0, 0, 0); + + const from = new Date(date.getTime()); + from.setDate(from.getDate() - 10); + + const to = new Date(date.getTime()); + to.setDate(to.getDate() + 10); + + return JSON.stringify({ + supplierFk: this.id, + from, + to + }); + } + + loadData() { + const filter = { + fields: [ + 'id', + 'name', + 'nickname', + 'nif', + 'payMethodFk', + 'payDemFk', + 'payDay', + 'isActive', + 'isReal', + 'isTrucker', + 'account' + ], + include: [ + { + relation: 'payMethod', + scope: { + fields: ['id', 'name'] + } + }, + { + relation: 'payDem', + scope: { + fields: ['id', 'payDem'] + } + }, + { + relation: 'client', + scope: { + fields: ['id', 'fi'] + } + } + ] + }; + + return this.getData(`Suppliers/${this.id}`, {filter}) + .then(res => this.supplier = res.data); + } +} + +ngModule.vnComponent('vnSupplierDescriptor', { + template: require('./index.html'), + controller: Controller, + bindings: { + supplier: '<' + } +}); diff --git a/modules/supplier/front/index.js b/modules/supplier/front/index.js index a7209a0bdd..0f22088628 100644 --- a/modules/supplier/front/index.js +++ b/modules/supplier/front/index.js @@ -1,3 +1,6 @@ export * from './module'; import './main'; +import './descriptor'; +import './descriptor-popover'; +import './summary'; diff --git a/modules/supplier/front/routes.json b/modules/supplier/front/routes.json index ab0022ff96..bddd389703 100644 --- a/modules/supplier/front/routes.json +++ b/modules/supplier/front/routes.json @@ -36,6 +36,146 @@ "state": "supplier.index", "component": "vn-supplier-index", "description": "Suppliers" + }, + { + "url": "/:id", + "state": "supplier.card", + "abstract": true, + "component": "vn-supplier-card" + }, + { + "url": "/summary", + "state": "supplier.card.summary", + "component": "vn-supplier-summary", + "description": "Summary", + "params": { + "supplier": "$ctrl.supplier" + } + }, + { + "url": "/create", + "state": "supplier.create", + "component": "vn-supplier-create", + "acl": ["administrative"], + "description": "New supplier" + }, + { + "url": "/basic-data", + "state": "supplier.card.basicData", + "component": "vn-supplier-basic-data", + "description": "Basic data", + "acl": ["administrative"], + "params": { + "supplier": "$ctrl.supplier" + } + }, + { + "url": "/fiscal-data", + "state": "supplier.card.fiscalData", + "component": "vn-supplier-fiscal-data", + "description": "Fiscal data", + "params": { + "supplier": "$ctrl.supplier" + }, + "acl": ["administrative"] + }, + { + "url" : "/log", + "state": "supplier.card.log", + "component": "vn-supplier-log", + "description": "Log" + }, + { + "url": "/contact", + "state": "supplier.card.contact", + "component": "vn-supplier-contact", + "description": "Contacts", + "params": { + "supplier": "$ctrl.supplier" + } + }, + { + "url": "/agency-term", + "state": "supplier.card.agencyTerm", + "component": "ui-view", + "abstract": true + }, + { + "url": "/index", + "state": "supplier.card.agencyTerm.index", + "component": "vn-supplier-agency-term-index", + "description": "Agency Agreement", + "params": { + "supplier": "$ctrl.supplier" + } + }, + { + "url": "/create", + "state": "supplier.card.agencyTerm.create", + "component": "vn-supplier-agency-term-create", + "description": "New autonomous", + "params": { + "supplier": "$ctrl.supplier" + } + }, + { + "url": "/consumption?q", + "state": "supplier.card.consumption", + "component": "vn-supplier-consumption", + "description": "Consumption", + "params": { + "supplier": "$ctrl.supplier" + } + }, + { + "url": "/billing-data", + "state": "supplier.card.billingData", + "component": "vn-supplier-billing-data", + "description": "Billing data", + "params": { + "supplier": "$ctrl.supplier" + }, + "acl": ["administrative"] + }, + { + "url": "/account", + "state": "supplier.card.account", + "component": "vn-supplier-account", + "description": "Accounts", + "params": { + "supplier": "$ctrl.supplier" + }, + "acl": ["administrative"] + }, + { + "url": "/address", + "state": "supplier.card.address", + "component": "ui-view", + "abstract": true + }, + { + "url": "/index?q", + "state": "supplier.card.address.index", + "component": "vn-supplier-address-index", + "description": "Addresses", + "params": { + "supplier": "$ctrl.supplier" + } + }, + { + "url": "/create", + "state": "supplier.card.address.create", + "component": "vn-supplier-address-create", + "description": "New address", + "params": { + "supplier": "$ctrl.supplier" + } + }, + { + "url": "/:addressId/edit", + "state": "supplier.card.address.edit", + "component": "vn-supplier-address-edit", + "description": "Edit address" } ] } diff --git a/modules/supplier/front/summary/index.html b/modules/supplier/front/summary/index.html new file mode 100644 index 0000000000..31318dc430 --- /dev/null +++ b/modules/supplier/front/summary/index.html @@ -0,0 +1,172 @@ + +
+ + + + {{::$ctrl.summary.name}} - {{::$ctrl.summary.id}} +
+ + +

+ + Basic data + +

+

+ Basic data +

+ + + + + + + + {{$ctrl.summary.worker.user.nickname}} + + + + + + + + + +
+ +

+ + Billing data + +

+

+ Billing data +

+ + + + + + + + +
+
+ + +

+ + Fiscal data + +

+

+ Fiscal data +

+ + + + + + + + + +
+
+ + +

+ + Fiscal address + +

+

+ Fiscal address +

+ + + + + + + + + + + + + + +
+
+
+ + \ No newline at end of file diff --git a/modules/supplier/front/summary/index.js b/modules/supplier/front/summary/index.js new file mode 100644 index 0000000000..a828379bc9 --- /dev/null +++ b/modules/supplier/front/summary/index.js @@ -0,0 +1,30 @@ +import ngModule from '../module'; +import Summary from 'salix/components/summary'; +import './style.scss'; + +class Controller extends Summary { + $onChanges() { + if (!this.supplier) + return; + + this.getSummary(); + } + + get isAdministrative() { + return this.aclService.hasAny(['administrative']); + } + + getSummary() { + return this.$http.get(`Suppliers/${this.supplier.id}/getSummary`).then(response => { + this.summary = response.data; + }); + } +} + +ngModule.vnComponent('vnSupplierSummary', { + template: require('./index.html'), + controller: Controller, + bindings: { + supplier: '<' + } +}); diff --git a/modules/supplier/front/summary/style.scss b/modules/supplier/front/summary/style.scss new file mode 100644 index 0000000000..96adf153b0 --- /dev/null +++ b/modules/supplier/front/summary/style.scss @@ -0,0 +1,7 @@ +@import "variables"; + +vn-client-summary { + .alert span { + color: $color-alert + } +} \ No newline at end of file