Skip to content

Commit

Permalink
Merge branch 'main' into NKS-1764
Browse files Browse the repository at this point in the history
  • Loading branch information
vegarduri authored Jan 21, 2025
2 parents 2d77090 + 62c7aca commit 95f15ab
Show file tree
Hide file tree
Showing 10 changed files with 184 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.padding-border-bottom {
border-bottom: 1px solid black;
padding-bottom: 1.5rem;
}

.button-padding {
padding-bottom: 1rem;
padding-top: 1.5rem;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<template>
<section role="log" class="slds-theme_default padding-border-bottom">
<template if:true={hasMessages}>
<template for:each={messages} for:item="message">
<c-crm-messaging-message-container message={message} key={message.Id}>
</c-crm-messaging-message-container>
</template>
</template>
</section>
<div class="button-padding">
<c-nks-button button-label="Behandle henvendelse" onclick={openRecord} is-link standard-length></c-nks-button>
</div>
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import { LightningElement, api, wire } from 'lwc';
import { NavigationMixin } from 'lightning/navigation';
import { getRelatedListRecords } from 'lightning/uiRelatedListApi';
import { publishToAmplitude } from 'c/amplitude';

export default class ThreadExpandedTimeline extends NavigationMixin(LightningElement) {
@api recordId;
@api logEvent;
messages;
hasMessages = false;
error;

@wire(getRelatedListRecords, {
parentRecordId: '$recordId',
relatedListId: 'Messages__r',
fields: [
'Message__c.Id',
'Message__c.CRM_Message_Text__c',
'Message__c.CRM_Type__c',
'Message__c.CRM_Event_Type__c',
'Message__c.CRM_Sent_date__c',
'Message__c.CRM_From_User__c',
'Message__c.CRM_From_Contact__c',
'Message__c.CRM_From_First_Name__c',
'Message__c.CRM_External_Message__c',
'Message__c.CRM_From_Label__c'
],
sortBy: ['Message__c.CRM_Sent_date__c']
})
wiredMessages(result) {
if (result.error) {
this.error = result.error;
console.log('Error: ' + JSON.stringify(result.error, null, 2));
} else if (result.data) {
this.messages = result.data.records.map((record) => {
const retObj = {};
Object.keys(record.fields).forEach((field) => {
retObj[field] = record.fields[field].value;
});
return retObj;
});
this.hasMessages = true;
}
}

openRecord(event) {
event.stopPropagation();
this[NavigationMixin.Navigate]({
type: 'standard__recordPage',
attributes: {
recordId: this.recordId,
objectApiName: 'Conversation_note__c',
actionName: 'view'
}
});
if (this.logEvent) {
publishToAmplitude('Timeline', { type: 'Navigate to record' });
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>62.0</apiVersion>
<isExposed>false</isExposed>
</LightningComponentBundle>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata">
<fullName>CRM_Journal_Status_Formula_Icons__c</fullName>
<externalId>false</externalId>
<formula>CASE(CRM_Journal_Status__c,
&apos;Journal Completed&apos;, IMAGE(&apos;/resource/circles/circle_green.svg&apos;, &apos;Journalført&apos;, 18,18)+ &apos; Journalført&apos;,
&apos;Journal Error&apos;, IMAGE(&apos;/resource/circles/circle_red.svg&apos;, &apos;Journalføring feilet&apos;, 18,18)+ &apos; Journalføring feilet&apos;,
&apos;Journal Started&apos;, IMAGE(&apos;/resource/circles/circle_blue.svg&apos;, &apos;Journalføring registrert&apos;, 18,18)+ &apos; Journalføring registrert&apos;,
IMAGE(&apos;/resource/circles/circle_grey.svg&apos;, &apos;Ikke journalført&apos;, 18,18) + &apos; Ikke journalført&apos;
)</formula>
<formulaTreatBlanksAs>BlankAsZero</formulaTreatBlanksAs>
<label>Journal Status</label>
<required>false</required>
<trackHistory>false</trackHistory>
<trackTrending>false</trackTrending>
<type>Text</type>
<unique>false</unique>
</CustomField>
Original file line number Diff line number Diff line change
@@ -1,21 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata">
<fullName>CRM_Timeline_Name__c</fullName>
<deprecated>false</deprecated>
<description>Friendly name displayed in timeline component for the thread.</description>
<externalId>false</externalId>
<formula>IF(ISPICKVAL(NKS_Experience_Site_Source__c, &apos;Fedrekvotesaken&apos;), &apos;Fedrekvotesaken: Kvittering&apos;,
IF(ISPICKVAL(CRM_Thread_Type__c,&apos;STO&apos;) || ISPICKVAL(CRM_Thread_Type__c,&apos;STB&apos;) || ISPICKVAL(CRM_Thread_Type__c,&apos;BTO&apos;),
IF(ISPICKVAL(CRM_Thread_Type__c, &apos;STO&apos;),&apos;Skriv til oss&apos;, IF(ISPICKVAL(CRM_Thread_Type__c, &apos;BTO&apos;), &apos;Beskjed til oss&apos;, &apos;Skriv til bruker&apos;)) + IF(ISBLANK(CRM_Theme__c), IF(ISPICKVAL(STO_Category__c, &apos;&apos;), &apos;&apos;, &apos; - &apos; + TEXT(STO_Category__c)), &apos; - &apos; + CRM_Theme__r.Name) +
IF(CRM_Number_of_unread_Messages__c != 0,
&apos; (&apos; +
TEXT(CRM_Number_of_unread_Messages__c) +
IF(CRM_Number_of_unread_Messages__c &gt; 1,
&apos; uleste meldinger&apos;,
&apos; ulest melding&apos;
),
&apos; (Lest&apos;
) +&apos;) &apos; + IF(CRM_isActive__c == false, IMAGE(&apos;/resource/caseStatusClosed&apos;, &apos;Lukket&apos;, 22, 53), IF(ISBLANK(CRM_Assignee_NAV_Unit__c), IF(ISBLANK(CRM_Case__c), &apos;&apos;, CRM_Case__r.CRM_Status_Image__c), IMAGE(&apos;/resource/caseStatusinProgress&apos;, &apos;Under Arbeid&apos;, 22, 86))),
STO_Timeline_Name__c + &apos; &apos; + IF(CRM_isActive__c == false, IMAGE(&apos;/resource/caseStatusClosed&apos;, &apos;Lukket&apos;, 22, 53), IF(ISBLANK(CRM_Assignee_NAV_Unit__c), IF(ISBLANK(CRM_Case__c), &apos;&apos;, CRM_Case__r.CRM_Status_Image__c), IMAGE(&apos;/resource/caseStatusinProgress&apos;, &apos;Under Arbeid&apos;, 22, 86))),
CASE(CRM_Thread_Type__c, &quot;CHAT&quot;,
&apos;Chat&apos; + IF(
AND(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata">
<fullName>CRM_Timeline_status__c</fullName>
<externalId>false</externalId>
<formula>IF(CRM_isActive__c == false,
&apos;Lukket&apos;,
IF(ISBLANK(CRM_Assignee_NAV_Unit__c),
IF(ISBLANK(CRM_Case__c),
&apos;&apos;,
CASE(CRM_Case__r.Status,
&apos;New&apos;, &apos;Åpen&apos;,
&apos;Escalated&apos;, &apos;Åpen&apos;,
&apos;Forwarded&apos;, &apos;Åpen&apos;,
&apos;On Hold&apos;, &apos;Besvart&apos;,
&apos;In progress&apos;, &apos;Under Arbeid&apos;,
&apos;Reserved&apos;, &apos;Under Arbeid&apos;,
&apos;Closed&apos;, &apos;Lukket&apos;,
&apos;&apos;)),
&apos;Under Arbeid&apos;))</formula>
<formulaTreatBlanksAs>BlankAsZero</formulaTreatBlanksAs>
<label>Timeline status</label>
<required>false</required>
<trackHistory>false</trackHistory>
<trackTrending>false</trackTrending>
<type>Text</type>
<unique>false</unique>
</CustomField>
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata">
<fullName>STO_Timeline_Name__c</fullName>
<externalId>false</externalId>
<formula>
IF(ISPICKVAL(NKS_Experience_Site_Source__c, &apos;Fedrekvotesaken&apos;), &apos;Fedrekvotesaken: Kvittering&apos;,
IF(ISPICKVAL(CRM_Thread_Type__c,&apos;STO&apos;) || ISPICKVAL(CRM_Thread_Type__c,&apos;STB&apos;) || ISPICKVAL(CRM_Thread_Type__c,&apos;BTO&apos;),
IF(ISPICKVAL(CRM_Thread_Type__c, &apos;STO&apos;),&apos;Skriv til oss&apos;, IF(ISPICKVAL(CRM_Thread_Type__c, &apos;BTO&apos;), &apos;Beskjed til oss&apos;, &apos;Skriv til bruker&apos;)) +
IF(ISBLANK(CRM_Theme__c), IF(ISPICKVAL(STO_Category__c, &apos;&apos;), &apos;&apos;, &apos; - &apos; + TEXT(STO_Category__c)), &apos; - &apos; + CRM_Theme__r.Name) +
IF(CRM_Number_of_unread_Messages__c != 0,
&apos; (&apos; +
TEXT(CRM_Number_of_unread_Messages__c) +
IF(CRM_Number_of_unread_Messages__c &gt; 1,
&apos; uleste meldinger&apos;,
&apos; ulest melding&apos;
),
&apos; (Lest&apos;
) +&apos;)&apos;,
CASE(CRM_Thread_Type__c, &quot;CHAT&quot;,
&apos;Chat&apos; +
IF(
AND(
NOT(ISBLANK(CRM_Theme_Name__c)),
NOT(ISBLANK(CRM_Theme_Group_Name__c))
),
&apos; - &apos; + CRM_Theme_Group_Name__c + &apos;, &apos; + CRM_Theme_Name__c,
&apos; - &apos; + CRM_Theme_Group_Name__c
)
, &quot;Tråd&quot;)
)
)
</formula>
<formulaTreatBlanksAs>BlankAsZero</formulaTreatBlanksAs>
<label>STO Timeline Name</label>
<required>false</required>
<trackHistory>false</trackHistory>
<trackTrending>false</trackTrending>
<type>Text</type>
<unique>false</unique>
</CustomField>
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@
<field>Case.STO_Category__c</field>
<readable>true</readable>
</fieldPermissions>
<fieldPermissions>
<editable>false</editable>
<field>Message__c.CRM_Event_Type__c</field>
<readable>true</readable>
</fieldPermissions>
<fieldPermissions>
<editable>false</editable>
<field>Message__c.CRM_From_First_Name__c</field>
<readable>true</readable>
</fieldPermissions>
<fieldPermissions>
<editable>true</editable>
<field>STO_Internal_Comment__c.Case__c</field>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@
<recordType>Case.STO_Case</recordType>
<visible>true</visible>
</recordTypeVisibilities>
</PermissionSet>
</PermissionSet>

0 comments on commit 95f15ab

Please sign in to comment.