merge conflicts

This commit is contained in:
Daniel Herrero 2018-03-01 12:55:07 +01:00
commit a78292ffb8
14 changed files with 190 additions and 4 deletions

View File

@ -181,6 +181,30 @@
} }
}, },
{ {
"url": "/recovery",
"abstract": true,
"state": "clientCard.recovery",
"component": "ui-view"
},
{
"url": "/list",
"state": "clientCard.recovery.list",
"component": "vn-client-recovery-list",
"params": {
"client": "$ctrl.client"
},
"menu": {
"description": "Recovery",
"icon": "credit_card"
}
}, {
"url": "/create",
"state": "clientCard.recovery.create",
"component": "vn-client-recovery-create",
"params": {
"client": "$ctrl.client"
}
}, {
"url": "/summary", "url": "/summary",
"state": "clientCard.summary", "state": "clientCard.summary",
"component": "vn-client-summary", "component": "vn-client-summary",

View File

@ -20,3 +20,5 @@ import './greuge-list/greuge-list';
import './greuge-create/greuge-create'; import './greuge-create/greuge-create';
import './mandate/mandate'; import './mandate/mandate';
import './summary/client-summary'; import './summary/client-summary';
import './recovery-list/recovery-list';
import './recovery-create/recovery-create';

View File

@ -15,8 +15,7 @@
<vn-date-picker vn-one <vn-date-picker vn-one
label="Date" label="Date"
model="$ctrl.greuge.shipped" model="$ctrl.greuge.shipped"
ini-options="{enableTime: true, dateFormat: 'd-m-Y h:i', time_24hr: true}" ini-options="{enableTime: true, dateFormat: 'd-m-Y h:i', time_24hr: true}">
>
</vn-date-picker> </vn-date-picker>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>

View File

@ -0,0 +1,2 @@
Add recovery: Añadir recobro
Period: Periodo

View File

@ -0,0 +1,34 @@
<mg-ajax path="/client/api/recoveries" options="vnPost"></mg-ajax>
<vn-watcher
vn-id="watcher"
data="$ctrl.recovery"
form="form"
save="post">
</vn-watcher>
<form pad-medium name="form" ng-submit="$ctrl.onSubmit()">
<vn-card>
<vn-vertical pad-large>
<vn-title>Add recovery</vn-title>
<vn-horizontal>
<vn-date-picker vn-one
label="Since"
model="$ctrl.recovery.started"
ini-options="{dateFormat: 'd-m-Y'}"
vn-focus>
</vn-date-picker>
<vn-date-picker vn-one
label="To"
model="$ctrl.recovery.finished"
ini-options="{dateFormat: 'd-m-Y'}">
</vn-date-picker>
<vn-textfield vn-one label="Amount" field="$ctrl.recovery.amount" type="number"></vn-textfield>
<vn-textfield vn-one label="Period" field="$ctrl.recovery.period" type="number"></vn-textfield>
</vn-horizontal>
</vn-vertical>
</vn-card>
<vn-button-bar>
<vn-submit label="Save"></vn-submit>
</vn-button-bar>
</form>

View File

@ -0,0 +1,25 @@
import ngModule from '../module';
class ClientRecoveryCreate {
constructor($scope, $state, $filter) {
this.$ = $scope;
this.$state = $state;
this.recovery = {
started: $filter('date')(new Date(), 'yyyy-MM-dd HH:mm')
};
}
onSubmit() {
this.recovery.clientFk = this.$state.params.id;
this.$.watcher.submit().then(
() => {
this.$state.go('clientCard.recovery.list');
}
);
}
}
ClientRecoveryCreate.$inject = ['$scope', '$state', '$filter'];
ngModule.component('vnClientRecoveryCreate', {
template: require('./recovery-create.html'),
controller: ClientRecoveryCreate
});

View File

@ -0,0 +1,39 @@
import './recovery-create.js';
describe('Client', () => {
describe('Component vnClientRecoveryCreate', () => {
let $componentController;
let $scope;
let $state;
let controller;
beforeEach(() => {
angular.mock.module('client');
});
beforeEach(angular.mock.inject((_$componentController_, $rootScope, _$state_) => {
$componentController = _$componentController_;
$scope = $rootScope.$new();
$state = _$state_;
$scope.watcher = {
submit: () => {
return {
then: callback => {
callback();
}
};
}
};
controller = $componentController('vnClientRecoveryCreate', {$scope: $scope});
}));
describe('onSubmit()', () => {
it('should call the function go() on $state to go to the recovery list', () => {
spyOn($state, 'go');
controller.onSubmit();
expect(controller.$state.go).toHaveBeenCalledWith('clientCard.recovery.list');
});
});
});
});

View File

@ -0,0 +1,4 @@
Since: Desde
Employee: Empleado
No results: Sin resultados
To: Hasta

View File

@ -0,0 +1,29 @@
<mg-ajax path="/client/api/Recoveries/filter" options="vnIndexNonAuto"></mg-ajax>
<vn-card pad-medium>
<vn-vertical pad-large>
<vn-title vn-one margin-large-bottom>Recovery</vn-title>
<vn-grid-header on-order="$ctrl.onOrder(field, order)">
<vn-column-header vn-one pad-medium-h field="started" text="Since" default-order="DESC"></vn-column-header>
<vn-column-header vn-one pad-medium-h field="finished" text="To"></vn-column-header>
<vn-column-header vn-one pad-medium-h field="amount" text="Amount"></vn-column-header>
<vn-column-header vn-one pad-medium-h field="period" text="Period"></vn-column-header>
</vn-grid-header>
<vn-one class="list list-content">
<vn-horizontal
vn-one class="list list-element text-center"
pad-small-bottom
ng-repeat="recovery in index.model.instances track by recovery.id">
<vn-one pad-medium-h>{{::recovery.started | date:'dd/MM/yyyy' }}</vn-one>
<vn-one pad-medium-h>{{::recovery.finished | date:'dd/MM/yyyy' }}</vn-one>
<vn-one pad-medium-h>{{::recovery.amount | currency:'€':0}}</vn-one>
<vn-one pad-medium-h>{{::recovery.period}}</vn-one>
</vn-horizontal>
</vn-one>
<vn-one class="text-center pad-small-v" ng-if="index.model.count === 0" translate>No results</vn-one>
<vn-horizontal vn-one class="list list-footer"></vn-horizontal>
<vn-paging vn-one margin-large-top index="index" total="index.model.count"></vn-paging>
</vn-vertical>
</vn-card>
<a ui-sref="clientCard.recovery.create" fixed-bottom-right>
<vn-float-button icon="add"></vn-float-button>
</a>

View File

@ -0,0 +1,7 @@
import ngModule from '../module';
import FilterClientList from '../filter-client-list';
ngModule.component('vnClientRecoveryList', {
template: require('./recovery-list.html'),
controller: FilterClientList
});

View File

@ -32,9 +32,9 @@
value-field="id" value-field="id"
field="$ctrl.item.intrastatFk" field="$ctrl.item.intrastatFk"
order="description ASC" order="description ASC"
filter-search="{where: {description: {regexp: 'search'}} }" filter-search= "{where: {or: [{id: {regexp: 'search'}}, {description: {regexp: 'search'}}]}}"
initial-data="$ctrl.item.intrastat"> initial-data="$ctrl.item.intrastat">
<tpl-item>{{$parent.$parent.item.description}}</tpl-item> <tpl-item>{{$parent.$parent.item.id}} : {{$parent.$parent.item.description}}</tpl-item>
</vn-autocomplete> </vn-autocomplete>
<vn-textfield vn-one label="Relevancy" field="$ctrl.item.relevancy" type="number"></vn-textfield> <vn-textfield vn-one label="Relevancy" field="$ctrl.item.relevancy" type="number"></vn-textfield>
</vn-horizontal> </vn-horizontal>

View File

@ -0,0 +1,14 @@
module.exports = Self => {
Self.installMethod('filter', filterParams);
function filterParams(params) {
return {
where: {
clientFk: params.clientFk
},
skip: (params.page - 1) * params.size,
limit: params.size,
order: params.order
};
}
};

View File

@ -0,0 +1,3 @@
module.exports = function(Self) {
require('../methods/recovery/filter.js')(Self);
};

View File

@ -17,6 +17,10 @@ describe('Client Create', () => {
(9, 'BruceBanner', 'ac754a330530832ba1bf7687f577da91', 18, 1, 'BruceBanner@verdnatura.es'), (9, 'BruceBanner', 'ac754a330530832ba1bf7687f577da91', 18, 1, 'BruceBanner@verdnatura.es'),
(10, 'JessicaJones', 'ac754a330530832ba1bf7687f577da91', 9, 1, 'JessicaJones@verdnatura.es'), (10, 'JessicaJones', 'ac754a330530832ba1bf7687f577da91', 9, 1, 'JessicaJones@verdnatura.es'),
(11, 'Cyborg', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'cyborg@verdnatura.es'); (11, 'Cyborg', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'cyborg@verdnatura.es');
INSERT INTO account.user(name, password, role, active, email)
SELECT name, MD5('nightmare'), id, 1, CONCAT(name, '@verdnatura.es')
FROM account.role;
INSERT INTO salix.Address(id, consignee, street, city, postcode, provinceFk, phone, mobile, isEnabled, isDefaultAddress, clientFk, defaultAgencyFk, longitude, latitude, isEqualizated) INSERT INTO salix.Address(id, consignee, street, city, postcode, provinceFk, phone, mobile, isEnabled, isDefaultAddress, clientFk, defaultAgencyFk, longitude, latitude, isEqualizated)
VALUES VALUES