supplier contact
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
39de960b9d
commit
18ebbe80d7
|
@ -7,5 +7,8 @@
|
|||
},
|
||||
"SupplierLog": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"SupplierContact": {
|
||||
"dataSource": "vn"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
<vn-crud-model
|
||||
vn-id="model"
|
||||
url="SupplierContacts"
|
||||
link="{supplierFk: $ctrl.$params.id}"
|
||||
data="contacts"
|
||||
auto-load="true">
|
||||
</vn-crud-model>
|
||||
<vn-watcher
|
||||
vn-id="watcher"
|
||||
data="contacts"
|
||||
form="form">
|
||||
</vn-watcher>
|
||||
<form name="form" ng-submit="$ctrl.onSubmit()" class="vn-w-md">
|
||||
<vn-card class="vn-pa-lg">
|
||||
<div ng-repeat="contact in contacts" class="contact">
|
||||
<vn-vertical>
|
||||
<vn-horizontal>
|
||||
<vn-textfield
|
||||
vn-one
|
||||
label="Name"
|
||||
ng-model="contact.name"
|
||||
rule="SupplierContact">
|
||||
</vn-textfield>
|
||||
<vn-textfield
|
||||
vn-one
|
||||
label="Phone"
|
||||
ng-model="contact.phone"
|
||||
rule="SupplierContact"
|
||||
vn-focus>
|
||||
</vn-textfield>
|
||||
<vn-textfield
|
||||
vn-one
|
||||
label="Mobile"
|
||||
ng-model="contact.mobile"
|
||||
rule="SupplierContact"
|
||||
vn-focus>
|
||||
</vn-textfield>
|
||||
<vn-textfield
|
||||
vn-one
|
||||
label="Email"
|
||||
ng-model="contact.email"
|
||||
rule="SupplierContact"
|
||||
vn-focus>
|
||||
</vn-textfield>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-textfield
|
||||
vn-one
|
||||
label="Notes"
|
||||
ng-model="contact.observation"
|
||||
rule="SupplierContact"
|
||||
vn-focus>
|
||||
</vn-textfield>
|
||||
<vn-none>
|
||||
<vn-icon-button
|
||||
vn-tooltip="Remove contact"
|
||||
icon="delete"
|
||||
tabindex="-1"
|
||||
ng-click="model.remove($index)">
|
||||
</vn-icon-button>
|
||||
</vn-none>
|
||||
</vn-horizontal>
|
||||
</vn-vertical>
|
||||
</div>
|
||||
<vn-one>
|
||||
<vn-icon-button
|
||||
vn-bind="+"
|
||||
vn-tooltip="Add contact"
|
||||
icon="add_circle"
|
||||
ng-click="$ctrl.add()">
|
||||
</vn-icon-button>
|
||||
</vn-one>
|
||||
</vn-card>
|
||||
<vn-button-bar>
|
||||
<vn-submit label="Save"></vn-submit>
|
||||
</vn-button-bar>
|
||||
</form>
|
|
@ -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: '<'
|
||||
}
|
||||
});
|
|
@ -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;
|
||||
}
|
|
@ -7,3 +7,4 @@ import './index/';
|
|||
import './search-panel';
|
||||
import './log';
|
||||
import './summary';
|
||||
import './contact';
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue