Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 1824-e2e-worker-phone
gitea/salix/1824-e2e-worker-phone This commit looks good Details

This commit is contained in:
Carlos Jimenez Ruiz 2020-02-07 10:34:31 +01:00
commit 4f7241882e
10 changed files with 91 additions and 31 deletions

View File

@ -32,12 +32,11 @@ describe('Claim action path', () => {
expect(result).toEqual('Data saved!');
});
// #2036 claim.action destinatario
it('should edit the second line destination field', async() => {
await page.autocompleteSearch(selectors.claimAction.secondLineDestination, 'Bueno');
// const result = await page.waitForLastSnackbar();
const result = await page.waitForLastSnackbar();
// expect(result).toEqual('Data saved!');
expect(result).toEqual('Data saved!');
});
it('should delete the first line', async() => {

View File

@ -1,7 +1,10 @@
<vn-crud-model vn-id="model" auto-load="true" auto-save="true"
<vn-crud-model vn-id="model"
url="ClaimEnds"
filter="$ctrl.filter"
data="$ctrl.salesClaimed">
data="$ctrl.salesClaimed"
auto-load="true"
auto-save="true"
on-save="$ctrl.onSave()">
</vn-crud-model>
<vn-crud-model auto-load="true"

View File

@ -203,6 +203,10 @@ class Controller {
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
});
}
onSave() {
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
}
}
Controller.$inject = ['$stateParams', '$scope', '$http', '$translate', 'vnApp', '$httpParamSerializer'];

View File

@ -6,14 +6,15 @@
order="shipped DESC, isOk ASC">
</vn-crud-model>
<vn-portal slot="topbar">
<vn-searchbar
vn-focus
<vn-searchbar vn-focus
panel="vn-request-search-panel"
on-search="$ctrl.onSearch($params)"
info="Search request by id or alias"
suggested-filter="$ctrl.filter.where">
suggested-filter="$ctrl.filter.where"
info="Search request by id or alias">
</vn-searchbar>
</vn-portal>
<vn-auto-search
on-search="$ctrl.onSearch($params)">
</vn-auto-search>
<vn-data-viewer model="model">
<vn-card>
<vn-table model="model">
@ -21,8 +22,6 @@
<vn-tr>
<vn-th field="ticketFk" number>Ticket ID</vn-th>
<vn-th field="shipped">Shipped</vn-th>
<vn-th field="warehouse">Warehouse</vn-th>
<vn-th field="salesPersonNickname">SalesPerson</vn-th>
<vn-th field="description">Description</vn-th>
<vn-th field="quantity" number editable>Requested</vn-th>
<vn-th field="price" number>Price</vn-th>
@ -47,15 +46,7 @@
{{::request.shipped | date: 'dd/MM/yyyy'}}
</span>
</vn-td>
<vn-td>{{::request.warehouse}}</vn-td>
<vn-td>
<span
class="link"
ng-click="$ctrl.showWorkerDescriptor($event, request.salesPersonFk)">
{{::request.salesPersonNickname}}
</span>
</vn-td>
<vn-td title="{{::request.description}}">{{::request.description}}</vn-td>
<vn-td title="{{::request.description}}" expand>{{::request.description}}</vn-td>
<vn-td number>{{::request.quantity}}</vn-td>
<vn-td number>{{::request.price | currency: 'EUR':2}}</vn-td>
<vn-td>
@ -82,7 +73,7 @@
</vn-input-number>
</field>
</vn-td-editable>
<vn-td>
<vn-td expand>
<span
class="link"
ng-click="$ctrl.showItemDescriptor($event, request.itemFk)"
@ -101,7 +92,8 @@
ng-if="request.isOk != 0"
icon="thumb_down"
ng-click="$ctrl.showDenyReason($event, request)"
translate-attr="{title: 'Discard'}">
translate-attr="{title: 'Discard'}"
tabindex="-1">
</vn-icon-button>
</vn-td>
</vn-tr>
@ -124,7 +116,7 @@
<tpl-body>
<h5 class="vn-pa-md" translate>Specify the reasons to deny this request</h5>
<vn-horizontal class="vn-pa-md">
<vn-textarea
<vn-textarea vn-focus
ng-model="$ctrl.denyObservation">
</vn-textarea>
</vn-horizontal>

View File

@ -96,7 +96,6 @@ export default class Controller extends Component {
this.selectedRequest = requestId;
this.$.denyReason.parent = event.target;
this.$.denyReason.show();
document.querySelector('vn-item-request vn-textarea textArea').focus();
}
clear() {

View File

@ -1,5 +1,5 @@
<vn-portal slot="menu">
<vn-route-descriptor route="$ctrl.route"></vn-route-descriptor>
<vn-route-descriptor route="$ctrl.route" card-reload="$ctrl.reload()"></vn-route-descriptor>
<vn-left-menu source="card"></vn-left-menu>
</vn-portal>
<ui-view></ui-view>

View File

@ -70,7 +70,7 @@ class Controller {
let url = `Routes/${this.route.id}/updateVolume`;
this.$http.post(url).then(() => {
this.vnApp.showSuccess(this.$translate.instant('Volume updated'));
if (this.card) this.card.reload();
this.cardReload();
});
}
}
@ -82,10 +82,8 @@ ngModule.component('vnRouteDescriptor', {
template: require('./index.html'),
bindings: {
route: '<',
cardReload: '&?',
quicklinks: '<'
},
require: {
card: '^?vnRouteCard'
},
controller: Controller
});

View File

@ -89,6 +89,8 @@ class Controller {
isEditable(isOk) {
if (isOk != null)
return true;
return false;
}
}

View File

@ -0,0 +1,62 @@
import './index';
describe('Ticket', () => {
describe('Component vnTicketRequestIndex', () => {
let controller;
let $scope;
beforeEach(ngModule('ticket'));
beforeEach(angular.mock.inject(($componentController, $rootScope) => {
$scope = $rootScope.$new();
controller = $componentController('vnTicketRequestIndex', {$scope});
}));
describe('getRequestState()', () => {
it('should return New when the state is null', () => {
let state = null;
let result = controller.getRequestState(state);
expect(result).toEqual('New');
});
it('should return Denied when the state is false', () => {
let state = false;
let result = controller.getRequestState(state);
expect(result).toEqual('Denied');
});
it('should return Acepted when the state is true', () => {
let state = true;
let result = controller.getRequestState(state);
expect(result).toEqual('Acepted');
});
});
describe('isEditable()', () => {
it('should return true when isOk is true', () => {
let isOk = true;
let result = controller.isEditable(isOk);
expect(result).toEqual(true);
});
it('should return true when isOk is false', () => {
let isOk = false;
let result = controller.isEditable(isOk);
expect(result).toEqual(true);
});
it('should return true when isOk is null', () => {
let isOk = null;
let result = controller.isEditable(isOk);
expect(result).toEqual(false);
});
});
});
});

View File

@ -3,4 +3,5 @@ Atender: Comprador
Remove request: Eliminar petición
New request: Crear petición
Sale id: Id linea
Requester: Solicitante
Requester: Solicitante
New purchase request: Nueva petición de compra