Commit 1b3c45b2 authored by vtduong0912's avatar vtduong0912

update: job detail

parent 7595efc7
...@@ -21,4 +21,8 @@ export class JobService { ...@@ -21,4 +21,8 @@ export class JobService {
} }
}); });
} }
jobsGetOne(id: string) {
return this._http.get<ResponseResult<Jobs.Job>>(`jobs/${id}`);
}
} }
\ No newline at end of file
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnInit } from '@angular/core';
import { JobApi } from '../../../+admin/management/job/data-access/model/job-manager.model';
import { JobService } from '../../data-access/service/job.service';
import { ActivatedRoute } from '@angular/router';
import { catchError, of, tap } from 'rxjs';
import { Jobs } from '../../data-access/model/job.model';
@Component({
selector: 'job-detail',
standalone: true,
template: `
<div class="tw-max-w-3xl tw-mx-auto">
<p> {{ job?.company }} </p>
<p> {{ job?.company_logo }} </p>
<p> {{ job?.id }} </p>
<p> {{ job?.company }} </p>
<p> {{ job?.company }} </p>
<p> {{ job?.company }} </p>
<p> {{ job?.company }} </p>
<p> {{ job?.company }} </p>
</div>
`,
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class JobDetailComponent implements OnInit {
id: string | null = '';
job: Jobs.Job | null = null;
constructor(
private _jobService: JobService,
private _activatedRoute: ActivatedRoute,
private _cdr: ChangeDetectorRef
) { }
ngOnInit() {
this.id = this._activatedRoute.snapshot.paramMap.get('id');
this.getJob();
}
getJob() {
this._jobService.jobsGetOne(this.id!)
.pipe(
tap((response) => {
this.job = response?.responseData;
this._cdr.markForCheck();
}),
catchError((err) => {
return of(null);
})
)
.subscribe();
}
}
\ No newline at end of file
...@@ -22,8 +22,8 @@ ...@@ -22,8 +22,8 @@
<p>Location: {{ job.location }}</p> <p>Location: {{ job.location }}</p>
</div> </div>
<div class="tw-flex-grow tw-grid tw-justify-end "> <div class="tw-flex-grow tw-grid tw-justify-end ">
<button class="tw-h-10 tw-px-2 tw-border tw-rounded-lg hover:tw-bg-black hover:tw-text-white tw-transition"> <button routerLink="/jobs/detail/{{job.id}}" class="tw-h-10 tw-px-2 tw-border tw-rounded-lg hover:tw-bg-black hover:tw-text-white tw-transition">
Apply See detail
</button> </button>
</div> </div>
</div> </div>
......
...@@ -8,6 +8,7 @@ import { catchError, of, tap } from 'rxjs'; ...@@ -8,6 +8,7 @@ import { catchError, of, tap } from 'rxjs';
import { NzCardModule } from 'ng-zorro-antd/card'; import { NzCardModule } from 'ng-zorro-antd/card';
import { NzAvatarModule } from 'ng-zorro-antd/avatar'; import { NzAvatarModule } from 'ng-zorro-antd/avatar';
import { NzPaginationModule } from 'ng-zorro-antd/pagination'; import { NzPaginationModule } from 'ng-zorro-antd/pagination';
import { RouterLink } from '@angular/router';
@Component({ @Component({
selector: 'meu-job-list-page', selector: 'meu-job-list-page',
...@@ -20,7 +21,8 @@ import { NzPaginationModule } from 'ng-zorro-antd/pagination'; ...@@ -20,7 +21,8 @@ import { NzPaginationModule } from 'ng-zorro-antd/pagination';
NzCardModule, NzCardModule,
NzAvatarModule, NzAvatarModule,
NzPaginationModule, NzPaginationModule,
DatePipe DatePipe,
RouterLink
], ],
changeDetection: ChangeDetectionStrategy.OnPush, changeDetection: ChangeDetectionStrategy.OnPush,
}) })
......
import { Route } from '@angular/router'; import { Route } from '@angular/router';
const JOB_ROUTES: Route[] = [ const JOB_ROUTES: Route[] = [
{
path: '',
children: [
{ {
path: '', path: '',
loadComponent: () => loadComponent: () =>
import('./feature/job.component').then((m) => m.JobComponent), import('./feature/job.component').then((m) => m.JobComponent),
}, },
{
path: 'detail/:id',
loadComponent: () =>
import('./feature/+job_detail/job-detail.component').then((m) => m.JobDetailComponent),
}
],
},
]; ];
export default JOB_ROUTES; export default JOB_ROUTES;
...@@ -20,7 +20,6 @@ import { NzLayoutModule } from 'ng-zorro-antd/layout'; ...@@ -20,7 +20,6 @@ import { NzLayoutModule } from 'ng-zorro-antd/layout';
standalone: true, standalone: true,
imports: [ imports: [
RouterModule, RouterModule,
DatePipe,
HeaderComponent, HeaderComponent,
FooterComponent, FooterComponent,
NzButtonModule, NzButtonModule,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment