Describe your feature changes
This commit is contained in:
parent
0970276250
commit
f2100986a1
|
|
@ -1,14 +0,0 @@
|
||||||
{
|
|
||||||
"extends": ["@salesforce/eslint-config-lwc/recommended"],
|
|
||||||
"overrides": [
|
|
||||||
{
|
|
||||||
"files": ["*.test.js"],
|
|
||||||
"rules": {
|
|
||||||
"@lwc/lwc/no-unexpected-wire-adapter-usages": "off"
|
|
||||||
},
|
|
||||||
"env": {
|
|
||||||
"node": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
<!-- accountList.html -->
|
|
||||||
<template>
|
|
||||||
<lightning-card title="Account List" icon-name="standard:account">
|
|
||||||
<lightning-datatable
|
|
||||||
data={accounts}
|
|
||||||
columns={columns}
|
|
||||||
key-field="Id"
|
|
||||||
hide-checkbox-column="true"
|
|
||||||
show-row-number-column="true"
|
|
||||||
onrowaction={handleRowAction}>
|
|
||||||
</lightning-datatable>
|
|
||||||
</lightning-card>
|
|
||||||
</template>
|
|
||||||
|
|
@ -1,44 +0,0 @@
|
||||||
// accountList.js
|
|
||||||
import { LightningElement, api } from 'lwc';
|
|
||||||
import { NavigationMixin } from 'lightning/navigation';
|
|
||||||
|
|
||||||
export default class AccountListLWC extends NavigationMixin(LightningElement) {
|
|
||||||
@api accounts;
|
|
||||||
|
|
||||||
columns = [
|
|
||||||
{ label: 'Account Name', fieldName: 'Name' },
|
|
||||||
{ label: 'Type', fieldName:'Type'},
|
|
||||||
{ label: 'Phone', fieldName:'Phone'},
|
|
||||||
{
|
|
||||||
label: 'Action',
|
|
||||||
type: 'button',
|
|
||||||
initialWidth: 135,
|
|
||||||
typeAttributes: {
|
|
||||||
label: 'View details',
|
|
||||||
name: 'view_details',
|
|
||||||
title: 'Click to View Details',
|
|
||||||
disabled: false,
|
|
||||||
value: 'view',
|
|
||||||
variant: 'base',
|
|
||||||
},
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
handleRowAction(event) {
|
|
||||||
const actionName = event.detail.action.name;
|
|
||||||
const row = event.detail.row;
|
|
||||||
switch (actionName) {
|
|
||||||
case 'view_details':
|
|
||||||
this[NavigationMixin.Navigate]({
|
|
||||||
type:'standard__recordPage',
|
|
||||||
attributes:{
|
|
||||||
recordId: row.Id,
|
|
||||||
objectApiName:'Account',
|
|
||||||
actionName:'view'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
|
|
||||||
<apiVersion>59.0</apiVersion>
|
|
||||||
<isExposed>false</isExposed>
|
|
||||||
</LightningComponentBundle>
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
||||||
<template>
|
|
||||||
|
|
||||||
<lightning-layout horizontal-align="space" multiple-rows>
|
|
||||||
<lightning-layout-item size="12" medium-device-size="12" padding="around-small">
|
|
||||||
<c-account-search onsearch={handleSearch}></c-account-search>
|
|
||||||
</lightning-layout-item>
|
|
||||||
<lightning-layout-item size="12" medium-device-size="6" padding="around-small">
|
|
||||||
<c-account-list-l-w-c accounts={accounts}></c-account-list-l-w-c>
|
|
||||||
</lightning-layout-item>
|
|
||||||
<lightning-layout-item size="12" medium-device-size="6" padding="around-small">
|
|
||||||
<c-account-map accounts={accounts}></c-account-map>
|
|
||||||
</lightning-layout-item>
|
|
||||||
</lightning-layout>
|
|
||||||
|
|
||||||
</template>
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
// accountLocatorController.js
|
|
||||||
import { LightningElement, track } from 'lwc';
|
|
||||||
|
|
||||||
export default class AccountLocator extends LightningElement {
|
|
||||||
@track accounts;
|
|
||||||
|
|
||||||
handleSearch(event) {
|
|
||||||
this.accounts = event.detail;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
|
|
||||||
<apiVersion>59.0</apiVersion>
|
|
||||||
<isExposed>true</isExposed>
|
|
||||||
<targets>
|
|
||||||
<target>lightning__HomePage</target>
|
|
||||||
<target>lightning__AppPage</target>
|
|
||||||
<target>lightningCommunity__Page</target>
|
|
||||||
</targets>
|
|
||||||
</LightningComponentBundle>
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
<template>
|
|
||||||
<lightning-card title="Account Map" icon-name="action:map">
|
|
||||||
<div class="slds-m-around_medium">
|
|
||||||
<lightning-map map-markers={mapMarkers}></lightning-map>
|
|
||||||
</div>
|
|
||||||
</lightning-card>
|
|
||||||
</template>
|
|
||||||
|
|
@ -1,40 +0,0 @@
|
||||||
// accountMap.js
|
|
||||||
import { LightningElement, api, track } from 'lwc';
|
|
||||||
|
|
||||||
export default class AccountMap extends LightningElement {
|
|
||||||
@track mapMarkers = [];
|
|
||||||
_accounts;
|
|
||||||
|
|
||||||
connectedCallback() {
|
|
||||||
this.loadMapMarkers();
|
|
||||||
}
|
|
||||||
|
|
||||||
loadMapMarkers() {
|
|
||||||
if (this._accounts && this._accounts.length > 0) {
|
|
||||||
|
|
||||||
this.mapMarkers = this._accounts.map(account => {
|
|
||||||
return {
|
|
||||||
location: {
|
|
||||||
Street: account.ShippingStreet,
|
|
||||||
City: account.ShippingCity,
|
|
||||||
PostalCode: account.ShippingPostalCode
|
|
||||||
},
|
|
||||||
title: account.Name,
|
|
||||||
description: `Phone: ${account.Phone}`,
|
|
||||||
icon: 'standard:location'
|
|
||||||
};
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@api
|
|
||||||
get accounts() {
|
|
||||||
return this._accounts;
|
|
||||||
}
|
|
||||||
|
|
||||||
set accounts(value) {
|
|
||||||
this._accounts = value;
|
|
||||||
this.loadMapMarkers();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
|
|
||||||
<apiVersion>59.0</apiVersion>
|
|
||||||
<isExposed>false</isExposed>
|
|
||||||
</LightningComponentBundle>
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
<template>
|
|
||||||
<lightning-card title="Account Search" icon-name="standard:search">
|
|
||||||
<div class="slds-form slds-p-around_x-small">
|
|
||||||
<lightning-input
|
|
||||||
label="Search"
|
|
||||||
variant="label-hidden"
|
|
||||||
value={searchValue}
|
|
||||||
placeholder="Search by name"
|
|
||||||
onchange={handleSearchChange}>
|
|
||||||
</lightning-input>
|
|
||||||
</div>
|
|
||||||
</lightning-card>
|
|
||||||
</template>
|
|
||||||
|
|
@ -1,29 +0,0 @@
|
||||||
// accountSearchController.js
|
|
||||||
import { LightningElement, track } from 'lwc';
|
|
||||||
import searchAccounts from '@salesforce/apex/AccountSearchController.searchAccounts';
|
|
||||||
|
|
||||||
export default class AccountSearch extends LightningElement {
|
|
||||||
@track searchValue = '';
|
|
||||||
|
|
||||||
handleSearchChange(event) {
|
|
||||||
this.searchValue = event.target.value;
|
|
||||||
this.searchAccounts();
|
|
||||||
}
|
|
||||||
|
|
||||||
searchAccounts() {
|
|
||||||
try {
|
|
||||||
searchAccounts({ searchValue: this.searchValue })
|
|
||||||
.then(result => {
|
|
||||||
console.log('Search Results: ', JSON.stringify(result)); // Debugging line
|
|
||||||
this.accounts = result;
|
|
||||||
const searchEvent = new CustomEvent('search', { detail: this.accounts });
|
|
||||||
this.dispatchEvent(searchEvent);
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
console.error('Error in AccountSearch: ' + error.message);
|
|
||||||
});
|
|
||||||
} catch (err) {
|
|
||||||
console.error('Error in AccountSearch: ' + err.message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
|
|
||||||
<apiVersion>59.0</apiVersion>
|
|
||||||
<isExposed>true</isExposed>
|
|
||||||
<targets>
|
|
||||||
<target>lightning__HomePage</target>
|
|
||||||
</targets>
|
|
||||||
</LightningComponentBundle>
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
<template>
|
|
||||||
<lightning-card title="Using Api Decorator">
|
|
||||||
{itemName}
|
|
||||||
</lightning-card>
|
|
||||||
|
|
||||||
<lightning-input type="file"
|
|
||||||
accept=".xlsx, .xls, .csv, .png, .doc, .docx, .pdf"
|
|
||||||
label="Upload file" onchange={openfileUpload}></lightning-input>
|
|
||||||
</template>
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
import { LightningElement,api} from 'lwc';
|
|
||||||
|
|
||||||
export default class ApiDecorator extends LightningElement {
|
|
||||||
itemName="Welcome to Api ";
|
|
||||||
}
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
|
|
||||||
<apiVersion>57.0</apiVersion>
|
|
||||||
<isExposed>true</isExposed>
|
|
||||||
<targets>
|
|
||||||
<target>lightning__RecordPage</target>
|
|
||||||
</targets>
|
|
||||||
</LightningComponentBundle>
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
<template>
|
|
||||||
<div>
|
|
||||||
<div>Name: {name}</div>
|
|
||||||
<div>Description: {description}</div>
|
|
||||||
<lightning-badge label={material}></lightning-badge>
|
|
||||||
<lightning-badge label={category}></lightning-badge>
|
|
||||||
<div>Price: {price}</div>
|
|
||||||
<div><img src={pictureUrl}/></div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
import { LightningElement } from 'lwc';
|
|
||||||
export default class bikeCard extends LightningElement {
|
|
||||||
name = 'Electra X4';
|
|
||||||
description = 'A sweet bike built for comfort.';
|
|
||||||
category = 'Mountain';
|
|
||||||
material = 'Steel';
|
|
||||||
price = '$2,700';
|
|
||||||
pictureUrl = 'https://s3-us-west-1.amazonaws.com/sfdc-demo/ebikes/electrax4.jpg';
|
|
||||||
}
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
|
|
||||||
<!-- The apiVersion may need to be increased for the current release -->
|
|
||||||
<apiVersion>57.0</apiVersion>
|
|
||||||
<isExposed>true</isExposed>
|
|
||||||
<masterLabel>Bike Card</masterLabel>
|
|
||||||
<targets>
|
|
||||||
<target>lightning__AppPage</target>
|
|
||||||
<target>lightning__RecordPage</target>
|
|
||||||
<target>lightning__HomePage</target>
|
|
||||||
</targets>
|
|
||||||
</LightningComponentBundle>
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
<template>
|
|
||||||
<section role="dialog" tabindex="-1" aria-modal="true" aria-labelledby="modal-heading-01" class="slds-modal slds-fade-in-open slds-modal_small">
|
|
||||||
<div class="slds-modal__container">
|
|
||||||
<div class="slds-modal__header">
|
|
||||||
<h1 id="modal-heading-01" class="slds-modal__title slds-hyphenate">Confirmation</h1>
|
|
||||||
</div>
|
|
||||||
<div class="slds-modal__content slds-p-around_medium" id="modal-content-id-1">
|
|
||||||
|
|
||||||
<p>Seccessfully Created</p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="slds-modal__footer">
|
|
||||||
<button class="slds-button slds-button_brand" onclick={closeHandler}>Ok</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
<div class="slds-backdrop slds-backdrop_open" role="presentation"></div>
|
|
||||||
</template>
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
import { LightningElement } from 'lwc';
|
|
||||||
|
|
||||||
export default class C2pModelComponent extends LightningElement {
|
|
||||||
|
|
||||||
msg = [{ name : 'Event 1',
|
|
||||||
mess : 'Closed 1'},
|
|
||||||
{
|
|
||||||
name : 'Event 2',
|
|
||||||
mess : 'Closed 2'
|
|
||||||
}]
|
|
||||||
closeHandler(){
|
|
||||||
|
|
||||||
const myEvent = new CustomEvent('close',{
|
|
||||||
detail :this.msg
|
|
||||||
});
|
|
||||||
this.dispatchEvent(myEvent);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
|
|
||||||
<apiVersion>59.0</apiVersion>
|
|
||||||
<isExposed>false</isExposed>
|
|
||||||
</LightningComponentBundle>
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
<template>
|
|
||||||
<lightning-card title="Child to parent commmunication">
|
|
||||||
<div class="slds-m around_medium">
|
|
||||||
<lightning-button label="Show Modal" onclick={clickHandler}></lightning-button>
|
|
||||||
<template if:true={message}>
|
|
||||||
<template for:each={message} for:item='item'>
|
|
||||||
<div key ={item.name}>
|
|
||||||
<p>Name : {item.name}</p>
|
|
||||||
<p>Message : {item.mess}</p>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template if:true={showModal}>
|
|
||||||
<c-c2p-model-component onclose = {closeHandler}></c-c2p-model-component>
|
|
||||||
</template>
|
|
||||||
</div>
|
|
||||||
</lightning-card>
|
|
||||||
</template>
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
import { LightningElement } from 'lwc';
|
|
||||||
|
|
||||||
export default class C2pParentComponet extends LightningElement {
|
|
||||||
|
|
||||||
showModal=false;
|
|
||||||
message;
|
|
||||||
|
|
||||||
clickHandler(){
|
|
||||||
this.showModal = true ;
|
|
||||||
}
|
|
||||||
|
|
||||||
closeHandler(event){
|
|
||||||
this.message = event.detail
|
|
||||||
this.showModal = false ;
|
|
||||||
console.log(this.message[0].name);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
|
|
||||||
<apiVersion>59.0</apiVersion>
|
|
||||||
<isExposed>true</isExposed>
|
|
||||||
<targets>
|
|
||||||
<target>lightning__AppPage</target>
|
|
||||||
</targets>
|
|
||||||
</LightningComponentBundle>
|
|
||||||
|
|
@ -1,177 +0,0 @@
|
||||||
<template>
|
|
||||||
<div class="slds-m-around_small" style="display: inline-block">
|
|
||||||
<lightning-card title="Calculator" icon-name="custom:custom34">
|
|
||||||
<div>
|
|
||||||
<lightning-input
|
|
||||||
value={calcExpression}
|
|
||||||
name="txtExpression"
|
|
||||||
readonly>
|
|
||||||
</lightning-input>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<lightning-input
|
|
||||||
value={showResult}
|
|
||||||
label="Output"
|
|
||||||
name="txtResult"
|
|
||||||
readonly>
|
|
||||||
</lightning-input>
|
|
||||||
</div>
|
|
||||||
<div style="display: inline-block">
|
|
||||||
<table class="slds-table slds-table_cell-buffer slds-table_bordered">
|
|
||||||
<tr class="slds-line-height_reset">
|
|
||||||
<td>
|
|
||||||
<div class="slds-truncate">
|
|
||||||
<lightning-button
|
|
||||||
variant="brand-outline"
|
|
||||||
label="1"
|
|
||||||
onclick={handleClick}
|
|
||||||
></lightning-button>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<div class="slds-truncate">
|
|
||||||
<lightning-button
|
|
||||||
variant="brand-outline"
|
|
||||||
label="2"
|
|
||||||
onclick={handleClick}
|
|
||||||
></lightning-button>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<div class="slds-truncate">
|
|
||||||
<lightning-button
|
|
||||||
variant="brand-outline"
|
|
||||||
label="3"
|
|
||||||
onclick={handleClick}
|
|
||||||
></lightning-button>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<div class="slds-truncate">
|
|
||||||
<lightning-button
|
|
||||||
variant="brand"
|
|
||||||
label="+"
|
|
||||||
onclick={handleClick}
|
|
||||||
></lightning-button>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="slds-line-height_reset">
|
|
||||||
<td>
|
|
||||||
<div class="slds-truncate">
|
|
||||||
<lightning-button
|
|
||||||
variant="brand-outline"
|
|
||||||
label="4"
|
|
||||||
onclick={handleClick}
|
|
||||||
></lightning-button>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<div class="slds-truncate">
|
|
||||||
<lightning-button
|
|
||||||
variant="brand-outline"
|
|
||||||
label="5"
|
|
||||||
onclick={handleClick}
|
|
||||||
></lightning-button>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<div class="slds-truncate">
|
|
||||||
<lightning-button
|
|
||||||
variant="brand-outline"
|
|
||||||
label="6"
|
|
||||||
onclick={handleClick}
|
|
||||||
></lightning-button>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<div class="slds-truncate">
|
|
||||||
<lightning-button
|
|
||||||
variant="destructive"
|
|
||||||
label="-"
|
|
||||||
onclick={handleClick}
|
|
||||||
></lightning-button>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="slds-line-height_reset">
|
|
||||||
<td>
|
|
||||||
<div class="slds-truncate">
|
|
||||||
<lightning-button
|
|
||||||
variant="brand-outline"
|
|
||||||
label="7"
|
|
||||||
onclick={handleClick}
|
|
||||||
></lightning-button>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<div class="slds-truncate">
|
|
||||||
<lightning-button
|
|
||||||
variant="brand-outline"
|
|
||||||
label="8"
|
|
||||||
onclick={handleClick}
|
|
||||||
></lightning-button>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<div class="slds-truncate">
|
|
||||||
<lightning-button
|
|
||||||
variant="brand-outline"
|
|
||||||
label="9"
|
|
||||||
onclick={handleClick}
|
|
||||||
></lightning-button>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<div class="slds-truncate">
|
|
||||||
<lightning-button
|
|
||||||
variant="brand"
|
|
||||||
label="*"
|
|
||||||
onclick={handleClick}
|
|
||||||
></lightning-button>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="slds-line-height_reset">
|
|
||||||
<td>
|
|
||||||
<div class="slds-truncate">
|
|
||||||
<lightning-button
|
|
||||||
variant="destructive-text"
|
|
||||||
label="AC"
|
|
||||||
onclick={handleClear}
|
|
||||||
></lightning-button>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<div class="slds-truncate">
|
|
||||||
<lightning-button
|
|
||||||
variant="brand-outline"
|
|
||||||
label="0"
|
|
||||||
onclick={handleClick}
|
|
||||||
></lightning-button>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<div class="slds-truncate">
|
|
||||||
<lightning-button
|
|
||||||
variant="success"
|
|
||||||
label="="
|
|
||||||
onclick={handleClick}
|
|
||||||
></lightning-button>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<div class="slds-truncate">
|
|
||||||
<lightning-button
|
|
||||||
variant="brand"
|
|
||||||
label="/"
|
|
||||||
onclick={handleClick}
|
|
||||||
></lightning-button>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</lightning-card>
|
|
||||||
</div >
|
|
||||||
</template>
|
|
||||||
|
|
@ -1,110 +0,0 @@
|
||||||
import { LightningElement } from 'lwc';
|
|
||||||
|
|
||||||
|
|
||||||
export default class PracticeJavaScript extends LightningElement {
|
|
||||||
calcResult = '';
|
|
||||||
calcExpression = '';
|
|
||||||
clrExpression = false;
|
|
||||||
prevOper = '';
|
|
||||||
operations = {
|
|
||||||
current: 0,
|
|
||||||
'=': function(){
|
|
||||||
return this.current;
|
|
||||||
},
|
|
||||||
'+': function(n){
|
|
||||||
this.current += parseInt(n);
|
|
||||||
return this;
|
|
||||||
},
|
|
||||||
'-': function(n){
|
|
||||||
this.current -= parseInt(n);
|
|
||||||
return this;
|
|
||||||
},
|
|
||||||
'*': function(n){
|
|
||||||
this.current *= parseInt(n);
|
|
||||||
return this;
|
|
||||||
},
|
|
||||||
'/': function(n){
|
|
||||||
this.current /= parseInt(n);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
get showResult(){
|
|
||||||
return this.operations.current;
|
|
||||||
}
|
|
||||||
handleClear(event){
|
|
||||||
this.calcResult = '';
|
|
||||||
this.calcExpression = '';
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
handleClick(event){
|
|
||||||
if (this.clrExpression){
|
|
||||||
this.calcExpression = '';
|
|
||||||
this.calcResult = '';
|
|
||||||
this.operations.current = 0;
|
|
||||||
this.clrExpression = false;
|
|
||||||
}
|
|
||||||
this.calcExpression = this.calcExpression + event.target.label;
|
|
||||||
if (event.target.label === "CLR"){
|
|
||||||
this.calcResult = '';
|
|
||||||
this.calcExpression = '';
|
|
||||||
this.operations.current = 0;
|
|
||||||
}
|
|
||||||
else if (event.target.label === "+"){
|
|
||||||
if (this.operations.current === 0)
|
|
||||||
{
|
|
||||||
this.operations.current = parseInt(this.calcResult);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
this.calcResult = this.operations[this.prevOper](this.calcResult);
|
|
||||||
}
|
|
||||||
this.prevOper = '+';
|
|
||||||
this.calcResult = '';
|
|
||||||
}
|
|
||||||
else if (event.target.label === "-"){
|
|
||||||
if (this.operations.current === 0)
|
|
||||||
{
|
|
||||||
this.operations.current = parseInt(this.calcResult);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
this.calcResult = this.operations[this.prevOper](this.calcResult);
|
|
||||||
}
|
|
||||||
this.prevOper = '-';
|
|
||||||
this.calcResult = '';
|
|
||||||
}
|
|
||||||
else if (event.target.label === "*"){
|
|
||||||
if (this.operations.current === 0)
|
|
||||||
{
|
|
||||||
this.operations.current = parseInt(this.calcResult);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
this.calcResult = this.operations[this.prevOper](this.calcResult);
|
|
||||||
}
|
|
||||||
this.prevOper = '*';
|
|
||||||
this.calcResult = '';
|
|
||||||
}
|
|
||||||
else if (event.target.label === "/"){
|
|
||||||
if (this.operations.current === 0)
|
|
||||||
{
|
|
||||||
this.operations.current = parseInt(this.calcResult);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
this.calcResult = this.operations[this.prevOper](this.calcResult);
|
|
||||||
}
|
|
||||||
this.prevOper = '/';
|
|
||||||
this.calcResult = '';
|
|
||||||
}
|
|
||||||
else if (event.target.label === "="){
|
|
||||||
this.calcResult = this.operations[this.prevOper](this.calcResult);
|
|
||||||
this.calcResult = this.operations['=']();
|
|
||||||
this.clrExpression = true;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
this.calcResult = this.calcResult + event.target.label;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
|
|
||||||
<apiVersion>57.0</apiVersion>
|
|
||||||
<isExposed>true</isExposed>
|
|
||||||
<targets>
|
|
||||||
<target>lightning__HomePage</target>
|
|
||||||
</targets>
|
|
||||||
</LightningComponentBundle>
|
|
||||||
|
|
@ -1,147 +0,0 @@
|
||||||
<template>
|
|
||||||
<lightning-card title="Calculator" icon-name="action:upload">
|
|
||||||
|
|
||||||
<div class="slds-grid slds-gutters slds-m-vertical_small">
|
|
||||||
<div class="slds-col">
|
|
||||||
<!-- substract button -->
|
|
||||||
<lightning-button class="slds-p-horizontal_medium "
|
|
||||||
label="1"
|
|
||||||
value="1"
|
|
||||||
onclick={handleNumbers}>
|
|
||||||
</lightning-button>
|
|
||||||
</div>
|
|
||||||
<div class="slds-col">
|
|
||||||
<!-- add button -->
|
|
||||||
<lightning-button class="slds-p-horizontal_medium "
|
|
||||||
label="2"
|
|
||||||
value="2"
|
|
||||||
onclick={handleNumbers}>
|
|
||||||
</lightning-button>
|
|
||||||
</div>
|
|
||||||
<div class="slds-col">
|
|
||||||
|
|
||||||
<!-- Do zero button -->
|
|
||||||
<lightning-button class="slds-p-horizontal_small "
|
|
||||||
label="3"
|
|
||||||
value="3"
|
|
||||||
onclick={handleNumbers}>
|
|
||||||
</lightning-button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="slds-grid slds-gutters slds-m-vertical_small">
|
|
||||||
<div class="slds-col">
|
|
||||||
<!-- substract button -->
|
|
||||||
<lightning-button class="slds-p-horizontal_medium "
|
|
||||||
label="4"
|
|
||||||
value="4"
|
|
||||||
onclick={handleNumbers}>
|
|
||||||
</lightning-button>
|
|
||||||
</div>
|
|
||||||
<div class="slds-col">
|
|
||||||
<!-- add button -->
|
|
||||||
<lightning-button class="slds-p-horizontal_medium "
|
|
||||||
label="5"
|
|
||||||
value="5"
|
|
||||||
onclick={handleNumbers}>
|
|
||||||
</lightning-button>
|
|
||||||
</div>
|
|
||||||
<div class="slds-col">
|
|
||||||
|
|
||||||
<!-- Do zero button -->
|
|
||||||
<lightning-button class="slds-p-horizontal_small "
|
|
||||||
label="6"
|
|
||||||
value="6"
|
|
||||||
onclick={handleNumbers}>
|
|
||||||
</lightning-button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="slds-grid slds-gutters slds-m-vertical_small">
|
|
||||||
<div class="slds-col">
|
|
||||||
<!-- substract button -->
|
|
||||||
<lightning-button class="slds-p-horizontal_medium "
|
|
||||||
label="7"
|
|
||||||
value="7"
|
|
||||||
onclick={handleNumbers}>
|
|
||||||
</lightning-button>
|
|
||||||
</div>
|
|
||||||
<div class="slds-col">
|
|
||||||
<!-- add button -->
|
|
||||||
<lightning-button class="slds-p-horizontal_medium "
|
|
||||||
label="8"
|
|
||||||
value="8"
|
|
||||||
onclick={handleNumbers}>
|
|
||||||
</lightning-button>
|
|
||||||
</div>
|
|
||||||
<div class="slds-col">
|
|
||||||
|
|
||||||
<!-- Do zero button -->
|
|
||||||
<lightning-button class="slds-p-horizontal_small "
|
|
||||||
label="9"
|
|
||||||
value="9"
|
|
||||||
onclick={handleNumbers}>
|
|
||||||
</lightning-button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="slds-grid slds-gutters slds-m-vertical_small">
|
|
||||||
<div class="slds-col">
|
|
||||||
<!-- substract button -->
|
|
||||||
<lightning-button class="slds-p-horizontal_medium "
|
|
||||||
label="0"
|
|
||||||
value="0"
|
|
||||||
onclick={handleNumbers}>
|
|
||||||
</lightning-button>
|
|
||||||
</div>
|
|
||||||
<div class="slds-col">
|
|
||||||
<!-- add button -->
|
|
||||||
<lightning-button class="slds-p-horizontal_medium "
|
|
||||||
label="+"
|
|
||||||
value="+"
|
|
||||||
onclick={handleMultiply}>
|
|
||||||
</lightning-button>
|
|
||||||
</div>
|
|
||||||
<div class="slds-col">
|
|
||||||
|
|
||||||
<!-- Do zero button -->
|
|
||||||
<lightning-button class="slds-p-horizontal_small "
|
|
||||||
label="-"
|
|
||||||
value="-"
|
|
||||||
onclick={handleMultiply}>
|
|
||||||
</lightning-button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="slds-grid slds-gutters slds-m-vertical_small">
|
|
||||||
<div class="slds-col">
|
|
||||||
<!-- substract button -->
|
|
||||||
<lightning-button class="slds-p-horizontal_medium "
|
|
||||||
label="*"
|
|
||||||
value="*"
|
|
||||||
onclick={handleMultiply}>
|
|
||||||
</lightning-button>
|
|
||||||
</div>
|
|
||||||
<div class="slds-col">
|
|
||||||
<!-- add button -->
|
|
||||||
<lightning-button class="slds-p-horizontal_medium "
|
|
||||||
label="/"
|
|
||||||
value="/"
|
|
||||||
onclick={handleMultiply}>
|
|
||||||
</lightning-button>
|
|
||||||
</div>
|
|
||||||
<div class="slds-col">
|
|
||||||
|
|
||||||
<!-- Do zero button -->
|
|
||||||
<lightning-button class="slds-p-horizontal_small "
|
|
||||||
label="c"
|
|
||||||
value="c"
|
|
||||||
onclick={handleClearAll}>
|
|
||||||
</lightning-button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</lightning-card>
|
|
||||||
|
|
||||||
</template>
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
import { LightningElement } from 'lwc';
|
|
||||||
|
|
||||||
export default class CalculatorChild extends LightningElement {
|
|
||||||
handleNumbers(event){
|
|
||||||
const valueformultiply=event.target.value;
|
|
||||||
|
|
||||||
this.dispatchEvent(new CustomEvent('numbers',{
|
|
||||||
detail:valueformultiply
|
|
||||||
}));
|
|
||||||
|
|
||||||
}
|
|
||||||
handleMultiply(event){
|
|
||||||
const valueoflogic=event.target.value;
|
|
||||||
this.dispatchEvent(new CustomEvent('logical',{
|
|
||||||
detail:valueoflogic
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
handleClearAll(event){
|
|
||||||
this.dispatchEvent(new CustomEvent('clear'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
|
|
||||||
<apiVersion>57.0</apiVersion>
|
|
||||||
<isExposed>false</isExposed>
|
|
||||||
</LightningComponentBundle>
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
<template>
|
|
||||||
<lightning-card title="Calculator">
|
|
||||||
<p>{expression}</p>
|
|
||||||
<p>{output}</p>
|
|
||||||
</lightning-card>
|
|
||||||
<c-calculator-child
|
|
||||||
onnumbers={handlenumbers}
|
|
||||||
onlogical={handlelogical}
|
|
||||||
onclear={handleClear}></c-calculator-child>
|
|
||||||
</template>
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
||||||
import { LightningElement } from 'lwc';
|
|
||||||
|
|
||||||
export default class CalculatorParent extends LightningElement {
|
|
||||||
expression;
|
|
||||||
number;
|
|
||||||
cal;
|
|
||||||
output=0;
|
|
||||||
handlenumbers(event){
|
|
||||||
this.expression+=event.detail;
|
|
||||||
this.number=event.detail;
|
|
||||||
if(this.cal=null){
|
|
||||||
this.output=this.number;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
handlelogical(event){
|
|
||||||
this.expression+=event.detail;
|
|
||||||
this.cal=event.detail;
|
|
||||||
|
|
||||||
}
|
|
||||||
handleClear(){
|
|
||||||
this.expression = '';
|
|
||||||
this.output = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
|
|
||||||
<apiVersion>57.0</apiVersion>
|
|
||||||
<isExposed>true</isExposed>
|
|
||||||
<targets>
|
|
||||||
<target>lightning__HomePage</target>
|
|
||||||
</targets>
|
|
||||||
</LightningComponentBundle>
|
|
||||||
|
|
@ -1,37 +0,0 @@
|
||||||
<template>
|
|
||||||
<div class="Box"> <h1>API EXAMPLE</h1>
|
|
||||||
<div>Message : {message}</div>
|
|
||||||
<div>RecordId : {recordId} </div>
|
|
||||||
</div>
|
|
||||||
<h1>WIRE EXAMPLE</h1>
|
|
||||||
<template if:true={record.data}>
|
|
||||||
<div class="slds-grid">
|
|
||||||
|
|
||||||
<div class="slds-col slds-size_1-of-2">
|
|
||||||
<lightning-formatted-text value={name} class="slds-text-heading_large">
|
|
||||||
|
|
||||||
</lightning-formatted-text>
|
|
||||||
</div>
|
|
||||||
<div class="slds-col slds-size_2-of-2">
|
|
||||||
<lightning-formatted-text value={phone} class="slds-text-heading_large">
|
|
||||||
|
|
||||||
</lightning-formatted-text>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<h1>ConnectedCallBack</h1>
|
|
||||||
<div class="slds-card">
|
|
||||||
<lightning-input label="Enter Name" name="name" onchange={getName}></lightning-input>
|
|
||||||
</div>
|
|
||||||
<div class="slds-card" if:true={ShowButton}>
|
|
||||||
<lightning-button name="Click On" label="Click On"></lightning-button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<h2>RenderCallBack</h2>
|
|
||||||
<lightning-button label="Button 1" onclick={buttonClicked} data-id="button1"></lightning-button>
|
|
||||||
<lightning-button label="Button 2" onclick={buttonClicked} data-id="button2"></lightning-button>
|
|
||||||
<template if:true={showInfo}>
|
|
||||||
<lightning-input name="input1" class='input1'></lightning-input>
|
|
||||||
</template>
|
|
||||||
</template>
|
|
||||||
|
|
@ -1,58 +0,0 @@
|
||||||
import { LightningElement,api, wire, track } from 'lwc';
|
|
||||||
import { getRecord, getFieldValue } from 'lightning/uiRecordApi';
|
|
||||||
// import templateOne from './templateOne.html';
|
|
||||||
// import templateTwo from './templateTwo.html';
|
|
||||||
|
|
||||||
// import NAME_FIELD from '@salesforce/schema/Account.Name';
|
|
||||||
// import PHONE_FIELD from '@salesforce/schema/Account.Phone';
|
|
||||||
const FIELDS =[
|
|
||||||
'Account.Name',
|
|
||||||
'Account.Phone',
|
|
||||||
]
|
|
||||||
export default class BaiscLWCLearn extends LightningElement {
|
|
||||||
message = 'Api Example';
|
|
||||||
@api recordId;
|
|
||||||
@track ShowButton=false;
|
|
||||||
showInfo = false;
|
|
||||||
showInputFiledVal = false;
|
|
||||||
buttonLabel;
|
|
||||||
@wire(getRecord, {recordId: '$recordId',fields:FIELDS})
|
|
||||||
record; //it contain data and error
|
|
||||||
|
|
||||||
get name(){
|
|
||||||
return this.record.data.fields.Name.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
get phone(){
|
|
||||||
return this.record.data.fields.Phone.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
getName(event){
|
|
||||||
console.log('Name', event.target.value);
|
|
||||||
this.ShowButton=true;
|
|
||||||
}
|
|
||||||
|
|
||||||
connectedCallback(){
|
|
||||||
console.log('Connected Call Back is Called');
|
|
||||||
}
|
|
||||||
buttonClicked(event)
|
|
||||||
{
|
|
||||||
this.buttonLabel = event.currentTarget.dataset.id;
|
|
||||||
this.showInfo = true;
|
|
||||||
this.showInputFiledVal = true;
|
|
||||||
//this.template.querySelector('.input1').value = buttonLabel + ' is Clicked';
|
|
||||||
}
|
|
||||||
|
|
||||||
renderedCallback()
|
|
||||||
{
|
|
||||||
if(this.showInputFiledVal)
|
|
||||||
{
|
|
||||||
this.template.querySelector('.input1').value = this.buttonLabel + ' is Clicked';
|
|
||||||
this.showInputFiledVal = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
disconnectedCallback(){
|
|
||||||
console.log('Disconnected Call Back is Called');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
|
|
||||||
<apiVersion>57.0</apiVersion>
|
|
||||||
<isExposed>true</isExposed>
|
|
||||||
<targets>
|
|
||||||
<target>lightning__HomePage</target>
|
|
||||||
<target>lightning__RecordPage</target>
|
|
||||||
</targets>
|
|
||||||
|
|
||||||
</LightningComponentBundle>
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
<template>
|
|
||||||
<lightning-button label="Launch Flow" onclick={launchFlow}></lightning-button>
|
|
||||||
<lightning-button label="Hide Flow" onclick={hideFlow}></lightning-button>
|
|
||||||
<template if:true={isFlowVisible}>
|
|
||||||
<lightning-flow id="flowContainer"></lightning-flow>
|
|
||||||
</template>
|
|
||||||
</template>
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
||||||
import { LightningElement, track } from 'lwc';
|
|
||||||
|
|
||||||
export default class MyComponent extends LightningElement {
|
|
||||||
@track isFlowVisible = false;
|
|
||||||
|
|
||||||
launchFlow() {
|
|
||||||
this.isFlowVisible = true;
|
|
||||||
this.template.querySelector('lightning-flow').startFlow('ShowingText');
|
|
||||||
}
|
|
||||||
|
|
||||||
hideFlow() {
|
|
||||||
this.isFlowVisible = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
|
|
||||||
<apiVersion>58.0</apiVersion>
|
|
||||||
<isExposed>true</isExposed>
|
|
||||||
<targets>
|
|
||||||
<target>lightning__HomePage</target>
|
|
||||||
<target>lightning__AppPage</target>
|
|
||||||
</targets>
|
|
||||||
</LightningComponentBundle>
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
||||||
.chat-content {
|
|
||||||
position: relative;
|
|
||||||
font-weight: 400;
|
|
||||||
line-height: 1.3;
|
|
||||||
max-width: 70%;
|
|
||||||
padding: 10px;
|
|
||||||
font-size: 0.875em;
|
|
||||||
border-radius: 10px 10px 0;
|
|
||||||
float: right;
|
|
||||||
margin-left: 40px;
|
|
||||||
white-space: pre-wrap;
|
|
||||||
text-align: left;
|
|
||||||
}
|
|
||||||
|
|
||||||
.agent.chat-content {
|
|
||||||
color: #000;
|
|
||||||
background: #7e0c65;
|
|
||||||
border-radius: 10px 10px 10px 0;
|
|
||||||
float: left;
|
|
||||||
}
|
|
||||||
|
|
||||||
.chasitor.chat-content {
|
|
||||||
background: rgb(6, 223, 6);
|
|
||||||
color: rgb(0, 0, 0);
|
|
||||||
margin-left: auto;
|
|
||||||
}
|
|
||||||
|
|
@ -1,34 +0,0 @@
|
||||||
<template>
|
|
||||||
<div class={messageStyle}>
|
|
||||||
<template if:true={showImage}>
|
|
||||||
<lightning-card>
|
|
||||||
<b>{name}</b><br/>
|
|
||||||
<img
|
|
||||||
src={imageURL}
|
|
||||||
alt="User Image"
|
|
||||||
height="120px"
|
|
||||||
width="120px"/>
|
|
||||||
</lightning-card>
|
|
||||||
</template>
|
|
||||||
<template if:true={fileUpload}>
|
|
||||||
<lightning-file-upload
|
|
||||||
name="fileUploader"
|
|
||||||
label="Attach receipt"
|
|
||||||
onuploadfinished={handleUploadFinished}>
|
|
||||||
</lightning-file-upload>
|
|
||||||
</template>
|
|
||||||
<template if:true={showMap}>
|
|
||||||
<!-- Add a map component to display the location -->
|
|
||||||
<div class="slds-size_1-of-2">
|
|
||||||
<lightning-map
|
|
||||||
map-markers={mapMarkers}
|
|
||||||
markers-title="Current Location">
|
|
||||||
</lightning-map>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<template if:false={showImage}>
|
|
||||||
<lightning-formatted-rich-text value={messageContent.value}>
|
|
||||||
</lightning-formatted-rich-text>
|
|
||||||
</template>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
@ -1,83 +0,0 @@
|
||||||
import { track, api } from 'lwc';
|
|
||||||
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
|
|
||||||
import Botimage from '@salesforce/resourceUrl/Botimage';
|
|
||||||
import ChatMessage from 'lightningsnapin/baseChatMessage';
|
|
||||||
|
|
||||||
const CHAT_CONTENT_CLASS = 'chat-content';
|
|
||||||
const AGENT_USER_TYPE = 'agent';
|
|
||||||
const CHASITOR_USER_TYPE = 'chasitor';
|
|
||||||
const SUPPORTED_USER_TYPES = [AGENT_USER_TYPE, CHASITOR_USER_TYPE];
|
|
||||||
|
|
||||||
export default class calllwc extends ChatMessage {
|
|
||||||
@track messageStyle = '';
|
|
||||||
@track imageURL = Botimage;
|
|
||||||
@track name = 'Order Product Image';
|
|
||||||
@track showImage = false;
|
|
||||||
@track fileUpload = false; // Initialize to false
|
|
||||||
@track mapMarkers = []; // Initialize to empty array
|
|
||||||
@track showMap = false;
|
|
||||||
|
|
||||||
handleGeolocationSuccess(position) {
|
|
||||||
const { latitude, longitude } = position.coords;
|
|
||||||
this.mapMarkers = [{
|
|
||||||
location: {
|
|
||||||
Street: '',
|
|
||||||
City: '',
|
|
||||||
Country: '',
|
|
||||||
Latitude: latitude,
|
|
||||||
Longitude: longitude
|
|
||||||
},
|
|
||||||
title: 'You are here',
|
|
||||||
description: 'Your current location'
|
|
||||||
}];
|
|
||||||
}
|
|
||||||
|
|
||||||
handleClick(){
|
|
||||||
if(navigator.geolocation){
|
|
||||||
navigator.geolocation.getCurrentPosition(
|
|
||||||
this.handleGeolocationSuccess.bind(this),
|
|
||||||
error => console.error('Geolocation error:', error)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@api
|
|
||||||
handleUploadFinished(event) {
|
|
||||||
console.log('Upload finished');
|
|
||||||
// Get the list of uploaded files
|
|
||||||
const uploadedFiles = event.detail.files;
|
|
||||||
console.log('No. of files uploaded : ' + uploadedFiles.length);
|
|
||||||
console.log('file : ', event.detail.files);
|
|
||||||
|
|
||||||
// Show success message
|
|
||||||
const toastEvent = new ShowToastEvent({
|
|
||||||
title: 'Success!',
|
|
||||||
message: 'Upload completed successfully',
|
|
||||||
variant: 'success',
|
|
||||||
});
|
|
||||||
this.dispatchEvent(toastEvent);
|
|
||||||
}
|
|
||||||
|
|
||||||
isSupportedUserType(userType) {
|
|
||||||
return SUPPORTED_USER_TYPES.includes(userType);
|
|
||||||
}
|
|
||||||
|
|
||||||
connectedCallback() {
|
|
||||||
if (this.isSupportedUserType(this.userType)) {
|
|
||||||
this.messageStyle = `${CHAT_CONTENT_CLASS} ${this.userType}`;
|
|
||||||
} else {
|
|
||||||
throw new Error(`Unsupported user type: ${this.userType}`);
|
|
||||||
}
|
|
||||||
if (this.messageContent.value === 'Einstein Chatbot') {
|
|
||||||
this.showImage = true;
|
|
||||||
} else if (this.messageContent.value === 'File Upload') {
|
|
||||||
this.fileUpload = true;
|
|
||||||
} else if (this.messageContent.value === 'Current Location') {
|
|
||||||
this.handleClick(); // Call the handleClick method to get the current location
|
|
||||||
this.showMap = true;
|
|
||||||
console.log('Map ' ,this.showMap );
|
|
||||||
} else {
|
|
||||||
this.showImage = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
|
|
||||||
<apiVersion>59.0</apiVersion>
|
|
||||||
<isExposed>true</isExposed>
|
|
||||||
<masterLabel>calllwc</masterLabel>
|
|
||||||
<targets>
|
|
||||||
<target>lightningSnapin__ChatMessage</target>
|
|
||||||
<target>lightning__HomePage</target>
|
|
||||||
</targets>
|
|
||||||
</LightningComponentBundle>
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
<template>
|
|
||||||
<lightning-card title="child Lwc">
|
|
||||||
<p class="slds-text-align_center">Count Value={counter}</p>
|
|
||||||
</lightning-card>
|
|
||||||
</template>
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
import { LightningElement,api } from 'lwc';
|
|
||||||
|
|
||||||
export default class ChildExample extends LightningElement {
|
|
||||||
@api counter=0;
|
|
||||||
}
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
|
|
||||||
<apiVersion>57.0</apiVersion>
|
|
||||||
<isExposed>false</isExposed>
|
|
||||||
</LightningComponentBundle>
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
<template>
|
|
||||||
<lightning-card title="Child Componant ">
|
|
||||||
<p>Counter value:{counter}</p>
|
|
||||||
</lightning-card>
|
|
||||||
|
|
||||||
</template>
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
import { LightningElement,api } from 'lwc';
|
|
||||||
|
|
||||||
export default class ChildExp1 extends LightningElement {
|
|
||||||
@api counter=0;
|
|
||||||
}
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
|
|
||||||
<apiVersion>57.0</apiVersion>
|
|
||||||
<isExposed>false</isExposed>
|
|
||||||
</LightningComponentBundle>
|
|
||||||
|
|
@ -1,41 +0,0 @@
|
||||||
<template>
|
|
||||||
<lightning-card title="Child Lwc" icon-name="action:upload">
|
|
||||||
|
|
||||||
<!-- substract button -->
|
|
||||||
<lightning-button class="slds-p-horizontal_medium "
|
|
||||||
label="Substract"
|
|
||||||
icon-name="utility:dash"
|
|
||||||
onclick={handleSubstract}>
|
|
||||||
</lightning-button>
|
|
||||||
|
|
||||||
<!-- add button -->
|
|
||||||
<lightning-button class="slds-p-horizontal_medium "
|
|
||||||
label="Add"
|
|
||||||
icon-name="utility:add"
|
|
||||||
onclick={handleAdd}>
|
|
||||||
</lightning-button>
|
|
||||||
|
|
||||||
<!-- Do zero button -->
|
|
||||||
<lightning-button class="slds-p-horizontal_small "
|
|
||||||
label="0"
|
|
||||||
value="0"
|
|
||||||
onclick={handleMultiply}>
|
|
||||||
</lightning-button>
|
|
||||||
|
|
||||||
<!-- 2x button -->
|
|
||||||
<lightning-button class="slds-p-horizontal_small "
|
|
||||||
label="2"
|
|
||||||
value="2"
|
|
||||||
icon-name="utility:close"
|
|
||||||
onclick={handleMultiply}>
|
|
||||||
</lightning-button>
|
|
||||||
|
|
||||||
<!-- 3x button -->
|
|
||||||
<lightning-button
|
|
||||||
label="3"
|
|
||||||
value="3"
|
|
||||||
icon-name="utility:close"
|
|
||||||
onclick={handleMultiply}>
|
|
||||||
</lightning-button>
|
|
||||||
</lightning-card>
|
|
||||||
</template>
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
import { LightningElement } from 'lwc';
|
|
||||||
|
|
||||||
export default class ChlidExp extends LightningElement {
|
|
||||||
handleSubstract(){
|
|
||||||
this.dispatchEvent(new CustomEvent('substract'));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
handleAdd(){
|
|
||||||
this.dispatchEvent(new CustomEvent('add'));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
handleMultiply(event){
|
|
||||||
const valueformultiply=event.target.value;
|
|
||||||
|
|
||||||
this.dispatchEvent(new CustomEvent('multiply',{
|
|
||||||
detail:valueformultiply
|
|
||||||
}))
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
|
|
||||||
<apiVersion>57.0</apiVersion>
|
|
||||||
<isExposed>false</isExposed>
|
|
||||||
</LightningComponentBundle>
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
.shadow-box {
|
|
||||||
box-shadow: 0 0 2px #0176d3;
|
|
||||||
margin-bottom: 5px;
|
|
||||||
}
|
|
||||||
|
|
@ -1,33 +0,0 @@
|
||||||
<template>
|
|
||||||
<div class="slds-card">
|
|
||||||
<div class="slds-card__header slds-grid">
|
|
||||||
<header class="slds-media slds-media_center slds-has-flexi-truncate">
|
|
||||||
<div class="slds-media__body">
|
|
||||||
<h2 class="slds-card__header-title">
|
|
||||||
<a href="#" class="slds-card__header-link slds-truncate" title="Data From Website">
|
|
||||||
<span>Data From Website</span>
|
|
||||||
</a>
|
|
||||||
</h2>
|
|
||||||
</div>
|
|
||||||
<div class="slds-no-flex">
|
|
||||||
<button class="slds-button slds-button_neutral" onclick={getMessages}>View Data</button>
|
|
||||||
</div>
|
|
||||||
</header>
|
|
||||||
</div>
|
|
||||||
<div class="slds-card__body slds-card__body_inner ">
|
|
||||||
<template if:true={messages} for:each={messages} for:item="message">
|
|
||||||
<div key={message.messageId} class="shadow-box " >
|
|
||||||
<p>Full Name: {message.data.name}</p>
|
|
||||||
<p>Email: {message.data.email}</p>
|
|
||||||
<p>Phone: {message.data.phone}</p>
|
|
||||||
<p>Website: {message.data.website}</p>
|
|
||||||
<p>Message: {message.data.message}</p>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<template if:false={messages}>
|
|
||||||
<p>No Data Found</p>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
import { LightningElement, track } from 'lwc';
|
|
||||||
import pullMessages from '@salesforce/apex/GoogleCloudPubSubService.pullMessages';
|
|
||||||
export default class Cloud_Pub_Sub extends LightningElement {
|
|
||||||
@track messages = [];
|
|
||||||
|
|
||||||
getMessages() {
|
|
||||||
console.log('onclick');
|
|
||||||
try {
|
|
||||||
pullMessages()
|
|
||||||
.then(result => {
|
|
||||||
this.messages = result;
|
|
||||||
console.log('got message', this.messages);
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
console.error('Error in pullMessages: ', error);
|
|
||||||
});
|
|
||||||
|
|
||||||
} catch (e) {
|
|
||||||
console.error('Error in getMessages: ', e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
|
|
||||||
<apiVersion>59.0</apiVersion>
|
|
||||||
<isExposed>true</isExposed>
|
|
||||||
<targets>
|
|
||||||
<target>lightning__HomePage</target>
|
|
||||||
<target>lightning__RecordPage</target>
|
|
||||||
<target>lightningCommunity__Page</target>
|
|
||||||
<target>lightningCommunity__Default</target>
|
|
||||||
</targets>
|
|
||||||
</LightningComponentBundle>
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
||||||
<template>
|
|
||||||
<lightning-card title="Conditional Rendering">
|
|
||||||
<div class="slds-m-arround_medium">
|
|
||||||
<lightning-button
|
|
||||||
variant="brand"
|
|
||||||
label="Show Data"
|
|
||||||
title="Show Data"
|
|
||||||
onclick={handleClick}
|
|
||||||
class="slds-m-left_x-small">
|
|
||||||
</lightning-button>
|
|
||||||
<template if:true={isVisible}>
|
|
||||||
<p>Data is visible</p>
|
|
||||||
</template>
|
|
||||||
<template if:false={isVisible}>
|
|
||||||
<p>Data is not visible</p>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<lightning-input type="text" label="Type hello to see data" onkeyup={handleInputChange}></lightning-input>
|
|
||||||
<template if:true={helloName}>
|
|
||||||
<h2>you types right </h2>
|
|
||||||
</template>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</lightning-card>
|
|
||||||
</template>
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
import { LightningElement } from 'lwc';
|
|
||||||
|
|
||||||
export default class ConditionalRenderingComponent extends LightningElement {
|
|
||||||
isVisible = false;
|
|
||||||
name
|
|
||||||
handleClick() {
|
|
||||||
this.isVisible = true;
|
|
||||||
}
|
|
||||||
handleInputChange(event){
|
|
||||||
this.name = event.target.value;
|
|
||||||
}
|
|
||||||
get helloName(){
|
|
||||||
return this.name === 'hello'
|
|
||||||
}
|
|
||||||
|
|
||||||
//falsy Values
|
|
||||||
// 0,false,'',null,undefined
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
|
|
||||||
<apiVersion>59.0</apiVersion>
|
|
||||||
<isExposed>true</isExposed>
|
|
||||||
<targets>
|
|
||||||
<target>lightning__AppPage</target>
|
|
||||||
<target>lightning__HomePage</target>
|
|
||||||
</targets>
|
|
||||||
</LightningComponentBundle>
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
<template>
|
|
||||||
<lightning-card>
|
|
||||||
<template lwc:if={ready}>
|
|
||||||
<div id="display">
|
|
||||||
<div>Name: {name}</div>
|
|
||||||
<div>Description: {description}</div>
|
|
||||||
<div>Category: {category}</div>
|
|
||||||
<div>Material: {material}</div>
|
|
||||||
<div>Price: {price}</div>
|
|
||||||
<div><img src={pictureUrl}/></div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<template lwc:else>
|
|
||||||
<div id="waiting">Loading…Please wait {time} seconds</div>
|
|
||||||
</template>
|
|
||||||
</lightning-card>
|
|
||||||
</template>
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
import { LightningElement } from 'lwc';
|
|
||||||
export default class App extends LightningElement {
|
|
||||||
name = 'Electra X4';
|
|
||||||
description = 'A sweet bike built for comfort.';
|
|
||||||
category = 'Mountain';
|
|
||||||
material = 'Steel';
|
|
||||||
price = '$2,700';
|
|
||||||
time=10000;
|
|
||||||
pictureUrl = 'https://s3-us-west-1.amazonaws.com/sfdc-demo/ebikes/electrax4.jpg';
|
|
||||||
ready = false;
|
|
||||||
connectedCallback() {
|
|
||||||
setTimeout(() => {
|
|
||||||
this.ready = true;
|
|
||||||
}, this.time);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
|
|
||||||
<apiVersion>58.0</apiVersion>
|
|
||||||
<isExposed>true</isExposed>
|
|
||||||
<targets>
|
|
||||||
<target>lightning__HomePage</target>
|
|
||||||
</targets>
|
|
||||||
</LightningComponentBundle>
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
.custom-background {
|
|
||||||
background-color: rgb(251, 238, 193);
|
|
||||||
}
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
<template>
|
|
||||||
<article class="slds-card custom-background custom-text">
|
|
||||||
<div class="slds-card__header slds-grid">
|
|
||||||
<header class="slds-media slds-media_center slds-has-flexi-truncate">
|
|
||||||
<div class="slds-media__body">
|
|
||||||
<h2 class="slds-card__header-title">
|
|
||||||
<span class="slds-text-heading_small">Connect with me!</span>
|
|
||||||
</h2>
|
|
||||||
</div>
|
|
||||||
</header>
|
|
||||||
</div>
|
|
||||||
<div class="slds-card__body slds-card__body_inner">
|
|
||||||
<lightning-input name="fname" label="First Name" value={contact.fname} onchange={handleChange} required></lightning-input>
|
|
||||||
<lightning-input name="lname" label="Last Name" value={contact.lname} onchange={handleChange} required></lightning-input>
|
|
||||||
<lightning-input name="email" type="email" label="Email Address" value={contact.email} onchange={handleChange} required></lightning-input>
|
|
||||||
<div style="display: flex; justify-content: center; margin: 20px;">
|
|
||||||
<lightning-button label="Submit" variant="Brand" onclick={handleSave}></lightning-button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</article>
|
|
||||||
</template>
|
|
||||||
|
|
@ -1,51 +0,0 @@
|
||||||
import { LightningElement, track } from 'lwc';
|
|
||||||
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
|
|
||||||
import createContact from '@salesforce/apex/ContactCreator.createContact';
|
|
||||||
|
|
||||||
export default class CreateContact extends LightningElement {
|
|
||||||
@track contact = {
|
|
||||||
fname: '',
|
|
||||||
lname: '',
|
|
||||||
email: ''
|
|
||||||
};
|
|
||||||
|
|
||||||
handleChange(event) {
|
|
||||||
const field = event.target.name;
|
|
||||||
this.contact[field] = event.target.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
handleSave() {
|
|
||||||
const { fname, lname, email } = this.contact;
|
|
||||||
console.log('debug',this.contact);
|
|
||||||
if(!fname || !lname || !email) {
|
|
||||||
this.showToast('Error', 'First Name, Last Name and Email cannot be empty', 'error');
|
|
||||||
} else {
|
|
||||||
createContact({ fname, lname, email })
|
|
||||||
.then(result => {
|
|
||||||
this.resetContact();
|
|
||||||
this.showToast('Success', 'Contact created', 'success');
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
this.showToast('Error creating record', 'A contact with this email already exists', 'error');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
showToast(title, message, variant) {
|
|
||||||
this.dispatchEvent(
|
|
||||||
new ShowToastEvent({
|
|
||||||
title,
|
|
||||||
message,
|
|
||||||
variant
|
|
||||||
})
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
resetContact() {
|
|
||||||
this.contact = {
|
|
||||||
fname: '',
|
|
||||||
lname: '',
|
|
||||||
email: ''
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
|
|
||||||
<apiVersion>59.0</apiVersion>
|
|
||||||
<isExposed>true</isExposed>
|
|
||||||
<targets>
|
|
||||||
<target>lightning__HomePage</target>
|
|
||||||
<target>lightningCommunity__Page</target>
|
|
||||||
<target>lightningCommunity__Default</target>
|
|
||||||
</targets>
|
|
||||||
</LightningComponentBundle>
|
|
||||||
|
|
@ -1,77 +0,0 @@
|
||||||
/* myComponent.css */
|
|
||||||
.image-container {
|
|
||||||
position: relative;
|
|
||||||
display: inline-block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.image {
|
|
||||||
height: 100px;
|
|
||||||
width: 100px;
|
|
||||||
border-radius:100px;
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
.card-image{
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
.overlay-icon-1{
|
|
||||||
position: absolute;
|
|
||||||
top: -4px;
|
|
||||||
right: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.overlay-icon {
|
|
||||||
position: absolute;
|
|
||||||
bottom: 2px;
|
|
||||||
right: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dropdown-content {
|
|
||||||
display: none;
|
|
||||||
position: absolute;
|
|
||||||
background-color: #f9f9f9;
|
|
||||||
min-width: 160px;
|
|
||||||
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.dropdown-content p {
|
|
||||||
padding: 3px 4px;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dropdown-content p:hover {
|
|
||||||
background-color: #ddd; /* Change the background color of each item when hovering over it */
|
|
||||||
}
|
|
||||||
|
|
||||||
.overlay-icon:hover .dropdown-content {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
.removeImage {
|
|
||||||
border-radius: 50%;
|
|
||||||
padding: 0px 4px;
|
|
||||||
margin: 8px 2px 8px 8px;
|
|
||||||
color: #fff;
|
|
||||||
background-color: #9f201b;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
/* for preview */
|
|
||||||
.image-preview-container {
|
|
||||||
width: 50%;
|
|
||||||
margin: 0 auto;
|
|
||||||
border: 1px solid rgba(0, 0, 0, 0.1);
|
|
||||||
padding: 3rem;
|
|
||||||
border-radius: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.image-preview-container img {
|
|
||||||
width: 100%;
|
|
||||||
display: none;
|
|
||||||
margin-bottom: 30px;
|
|
||||||
}
|
|
||||||
.custom-close-button {
|
|
||||||
--sds-c-icon-size-m: 2rem; /* Adjust the size */
|
|
||||||
font-weight: bold; /* Make it bold */
|
|
||||||
}
|
|
||||||
|
|
@ -1,259 +0,0 @@
|
||||||
<template>
|
|
||||||
|
|
||||||
<!-- The lightning-card component is a container for a single item in a list or related group of items -->
|
|
||||||
|
|
||||||
<lightning-card title="File Upload LWC" icon-name="custom:custom14">
|
|
||||||
|
|
||||||
|
|
||||||
<!-- The custom profile photo shower -->
|
|
||||||
|
|
||||||
<lightning-card>
|
|
||||||
|
|
||||||
<div class="image-container">
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Spinner -->
|
|
||||||
<template if:true={spinner}>
|
|
||||||
<div class="slds-spinner_container">
|
|
||||||
<div role="status" class="slds-spinner slds-spinner_medium">
|
|
||||||
<span class="slds-assistive-text">Loading</span>
|
|
||||||
<div class="slds-spinner__dot-a"></div>
|
|
||||||
<div class="slds-spinner__dot-b"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
|
|
||||||
<template if:true={imageUrl}>
|
|
||||||
|
|
||||||
<img class="image" src={imageUrl} />
|
|
||||||
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template if:false={imageUrl}>
|
|
||||||
|
|
||||||
<img class="image" src="https://www.lightningdesignsystem.com/assets/images/avatar2.jpg" alt="No" />
|
|
||||||
|
|
||||||
</template>
|
|
||||||
<div class="overlay-icon-1" >
|
|
||||||
<template if:true={imageUrl}>
|
|
||||||
<lightning-icon icon-name="utility:delete"
|
|
||||||
alternative-text="Description of icon when needed"
|
|
||||||
size="xx-small" style="cursor: pointer;"
|
|
||||||
onclick={deletePhoto}></lightning-icon>
|
|
||||||
|
|
||||||
|
|
||||||
</template>
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="overlay-icon" >
|
|
||||||
|
|
||||||
<lightning-icon icon-name="utility:photo"
|
|
||||||
alternative-text="Description of icon when needed"
|
|
||||||
size="x-small" style="cursor: pointer;">
|
|
||||||
</lightning-icon>
|
|
||||||
|
|
||||||
<!-- Drop down List -->
|
|
||||||
<div class="dropdown-content" style="z-index: 1;">
|
|
||||||
|
|
||||||
<p onclick={uploadPhoto}>Upload Photo</p>
|
|
||||||
|
|
||||||
<p onclick={showPhoto}>Show Photo</p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<p>Profile Photo
|
|
||||||
|
|
||||||
|
|
||||||
</p>
|
|
||||||
|
|
||||||
</lightning-card>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Upload Photo Promt starts-->
|
|
||||||
|
|
||||||
|
|
||||||
<!-- This template tag with if:true directive renders the contained markup if the uploadPhotoPrompt property is truthy -->
|
|
||||||
|
|
||||||
<template if:true={uploadPhotoPrompt}>
|
|
||||||
|
|
||||||
<section role="dialog" tabindex="-1" aria-modal="true" aria-labelledby="modal-heading-01" class="slds-modal slds-fade-in-open">
|
|
||||||
|
|
||||||
<div class="slds-modal__container">
|
|
||||||
|
|
||||||
<!-- close icon button -->
|
|
||||||
<lightning-button-icon
|
|
||||||
icon-name="utility:close"
|
|
||||||
variant="bare"
|
|
||||||
alternative-text="Delete"
|
|
||||||
class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse"
|
|
||||||
title="Delete"
|
|
||||||
onclick={hidePrompt}>
|
|
||||||
</lightning-button-icon>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="slds-modal__header">
|
|
||||||
|
|
||||||
<!-- The h1 tag defines the title of the modal dialog -->
|
|
||||||
|
|
||||||
<h1 id="modal-heading-01" class="slds-modal__title slds-hyphenate">Upload Photo</h1>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="slds-modal__content slds-p-around_medium" id="modal-content-id-1">
|
|
||||||
|
|
||||||
<div class="slds-modal__content slds-p-around_medium" id="prompt-message-wrapper">
|
|
||||||
|
|
||||||
<div class="slds-m-around_medium">
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- The lightning-input component represents an input element of type file for uploading photos -->
|
|
||||||
|
|
||||||
<lightning-input type="file" accept=".JPEG,.JPG" label="Photo/File" onchange={UploadFilechange}></lightning-input>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- This template tag with if:true directive renders the contained markup if the fileData property is truthy -->
|
|
||||||
|
|
||||||
<template if:true={fileData}>
|
|
||||||
|
|
||||||
<!-- This p tag displays the filename of the uploaded file -->
|
|
||||||
|
|
||||||
{fileData.filename}
|
|
||||||
|
|
||||||
<span onclick={removeReceiptImage} class="removeImage">X</span>
|
|
||||||
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<!-- <div class="image-preview-container" >
|
|
||||||
<div class="preview">
|
|
||||||
<img id="preview-selected-image"/>
|
|
||||||
<a href={fileUrl} target="_blank">{fileName}</a>
|
|
||||||
</div>
|
|
||||||
</div> -->
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- The div with class slds-modal__footer contains the footer of the modal dialog, including the Cancel and Submit buttons -->
|
|
||||||
|
|
||||||
<div class="slds-modal__footer">
|
|
||||||
|
|
||||||
<!-- These buttons are used to cancel and submit the form, respectively -->
|
|
||||||
|
|
||||||
<button class="slds-button slds-button_neutral" onclick={hidePrompt}>Cancel</button>
|
|
||||||
|
|
||||||
<button class="slds-button slds-button_neutral" onclick={handleClick}>Submit</button>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</section>
|
|
||||||
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<!-- Upload Photo Promt ends-->
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Show Photo Promt starts-->
|
|
||||||
|
|
||||||
<!-- This template tag with if:true directive renders the contained markup if the showPhotoPrompt property is truthy -->
|
|
||||||
|
|
||||||
<template if:true={showPhotoPrompt}>
|
|
||||||
|
|
||||||
<section role="dialog" tabindex="-1" aria-modal="true" aria-labelledby="modal-heading-01" class="slds-modal slds-fade-in-open">
|
|
||||||
|
|
||||||
<div class="slds-modal__container">
|
|
||||||
|
|
||||||
<!-- close icon button -->
|
|
||||||
|
|
||||||
<lightning-button-icon icon-name="utility:close"
|
|
||||||
variant="bare" alternative-text="Delete"
|
|
||||||
class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse"
|
|
||||||
title="Delete" onclick={hidePrompt} >
|
|
||||||
</lightning-button-icon>
|
|
||||||
|
|
||||||
<div class="slds-modal__header">
|
|
||||||
|
|
||||||
<!-- The h1 tag defines the title of the modal dialog -->
|
|
||||||
|
|
||||||
<h1 class="slds-modal__title slds-hyphenate">View Photo</h1>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="slds-modal__content slds-p-around_medium">
|
|
||||||
|
|
||||||
<div class="slds-modal__content slds-p-around_medium">
|
|
||||||
<div class="card-image">
|
|
||||||
<img src={imageUrl} alt="view Image" >
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</section>
|
|
||||||
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<!-- show Photo Promt ends-->
|
|
||||||
|
|
||||||
<!-- delete Photo Promt Starts-->
|
|
||||||
|
|
||||||
<!-- This template tag with if:true directive renders the contained markup if the showPhotoPrompt property is truthy -->
|
|
||||||
|
|
||||||
<template if:true={deletePhotoPrompt}>
|
|
||||||
|
|
||||||
<section role="dialog" tabindex="-1" aria-modal="true" aria-labelledby="modal-heading-01" class="slds-modal slds-fade-in-open">
|
|
||||||
|
|
||||||
<div class="slds-modal__container">
|
|
||||||
|
|
||||||
<!-- close icon button -->
|
|
||||||
|
|
||||||
<lightning-button-icon
|
|
||||||
icon-name="utility:close"
|
|
||||||
variant="bare"
|
|
||||||
alternative-text="Close"
|
|
||||||
class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse"
|
|
||||||
title="Close"
|
|
||||||
onclick={hidePrompt}>
|
|
||||||
</lightning-button-icon>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="slds-modal__header">
|
|
||||||
|
|
||||||
<!-- The h1 tag defines the title of the modal dialog -->
|
|
||||||
|
|
||||||
<h1 class="slds-modal__title slds-hyphenate">Delete Photo</h1>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="slds-modal__content slds-p-around_medium">
|
|
||||||
<p style="text-align: center;">Are You Sure? Do You Want Delete This Record?</p>
|
|
||||||
<div style="display: flex; justify-content: center; margin-top: 20px;">
|
|
||||||
<button class="slds-button slds-button_neutral" onclick={hidePrompt}>Cancel</button>
|
|
||||||
<button class="slds-button slds-button_neutral" onclick={handleDelete}>Delete</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</section>
|
|
||||||
|
|
||||||
</template>
|
|
||||||
|
|
||||||
|
|
||||||
</lightning-card>
|
|
||||||
|
|
||||||
</template>
|
|
||||||
|
|
@ -1,161 +0,0 @@
|
||||||
import { LightningElement,api,track,wire} from 'lwc';
|
|
||||||
import uploadFile from '@salesforce/apex/FileUploadService.uploadFile';
|
|
||||||
import deletefile from '@salesforce/apex/FileUploadService.deletefile';
|
|
||||||
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
|
|
||||||
import { refreshApex } from '@salesforce/apex';
|
|
||||||
import { getRecord, getFieldValue } from 'lightning/uiRecordApi';
|
|
||||||
|
|
||||||
// Import the reference to the fields that you wish to display
|
|
||||||
import ProfileUrl__c_FIELD from '@salesforce/schema/Friend__c.ProfileUrl__c';
|
|
||||||
|
|
||||||
export default class CreateCustomPhotoUploader extends LightningElement {
|
|
||||||
|
|
||||||
fields = [ProfileUrl__c_FIELD];
|
|
||||||
uploadPhotoPrompt = false;
|
|
||||||
showPhotoPrompt=false;
|
|
||||||
deletePhotoPrompt=false;
|
|
||||||
Contentv;
|
|
||||||
@api recordId;
|
|
||||||
fileData;
|
|
||||||
imageUrl;
|
|
||||||
spinner=false;
|
|
||||||
isphoto=false;
|
|
||||||
|
|
||||||
@wire(getRecord, { recordId: '$recordId', fields: [ProfileUrl__c_FIELD] })
|
|
||||||
wiredRecord({ error, data }) {
|
|
||||||
if (data) {
|
|
||||||
this.imageUrl = getFieldValue(data, ProfileUrl__c_FIELD);
|
|
||||||
} else if (error) {
|
|
||||||
console.error('Error getting record', error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
renderedCallback() {
|
|
||||||
console.log('Img url:',this.imageUrl);
|
|
||||||
if(this.imageUrl!=null){
|
|
||||||
let url = new URL(this.imageUrl);
|
|
||||||
let params = new URLSearchParams(url.search);
|
|
||||||
this.Contentv= params.get('versionId');
|
|
||||||
console.log('@@@ Content iddddd',this.Contentv);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
UploadFilechange(event) {
|
|
||||||
const file = event.target.files[0];
|
|
||||||
const fileType = file.type;
|
|
||||||
const acceptedFormats = ['image/png', 'image/jpeg'];
|
|
||||||
if (!acceptedFormats.includes(fileType)) {
|
|
||||||
// Show an error message and return
|
|
||||||
this.dispatchEvent(
|
|
||||||
new ShowToastEvent({
|
|
||||||
title: 'Error',
|
|
||||||
message: 'Invalid file type. Please upload a .png or .jpeg file.',
|
|
||||||
variant: 'error',
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
|
|
||||||
}
|
|
||||||
var reader = new FileReader();
|
|
||||||
reader.onload = () => {
|
|
||||||
var base64 = reader.result.split(',')[1];
|
|
||||||
this.fileData = {
|
|
||||||
'filename': file.name,
|
|
||||||
'base64': base64,
|
|
||||||
'recordId': this.recordId
|
|
||||||
}
|
|
||||||
console.log(this.fileData);
|
|
||||||
}
|
|
||||||
reader.readAsDataURL(file);
|
|
||||||
}
|
|
||||||
|
|
||||||
handleClick(){
|
|
||||||
if(this.fileData==null){
|
|
||||||
console.log('inside click if');
|
|
||||||
this.dispatchEvent(
|
|
||||||
new ShowToastEvent({
|
|
||||||
title: 'Error',
|
|
||||||
message: 'Please Choose Photo!',
|
|
||||||
variant: 'error',
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
}else if(this.fileData != null){
|
|
||||||
this.spinner = true;
|
|
||||||
console.log('inside else');
|
|
||||||
const {base64, filename, recordId} = this.fileData;
|
|
||||||
uploadFile({ base64, filename, recordId })
|
|
||||||
.then(result=>{
|
|
||||||
if(result){
|
|
||||||
this.imageUrl = result;
|
|
||||||
// window.localStorage.setItem('imageUrl', this.imageUrl)
|
|
||||||
this.isphoto=true;
|
|
||||||
this.dispatchEvent(
|
|
||||||
new ShowToastEvent({
|
|
||||||
title:`${filename} uploaded successfully!!`,
|
|
||||||
variant: 'success',
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
console.log('image url:',this.imageUrl);
|
|
||||||
let url = new URL(this.imageUrl);
|
|
||||||
let params = new URLSearchParams(url.search);
|
|
||||||
this.Contentv= params.get('versionId');
|
|
||||||
console.log('@@@ Content iddddd',this.Contentv);
|
|
||||||
// Hide the spinner after 2.5 seconds
|
|
||||||
setTimeout(() => {
|
|
||||||
this.spinner = false;
|
|
||||||
}, 2500);
|
|
||||||
this.fileData = null
|
|
||||||
this.hidePrompt();
|
|
||||||
}else if(error){
|
|
||||||
console.log(error);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
removeReceiptImage(){
|
|
||||||
this.fileData=null;
|
|
||||||
}
|
|
||||||
|
|
||||||
showPrompt() {
|
|
||||||
this.uploadPhotoPrompt = true;
|
|
||||||
}
|
|
||||||
hidePrompt() {
|
|
||||||
this.uploadPhotoPrompt = false;
|
|
||||||
this.showPhotoPrompt= false;
|
|
||||||
this.fileData=null;
|
|
||||||
this.deletePhotoPrompt=false;
|
|
||||||
|
|
||||||
}
|
|
||||||
showPhoto() {
|
|
||||||
this.showPhotoPrompt=true;
|
|
||||||
|
|
||||||
}
|
|
||||||
uploadPhoto() {
|
|
||||||
|
|
||||||
this.uploadPhotoPrompt=true;
|
|
||||||
}
|
|
||||||
deletePhoto(){
|
|
||||||
this.deletePhotoPrompt=true;
|
|
||||||
}
|
|
||||||
|
|
||||||
handleDelete(){
|
|
||||||
deletefile({Contentv: this.Contentv,recordid:this.recordId})
|
|
||||||
.then(result=>{
|
|
||||||
if(result){
|
|
||||||
this.dispatchEvent(
|
|
||||||
new ShowToastEvent({
|
|
||||||
title:result,
|
|
||||||
variant: 'success',
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
setTimeout(() => {
|
|
||||||
this.spinner = false;
|
|
||||||
}, 2500);
|
|
||||||
this.isphoto=false;
|
|
||||||
this.hidePrompt();
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
|
|
||||||
<apiVersion>58.0</apiVersion>
|
|
||||||
<isExposed>true</isExposed>
|
|
||||||
<targets>
|
|
||||||
<target>lightning__RecordPage</target>
|
|
||||||
</targets>
|
|
||||||
</LightningComponentBundle>
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
<template>
|
|
||||||
<lightning-card title="Creating Record Without Apex"> <!-- A Lightning Card component with a title -->
|
|
||||||
<div class="slds-m-around_medium"> <!-- A div with medium padding around it -->
|
|
||||||
<lightning-input label="Id" disabled value={accountId}></lightning-input> <!-- A disabled input field for displaying the Id of the created Account record -->
|
|
||||||
<lightning-input label="Name" onchange={handleNameChange}></lightning-input> <!-- An input field for entering the name of the Account. The handleNameChange function is called when the value of this field changes -->
|
|
||||||
<lightning-button label="Create Button" variant="Brand" onclick={handleCreateAccount}></lightning-button> <!-- A button for creating the Account record. The handleCreateAccount function is called when this button is clicked -->
|
|
||||||
</div>
|
|
||||||
</lightning-card>
|
|
||||||
</template>
|
|
||||||
|
|
@ -1,56 +0,0 @@
|
||||||
import { LightningElement } from 'lwc'; // Importing necessary modules from LWC
|
|
||||||
import { createRecord } from 'lightning/uiRecordApi'; // Importing createRecord from uiRecordApi to create a new record
|
|
||||||
import ACCOUNT_OBJECT from '@salesforce/schema/Account'; // Importing Account object from Salesforce schema
|
|
||||||
import { ShowToastEvent } from 'lightning/platformShowToastEvent'; // Importing ShowToastEvent to display toast messages
|
|
||||||
import NAME_FIELD from '@salesforce/schema/Account.Name'; // Importing Name field from Account object in Salesforce schema
|
|
||||||
import matchNameMethod from '@salesforce/apex/MatchName.matchNameMethod'; // Importing Apex method to check for matching account names
|
|
||||||
|
|
||||||
export default class CreateRecordWithoutApex extends LightningElement {
|
|
||||||
Name = ''; // Variable to hold the name value entered in the LWC
|
|
||||||
|
|
||||||
// Function to handle the change in name input field value
|
|
||||||
handleNameChange(event) {
|
|
||||||
this.Name = event.target.value; // Updating the Name variable with the entered value
|
|
||||||
}
|
|
||||||
|
|
||||||
// Function to handle account creation
|
|
||||||
async handleCreateAccount() {
|
|
||||||
const fields = {};
|
|
||||||
fields[NAME_FIELD.fieldApiName] = this.Name; // Setting the Name field with the entered value
|
|
||||||
const recordInput = { apiName: ACCOUNT_OBJECT.objectApiName, fields }; // Preparing the record input for account creation
|
|
||||||
|
|
||||||
try {
|
|
||||||
const matchName = await matchNameMethod({ acName: this.Name }); // Checking if a matching account name exists
|
|
||||||
if (!matchName) { // If no matching account name exists, create a new account record
|
|
||||||
const account = await createRecord(recordInput);
|
|
||||||
this.showSuccessToast(); // Show success toast message after account creation
|
|
||||||
window.location.reload(); // Reload the window to reflect the changes
|
|
||||||
} else {
|
|
||||||
this.failToast(); // If a matching account name exists, show failure toast message
|
|
||||||
window.location.reload(); // Reload the window to reflect the changes
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error); // Log any errors encountered during the process
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
showSuccessToast() { // Function to display success toast message
|
|
||||||
const event = new ShowToastEvent({
|
|
||||||
label: 'Record Created',
|
|
||||||
message: 'Congratulations!!! You have Created Record',
|
|
||||||
variant: 'success',
|
|
||||||
mode: 'dismissable',
|
|
||||||
});
|
|
||||||
this.dispatchEvent(event); // Dispatching the toast event
|
|
||||||
}
|
|
||||||
|
|
||||||
failToast() { // Function to display failure toast message
|
|
||||||
const event = new ShowToastEvent({
|
|
||||||
label: 'Record Creation failed',
|
|
||||||
message: 'Failed!! Duplicate Name Found!!! Try With Different Name',
|
|
||||||
variant: 'error',
|
|
||||||
mode: 'dismissable',
|
|
||||||
});
|
|
||||||
this.dispatchEvent(event); // Dispatching the toast event
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
|
|
||||||
<apiVersion>58.0</apiVersion>
|
|
||||||
<isExposed>true</isExposed>
|
|
||||||
<targets>
|
|
||||||
<target>lightning__HomePage</target>
|
|
||||||
</targets>
|
|
||||||
</LightningComponentBundle>
|
|
||||||
|
|
@ -1,36 +0,0 @@
|
||||||
<template>
|
|
||||||
<lightning-card title="File Upload Demo LWC" icon-name="custom:custom14">
|
|
||||||
<div class="slds-m-around_medium">
|
|
||||||
<lightning-input type="file"
|
|
||||||
accept=".png,.JPEG,.JPG"
|
|
||||||
label="Attachment" onchange={UploadFilechange}></lightning-input>
|
|
||||||
</div>
|
|
||||||
<template if:true={fileData}>
|
|
||||||
<p>{fileData.filename}</p>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<lightning-button variant="brand" label="submit" title="Submit" onclick={handleClick} class="slds-m-left_x-small"></lightning-button>
|
|
||||||
|
|
||||||
</lightning-card>
|
|
||||||
<lightning-card>
|
|
||||||
<!-- <c-common-notification></c-common-notification> -->
|
|
||||||
<lightning-button variant="brand" label="Custom toast" title="Custom Toast" onclick={notify}></lightning-button>
|
|
||||||
|
|
||||||
</lightning-card>
|
|
||||||
<template if:true={showToastBar}>
|
|
||||||
<div class="slds-notify_container">
|
|
||||||
<div class={outerClass} role="status">
|
|
||||||
<span class="slds-assistive-text">{header}</span>
|
|
||||||
<span class={innerClass} title={message}>
|
|
||||||
<lightning-icon icon-name={getIconName} alternative-text="icon" styleclass="slds-icon slds-icon_small" variant="inverse" size="small"></lightning-icon>
|
|
||||||
</span>
|
|
||||||
<div class="slds-notify__content">
|
|
||||||
<h2 class="slds-text-heading_small">{message}</h2>
|
|
||||||
</div>
|
|
||||||
<div class="slds-notify__close">
|
|
||||||
<lightning-button-icon icon-name="utility:close" size="small" variant="border-filled" class="slds-button slds-button_icon slds-button_icon-inverse" alternative-text="next" onclick={closeModel} ></lightning-button-icon>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</template>
|
|
||||||
|
|
@ -1,166 +0,0 @@
|
||||||
import { LightningElement, api,track } from 'lwc';
|
|
||||||
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
|
|
||||||
import LightningPrompt from 'lightning/prompt';
|
|
||||||
import uploadFile from '@salesforce/apex/FileUploadService.uploadFile'
|
|
||||||
import { FlowAttributeChangeEvent, FlowNavigationNextEvent } from 'lightning/flowSupport';
|
|
||||||
export default class creatingCustomPhotoUploader extends LightningElement {
|
|
||||||
@api recordId;
|
|
||||||
fileData
|
|
||||||
UploadFilechange(event) {
|
|
||||||
const file = event.target.files[0];
|
|
||||||
const fileType = file.type;
|
|
||||||
const acceptedFormats = ['image/png', 'image/jpeg'];
|
|
||||||
|
|
||||||
if (!acceptedFormats.includes(fileType)) {
|
|
||||||
// Show an error message and return
|
|
||||||
this.dispatchEvent(
|
|
||||||
new ShowToastEvent({
|
|
||||||
title: 'Error',
|
|
||||||
message: 'Invalid file type. Please upload a .png or .jpeg file.',
|
|
||||||
variant: 'error',
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var reader = new FileReader();
|
|
||||||
reader.onload = () => {
|
|
||||||
var base64 = reader.result.split(',')[1];
|
|
||||||
this.fileData = {
|
|
||||||
'filename': file.name,
|
|
||||||
'base64': base64,
|
|
||||||
'recordId': this.recordId
|
|
||||||
}
|
|
||||||
console.log(this.fileData);
|
|
||||||
}
|
|
||||||
reader.readAsDataURL(file);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
handleClick(){
|
|
||||||
const {base64, filename, recordId} = this.fileData
|
|
||||||
uploadFile({ base64, filename, recordId }).then(result=>{
|
|
||||||
this.fileData = null
|
|
||||||
let title = `${filename} uploaded successfully!!`
|
|
||||||
this.toast(title)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
toast(title){
|
|
||||||
const toastEvent = new ShowToastEvent({
|
|
||||||
title,
|
|
||||||
variant:"success"
|
|
||||||
})
|
|
||||||
this.dispatchEvent(toastEvent)
|
|
||||||
}
|
|
||||||
notify()
|
|
||||||
{
|
|
||||||
//Ask question using Prompt
|
|
||||||
this.template.querySelector('c-common-notification').notify('prompt', 'What is your Email?','header','Notification','info');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@api notificationType;
|
|
||||||
@api message;
|
|
||||||
@api variant;
|
|
||||||
@api header;
|
|
||||||
@api colorTheme;
|
|
||||||
@api value;
|
|
||||||
@api isCallerFlow=false;
|
|
||||||
@api autoCloseTime = 5000;
|
|
||||||
@track showToastBar=false;
|
|
||||||
connectedCallback()
|
|
||||||
{
|
|
||||||
//If Flow then show modal when screen is shown
|
|
||||||
if(this.isCallerFlow==true)
|
|
||||||
{
|
|
||||||
this.showNotification();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
showNotification()
|
|
||||||
{
|
|
||||||
if(this.notificationType=='Confirm')
|
|
||||||
{
|
|
||||||
this.handleConfirm();
|
|
||||||
}
|
|
||||||
else if(this.notificationType=='Prompt')
|
|
||||||
{
|
|
||||||
this.handlePrompt();
|
|
||||||
}
|
|
||||||
else if(this.notificationType=='Alert')
|
|
||||||
{
|
|
||||||
this.handleAlert();
|
|
||||||
}
|
|
||||||
else if(this.notificationType=='Toast')
|
|
||||||
{
|
|
||||||
this.handleToast();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@api
|
|
||||||
notify(type, message,variant,header,theme) {
|
|
||||||
this.notificationType = type;
|
|
||||||
this.message = message;
|
|
||||||
this.variant=variant;
|
|
||||||
this.header=header;
|
|
||||||
this.colorTheme = theme;
|
|
||||||
this.showNotification();
|
|
||||||
}
|
|
||||||
|
|
||||||
handlePrompt(){
|
|
||||||
LightningPrompt.open({
|
|
||||||
message: this.message,
|
|
||||||
theme: this.colorTheme,
|
|
||||||
label: this.header,
|
|
||||||
variant: this.variant,
|
|
||||||
defaultValue: '',
|
|
||||||
}).then((result) => {
|
|
||||||
this.value=result;
|
|
||||||
const selectedEvent = new CustomEvent('selection', { detail: result });
|
|
||||||
// Dispatches the event
|
|
||||||
this.dispatchEvent(selectedEvent);
|
|
||||||
|
|
||||||
if(this.isCallerFlow==true)
|
|
||||||
{
|
|
||||||
const attributeChangeEvent = new FlowAttributeChangeEvent(
|
|
||||||
'value',result);
|
|
||||||
this.dispatchEvent(attributeChangeEvent);
|
|
||||||
|
|
||||||
var navigationEvent = new FlowNavigationNextEvent();
|
|
||||||
this.dispatchEvent(navigationEvent);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//Toast Section
|
|
||||||
closeModel() {
|
|
||||||
this.showToastBar = false;
|
|
||||||
if(this.isCallerFlow==true)
|
|
||||||
{
|
|
||||||
var navigationEvent = new FlowNavigationNextEvent();
|
|
||||||
this.dispatchEvent(navigationEvent);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
get getIconName() {
|
|
||||||
return 'utility:' + this.colorTheme;
|
|
||||||
}
|
|
||||||
|
|
||||||
get innerClass() {
|
|
||||||
return 'slds-icon_container slds-icon-utility-' + this.colorTheme + ' slds-icon-utility-success slds-m-right_small slds-no-flex slds-align-top';
|
|
||||||
}
|
|
||||||
|
|
||||||
get outerClass() {
|
|
||||||
return 'slds-notify slds-notify_toast slds-theme_' + this.colorTheme;
|
|
||||||
}
|
|
||||||
|
|
||||||
handleToast(){
|
|
||||||
var that=this;
|
|
||||||
that.showToastBar = true;
|
|
||||||
setTimeout(() => {
|
|
||||||
that.closeModel();
|
|
||||||
}, that.autoCloseTime);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
|
|
||||||
<apiVersion>56.0</apiVersion>
|
|
||||||
<isExposed>true</isExposed>
|
|
||||||
<masterLabel>Notification</masterLabel>
|
|
||||||
<targets>
|
|
||||||
<target>lightning__RecordAction</target>
|
|
||||||
<target>lightning__HomePage</target>
|
|
||||||
<target>lightning__RecordPage</target>
|
|
||||||
<target>lightning__AppPage</target>
|
|
||||||
<target>lightning__Tab</target>
|
|
||||||
<target>lightning__FlowScreen</target>
|
|
||||||
</targets>
|
|
||||||
<targetConfigs>
|
|
||||||
<targetConfig targets="lightning__FlowScreen">
|
|
||||||
<property name="isCallerFlow" type="Boolean" label="Is Caller Flow" default="true"></property>
|
|
||||||
<property name="notificationType" type="String" label="Notification Type" default="Alert" description="Type of notification we need to show. It can be Alert/Prompt/Confirm/Toast"/>
|
|
||||||
<property name="message" type="String" label="Notification Message" role="inputOnly"/>
|
|
||||||
<property name="variant" type="String" label="Header or Header less nofification?" default="header" role="inputOnly" description="Need Header or Not. Possible values are header/headerless"/>
|
|
||||||
<property name="header" type="String" label="Header Label" role="inputOnly"/>
|
|
||||||
<property name="colorTheme" type="String" label="Color theme for the header" default="default" role="inputOnly" description="Color theme for the header. choose from default, shade,inverse,alt-inverse,success,info,warning,error,offline" />
|
|
||||||
<property name="value" type="String" label="Selected Value" role="outputOnly"/>
|
|
||||||
<property name="autoCloseTime" type="Integer" label="Toast Auto Close Time." description="Toast Auto Close Time. Only required when notificationType is Toast"/>
|
|
||||||
</targetConfig>
|
|
||||||
</targetConfigs>
|
|
||||||
</LightningComponentBundle>
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
||||||
<template>
|
|
||||||
|
|
||||||
<div class="slds-grid slds-wrap">
|
|
||||||
<div>
|
|
||||||
<button class="slds-button slds-button_neutral" name="Previous" onclick={handleGoBack}>Previous</button>
|
|
||||||
</div>
|
|
||||||
<div class="slds-col_bump-left">
|
|
||||||
<button class="slds-button slds-button_brand slds-m-vertical_xx-small" name="Save as Draft" onclick={handleSaveData}>Save as Draft</button>
|
|
||||||
<button class="slds-button slds-button_brand" name="Send Checklists" onclick={handleSaveData}>Send Checklists</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- slds-col slds-large-size_9-of-12 -->
|
|
||||||
</template>
|
|
||||||
|
|
@ -1,37 +0,0 @@
|
||||||
import { LightningElement, api } from 'lwc';
|
|
||||||
import { FlowAttributeChangeEvent, FlowNavigationBackEvent, FlowNavigationNextEvent} from 'lightning/flowSupport';
|
|
||||||
|
|
||||||
/*FlowAttributeChangeEvent — Informs the runtime that a component property has changed.
|
|
||||||
FlowNavigationBackEvent — Requests navigation to the previous screen.
|
|
||||||
FlowNavigationNextEvent — Requests navigation to the next screen.
|
|
||||||
FlowNavigationFinishEvent — Requests the flow runtime to terminate the flow.*/
|
|
||||||
|
|
||||||
export default class CustomFooterFlowComponent extends LightningElement {
|
|
||||||
|
|
||||||
@api btnName;
|
|
||||||
|
|
||||||
handleSaveData(event){
|
|
||||||
|
|
||||||
if(event.target.name === 'Save as Draft'){
|
|
||||||
this.btnName = event.target.name;
|
|
||||||
console.log('btn name: ',this.btnName);
|
|
||||||
const attributeChangeEvent = new FlowAttributeChangeEvent('btnName', this.btnName);
|
|
||||||
this.dispatchEvent(attributeChangeEvent);
|
|
||||||
}
|
|
||||||
else if(event.target.name === 'Send Checklists'){
|
|
||||||
this.btnName = event.target.name;
|
|
||||||
console.log('btn name: ',this.btnName);
|
|
||||||
const attributeChangeEvent = new FlowAttributeChangeEvent('btnName', this.btnName);
|
|
||||||
this.dispatchEvent(attributeChangeEvent);
|
|
||||||
}
|
|
||||||
const navigateNextEvent = new FlowNavigationNextEvent();
|
|
||||||
this.dispatchEvent(navigateNextEvent);
|
|
||||||
}
|
|
||||||
|
|
||||||
handleGoBack(){
|
|
||||||
// navigate to the back screen
|
|
||||||
const navigateBackEvent = new FlowNavigationBackEvent();
|
|
||||||
this.dispatchEvent(navigateBackEvent);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
|
|
||||||
<apiVersion>59.0</apiVersion>
|
|
||||||
<isExposed>true</isExposed>
|
|
||||||
<targets>
|
|
||||||
<target>lightning__FlowScreen</target>
|
|
||||||
</targets>
|
|
||||||
<targetConfigs>
|
|
||||||
<targetConfig targets="lightning__FlowScreen">
|
|
||||||
<property name="btnName" type="String" label="btnName" description="btnName" role="outputOnly"/>
|
|
||||||
</targetConfig>
|
|
||||||
</targetConfigs>
|
|
||||||
</LightningComponentBundle>
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
||||||
<template>
|
|
||||||
<div class="slds-form-element">
|
|
||||||
<div class="slds-form-element__control slds-input-has-icon slds-input-has-icon_right">
|
|
||||||
<lightning-icon size="x-small" class="slds-icon slds-input__icon slds-input__icon_right slds-icon-text-default" icon-name="utility:search"></lightning-icon>
|
|
||||||
<input type="text" id="text-input-id-1" placeholder="Custom Lookup" class="slds-input" oninput={handleOnChange} />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<template for:each={resultObj} for:item="obj">
|
|
||||||
<lightning-card key={obj.Id} style="height: 5px;">
|
|
||||||
<div class="Card" style="margin-top:-12px;">
|
|
||||||
<p>{obj.Name}</p>
|
|
||||||
</div>
|
|
||||||
</lightning-card>
|
|
||||||
</template>
|
|
||||||
</template>
|
|
||||||
|
|
@ -1,31 +0,0 @@
|
||||||
import { LightningElement,wire } from 'lwc';
|
|
||||||
import findAccounts from '@salesforce/apex/AccountController.findAccounts';
|
|
||||||
|
|
||||||
export default class customLookup extends LightningElement {
|
|
||||||
value = '';
|
|
||||||
resultObj = []; // Declare an object to store the result
|
|
||||||
|
|
||||||
handleOnChange(event){
|
|
||||||
this.value = event.target.value;
|
|
||||||
console.log(this.value);
|
|
||||||
findAccounts({searchKey: this.value})
|
|
||||||
.then(result => {
|
|
||||||
this.resultObj = result; // Store the result in the object
|
|
||||||
console.log("Printing reslt ",this.resultObj); // Log the object
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
console.error(error);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
handleMouseOver(event) {
|
|
||||||
const recordId = event.currentTarget.dataset.id;
|
|
||||||
const record = this.resultObj.find(rec => rec.Id === recordId);
|
|
||||||
record.showCard = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
handleMouseOut(event) {
|
|
||||||
const recordId = event.currentTarget.dataset.id;
|
|
||||||
const record = this.resultObj.find(rec => rec.Id === recordId);
|
|
||||||
record.showCard = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
|
|
||||||
<apiVersion>58.0</apiVersion>
|
|
||||||
<isExposed>true</isExposed>
|
|
||||||
<targets>
|
|
||||||
<target>lightning__RecordPage</target>
|
|
||||||
</targets>
|
|
||||||
</LightningComponentBundle>
|
|
||||||
|
|
@ -1,33 +0,0 @@
|
||||||
/* .custom-button {
|
|
||||||
height: 120px;
|
|
||||||
width: 250px;
|
|
||||||
display: flex;
|
|
||||||
color: #022160;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
text-align: center;
|
|
||||||
padding: 10px;
|
|
||||||
border-radius: 10px;
|
|
||||||
box-shadow: 0 2px 4px rgba(0,0,0,0.2);
|
|
||||||
cursor: pointer;
|
|
||||||
background-color: #ffffff
|
|
||||||
}*/
|
|
||||||
svg {
|
|
||||||
fill: blue;
|
|
||||||
}
|
|
||||||
|
|
||||||
.custom-button {
|
|
||||||
height: 120px; /* Adjust based on your design needs */
|
|
||||||
width: 250px; /* Adjust based on your design needs */
|
|
||||||
display: flex;
|
|
||||||
color: #022160;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
text-align: center;
|
|
||||||
padding: 10px;
|
|
||||||
border-radius: 10px; /* Optional for rounded corners */
|
|
||||||
box-shadow: 0 2px 4px rgba(0,0,0,0.2); /* Optional for shadow effect */
|
|
||||||
cursor: pointer;
|
|
||||||
background-color: #ffffff;
|
|
||||||
margin: 10px; /* Add this line */
|
|
||||||
}
|
|
||||||
|
|
@ -1,58 +0,0 @@
|
||||||
<template>
|
|
||||||
<div class="Container">
|
|
||||||
<div class="slds-grid slds-wrap slds-grid_align-space slds-text-heading_medium">
|
|
||||||
<div class="slds-col">
|
|
||||||
<div class="custom-button " onclick={handleclick}>
|
|
||||||
<div class="slds-grid">
|
|
||||||
<div class="slds-col slds-size_4-of-12 slds-align_absolute-center">
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 600" >
|
|
||||||
<path d="M64 0C28.7 0 0 28.7 0 64V448c0 35.3 28.7 64 64 64H320c35.3 0 64-28.7 64-64V64c0-35.3-28.7-64-64-64H64zM96 64H288c17.7 0 32 14.3 32 32v32c0 17.7-14.3 32-32 32H96c-17.7 0-32-14.3-32-32V96c0-17.7 14.3-32 32-32zm32 160a32 32 0 1 1 -64 0 32 32 0 1 1 64 0zM96 352a32 32 0 1 1 0-64 32 32 0 1 1 0 64zM64 416c0-17.7 14.3-32 32-32h96c17.7 0 32 14.3 32 32s-14.3 32-32 32H96c-17.7 0-32-14.3-32-32zM192 256a32 32 0 1 1 0-64 32 32 0 1 1 0 64zm32 64a32 32 0 1 1 -64 0 32 32 0 1 1 64 0zm64-64a32 32 0 1 1 0-64 32 32 0 1 1 0 64zm32 64a32 32 0 1 1 -64 0 32 32 0 1 1 64 0zM288 448a32 32 0 1 1 0-64 32 32 0 1 1 0 64z"/>
|
|
||||||
</svg>
|
|
||||||
</div>
|
|
||||||
<div class="slds-col slds-size_8-of-12">
|
|
||||||
Create Budget
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="slds-col">
|
|
||||||
<div class="custom-button" onclick={handleclick}>
|
|
||||||
<div class="slds-grid">
|
|
||||||
<div class="slds-col slds-size_4-of-12 slds-align_absolute-center">
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 600">
|
|
||||||
<path d="M64 0C28.7 0 0 28.7 0 64V448c0 35.3 28.7 64 64 64H320c35.3 0 64-28.7 64-64V160H256c-17.7 0-32-14.3-32-32V0H64zM256 0V128H384L256 0zM64 80c0-8.8 7.2-16 16-16h64c8.8 0 16 7.2 16 16s-7.2 16-16 16H80c-8.8 0-16-7.2-16-16zm0 64c0-8.8 7.2-16 16-16h64c8.8 0 16 7.2 16 16s-7.2 16-16 16H80c-8.8 0-16-7.2-16-16zm128 72c8.8 0 16 7.2 16 16v17.3c8.5 1.2 16.7 3.1 24.1 5.1c8.5 2.3 13.6 11 11.3 19.6s-11 13.6-19.6 11.3c-11.1-3-22-5.2-32.1-5.3c-8.4-.1-17.4 1.8-23.6 5.5c-5.7 3.4-8.1 7.3-8.1 12.8c0 3.7 1.3 6.5 7.3 10.1c6.9 4.1 16.6 7.1 29.2 10.9l.5 .1 0 0 0 0c11.3 3.4 25.3 7.6 36.3 14.6c12.1 7.6 22.4 19.7 22.7 38.2c.3 19.3-9.6 33.3-22.9 41.6c-7.7 4.8-16.4 7.6-25.1 9.1V440c0 8.8-7.2 16-16 16s-16-7.2-16-16V422.2c-11.2-2.1-21.7-5.7-30.9-8.9l0 0 0 0c-2.1-.7-4.2-1.4-6.2-2.1c-8.4-2.8-12.9-11.9-10.1-20.2s11.9-12.9 20.2-10.1c2.5 .8 4.8 1.6 7.1 2.4l0 0 0 0 0 0c13.6 4.6 24.6 8.4 36.3 8.7c9.1 .3 17.9-1.7 23.7-5.3c5.1-3.2 7.9-7.3 7.8-14c-.1-4.6-1.8-7.8-7.7-11.6c-6.8-4.3-16.5-7.4-29-11.2l-1.6-.5 0 0c-11-3.3-24.3-7.3-34.8-13.7c-12-7.2-22.6-18.9-22.7-37.3c-.1-19.4 10.8-32.8 23.8-40.5c7.5-4.4 15.8-7.2 24.1-8.7V232c0-8.8 7.2-16 16-16z"/>
|
|
||||||
</svg>
|
|
||||||
</div>
|
|
||||||
<div class="slds-col slds-size_8-of-12">
|
|
||||||
Create Invoice
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="slds-col">
|
|
||||||
<div class="custom-button" onclick={handleclick}><div class="slds-grid">
|
|
||||||
<div class="slds-col slds-size_4-of-12 slds-align_absolute-center">
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 600">
|
|
||||||
<path d="M288 0H400c8.8 0 16 7.2 16 16V80c0 8.8-7.2 16-16 16H320.7l89.6 64H512c35.3 0 64 28.7 64 64V448c0 35.3-28.7 64-64 64H336V400c0-26.5-21.5-48-48-48s-48 21.5-48 48V512H64c-35.3 0-64-28.7-64-64V224c0-35.3 28.7-64 64-64H165.7L256 95.5V32c0-17.7 14.3-32 32-32zm48 240a48 48 0 1 0 -96 0 48 48 0 1 0 96 0zM80 224c-8.8 0-16 7.2-16 16v64c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16V240c0-8.8-7.2-16-16-16H80zm368 16v64c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16V240c0-8.8-7.2-16-16-16H464c-8.8 0-16 7.2-16 16zM80 352c-8.8 0-16 7.2-16 16v64c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16V368c0-8.8-7.2-16-16-16H80zm384 0c-8.8 0-16 7.2-16 16v64c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16V368c0-8.8-7.2-16-16-16H464z"/>
|
|
||||||
</svg>
|
|
||||||
</div>
|
|
||||||
<div class="slds-col slds-size_8-of-12">
|
|
||||||
Create Enrollment
|
|
||||||
</div>
|
|
||||||
</div></div>
|
|
||||||
</div>
|
|
||||||
<div class="slds-col">
|
|
||||||
<div class="custom-button" onclick={handleclick}><div class="slds-grid">
|
|
||||||
<div class="slds-col slds-size_4-of-12 slds-align_absolute-center">
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 600">
|
|
||||||
<path d="M96 128a128 128 0 1 1 256 0A128 128 0 1 1 96 128zM0 482.3C0 383.8 79.8 304 178.3 304h91.4C368.2 304 448 383.8 448 482.3c0 16.4-13.3 29.7-29.7 29.7H29.7C13.3 512 0 498.7 0 482.3zM625 177L497 305c-9.4 9.4-24.6 9.4-33.9 0l-64-64c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l47 47L591 143c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9z"/>
|
|
||||||
</svg>
|
|
||||||
</div>
|
|
||||||
<div class="slds-col slds-size_8-of-12">
|
|
||||||
Create Screening
|
|
||||||
</div>
|
|
||||||
</div></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
import { LightningElement } from 'lwc';
|
|
||||||
|
|
||||||
export default class DOEComponent extends LightningElement {
|
|
||||||
handleclick(){
|
|
||||||
console.log('clicked');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
|
|
||||||
<apiVersion>59.0</apiVersion>
|
|
||||||
<isExposed>true</isExposed>
|
|
||||||
<targets>
|
|
||||||
<target>lightning__AppPage</target>
|
|
||||||
<target>lightningCommunity__Default</target>
|
|
||||||
<target>lightningCommunity__Page</target>
|
|
||||||
</targets>
|
|
||||||
</LightningComponentBundle>
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
.designTokens{
|
|
||||||
color: var(--lwc-brandAccessible);
|
|
||||||
background-color: var(--lwc-colorBackgroundAlt);
|
|
||||||
}
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
<template>
|
|
||||||
<div class="slds-brand-band slds-brand-band_medium slds-brand-band_group">
|
|
||||||
<div class="slds-p-around_medium">
|
|
||||||
<div class="slds-box">
|
|
||||||
<p>This is a regular-sized box.</p>
|
|
||||||
<div class="slds-grid slds-gutters">
|
|
||||||
<div class="slds-col slds-size_8-of-12" style="background-color: burlywood;">
|
|
||||||
<span class="slds-badge">Badge Label</span>
|
|
||||||
</div>
|
|
||||||
<div class="slds-col slds-size_4-of-12" style="background-color: brown;">
|
|
||||||
<span class="slds-badge slds-theme_success">Badge Label</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="designTokens">
|
|
||||||
<p>Design Token</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
import { LightningElement } from 'lwc';
|
|
||||||
|
|
||||||
export default class DesignSystemComponent extends LightningElement {}
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
|
|
||||||
<apiVersion>59.0</apiVersion>
|
|
||||||
<isExposed>true</isExposed>
|
|
||||||
<targets>
|
|
||||||
<target>lightning__AppPage</target>
|
|
||||||
</targets>
|
|
||||||
</LightningComponentBundle>
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
||||||
.loading-container {
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
.spinner-container {
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
bottom: 0;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
background-color: rgba(255, 255, 255, 0.8);
|
|
||||||
}
|
|
||||||
|
|
@ -1,40 +0,0 @@
|
||||||
<template>
|
|
||||||
<div class="loading-container">
|
|
||||||
<template if:true={isLoading}>
|
|
||||||
<div class="spinner-container">
|
|
||||||
<lightning-spinner alternative-text="Loading" size="medium" style="color: orangered;"></lightning-spinner>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<lightning-card
|
|
||||||
title="Dynamic Record Picker "
|
|
||||||
class="slds-card__body_inner"
|
|
||||||
icon-name="standard:search">
|
|
||||||
<div class="slds-form-element">
|
|
||||||
<label class="slds-form-element__label"><b>Select a record</b> </label>
|
|
||||||
<div class="slds-form-element__control slds-combobox-group">
|
|
||||||
<template if:true={showTargetSelector}>
|
|
||||||
<!-- Target Object Selector -->
|
|
||||||
<lightning-combobox
|
|
||||||
data-id="targetSelector"
|
|
||||||
label="Select sObject"
|
|
||||||
variant="label-hidden"
|
|
||||||
placeholder="Select object"
|
|
||||||
options={targetObjects}
|
|
||||||
value={selectedTarget}
|
|
||||||
onchange={handleTargetSelection}
|
|
||||||
class="slds-combobox_object-switcher slds-combobox-addon_start">
|
|
||||||
</lightning-combobox>
|
|
||||||
</template>
|
|
||||||
<lightning-record-picker
|
|
||||||
object-api-name={selectedTarget}
|
|
||||||
placeholder="Search for a Record"
|
|
||||||
label="Select a record"
|
|
||||||
variant="label-hidden"
|
|
||||||
onchange={handleRecordSelect}
|
|
||||||
class="slds-size_full slds-combobox-addon_end">
|
|
||||||
</lightning-record-picker>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</lightning-card>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
@ -1,45 +0,0 @@
|
||||||
import { LightningElement, wire, track } from 'lwc';
|
|
||||||
import getAllObjects from '@salesforce/apex/GetAllObjects.getAllObjects';
|
|
||||||
|
|
||||||
export default class DynamicRecordPicker extends LightningElement {
|
|
||||||
@track targetObjects = [];
|
|
||||||
selectedTarget = '';
|
|
||||||
currentSelectedRecordId = null;
|
|
||||||
@track isLoading = true;
|
|
||||||
|
|
||||||
@track targetObjects = [
|
|
||||||
{ label: 'Account', value: 'Account' },
|
|
||||||
{ label: 'Contact', value: 'Contact' },
|
|
||||||
{ label: 'Lead', value: 'Lead' },
|
|
||||||
{ label: 'Opportunity', value: 'Opportunity' }
|
|
||||||
];
|
|
||||||
|
|
||||||
@wire(getAllObjects)
|
|
||||||
wiredObjects({ error, data }) {
|
|
||||||
if (data) {
|
|
||||||
// this.targetObjects = data.map(obj => ({ label: obj, value: obj }));
|
|
||||||
// Set the selectedTarget to the first object in the list
|
|
||||||
if(this.targetObjects.length > 0) {
|
|
||||||
this.selectedTarget = this.targetObjects[0].value;
|
|
||||||
}
|
|
||||||
console.log('@@@data',this.targetObjects);
|
|
||||||
this.isLoading = false;
|
|
||||||
} else if (error) {
|
|
||||||
console.error(error);
|
|
||||||
this.isLoading = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//To hide combobox
|
|
||||||
get showTargetSelector() {
|
|
||||||
return this.currentSelectedRecordId === null;
|
|
||||||
}
|
|
||||||
|
|
||||||
handleTargetSelection(event) {
|
|
||||||
this.selectedTarget = event.target.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
handleRecordSelect(event) {
|
|
||||||
this.currentSelectedRecordId = event.detail.recordId;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
|
|
||||||
<apiVersion>58.0</apiVersion>
|
|
||||||
<isExposed>true</isExposed>
|
|
||||||
<targets>
|
|
||||||
<target>lightning__HomePage</target>
|
|
||||||
</targets>
|
|
||||||
</LightningComponentBundle>
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
<template>
|
|
||||||
<template if:true={showNoContent}>
|
|
||||||
<lightning-formatted-rich-text value={text}>
|
|
||||||
</lightning-formatted-rich-text>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template if:true={showNow}>
|
|
||||||
<lightning-file-upload
|
|
||||||
label="File Upload"
|
|
||||||
name="fileUploader"
|
|
||||||
onuploadfinished={handleUploadFinished}
|
|
||||||
multiple>
|
|
||||||
</lightning-file-upload>
|
|
||||||
</template>
|
|
||||||
<template if:false={showNow}>
|
|
||||||
<lightning-formatted-rich-text value={content}>
|
|
||||||
</lightning-formatted-rich-text>
|
|
||||||
</template>
|
|
||||||
</template>
|
|
||||||
|
|
@ -1,34 +0,0 @@
|
||||||
import { track } from 'lwc';
|
|
||||||
|
|
||||||
import BaseChatMessage from 'lightningsnapin/BaseChatMessage';
|
|
||||||
const CHAT_CONTENT_CLASS = 'chat-content';
|
|
||||||
const AGENT_USER_TYPE = 'agent';
|
|
||||||
const CHASITOR_USER_TYPE = 'chasitor';
|
|
||||||
const SUPPORTED_USER_TYPES = [AGENT_USER_TYPE, CHASITOR_USER_TYPE];
|
|
||||||
const LWC_PREFIX = 'lwc:';
|
|
||||||
|
|
||||||
export default class fileupload extends BaseChatMessage {
|
|
||||||
|
|
||||||
@track content = '';
|
|
||||||
showNow=false;
|
|
||||||
showNoContent=false;
|
|
||||||
text = ''; // Declare 'text' variable
|
|
||||||
|
|
||||||
connectedCallback() {
|
|
||||||
if(this.messageContent.value.startsWith(LWC_PREFIX)) { // Use the constant LWC_PREFIX
|
|
||||||
if(this.messageContent.value.split(':')[1]==="Yes") { // Use double quotes
|
|
||||||
this.showNow=true;
|
|
||||||
} else {
|
|
||||||
this.text='The file upload option is not available';
|
|
||||||
this.showNoContent=true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.showNoContent=true;
|
|
||||||
this.text=this.messageContent.value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
handleUploadFinished(event) { // Add 'event' parameter
|
|
||||||
const uploadedFiles = event.detail.files;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
|
|
||||||
<apiVersion>59.0</apiVersion>
|
|
||||||
<isExposed>true</isExposed>
|
|
||||||
<targets>
|
|
||||||
<target>lightningSnapin__ChatMessage</target>
|
|
||||||
</targets>
|
|
||||||
</LightningComponentBundle>
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
<template>
|
|
||||||
<lightning-card title="Contact Form" icon-name="custom:custom14">
|
|
||||||
<div class="slds-m-around_medium">
|
|
||||||
<lightning-input type="text" label="First Name" value={firstName}></lightning-input>
|
|
||||||
<lightning-input type="text" label="Last Name" value={lastName}></lightning-input>
|
|
||||||
<lightning-input type="email" label="Email" value={email}></lightning-input>
|
|
||||||
<lightning-button variant="brand" label="Submit" onclick={handleSubmit}></lightning-button>
|
|
||||||
</div>
|
|
||||||
</lightning-card>
|
|
||||||
</template>
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
import { LightningElement, track } from 'lwc';
|
|
||||||
|
|
||||||
export default class ContactForm extends LightningElement {
|
|
||||||
@track firstName = '';
|
|
||||||
@track lastName = '';
|
|
||||||
@track email = '';
|
|
||||||
|
|
||||||
handleSubmit() {
|
|
||||||
// handle form submission logic here
|
|
||||||
window.print();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue