#997 worker.summary, bugs fixed

This commit is contained in:
Juan Ferrer 2019-01-30 13:32:25 +01:00
parent 97f28e2ef6
commit 84737a0bb9
7 changed files with 75 additions and 57 deletions

View File

@ -13,15 +13,18 @@ import UserError from '../../lib/user-error';
* properties are provided.
*/
export default class Watcher extends Component {
constructor($element, $scope, $state, $transitions, $http, vnApp, $translate, $attrs, $q) {
constructor($element, $, $state, $stateParams, $transitions, $http, vnApp, $translate, $attrs, $q) {
super($element);
this.$ = $scope;
this.$state = $state;
this.$http = $http;
this._ = $translate;
this.$attrs = $attrs;
this.vnApp = vnApp;
this.$q = $q;
Object.assign(this, {
$,
$state,
$stateParams,
$http,
_: $translate,
$attrs,
vnApp,
$q
});
this.state = null;
this.deregisterCallback = $transitions.onStart({},
@ -240,7 +243,7 @@ export default class Watcher extends Component {
return newCopy;
}
}
Watcher.$inject = ['$element', '$scope', '$state', '$transitions', '$http', 'vnApp', '$translate', '$attrs', '$q'];
Watcher.$inject = ['$element', '$scope', '$state', '$stateParams', '$transitions', '$http', 'vnApp', '$translate', '$attrs', '$q'];
ngModule.component('vnWatcher', {
template: require('./watcher.html'),

View File

@ -8,25 +8,40 @@
<form name="form" ng-submit="watcher.submit()" compact>
<vn-card pad-large>
<vn-horizontal>
<vn-textfield vn-one
<vn-textfield
vn-one
label="Comercial Name"
field="$ctrl.client.name" vn-focus>
</vn-textfield>
</vn-horizontal>
<vn-horizontal>
<vn-textfield vn-one label="Contact" field="$ctrl.client.contact"></vn-textfield>
<vn-textfield vn-one
<vn-textfield
vn-one
label="Contact"
field="$ctrl.client.contact">
</vn-textfield>
<vn-textfield
vn-one
label="Email"
field="$ctrl.client.email"
info="You can save multiple emails">
</vn-textfield>
</vn-horizontal>
<vn-horizontal>
<vn-textfield vn-one label="Phone" field="$ctrl.client.phone"></vn-textfield>
<vn-textfield vn-one label="Mobile" field="$ctrl.client.mobile"></vn-textfield>
<vn-textfield
vn-one
label="Phone"
field="$ctrl.client.phone">
</vn-textfield>
<vn-textfield
vn-one
label="Mobile"
field="$ctrl.client.mobile">
</vn-textfield>
</vn-horizontal>
<vn-horizontal>
<vn-autocomplete vn-one
<vn-autocomplete
vn-one
initial-data="$ctrl.client.salesPerson"
field="$ctrl.client.salesPersonFk"
url="/client/api/Clients/activeWorkersWithRole"
@ -38,7 +53,8 @@
vn-acl="salesAssistant">
<tpl-item>{{firstName}} {{name}}</tpl-item>
</vn-autocomplete>
<vn-autocomplete vn-one
<vn-autocomplete
vn-one
initial-data="$ctrl.client.contactChannel"
field="$ctrl.client.contactChannelFk"
url="/client/api/ContactChannels"

View File

@ -236,6 +236,7 @@
"state": "client.card.creditInsurance.index",
"component": "vn-client-credit-insurance-index",
"description": "Credit contracts",
"acl": ["creditInsurance"],
"params": {
"client": "$ctrl.client"
}

View File

@ -1,30 +1,34 @@
<mg-ajax path="api/Workers/{{patch.params.id}}" options="vnPatch"></mg-ajax>
<vn-watcher
vn-id="watcher"
data="$ctrl.worker"
form="form"
save="patch">
id-field="id"
url="api/Workers"
save="post">
</vn-watcher>
<form name="form" ng-submit="$ctrl.onSubmit()">
<vn-card pad-large>
<vn-vertical>
<vn-horizontal>
<vn-autocomplete
<vn-textfield
vn-one
field="$ctrl.zone.warehouseFk"
url="api/Warehouses"
show-field="name"
value-field="id"
label="Id">
</vn-autocomplete>
<vn-autocomplete
label="Name"
field="$ctrl.worker.firstName">
</vn-textfield>
<vn-textfield
vn-one
field="$ctrl.zone.agencyModeFk"
url="api/AgencyModes"
show-field="name"
value-field="id"
label="Name">
</vn-autocomplete>
label="Last name"
field="$ctrl.worker.name">
</vn-textfield>
</vn-horizontal>
<vn-horizontal>
<vn-textfield
vn-one
label="Phone"
field="$ctrl.worker.phone">
</vn-textfield>
</vn-horizontal>
</vn-vertical>
</vn-card>
<vn-button-bar>
<vn-submit label="Save"></vn-submit>

View File

@ -1,21 +1,16 @@
import ngModule from '../module';
class Controller {
constructor($, $state) {
Object.assign(this, {
$,
$state
});
constructor($) {
Object.assign(this, {$});
}
onSubmit() {
this.$.watcher.submit().then(() => {
this.card.reload();
});
this.$.watcher.submit()
.then(() => this.card.reload());
}
}
Controller.$inject = ['$scope', '$state'];
Controller.$inject = ['$scope'];
ngModule.component('vnWorkerBasicData', {
template: require('./index.html'),

View File

@ -10,27 +10,27 @@
</vn-horizontal>
<div class="body">
<div class="attributes">
<h5>{{::$ctrl.worker.firstName}} {{::$ctrl.worker.name}}</h5>
<h5>{{$ctrl.worker.firstName}} {{$ctrl.worker.name}}</h5>
<vn-label-value label="Id"
value="{{::$ctrl.worker.id}}">
value="{{$ctrl.worker.id}}">
</vn-label-value>
<vn-label-value label="User"
value="{{::$ctrl.worker.user.name}}">
value="{{$ctrl.worker.user.name}}">
</vn-label-value>
<vn-label-value label="Email"
value="{{::$ctrl.worker.user.email}}">
value="{{$ctrl.worker.user.email}}">
</vn-label-value>
<vn-label-value label="Fiscal identifier"
value="{{::$ctrl.worker.client.fi}}">
value="{{$ctrl.worker.client.fi}}">
</vn-label-value>
<vn-label-value label="Department"
value="{{::$ctrl.worker.department.department}}">
value="{{$ctrl.worker.department.department}}">
</vn-label-value>
<vn-label-value label="Phone"
value="{{::$ctrl.worker.phone}}">
value="{{$ctrl.worker.phone}}">
</vn-label-value>
<vn-label-value label="Extension"
value="{{::$ctrl.worker.sip.phone}}">
value="{{$ctrl.worker.sip.phone}}">
</vn-label-value>
</div>
<div class="quicklinks">

View File

@ -3,8 +3,7 @@
url="/agency/api/Workers"
include="::$ctrl.include"
limit="20"
data="workers"
auto-load="false">
data="workers">
</vn-crud-model>
<div class="index-block">
<div class="vn-list">
@ -21,7 +20,7 @@
ui-sref="worker.card.summary({id: worker.id})"
translate-attr="{title: 'View worker'}"
class="vn-list-item">
<vn-horizontal ng-click="$ctrl.onClick($event)">
<vn-horizontal>
<vn-one>
<h6>{{::worker.firstName}} {{::worker.name}}</h6>
<vn-label-value label="Id"