Merge branch '2044-ticket.request' of verdnatura/salix into dev
gitea/salix/dev This commit looks good Details
gitea/salix/test This commit looks good Details

This commit is contained in:
Joan Sanchez 2020-01-29 06:49:32 +00:00 committed by Gitea
commit 86c5e33e1a
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"]', priceInput: 'vn-ticket-request-create [ng-model="$ctrl.ticketRequest.price"]',
firstRemoveRequestButton: 'vn-ticket-request-index vn-icon[icon="delete"]:nth-child(1)', firstRemoveRequestButton: 'vn-ticket-request-index vn-icon[icon="delete"]:nth-child(1)',
saveButton: 'vn-ticket-request-create button[type=submit]', 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: { ticketLog: {

View File

@ -38,7 +38,7 @@ describe('Ticket purchase request path', () => {
it(`should confirm the new request was added`, async() => { it(`should confirm the new request was added`, async() => {
await page.reloadSection('ticket.card.request.index'); 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'); expect(result).toEqual('New stuff');
}); });

View File

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

View File

@ -31,30 +31,51 @@
<vn-tbody> <vn-tbody>
<vn-tr ng-repeat="request in purchaseRequests"> <vn-tr ng-repeat="request in purchaseRequests">
<vn-td number>{{::request.id}}</vn-td> <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-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 <span
class="link" class="link"
ng-click="$ctrl.showWorkerDescriptor($event, request.requesterFk)"> ng-click="$ctrl.showWorkerDescriptor($event, request.requesterFk)">
{{::request.requester.user.nickname | dashIfEmpty}} {{::request.requester.user.nickname | dashIfEmpty}}
</span> </span>
</vn-td> </vn-td>
<vn-td expand> <vn-td>
<span <span
class="link" class="link"
ng-click="$ctrl.showWorkerDescriptor($event, request.attenderFk)"> ng-click="$ctrl.showWorkerDescriptor($event, request.attenderFk)">
{{::request.atender.user.nickname | dashIfEmpty}} {{::request.atender.user.nickname | dashIfEmpty}}
</span> </span>
</vn-td> </vn-td>
<vn-td number>{{::request.quantity}}</vn-td> <vn-td>
<vn-td number>{{::request.price | currency: 'EUR': 2}}</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> <vn-td number>
<span <span
ng-show="::request.saleFk" ng-show="::request.saleFk"
ng-click="$ctrl.showItemDescriptor($event, request.sale.itemFk)" ng-click="$ctrl.showItemDescriptor($event, request.sale.itemFk)"
class="link"> class="link">
{{request.saleFk | zeroFill:6}} {{::request.saleFk | zeroFill:6}}
</span> </span>
</vn-td> </vn-td>
<vn-td number> <vn-td number>

View File

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