-
Notifications
You must be signed in to change notification settings - Fork 178
/
reservationTile.js
36 lines (33 loc) · 1.15 KB
/
reservationTile.js
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
import { LightningElement, api } from 'lwc';
import { NavigationMixin } from 'lightning/navigation';
export default class ReservationTile extends NavigationMixin(LightningElement) {
@api reservation;
navRef;
get cssClass() {
return this.reservation.muted ? 'mute pointer' : 'pointer';
}
connectedCallback() {
this.reservationRecordRef = {
type: 'standard__recordPage',
attributes: {
recordId: this.reservation.record.Id,
actionName: 'view'
}
};
this[NavigationMixin.GenerateUrl](this.reservationRecordRef).then(
(url) => (this.navRef = url)
);
}
handleTileClick() {
const clickevt = new CustomEvent('reservationselect', {
detail: {
reservationId: this.reservation.record.Id,
marketId: this.reservation.record.Market__c,
customerName: this.reservation.record.Contact__c
? this.reservation.record.Contact__r.Name
: this.reservation.record.Lead__r.Name
}
});
this.dispatchEvent(clickevt);
}
}