-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
181 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 71 additions & 3 deletions
74
src/app/_pages/ticket/ticket-detail/ticket-detail.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,71 @@ | ||
<p>ticket-detail works!</p> | ||
<p>cooming-soon!</p> | ||
<p>please-come-back-later!</p> | ||
<!-- Notification --> | ||
<app-notifications></app-notifications> | ||
|
||
<!-- Content --> | ||
<div class="container" *ngIf="ticketData"> | ||
|
||
<!-- Detail --> | ||
<div class="row pb-3 px-0"> | ||
<div class="col-12"> | ||
<div class="row"> | ||
<div class="sticky-top bg-bifeldy"> | ||
<div class="col-12"> | ||
<h2 class="pt-3 m-0"> | ||
<b class="text-bifeldy">Ticket #{{ ticketData.id }}</b> | ||
</h2> | ||
</div> | ||
<div class="col-12"> | ||
<hr class="my-1 border-bottom-dotted" style="height: 4px; background: url('/assets/img/stripe.png');" /> | ||
</div> | ||
<div class="col-12"> | ||
<h5 class="pb-3 m-0 text-bifeldy"> | ||
.: | ||
<a routerLink="/user/{{ ticketData.user_.username }}" class="text-warning text-decoration-none" *ngIf="ticketData.user_"> | ||
{{ ticketData.user_.username }} | ||
</a> | ||
<span class="text-warning" *ngIf="!ticketData.user_">Anonim!</span> | ||
:: | ||
{{ ticketData.created_at | date:'d MMMM y, hh:mm:ss a z' }} | ||
:. | ||
</h5> | ||
</div> | ||
</div> | ||
<div class="col-12 pt-3 mt-3"> | ||
URL Terkait :: | ||
<br /> | ||
<a href="{{ ticketData.url }}" class="text-warning text-decoration-none" target="_blank"> | ||
{{ ticketData.url }} | ||
</a> | ||
</div> | ||
<div class="col-12 pt-3 mt-3" *ngIf="ticketData.expected_solution"> | ||
Ekspektasi Tindakan :: | ||
<br /> | ||
{{ ticketData.expected_solution }} | ||
</div> | ||
<div class="col-12 pt-3 mt-3" *ngIf="ticketData.final_decision"> | ||
Hasil Putusan :: | ||
<br /> | ||
{{ ticketData.final_decision }} | ||
</div> | ||
<div class="col-12 pt-3 mt-3"> | ||
Isi Laporan :: | ||
<br /> | ||
<div [innerHTML]="ticketData.reported_issue | safeInnerHtml"></div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="row pt-3"> | ||
<div class="col-12 sticky-top bg-bifeldy"> | ||
<h2 class="pt-3 border-bottom-dotted"> | ||
<b class="text-bifeldy">Komentar</b> | ||
</h2> | ||
</div> | ||
<div class="col-12"> | ||
<div class="p-3"> | ||
<app-discussion></app-discussion> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
</div> |
65 changes: 62 additions & 3 deletions
65
src/app/_pages/ticket/ticket-detail/ticket-detail.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,74 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { Component, OnDestroy, OnInit } from '@angular/core'; | ||
import { ActivatedRoute, Router } from '@angular/router'; | ||
|
||
import { GlobalService } from '../../../_shared/services/global.service'; | ||
import { TicketService } from '../../../_shared/services/ticket.service'; | ||
import { PageInfoService } from '../../../_shared/services/page-info.service'; | ||
import { BusyService } from '../../../_shared/services/busy.service'; | ||
|
||
@Component({ | ||
selector: 'app-ticket-detail', | ||
templateUrl: './ticket-detail.component.html', | ||
styleUrls: ['./ticket-detail.component.css'] | ||
}) | ||
export class TicketDetailComponent implements OnInit { | ||
export class TicketDetailComponent implements OnInit, OnDestroy { | ||
|
||
ticketId = 0; | ||
ticketSecret = ''; | ||
ticketData = null; | ||
|
||
subsActRoute = null; | ||
subsTicket = null; | ||
subsParam = null; | ||
|
||
constructor( | ||
private activatedRoute: ActivatedRoute, | ||
private router: Router, | ||
private bs: BusyService, | ||
private gs: GlobalService, | ||
private pi: PageInfoService, | ||
private ticket: TicketService | ||
) { | ||
this.gs.bannerImg = null; | ||
this.gs.sizeContain = false; | ||
this.gs.bgRepeat = false; | ||
} | ||
|
||
constructor() { } | ||
ngOnDestroy(): void { | ||
this.subsActRoute?.unsubscribe(); | ||
this.subsTicket?.unsubscribe(); | ||
this.subsParam?.unsubscribe(); | ||
} | ||
|
||
ngOnInit(): void { | ||
this.ticketId = Number(this.activatedRoute.snapshot.paramMap.get('ticketId') || ''); | ||
this.ticketSecret = this.activatedRoute.snapshot.queryParamMap.get('secret') || ''; | ||
this.getTicket(); | ||
} | ||
|
||
getTicket(): void { | ||
this.bs.busy(); | ||
this.subsTicket = this.ticket.getTicket(this.ticketId, this.ticketSecret).subscribe({ | ||
next: res => { | ||
this.gs.log('[TICKET_DETAIL_SUCCESS]', res); | ||
this.ticketData = res.result; | ||
this.pi.updatePageMetaData( | ||
`Ticket #${this.ticketData.id}`, | ||
this.ticketData.reported_issue, | ||
this.ticketData.url | ||
); | ||
this.bs.idle(); | ||
}, | ||
error: err => { | ||
this.gs.log('[TICKET_DETAIL_ERROR]', err, 'error'); | ||
this.bs.idle(); | ||
this.router.navigate(['/error'], { | ||
queryParams: { | ||
returnUrl: '/ticket' | ||
} | ||
}); | ||
} | ||
}); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters