frontEnd ticket module file system
This commit is contained in:
parent
93baddbfc2
commit
856fc64742
|
@ -5,10 +5,38 @@
|
|||
"validations": false,
|
||||
"routes": [
|
||||
{
|
||||
"url": "/tickets",
|
||||
"state": "tickets",
|
||||
"component": "vn-ticket-index",
|
||||
"acl": ["developer"]
|
||||
"url": "/ticket",
|
||||
"state": "ticket",
|
||||
"abstract": true,
|
||||
"component": "ui-view"
|
||||
},
|
||||
{
|
||||
"url": "/list?q",
|
||||
"state": "ticket.list",
|
||||
"component": "vn-ticket-list"
|
||||
},
|
||||
{
|
||||
"url": "/create",
|
||||
"state": "ticket.create",
|
||||
"component": "vn-ticket-create"
|
||||
},
|
||||
{
|
||||
"url": "/:id",
|
||||
"state": "ticket.card",
|
||||
"abstract": true,
|
||||
"component": "vn-ticket-card"
|
||||
},
|
||||
{
|
||||
"url" : "/data",
|
||||
"state": "ticket.card.data",
|
||||
"component": "vn-ticket-data",
|
||||
"params": {
|
||||
"ticket": "$ctrl.ticket"
|
||||
},
|
||||
"menu": {
|
||||
"description": "Basic data",
|
||||
"icon": "settings"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
<vn-main-block>
|
||||
<vn-horizontal>
|
||||
<vn-auto margin-medium-v class="left-block">
|
||||
<vn-item-descriptor ticket="$ctrl.ticket"></vn-ticket-descriptor>
|
||||
<vn-left-menu></vn-left-menu>
|
||||
</vn-auto>
|
||||
<vn-one>
|
||||
<vn-vertical margin-medium ui-view></vn-vertical>
|
||||
</vn-one>
|
||||
</vn-horizontal>
|
||||
</vn-main-block>
|
|
@ -0,0 +1,35 @@
|
|||
import ngModule from '../module';
|
||||
|
||||
class TicketCard {
|
||||
constructor($http, $state, $timeout) {
|
||||
this.$http = $http;
|
||||
this.$state = $state;
|
||||
this.$timeout = $timeout;
|
||||
|
||||
this.ticket = null;
|
||||
}
|
||||
|
||||
_getTicket() {
|
||||
let filter = {
|
||||
};
|
||||
this.$http.get(`/ticket/api/Tickets/${this.$state.params.id}?filter=${JSON.stringify(filter)}`)
|
||||
.then(res => {
|
||||
if (res.data && res.data.id) {
|
||||
this.$timeout(() => {
|
||||
this.ticket = res.data;
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
$onInit() {
|
||||
this._getTicket();
|
||||
}
|
||||
}
|
||||
TicketCard.$inject = ['$http', '$state', '$timeout'];
|
||||
|
||||
ngModule.component('vnTicketCard', {
|
||||
template: require('./ticket-card.html'),
|
||||
controller: TicketCard
|
||||
});
|
|
@ -0,0 +1,18 @@
|
|||
<mg-ajax path="/item/api/Tickets" options="vnPost"></mg-ajax>
|
||||
<vn-watcher
|
||||
vn-id="watcher"
|
||||
data="$ctrl.ticket"
|
||||
form="form"
|
||||
save="post">
|
||||
</vn-watcher>
|
||||
<form name="form" ng-submit="$ctrl.onSubmit()" margin-medium>
|
||||
<div style="max-width: 70em; margin: 0 auto;">
|
||||
<vn-card pad-large>
|
||||
<vn-title>New ticket</vn-title>
|
||||
|
||||
</vn-card>
|
||||
<vn-button-bar>
|
||||
<vn-submit label="Create"></vn-submit>
|
||||
</vn-button-bar>
|
||||
</div>
|
||||
</form>
|
|
@ -0,0 +1,21 @@
|
|||
import ngModule from '../module';
|
||||
|
||||
class TicketCreate {
|
||||
constructor($scope, $state) {
|
||||
this.$ = $scope;
|
||||
this.$state = $state;
|
||||
this.Ticket = {};
|
||||
}
|
||||
|
||||
onSubmit() {
|
||||
this.$.watcher.submit().then(
|
||||
json => this.$state.go('ticket.card.data', {id: json.data.id})
|
||||
);
|
||||
}
|
||||
}
|
||||
TicketCreate.$inject = ['$scope', '$state'];
|
||||
|
||||
ngModule.component('vnTicketCreate', {
|
||||
template: require('./ticket-create.html'),
|
||||
controller: TicketCreate
|
||||
});
|
|
@ -1,5 +1,5 @@
|
|||
<a
|
||||
ui-sref="clientCard.basicData({ id: {{::$ctrl.ticket.id}} })"
|
||||
ui-sref="ticket.card.data({ id: {{::$ctrl.ticket.id}} })"
|
||||
translate-attr="{title: 'View client'}"
|
||||
class="vn-list-item">
|
||||
<vn-horizontal ng-click="$ctrl.onClick($event)">
|
|
@ -13,7 +13,7 @@ class Controller {
|
|||
|
||||
ngModule.component('vnTicketItem', {
|
||||
controller: Controller,
|
||||
template: require('./item.html'),
|
||||
template: require('./ticket-item.html'),
|
||||
bindings: {
|
||||
ticket: '<'
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
<mg-ajax path="/client/api/Clients/filter" options="mgIndex"></mg-ajax>
|
||||
<mg-ajax path="/client/api/Clients/filter" options="vnIndexNonAuto"></mg-ajax>
|
||||
<div margin-medium>
|
||||
<div class="vn-list">
|
||||
<vn-card>
|
||||
|
@ -19,6 +19,6 @@
|
|||
<vn-paging index="index" total="index.model.count"></vn-paging>
|
||||
</div>
|
||||
</div>
|
||||
<a ui-sref="create" fixed-bottom-right>
|
||||
<vn-float-button icon="person_add"></vn-float-button>
|
||||
<a ui-sref="ticket.create" fixed-bottom-right>
|
||||
<vn-float-button icon="add"></vn-float-button>
|
||||
</a>
|
|
@ -1,5 +1,6 @@
|
|||
import ngModule from '../module';
|
||||
import './item';
|
||||
import './ticket-item';
|
||||
import './style.scss';
|
||||
|
||||
export default class Controller {
|
||||
search(index) {
|
||||
|
@ -8,7 +9,7 @@ export default class Controller {
|
|||
}
|
||||
Controller.$inject = [];
|
||||
|
||||
ngModule.component('vnTicketIndex', {
|
||||
template: require('./index.html'),
|
||||
ngModule.component('vnTicketList', {
|
||||
template: require('./ticket-list.html'),
|
||||
controller: Controller
|
||||
});
|
|
@ -1,4 +1,6 @@
|
|||
export * from './module';
|
||||
|
||||
import './index/index';
|
||||
|
||||
import './list/ticket-list';
|
||||
import './create/ticket-create';
|
||||
import './card/ticket-card';
|
||||
import './data/ticket-data';
|
||||
|
|
Loading…
Reference in New Issue