Client LWC
Client LWC
***********************************************************************************
**************
Name : LwcNewOrderSelectClientDetails
Description: LWC for Client and Physician Selection
Author : Persistent
US# : CDP-433,CDP-857,CDP-1285,CDP-1417,CDP-854,CDP-1748,CDP-2274,CDP-
2988,CDP-3186, CDP-2295,CDP-3817
***********************************************************************************
**************/
import { LightningElement, track, wire ,api } from 'lwc';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import { getObjectInfo, getPicklistValues } from "lightning/uiObjectInfoApi";
//CDP-4962
import Contact_OBJECT from "@salesforce/schema/Contact";
import { OmniscriptBaseMixin } from "omnistudio/omniscriptBaseMixin";
import PageSize from '@salesforce/label/c.ClientandPhysicianPagesize';
//Import custom label for CDP2295
import Additional_Distribution_Acknowledgement from
'@salesforce/label/c.Additional_Distribution_Acknowledgement';
//Import for CDP-3186 Start
import UserId from '@salesforce/user/Id';
import {getRecord} from 'lightning/uiRecordApi';
import PROFILE_NAME_FIELD from '@salesforce/schema/User.Profile.Name';
import OncologistProfileName from '@salesforce/label/c.OncologistProfileName';
//Import for CDP-3186 End
import { loadStyle } from 'lightning/platformResourceLoader';
import NeoStyleSheet from '@salesforce/resourceUrl/NeoStyleSheet';
import newCreatedPatientDeletion from
'@salesforce/apex/NewOrderPatientSelectionController.newCreatedPatientDeletion';
//Import for CDP-2274 Start
import getClientData from
'@salesforce/apex/PreFillOmniLauchlwcHandler.getClientData';
//Import for CDP-2274 End
//Import for CDP-2988 Strat
import fetchPrimayAccount from
'@salesforce/apex/LookupController.fetchPrimayAccount';
//Import for CDP-2988 End
//CDP-2921
import delRelPhysician from
'@salesforce/apex/NewOrderRemoveHandler.delRelPhysician';
import MailingStateCode from '@salesforce/schema/Contact.MailingStateCode'; //CDP-
850
import getContacts from
'@salesforce/apex/NPIPhysicianSearchController.getContacts'; //CDP-850
import getNPIPhyData from
'@salesforce/apex/NPIPhysicianSearchController.getNPIPhyData'; //CDP-850
import createACR from
'@salesforce/apex/NPIPhysicianSearchController.createACR'; //CDP-850
import createExceptionLog from
'@salesforce/apex/NPIPhysicianSearchController.createExceptionLog'; //CDP-850//CDP-
5234
import getNeoServeNPIDetails from
'@salesforce/apex/NPIPhysicianSearchController.getNeoServeNPIDetails'; //CDP-5234
//Start CDP-4962/CDP-850
@track npiDisableValue;
@track sortBy;
@track sortDirection;
@track onloadSortDirection; //CDP-5234
@track neoServeCMData = null; //CDP-5234 //Store NeoServe NPI Details Custom
Metadata
statePicklistValues = [];
searchedNPIPhyData = [];
selectedNPIPhyData = [];
phyFieldsObj = {};
@track searchedInputFields = {};
disbaleSearchBtn = false;
showZeroMatches = false;
//Start PageNation Variables
showPagenation = false;
@track pageNumber = 1;
@track phyDTPagesize = 10;
@track totalPages = 0;
@track startingRecord = 1;
@track endingRecord = 0;
@track totalRecordCount = 0;
disableNextBtn = false;
disablePreviousBtn = false;
//End PageNation Variables
//End CDP-4962/CDP-850
/*** End CDP-3187 ***/
loadStyle(this, NeoStyleSheet);
/*** Start CDP-1748 ***/
this.omniJsonData = JSON.parse(this.omniJsonDataStr);
this.newPatientAccId = this.omniJsonData.newPatientAccId;
this.newPatientAccIdList = this.omniJsonData.newPatientAccIdList;
/*** End CDP-1748 ***/
let key = 'clientDataKey';
const state = this.omniGetSaveState(key);
/*** Start CDP-2274 ***/
if(this.omniJsonData.ContextId && !(state)){
var data = {
OrderId:this.omniJsonData.ContextId,
showFooter: false //CDP-2942
}
this.omniApplyCallResp(data);
this.prefillLoadFlag = true; //CDP-2942 to show spinner while data
loading
//adding await //CDP-2942
await
getClientData({orderRecId:this.omniJsonData.ContextId}).then(result=>{
if(result){
console.log('I am inside result');
this.onOrderClientData = result.SelectedClient;
this.selectedClient = result.SelectedClient;
this.oldSelectedClient = result.SelectedClient;
this.prevSelectedClient = result.SelectedClient;
this.selectedOrderingPhysician =
result.SelectedOrderingPhysicians;
this.oldSelectedOrdering = result.SelectedOrderingPhysicians;
this.oldSelectedTreating = result.SelectedTreatingPhysicians;
this.selectedTreatingPhysician =
result.SelectedTreatingPhysicians;
if (this.selectedOrderingPhysician.length > 0) {
this.showOrderingData = true;
this.showCopyButton = true;
}
if (this.selectedTreatingPhysician.length > 0) {
this.showTreatingData = true;
}
//CDP-2295 START
if(this.selectedClient){
// Map Additinal Distribution variable values of existing
Order
if(this.selectedClient?.Additional_Distribution_Acknowledgement__c ){
this.additionalDistributionAcknowledgement
=this.selectedClient.Additional_Distribution_Acknowledgement__c=='true' ?
true :false;
}else{
this.additionalDistributionAcknowledgement =false;
}
this.faxNumber = this.selectedClient?.Fax_Number__c ?
this.selectedClient.Fax_Number__c.toString() :'';
this.verifyFaxNumber =
this.selectedClient?.Verify_Fax_Number__c ?
this.selectedClient.Verify_Fax_Number__c.toString() :'';
if(this.faxNumber){
this.faxNumberPatternCheck();
this.verifyFaxNumberMatches();
}
this.orderComment =this.selectedClient?.Comments__c ?
this.selectedClient.Comments__c :'';
this.reportRecipientName =
this.selectedClient?.Report_Recipient_Name__c ?
this.selectedClient.Report_Recipient_Name__c :'';
}
//Map values in Data object to pass in OmniJSON
this.AdditionalDistribution.faxNumber=this.faxNumber;
this.AdditionalDistribution.verifyFaxNumber=this.verifyFaxNumber;
this.AdditionalDistribution.orderComment=this.orderComment;
this.AdditionalDistribution.reportRecipientName=this.reportRecipientName;
this.AdditionalDistribution.additionalDistributionAcknowledgement=this.additionalDi
stributionAcknowledgement;
// this.AdditionalDistribution.verifyFaxNumber=this.faxNumber;
//CDP-2295 END
}
}).catch(error=>{
console.log('I am inside error');
console.log(error);
//CDP-2942--START
this.prefillLoadFlag = false;
var data1 = {
showFooter: true
}
this.omniApplyCallResp(data1);
//CDP-2942---End
});
//CDP-2942--START
this.prefillLoadFlag = false;
var data1 = {
showFooter: true
}
this.omniApplyCallResp(data1);
//CDP-2942---End
console.log('I am inside 1st');
}
/*** End CDP-2274 ***/
else if (state) {
this.onOrderClientData = state.SelectedClient; //CDP-2274
this.prevSelectedClient = state.SelectedClient;
this.selectedClient = state.SelectedClient;
this.oldSelectedClient = state.SelectedClient;
this.selectedOrderingPhysician = state.SelectedOrderingPhysician;
this.oldSelectedOrdering = state.SelectedOrderingPhysician;
this.selectedTreatingPhysician = state.SelectedTreatingPhysician;
this.oldSelectedTreating = state.SelectedTreatingPhysician;
this.isSameAsOrdering = state.CheckBoxValue;
//CDP-2295 START
this.additionalDistributionAcknowledgement =
state.AdditionalDistribution?.additionalDistributionAcknowledgement ?
state.AdditionalDistribution.additionalDistributionAcknowledgement : false;
this.AdditionalDistribution = state.AdditionalDistribution;
this.faxNumber = state.AdditionalDistribution?.faxNumber ?
state.AdditionalDistribution.faxNumber : '';
this.verifyFaxNumber = state.AdditionalDistribution?.verifyFaxNumber ?
state.AdditionalDistribution.verifyFaxNumber : '';
this.orderComment=state.AdditionalDistribution.orderComment ?
state.AdditionalDistribution.orderComment : '';
this.reportRecipientName=state.AdditionalDistribution?.reportRecipientName ?
state.AdditionalDistribution.reportRecipientName :'';
this.isFaxPatternMatch=state.AdditionalDistribution?.isFaxPatternMatch ?
state.AdditionalDistribution.isFaxPatternMatch : this.isFaxPatternMatch;
this.isValidAdditionalDistData=state.AdditionalDistribution?.isValidAdditionalDistD
ata ? state.AdditionalDistribution.isValidAdditionalDistData :
this.isValidAdditionalDistData;
//CDP-2295 END
if (this.selectedTreatingPhysician.length > 0) {
this.showTreatingData = true;
}
if (this.selectedOrderingPhysician.length > 0) {
this.showOrderingData = true;
this.showCopyButton = true; //to retain the value on next/previous
screen
}
//CDP-2295 START
if(this.faxNumber){
this.faxNumberPatternCheck();
this.verifyFaxNumberMatches();
}
//CDP-2295 END
console.log('I am inside state');
}
else if(!(this.omniJsonData.ContextId) && !(state)){ //CDP-2988
//Call the apex to fetch the primary account
this.handleFetchPrimayAccount(); //CDP-2988
console.log('I am inside 3rd');
}
//CDP-4777 starts
this.highlightOPlookup = this.omniJsonData?.reachedReviewPage &&
this.selectedOrderingPhysician.length == 0 ? true :false;
this.highlightTPlookup = this.omniJsonData?.reachedReviewPage &&
this.selectedTreatingPhysician.length == 0 ? true :false;
//CDP-4777 ends
//CDP-2942--START
/*if (this.editButtonFlag) {
this.columns.push({
type: "button", initialWidth: 70, typeAttributes: {
label: 'Edit',
name: 'Edit',
title: 'Edit',
disabled: false,
value: 'Edit',
iconPosition: 'left',
variant: 'base'
}
})
}
if (this.removeButtonFlag) {
this.columns.push({
type: "button", initialWidth: 70, typeAttributes: {
label: 'Remove',
name: 'Remove',
title: 'Remove',
disabled: false,
value: 'Remove',
iconPosition: 'left',
variant: 'base'
}
});
}*/
//CDP-2942--END
//this.checkADRequiredFields(); //CDP-3817
}
this.template.querySelector('c-lwc_-custom-
lookup').handleSelectRecordAuto(this.prevSelectedClient,
this.prevSelectedClient.Account_number__c + ', ' + this.prevSelectedClient.Name);
}
this.hideLabel(); //CDP-3452
this.reduceSpaceForDatatable(); //CDP-4962
}
//Start CDP-4962/CDP-850
//Getting the MailingStateCode picklist field values from contact object
@wire(getPicklistValues, {
recordTypeId: '$getConObjectInfo.data.defaultRecordTypeId',
fieldApiName: MailingStateCode
})
wiredStates({ data, error }) {
if(data){
let controllerValue = 'US';
const key = data.controllerValues[controllerValue];
if(data.values){
let USStates = data.values.filter((opt) =>
opt.validFor.includes(key));
const states = USStates.map(statecode => statecode.value);
let stateCodes = [];
states.forEach(statecode => {
stateCodes.push({label: statecode, value: statecode});
})
this.statePicklistValues = [{label: '--None--', value:
null}, ...stateCodes];
}
}else if(error){
}
}
//End CDP-4962/CDP-850
if(JSON.stringify(this.oldSelectedClient) !=
JSON.stringify(this.selectedClient)){
var data = {
flagRetain: true
}
this.omniApplyCallResp(data);
this.flagRetain=true;
}
/*** End CDP-1748 ***/
/*** Start CDP-2274 ***/
else if(this.onOrderClientData){
if(JSON.stringify(this.onOrderClientData) ==
JSON.stringify(this.selectedClient)){
var data = {
flagRetain: false
}
this.omniApplyCallResp(data);
this.flagRetain=false;
}
}
/*** End CDP-2274 ***/
/*** Start CDP-1285 ***/
//Checking null condition and Storing AccountId value from SelectedClient
if (typeof this.selectedClient === 'object' && this.selectedClient !== null
&&
Object.keys(this.selectedClient).length > 0) { /*** Start CDP-1285 ***/
this.conAccountId = this.selectedClient.Id;/*** Start CDP-1285 ***/
this.showOrderingData = this.selectedOrderingPhysician.length > 0 ?
true : false;
this.showTreatingData = this.selectedTreatingPhysician.length > 0 ?
true : false;
this.selectedClientId = this.selectedClient.Id;
}
else {
/*** Start CDP-1748 ***/
if(this.newPatientAccIdList !== undefined ||
(this.newPatientAccIdList !== null)){
newCreatedPatientDeletion({ newPatientAccId:
this.newPatientAccIdList })
.then(result => {
if(result === true){
this.newPatientAccId=null;
this.newPatientAccIdList = null;
var data = {
newPatientAccId : this.newPatientAccId,
newPatientAccIdList :this.newPatientAccIdList
}
this.omniApplyCallResp(data);
}
}).catch(error => {
console.log(error);
});
}
}
//assign eventvalues to variables
if(nameEvent !='additionalDistributionAcknowledgement'){
this[event.target.name] = event.target.value; //Assign changed value to
variables
this.AdditionalDistribution[event.target.name] =
event.target.value; //assign value of event to varialble
this.checkADRequiredFields();
faxNumberPatternCheck(){
let inputCmpfax = this.template.querySelector('.fax');
const faxpattern = /^[0-9]{10}$/ ;
if(!this.faxNumber){
inputCmpfax.setCustomValidity('');
this.isFaxPatternMatch = true;
this.verifyFaxNumber ='';
this.checkADRequiredFields(); //CDP 3817
}
else if(!faxpattern.test(this.faxNumber)){
inputCmpfax.setCustomValidity('Fax Number must be 10 digits.');
this.isFaxPatternMatch = false;
}
else {
inputCmpfax.setCustomValidity('');
this.isFaxPatternMatch = true;
}
inputCmpfax.reportValidity();
}
faxPatternHandler(evt){
this.faxNumberPatternCheck();
}
verifyFaxNumberMatches(){
if(this.faxNumber != this.verifyFaxNumber){
this.template.querySelector('.VerifyFax').setCustomValidity('Fax number
must match');
this.verifyFaxCorrect=false;
}else{
this.template.querySelector('.VerifyFax').setCustomValidity('');
this.verifyFaxCorrect=true;
this.faxNumberPatternCheck();
}
this.template.querySelector('.VerifyFax').reportValidity();
this.disableVerifyFax = this.faxNumber ? false :true;
}
/****Start-CDP-1417****/
//Same As Ordering Physician Action Link Handler
actionLinkHandler(event) {
this.isSameAsOrdering = true;
if (this.isSameAsOrdering == true && this.selectedOrderingPhysician.length
> 0) {
this.showTreatingData = true;
this.selectedTreatingPhysician = [...this.selectedOrderingPhysician];
}
else {
this.showTreatingData = false;
this.selectedTreatingPhysician = [];
}
this.isSameAsOrdering = false;
this.highlightTPlookup =this.selectedTreatingPhysician.length == 0 ?
true :false; //CDP-4777
}
/****End-CDP-1417****/
/*** End CDP-433 ***/
//It loads when record edit form opens and making loading spinner false
handleLoad(event) {
this.showSpinner = false;
}
//**CDP-3187
//Start CDP-4962/CDP-850/CDP-5234
handleChangeAddPhyInputFields(event){
let fieldName = event.target.dataset.id;
let obj = JSON.parse(JSON.stringify(this.phyFieldsObj));
if(fieldName == 'npi'){
obj.NPI = this.getValue(event.target.value) != null ?
event.target.value : null;
//Validate the NPI Field
let npiField = this.template.querySelector('.npiField');
this.npiDisableValue = false;
this.handleInputFieldsValidity(npiField, npiField.value, null);
}else if(fieldName == 'firstName'){
obj.firstName = this.getValue(event.target.value) != null ?
event.target.value : null;
}else if(fieldName == 'lastName'){
obj.lastName = this.getValue(event.target.value) != null ?
event.target.value : null;
}else if(fieldName == 'statefield'){
obj.state = this.getValue(event.target.value) != null ?
event.target.value : null;
}else if(fieldName == 'cityField'){
obj.city = this.getValue(event.target.value) != null ?
event.target.value : null;
}else if(fieldName == 'zipCodeField'){
obj.zipCode = this.getValue(event.target.value) != null ?
event.target.value : null;
//Validate the ZipCode Field
let ZipCodeField = this.template.querySelector('.zipCode');
this.zipdisablevalue = false;
this.handleInputFieldsValidity(ZipCodeField, null, ZipCodeField.value);
}
handleSearchBtn(event){
this.showZeroMatches = false; //CDP-5234 Hide Zero Matches Message
this.selectedNPIPhyData = []; //Empty the Selected NPI Phy Datatable
this.handleEmptySelectedRows(); //CDP-5234 Empty the Selected Rows in NPI
Phy Datatable
this.disableAddPhysician = true; //Disable Add Physician Button
//Call the getNPIPhyData apex method and get the NPI response
getNPIPhyData({queryInfo: queryInfo})
.then(result => {
this.showSpinner = false; //Hide Loading Spinner
if(result){
for(var key in result){
if(key == 'Success'){
this.searchedNPIPhyData = []; //Empty the NPI Physician
Datatable
var npiInfo = JSON.parse(result[key]); //Get the NPI Info
if(npiInfo.inError == true){ //CDP-5234 Check Error From
NPI
let errorMessage = npiInfo.errorMessage != null ?
npiInfo.errorMessage : 'Unknown error in API response';
this.showNotification("Error!", errorMessage, "Error",
"dismissable"); //CDP-5234
this.handleCreateExceptionLog(errorMessage,
'ErrorFromNPI'); //CDP-5234
}else{
var npiResult = npiInfo.Results[0]; //NPI Results
//CDP-5234
let finalNpiResult = this.getValue(npiResult);
if(finalNpiResult == null){
this.searchedNPIPhyData = []; //Empty the Physician
Datatable
this.showZeroMatches = true; //Show Zero Matches
}else{
if(npiResult && npiResult.length > 0){
let totalNoOfRecords = 0;
//Check PageingInfomation
if(typeof npiInfo.pagingInformation ===
'object' && npiInfo.pagingInformation !== null &&
displayRecordPerPage(pageNumber, phyData) {
this.startingRecord = ((pageNumber - 1) * this.phyDTPagesize);
this.endingRecord = (this.phyDTPagesize * pageNumber);
this.endingRecord = (this.endingRecord > this.totalRecordCount) ?
this.totalRecordCount : this.endingRecord;
if(phyData.length > this.phyDTPagesize){
this.searchedNPIPhyData = phyData.slice(0, this.phyDTPagesize);
}else{
this.searchedNPIPhyData = phyData;
}
this.startingRecord = this.startingRecord + 1;
this.disablePreviousBtn = this.startingRecord == 1 ? true : false;
this.disableNextBtn = this.endingRecord == this.totalRecordCount ? true :
false;
}
//Handle Sorting
doSorting(event){
this.sortBy = event.detail.fieldName;
this.sortDirection = event.detail.sortDirection;
//Start CDP-5234
if(this.onloadSortDirection == 'asc'){
this.sortDirection = 'desc';
this.onloadSortDirection = null;
}
//End CDP-5234
this.sortData(this.sortBy, this.sortDirection);
}
sortData(fieldname, direction){
this.handleEmptySelectedRows(); //CDP-5234 Empty the Selected Rows in NPI
Phy Datatable
let parseData = JSON.parse(JSON.stringify(this.searchedNPIPhyData));
// Return the value stored in the field
let keyValue = (a) => {
return a[fieldname];
};
removeRow_nod(event) {
this.delRelPhyFlag = true; //CDP-2921
let relPhyRole = 'Ordering Physician'; //CDP-2921
let selectedOrderingPhysicianLocal = [];
let selectedTreatingPhysicianLocal = [];
let compName = event.detail.compName
if (compName == 'Ordering') {
for (let i = 0; i < this.selectedOrderingPhysician.length; i++) {
if (this.selectedOrderingPhysician[i].Id !== event.detail.rowIds) {
selectedOrderingPhysicianLocal.push(this.selectedOrderingPhysician[i]);
}
}
this.selectedOrderingPhysician = selectedOrderingPhysicianLocal;
this.isSameAsOrdering = false;
selectedTreatingPhysicianLocal.push(this.selectedTreatingPhysician[i]);
}
}
this.selectedTreatingPhysician = selectedTreatingPhysicianLocal;
this.isSameAsOrdering = false;
if(this.selectedTreatingPhysician.length<=0){
this.showTreatingData = false;
this.selectedTreatingPhysician = [];
this.highlightTPlookup =true; //CDP-4777
}
const childComponent = this.template.querySelector('[data-unique-
id="Treating"]');
childComponent.updateSelectedRecords(this.selectedTreatingPhysician);
}
//CDP-2921
this.deletePhysician(event.detail.rowIds, relPhyRole);
}
//CDP-2921
deletePhysician(phyConId, phyConRole) {
delRelPhysician({orderId : this.omniJsonData.OrderId, conId : phyConId,
conRole : phyConRole})
.then(result => {
this.delRelPhyFlag = false;
})
.catch(error => {
this.delRelPhyFlag = false;
console.log('error=>', error.body.message);
return;
});
}
}else{
this.highlightADSection = false;
}
}else{
this.highlightADSection = false;
}
this.checkADRequiredFields(); //CDP-3817
//CDP -3817 END
}
/*** End CDP-1655 ***/
){
}else{
console.log('inside AD else');
this.faxNumberMissing = '';
this.reportRecipientNameMissing = '';
this.additionalDistributionAcknowledgementMissing = '';
}
this.template.querySelector('.faxNumberReq').setCustomValidity(this.faxNumberMissin
g);
this.template.querySelector('.faxNumberReq').reportValidity();
this.template.querySelector('.reportRecipientNameReq').setCustomValidity(this.repor
tRecipientNameMissing);
this.template.querySelector('.reportRecipientNameReq').reportValidity();
this.template.querySelector('.additionalDistributionAcknowledgementReq').setCustomV
alidity(this.additionalDistributionAcknowledgementMissing);
this.template.querySelector('.additionalDistributionAcknowledgementReq').reportVali
dity();
}
//CDP -3817 end
//Start CDP-4962/CDP-850
//Handle Input Fields Validity
handleInputFieldsValidity(inputCmp, npiValue, zipCodeValue){
inputCmp.setCustomValidity('');
if(npiValue){
const npiPattern = /^[0-9]{10}$/;
if(npiValue.length === 0 || npiValue == null || npiValue == ''){
inputCmp.setCustomValidity('');
this.npiDisableValue = false;
}else if(!npiPattern.test(npiValue)){
inputCmp.setCustomValidity("NPI must be 10 digits.");
this.npiDisableValue = true;
}else{
inputCmp.setCustomValidity('');
this.npiDisableValue = false;
}
}else if(zipCodeValue){
inputCmp.setCustomValidity('');
this.zipdisablevalue = false;
if(isNaN(zipCodeValue) && zipCodeValue != null){
inputCmp.setCustomValidity("Zip code must be number.");
this.zipdisablevalue = true;
}
}
inputCmp.reportValidity();
}
//Start CDP-5234
//Empty the Selected Rows in NPI Phy Datatable
handleEmptySelectedRows(){
const phyDataTable = this.template.querySelector('.phyDataTable');
if(phyDataTable && phyDataTable.selectedRows.length > 0){
phyDataTable.selectedRows = [];
}
}
createCustomErrors(detail) {
let errorMessage = '';
if(detail){
if(detail.message){
if(detail.message.includes('An error occurred')){
errorMessage = 'An error occurred while trying to create the
record.';
}else{
errorMessage = detail.message;
}
}
if(detail.output){
if(detail.output.errors != null && detail.output.errors.length > 0)
{
let msg = '';
if(detail.output.errors[0].errorCode != null){
msg = "Error Code: " + detail.output.errors[0].errorCode;
}
if(detail.output.errors[0].message != null){
let message = "Message: " +
detail.output.errors[0].message;
msg += msg != '' ? ' '+message : message;
}
errorMessage += (errorMessage != '' && msg !='') ? ' '+msg :
msg;
}else if(typeof detail.output.fieldErrors === 'object' &&
detail.output.fieldErrors !== null &&
Object.keys(detail.output.fieldErrors).length > 0){
let fieldErrorMsg = '';
const fieldNames = Object.keys(detail.output.fieldErrors);
if(fieldNames.length > 0){
const errorsField =
detail.output.fieldErrors[fieldNames[0]];
if(errorsField && errorsField.length > 0){
fieldErrorMsg = "Field Error on " +
errorsField[0].field;
if(errorsField[0].errorCode != null){
let code = "Error Code: " +
errorsField[0].errorCode;
fieldErrorMsg += fieldErrorMsg != '' ? ' '+code :
code;
}
if(errorsField[0].message != null){
let msg = "Message: " + errorsField[0].message;
fieldErrorMsg += fieldErrorMsg != '' ? ' '+msg :
msg;
}
}
}
errorMessage += (errorMessage != '' && fieldErrorMsg != '') ? '
'+fieldErrorMsg : fieldErrorMsg;
}
}else if(detail.detail){
errorMessage += (errorMessage != '' && detail.detail != null) ? '
'+detail.detail : detail.detail;
}
}
return errorMessage;
}
createCallOutErrors(error) {
let errorMessage = '';
if(error){
if(error.message && error.message != null){
errorMessage = error.message;
}else{
if(error.status && error.status != null){
errorMessage = 'Status: '+ error.status;
}
if(error.body && error.body != null && error.body.message &&
error.body.message != null){
let bodyMsg = 'Message: '+error.body.message;
errorMessage += errorMessage != '' ? ' '+bodyMsg : bodyMsg;
}
if(error.statusText && error.statusText != null){
let statusText = 'StatusText: '+error.statusText;
errorMessage += errorMessage != '' ? ' '+statusText :
statusText;
}
}
}else{
errorMessage = 'An unknown error occurred.';
}
return errorMessage;
}
//End CDP-5234
reduceSpaceForDatatable(){
const addressInput = this.template.querySelector('.c-popup-table');
if (addressInput) {
const style = document.createElement('style');
style.innerText = `
.slds-has-button-menu .slds-th__action,
.slds-th__action {
padding: 0 0.4rem !important; /* Adjust padding as needed */
}
`;
this.template.appendChild(style);
}
}
//End CDP-4962/CDP-850
pressSearchMethod(){
this.toggleIt = true;
console.log('i m here 222');
}
}
<template>
<div class="c-wrapper c-select-client slds-p-bottom_small">
<article class="">
<!--//CDP-2942 Start-->
<template if:true={prefillLoadFlag}>
<lightning-spinner alternative-text="Loading"
size="small"></lightning-spinner>
</template>
<!--//CDP-2942 End-->
<!--CDP-2921 Start-->
<template if:true={delRelPhyFlag}>
<lightning-spinner alternative-text="Loading"
size="small"></lightning-spinner>
</template>
<!--CDP-2921 End-->
<fieldset class="slds-form-element slds-form-element_compound
slds-form-element_address">
<div class="slds-form-element__control">
<div class="slds-form-element__row">
<div class="slds-size_3-of-6 slds-p-around_x-
small">
<!-- <div class="slds-form-element"> -->
<label class="slds-form-
element__label" for="stacked-combobox-id-01"
id="combobox-label-id-
18"><abbr class="slds-required" title="required">* </abbr>
Client Name</label>
<div class="slds-form-
element__control">
<div class="slds-
combobox_container">
<div class="slds-
combobox slds-dropdown-trigger slds-dropdown-trigger_click">
<div class="slds-
combobox__form-element slds-input-has-icon slds-input-has-icon_right"
role="none">
<c-lwc_-
custom-lookup icon-name="standard:account" label=""
s-
object-api-name="account" recordtype="Approved"
prev-
client={prevSelectedClient} onlookupupdate={clientSelect}
objectname="Contact" onremove={removehandler}
onselected={handleOrderingPhysician} icon-name="standard:contact"
is-
disabled={disableOrderingPhysician}
selected-client-id-setter={selectedClientIdGetter}
selected-data={selectedOrderingPhysician}
onremoverowdd={removeRow_nod}>
</c-lwc_dynamic-
Datatable>
</div>
</div>
</div>
</div>
</div>
</template>
<!--Ordering Physician Datatable END-->
<div class="slds-form-element__row">
<div class="slds-size_3-of-6 slds-p-around_x-
small">
<!-- <div class="slds-form-element"> -->
<div class="slds-clearfix ">
<div class="slds-float_left">
<label class="slds-form-
element__label" for="combobox-id-3"
id="combobox-
label-id-34"><abbr class="slds-required" title="required">*
</abbr>
Treating
Physician</label>
</div>
<template
if:true={showCopyButton}>
<div class="c-
show_contents slds-p-bottom_xx-small">
<lightning-button
variant="base" label="Copy over Ordering Physician"
title="Click
to copy values from Ordering Physician to Treating Physician"
onrefresh={onRfreshHandler} highlight-lookup={highlightTPlookup}
selected-data={selectedTreatingPhysician}
require-validate ={requiredValidateTreating}
is-
disabled={disableTreatingPhysician}
selected-client-id-setter={selectedClientIdGetter}
show-
list-records-available={toggleIt} onnew={handlePhyRecordCreation} module-
type="NewTreatingOrder"
data-
label="1">
</c-lwc_-
multi-select-lookup>
</div>
</div>
</div>
</div>
<!-- </div> -->
</div>
</div>
<!--Treating Physician Datatable START-->
<template if:true={showTreatingData}>
<div class="slds-form-element__row">
<div class="slds-size_6-of-6 slds-p-
around_x-small">
<div class="slds-form-element">
<div class="slds-form-element">
<div class="c-table-
container">
<h3 class="slds-p-
bottom_x-small">Selected Treating Physician</h3>
<c-lwc_dynamic-Datatable
page-size={pagesize} columns-data={columns}
comp-
name="Treating" lst-result={selectedTreatingPhysician} hide-checkbox
onremoverowdd={removeRow_nod}>
</c-lwc_dynamic-
Datatable>
</div>
</div>
</div>
</div>
</div>
</template>
<!--Treating Physician Datatable END-->
<!-- <div class="slds-form-element__control"> -->
<div class="slds-form-element__row">
<h1 class="slds-text-title_bold slds-p-
horizontal_x-small slds-p-top_x-small slds-p-bottom_xx-small" aria-live="polite"
tabindex="0" lwc-
314pbdlkbi2="">Additional Distribution</h1>
</div>
<!-- <div class="slds-p-bottom_small"> -->
<div class="slds-form-element__row">
<div class="slds-size_3-of-6 slds-p-
around_x-small">
<!-- <div class="slds-form-
element"> -->
<div class="slds-form-
element">
<label class="slds-form-
element__label" for="form-element-id-03">Report Recipient
Name</label>
<div class="slds-form-
element__control">
<lightning-input
type="text" id="reportRecipientName" name="reportRecipientName" maxlength="255"
class="reportRecipientNameReq"
</div>
<div class="slds-size_3-of-6 slds-p-
around_x-small">
<div class="slds-form-element">
<label class="slds-form-
element__label" for="form-element-id-03">Verify Fax
Number</label>
<div class="slds-form-
element__control">
<lightning-input
type="text" id="verifyFaxNumber" name="verifyFaxNumber" variant="label-hidden"
class="VerifyFax" maxlength="10"
</div>
<div class="slds-form-element__row">
<div class="slds-form-element">
<div class="slds-size_6-of-6 slds-
p-horizontal_x-small">
<div>
<!-- <lightning-input
type="checkbox" name="additionalDistributionAcknowledgement"
id="additionalDistributionAcknowledgement" onchange={additionalDistributionHandler}
value={additionalDistributionAcknowledgement}
checked={additionalDistributionAcknowledgement} variant="label-hidden">
</lightning-input>
<label class="slds-
checkbox__label" for="additionalDistributionAcknowledgement">
<span class="slds-
checkbox_faux"></span>
<span class="slds-
form-element__label"> I acknowledge that the fax number
associated
with the above healthcare provider, which I have entered, is
accurate and
current.</span>
</label> -->
<lightning-input
type="checkbox" name="additionalDistributionAcknowledgement"
id="additionalDistributionAcknowledgement" onchange={additionalDistributionHandler}
label={additionalDistributionAcknowledgementLabel}
class="additionalDistributionAcknowledgementReq"
value={additionalDistributionAcknowledgement}
checked={additionalDistributionAcknowledgement} >
</lightning-input>
</div>
</div>
</div>
</div>
<!-- </div> -->
</div>
</fieldset>
</article>
</div>
<lightning-record-edit-form object-api-name="Contact"
onsuccess={handleSuccess}
onsubmit={handleSavePhysician}
onload={handleLoad} onerror={handleError}>
<div class="slds-modal__content slds-p-
around_small slds-scrollable_y" id="modal-content-id-2">
<div class="slds-form-element slds-form-
element_compound slds-form-element_address">
<div class="slds-form-
element__control">
<div class="slds-form-
element__row">
<div class="slds-
size_12-of-12 slds-p-horizontal_small slds-p-top_none">
<h2 class="c-
modal-body-title">Search NPI Database</h2>
</div>
</div>
onchange={handleChangeAddPhyInputFields} variant="label-hidden"
max-
length="10" class="npiField">
</lightning-
input>
</div>
</div>
<div class="slds-size_4-
of-12 slds-p-horizontal_x-small slds-p-vertical_xx-small">
<label
class="slds-form-element__label slds-p-left_xx-small" for="stacked-input-id-02">
First Name
</label>
<div class="slds-
form-element__control">
<lightning-
input type="text" placeholder="Type here"
data-
id="firstName" onchange={handleChangeAddPhyInputFields}
variant="label-hidden" max-length="40">
</lightning-
input>
</div>
</div>
<div class="slds-size_4-
of-12 slds-p-horizontal_x-small slds-p-vertical_xx-small">
<label
class="slds-form-element__label slds-p-left_xx-small" for="stacked-input-id-03">
Last Name
</label>
<div class="slds-
form-element__control">
<lightning-
input type="text" placeholder="Type here"
data-
id="lastName" onchange={handleChangeAddPhyInputFields}
variant="label-hidden" max-length="80">
</lightning-
input>
</div>
</div>
</div>
<div class="slds-form-
element__row">
<div class="slds-size_4-
of-12 slds-p-horizontal_x-small slds-p-vertical_xx-small">
<label
class="slds-form-element__label slds-p-left_xx-small" for="stacked-input-id-05">
City
</label>
<div class="slds-
form-element__control">
<lightning-
input type="text" placeholder="Type here"
data-
id="cityField" variant="label-hidden"
onchange={handleChangeAddPhyInputFields} max-length="40">
</lightning-
input>
</div>
</div>
<div class="slds-size_4-
of-12 slds-p-horizontal_x-small slds-p-vertical_xx-small">
<label
class="slds-form-element__label slds-p-left_xx-small" for="stacked-input-id-06">
State
</label>
<div class="slds-
form-element__control">
<lightning-
combobox label="State" options={statePicklistValues}
data-
id="statefield" variant="label-hidden" placeholder="Select"
onchange={handleChangeAddPhyInputFields}>
</lightning-
combobox>
</div>
</div>
<div class="slds-size_4-
of-12 slds-p-horizontal_x-small slds-p-vertical_xx-small">
<label
class="slds-form-element__label slds-p-left_xx-small" for="stacked-input-id-07">
ZIP Code
</label>
<div class="slds-
form-element__control">
<lightning-
input type="text" placeholder="Type here"
data-
id="zipCodeField" variant="label-hidden"
class="zipCode" onchange={handleChangeAddPhyInputFields}
max-
length="20">
</lightning-
input>
</div>
</div>
</div>
<!-- Input Fields End -->
<!-- Search Button Start -->
<div class="slds-form-
element__row">
<div class="slds-size_1-
of-6 slds-p-around_x-small">
<div class="slds-
form-element">
<button
title="Search Patient" type="button" disabled={disbaleSearchBtn}
onclick={handleSearchBtn}>
Search
</button>
</div>
</div>
</div>
<!-- Search Button End -->
<!-- Selected Physician
Datatable Start -->
<template
if:true={selectedNPIPhyData.length}>
<div class="slds-form-
element__row">
<div class="slds-
size_6-of-6 slds-p-bottom_x-small slds-p-top_xx-small slds-p-horizontal_x-small">
<div
class="slds-form-element">
<div
class="c-table-container">
<div class="c-table-spacing">
</lightning-datatable>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<!-- Selected Physician
Datatable End -->
<template
if:true={searchedNPIPhyData.length}>
<div class="slds-form-
element__row">
<div class="slds-
size_6-of-6 slds-p-vertical_x-small slds-p-horizontal_x-small">
<div
class="slds-form-element">
<!--
PageNation Start -->
<template if:true={showPagenation}>
<span class="slds-p-around_x-small">
<lightning-button variant="base" label="Previous" icon-
name="utility:chevronleft"
onclick={previousHandler} disabled={disablePreviousBtn}
class="slds-m-left_x-small c-pagination-btn">
</lightning-button>
</span>
</span>
<span class="slds-p-around_x-small">
icon-position="right" onclick={nextHandler}
disabled={disableNextBtn}
class="c-pagination-btn">
</lightning-button>
</span>
</div>
</template>
<!--
PageNation End -->
<!--
Matched Physician Datatable Start -->
<div
class="c-table-container">
<div class="c-table-spacing">
data={searchedNPIPhyData} columns={physicianColumns}
sorted-by={sortBy} sorted-direction={sortDirection}
onsort={doSorting} max-row-selection="1"
resize-column-disabled onrowselection={handleRowSelection}>
</lightning-datatable>
</div>
</div>
</div>
<!--
Matched Physician Datatable End -->
</div>
</div>
</div>
</template>
<template
if:true={showZeroMatches}>
<h3 class="slds-text-
heading_small slds-p-around_x-small slds-m-top_small">Zero Matches</h3>
</template>
</div>
</div>
</div>
<footer class="slds-modal__footer slds-p-
around_small">
<lightning-button variant="brand"
type="submit" label="Add Physician"
disabled={disableAddPhysician}>
</lightning-button>
</footer>
</lightning-record-edit-form>
</div>
</section>
<div class="slds-backdrop slds-backdrop_open"
role="presentation"></div>
</div>
</template>
<!--End CDP-4961/CDP-850-->
</template>
.slds-modal__content{
max-height: 70vh;
}
.c-custom-card {
border: 0.063rem solid #d8dde6; /* light grey border */
box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.1); /* shadow */
background: #F9FDFF;
}
.VerifyFax .slds-has-error .slds-input:focus{
--slds-c-input-shadow: var(--slds-g-color-error-base-40, var(--lwc-
colorBorderError, rgb(234, 0, 30))) 0 0 0 var(--lwc-borderWidthThin, 1px) inset,
var(--_slds-g-shadow-outline-focus, var(--lwc-shadowButtonFocus, 0 0 3px
#66d301)) !important;
}
.c-select-client{
overflow: initial !important;
}
/*Start CDP-4962*/
.c-dynamicDataTable{
border: 1px solid #d4d4d4;
}
.c-disable-button:disabled {
background-color: #c9c9c9 !important; /*Adjust the color as needed */
cursor: not-allowed;
}
.c-disable-button:disabled:hover {
background-color: #c9c9c9 !important; /* Ensure it remains the same color on
hover */
border-color: #c9c9c9 !important;
color: #ffffff /* Ensure border color remains the same on hover */
}
/*End CDP-4962*/
<?xml version="1.0"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>57.0</apiVersion>
<isExposed>true</isExposed>
<runtimeNamespace>omnistudio</runtimeNamespace>
<targets>
<target>lightning__RecordPage</target>
<target>lightning__AppPage</target>
<target>lightning__HomePage</target>
<target>lightning__Tab</target>
<target>lightningCommunity__Page</target>
</targets>
</LightningComponentBundle>