Merge branch 'master' of ssh://git.verdnatura.es:/var/lib/git/salix
This commit is contained in:
commit
1e282656ab
|
@ -1,3 +1,52 @@
|
|||
.display-block{
|
||||
display: block;
|
||||
}
|
||||
|
||||
/*angular-paging*/
|
||||
.well {
|
||||
min-height: 20px;
|
||||
padding: 19px;
|
||||
margin-bottom: 20px;
|
||||
background-color: #f5f5f5;
|
||||
border: 1px solid #e3e3e3;
|
||||
border-radius: 4px;
|
||||
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .05);
|
||||
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .05);
|
||||
}
|
||||
.pagination {
|
||||
display: inline-block;
|
||||
padding-left: 0;
|
||||
margin: 20px 0;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.pagination > li {
|
||||
display: inline;
|
||||
}
|
||||
.pagination > li > a,
|
||||
.pagination > li > span {
|
||||
position: relative;
|
||||
float: left;
|
||||
padding: 6px 12px;
|
||||
margin-left: -1px;
|
||||
line-height: 1.42857143;
|
||||
color: #337ab7;
|
||||
text-decoration: none;
|
||||
background-color: #fff;
|
||||
border: 1px solid #ddd;
|
||||
}
|
||||
.pagination > li:first-child > a,
|
||||
.pagination > li:first-child > span {
|
||||
margin-left: 0;
|
||||
border-top-left-radius: 4px;
|
||||
border-bottom-left-radius: 4px;
|
||||
}
|
||||
.form-group {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.pagination>li.active>a {
|
||||
background: #4f94ce;
|
||||
color: #fff;
|
||||
}
|
||||
ul.pagination li a:hover:not(.active) {background-color: #ddd;}
|
||||
/* fin angular-paging*/
|
||||
|
|
|
@ -7,6 +7,8 @@ export const COMPONENT = {
|
|||
controllerAs: 'addressData',
|
||||
controller: function($http, $state)
|
||||
{
|
||||
var self = this;
|
||||
this.clientId = $state.params.id;
|
||||
this.address = {};
|
||||
$http.get('/client/api/Agencies').then(
|
||||
json => this.agencies = json.data
|
||||
|
@ -16,6 +18,7 @@ export const COMPONENT = {
|
|||
);
|
||||
|
||||
this.submit = function(){
|
||||
this.address.client = self.clientId;
|
||||
$http.post('/client/api/Addresses', this.address).then(
|
||||
json => $state.go('clientCard.addresses')
|
||||
);
|
||||
|
|
|
@ -18,8 +18,22 @@
|
|||
</vn-auto>
|
||||
</vn-horizontal>
|
||||
</vn-vertical>
|
||||
<vn-horizontal>
|
||||
<vn-one style="text-align:center;">
|
||||
<paging page="address.currentPage"
|
||||
page-size="address.numPerPage"
|
||||
total="address.numPages"
|
||||
show-prev-next="true"
|
||||
show-first-last="true"
|
||||
ul-class="pagination"
|
||||
active-class="active"
|
||||
ng-click="address.figureOutToDisplay()">
|
||||
</paging>
|
||||
</vn-one>
|
||||
</vn-horizontal>
|
||||
|
||||
</vn-card>
|
||||
<vn-one margin-large-top style="position: fixed; bottom: 2em; right: 2em;">
|
||||
<a ui-sref="clientCard.addressDataCreate"><vn-float-button icon="add"></vn-float-button></a>
|
||||
<vn-float-button ng-click="address.newAddress()" icon="add"></vn-float-button>
|
||||
</vn-one>
|
||||
</vn-vertical>
|
||||
|
|
|
@ -5,22 +5,64 @@ export const NAME = 'vnClientAddresses';
|
|||
export const COMPONENT = {
|
||||
template: template,
|
||||
controllerAs: 'address',
|
||||
bindings: {
|
||||
adresses: '<',
|
||||
bindings: {
|
||||
client: '<'
|
||||
},
|
||||
controller: function($http)
|
||||
controller: function($http, $state)
|
||||
{
|
||||
var self = this;
|
||||
let numPerPage = 2;
|
||||
let numRecords = 0;
|
||||
|
||||
this.$onChanges = function(changes) {
|
||||
if (this.client) {
|
||||
self.client = this.client;
|
||||
this.getAddresses();
|
||||
}
|
||||
};
|
||||
this.getAddresses = () => {
|
||||
var json = JSON.stringify({client: self.client.id});
|
||||
$http.get(`/client/api/Addresses/count?where=${json}`).then(
|
||||
json => {
|
||||
numRecords = json.data.count;
|
||||
self.getNumPages();
|
||||
self.figureOutToDisplay();
|
||||
}
|
||||
);
|
||||
};
|
||||
$http.get('/client/api/Addresses').then(
|
||||
json => this.addresses = json.data
|
||||
);
|
||||
this.submit = function(){
|
||||
$http.post('/client/api/Clients', this.model).then(
|
||||
json => $state.go('clientCard.basicData',{id: json.data.id})
|
||||
|
||||
this.getNumPages = () => {
|
||||
var nPages = numRecords / numPerPage;
|
||||
if (nPages > 0)
|
||||
self.numPages = (nPages % 2) ? Math.ceil(nPages) : Math.ceil(nPages) + 1;
|
||||
};
|
||||
|
||||
this.figureOutToDisplay = () => {
|
||||
var begin = ((self.currentPage - 1) * numPerPage);
|
||||
self.getAddress(begin);
|
||||
};
|
||||
|
||||
this.getAddress = function(end) {
|
||||
var json = JSON.stringify({where: {client: self.client.id}, limit: numPerPage, skip: end});
|
||||
$http.get(`/client/api/Addresses?filter=${json}`).then(
|
||||
json => {
|
||||
self.addresses = json.data;
|
||||
self.filteredTodos = self.addresses;
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
this.pageChanged = () => {
|
||||
self.figureOutToDisplay();
|
||||
};
|
||||
this.newAddress = () => {
|
||||
$state.go("clientCard.addressDataCreate", {id: self.client.id});
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
COMPONENT.controller.$inject = ['$http'];
|
||||
COMPONENT.controller.$inject = ['$http', '$state'];
|
||||
module.component(NAME, COMPONENT);
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
<form name="form" ng-submit="form.$valid && notes.submit()" pad-medium>
|
||||
<form name="form" ng-submit="form.$valid && observation.submit()" pad-medium>
|
||||
<vn-card>
|
||||
<vn-vertical pad-large>
|
||||
<vn-title>Notas</vn-title>
|
||||
<vn-textarea label="Notas" model="notes.newNote" focus padd-medium-top></vn-textarea>
|
||||
<vn-textarea label="Notas" model="observation.newNote" focus padd-medium-top></vn-textarea>
|
||||
</vn-vertical>
|
||||
</vn-card>
|
||||
<div margin-small-top>
|
||||
<vn-submit label="Guardar"></vn-submit>
|
||||
</div>
|
||||
<vn-card margin-small-top>
|
||||
<div ng-repeat="n in notes.notes">
|
||||
<p><b>{{n.date}}</b></p>
|
||||
<div ng-repeat="n in observation.observations">
|
||||
<p><b>{{n.creationDate}} {{n.salesPerson}}</b></p>
|
||||
<p>>{{n.text}}</p>
|
||||
</div>
|
||||
<div style="margin:0" pad-large>{{notes.client.notes}}</div>
|
||||
|
|
|
@ -4,23 +4,57 @@ import {module} from '../../module';
|
|||
export const NAME = 'vnClientNotes';
|
||||
export const COMPONENT = {
|
||||
template: template,
|
||||
controllerAs: 'notes',
|
||||
controllerAs: 'observation',
|
||||
bindings: {
|
||||
client: '<'
|
||||
},
|
||||
controller: function($http) {
|
||||
this.notes = [];
|
||||
this.submit = function() {
|
||||
this.notes.push({
|
||||
text: this.newNote,
|
||||
salesPerson: 'user'
|
||||
});
|
||||
controller: function($http, copyObject, equalsObject, $transitions, $element) {
|
||||
var self = this;
|
||||
var deregister = $transitions.onStart({ }, callback);
|
||||
|
||||
$http.put('/client/api/ClientObservation', this.client).then(() => {
|
||||
this.newNote = "";
|
||||
});
|
||||
this.submit = function() {
|
||||
if (this.newNote) {
|
||||
this.client.modify = "ClientObservation";
|
||||
let observation = {
|
||||
client: this.client.id,
|
||||
text: this.newNote,
|
||||
salesPerson: 'user'
|
||||
};
|
||||
this.observations.unshift(observation);
|
||||
|
||||
$http.put('/client/api/ClientObservations', observation).then(() => {
|
||||
this.newNote = "";
|
||||
});
|
||||
}
|
||||
};
|
||||
this.$onChanges = function(changes) {
|
||||
if (this.client) {
|
||||
this.getObservation(this.client.id);
|
||||
}
|
||||
};
|
||||
|
||||
this.$onDestroy = function() {
|
||||
deregister();
|
||||
};
|
||||
|
||||
function callback(transition) {
|
||||
if (!equalsObject(self.observation, self.observationOld)) {
|
||||
self.state = transition.to().name;
|
||||
var dialog = $element[0].querySelector('dialog');
|
||||
dialog.showModal();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
this.getObservation = function(clientId) {
|
||||
let json = JSON.stringify({where: {client: this.client.id}});
|
||||
$http.get(`/client/api/clientObservations?filter=${json}`).then(
|
||||
json => {
|
||||
this.observations = json.data;
|
||||
}
|
||||
);
|
||||
};
|
||||
}
|
||||
};
|
||||
COMPONENT.controller.$inject = ['$http'];
|
||||
COMPONENT.controller.$inject = ['$http', 'copyObject', 'equalsObject', '$transitions', '$element'];
|
||||
module.component(NAME, COMPONENT);
|
||||
|
|
|
@ -31,6 +31,9 @@
|
|||
url: "/addresses",
|
||||
state: "clientCard.addresses",
|
||||
component: "vn-client-addresses",
|
||||
params: {
|
||||
client: "card.client"
|
||||
},
|
||||
description: "Consignatarios",
|
||||
icon: "local_shipping"
|
||||
}, {
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"angular": "^1.5.8",
|
||||
"angular-paging": "^2.2.2",
|
||||
"angular-translate": "^2.13.1",
|
||||
"angular-ui-router": "^1.0.0-beta.3",
|
||||
"express": "^4.14.0",
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
import * as _ngPaging from 'angular-paging';
|
||||
|
||||
export const ngPaging = {
|
||||
name: 'bw.paging'
|
||||
};
|
|
@ -3,3 +3,4 @@ export * from './oclazyload-vendor';
|
|||
export * from './uirouter-vendor';
|
||||
export * from './angular-translate-vendor';
|
||||
export * from './materialdesignlite-vendor';
|
||||
export * from './angular-paging';
|
12
db.json
12
db.json
|
@ -9,7 +9,8 @@
|
|||
"Country": 3,
|
||||
"Province": 3,
|
||||
"Agency": 4,
|
||||
"Account": 14
|
||||
"Account": 14,
|
||||
"ClientObservation": 1248
|
||||
},
|
||||
"models": {
|
||||
"User": {
|
||||
|
@ -54,6 +55,15 @@
|
|||
"Account": {
|
||||
"12": "{\"id\":12,\"name\":\"prueba12\",\"active\":false,\"user\":\"juanete\"}",
|
||||
"13": "{\"id\":13,\"name\":\"manu\",\"active\":false,\"user\":\"joselito\"}"
|
||||
},
|
||||
"ClientObservation": {
|
||||
"12": "{\"id\":12,\"text\":\"prueba12\"}",
|
||||
"41": "{\"id\":41,\"text\":\"text41\",\"creationDate\":\"2017-01-17T00:00:00.000Z\",\"client\":12,\"sdfopi\":24}",
|
||||
"1243": "{\"id\":1243,\"text\":\"string\",\"creationDate\":\"2017-01-17T00:00:00.000Z\",\"relations\":{\"clientId\":12},\"client\":1289034237891}",
|
||||
"1244": "{\"text\":\"asdf\",\"client\":12,\"salesPerson\":\"user\",\"id\":1244}",
|
||||
"1245": "{\"text\":\"asdf\",\"client\":12,\"salesPerson\":\"user\",\"id\":1245}",
|
||||
"1246": "{\"text\":\"asdf\",\"client\":12,\"salesPerson\":\"user\",\"id\":1246}",
|
||||
"1247": "{\"text\":\"zzzz\",\"client\":12,\"salesPerson\":\"user\",\"id\":1247}"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -49,6 +49,11 @@
|
|||
"type": "belongsTo",
|
||||
"model": "Province",
|
||||
"foreignKey": "provinceId"
|
||||
},
|
||||
"client": {
|
||||
"type": "belongsTo",
|
||||
"model":"Client",
|
||||
"foreignKey": "clientId"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,9 +24,9 @@
|
|||
"foreignKey": "salePersonId"
|
||||
},
|
||||
"client": {
|
||||
"type": "belongsTo",
|
||||
"model": "Client",
|
||||
"foreignKey": "clientId"
|
||||
"type": "belongsTo",
|
||||
"foreignKey": "id"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,3 +51,5 @@
|
|||
2017/01/13 15:37:25 [notice] 5088#9876: signal process started
|
||||
2017/01/16 07:49:58 [notice] 9028#8132: signal process started
|
||||
2017/01/16 08:26:22 [notice] 1256#3772: signal process started
|
||||
2017/01/17 13:27:35 [notice] 7104#204: signal process started
|
||||
2017/01/17 13:38:00 [notice] 1592#8484: signal process started
|
||||
|
|
Loading…
Reference in New Issue