Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c7335af514 | |||
| ff78f9da54 | |||
| 3a14528402 | |||
| 5c276faf78 | |||
| 95b17947b2 | |||
| f20635e10e |
@@ -1,4 +1,4 @@
|
||||
FROM python:3.10
|
||||
FROM python:3.13
|
||||
|
||||
RUN apt update && apt install -y xfonts-base xfonts-75dpi python3-pip python3-cffi python3-brotli libpango-1.0-0 libpangoft2-1.0-0 \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import datetime
|
||||
from typing import List, Literal
|
||||
from typing import List, Literal, Optional
|
||||
from enum import Enum
|
||||
|
||||
from pydantic import BaseModel, Field, validator
|
||||
@@ -52,10 +52,10 @@ class DraftParty(BaseModel):
|
||||
class Party(BaseModel):
|
||||
entity: Entity
|
||||
part: str
|
||||
representative: Entity = None
|
||||
representative: Optional[Entity] = None
|
||||
signature_uuid: str
|
||||
signature_affixed: bool = False
|
||||
signature_png: str = None
|
||||
signature_png: Optional[str] = None
|
||||
|
||||
|
||||
class ProvisionGenuine(BaseModel):
|
||||
@@ -181,7 +181,7 @@ class Contract(CrudDocument):
|
||||
lawyer: Entity = Field(title="Avocat en charge")
|
||||
location: str = Field(title="Lieu")
|
||||
date: datetime.date = Field(title="Date")
|
||||
label: str = None
|
||||
label: Optional[str] = None
|
||||
|
||||
@validator("label", always=True)
|
||||
def generate_label(cls, v, values, **kwargs):
|
||||
|
||||
@@ -117,6 +117,10 @@ p {
|
||||
text-align: justify;
|
||||
}
|
||||
|
||||
li {
|
||||
margin: 16px 0;
|
||||
}
|
||||
|
||||
.footer {
|
||||
margin-top: 30px;
|
||||
page-break-inside: avoid;
|
||||
|
||||
@@ -3,8 +3,8 @@ from beanie.odm.operators.find.comparison import In
|
||||
from beanie.operators import And, RegEx, Eq
|
||||
|
||||
from fastapi import APIRouter, HTTPException, Depends
|
||||
from fastapi_paginate import Page, Params, add_pagination
|
||||
from fastapi_paginate.ext.motor import paginate
|
||||
from fastapi_pagination import Page, Params, add_pagination
|
||||
from fastapi_pagination.ext.beanie import paginate
|
||||
|
||||
from ..user.manager import get_current_user, get_current_superuser
|
||||
|
||||
@@ -79,8 +79,7 @@ def get_crud_router(model, model_create, model_read, model_update):
|
||||
sort = parse_sort(sort_by)
|
||||
query = parse_query(query, model_read)
|
||||
|
||||
collection = model.get_motor_collection()
|
||||
items = paginate(collection, query, Params(**{'size': size, 'page': page}), sort=sort)
|
||||
items = paginate(model.find(query), Params(**{'size': size, 'page': page}))
|
||||
return await items
|
||||
|
||||
@router.put("/{id}", response_description="{} record updated".format(model.__name__))
|
||||
|
||||
@@ -23,8 +23,8 @@ class Individual(EntityType):
|
||||
props={"items-per-row": "4", "numbered": True},
|
||||
title="Surnoms"
|
||||
)
|
||||
day_of_birth: date = Field(default=None, title='Date de naissance')
|
||||
place_of_birth: str = Field(default="", title='Lieu de naissance')
|
||||
day_of_birth: Optional[date] = Field(default=None, title='Date de naissance')
|
||||
place_of_birth: Optional[str] = Field(default="", title='Lieu de naissance')
|
||||
|
||||
@property
|
||||
def label(self) -> str:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from typing import Optional, TypeVar
|
||||
from datetime import datetime
|
||||
from pydantic import Field
|
||||
from beanie import PydanticObjectId
|
||||
from beanie import Document
|
||||
|
||||
from fastapi_users.db import BeanieBaseUser, BeanieUserDatabase
|
||||
from fastapi_users_db_beanie.access_token import BeanieAccessTokenDatabase, BeanieBaseAccessToken
|
||||
@@ -9,11 +9,11 @@ from fastapi_users_db_beanie.access_token import BeanieAccessTokenDatabase, Bean
|
||||
from pymongo import IndexModel
|
||||
|
||||
|
||||
class AccessToken(BeanieBaseAccessToken[PydanticObjectId]):
|
||||
class AccessToken(BeanieBaseAccessToken, Document):
|
||||
pass
|
||||
|
||||
|
||||
class User(BeanieBaseUser[PydanticObjectId]):
|
||||
class User(BeanieBaseUser, Document):
|
||||
login: str
|
||||
entity_id: str
|
||||
created_at: datetime = Field(default=datetime.utcnow(), nullable=False)
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
from pydantic import BaseModel
|
||||
from typing import Annotated
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
from fastapi_users import schemas
|
||||
|
||||
from .models import User
|
||||
@@ -9,12 +11,8 @@ class UserBase(schemas.CreateUpdateDictModel):
|
||||
|
||||
|
||||
class UserRead(User):
|
||||
class Config:
|
||||
fields = {
|
||||
'_id': {'alias': 'id'},
|
||||
'hashed_password': {'exclude': True}
|
||||
}
|
||||
|
||||
_id: Annotated[str, Field(alias='id')]
|
||||
hashed_password: Annotated[str, Field(exclude=True)]
|
||||
|
||||
class UserCreate(UserBase):
|
||||
login: str
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
fastapi==0.88.0
|
||||
fastapi_users==10.2.1
|
||||
fastapi_users_db_beanie==1.1.2
|
||||
motor==3.1.1
|
||||
fastapi-paginate==0.1.0
|
||||
fastapi
|
||||
fastapi_users
|
||||
fastapi_users_db_beanie
|
||||
fastapi-pagination
|
||||
uvicorn
|
||||
jinja2
|
||||
weasyprint
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
version: "3.9"
|
||||
services:
|
||||
back:
|
||||
build:
|
||||
@@ -10,6 +9,11 @@ services:
|
||||
volumes:
|
||||
- ./back/app:/code/app
|
||||
- ./back/media:/code/media
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.back.entrypoints=web"
|
||||
- "traefik.http.routers.back.rule=PathPrefix(`/api/v1/`)"
|
||||
- "traefik.http.services.back.loadbalancer.server.port=8000"
|
||||
|
||||
front:
|
||||
build:
|
||||
@@ -21,12 +25,23 @@ services:
|
||||
volumes:
|
||||
- ./front/app/src:/app/src
|
||||
- ./front/app/public:/app/public
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.front.entrypoints=web"
|
||||
- "traefik.http.routers.front.rule=PathPrefix(`/`)"
|
||||
- "traefik.http.services.front.loadbalancer.server.port=4200"
|
||||
|
||||
nginx:
|
||||
build:
|
||||
context: ./nginx
|
||||
image: cht-lawfirm-nginx-dev
|
||||
proxy:
|
||||
image: traefik
|
||||
restart: always
|
||||
command:
|
||||
- --providers.docker
|
||||
- --providers.docker.watch=true
|
||||
- --providers.docker.exposedByDefault=false
|
||||
- --entrypoints.web.address=:80
|
||||
- --log.level=DEBUG
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
ports:
|
||||
- "80:80"
|
||||
|
||||
|
||||
@@ -78,37 +78,22 @@ export class ContractsCardComponent extends BaseContractsComponent{
|
||||
|
||||
@Component({
|
||||
template: `
|
||||
<ngb-accordion #acc="ngbAccordion" activeIds="ngb-panel-1">
|
||||
<ngb-panel>
|
||||
<ng-template ngbPanelTitle>
|
||||
<span i18n>Preview</span>
|
||||
</ng-template>
|
||||
<ng-template ngbPanelContent>
|
||||
<iframe width="100%"
|
||||
[src]="getPreview()"
|
||||
onload='javascript:(function(o){o.style.height=o.contentWindow.document.body.scrollHeight+"px";o.style.width=o.contentWindow.document.body.scrollWidth+"px";}(this));' style="height:200px;width:100%;border:none;overflow:hidden;"></iframe>
|
||||
</ng-template>
|
||||
</ngb-panel>
|
||||
<ngb-panel>
|
||||
<ng-template ngbPanelTitle>
|
||||
<span i18n>Signature</span>
|
||||
</ng-template>
|
||||
<ng-template ngbPanelContent>
|
||||
<ng-container *ngIf="this.affixed"><ng-container i18n>This Contract has already been signed by</ng-container> {{ this.signatory }}</ng-container>
|
||||
<div class="row" *ngIf="!this.affixed">
|
||||
<signature-drawer class="col-7"
|
||||
(signatureDrawn$)="postSignature($event)"></signature-drawer>
|
||||
<div class="col-5" i18n>
|
||||
<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>
|
||||
</ng-template>
|
||||
</ngb-panel>
|
||||
</ngb-accordion>
|
||||
`
|
||||
<div>
|
||||
<iframe width="100%"
|
||||
[src]="getPreview()"
|
||||
onload='javascript:(function(o){o.style.height=o.contentWindow.document.body.scrollHeight+"px";o.style.width=o.contentWindow.document.body.scrollWidth+"px";}(this));' style="height:200px;width:100%;border:none;overflow:hidden;">
|
||||
</iframe>
|
||||
</div>
|
||||
<div class="row" *ngIf="!this.affixed">
|
||||
<signature-drawer class="col-7"
|
||||
(signatureDrawn$)="postSignature($event)"></signature-drawer>
|
||||
<div class="col-5" i18n>
|
||||
<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>`
|
||||
})
|
||||
export class ContractsSignatureComponent implements OnInit {
|
||||
signature_id: string | null = null;
|
||||
|
||||
@@ -2,36 +2,44 @@ import {Component, OnInit} from '@angular/core';
|
||||
import { FieldArrayType } from '@ngx-formly/core';
|
||||
|
||||
@Component({
|
||||
selector: 'formly-array-type',
|
||||
template: `
|
||||
<div>
|
||||
<label *ngIf="props.label" class="form-label">{{ props.label }}</label>
|
||||
<p *ngIf="props.description">{{ props.description }}</p>
|
||||
<div class="alert alert-danger" role="alert" *ngIf="showError && formControl.errors">
|
||||
<formly-validation-message [field]="field"></formly-validation-message>
|
||||
</div>
|
||||
<div class="row row-cols-1 row-cols-md-{{this.itemsPerRow}} g-1">
|
||||
<div *ngFor="let entry of field.fieldGroup; let i = index" class="col">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<div *ngIf="props['numbered']" class="float-start">
|
||||
<strong>{{ i + 1 }}</strong>
|
||||
selector: 'formly-array-type',
|
||||
template: `
|
||||
<div class="mb-3">
|
||||
<ngb-accordion #acc="ngbAccordion" activeIds="ngb-panel-0">
|
||||
<ngb-panel id="ngb-panel-0">
|
||||
<ng-template ngbPanelTitle>
|
||||
<label *ngIf="props.label" class="form-label">{{ props.label }}</label>
|
||||
<p *ngIf="props.description">{{ props.description }}</p>
|
||||
<div class="alert alert-danger" role="alert" *ngIf="showError && formControl.errors">
|
||||
<formly-validation-message [field]="field"></formly-validation-message>
|
||||
</div>
|
||||
<div *ngIf="! this.field.props.readonly" class="btn-group float-end">
|
||||
<button class="btn btn-primary btn-sm" [attr.disabled]="i == 0 ? 'disabled' : null" type="button" (click)="move(i, i-1)"><i-bs name="caret-up-fill"></i-bs></button>
|
||||
<button class="btn btn-primary btn-sm" [attr.disabled]="i == this.field.fieldGroup!.length-1 ? 'disabled' : null" type="button" (click)="move(i, i+1)"><i-bs name="caret-down-fill"></i-bs></button>
|
||||
<button class="btn btn-danger btn-sm" [attr.disabled]="field.props!['removable'] === false ? 'disabled' : null" type="button" (click)="remove(i)"><i-bs name="x-octagon-fill"></i-bs></button>
|
||||
</ng-template>
|
||||
<ng-template ngbPanelContent>
|
||||
<div class="row row-cols-1 row-cols-md-{{this.itemsPerRow}} g-1">
|
||||
<div *ngFor="let entry of field.fieldGroup; let i = index" class="col">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<div *ngIf="props['numbered']" class="float-start">
|
||||
<strong>{{ i + 1 }}</strong>
|
||||
</div>
|
||||
<div *ngIf="! this.field.props.readonly" class="btn-group float-end">
|
||||
<button class="btn btn-primary btn-sm" [attr.disabled]="i == 0 ? 'disabled' : null" type="button" (click)="move(i, i-1)"><i-bs name="caret-up-fill"></i-bs></button>
|
||||
<button class="btn btn-primary btn-sm" [attr.disabled]="i == this.field.fieldGroup!.length-1 ? 'disabled' : null" type="button" (click)="move(i, i+1)"><i-bs name="caret-down-fill"></i-bs></button>
|
||||
<button class="btn btn-danger btn-sm" [attr.disabled]="field.props!['removable'] === false ? 'disabled' : null" type="button" (click)="remove(i)"><i-bs name="x-octagon-fill"></i-bs></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<formly-field class="col" [field]="entry"></formly-field>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<formly-field class="col" [field]="entry"></formly-field>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<button *ngIf="! this.field.props.readonly" class="btn btn-success col-sm-12 gap-3" type="button" (click)="add()"><i-bs name="plus-square-fill"></i-bs></button>
|
||||
</ng-template>
|
||||
</ngb-panel>
|
||||
</ngb-accordion>
|
||||
</div>
|
||||
<button *ngIf="! this.field.props.readonly" class="btn btn-success col-sm-12" type="button" (click)="add()"><i-bs name="plus-square-fill"></i-bs></button>
|
||||
</div>
|
||||
`,
|
||||
`,
|
||||
})
|
||||
export class ArrayTypeComponent extends FieldArrayType implements OnInit {
|
||||
colSm: string = "col-sm-6"
|
||||
|
||||
@@ -10,7 +10,7 @@ import {FormlyJsonschema} from "@ngx-formly/core/json-schema";
|
||||
template: `
|
||||
<div class="mb-3">
|
||||
<ngb-accordion #acc="ngbAccordion" activeIds="ngb-panel-0">
|
||||
<ngb-panel>
|
||||
<ngb-panel id="ngb-panel-0">
|
||||
<ng-template ngbPanelTitle>
|
||||
<label *ngIf="props.label && props['hideLabel'] !== true" [attr.for]="id"
|
||||
class="form-label">{{ props.label }}
|
||||
|
||||
Reference in New Issue
Block a user