Skip to content

Commit

Permalink
mail page
Browse files Browse the repository at this point in the history
  • Loading branch information
nbittich committed Jan 25, 2024
1 parent e2719f3 commit aa78143
Show file tree
Hide file tree
Showing 25 changed files with 679 additions and 301 deletions.
406 changes: 203 additions & 203 deletions package-lock.json

Large diffs are not rendered by default.

44 changes: 22 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@
},
"private": true,
"dependencies": {
"@angular/animations": "^17.1.0",
"@angular/cdk": "^17.1.0",
"@angular/common": "^17.1.0",
"@angular/compiler": "^17.1.0",
"@angular/core": "^17.1.0",
"@angular/forms": "^17.1.0",
"@angular/localize": "^17.1.0",
"@angular/platform-browser": "^17.1.0",
"@angular/platform-browser-dynamic": "^17.1.0",
"@angular/platform-server": "^17.1.0",
"@angular/router": "^17.1.0",
"@angular/service-worker": "^17.1.0",
"@angular/animations": "^17.1.1",
"@angular/cdk": "^17.1.1",
"@angular/common": "^17.1.1",
"@angular/compiler": "^17.1.1",
"@angular/core": "^17.1.1",
"@angular/forms": "^17.1.1",
"@angular/localize": "^17.1.1",
"@angular/platform-browser": "^17.1.1",
"@angular/platform-browser-dynamic": "^17.1.1",
"@angular/platform-server": "^17.1.1",
"@angular/router": "^17.1.1",
"@angular/service-worker": "^17.1.1",
"@fortawesome/angular-fontawesome": "^0.14.1",
"@fortawesome/fontawesome-svg-core": "^6.5.1",
"@fortawesome/free-brands-svg-icons": "^6.5.1",
Expand All @@ -48,21 +48,21 @@
"ngx-highlightjs": "^10.0.0",
"ngx-markdown-editor": "5.3.4",
"primeicons": "^6.0.1",
"primeng": "^17.3.3",
"primeng": "^17.4.0",
"rxjs": "^7.8.0",
"validator": "^13.11.0",
"zone.js": "^0.14.2"
},
"devDependencies": {
"@angular-devkit/build-angular": "^17.1.0",
"@angular-devkit/schematics": "^17.1.0",
"@angular-eslint/builder": "17.2.0",
"@angular-eslint/eslint-plugin": "17.2.0",
"@angular-eslint/eslint-plugin-template": "17.2.0",
"@angular-eslint/schematics": "17.2.0",
"@angular-eslint/template-parser": "17.2.0",
"@angular/cli": "^17.1.0",
"@angular/compiler-cli": "^17.1.0",
"@angular-devkit/build-angular": "^17.1.1",
"@angular-devkit/schematics": "^17.1.1",
"@angular-eslint/builder": "17.2.1",
"@angular-eslint/eslint-plugin": "17.2.1",
"@angular-eslint/eslint-plugin-template": "17.2.1",
"@angular-eslint/schematics": "17.2.1",
"@angular-eslint/template-parser": "17.2.1",
"@angular/cli": "^17.1.1",
"@angular/compiler-cli": "^17.1.1",
"@types/bootstrap": "^5.2.8",
"@types/node": "^18.11.9",
"@typescript-eslint/eslint-plugin": "^6.10.0",
Expand Down
20 changes: 10 additions & 10 deletions src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,21 @@ const routes: Routes = [
path: 'documents',
loadChildren: () =>
import('./features/administrative-document/administrative-document.module').then(
(m) => m.AdministrativeDocumentModule
(m) => m.AdministrativeDocumentModule,
),
},
{
path: 'billable-clients',
loadChildren: () =>
import('./features/billable-client/billable-client.module').then(
(m) => m.BillableClientModule
),
loadChildren: () => import('./features/billable-client/billable-client.module').then((m) => m.BillableClientModule),
},
{
path: 'timesheets',
loadChildren: () => import('./features/timesheet/timesheet.module').then((m) => m.TimesheetModule),
},
{
path: 'mails',
loadChildren: () => import('./features/mail/mail.module').then((m) => m.MailModule),
},
{
path: 'services',
loadChildren: () => import('./features/service/service.module').then((m) => m.ServiceModule),
Expand Down Expand Up @@ -75,17 +76,16 @@ const routes: Routes = [
{
path: '**',
redirectTo: '404',

},
];

@NgModule({
imports: [
RouterModule.forRoot(routes, {
useHash: false,
initialNavigation: 'enabledNonBlocking'
}),
useHash: false,
initialNavigation: 'enabledNonBlocking',
}),
],
exports: [RouterModule],
})
export class AppRoutingModule {}
export class AppRoutingModule { }
9 changes: 0 additions & 9 deletions src/app/core/models/mail-request.ts

This file was deleted.

21 changes: 21 additions & 0 deletions src/app/core/models/mail.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
export interface MailRequest {
to: string[];
subject: string;
body: string;
bcc: boolean;
uploadIds: string[];
sendingDate?: string;
}
export interface MailJob {
id: string;
createdDate: Date;
updatedDate?: Date;
sent: boolean;
sendingDate?: Date;
to: string[];
subject: string;
body: string;
bcc: boolean;
uploadIds: string[];
}
export type MailContextType = string | number | boolean;
13 changes: 11 additions & 2 deletions src/app/core/service/mail.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,28 @@ import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { ConfigInitService } from '@init/config-init.service';
import { MailRequest } from '@core/models/mail-request';
import { MailJob, MailRequest } from '@core/models/mail';
import { Page } from '@core/models/page';

@Injectable({
providedIn: 'root',
})
export class MailService {
basePath: string;

constructor(private http: HttpClient, configService: ConfigInitService) {
constructor(
private http: HttpClient,
configService: ConfigInitService,
) {
this.basePath = `${configService.getConfig()['BACKEND_URL']}/api/mail`;
}

send(data: MailRequest): Observable<void> {
return this.http.post<void>(`${this.basePath}/send`, data);
}

findAll(pageNumber: number, pageSize: number): Observable<Page<MailJob>> {
const url = `${this.basePath}/find-all?page=${pageNumber - 1}&size=${pageSize}&sort=creationDate,DESC`;
return this.http.get<Page<MailJob>>(url);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { NotificationService } from '@core/service/notification.service';
import { ArtcodedNotification } from '@core/models/artcoded.notification';
import { OnDestroy } from '@angular/core';
import { SplitPdfComponent } from '../split-pdf/split-pdf.component';
import { MailContextType, MailRequest } from '@core/models/mail-request';
import { MailContextType, MailRequest } from '@core/models/mail';
import { MailFormComponent } from '@shared/mail-form/mail-form.component';
import { ToastService } from '@core/service/toast.service';
import { MailService } from '@core/service/mail.service';
Expand Down Expand Up @@ -45,7 +45,7 @@ export class DocumentResultComponent implements OnInit, OnDestroy, OnApplication
private toastService: ToastService,
private mailService: MailService,
private dossierService: DossierService,
private titleService: Title
private titleService: Title,
) { }

ngOnInit() {
Expand Down Expand Up @@ -83,13 +83,13 @@ export class DocumentResultComponent implements OnInit, OnDestroy, OnApplication
.search(this.searchCriteria, event, this.pageSize)
.pipe(
tap((page) => {
const attachmentIds = page.content?.map(d => d.attachmentId);
this.fileService.findByIds(attachmentIds).subscribe(attachments => {
attachments.forEach(attachment => {
page.content.filter(d => d.attachmentId === attachment.id).forEach(d => d.attachment = attachment);
const attachmentIds = page.content?.map((d) => d.attachmentId);
this.fileService.findByIds(attachmentIds).subscribe((attachments) => {
attachments.forEach((attachment) => {
page.content.filter((d) => d.attachmentId === attachment.id).forEach((d) => (d.attachment = attachment));
});
});
})
}),
)
.subscribe((data) => (this.adminDocuments = data));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { UntypedFormBuilder, UntypedFormControl, UntypedFormGroup, Validators }
import { BillableClient, ContractStatus, getAllDays } from '@core/models/billable-client';
import { RateType } from '@core/models/common';
import { FileUpload } from '@core/models/file-upload';
import { MailContextType, MailRequest } from '@core/models/mail-request';
import { MailContextType, MailRequest } from '@core/models/mail';
import { FileService } from '@core/service/file.service';
import { MailService } from '@core/service/mail.service';
import { ToastService } from '@core/service/toast.service';
Expand Down Expand Up @@ -44,7 +44,7 @@ export class BillableClientDetailComponent implements OnInit {
private fb: UntypedFormBuilder,
private modalService: NgbModal,
private mailService: MailService,
private toastService: ToastService
private toastService: ToastService,
) { }

ngOnInit(): void {
Expand All @@ -67,7 +67,7 @@ export class BillableClientDetailComponent implements OnInit {
value: this.client?.emailAddress,
disabled: false,
},
[]
[],
),
projectName: new UntypedFormControl({ value: this.client?.projectName, disabled: false }, [Validators.required]),
defaultWorkingDays: new UntypedFormControl({ value: this.client?.defaultWorkingDays, disabled: false }, [
Expand Down
20 changes: 10 additions & 10 deletions src/app/features/dossier/dossier-form/dossier-form.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export class DossierFormComponent implements OnInit, OnDestroy {
private invoiceService: InvoiceService,
private documentService: AdministrativeDocumentService,
private clientService: BillableClientService,
private fb: UntypedFormBuilder
private fb: UntypedFormBuilder,
) { }

ngOnDestroy(): void {
Expand Down Expand Up @@ -135,7 +135,7 @@ export class DossierFormComponent implements OnInit, OnDestroy {
}
this.dossier.invoices = invoices;
this.dossier.invoices.sort(
(e1, e2) => new Date(e2.dateOfInvoice).getTime() - new Date(e1.dateOfInvoice).getTime()
(e1, e2) => new Date(e2.dateOfInvoice).getTime() - new Date(e1.dateOfInvoice).getTime(),
);
} else {
this.dossier.invoices = [];
Expand All @@ -150,7 +150,7 @@ export class DossierFormComponent implements OnInit, OnDestroy {
value: this.dossier.tvaDue,
disabled: this.dossier.closed && !this.recallForModification,
},
[]
[],
),
advancePayments: this.fb.array(this.createAdvancePayments(this.dossier.advancePayments)),
dossierName: new UntypedFormControl({ value: this.dossier.name, disabled: this.dossier.closed }, [
Expand All @@ -165,14 +165,14 @@ export class DossierFormComponent implements OnInit, OnDestroy {
value: this.dossier.creationDate ? formatDate(this.dossier.creationDate, 'dd/MM/yyyy HH:mm', 'de') : null,
disabled: true,
},
[]
[],
),
updatedDate: new UntypedFormControl(
{
value: this.dossier.updatedDate ? formatDate(this.dossier.updatedDate, 'dd/MM/yyyy HH:mm', 'de') : null,
disabled: true,
},
[]
[],
),
dossierClosed: new UntypedFormControl({ value: this.dossier.closed, disabled: true }, []),

Expand All @@ -181,14 +181,14 @@ export class DossierFormComponent implements OnInit, OnDestroy {
value: this.dossier.closedDate ? formatDate(this.dossier.closedDate, 'dd/MM/yyyy HH:mm', 'de') : null,
disabled: true,
},
[]
[],
),
dossierRecalledForModification: new UntypedFormControl(
{
value: this.dossier.recalledForModification,
disabled: true,
},
[]
[],
),

dossierRecalledForModificationDate: new UntypedFormControl(
Expand All @@ -198,7 +198,7 @@ export class DossierFormComponent implements OnInit, OnDestroy {
: null,
disabled: true,
},
[]
[],
),
});
}
Expand Down Expand Up @@ -271,14 +271,14 @@ export class DossierFormComponent implements OnInit, OnDestroy {
value: DateUtils.formatInputDate(DateUtils.toDateOrNow(tva.datePaid)),
disabled: this.dossier.closed && !this.recallForModification,
},
[Validators.required]
[Validators.required],
),
advance: new UntypedFormControl(
{
value: tva.advance,
disabled: this.dossier.closed && !this.recallForModification,
},
[Validators.required, Validators.min(1)]
[Validators.required, Validators.min(1)],
),
});
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { DossierImportFormComponent } from '../dossier-import-form/dossier-impor
import { Direction, Page, SortCriteria } from '@core/models/page';
import { MailService } from '@core/service/mail.service';
import { MailFormComponent } from '@shared/mail-form/mail-form.component';
import { MailContextType, MailRequest } from '@core/models/mail-request';
import { MailContextType, MailRequest } from '@core/models/mail';
import { firstValueFrom } from 'rxjs';
import { Invoice } from '@core/models/invoice';
import { AdministrativeDocument } from '@core/models/administrative-document';
Expand Down Expand Up @@ -44,7 +44,7 @@ export class DossierTableResultComponent implements OnInit {
private toastService: ToastService,
private windowRefService: WindowRefService,
private modalService: NgbModal,
private mailService: MailService
private mailService: MailService,
) { }

ngOnInit(): void {
Expand Down Expand Up @@ -87,13 +87,13 @@ export class DossierTableResultComponent implements OnInit {
}
openDossier(
doss: Dossier = { name: null, advancePayments: [] },
recallForModification: boolean = false
recallForModification: boolean = false,
): NgbModalRef {
const dossierUpdatedEmitter: EventEmitter<Dossier> = new EventEmitter<Dossier>();
const modalRef = this.modalService.open(DossierFormComponent, {
size: 'xl',
scrollable: true,
backdrop: 'static'
backdrop: 'static',
});

modalRef.componentInstance.dossier = doss;
Expand Down Expand Up @@ -168,7 +168,7 @@ export class DossierTableResultComponent implements OnInit {
this.dossierService.closeActiveDossier().subscribe((d) =>
this.downloadArchive(d.dossierUploadId, () => {
this.load();
})
}),
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { firstValueFrom } from 'rxjs';
import { FileService } from '@core/service/file.service';
import { MailService } from '@core/service/mail.service';
import { MailFormComponent } from '@shared/mail-form/mail-form.component';
import { MailRequest } from '@core/models/mail-request';
import { MailRequest } from '@core/models/mail';
import { ToastService } from '@core/service/toast.service';

@Component({
Expand Down Expand Up @@ -50,7 +50,7 @@ export class FeeTableResultComponent implements OnInit, OnApplicationEvent {
private feeService: FeeService,
private fileService: FileService,
private mailService: MailService,
private toastService: ToastService
private toastService: ToastService,
) { }

ngOnInit(): void {
Expand Down Expand Up @@ -133,7 +133,7 @@ export class FeeTableResultComponent implements OnInit, OnApplicationEvent {
const modalRef = this.modalService.open(FeeDetailComponent, {
size: 'xl',
scrollable: true,
backdrop: 'static'
backdrop: 'static',
});
modalRef.componentInstance.fee = f;
modalRef.componentInstance.feeUpdated.subscribe((_f: any) => {
Expand Down
Loading

0 comments on commit aa78143

Please sign in to comment.