diff --git a/client/ticket/routes.json b/client/ticket/routes.json index 8fd9b65f5..eb2a208c0 100644 --- a/client/ticket/routes.json +++ b/client/ticket/routes.json @@ -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" + } } ] } \ No newline at end of file diff --git a/client/ticket/src/card/ticket-card.html b/client/ticket/src/card/ticket-card.html new file mode 100644 index 000000000..266252ee5 --- /dev/null +++ b/client/ticket/src/card/ticket-card.html @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/client/ticket/src/card/ticket-card.js b/client/ticket/src/card/ticket-card.js new file mode 100644 index 000000000..8f3ea3462 --- /dev/null +++ b/client/ticket/src/card/ticket-card.js @@ -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 +}); diff --git a/client/ticket/src/create/ticket-create.html b/client/ticket/src/create/ticket-create.html new file mode 100644 index 000000000..1542ffbc4 --- /dev/null +++ b/client/ticket/src/create/ticket-create.html @@ -0,0 +1,18 @@ + + + +
+
+ + New ticket + + + + + +
+
diff --git a/client/ticket/src/create/ticket-create.js b/client/ticket/src/create/ticket-create.js new file mode 100644 index 000000000..f9b33c16d --- /dev/null +++ b/client/ticket/src/create/ticket-create.js @@ -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 +}); diff --git a/client/ticket/src/data/ticket-data.html b/client/ticket/src/data/ticket-data.html new file mode 100644 index 000000000..e69de29bb diff --git a/client/ticket/src/data/ticket-data.js b/client/ticket/src/data/ticket-data.js new file mode 100644 index 000000000..e69de29bb diff --git a/client/ticket/src/index/style.scss b/client/ticket/src/list/style.scss similarity index 100% rename from client/ticket/src/index/style.scss rename to client/ticket/src/list/style.scss diff --git a/client/ticket/src/index/item.html b/client/ticket/src/list/ticket-item.html similarity index 88% rename from client/ticket/src/index/item.html rename to client/ticket/src/list/ticket-item.html index eed354bff..d245d04ab 100644 --- a/client/ticket/src/index/item.html +++ b/client/ticket/src/list/ticket-item.html @@ -1,5 +1,5 @@ diff --git a/client/ticket/src/index/item.js b/client/ticket/src/list/ticket-item.js similarity index 88% rename from client/ticket/src/index/item.js rename to client/ticket/src/list/ticket-item.js index c48d773f1..da58c89cd 100644 --- a/client/ticket/src/index/item.js +++ b/client/ticket/src/list/ticket-item.js @@ -13,7 +13,7 @@ class Controller { ngModule.component('vnTicketItem', { controller: Controller, - template: require('./item.html'), + template: require('./ticket-item.html'), bindings: { ticket: '<' } diff --git a/client/ticket/src/index/index.html b/client/ticket/src/list/ticket-list.html similarity index 79% rename from client/ticket/src/index/index.html rename to client/ticket/src/list/ticket-list.html index 51a50474c..9952267f0 100644 --- a/client/ticket/src/index/index.html +++ b/client/ticket/src/list/ticket-list.html @@ -1,4 +1,4 @@ - +
@@ -19,6 +19,6 @@
-
- + + diff --git a/client/ticket/src/index/index.js b/client/ticket/src/list/ticket-list.js similarity index 57% rename from client/ticket/src/index/index.js rename to client/ticket/src/list/ticket-list.js index bc514194c..f1538f300 100644 --- a/client/ticket/src/index/index.js +++ b/client/ticket/src/list/ticket-list.js @@ -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 }); diff --git a/client/ticket/src/ticket.js b/client/ticket/src/ticket.js index c7b861d2c..92b0b6ec8 100644 --- a/client/ticket/src/ticket.js +++ b/client/ticket/src/ticket.js @@ -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';