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 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | 92x 97x 97x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 93x 93x 93x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 93x 93x 93x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x | import { css, html, TemplateResult } from 'lit';
import { ContactStoreElement } from './ContactStoreElement';
import { Icon } from '../Icons';
import { capitalize } from '../utils';
const STATUS = {
active: 'Active',
blocked: 'Blocked',
stopped: 'Stopped',
archived: 'Archived'
};
const SCHEMES = {
tel: 'Phone',
whatsapp: 'WhatsApp',
fcm: 'Firebase Cloud Messaging',
twitter: 'Twitter'
};
export class ContactDetails extends ContactStoreElement {
static get styles() {
return css`
.urn {
display: flex;
padding: 0.4em 1em 0.8em 1em;
border-bottom: 1px solid #e6e6e6;
margin-bottom: 0.5em;
}
.urn .path {
margin-left: 0.2em;
}
.wrapper {
padding-top: 0em;
}
.groups {
padding: 0.4em 0.5em 0.6em 0.5em;
border-bottom: 1px solid #e6e6e6;
margin-bottom: 0.4em;
}
.group {
margin-right: 0.7em;
margin-bottom: 0.7em;
}
.label {
font-size: 0.8em;
color: rgb(136, 136, 136);
margin-left: 0.5em;
margin-bottom: 0.4em;
}
`;
}
// Not sure if we want to include name here or not, so hold onto this for the moment
// ${this.data.name ? html`<temba-contact-field name="Name" value=${this.data.name} disabled></temba-contact-field>`:null}
public render(): TemplateResult {
if (!this.data) {
return;
}
const lang = this.store.getLanguageName(this.data.language);
return html`
<div class="wrapper">
${this.data.groups.length > 0
? html` <div class="groups">
<div class="label">Groups</div>
${this.data.groups.map((group) => {
return html`<temba-label
class="group"
onclick="goto(event)"
href="/contact/group/${group.uuid}/"
icon=${group.is_dynamic ? Icon.group_smart : Icon.group}
clickable
>
${group.name}
</temba-label>`;
})}
</div>`
: null}
${this.data.urns.map((urn) => {
const parts = urn.split(':');
let scheme = SCHEMES[parts[0]];
if (!scheme) {
scheme = capitalize(parts[0] as any);
}
return html`<temba-contact-field
name=${scheme}
value=${parts[1]}
disabled
></temba-contact-field>`;
})}
${this.data.ref
? html`<temba-contact-field
name="Ref"
value=${this.data.ref}
disabled
></temba-contact-field>`
: null}
<temba-contact-field
name="Status"
value=${STATUS[this.data.status]}
disabled
></temba-contact-field>
${lang
? html`<temba-contact-field
name="Language"
value=${lang}
disabled
></temba-contact-field>`
: null}
<temba-contact-field
name="Created"
value=${this.data.created_on}
type="datetime"
disabled
></temba-contact-field>
<temba-contact-field
name="Last Seen"
value=${this.data.last_seen_on}
type="datetime"
disabled
></temba-contact-field>
</div>
`;
}
}
|