import { LightningElement, api, track, wire } from 'lwc';
|
import { CurrentPageReference } from 'lightning/navigation';
|
import initData from '@salesforce/apex/LexConsumApplyEquipDetailPIPLController.initData';
|
import { NavigationMixin } from 'lightning/navigation';
|
import { AWSService } from 'c/piUtils';
|
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
|
import lexPIPLCustomStyle from '@salesforce/resourceUrl/lexPIPLCustomStyle'
|
import { loadStyle } from 'lightning/platformResourceLoader';
|
import { decodeDefaultFieldValues } from "lightning/pageReferenceUtils";
|
import { conmentCancel } from "c/lexPIPLConmentMethods";
|
import CONSUMDetail from '@salesforce/schema/Consum_Apply_Equipment_Set_Detail__c';
|
import { getObjectInfo } from 'lightning/uiObjectInfoApi';
|
// Add By Li Jun 20231025 Start
|
import LexRecordNotCreateable from '@salesforce/label/c.LexRecordNotCreateable';
|
import LexNotCreateNote from '@salesforce/label/c.LexNotCreateNote';
|
const customLabel = {
|
LexRecordNotCreateable,
|
LexNotCreateNote
|
}
|
// Add By Li Jun 20231025 End
|
|
export default class LexConsumApplyEquipSetDetailPIPL extends NavigationMixin(LightningElement) {
|
sobjectType = 'Consum_Apply_Equipment_Set_Detail__c';
|
@track customLabel = customLabel;
|
@api recordId;
|
@track recordTypeId = '';
|
@wire(CurrentPageReference) pageRef;
|
@track recordData = {};
|
@track title;
|
@track isLoading = false;
|
@track layout = [];
|
@track mode = '';
|
|
@track staticResource;
|
@track staticResourceV2;
|
@track staticResourceContact;
|
@track piFieldsMap;
|
@track abstractData = '';
|
@track data = {};
|
@track piplData = {};
|
@track isNewMode = false;
|
@track isCloneMode = false;
|
@track isEditMode = false;
|
@track sectionName = [];
|
@track AWSToSobjectMap = {};
|
@track AWSDataId = '';
|
@track txId = '';
|
@track isShowSearchAccount = false;
|
@track hospitalId = '';
|
@track contactId = '';
|
@track isEdit = false;
|
AWSService;
|
@track modifyObj = {};
|
modifyArray = [''];
|
@track saveAndNew = false;
|
@track recordCloneId = '';
|
@track isInitSuccess = false;
|
|
fieldLabel = {};
|
defaultValues = {};
|
@wire(getObjectInfo, { objectApiName: CONSUMDetail })
|
getConsumInfo({data,error}){
|
if(data){
|
this.fieldLabel = data.fields;
|
}
|
}
|
|
|
connectedCallback() {
|
this.isLoading = true;
|
console.log('enter connectedCallback');
|
loadStyle(this, lexPIPLCustomStyle);
|
this.AWSService = new AWSService();
|
if (!this.recordId) {
|
this.title = '新建耗材备品配套一览明细';
|
this.mode = 'new';
|
this.isNewMode = true;
|
}
|
if (this.recordId) {
|
this.title = '编辑耗材备品配套一览明细';
|
this.mode = 'edit';
|
this.isEditMode = true;
|
}
|
if (this.pageRef && this.pageRef.state) {
|
this.recordTypeId = this.pageRef.state.recordTypeId;
|
console.log('this.recordTypeId = ' + this.recordTypeId);
|
this.isCloneMode = Boolean(this.pageRef.state.c__isClone);
|
//克隆
|
if (this.isCloneMode) {
|
this.isNewMode = false;
|
this.isEditMode = false;
|
this.recordCloneId = this.pageRef.state.c__recordId;
|
console.log('recordCloneId = ' + this.recordCloneId);
|
this.title = '克隆耗材备品配套一览明细';
|
}
|
if (this.pageRef.state.defaultFieldValues) {
|
this.defaultValues = decodeDefaultFieldValues(
|
this.pageRef.state.defaultFieldValues
|
);
|
console.log('this.contactAWSDataId = ' + this.contactAWSDataId);
|
}
|
console.log("defaultValues:", JSON.stringify(this.defaultValues));
|
}
|
console.log('recordId = ' + this.recordId + ' recordCloneId = ' + this.recordCloneId + ' recordTypeId = ' + this.recordTypeId + ' sobjectType = ' + this.sobjectType);
|
let id = this.isCloneMode == true ? this.recordCloneId : this.recordId;
|
initData({
|
rid: id,
|
recordTypeId: this.recordTypeId,
|
sobjectType: this.sobjectType
|
}).then((r) => {
|
r = JSON.parse(JSON.stringify(r));
|
if (r.status == 'Success') {
|
|
this.recordTypeId = r.entity.recordTypeId;
|
this.AWSDataId = r.entity.AWSDataId;
|
this.recordData = r.entity.data;
|
console.log('this.recordTypeId = ' + this.recordTypeId);
|
console.log('this.recordData = ' + this.recordData);
|
let layout = JSON.parse(r.entity.layout);
|
layout = this.sortMetaLayouts(layout); //deloitte-zhj 20231105
|
console.log('layout = ' + JSON.stringify(layout));
|
|
let index = 1;
|
this.sectionName = layout.map(s => s.label);
|
for (let s of layout) {
|
s['showSection'] = false;
|
if (s['editHeading'] || s['detailHeading']) {
|
s['showSection'] = true;
|
}
|
s['showLabel'] = false;
|
for (let c of s.layoutColumns) {
|
c['index'] = index++;
|
if (c.layoutItems.length != 0 && s['showLabel'] == false) {
|
s['showLabel'] = true;
|
}
|
if (c.layoutItems) {
|
for (let item of c.layoutItems) {
|
item['isDisable'] = item.behavior == 'Readonly' ? true : false;
|
item['isRequired'] = item.behavior == 'Required' ? true : false;
|
item['isModify'] = false;
|
let fieldName = item['field'];
|
if (this.isCloneMode) {
|
item['value'] = this.recordData[fieldName];
|
}
|
if (this.isNewMode && this.defaultValues && Object.keys(this.defaultValues).length != 0) {
|
if(this.defaultValues[item['field']]){
|
item["value"] = this.defaultValues[item['field']];
|
}
|
}
|
}
|
}
|
}
|
}
|
//add by xq 2023/07/18 Start
|
// 创建一个空数组,用于存储去重后的 layout
|
const uniqueLayout = [];
|
// 遍历 layout 数组
|
for (let i = 0; i < layout.length; i++) {
|
const uniqueFields = new Set();
|
const uniqueLayoutColumns = layout[i].layoutColumns.map((column) => {
|
const uniqueLayoutItems = [];
|
column.layoutItems.forEach((item) => {
|
if (!uniqueFields.has(item.field)) {
|
uniqueFields.add(item.field);
|
uniqueLayoutItems.push(item);
|
}
|
});
|
|
return {
|
reserved: column.reserved,
|
layoutItems: uniqueLayoutItems,
|
};
|
});
|
const uniqueLayoutItem = {
|
style: layout[i].style,
|
layoutColumns: uniqueLayoutColumns,
|
label: layout[i].label,
|
editHeading: layout[i].editHeading,
|
detailHeading: layout[i].detailHeading,
|
customLabel: layout[i].customLabel
|
};
|
uniqueLayout.push(uniqueLayoutItem);
|
}
|
console.log('uniqueLayout: ', JSON.stringify(uniqueLayout));
|
this.sectionName = uniqueLayout.map(s => s.label);
|
for (let s of uniqueLayout) {
|
s['showSection'] = false;
|
if (s['editHeading'] || s['detailHeading']) {
|
s['showSection'] = true;
|
}
|
s['showLabel'] = false;
|
for (let c of s.layoutColumns) {
|
c['index'] = index++;
|
if (c.layoutItems.length != 0 && s['showLabel'] == false) {
|
s['showLabel'] = true;
|
}
|
if (c.layoutItems) {
|
for (let item of c.layoutItems) {
|
item['isDisable'] = item.behavior == 'Readonly' ? true : false;
|
item['isRequired'] = item.behavior == 'Required' ? true : false;
|
item['isModify'] = false;
|
let fieldName = item['field'];
|
if (this.isCloneMode) {
|
item['value'] = this.recordData[fieldName];
|
}
|
}
|
}
|
}
|
}
|
this.layout = uniqueLayout;
|
console.log('this.layout = ' + JSON.stringify(this.layout))
|
//add by xq 2023/07/18 end
|
// this.layout = layout;
|
this.AWSToSobjectMap = JSON.parse(JSON.stringify(r.entity.AWSToSobjectNonEncryptedMap));
|
this.staticResource = JSON.parse(r.entity.staticResource);
|
this.staticResourceV2 = JSON.parse(r.entity.staticResourceV2);
|
console.log('this.staticResourceV2 = ' + JSON.stringify(this.staticResourceV2));
|
if (r.entity.isEdit != null)
|
this.isEdit = r.entity.isEdit
|
|
console.log('this.isEdit = ' + this.isEdit);
|
//编辑
|
if (this.isEditMode || this.isCloneMode) {
|
//解密加密字段
|
this.querySobjectFromAWS();
|
}
|
this.isInitSuccess = true;
|
} else {
|
//this.showToast('Error', r.msg);
|
this.showMyToast(r.msg , '' , 'error');
|
}
|
})
|
}
|
|
//deloitte-zhj 20231105
|
sortMetaLayouts(layout){
|
layout.forEach(s => {
|
let c1 = (s.layoutColumns[0].layoutItems != null) ? s.layoutColumns[0].layoutItems : [];
|
let c2 = [];
|
if(s.layoutColumns.length > 1){
|
c2 = (s.layoutColumns[1].layoutItems != null) ? s.layoutColumns[1].layoutItems : [];
|
}
|
else{
|
s.layoutColumns.push({ "reserved": null, "layoutItems": [] });
|
}
|
let emptySpaceItem = {
|
"width": null,
|
"showScrollbars": null,
|
"showLabel": null,
|
"scontrol": null,
|
"reportChartComponent": null,
|
"page_x": null,
|
"height": null,
|
"field": null,
|
"emptySpace": true,
|
"customLink": null,
|
"component": null,
|
"canvas": null,
|
"behavior": null,
|
"analyticsCloudComponent": null
|
}
|
let maxSize = 0
|
if(c1.length > c2.length){
|
maxSize = c1.length;
|
for(let i = 0; i < maxSize; i++){
|
if(c2.length == maxSize){
|
break;
|
}
|
c2.push(emptySpaceItem);
|
}
|
}else{
|
maxSize = c2.length;
|
for(let i = 0; i < maxSize; i++){
|
if(c1.length == maxSize){
|
break;
|
}
|
c1.push(emptySpaceItem);
|
}
|
}
|
let tempList = [];
|
let index = 0;
|
for(let i = 0; i < maxSize; i++){
|
tempList.push(c1[i]);
|
if(tempList.length == maxSize){
|
s.layoutColumns[index].layoutItems = tempList;
|
tempList = [];
|
tempList.push(c2[i]);
|
index++;
|
}else{
|
tempList.push(c2[i]);
|
if(tempList.length == maxSize){
|
s.layoutColumns[index].layoutItems = tempList;
|
tempList = [];
|
index++;
|
}
|
}
|
}
|
})
|
layout = [...layout];
|
return layout;
|
}
|
|
handleLoad() {
|
console.log('handleLoad')
|
console.log('this.isInitSuccess = ' + this.isInitSuccess)
|
if (this.isInitSuccess) {
|
let time = 1000;
|
if (!this.isNewMode) {
|
time = 2000;
|
}
|
|
let that = this;
|
setTimeout(() => {
|
that.isLoading = false;
|
}, time);
|
}
|
}
|
querySobjectFromAWS() {
|
var that = this;
|
this.AWSService.query(this.staticResource.queryUrl, this.AWSDataId, function (data) {
|
console.log('queryLeadFromAWSIFS data = ' + JSON.stringify(data));
|
if (data.object) {
|
for (let s of that.layout) {
|
for (let lc of s.layoutColumns) {
|
if (lc.layoutItems) {
|
for (let c of lc.layoutItems) {
|
for (let f in that.AWSToSobjectMap) {
|
if (data.object.hasOwnProperty(f) && c['field'] == that.AWSToSobjectMap[f]) {
|
c['value'] = data.object[f] == null ? '' : data.object[f];
|
}
|
}
|
}
|
}
|
}
|
}
|
}
|
}, this.staticResource.token)
|
}
|
|
dataChange(event) {
|
let fieldName = event.target.getAttribute("data-field");
|
let value = event.detail.value;
|
console.log("fieldName = " + fieldName + " value = " + value);
|
}
|
|
clickSubmit() {
|
console.log('clickSubmit');
|
const btn = this.template.querySelector(".hidden");
|
|
if (btn) {
|
btn.click();
|
}
|
}
|
|
clickSubmitAndNew() {
|
console.log('clickSubmitAndNew');
|
this.saveAndNew = true;
|
const btn = this.template.querySelector(".hidden");
|
if (btn) {
|
btn.click();
|
}
|
}
|
|
handleSubmit(event) {
|
this.isLoading = true;
|
//1. Get Sobject Information from Form
|
console.log('handleSubmit');
|
event.preventDefault();
|
const fields = event.detail.fields;
|
console.log('this.modifyObj = ' + JSON.stringify(this.modifyObj));
|
Object.assign(fields, this.modifyObj);
|
console.log('fields = ' + JSON.stringify(fields));
|
|
//2. select cannot actively select redaction option
|
let validationResultMessage = this.validateFieldValueFormate(fields);
|
console.log(validationResultMessage);
|
if (validationResultMessage) {
|
//this.showToast('Error', validationResultMessage);
|
this.showMyToast(validationResultMessage , '' , 'error');
|
return
|
}
|
|
//3. Check Required Field
|
console.log('fields = ' + JSON.stringify(fields));
|
let checkRequiredFieldMsgResult = this.checkRequiredFieldMsg(fields);
|
console.log('checkRequiredFieldMsgResult = ' + checkRequiredFieldMsgResult);
|
if (checkRequiredFieldMsgResult != '') {
|
//this.showToast('Error', checkRequiredFieldMsgResult + '需要进行填写');
|
this.showMyToast(checkRequiredFieldMsgResult + '需要进行填写' , '' , 'error');
|
return
|
}
|
|
//4. Prepare the payload for New PI API To AWS - To Do
|
let payloadForNewPI = this.getPIPayload(fields);
|
console.log('payloadForNewPI = ' + payloadForNewPI);
|
|
//zhj MEBG新方案改造 2022-11-29 start
|
if (this.isEdit && (fields.Phone_number__c != phoneNumber || fields.direct_shippment_address__c != directShippmentAddress)) {
|
//this.showToast('error', '申请单批准后,不能编辑耗材备品借用信息');
|
this.showMyToast('申请单批准后,不能编辑耗材备品借用信息' , '' , 'error');
|
return
|
}
|
//zhj MEBG新方案改造 2022-11-29 end
|
|
|
//5. PI To AWS
|
//新建/克隆
|
if (this.isNewMode || this.isCloneMode || !this.AWSDataId) { //deloitte-zhj 20231113
|
this.NewPIToAWS(payloadForNewPI, fields);
|
return
|
}
|
//编辑
|
if (this.isEditMode) {
|
this.UpdatePIToAWS(payloadForNewPI, fields);
|
}
|
}
|
|
//验证字段
|
validateFieldValueFormate(fields) {
|
let error_msg = '';
|
let b = false;
|
for (var key in fields) {
|
if (fields[key] == "*****")
|
b = true;
|
}
|
if (b)
|
error_msg = '下拉框不能主动选择密文选项';
|
return error_msg;
|
}
|
|
//验证required字段需要进行填写
|
checkRequiredFieldMsg(fields) {
|
|
let msg = '';
|
try {
|
for (let s of this.layout) {
|
for (let lc of s.layoutColumns) {
|
if (lc.layoutItems) {
|
for (let c of lc.layoutItems) {
|
if (!c.isDisable && c.isRequired && (fields[c.field] == null || fields[c.field] === '') && c.field != 'Consum_Apply_Equipment_Set__c') {
|
console.log('c.isDisable = ' + c.isDisable);
|
console.log('fields[c.field] = ' + fields[c.field]);
|
msg += ";" + this.fieldLabel[c.field].label ;
|
}
|
}
|
}
|
}
|
}
|
} catch (err) {
|
//this.showToast('Error', err.message);
|
this.showMyToast(err.message , '' , 'error');
|
}
|
msg = msg.substring(1);
|
return msg;
|
}
|
|
//获取PI字段
|
getPIPayload(sobjJsonLwc) {
|
console.log()
|
let leadPayloadList = [];
|
let leadPIData = {};
|
|
for (let f in this.AWSToSobjectMap) {
|
if (sobjJsonLwc.hasOwnProperty(this.AWSToSobjectMap[f])) {
|
leadPIData[f] = sobjJsonLwc[this.AWSToSobjectMap[f]] == null ? '' : sobjJsonLwc[this.AWSToSobjectMap[f]];
|
}
|
else {
|
console.log(this.AWSToSobjectMap[f] + 'is not in sobjJsonLwc');
|
}
|
}
|
|
leadPIData.medicalStaffFullName = leadPIData.lastName;
|
leadPIData.sfRecordId = '';
|
console.log('Sobject PI Data x :' + leadPIData);
|
leadPayloadList.push(leadPIData);
|
console.log('leadPayloadList = ' + JSON.stringify(leadPayloadList));
|
return JSON.stringify(leadPayloadList);
|
}
|
|
//新建保存ToAWS
|
NewPIToAWS(payloadForNewPI, fields) {
|
var that = this;
|
|
this.AWSService.post(this.staticResourceV2.newUrl, payloadForNewPI, (result) => {
|
if (result && result.object) {
|
console.log('result = ' + JSON.stringify(result));
|
for (let f in that.AWSToSobjectMap) {
|
if (result.object[0].hasOwnProperty(f)) {
|
fields[that.AWSToSobjectMap[f]] = result.object[0][f];
|
console.log('that.AWSToSobjectMap[f] = ' + that.AWSToSobjectMap[f]);
|
console.log('fields[that.AWSToSobjectMap[f]] = ' + fields[that.AWSToSobjectMap[f]]);
|
}
|
else {
|
console.log(f + 'is not in result.object[0]');
|
}
|
}
|
fields['AWS_Data_Id__c'] = result.object[0].dataId;
|
that.txId = result.txId;
|
fields['IndexFromUniqueKey__c'] = 100;
|
console.log('fields = ' + JSON.stringify(fields))
|
that.template.querySelector('lightning-record-edit-form').submit(fields);
|
} else {
|
console.log('result = ' + JSON.stringify(result));
|
}
|
}, this.staticResource.token);
|
}
|
|
//编辑保存ToAWS
|
UpdatePIToAWS(payloadForNewPI, fields) {
|
debugger
|
let obj = JSON.parse(payloadForNewPI);
|
if(this.AWSDataId){
|
obj[0].dataId = this.AWSDataId;
|
}else{
|
this.showMyToast("Error", '未找到该记录的AWS Id,请确认记录完整性', 'error');
|
return;
|
}
|
obj[0].dataId = this.AWSDataId;
|
let payloadForNewPIJson = JSON.stringify(obj);
|
var that = this;
|
this.AWSService.post(this.staticResourceV2.updateUrl, payloadForNewPIJson, (result) => {
|
if (result && result.object) {
|
console.log('result = ' + JSON.stringify(result));
|
for (let f in that.AWSToSobjectMap) {
|
if (result.object[0].hasOwnProperty(f)) {
|
fields[that.AWSToSobjectMap[f]] = result.object[0][f];
|
console.log('that.AWSToSobjectMap[f] = ' + that.AWSToSobjectMap[f]);
|
console.log('fields[that.AWSToSobjectMap[f]] = ' + fields[that.AWSToSobjectMap[f]]);
|
}
|
else {
|
console.log(f + 'is not in result.object[0]');
|
}
|
}
|
fields['AWS_Data_Id__c'] = that.AWSDataId;
|
that.txId = result.txId;
|
console.log('that.txId = ' + that.txId);
|
console.log('PI After fields = ' + JSON.stringify(fields));
|
if (fields.RecordTypeId) {
|
fields['RecordTypeId'] = fields.RecordTypeId.substring(1, fields.RecordTypeId.length - 1);
|
}
|
//保存到后端
|
console.log('update submit = ' + JSON.stringify(fields));
|
that.template.querySelector('lightning-record-edit-form').submit(fields);
|
} else {
|
console.log('result = ' + JSON.stringify(result));
|
}
|
}, this.staticResource.token);
|
}
|
|
//提交保存成功
|
handleSuccess(event) {
|
|
let updatedRecord = event.detail.id;
|
console.log('onsuccess: ', updatedRecord);
|
console.log('confirmTrans');
|
let that = this;
|
this.AWSService.confirm(true, updatedRecord, this.txId, this.staticResource.token, this.staticResource.transactionUrl, function (result) {
|
console.log('result = ' + JSON.stringify(result))
|
that.showToast('Success', '保存成功');
|
//that.showMyToast('保存成功' , '' , 'Success');
|
console.log('updatedRecord = ' + updatedRecord)
|
if (that.saveAndNew) {
|
console.log('that.recordTypeId = ' + that.recordTypeId);
|
that[NavigationMixin.Navigate]({
|
type: 'standard__objectPage',
|
attributes: {
|
objectApiName: that.sobjectType,
|
actionName: 'new',
|
},
|
state: {
|
recordTypeId: that.recordTypeId
|
}
|
});
|
} else {
|
that[NavigationMixin.Navigate]({
|
type: 'standard__recordPage',
|
attributes: {
|
actionName: "view",
|
recordId: updatedRecord,
|
objectApiName: that.sobjectType
|
}
|
});
|
}
|
});
|
}
|
|
//提交保存失败
|
handleError(event) {
|
|
event.preventDefault();
|
event.stopImmediatePropagation();
|
console.log('event.detail = ' + JSON.stringify(event.detail))
|
|
//this.showToast("Error", event.detail.message + ' : ' + event.detail.detail);
|
|
//字段级别的报错
|
if (event.detail.output && event.detail.output.fieldErrors && Object.keys(event.detail.output.fieldErrors).length != 0) {
|
let msg = '';
|
for (let key in event.detail.output.fieldErrors) {
|
msg += ',' + event.detail.output.fieldErrors[key][0].message;
|
}
|
msg = msg.substring(1);
|
//this.showToast("Error", event.detail.message + ' : ' + msg);
|
this.showMyToast(event.detail.message + ' : ' + msg , '' , 'error');
|
} else {
|
//add by Li Jun 20231025 Start
|
if(event.detail.message != '' && this.customLabel.LexRecordNotCreateable.indexOf(event.detail.message) != -1){
|
this.showMyToast("Error", this.customLabel.LexNotCreateNote, 'error');
|
}else{
|
this.showMyToast("Error", event.detail.message + ' : ' + event.detail.detail, 'error');
|
}
|
//add by Li Jun 20231025 End
|
}
|
//add by Li Jun 20231025 Start
|
if(this.txId && this.staticResource){
|
this.AWSService.confirm(false,'',this.txId,this.staticResource.token,this.staticResource.transactionUrl,function(result){
|
console.log('result = ' + JSON.stringify(result))
|
});
|
}
|
//add by Li Jun 20231025 End
|
}
|
|
//change事件
|
dataChange(event) {
|
let fieldName = event.target.getAttribute("data-field");
|
let value = event.detail.value;
|
console.log("fieldName = " + fieldName + " value = " + event.detail.value);
|
if (this.modifyArray.indexOf(fieldName) != -1) {
|
switch (fieldName) {
|
case "LastName":
|
this.modifyObj[fieldName] = value;
|
break;
|
}
|
}
|
}
|
|
//取消
|
cancel() {
|
conmentCancel(this.defaultValues);
|
}
|
|
//标准新建页面跳转
|
RedirectStandardNewPage() {
|
this[NavigationMixin.Navigate]({
|
type: 'standard__objectPage',
|
attributes: {
|
objectApiName: 'Contact',
|
actionName: 'new'
|
},
|
state: {
|
nooverride: '1',
|
recordTypeId: this.recordTypeId
|
}
|
});
|
}
|
|
//标准编辑页面跳转
|
RedirectStandardEditPage() {
|
this[NavigationMixin.Navigate]({
|
type: 'standard__recordPage',
|
attributes: {
|
objectApiName: 'Contact',
|
recordId: this.recordId,
|
actionName: 'edit',
|
},
|
state: {
|
nooverride: '1',
|
}
|
});
|
}
|
|
//显示信息
|
showToast(type, msg) {
|
this.isLoading = false;
|
const event = new ShowToastEvent({
|
title: type,
|
variant: type,
|
message: msg,
|
});
|
this.dispatchEvent(event);
|
}
|
|
//显示信息
|
showMyToast(title, message, variant) {
|
console.log('show custom message');
|
let iconName = '';
|
let content = '';
|
if (variant == 'success') {
|
iconName = 'utility:check';
|
} else {
|
iconName = 'utility:error';
|
}
|
if (message != '') {
|
content =
|
'<h2><strong>' +
|
title +
|
'<strong/></h2><h5>' +
|
message +
|
'</h5>';
|
} else {
|
content = '<h2><strong>' + title + '<strong/></h2>';
|
}
|
this.template
|
.querySelector('c-common-toast')
|
.showToast(variant, content, iconName, 10000);
|
this.isLoading = false;
|
}
|
}
|