Merge pull request '2724 - Fix: Create new service type' (#511) from 2724-ticket_service_fix into dev
gitea/salix/pipeline/head This commit looks good Details

Reviewed-on: #511
Reviewed-by: Carlos Jimenez Ruiz <carlosjr@verdnatura.es>
This commit is contained in:
Carlos Jimenez Ruiz 2021-01-18 13:03:26 +00:00
commit e4c5ebf615
3 changed files with 7 additions and 1 deletions

View File

@ -6,6 +6,7 @@
auto-load="true">
</vn-crud-model>
<vn-crud-model
vn-id="typesModel"
auto-load="true"
url="TicketServiceTypes"
data="ticketServiceTypes"

View File

@ -35,6 +35,10 @@ class Controller extends Section {
throw new UserError(`Name can't be empty`);
return this.$http.post(`TicketServiceTypes`, this.$.newServiceType)
.then(res => {
this.$.typesModel.refresh();
return res;
})
.then(res => service.ticketServiceTypeFk = res.data.id);
}

View File

@ -1,4 +1,5 @@
import './index.js';
import crudModel from 'core/mocks/crud-model';
describe('Ticket component vnTicketService', () => {
let controller;
@ -11,7 +12,7 @@ describe('Ticket component vnTicketService', () => {
beforeEach(inject(($componentController, _$httpBackend_, $rootScope) => {
$httpBackend = _$httpBackend_;
$scope = $rootScope.$new();
$scope.typesModel = crudModel;
$element = angular.element(`<div></div>`);
controller = $componentController('vnTicketService', {$scope, $element});
}));