parent
ab0b9aee33
commit
2f77d371e9
|
@ -13,6 +13,20 @@ function loader(module) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getParams(route){
|
||||||
|
var params = "",
|
||||||
|
temporalParams=[];
|
||||||
|
|
||||||
|
if(!route.params){
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
|
||||||
|
Object.keys(route.params).forEach((key)=>{
|
||||||
|
temporalParams.push(key + `= "${route.params[key]}"`);
|
||||||
|
});
|
||||||
|
return temporalParams.join(" ");
|
||||||
|
}
|
||||||
|
|
||||||
function config($stateProvider, $urlRouterProvider) {
|
function config($stateProvider, $urlRouterProvider) {
|
||||||
core.splitingRegister.registerGraph(deps);
|
core.splitingRegister.registerGraph(deps);
|
||||||
$urlRouterProvider.otherwise('/clients');
|
$urlRouterProvider.otherwise('/clients');
|
||||||
|
@ -25,14 +39,16 @@ function config($stateProvider, $urlRouterProvider) {
|
||||||
fileRoutes.forEach(function(route) {
|
fileRoutes.forEach(function(route) {
|
||||||
$stateProvider.state(route.state, {
|
$stateProvider.state(route.state, {
|
||||||
url: route.url,
|
url: route.url,
|
||||||
template: `<${route.component} full-height></${route.component}>`,
|
template: `<${route.component} full-height ${getParams(route)}></${route.component}>`,
|
||||||
resolve: {
|
resolve: {
|
||||||
loader: loader(module)
|
loader: loader(module)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
config.$inject = ['$stateProvider', '$urlRouterProvider'];
|
config.$inject = ['$stateProvider', '$urlRouterProvider'];
|
||||||
core.module.config(config);
|
core.module.config(config);
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
<form ng-submit="$ctrl.submit()" pad-large>
|
<form ng-submit="$ctrl.submit()" pad-large>
|
||||||
<vn-title>Datos básicos</vn-title>
|
<vn-title>Datos básicos</vn-title>
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
<vn-textfield vn-one label="Alias" name="alias" model="$ctrl.model"></vn-textfield>
|
<vn-textfield vn-one label="Alias" name="alias" model="$ctrl.client"></vn-textfield>
|
||||||
<vn-textfield vn-one label="NIF/CIF" name="fi" model="$ctrl.model"></vn-textfield>
|
<vn-textfield vn-one label="NIF/CIF" name="fi" model="$ctrl.client"></vn-textfield>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
<vn-textfield autofocus vn-one label="Razón social" name="socialName" model="$ctrl.model"></vn-textfield>
|
<vn-textfield autofocus vn-one label="Razón social" name="socialName" model="$ctrl.client"></vn-textfield>
|
||||||
<vn-date-picker vn-one label="Fecha alta" name="dischargeDate" model="$ctrl.model"></vn-date-picker>
|
<vn-date-picker vn-one label="Fecha alta" name="dischargeDate" model="$ctrl.client"></vn-date-picker>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
<vn-textfield vn-one label="Contacto" name="contact" model="$ctrl.model"></vn-textfield>
|
<vn-textfield vn-one label="Contacto" name="contact" model="$ctrl.client"></vn-textfield>
|
||||||
<vn-textfield vn-one label="Teléfono" name="telefono" model="$ctrl.model"></vn-textfield>
|
<vn-textfield vn-one label="Teléfono" name="telefono" model="$ctrl.client"></vn-textfield>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
<vn-textfield vn-one label="Calidad" name="quality" model="$ctrl.model"></vn-textfield>
|
<vn-textfield vn-one label="Calidad" name="quality" model="$ctrl.client"></vn-textfield>
|
||||||
<vn-combo vn-one label="Comercial" name="salesPerson" model="$ctrl.model">
|
<vn-combo vn-one label="Comercial" name="salesPerson" model="$ctrl.client">
|
||||||
<option value="1">Comercial 1</option>
|
<option value="1">Comercial 1</option>
|
||||||
<option value="2">Comercial 2</option>
|
<option value="2">Comercial 2</option>
|
||||||
</vn-combo>
|
</vn-combo>
|
||||||
|
|
|
@ -4,6 +4,9 @@ import {module} from '../../module';
|
||||||
export const NAME = 'vnClientBasicData';
|
export const NAME = 'vnClientBasicData';
|
||||||
export const COMPONENT = {
|
export const COMPONENT = {
|
||||||
template: template,
|
template: template,
|
||||||
|
bindings: {
|
||||||
|
client: '<'
|
||||||
|
},
|
||||||
controller: function($http) {
|
controller: function($http) {
|
||||||
this.submit = function() {
|
this.submit = function() {
|
||||||
$http.post('/client/api/Clients', this.model).then(
|
$http.post('/client/api/Clients', this.model).then(
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<vn-descriptor descriptor = "$ctrl.descriptor"></vn-descriptor>
|
<vn-descriptor descriptor = "$ctrl.descriptor"></vn-descriptor>
|
||||||
<vn-left-menu items="$ctrl.items"></vn-left-menu>
|
<vn-left-menu items="$ctrl.items"></vn-left-menu>
|
||||||
</vn-empty>
|
</vn-empty>
|
||||||
<vn-auto>
|
<vn-auto >
|
||||||
<vn-vertical ui-view></vn-vertical>
|
<vn-vertical ui-view></vn-vertical>
|
||||||
</vn-auto>
|
</vn-auto>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
|
|
|
@ -8,11 +8,18 @@ export const COMPONENT = {
|
||||||
template: template,
|
template: template,
|
||||||
controller: function($http, $stateParams) {
|
controller: function($http, $stateParams) {
|
||||||
let clientRoutes = routes['src/client/routes.js'].routes;
|
let clientRoutes = routes['src/client/routes.js'].routes;
|
||||||
this.client = [];
|
|
||||||
this.items = [];
|
this.items = [];
|
||||||
|
this.client = null;
|
||||||
|
|
||||||
$http.get(`/client/api/Clients/${$stateParams.id}`).then(
|
$http.get(`/client/api/Clients/${$stateParams.id}`).then(
|
||||||
(json) => {this.client = json.data;},
|
(json) => {
|
||||||
|
this.client = json.data;
|
||||||
|
this.descriptor = {
|
||||||
|
clientId: this.client.id,
|
||||||
|
name: this.client.name,
|
||||||
|
phone: this.client.phone
|
||||||
|
};
|
||||||
|
},
|
||||||
(json) => console.error (json.data.error.message)
|
(json) => console.error (json.data.error.message)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -25,11 +32,7 @@ export const COMPONENT = {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
this.descriptor = {
|
|
||||||
clientId: "Cliente 1231",
|
|
||||||
name: "Floristeria Lola",
|
|
||||||
phone: "987 654 321"
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
COMPONENT.controller.$inject = ['$http', '$stateParams'];
|
COMPONENT.controller.$inject = ['$http', '$stateParams'];
|
||||||
|
|
|
@ -12,6 +12,9 @@
|
||||||
url: "/basic-data",
|
url: "/basic-data",
|
||||||
state: "clientCard.basicData",
|
state: "clientCard.basicData",
|
||||||
component: "vn-client-basic-data",
|
component: "vn-client-basic-data",
|
||||||
|
params: {
|
||||||
|
client: "$ctrl.client"
|
||||||
|
},
|
||||||
description: "Datos básicos",
|
description: "Datos básicos",
|
||||||
icon: "person"
|
icon: "person"
|
||||||
},{
|
},{
|
||||||
|
|
Loading…
Reference in New Issue