2402 - Added create entry section
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
11e1a6f845
commit
a3382300f9
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "Entry",
|
||||
"base": "VnModel",
|
||||
"base": "Loggable",
|
||||
"log": {
|
||||
"model":"EntryLog"
|
||||
},
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
<mg-ajax path="Entries" options="vnPost"></mg-ajax>
|
||||
<vn-watcher
|
||||
vn-id="watcher"
|
||||
data="$ctrl.entry"
|
||||
form="form"
|
||||
save="post">
|
||||
</vn-watcher>
|
||||
<form name="form" ng-submit="$ctrl.onSubmit()" class="vn-w-md">
|
||||
<vn-card class="vn-pa-lg">
|
||||
<vn-horizontal>
|
||||
<vn-autocomplete
|
||||
vn-one
|
||||
ng-model="$ctrl.entry.supplierFk"
|
||||
url="Suppliers"
|
||||
show-field="nickname"
|
||||
search-function="{or: [{id: $search}, {name: {like: '%'+ $search +'%'}}]}"
|
||||
value-field="id"
|
||||
order="nickname"
|
||||
label="Supplier">
|
||||
<tpl-item>
|
||||
{{::id}} - {{::nickname}}
|
||||
</tpl-item>
|
||||
</vn-autocomplete>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-autocomplete
|
||||
vn-one
|
||||
ng-model="$ctrl.entry.travelFk"
|
||||
url="Travels/filter"
|
||||
search-function="$ctrl.searchFunction($search)"
|
||||
value-field="t.id"
|
||||
order="t.id"
|
||||
label="Travel">
|
||||
<tpl-item>
|
||||
{{::agencyModeName}} - {{::warehouseInName}} ({{::shipped | date: 'dd/MM/yyyy'}}) →
|
||||
{{::warehouseOutName}} ({{::landed | date: 'dd/MM/yyyy'}})
|
||||
</tpl-item>
|
||||
</vn-autocomplete>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-autocomplete
|
||||
url="Companies"
|
||||
label="Company"
|
||||
show-field="code"
|
||||
value-field="id"
|
||||
ng-model="$ctrl.entry.companyFk">
|
||||
</vn-autocomplete>
|
||||
</vn-horizontal>
|
||||
</vn-card>
|
||||
<vn-button-bar>
|
||||
<vn-submit label="Create"></vn-submit>
|
||||
<vn-button ui-sref="entry.index" label="Cancel"></vn-button>
|
||||
</vn-button-bar>
|
||||
</form>
|
|
@ -0,0 +1,42 @@
|
|||
import ngModule from '../module';
|
||||
import Section from 'salix/components/section';
|
||||
|
||||
export default class Controller extends Section {
|
||||
constructor($element, $) {
|
||||
super($element, $);
|
||||
|
||||
this.entry = {
|
||||
companyFk: this.vnConfig.companyFk
|
||||
};
|
||||
|
||||
if (this.$params && this.$params.supplierFk)
|
||||
this.entry.supplierFk = parseInt(this.$params.supplierFk);
|
||||
if (this.$params && this.$params.travelFk)
|
||||
this.entry.travelFk = parseInt(this.$params.travelFk);
|
||||
if (this.$params && this.$params.companyFk)
|
||||
this.entry.companyFk = parseInt(this.$params.companyFk);
|
||||
}
|
||||
|
||||
onSubmit() {
|
||||
this.$.watcher.submit().then(
|
||||
res => this.$state.go('entry.card.basicData', {id: res.data.id})
|
||||
);
|
||||
}
|
||||
|
||||
searchFunction($search) {
|
||||
return {or: [
|
||||
{'am.name': {like: `%${$search}%`}},
|
||||
{'win.name': {like: `%${$search}%`}},
|
||||
{'wout.name': {like: `%${$search}%`}},
|
||||
{'t.shipped': new Date($search)},
|
||||
{'t.landed': new Date($search)}
|
||||
]};
|
||||
}
|
||||
}
|
||||
|
||||
Controller.$inject = ['$element', '$scope'];
|
||||
|
||||
ngModule.vnComponent('vnEntryCreate', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller
|
||||
});
|
|
@ -0,0 +1 @@
|
|||
New entry: Nueva entrada
|
|
@ -2,6 +2,7 @@ export * from './module';
|
|||
|
||||
import './main';
|
||||
import './index/';
|
||||
import './create';
|
||||
import './search-panel';
|
||||
import './descriptor';
|
||||
import './card';
|
||||
|
|
|
@ -69,4 +69,16 @@
|
|||
</vn-data-viewer>
|
||||
<vn-travel-descriptor-popover
|
||||
vn-id="travelDescriptor">
|
||||
</vn-travel-descriptor-popover>
|
||||
</vn-travel-descriptor-popover>
|
||||
|
||||
<div fixed-bottom-right>
|
||||
<vn-vertical style="align-items: center;">
|
||||
<a ui-sref="entry.create" vn-bind="+">
|
||||
<vn-button class="round md vn-mb-sm"
|
||||
icon="add"
|
||||
vn-tooltip="New entry"
|
||||
tooltip-position="left">
|
||||
</vn-button>
|
||||
</a>
|
||||
</vn-vertical>
|
||||
</div>
|
|
@ -25,6 +25,12 @@
|
|||
"state": "entry.index",
|
||||
"component": "vn-entry-index",
|
||||
"description": "Entries"
|
||||
}, {
|
||||
"url": "/create?supplierFk&travelFk&companyFk",
|
||||
"state": "entry.create",
|
||||
"component": "vn-entry-create",
|
||||
"description": "New entry",
|
||||
"acl": ["buyer"]
|
||||
}, {
|
||||
"url": "/:id",
|
||||
"state": "entry.card",
|
||||
|
|
|
@ -33,13 +33,13 @@
|
|||
"retAccount": {
|
||||
"type": "Number"
|
||||
},
|
||||
"commision": {
|
||||
"commission": {
|
||||
"type": "Boolean"
|
||||
},
|
||||
"created": {
|
||||
"type": "Date"
|
||||
},
|
||||
"poscodeFk": {
|
||||
"postcodeFk": {
|
||||
"type": "Number"
|
||||
},
|
||||
"isActive": {
|
||||
|
|
|
@ -79,10 +79,9 @@
|
|||
tooltip-position="left">
|
||||
</vn-button>
|
||||
|
||||
<a ui-sref="route.create">
|
||||
<a ui-sref="route.create" vn-bind="+">
|
||||
<vn-button class="round md vn-mb-sm"
|
||||
icon="add"
|
||||
vn-bind="+"
|
||||
vn-tooltip="New route"
|
||||
tooltip-position="left">
|
||||
</vn-button>
|
||||
|
|
|
@ -143,10 +143,9 @@
|
|||
vn-tooltip="Payment on account..."
|
||||
tooltip-position="left">
|
||||
</vn-button>
|
||||
<a ui-sref="ticket.create">
|
||||
<a ui-sref="ticket.create" vn-bind="+">
|
||||
<vn-button class="round md vn-mb-sm"
|
||||
icon="add"
|
||||
vn-bind="+"
|
||||
vn-tooltip="New ticket"
|
||||
tooltip-position="left">
|
||||
</vn-button>
|
||||
|
|
Loading…
Reference in New Issue