update ticket request
gitea/salix/2044-ticket.request There was a failure building this commit Details

This commit is contained in:
Bernat Exposito Domenech 2020-01-28 09:05:01 +01:00
parent ddceb885ec
commit 35b9820e73
5 changed files with 42 additions and 9 deletions

View File

@ -487,7 +487,7 @@ export default {
priceInput: 'vn-ticket-request-create [ng-model="$ctrl.ticketRequest.price"]',
firstRemoveRequestButton: 'vn-ticket-request-index vn-icon[icon="delete"]:nth-child(1)',
saveButton: 'vn-ticket-request-create button[type=submit]',
firstDescription: 'vn-ticket-request-index vn-table vn-tr:nth-child(1) > vn-td:nth-child(2)',
firstDescription: 'vn-ticket-request-index vn-table vn-tr:nth-child(1) > vn-td:nth-child(2) vn-textfield',
},
ticketLog: {

View File

@ -38,7 +38,7 @@ describe('Ticket purchase request path', () => {
it(`should confirm the new request was added`, async() => {
await page.reloadSection('ticket.card.request.index');
const result = await page.waitToGetProperty(selectors.ticketRequests.firstDescription, 'innerText');
const result = await page.waitToGetProperty(`${selectors.ticketRequests.firstDescription} input`, 'value');
expect(result).toEqual('New stuff');
});

View File

@ -3,7 +3,7 @@
url="TicketPackagings"
fields="['id', 'ticketFk', 'packagingFk', 'quantity', 'created']"
link="{ticketFk: $ctrl.$stateParams.id}"
data="packages" on-data-change="$ctrl.onDataChange()"
data="packages"
auto-load="true">
</vn-crud-model>
<vn-watcher

View File

@ -31,30 +31,51 @@
<vn-tbody>
<vn-tr ng-repeat="request in purchaseRequests">
<vn-td number>{{::request.id}}</vn-td>
<vn-td expand>{{::request.description}}</vn-td>
<vn-td number>{{::request.created | date: 'dd/MM/yyyy'}}</vn-td>
<vn-td expand>
<vn-textfield
vn-one
disabled="$ctrl.isEditable(request.isOk)"
ng-model="::request.description"
on-change="$ctrl.updateData()">
</vn-textfield>
</vn-td>
<vn-td number>{{::request.created | date: 'dd/MM/yyyy'}}</vn-td>
<vn-td>
<span
class="link"
ng-click="$ctrl.showWorkerDescriptor($event, request.requesterFk)">
{{::request.requester.user.nickname | dashIfEmpty}}
</span>
</vn-td>
<vn-td expand>
<vn-td>
<span
class="link"
ng-click="$ctrl.showWorkerDescriptor($event, request.attenderFk)">
{{::request.atender.user.nickname | dashIfEmpty}}
</span>
</vn-td>
<vn-td number>{{::request.quantity}}</vn-td>
<vn-td number>{{::request.price | currency: 'EUR': 2}}</vn-td>
<vn-td>
<vn-input-number
min="1"
disabled="$ctrl.isEditable(request.isOk)"
ng-model="::request.quantity"
on-change="$ctrl.updateData()">
</vn-input-number>
</vn-td>
<vn-td>
<vn-input-number
step="0.01"
disabled="$ctrl.isEditable(request.isOk)"
ng-model="::request.price"
on-change="$ctrl.updateData()">
</vn-input-number>
</vn-td>
<vn-td number>
<span
ng-show="::request.saleFk"
ng-click="$ctrl.showItemDescriptor($event, request.sale.itemFk)"
class="link">
{{request.saleFk | zeroFill:6}}
{{::request.saleFk | zeroFill:6}}
</span>
</vn-td>
<vn-td number>

View File

@ -78,6 +78,18 @@ class Controller {
return 'Acepted';
}
}
updateData() {
this.$.model.save().then(() => {
this.$.watcher.notifySaved();
this.$.watcher.updateOriginalData();
});
}
isEditable(isOk) {
if (isOk != null)
return true;
}
}
Controller.$inject = ['$scope', '$stateParams'];