diff --git a/front/current/assets/styles/components/_project.scss b/front/current/assets/styles/components/_project.scss index 29ee3e60214636cae32f115c53526e4323c06d05..73261eea74da9a5169a5aa1cf7fbcdc165c5f7ab 100644 --- a/front/current/assets/styles/components/_project.scss +++ b/front/current/assets/styles/components/_project.scss @@ -24,7 +24,14 @@ project { padding-bottom: 20px; h1, h4 { margin-left: 22px; } - h1 { margin-top: 20px; } + h1 { + margin-top: 20px; + + small { + color: $gray-01; + font-style: italic; + } + } h4 { margin-top: 10px; color: $gray-01; } } .project-contacts { diff --git a/front/current/components/app/app.component.ts b/front/current/components/app/app.component.ts index 77db73ddd60fea1076537bf17ce956fc7818afdc..97827d568f15ac88c3fa6c1c7e22c1f1bf1d01ec 100644 --- a/front/current/components/app/app.component.ts +++ b/front/current/components/app/app.component.ts @@ -5,6 +5,7 @@ import { config } from '../../config'; import { RestService } from '../../services/rest.service'; import { ProjectService } from '../../services/project/project.service'; +import { ClientService } from '../../services/project/client.service'; import { AddressService } from '../../services/project/address.service'; import { ContactService } from '../../services/project/contact.service'; import { ContactMethodService } from '../../services/project/contact-method.service'; @@ -28,7 +29,7 @@ import { LoginComponent } from '../login/login.component'; ROUTER_PROVIDERS, RestService, - ProjectService, AddressService, ContactService, ContactMethodService, + ProjectService, ClientService, AddressService, ContactService, ContactMethodService, DocumentSlotService, DocumentService, diff --git a/front/current/components/project/detail.component.html b/front/current/components/project/detail.component.html index 08e5f39e0deae9ce6d85d26e478cb061aa388d14..58b0764b6acb1c6098ee79f730e3998057046254 100644 --- a/front/current/components/project/detail.component.html +++ b/front/current/components/project/detail.component.html @@ -17,7 +17,7 @@
- {{ project.data['name'] }} + {{ project.data['name'] }} {{ client.data['name'] }}

diff --git a/front/current/components/project/detail.component.ts b/front/current/components/project/detail.component.ts index c2c081242021eac35909f0c19816d24b04853a7d..63500c4490910fe7385b6818f9e0cb1f68323d2c 100644 --- a/front/current/components/project/detail.component.ts +++ b/front/current/components/project/detail.component.ts @@ -5,6 +5,7 @@ import { config } from '../../config'; import { RestService, Model, Collection } from '../../services/rest.service'; import { ProjectService } from '../../services/project/project.service'; +import { ClientService } from '../../services/project/client.service'; import { AddressService } from '../../services/project/address.service'; import { ContactService } from '../../services/project/contact.service'; import { ContactMethodService } from '../../services/project/contact-method.service'; @@ -26,6 +27,7 @@ export class ProjectDetailComponent implements OnInit { private _routeParams:RouteParams, private _restService:RestService, public projectService:ProjectService, + public clientService:ClientService, public addressService:AddressService, public contactService:ContactService, public contactMethodService:ContactMethodService, @@ -34,7 +36,9 @@ export class ProjectDetailComponent implements OnInit { ) {}; project:Model; - addresses:Collection; + clients:Collection; // A throwaway collection. The client is pulled from here. + client:Model; + addresses:Collection; // A throwaway collection. The address is pulled from here. address:Model; contacts:Collection; contact_methods:Collection; @@ -45,6 +49,8 @@ export class ProjectDetailComponent implements OnInit { let project_id = this._routeParams.get('id'); this.project = this._restService.Model(this.projectService, {id: project_id}); + this.clients = (this._restService.Collection(this.clientService, []) + .setFilters({'project_id': project_id})); this.addresses = (this._restService.Collection(this.addressService, []) .setFilters({'project_id': project_id})); this.contacts = (this._restService.Collection(this.contactService, []) @@ -60,6 +66,10 @@ export class ProjectDetailComponent implements OnInit { fetch() { this.project.fetch(); + this.clients.fetch(() => { + if (this.clients.models.length) + this.client = this.clients.models[0]; + }); this.addresses.fetch(() => { if (this.addresses.models.length) this.address = this.addresses.models[0]; diff --git a/front/current/services/project/client.service.ts b/front/current/services/project/client.service.ts new file mode 100644 index 0000000000000000000000000000000000000000..4e5ade03641ebfc6325364b10e9292c9ffcec736 --- /dev/null +++ b/front/current/services/project/client.service.ts @@ -0,0 +1,9 @@ +import { Injectable } from 'angular2/core'; +import { config } from '../../config'; + + +@Injectable() +export class ClientService { + public config:any = config.SERVICES.project; + public url:string = '/client/'; +};