Merge
This commit is contained in:
commit
9881c4e6f3
|
@ -188,6 +188,38 @@
|
|||
"description": "Invoices",
|
||||
"icon": "insert_drive_file"
|
||||
}
|
||||
},
|
||||
{
|
||||
"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",
|
||||
"state": "clientCard.summary",
|
||||
"component": "vn-client-summary",
|
||||
"params": {
|
||||
"client": "$ctrl.client"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -20,3 +20,6 @@ import './greuge-list/greuge-list';
|
|||
import './greuge-create/greuge-create';
|
||||
import './mandate/mandate';
|
||||
import './invoices/invoices';
|
||||
import './summary/client-summary';
|
||||
import './recovery-list/recovery-list';
|
||||
import './recovery-create/recovery-create';
|
||||
|
|
|
@ -15,8 +15,7 @@
|
|||
<vn-date-picker vn-one
|
||||
label="Date"
|
||||
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-horizontal>
|
||||
<vn-horizontal>
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
<vn-card margin-medium-top>
|
||||
<vn-item-client
|
||||
ng-repeat="client in index.model.instances"
|
||||
title="View client"
|
||||
client="client">
|
||||
</vn-item-client>
|
||||
</vn-card>
|
||||
|
@ -24,4 +23,10 @@
|
|||
<a ui-sref="create" fixed-bottom-right>
|
||||
<vn-float-button icon="person_add"></vn-float-button>
|
||||
</a>
|
||||
<vn-dialog class="dialog-summary"
|
||||
vn-id="dialog-summary-client">
|
||||
<tpl-body>
|
||||
<vn-client-summary client="$ctrl.clientSelected"></vn-client-summary>
|
||||
</tpl-body>
|
||||
</vn-dialog>
|
||||
</div>
|
||||
|
|
|
@ -3,13 +3,19 @@ import './style.scss';
|
|||
import './item-client';
|
||||
|
||||
export default class Controller {
|
||||
constructor() {
|
||||
this.model = {};
|
||||
constructor($scope) {
|
||||
this.$scope = $scope;
|
||||
this.clientSelected = null;
|
||||
}
|
||||
search(index) {
|
||||
index.accept();
|
||||
}
|
||||
openSummary(client) {
|
||||
this.clientSelected = client;
|
||||
this.$scope.dialogSummaryClient.show();
|
||||
}
|
||||
}
|
||||
Controller.$inject = ['$scope'];
|
||||
|
||||
ngModule.component('vnClientIndex', {
|
||||
template: require('./index.html'),
|
||||
|
|
|
@ -14,8 +14,8 @@ describe('Client', () => {
|
|||
controller = $componentController('vnClientIndex');
|
||||
}));
|
||||
|
||||
it('should define and set model property as an empty object', () => {
|
||||
expect(controller.model).toEqual({});
|
||||
it('should define and set clientSelected property as null', () => {
|
||||
expect(controller.clientSelected).toEqual(null);
|
||||
});
|
||||
|
||||
// describe('search()', () => {
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
<a ui-sref="clientCard.basicData({ id: {{::$ctrl.client.id}} })" pad-medium border-solid-bottom>
|
||||
<h6>{{::$ctrl.client.name}}</h6>
|
||||
<div><span translate>Id</span> {{::$ctrl.client.id}}</div>
|
||||
<div><span translate>Phone</span> {{::$ctrl.client.phone | phone}}</div>
|
||||
<div><span translate>Town/City</span> {{::$ctrl.client.city}}</div>
|
||||
<div><span translate>Email</span> {{::$ctrl.client.email}}</div>
|
||||
</a>
|
||||
<vn-horizontal pad-medium border-solid-bottom>
|
||||
<a vn-one ui-sref="clientCard.basicData({ id: {{::$ctrl.client.id}} })" title="View client">
|
||||
<h6>{{::$ctrl.client.name}}</h6>
|
||||
<div><span translate>Id</span> {{::$ctrl.client.id}}</div>
|
||||
<div><span translate>Phone</span> {{::$ctrl.client.phone | phone}}</div>
|
||||
<div><span translate>Town/City</span> {{::$ctrl.client.city}}</div>
|
||||
<div><span translate>Email</span> {{::$ctrl.client.email}}</div>
|
||||
</a>
|
||||
<vn-auto>
|
||||
<vn-icon ng-click="$ctrl.preview()" vn-tooltip="Preview" pad-medium-top margin-small-top icon="icon-preview"></vn-icon>
|
||||
</vn-auto>
|
||||
</vn-horizontal>
|
||||
|
|
|
@ -1,8 +1,18 @@
|
|||
import ngModule from '../module';
|
||||
|
||||
class Controller {
|
||||
preview() {
|
||||
this.list.openSummary(this.client);
|
||||
}
|
||||
}
|
||||
|
||||
ngModule.component('vnItemClient', {
|
||||
template: require('./item-client.html'),
|
||||
controller: Controller,
|
||||
bindings: {
|
||||
client: '<'
|
||||
},
|
||||
require: {
|
||||
list: '^vnClientIndex'
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,20 +1,21 @@
|
|||
vn-item-client {
|
||||
display: block;
|
||||
|
||||
a {
|
||||
display: block;
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
}
|
||||
a:hover {
|
||||
color: white;
|
||||
background-color: #424242;
|
||||
}
|
||||
span {
|
||||
font-size: .9em;
|
||||
color: #666;
|
||||
}
|
||||
a:hover span {
|
||||
color: #aaa;
|
||||
vn-horizontal {
|
||||
a {
|
||||
display: block;
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
}
|
||||
&:hover {
|
||||
color: white;
|
||||
background-color: #424242;
|
||||
}
|
||||
span {
|
||||
font-size: .9em;
|
||||
color: #666;
|
||||
}
|
||||
&:hover span {
|
||||
color: #aaa;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
Add recovery: Añadir recobro
|
||||
Period: Periodo
|
|
@ -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>
|
|
@ -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
|
||||
});
|
|
@ -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');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
|
@ -0,0 +1,4 @@
|
|||
Since: Desde
|
||||
Employee: Empleado
|
||||
No results: Sin resultados
|
||||
To: Hasta
|
|
@ -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>
|
|
@ -0,0 +1,7 @@
|
|||
import ngModule from '../module';
|
||||
import FilterClientList from '../filter-client-list';
|
||||
|
||||
ngModule.component('vnClientRecoveryList', {
|
||||
template: require('./recovery-list.html'),
|
||||
controller: FilterClientList
|
||||
});
|
|
@ -0,0 +1,46 @@
|
|||
<vn-vertical vn-one pad-medium>
|
||||
<vn-card class="summary">
|
||||
<vn-vertical pad-medium>
|
||||
<vn-auto>
|
||||
<h5 text-center pad-small-v class="tittle">{{$ctrl.client.name}} - {{$ctrl.client.id}} - {{$ctrl.client.salesPerson.name}}</h5>
|
||||
</vn-auto>
|
||||
<vn-horizontal vn-one>
|
||||
<vn-one margin-medium>
|
||||
<h5 translate>Basic data</h5>
|
||||
<p><span translate>Commercial name</span>: <b>{{$ctrl.client.name}}</b></p>
|
||||
<p><span translate>Contact</span>: <b>{{$ctrl.client.contact}}</b></p>
|
||||
<p><span translate>Phone</span>: <b>{{$ctrl.client.phone}}</b></p>
|
||||
<p><span translate>Mobile</span>: <b>{{$ctrl.client.mobile}}</b></p>
|
||||
<p><span translate>Email</span>: <b>{{$ctrl.client.email}}</b></p>
|
||||
<p><span translate>Salesperson</span>: <b>{{$ctrl.client.salesPerson}}</b></p>
|
||||
<p><span translate>Channel</span>: <b>{{$ctrl.client.contactChannel}}</b></p>
|
||||
</vn-one>
|
||||
<vn-one margin-medium>
|
||||
<h5 translate>Fiscal data</h5>
|
||||
<p><span translate>Social name</span>: <b>{{$ctrl.client.socialName}}</b></p>
|
||||
<p><span translate>NIF / CIF</span>: <b>{{$ctrl.client.fi}}</b></p>
|
||||
<p><span translate>Fiscal address</span>: <b>{{$ctrl.client.street}}</b></p>
|
||||
<p><span translate>City</span>: <b>{{$ctrl.client.city}}</b></p>
|
||||
<p><span translate>Postcode</span>: <b>{{$ctrl.client.postcode}}</b></p>
|
||||
<p><span translate>Province</span>: <b>{{$ctrl.client.province}}</b></p>
|
||||
<p><span translate>Country</span>: <b>{{$ctrl.client.country}}</b></p>
|
||||
</vn-one>
|
||||
<vn-one margin-medium>
|
||||
<h5 translate>Pay method</h5>
|
||||
<p><span translate>Pay method</span>: <b>{{$ctrl.client.payMethodFk}}</b></p>
|
||||
</vn-one>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal vn-one>
|
||||
<vn-one margin-medium>
|
||||
<h5 translate>Address</h5>
|
||||
</vn-one>
|
||||
<vn-one margin-medium>
|
||||
<h5 translate>Credit</h5>
|
||||
</vn-one>
|
||||
<vn-one margin-medium>
|
||||
<h5 translate>Greuge</h5>
|
||||
</vn-one>
|
||||
</vn-horizontal>
|
||||
</vn-vertical>
|
||||
</vn-card>
|
||||
</vn-vertical>
|
|
@ -0,0 +1,8 @@
|
|||
import ngModule from '../module';
|
||||
|
||||
ngModule.component('vnClientSummary', {
|
||||
template: require('./client-summary.html'),
|
||||
bindings: {
|
||||
client: '<'
|
||||
}
|
||||
});
|
|
@ -6,7 +6,7 @@
|
|||
* @return {String} The camelized string
|
||||
*/
|
||||
export function kebabToCamel(str) {
|
||||
var camelCased = str.replace(/-([a-z])/, function(g) {
|
||||
var camelCased = str.replace(/-([a-z])/g, function(g) {
|
||||
return g[1].toUpperCase();
|
||||
});
|
||||
return camelCased;
|
||||
|
|
|
@ -32,9 +32,9 @@
|
|||
value-field="id"
|
||||
field="$ctrl.item.intrastatFk"
|
||||
order="description ASC"
|
||||
filter-search="{where: {description: {regexp: 'search'}} }"
|
||||
filter-search= "{where: {or: [{id: {regexp: 'search'}}, {description: {regexp: 'search'}}]}}"
|
||||
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-textfield vn-one label="Relevancy" field="$ctrl.item.relevancy" type="number"></vn-textfield>
|
||||
</vn-horizontal>
|
||||
|
|
|
@ -22,8 +22,8 @@
|
|||
<a ui-sref="item.create" fixed-bottom-right>
|
||||
<vn-float-button icon="add"></vn-float-button>
|
||||
</a>
|
||||
<vn-dialog vn-id="preview" class="dialog-item-summary">
|
||||
<tpl-body style="width:auto; background-color: transparent">
|
||||
<vn-dialog vn-id="preview" class="dialog-summary">
|
||||
<tpl-body>
|
||||
<vn-item-summary item="$ctrl.itemSelected"></vn-item-summary>
|
||||
</tpl-body>
|
||||
</vn-dialog>
|
||||
|
|
|
@ -28,16 +28,3 @@ vn-item-product img {
|
|||
.vn-item-product-name {
|
||||
font-family: vn-font-bold;
|
||||
}
|
||||
|
||||
.vn-dialog.dialog-item-summary > div {
|
||||
border: none;
|
||||
background: transparent;
|
||||
box-shadow: none;
|
||||
}
|
||||
.vn-dialog.dialog-item-summary > div > button.close > vn-icon {
|
||||
color: $color-orange;
|
||||
}
|
||||
.vn-dialog.dialog-item-summary vn-item-summary > vn-card {
|
||||
min-width: 680px;
|
||||
margin-left: -20px;
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
<vn-card>
|
||||
<vn-card class="summary">
|
||||
<vn-vertical pad-medium>
|
||||
<vn-horizontal>
|
||||
<vn-one margin-medium>
|
||||
|
@ -12,7 +12,7 @@
|
|||
zoom-image="http://verdnatura.es/vn-image-data/catalog/900x900/{{$ctrl.item.image}}" on-error-src/>
|
||||
</vn-one>
|
||||
<vn-one>
|
||||
<h5 text-center pad-small-v class="summaryId">{{$ctrl.item.id}}</h5>
|
||||
<h5 text-center pad-small-v class="tittle">{{$ctrl.item.id}}</h5>
|
||||
</vn-one>
|
||||
</vn-vertical>
|
||||
</vn-auto>
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import ngModule from '../module';
|
||||
import './style.scss';
|
||||
|
||||
class ItemSummary {
|
||||
constructor($http) {
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
@import "../../../salix/src/styles/colors";
|
||||
|
||||
vn-item-summary{
|
||||
h5 {
|
||||
border-bottom: 2px solid $color-orange;
|
||||
}
|
||||
h5.summaryId {
|
||||
border: none;
|
||||
background: $color-orange;
|
||||
color: $color-white;
|
||||
}
|
||||
p {
|
||||
margin: 0 0 5px 0;
|
||||
}
|
||||
}
|
|
@ -7,3 +7,4 @@ import './background.scss';
|
|||
import './border.scss';
|
||||
import './font-style.scss';
|
||||
import './misc.scss';
|
||||
import './summary.scss';
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
@import "./colors";
|
||||
|
||||
.summary{
|
||||
h5 {
|
||||
border-bottom: 2px solid $color-orange;
|
||||
}
|
||||
h5.tittle {
|
||||
border: none;
|
||||
background: $color-orange;
|
||||
color: $color-white;
|
||||
}
|
||||
p {
|
||||
margin: 0 0 5px 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.vn-dialog.dialog-summary > div {
|
||||
border: none;
|
||||
background: transparent;
|
||||
box-shadow: none;
|
||||
}
|
||||
.vn-dialog.dialog-summary > div > button.close > vn-icon {
|
||||
color: $color-orange;
|
||||
}
|
||||
.vn-dialog.dialog-summary tpl-body {
|
||||
width:auto;
|
||||
background-color: transparent;
|
||||
}
|
||||
.vn-dialog.dialog-summary form {
|
||||
min-width: 680px;
|
||||
margin-left: -20px;
|
||||
}
|
|
@ -16,7 +16,7 @@ export default {
|
|||
clientsIndex: {
|
||||
searchClientInput: `${components.vnTextfield}`,
|
||||
searchButton: `${components.vnSearchBar} > vn-icon-button > button`,
|
||||
searchResult: `${components.vnItemClient}:nth-child(1) > a`,
|
||||
searchResult: `${components.vnItemClient}:nth-child(1) > vn-horizontal > a`,
|
||||
createClientButton: `${components.vnFloatButton}`
|
||||
},
|
||||
createClientView: {
|
||||
|
|
|
@ -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
|
||||
};
|
||||
}
|
||||
};
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = function(Self) {
|
||||
require('../methods/recovery/filter.js')(Self);
|
||||
};
|
|
@ -17,6 +17,10 @@ describe('Client Create', () => {
|
|||
(9, 'BruceBanner', 'ac754a330530832ba1bf7687f577da91', 18, 1, 'BruceBanner@verdnatura.es'),
|
||||
(10, 'JessicaJones', 'ac754a330530832ba1bf7687f577da91', 9, 1, 'JessicaJones@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)
|
||||
VALUES
|
||||
|
|
Loading…
Reference in New Issue