diff --git a/modules/supplier/back/model-config.json b/modules/supplier/back/model-config.json index c1963a8cf..34d152bc6 100644 --- a/modules/supplier/back/model-config.json +++ b/modules/supplier/back/model-config.json @@ -7,5 +7,8 @@ }, "SupplierLog": { "dataSource": "vn" + }, + "SupplierContact": { + "dataSource": "vn" } } diff --git a/modules/supplier/back/models/supplier-contact.json b/modules/supplier/back/models/supplier-contact.json new file mode 100644 index 000000000..accb2acd6 --- /dev/null +++ b/modules/supplier/back/models/supplier-contact.json @@ -0,0 +1,49 @@ +{ + "name": "SupplierContact", + "base": "VnModel", + "options": { + "mysql": { + "table": "supplierContact" + } + }, + "properties": { + "id": { + "type": "Number", + "id": true, + "description": "Identifier" + }, + "supplierFk": { + "type": "String" + }, + "phone": { + "type": "String" + }, + "mobile": { + "type": "String" + }, + "email": { + "type": "String" + }, + "observation": { + "type": "String" + }, + "name": { + "type": "String" + } + }, + "relations": { + "supplier": { + "type": "belongsTo", + "model": "Supplier", + "foreignKey": "supplierFk" + } + }, + "acls": [ + { + "accessType": "READ", + "principalType": "ROLE", + "principalId": "$everyone", + "permission": "ALLOW" + } + ] +} \ No newline at end of file diff --git a/modules/supplier/front/contact/index.html b/modules/supplier/front/contact/index.html new file mode 100644 index 000000000..f0921875f --- /dev/null +++ b/modules/supplier/front/contact/index.html @@ -0,0 +1,77 @@ + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + +
\ No newline at end of file diff --git a/modules/supplier/front/contact/index.js b/modules/supplier/front/contact/index.js new file mode 100644 index 000000000..48db3d526 --- /dev/null +++ b/modules/supplier/front/contact/index.js @@ -0,0 +1,27 @@ +import ngModule from '../module'; +import './style.scss'; +import Section from 'salix/components/section'; + +class Controller extends Section { + add() { + this.$.model.insert({ + supplierFk: this.supplier.id + }); + } + + onSubmit() { + this.$.watcher.check(); + this.$.model.save().then(() => { + this.$.watcher.notifySaved(); + this.$.watcher.updateOriginalData(); + }); + } +} + +ngModule.vnComponent('vnSupplierContact', { + template: require('./index.html'), + controller: Controller, + bindings: { + supplier: '<' + } +}); diff --git a/modules/supplier/front/contact/style.scss b/modules/supplier/front/contact/style.scss new file mode 100644 index 000000000..84e98050d --- /dev/null +++ b/modules/supplier/front/contact/style.scss @@ -0,0 +1,10 @@ +@import "variables"; + + +.contact { + max-width: $width-lg; + margin-bottom: 10px; + padding-right: 10px; + padding-left: 10px; + border: 1px solid $color-marginal; +} diff --git a/modules/supplier/front/index.js b/modules/supplier/front/index.js index a4017bbd9..2b7d73541 100644 --- a/modules/supplier/front/index.js +++ b/modules/supplier/front/index.js @@ -7,3 +7,4 @@ import './index/'; import './search-panel'; import './log'; import './summary'; +import './contact'; diff --git a/modules/supplier/front/routes.json b/modules/supplier/front/routes.json index 24e8d8692..d679dd979 100644 --- a/modules/supplier/front/routes.json +++ b/modules/supplier/front/routes.json @@ -9,6 +9,7 @@ {"state": "supplier.index", "icon": "icon-supplier"} ], "card": [ + {"state": "supplier.card.contact", "icon": "contact_phone"}, {"state": "supplier.card.log", "icon": "history"} ] }, @@ -19,17 +20,20 @@ "abstract": true, "component": "vn-supplier", "description": "Suppliers" - }, { + }, + { "url": "/index?q", "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", @@ -37,11 +41,21 @@ "params": { "supplier": "$ctrl.supplier" } - }, { + }, + { "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" + } } ] } \ No newline at end of file