notes
This commit is contained in:
parent
05376e27c7
commit
ede68e83b9
|
@ -1,7 +1,7 @@
|
||||||
<div style="position: fixed; top: 0; right: 0; padding: .8em 1.5em; z-index: 10;">
|
<div style="position: fixed; top: 0; right: 0; padding: .8em 1.5em; z-index: 10;">
|
||||||
<vn-icon icon="exit_to_app" title="Logout" ng-click="mainMenu.onLogoutClick()"></vn-icon>
|
|
||||||
<vn-icon icon="apps" id="apps" title="Applications"></vn-icon>
|
<vn-icon icon="apps" id="apps" title="Applications"></vn-icon>
|
||||||
<vn-icon icon="notifications" title="Notifications"></vn-icon>
|
<vn-icon icon="notifications" title="Notifications"></vn-icon>
|
||||||
|
<vn-icon icon="exit_to_app" title="Logout" ng-click="mainMenu.onLogoutClick()"></vn-icon>
|
||||||
<vn-icon icon="account_circle" title="Profile" style="font-size: 35px;"></vn-icon>
|
<vn-icon icon="account_circle" title="Profile" style="font-size: 35px;"></vn-icon>
|
||||||
<!--
|
<!--
|
||||||
<vn-popover pad-medium for="apps">
|
<vn-popover pad-medium for="apps">
|
||||||
|
|
|
@ -22,6 +22,8 @@ export {NAME as CHECK_BT, factory as checkBt} from './check/check.bt';
|
||||||
export {NAME as RADIO, directive as RadioDirective} from './radio/radio';
|
export {NAME as RADIO, directive as RadioDirective} from './radio/radio';
|
||||||
export {NAME as RADIO_MDL, factory as radionMdl} from './radio/radio.mdl';
|
export {NAME as RADIO_MDL, factory as radionMdl} from './radio/radio.mdl';
|
||||||
export {NAME as RADIO_BT, factory as radioBt} from './radio/radio.bt';
|
export {NAME as RADIO_BT, factory as radioBt} from './radio/radio.bt';
|
||||||
|
export {NAME as TEXTAREA, directive as TextareaDirective} from './textarea/textarea';
|
||||||
|
export {NAME as TEXTAREA_MDL, factory as textareaMdl} from './textarea/textarea.mdl';
|
||||||
export {NAME as TEXTFIELD, directive as TextfieldDirective} from './textfield/textfield';
|
export {NAME as TEXTFIELD, directive as TextfieldDirective} from './textfield/textfield';
|
||||||
export {NAME as TEXTFIELD_MDL, factory as textfieldMdl} from './textfield/textfield.mdl';
|
export {NAME as TEXTFIELD_MDL, factory as textfieldMdl} from './textfield/textfield.mdl';
|
||||||
export {NAME as TEXTFIELD_BT, factory as textfieldBt} from './textfield/textfield.bt';
|
export {NAME as TEXTFIELD_BT, factory as textfieldBt} from './textfield/textfield.bt';
|
||||||
|
|
|
@ -8,8 +8,8 @@ export function factory() {
|
||||||
default: {
|
default: {
|
||||||
enabled: 'enabled',
|
enabled: 'enabled',
|
||||||
icon: '',
|
icon: '',
|
||||||
label: '',
|
label: ''
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
module.factory(NAME, factory);
|
module.factory(NAME, factory);
|
||||||
|
|
|
@ -1,19 +1,27 @@
|
||||||
import {module as _module} from '../module';
|
import {module as _module} from '../module';
|
||||||
import * as resolveFactory from '../resolveDefaultComponents';
|
import * as resolveFactory from '../resolveDefaultComponents';
|
||||||
import * as util from '../util';
|
import * as util from '../util';
|
||||||
|
|
||||||
const _NAME = 'textarea';
|
const _NAME = 'textarea';
|
||||||
export const NAME = util.getName(_NAME);
|
export const NAME = util.getName(_NAME);
|
||||||
|
|
||||||
directive.$inject = [resolveFactory.NAME];
|
directive.$inject = [resolveFactory.NAME];
|
||||||
export function directive(resolve) {
|
export function directive(resolve) {
|
||||||
return {
|
return {
|
||||||
require: 'E',
|
restrict: 'E',
|
||||||
template: function(_, attr) {
|
template: function(_, attr) {
|
||||||
return resolve.getTemplate(_NAME, attr);
|
return resolve.getTemplate(_NAME, attr);
|
||||||
}
|
},
|
||||||
};
|
link: function(scope, element, attrs) {
|
||||||
}
|
scope.$watch(attrs.model, () => {
|
||||||
|
let mdlField = element[0].firstChild.MaterialTextfield;
|
||||||
_module.directive(NAME, directive);
|
if (mdlField)
|
||||||
|
mdlField.updateClasses_();
|
||||||
|
});
|
||||||
|
componentHandler.upgradeElement(element[0].firstChild);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
_module.directive(NAME, directive);
|
||||||
|
|
||||||
|
|
|
@ -1,2 +1,4 @@
|
||||||
<!-- por definir -->
|
<div class="mdl-textfield mdl-js-textfield">
|
||||||
|
<textarea class="mdl-textfield__input" type="text" rows= "*[rows]*" ng-model="*[model]*" rule="*[rule]*" *[enabled]* *[focus]*></textarea>
|
||||||
|
<label class="mdl-textfield__label" translate>*[label]*</label>
|
||||||
|
</div>
|
|
@ -4,7 +4,9 @@ import * as constant from '../constants';
|
||||||
import template from './textarea.mdl.html';
|
import template from './textarea.mdl.html';
|
||||||
|
|
||||||
const _NAME = 'textarea';
|
const _NAME = 'textarea';
|
||||||
const DEFAULT_CLASS = '';
|
const DEFAULT_LABEL = 'textarea';
|
||||||
|
const DEFAULT_ROWS = 3;
|
||||||
|
|
||||||
|
|
||||||
export const NAME = util.getFactoryName(_NAME + constant.MATERIAL_DESIGN_FRAMEWORK);
|
export const NAME = util.getFactoryName(_NAME + constant.MATERIAL_DESIGN_FRAMEWORK);
|
||||||
|
|
||||||
|
@ -12,9 +14,10 @@ export function factory() {
|
||||||
return {
|
return {
|
||||||
template: template,
|
template: template,
|
||||||
default: {
|
default: {
|
||||||
className: DEFAULT_CLASS,
|
label: DEFAULT_LABEL,
|
||||||
|
rows: DEFAULT_ROWS
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
_module.factory(NAME, factory);
|
_module.factory(NAME, factory);
|
||||||
|
|
|
@ -5,8 +5,7 @@ export const NAME = 'vnClientAddressesDataEdit';
|
||||||
export const COMPONENT = {
|
export const COMPONENT = {
|
||||||
template: template,
|
template: template,
|
||||||
controllerAs: 'addressData',
|
controllerAs: 'addressData',
|
||||||
controller: function($http,$stateParams)
|
controller: function($http, $stateParams) {
|
||||||
{
|
|
||||||
this.address = {};
|
this.address = {};
|
||||||
$http.get(`/client/api/Addresses/${$stateParams.addressId}`).then(
|
$http.get(`/client/api/Addresses/${$stateParams.addressId}`).then(
|
||||||
json => this.address = json.data
|
json => this.address = json.data
|
||||||
|
@ -17,12 +16,12 @@ export const COMPONENT = {
|
||||||
$http.get('/client/api/Provinces').then(
|
$http.get('/client/api/Provinces').then(
|
||||||
json => this.provinces = json.data
|
json => this.provinces = json.data
|
||||||
);
|
);
|
||||||
|
|
||||||
this.submit = function(){
|
|
||||||
$http.put('/client/api/Addresses', this.address);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
COMPONENT.controller.$inject = ['$http' , '$stateParams'];
|
this.submit = function() {
|
||||||
|
$http.put('/client/api/Addresses', this.address);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
COMPONENT.controller.$inject = ['$http', '$stateParams'];
|
||||||
module.component(NAME, COMPONENT);
|
module.component(NAME, COMPONENT);
|
||||||
|
|
|
@ -2,13 +2,17 @@
|
||||||
<vn-card>
|
<vn-card>
|
||||||
<vn-vertical pad-large>
|
<vn-vertical pad-large>
|
||||||
<vn-title>Notas</vn-title>
|
<vn-title>Notas</vn-title>
|
||||||
<vn-textfield label="Notas" field="notes.client.notes" focus padd-medium-top></vn-textfield>
|
<vn-textarea label="Notas" model="notes.newNote" focus padd-medium-top></vn-textarea>
|
||||||
</vn-vertical>
|
</vn-vertical>
|
||||||
</vn-card>
|
</vn-card>
|
||||||
<vn-submit margin-small-top label="Guardar"></vn-submit>
|
<div margin-small-top>
|
||||||
<vn-card>
|
<vn-submit label="Guardar"></vn-submit>
|
||||||
<vn-vertical pad-large margin-small-top>
|
</div>
|
||||||
<vn-textfield label="Notas" field="notes.client.notes" padd-medium-top></vn-textfield>
|
<vn-card margin-small-top>
|
||||||
</vn-vertical>
|
<div ng-repeat="n in notes.notes">
|
||||||
|
<p><b>{{n.date}}</b></p>
|
||||||
|
<p>>{{n.text}}</p>
|
||||||
|
</div>
|
||||||
|
<div style="margin:0" pad-large>{{notes.client.notes}}</div>
|
||||||
</vn-card>
|
</vn-card>
|
||||||
</form>
|
</form>
|
|
@ -9,10 +9,18 @@ export const COMPONENT = {
|
||||||
client: '<'
|
client: '<'
|
||||||
},
|
},
|
||||||
controller: function($http) {
|
controller: function($http) {
|
||||||
|
this.notes = [];
|
||||||
this.submit = function() {
|
this.submit = function() {
|
||||||
$http.put('/client/api/Clients', this.client);
|
this.notes.push({
|
||||||
|
text: this.newNote,
|
||||||
|
salesPerson: 'user'
|
||||||
|
});
|
||||||
|
|
||||||
|
$http.put('/client/api/ClientObservation', this.client).then(() => {
|
||||||
|
this.newNote = "";
|
||||||
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
COMPONENT.controller.$inject = ['$http'];
|
COMPONENT.controller.$inject = ['$http'];
|
||||||
module.component(NAME, COMPONENT);
|
module.component(NAME, COMPONENT);
|
||||||
|
|
|
@ -46,6 +46,9 @@
|
||||||
url: "/notes",
|
url: "/notes",
|
||||||
state: "clientCard.notes",
|
state: "clientCard.notes",
|
||||||
component: "vn-client-notes",
|
component: "vn-client-notes",
|
||||||
|
params: {
|
||||||
|
client: "card.client"
|
||||||
|
},
|
||||||
description: "Notas",
|
description: "Notas",
|
||||||
icon: "insert_drive_file"
|
icon: "insert_drive_file"
|
||||||
}, {
|
}, {
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
<vn-textfield label="Usuario" class="padd-medium-top margin-medium-top" field="web.client.user" focus></vn-textfield>
|
<vn-textfield label="Usuario" class="padd-medium-top margin-medium-top" field="web.client.user" focus></vn-textfield>
|
||||||
</vn-vertical>
|
</vn-vertical>
|
||||||
</vn-card>
|
</vn-card>
|
||||||
<vn-vertical>
|
<vn-vertical margin-small-top>
|
||||||
<vn-submit margin-small-top label="Guardar"></vn-submit>
|
<vn-submit label="Guardar"></vn-submit>
|
||||||
</vn-vertical>
|
</vn-vertical>
|
||||||
</form>
|
</form>
|
||||||
<vn-confirm-client client="web.client" client-old="web.clientOld" state="web.state"></vn-confirm-client>
|
<vn-confirm-client client="web.client" client-old="web.clientOld" state="web.state"></vn-confirm-client>
|
||||||
|
|
|
@ -1,65 +1,65 @@
|
||||||
import {module} from '../module'
|
import {module} from '../module';
|
||||||
import template from './login.html'
|
import template from './login.html';
|
||||||
import style from './login.scss'
|
import style from './login.scss';
|
||||||
|
|
||||||
export const COMPONENT =
|
export const COMPONENT =
|
||||||
{
|
{
|
||||||
template: template,
|
template: template,
|
||||||
controller: controller,
|
controller: controller,
|
||||||
controllerAs: 'login'
|
controllerAs: 'login'
|
||||||
};
|
};
|
||||||
|
|
||||||
module.component('vnLogin', COMPONENT);
|
module.component('vnLogin', COMPONENT);
|
||||||
|
|
||||||
controller.$inject = ['$http', '$element'];
|
controller.$inject = ['$http', '$element'];
|
||||||
function controller($http, $element) {
|
function controller($http, $element) {
|
||||||
var self = this;
|
var self = this;
|
||||||
this.submit = function() {
|
this.submit = function() {
|
||||||
let model = this.model;
|
let model = this.model;
|
||||||
|
|
||||||
if(!(model && model.email && model.password)) {
|
if (!(model && model.email && model.password)) {
|
||||||
showMessage('Please insert your email and password');
|
showMessage('Please insert your email and password');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
model.appId = window.location.href;
|
model.appId = window.location.href;
|
||||||
$http.post('/account', this.model).then (
|
$http.post('/account', this.model).then(
|
||||||
onLoginOk,
|
onLoginOk,
|
||||||
onLoginErr
|
onLoginErr
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
function onLoginOk (response) {
|
function onLoginOk(response) {
|
||||||
self.loading = false;
|
self.loading = false;
|
||||||
window.location = response.data.location +'?access_token='+ response.data.accessToken;
|
window.location = response.data.location + '?access_token=' + response.data.accessToken;
|
||||||
}
|
}
|
||||||
function onLoginErr(response) {
|
function onLoginErr(response) {
|
||||||
self.loading = false;
|
self.loading = false;
|
||||||
self.model.password = '';
|
self.model.password = '';
|
||||||
|
|
||||||
let message;
|
let message;
|
||||||
|
|
||||||
switch(response.status) {
|
switch (response.status) {
|
||||||
case 401:
|
case 401:
|
||||||
message = 'Invalid credentials';
|
message = 'Invalid credentials';
|
||||||
break;
|
break;
|
||||||
case -1:
|
case -1:
|
||||||
message = 'Can\'t contact with server';
|
message = 'Can\'t contact with server';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
message = 'Something went wrong';
|
message = 'Something went wrong';
|
||||||
}
|
}
|
||||||
|
|
||||||
showMessage(message);
|
showMessage(message);
|
||||||
}
|
}
|
||||||
function showMessage(message) {
|
function showMessage(message) {
|
||||||
let snackbar = $element.find('vn-snackbar').controller('vnSnackbar');
|
let snackbar = $element.find('vn-snackbar').controller('vnSnackbar');
|
||||||
snackbar.show({message: message});
|
snackbar.show({message: message});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.config(['$httpProvider', function($httpProvider) {
|
module.config(['$httpProvider', function($httpProvider) {
|
||||||
$httpProvider.defaults.useXDomain = true;
|
$httpProvider.defaults.useXDomain = true;
|
||||||
delete $httpProvider.defaults.headers.common['X-Requested-With'];
|
delete $httpProvider.defaults.headers.common['X-Requested-With'];
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
{
|
||||||
|
"name": "ClientObservation",
|
||||||
|
"description": "Notas de los clientes.",
|
||||||
|
"base": "PersistedModel",
|
||||||
|
"validateUpsert": true,
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "Number",
|
||||||
|
"id": true,
|
||||||
|
"description": "Identifier"
|
||||||
|
},
|
||||||
|
"text": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Fiscal indetifier"
|
||||||
|
},
|
||||||
|
"creationDate": {
|
||||||
|
"type": "date",
|
||||||
|
"description": "Fiscal indetifier"
|
||||||
|
},
|
||||||
|
"relations": {
|
||||||
|
"salesPerson": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "SalesPerson",
|
||||||
|
"foreignKey": "salePersonId"
|
||||||
|
},
|
||||||
|
"client": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "Client",
|
||||||
|
"foreignKey": "clientId"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -59,5 +59,9 @@
|
||||||
"Country": {
|
"Country": {
|
||||||
"dataSource": "db",
|
"dataSource": "db",
|
||||||
"public": true
|
"public": true
|
||||||
|
},
|
||||||
|
"ClientObservation": {
|
||||||
|
"dataSource": "db",
|
||||||
|
"public": true
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue