3012 - Hotfix: Get ticket list
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
878e989c02
commit
ea78db1441
|
@ -1,9 +1,7 @@
|
|||
<vn-crud-model
|
||||
vn-id="ticketsModel"
|
||||
url="InvoiceOuts/{{$ctrl.$params.id}}/getTickets"
|
||||
limit="10"
|
||||
data="tickets"
|
||||
auto-load="true">
|
||||
data="tickets">
|
||||
</vn-crud-model>
|
||||
<vn-card class="summary">
|
||||
<h5>
|
||||
|
@ -56,7 +54,7 @@
|
|||
</vn-two>
|
||||
<vn-auto>
|
||||
<h4 translate>Ticket</h4>
|
||||
<vn-table model="model">
|
||||
<vn-table>
|
||||
<vn-thead>
|
||||
<vn-tr>
|
||||
<vn-th number>Ticket id</vn-th>
|
||||
|
|
|
@ -5,8 +5,10 @@ import './style.scss';
|
|||
class Controller extends Summary {
|
||||
set invoiceOut(value) {
|
||||
this._invoiceOut = value;
|
||||
if (value && value.id)
|
||||
if (value && value.id) {
|
||||
this.getSummary();
|
||||
this.getTickets();
|
||||
}
|
||||
}
|
||||
|
||||
get invoiceOut() {
|
||||
|
@ -17,6 +19,14 @@ class Controller extends Summary {
|
|||
return this.$http.get(`InvoiceOuts/${this.invoiceOut.id}/summary`)
|
||||
.then(res => this.summary = res.data);
|
||||
}
|
||||
|
||||
getTickets() {
|
||||
this.$.$applyAsync(() => {
|
||||
const query = `InvoiceOuts/${this.invoiceOut.id}/getTickets`;
|
||||
this.$.ticketsModel.url = query;
|
||||
this.$.ticketsModel.refresh();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
ngModule.vnComponent('vnInvoiceOutSummary', {
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import './index.js';
|
||||
import crudModel from 'core/mocks/crud-model';
|
||||
|
||||
describe('InvoiceOut', () => {
|
||||
describe('Component summary', () => {
|
||||
|
@ -13,17 +14,30 @@ describe('InvoiceOut', () => {
|
|||
$scope = $rootScope.$new();
|
||||
const $element = angular.element('<vn-invoice-out-summary></vn-invoice-out-summary>');
|
||||
controller = $componentController('vnInvoiceOutSummary', {$element, $scope});
|
||||
controller.invoiceOut = {id: 1};
|
||||
controller._invoiceOut = {id: 1};
|
||||
controller.$.ticketsModel = crudModel;
|
||||
}));
|
||||
|
||||
describe('getSummary()', () => {
|
||||
it('should perform a query to set summary', () => {
|
||||
$httpBackend.when('GET', `InvoiceOuts/1/summary`).respond(200, 'the data you are looking for');
|
||||
$httpBackend.expect('GET', `InvoiceOuts/1/summary`).respond(200, 'the data you are looking for');
|
||||
controller.getSummary();
|
||||
$httpBackend.flush();
|
||||
|
||||
expect(controller.summary).toEqual('the data you are looking for');
|
||||
});
|
||||
});
|
||||
|
||||
describe('getTickets()', () => {
|
||||
it('should perform a and then call to the ticketModel refresh() method', () => {
|
||||
jest.spyOn(controller.$.ticketsModel, 'refresh');
|
||||
|
||||
controller.getTickets();
|
||||
$scope.$apply();
|
||||
|
||||
expect(controller.$.ticketsModel.url).toEqual('InvoiceOuts/1/getTickets');
|
||||
expect(controller.$.ticketsModel.refresh).toHaveBeenCalledWith();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue