Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 8x 8x 8x 8x 3x 3x 1x 1x 1x 1x 2x 2x 2x 2x | import { Component, EventEmitter, Input, Output } from '@angular/core';
import { MatMenuModule } from '@angular/material/menu';
import { RatingComponent } from '@features/jobs/rating/rating.component';
import { MatIcon } from '@angular/material/icon';
import { JobStatusComponent } from '@features/jobs/job-status/job-status.component';
import { MatCardModule } from '@angular/material/card';
import { RouterLink } from '@angular/router';
import { Job } from '@core/model/job.interface';
import { JobService } from '@core/services/job.service';
import { ModalService } from '@core/services/modal.service';
import { ConfirmDialogService } from '@core/services/confirm-dialog.service';
import { take, tap } from 'rxjs';
import { DatePipe } from '@angular/common';
import { MatIconButton } from '@angular/material/button';
import { MatTooltip } from '@angular/material/tooltip';
import { JobCommentComponent } from "../job-comment/job-comment.component";
import { JobEditableFieldComponent } from "../job-editable-field/job-editable-field.component";
@Component({
selector: 'app-job-summary',
imports: [MatMenuModule, RatingComponent, MatIcon, MatTooltip, MatIconButton, JobStatusComponent, MatCardModule, RouterLink, DatePipe, JobCommentComponent, JobEditableFieldComponent],
templateUrl: './job-summary.component.html',
styleUrl: './job-summary.component.scss'
})
export class JobSummaryComponent {
@Input({ required: true }) job!: Job;
@Input() context: 'list' | 'detail' = 'list';
@Output() deleted = new EventEmitter<Job>();
@Output() jobChanged = new EventEmitter<Job>();
constructor(private jobService:JobService, private modalService: ModalService, private confirmDialogService: ConfirmDialogService) {}
onJobChanged(job: Job): void {
this.job = job;
this.jobChanged.emit(job);
}
editJob(event: Event, job: Job): void {
// don't reload list as the edited job is replaced after update by the service
this.modalService.openJobModal('job', job, () => { });
}
confirmDeleteJob(job: Job): void {
this.jobService.deleteJob(job.id).pipe(
take(1),
tap(() => {
this.deleted.emit(this.job);
})
).subscribe();
}
deleteJob(job: Job): void {
this.confirmDialogService.openConfirmDialog($localize`:@@warning.job.delete:Delete job "${job.title}" ? All data will be lost.`, () => this.confirmDeleteJob(job));
}
manageAttachments(event: Event, job: Job): void {
// prevent routing to job detail
event.stopPropagation();
// FIXME : this is not ideal because we use contexts to emit or not the jobChanged event
// in case context is 'list' : don't reload list; as the edited job is replaced after update directly by the service
// in case context is 'detail' : emit jobChanged event to reload the job in the detail component
this.modalService.openJobModal('attachments', job, () => { if(this.context == 'detail') { this.onJobChanged(job) }});
}
manageActivities(event: Event, job: Job): void {
// prevent routing to job detail
event.stopPropagation();
// FIXME : this is not ideal because we use contexts to emit or not the jobChanged event
// in case context is 'list' : don't reload list; as the edited job is replaced after update directly by the service
// in case context is 'detail' : emit jobChanged event to reload the job in the detail component
this.modalService.openJobModal('activities', job, () => { if(this.context == 'detail') { this.onJobChanged(job) }});
}
}
|