Added form dialog
gitea/salix/2113-item_data_add_instrastat There was a failure building this commit Details

This commit is contained in:
Joan Sanchez 2020-02-17 07:22:55 +01:00
parent 84bf95db13
commit d9ed7cda38
4 changed files with 115 additions and 68 deletions

View File

@ -55,6 +55,9 @@ module.exports = Self => {
} }
}] }]
} }
},
{
relation: 'taxClass'
} }
] ]
}; };

View File

@ -1,13 +1,13 @@
{ {
"name": "Item", "name": "Item",
"base": "Loggable", "base": "Loggable",
"log": { "log": {
"model":"ItemLog", "model": "ItemLog",
"showField": "id" "showField": "id"
}, },
"options": { "options": {
"mysql": { "mysql": {
"table": "item" "table": "item"
} }
}, },
"properties": { "properties": {
@ -125,55 +125,55 @@
} }
}, },
"relations": { "relations": {
"itemType": { "itemType": {
"type": "belongsTo", "type": "belongsTo",
"model": "ItemType", "model": "ItemType",
"foreignKey": "typeFk" "foreignKey": "typeFk"
}, },
"ink": { "ink": {
"type": "belongsTo", "type": "belongsTo",
"model": "Ink", "model": "Ink",
"foreignKey": "inkFk" "foreignKey": "inkFk"
}, },
"origin": { "origin": {
"type": "belongsTo", "type": "belongsTo",
"model": "Origin", "model": "Origin",
"foreignKey": "originFk" "foreignKey": "originFk"
}, },
"producer": { "producer": {
"type": "belongsTo", "type": "belongsTo",
"model": "Producer", "model": "Producer",
"foreignKey": "producerFk" "foreignKey": "producerFk"
}, },
"intrastat": { "intrastat": {
"type": "belongsTo", "type": "belongsTo",
"model": "Intrastat", "model": "Intrastat",
"foreignKey": "intrastatFk" "foreignKey": "intrastatFk"
}, },
"expense": { "expense": {
"type": "belongsTo", "type": "belongsTo",
"model": "Expense", "model": "Expense",
"foreignKey": "expenseFk" "foreignKey": "expenseFk"
}, },
"tags": { "tags": {
"type": "hasMany", "type": "hasMany",
"model": "ItemTag", "model": "ItemTag",
"foreignKey": "itemFk" "foreignKey": "itemFk"
}, },
"itemBarcode": { "itemBarcode": {
"type": "hasMany", "type": "hasMany",
"model": "ItemBarcode", "model": "ItemBarcode",
"foreignKey": "itemFk" "foreignKey": "itemFk"
}, },
"taxes": { "taxes": {
"type": "hasMany", "type": "hasMany",
"model": "ItemTaxCountry", "model": "ItemTaxCountry",
"foreignKey": "itemFk" "foreignKey": "itemFk"
}, },
"itemNiche": { "itemNiche": {
"type": "hasMany", "type": "hasMany",
"model": "ItemNiche", "model": "ItemNiche",
"foreignKey": "itemFk" "foreignKey": "itemFk"
} }
} }
} }

View File

@ -55,6 +55,13 @@
<div style="width: 6em; text-align: right; padding-right: 1em;">{{::id}}</div> <div style="width: 6em; text-align: right; padding-right: 1em;">{{::id}}</div>
<div>{{::description}}</div> <div>{{::description}}</div>
</tpl-item> </tpl-item>
<append>
<vn-icon-button
icon="add_circle"
vn-tooltip="New intrastat"
ng-click="$ctrl.showIntrastat($event)">
</vn-icon-button>
</append>
</vn-autocomplete> </vn-autocomplete>
<vn-autocomplete vn-one <vn-autocomplete vn-one
url="Expenses" url="Expenses"
@ -69,7 +76,7 @@
value-field="id" value-field="id"
ng-model="$ctrl.item.originFk" ng-model="$ctrl.item.originFk"
initial-data="$ctrl.item.origin"> initial-data="$ctrl.item.origin">
</vn-autocomplete> </vn-autocomplete>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>
<vn-textfield <vn-textfield
@ -123,7 +130,7 @@
</vn-check> </vn-check>
<vn-textarea <vn-textarea
vn-one vn-one
label="description" label="Description"
ng-model="$ctrl.item.description" ng-model="$ctrl.item.description"
rule> rule>
</vn-textarea> </vn-textarea>
@ -134,3 +141,38 @@
<vn-button label="Undo changes" ng-if="$ctrl.$scope.form.$dirty" ng-click="watcher.loadOriginalData()"></vn-button> <vn-button label="Undo changes" ng-if="$ctrl.$scope.form.$dirty" ng-click="watcher.loadOriginalData()"></vn-button>
</vn-button-bar> </vn-button-bar>
</form> </form>
<!-- Create custom agent dialog -->
<vn-dialog class="edit"
vn-id="intrastat"
on-accept="$ctrl.onIntrastatAccept()">
<tpl-body>
<h5 class="vn-py-sm" translate>New intrastat</h5>
<vn-horizontal>
<vn-textfield vn-one vn-focus
label="Identifier"
ng-model="$ctrl.newIntrastat.id"
required="true">
</vn-textfield>
<vn-textfield vn-one
label="Description"
ng-model="$ctrl.newIntrastat.description"
required="true">
</vn-textfield>
</vn-horizontal>
<vn-horizontal>
<vn-autocomplete vn-one
url="TaxClasses"
label="Tax class"
show-field="description"
value-field="id"
ng-model="$ctrl.newIntrastat.taxClassFk"
initial-data="$ctrl.item.taxClass">
</vn-autocomplete>
</vn-horizontal>
</tpl-body>
<tpl-buttons>
<input type="button" response="cancel" translate-attr="{value: 'Cancel'}"/>
<button response="accept" translate>Create</button>
</tpl-buttons>
</vn-dialog>

View File

@ -1,20 +1,22 @@
import ngModule from '../module'; import ngModule from '../module';
import Component from 'core/lib/component';
class Controller extends Component {
showIntrastat(event) {
if (event.defaultPrevented) return;
event.preventDefault();
class Controller { this.newIntrastat = {
constructor($scope, $timeout) { taxClassFk: this.item.taxClassFk
this.$scope = $scope; };
this.$timeout = $timeout; this.$.intrastat.show();
} }
$onChanges(data) { onCustomAgentAccept() {
this.$timeout(() => { return this.$http.post(`CustomsAgents`, this.newCustomsAgent)
this.$scope.watcher.data = data.item.currentValue; .then(res => this.address.customsAgentFk = res.data.id);
});
} }
} }
Controller.$inject = ['$scope', '$timeout'];
ngModule.component('vnItemBasicData', { ngModule.component('vnItemBasicData', {
template: require('./index.html'), template: require('./index.html'),
bindings: { bindings: {