Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2948e9b961 | |||
| 191a3d0018 | |||
| 8885969a07 | |||
| a997e54891 |
@@ -7,7 +7,7 @@ from .routes_draft import draft_router
|
|||||||
from .print import print_router
|
from .print import print_router
|
||||||
|
|
||||||
from .models import Contract, ContractDraft, ContractDraftStatus, Party, replace_variables_in_value
|
from .models import Contract, ContractDraft, ContractDraftStatus, Party, replace_variables_in_value
|
||||||
from .schemas import ContractCreate, ContractRead, ContractUpdate
|
from .schemas import ContractCreate, ContractRead, ContractUpdate, SignatureRead
|
||||||
|
|
||||||
from ..entity.models import Entity
|
from ..entity.models import Entity
|
||||||
from ..template.models import ProvisionTemplate
|
from ..template.models import ProvisionTemplate
|
||||||
@@ -75,10 +75,12 @@ async def update(id: str, contract_form: ContractUpdate, user=Depends(get_curren
|
|||||||
|
|
||||||
|
|
||||||
@contract_router.get("/signature/{signature_id}", response_description="")
|
@contract_router.get("/signature/{signature_id}", response_description="")
|
||||||
async def get_signature(signature_id: str) -> Party:
|
async def get_signature(signature_id: str) -> SignatureRead:
|
||||||
contract = await Contract.find_by_signature_id(signature_id)
|
contract = await Contract.find_by_signature_id(signature_id)
|
||||||
signature = contract.get_signature(signature_id)
|
signature = contract.get_signature(signature_id)
|
||||||
return signature
|
signature_dict = signature.dict()
|
||||||
|
signature_dict['contract_label'] = contract.label
|
||||||
|
return signature_dict
|
||||||
|
|
||||||
|
|
||||||
@contract_router.post("/signature/{signature_id}", response_description="")
|
@contract_router.post("/signature/{signature_id}", response_description="")
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import datetime
|
|||||||
from typing import List, Literal
|
from typing import List, Literal
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
|
|
||||||
from pydantic import BaseModel, Field
|
from pydantic import BaseModel, Field, validator
|
||||||
from beanie.operators import ElemMatch
|
from beanie.operators import ElemMatch
|
||||||
|
|
||||||
from ..core.models import CrudDocument, RichtextSingleline, RichtextMultiline, DictionaryEntry
|
from ..core.models import CrudDocument, RichtextSingleline, RichtextMultiline, DictionaryEntry
|
||||||
@@ -181,6 +181,19 @@ class Contract(CrudDocument):
|
|||||||
lawyer: Entity = Field(title="Avocat en charge")
|
lawyer: Entity = Field(title="Avocat en charge")
|
||||||
location: str = Field(title="Lieu")
|
location: str = Field(title="Lieu")
|
||||||
date: datetime.date = Field(title="Date")
|
date: datetime.date = Field(title="Date")
|
||||||
|
label: str = None
|
||||||
|
|
||||||
|
@validator("label", always=True)
|
||||||
|
def generate_label(cls, v, values, **kwargs):
|
||||||
|
if not v:
|
||||||
|
contract_label = values['title']
|
||||||
|
for p in values['parties']:
|
||||||
|
contract_label = contract_label + f" - {p.entity.label}"
|
||||||
|
|
||||||
|
contract_label = contract_label + f" {values['date'].strftime('%m/%d/%Y')}"
|
||||||
|
return contract_label
|
||||||
|
|
||||||
|
return v
|
||||||
|
|
||||||
class Settings(CrudDocument.Settings):
|
class Settings(CrudDocument.Settings):
|
||||||
fulltext_search = ['name', 'title']
|
fulltext_search = ['name', 'title']
|
||||||
|
|||||||
@@ -73,3 +73,12 @@ class ContractCreate(Writer):
|
|||||||
|
|
||||||
class ContractUpdate(BaseModel):
|
class ContractUpdate(BaseModel):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class SignatureRead(BaseModel):
|
||||||
|
signature_uuid: str
|
||||||
|
entity: Entity
|
||||||
|
part: str
|
||||||
|
representative: Entity = None
|
||||||
|
signature_affixed: bool
|
||||||
|
contract_label: str
|
||||||
|
|||||||
@@ -28,8 +28,8 @@ class Individual(EntityType):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def label(self) -> str:
|
def label(self) -> str:
|
||||||
if len(self.surnames) > 0:
|
# if len(self.surnames) > 0:
|
||||||
return '{} "{}" {}'.format(self.firstname, self.surnames[0], self.lastname)
|
# return '{} "{}" {}'.format(self.firstname, self.surnames[0], self.lastname)
|
||||||
|
|
||||||
return '{} {}'.format(self.firstname, self.lastname)
|
return '{} {}'.format(self.firstname, self.lastname)
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { Component, Input, OnInit } from '@angular/core';
|
import { Component, ElementRef, Input, OnInit } from '@angular/core';
|
||||||
import { ActivatedRoute, ParamMap } from "@angular/router";
|
import { ActivatedRoute, ParamMap } from "@angular/router";
|
||||||
import { DomSanitizer } from "@angular/platform-browser";
|
import { DomSanitizer, Meta } from "@angular/platform-browser";
|
||||||
import { ImageUploaderCrudService } from "@common/crud/crud.service";
|
import { ImageUploaderCrudService } from "@common/crud/crud.service";
|
||||||
|
|
||||||
|
|
||||||
@@ -98,12 +98,7 @@ export class ContractsCardComponent extends BaseContractsComponent{
|
|||||||
<div class="row" *ngIf="!this.affixed">
|
<div class="row" *ngIf="!this.affixed">
|
||||||
<signature-drawer class="col-7"
|
<signature-drawer class="col-7"
|
||||||
(signatureDrawn$)="postSignature($event)"></signature-drawer>
|
(signatureDrawn$)="postSignature($event)"></signature-drawer>
|
||||||
<div class="col-5" i18n>
|
<div class="col-5" i18n [innerHTML]="this.legalText"></div>
|
||||||
<p>Cette page est à la destination exclusive de <strong>{{ this.signatory }}</strong></p>
|
|
||||||
<p>Si vous n'êtes <strong>pas</strong> {{ this.signatory }}, veuillez <strong>fermer cette page immédiatement</strong> et surpprimer tous les liens en votre possession menant vers celle-ci.</p>
|
|
||||||
<p>En vous maintenant et/ou en interagissant avec cette page, vous enfreignez l'article L.229 du code pénal de l'Etat de San Andreas pour <strong>usurpation d'identité</strong> et vous vous exposez ainsi à une amende de 20 000$ ainsi qu'à des poursuites civiles.</p>
|
|
||||||
<p>Le cabinet Cooper, Hillman & Toshi LLC</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</ngb-panel>
|
</ngb-panel>
|
||||||
@@ -117,10 +112,13 @@ export class ContractsSignatureComponent implements OnInit {
|
|||||||
|
|
||||||
affixed = false;
|
affixed = false;
|
||||||
|
|
||||||
|
public legalText: string = "";
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
private sanitizer: DomSanitizer,
|
private sanitizer: DomSanitizer,
|
||||||
private crudService: ImageUploaderCrudService,
|
private crudService: ImageUploaderCrudService,
|
||||||
|
private meta: Meta,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
@@ -134,8 +132,26 @@ export class ContractsSignatureComponent implements OnInit {
|
|||||||
} else {
|
} else {
|
||||||
this.signatory = this.signature.entity.entity_data.firstname + " " + this.signature.entity.entity_data.lastname;
|
this.signatory = this.signature.entity.entity_data.firstname + " " + this.signature.entity.entity_data.lastname;
|
||||||
}
|
}
|
||||||
})
|
|
||||||
})
|
this.legalText = `
|
||||||
|
<p>Cette page est à la destination exclusive de <strong>${ this.signatory }</strong></p>
|
||||||
|
<p>Si vous n'êtes <strong>pas</strong> ${ this.signatory }, veuillez <strong>fermer cette page immédiatement</strong> et surpprimer tous les liens en votre possession menant vers celle-ci.</p>
|
||||||
|
<p>En vous maintenant et/ou en interagissant avec cette page, vous enfreignez l'article L.229 du code pénal de l'Etat de San Andreas pour <strong>usurpation d'identité</strong> et vous vous exposez ainsi à une amende de 20 000$ ainsi qu'à des poursuites civiles.</p>
|
||||||
|
<p>Le cabinet Cooper, Hillman & Toshi LLC</p>
|
||||||
|
`
|
||||||
|
|
||||||
|
this.meta.updateTag({
|
||||||
|
name: 'og:title',
|
||||||
|
property: 'og:title',
|
||||||
|
content: this.signature.contract_label});
|
||||||
|
this.meta.updateTag({
|
||||||
|
name: 'og:description',
|
||||||
|
property: 'og:description',
|
||||||
|
content: this.legalText.replace(/<[^>]*>/g, '').trim()
|
||||||
|
});
|
||||||
|
this.meta.updateTag({ name: 'og:image', content: `${location.origin}/assets/logo.png` });
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getPreview() {
|
getPreview() {
|
||||||
|
|||||||
Reference in New Issue
Block a user