#779 ticket.ticketRequester

This commit is contained in:
Carlos Jimenez 2018-11-12 11:22:25 +01:00
parent 247aa317af
commit ded3fda09b
2 changed files with 97 additions and 0 deletions

View File

@ -0,0 +1,68 @@
<vn-crud-model
vn-id="model"
url="/ticket/api/TicketRequests"
fields="['id', 'description', 'created', 'requesterFk', 'atenderFk', 'quantity', 'price', 'saleFk', 'isOk']"
order="created ASC"
data="purchaseRequests">
</vn-crud-model>
<vn-watcher
vn-id="watcher"
data="purchaseRequests"
form="form">
</vn-watcher>
<form name="form" ng-submit="$ctrl.onSubmit()">
<vn-card pad-large>
<vn-title>Purchase request</vn-title>
<vn-horizontal ng-repeat="request in purchaseRequests">
<vn-textfield
vn-two
label="Description"
model="request.description"
vn-acl="salesPerson">
</vn-textfield>
<vn-textfield
vn-one
label="Quantity"
model="request.quantity"
type="text">
</vn-textfield>
<vn-autocomplete
vn-one
label="Atender"
field="request.atender"
url="/client/api/Clients/activeBuyer"
show-field="name"
vn-acl="buyer"
vn-focus>
<tpl-item>{{firstName}} {{name}}</tpl-item>
</vn-autocomplete>
<vn-textfield
vn-one
label="Price"
model="request.price"
type="text">
</vn-textfield>
<vn-none>
<vn-icon-button
medium-grey
margin-medium-v
vn-tooltip="Remove request"
icon="remove_circle_outline"
ng-click="model.remove($index)"
tabindex="-1">
</vn-icon-button>
</vn-none>
</vn-horizontal>
<vn-one>
<vn-icon-button
vn-bind="+"
vn-tooltip="Add request"
icon="add_circle"
ng-click="$ctrl.add()">
</vn-icon-button>
</vn-one>
</vn-card>
<vn-button-bar>
<vn-submit label="Save"></vn-submit>
</vn-button-bar>
</form>

View File

@ -0,0 +1,29 @@
import ngModule from '../module';
class Controller {
constructor($stateParams, $scope) {
this.$stateParams = $stateParams;
this.$scope = $scope;
}
add() {
this.$scope.model.insert({
ticketFk: this.$stateParams.id
});
}
onSubmit() {
this.$scope.watcher.check();
this.$scope.model.save().then(() => {
this.$scope.watcher.notifySaved();
this.$scope.model.refresh();
});
}
}
Controller.$inject = ['$stateParams', '$scope'];
ngModule.component('vnTicketRequest', {
template: require('./index.html'),
controller: Controller
});