0% found this document useful (0 votes)
39 views43 pages

Client LWC

Uploaded by

sauravgodbole
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views43 pages

Client LWC

Uploaded by

sauravgodbole
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

/

***********************************************************************************
**************
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

export default class LwcNewOrderSelectClientDetails extends


OmniscriptBaseMixin(LightningElement) {
columns = [
{ label: 'Name', fieldName: 'Name',wrapText:true,hideDefaultActions:
true },
{ label: 'NPI Number', fieldName:
'NPI__c',wrapText:true,hideDefaultActions: true },
{
type: "button", initialWidth: 70, typeAttributes: {label: 'Remove',name:
'Remove',title: 'Remove',
disabled: false,value: 'Remove',iconPosition: 'left',variant: 'base'
}
}//CDP-2942
];

//Physician Datatable Columns //CDP-4962


physicianColumns = [{label: 'Last Name', fieldName: 'LastName', type:"text",
sortable: "true", wrapText:true, hideDefaultActions: true},
{label: 'First Name', fieldName: 'FirstName', type:"text", wrapText:true,
hideDefaultActions: true},
{label: 'NPI Number', fieldName: 'NPI', type:"text", wrapText:true,
hideDefaultActions: true, initialWidth: 100},
{label: 'City', fieldName: 'MailingCity', type:"text", wrapText:true,
hideDefaultActions: true},
{label: 'State', fieldName: 'MailingState', type:"text", wrapText:true,
hideDefaultActions: true, initialWidth: 80},
{label: 'Zip', fieldName: 'MailingZip', type:"text", wrapText:true,
hideDefaultActions: true, initialWidth: 160}
];
//Selected Physician Datatable Columns //CDP-4962
selectedPhysicianColumns = [{label: 'Last Name', fieldName: 'LastName',
wrapText:true, hideDefaultActions: true},
{label: 'First Name', fieldName: 'FirstName', wrapText:true,
hideDefaultActions: true},
{label: 'NPI Number', fieldName: 'NPI', wrapText:true, hideDefaultActions:
true, initialWidth: 100},
{label: 'City', fieldName: 'MailingCity', wrapText:true,
hideDefaultActions: true},
{label: 'State', fieldName: 'MailingState', wrapText:true,
hideDefaultActions: true, initialWidth: 80},
{label: 'Zip', fieldName: 'MailingZip', wrapText:true, hideDefaultActions:
true, initialWidth: 160}
];

@track selectedClient = {};


@track selectedOrderingPhysician = [];
@track showOrderingData = false;
@track showCopyButton = false; //CDP-1417

@track selectedTreatingPhysician = [];


@track showTreatingData = false;
@track isSameAsOrdering = false;

@track oldTreatingData = [];


@track prevSelectedClient = '';
@track oldSelectedOrdering = [];
@track oldSelectedTreating = [];
retainOldValue = true;
editButtonFlag = false;
removeButtonFlag = true;
pagesize = PageSize;
/*** Start CDP-1285 ***/
@track conAccountId = '';
@track showNewPhyRcrdForm = false;
@track showSpinner = false;
//@track clinicalContactRectpId; //CDP-2173
@track cdpclinicalContactRectpId; //CDP-2173
/*** End CDP-1285 ***/
/*** Start CDP-3187 ***/
disableAddPhysician = false;
@track zipdisablevalue;

//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 ***/

/*** Start CDP-3186 ***/


@track profileName = '';
/*** End CDP-3186 ***/

/*** Start CDP-854 ***/


/*** Start CDP-1748 ***/
@track selectedValues = [];
@track selectedClientId;
@track newPatientAccId ;
@track newPatientAccIdList = [];
@track omniJsonData;
/*** End CDP-1748 ***/
/*** end CDP-854 ***/
/*** Start CDP-857 ***/
@api orderid;
@api recordId;
/*** Start CDP-1748 ***/
flagRetain = false;
retainOldValue1 = true;
//oldSelectedClient;
@track oldSelectedClient = {};
/*** End CDP-1748 ***/
onOrderClientData={};//CDP-2274

/*** Start CDP-1655 ***/


@track highlightClientSection = false;
@track highlightOPSection = false;
@track highlightTPSection = false;
/*** End CDP-1655 ***/

@track prefillLoadFlag = false;//CDP-2942


delRelPhyFlag = false; //CDP-2921

/***Start variables CDP 2295 */


@track AdditionalDistribution ={}; //store data of additional Dist
@track additionalDistributionAcknowledgement=false; //fax values
acknowledgement
@track faxNumber='';
@track verifyFaxNumber='';
@track verifyFaxCorrect=true;
@track orderComment='';
@track reportRecipientName='';
@track isFaxPatternMatch=true;
@track isValidAdditionalDistData=true;
@track disableVerifyFax=false;
@track
additionalDistributionAcknowledgementLabel=Additional_Distribution_Acknowledgement;
/***END variables CDP 2295 */
/***Start variables CDP 3817 */
@track highlightADSection = false; //CDP3817
@track faxNumberMissing = '';
@track reportRecipientNameMissing = '';
@track additionalDistributionAcknowledgementMissing = '';
/***END variables CDP 3817 */
highlightOPlookup; //4777
highlightTPlookup; //4777
@track toggleIt =false;
//Connected Callback to reintialize the data with previous selected values when
previous button is clicked
async connectedCallback() {

console.log('i m here 333');

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
}

//Rendered Callback to store changed Data on the Client screen


renderedCallback() {
console.log('Inside rendered call back');
/*** Start CDP-1655 ***/
//Function to perform validations
this.validateRequiredFields();
/*** End CDP-1655 ***/
//CDP-2295
if(this.faxNumber){
// this.faxNumberPatternCheck();
this.verifyFaxNumberMatches();
}else{
this.disableVerifyFax=true;
}
//CDP-2295 END
//sending data to OmniJson
var data = {
SelectedClient: this.selectedClient,
SelectedOrderingPhysician: this.selectedOrderingPhysician,
SelectedTreatingPhysician: this.selectedTreatingPhysician,
CheckBoxValue: this.isSameAsOrdering,
highlightClientSection: this.highlightClientSection, //CDP-1655
highlightOPSection: this.highlightOPSection, //CDP-1655
highlightTPSection: this.highlightTPSection, //CDP-1655
highlightADSection:this.highlightADSection, //CDP-3817
AdditionalDistribution: this.AdditionalDistribution //CDP-4013
}
this.omniApplyCallResp(data);

//reintializing the Selected Client with previous value when clicked On


Previous button
if (typeof this.prevSelectedClient === 'object' &&
this.prevSelectedClient !== null &&
Object.keys(this.prevSelectedClient).length > 0 && this.retainOldValue
== true) {
this.retainOldValue = false;

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
}

//Disconnected Callback to store data when component is moved out of DOM


disconnectedCallback() {
let clientPhysicianData = {
"SelectedClient": this.selectedClient,
"SelectedOrderingPhysician": this.selectedOrderingPhysician,
"SelectedTreatingPhysician": this.selectedTreatingPhysician,
"CheckBoxValue": this.isSameAsOrdering,
"AdditionalDistribution":this.AdditionalDistribution //CDP-2295
};
let key = 'clientDataKey';
let usePubSub = true;
this.omniSaveState(clientPhysicianData, key, usePubSub);
}
/*** End CDP-857 ***/

/*** Start CDP-1285 ***/


//Retrieve the contact object info
@wire(getObjectInfo, { objectApiName: Contact_OBJECT })
getConObjectInfo;
/*** End CDP-1285 ***/

/*** Start CDP-3186 ***/


@wire(getRecord, {recordId: UserId, fields: [PROFILE_NAME_FIELD]})
currentUserInfo({error, data}) {
if(data){
if(data.fields.Profile.value != null){
this.profileName = data.fields.Profile.value.fields.Name.value;
}
}else if(error){
}
}
/*** End CDP-3186 ***/

//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

/*** Start CDP-5234 ***/


//Get NeoServe NPI Details Custom MetaData
@wire(getNeoServeNPIDetails)
NeoServeDetailsCMD({error, data}) {
if(data){
this.neoServeCMData = data != null ? data : null;
}else if(error){}
}
/*** End CDP-5234 ***/

/*** Start CDP-433 ***/


//Client Selection Handler
clientSelect(event) {
/*** Start CDP-1748 ***/
this.selectedClient = event.detail.selectedRecord; //sending data to
omniJson

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);

});
}

this.conAccountId = '';/*** Start CDP-1285 ***/


this.showOrderingData = false;
this.showTreatingData = false;
this.selectedOrderingPhysician = [];
this.selectedTreatingPhysician = [];
this.selectedClientId = undefined;
this.showCopyButton = false;

const childComponent1 = this.template.querySelector('[data-unique-


id="Ordering"]');
childComponent1.updateSelectedRecords(this.selectedOrderingPhysician);

const childComponent2 = this.template.querySelector('[data-unique-


id="Treating"]');
childComponent2.updateSelectedRecords(this.selectedTreatingPhysician);
}
/*** End CDP-1748 ***/
/*** End CDP-1285 ***/
var data = {
SelectedClient: this.selectedClient
}
this.omniApplyCallResp(data);
}

// Sending selected client ID to lwc_multiselect_lookup


get selectedClientIdGetter() {
return this.selectedClientId;
}

// disabling Ordering Physician


get disableOrderingPhysician() {
return (this.selectedClientId === undefined || this.selectedClientId ===
'undefined' || !this.selectedClientId) ? true :
this.selectedOrderingPhysician.length > 4 ? true : false;
}

// disabling Treating Physician


get disableTreatingPhysician() {
return (this.selectedClientId === undefined || this.selectedClientId ===
'undefined' || !this.selectedClientId) ? true :
this.selectedTreatingPhysician.length > 4 ? true : false;
}

//Ordering Physician Selection Handler


handleOrderingPhysician(event) {
if (this.selectedOrderingPhysician.length < 5) {
this.showOrderingData = false;
this.selectedOrderingPhysician = [...event.detail.selRecords];
if (this.selectedOrderingPhysician.length > 0) {
this.showOrderingData = true;
this.showCopyButton = true; //CDP-1417
}else if (this.selectedOrderingPhysician.length <= 0) {
this.showOrderingData = false;
}
if (this.isSameAsOrdering == true &&
this.selectedOrderingPhysician.length > 0) {
this.showTreatingData = true;
this.selectedTreatingPhysician = this.selectedOrderingPhysician;
} else if (this.isSameAsOrdering == true &&
this.selectedOrderingPhysician.length <= 0) {
this.showTreatingData = false;
this.selectedTreatingPhysician = this.selectedOrderingPhysician;
}
}
this.highlightOPlookup = this.selectedOrderingPhysician.length == 0 ?
true :false; //CDP -4777
}

//Treating Physician Selection Handler


handleTreatingPhysician(event) {
this.showTreatingData = false;
this.selectedTreatingPhysician = [...event.detail.selRecords];
if(this.selectedTreatingPhysician.length >0){
this.showTreatingData = true;
}
if(this.isSameAsOrdering == true && this.selectedOrderingPhysician.length
>0){
this.showTreatingData = true;
this.selectedTreatingPhysician = [...this.selectedOrderingPhysician];
return;
}
this.highlightTPlookup = this.selectedTreatingPhysician.length == 0 ?
true :false; //CDP 4777
}

//CDP-2295 Additional distribution Input variables change event


additionalDistributionHandler(event){
const nameEvent = event.target.name; //get event name
//For fax Number and Verify fax number only keeps numbers
if(nameEvent =='faxNumber' || nameEvent =='verifyFaxNumber'){
const faxNumWithAllformat = event.target.value;
const onlyDigits = faxNumWithAllformat.replace(/[^0-9]/g, '');
event.target.value = onlyDigits;

}
//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();

}else if(nameEvent =='additionalDistributionAcknowledgement'){


this[event.target.name] =event.target.checked; //assign checkbox value
this.AdditionalDistribution[event.target.name]
=event.target.checked; //assign checkbox value
}
//fax data validation checks
if(nameEvent =='faxNumber' ){
//Custom validations to check fax number validity
if(!this.faxNumber){
this.disableVerifyFax = true;
this.verifyFaxNumber = '';
this.AdditionalDistribution.verifyFaxNumber ='';
}else{
this.disableVerifyFax=false;
}
if(!this.faxNumber || this.faxNumber.length ==10){
this.faxNumberPatternCheck();
}else{
this.isFaxPatternMatch = false; //CDP-3817
}
this.verifyFaxNumberMatches();
}
else if(nameEvent =='verifyFaxNumber'){
this.faxNumberPatternCheck();
this.verifyFaxNumberMatches();
}
this.isValidAdditionalDistData =(this.isFaxPatternMatch &&
this.verifyFaxCorrect) ? true: false;
this.AdditionalDistribution.isValidAdditionalDistData
=this.isValidAdditionalDistData ;

//get data and pass it to omniscript CDP-2295


let data = {
AdditionalDistribution :this.AdditionalDistribution,
}
this.omniApplyCallResp(data);
}

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 ***/

/*** Start CDP-1285 ***/


//To get to know from where we are clicking on create new ordering and treaing
physician
@track newtargetvalue = 0;

//Opening record edit form


handlePhyRecordCreation(event) {
this.newtargetvalue = event.target.dataset.label;
if (this.conAccountId !== null && this.conAccountId != '') {
this.showSpinner = true;
this.showNewPhyRcrdForm = true;
//let clinicalContactRectpe; //CDP-2173
let cdpclinicalContactRectpe; //CDP-2173
if (this.getConObjectInfo.data) {
let recordTypeInfo = this.getConObjectInfo.data.recordTypeInfos;
if (recordTypeInfo) {
for (let i in recordTypeInfo) {
if (recordTypeInfo[i].name == "CDP Clinical Contact" &&
recordTypeInfo[i].available == true) {
cdpclinicalContactRectpe =
recordTypeInfo[i].recordTypeId;
}
}
}
this.cdpclinicalContactRectpId = cdpclinicalContactRectpe;
}
} else {
this.showNotification("Error!", "Please select Client Name", "Error",
"dismissable");
}
/*** Start CDP-3187 ***/
//Start CDP-4962/CDP-850/CDP-5234
this.phyFieldsObj = {
NPI: null, firstName: null, lastName: null, city: null, state: null,
zipCode: null,
numberOfEntriesPerPage: this.phyDTPagesize, desiredPageNumber: 1
}
this.disbaleSearchBtn = false; //Enable Search Button
this.disableAddPhysician = true; //Disable Add Physician Button
this.showZeroMatches = false; //Hide Zero Matches Message
this.searchedNPIPhyData = []; //Empty the NPI Phy Datatable
this.selectedNPIPhyData = []; //Empty the Selected NPI Phy Datatable
this.searchedInputFields = this.phyFieldsObj;
//End CDP-4962/CDP-850
/*** End CDP-3187 ***/
}

//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);
}

if(!this.zipdisablevalue && !this.npiDisableValue){


this.disbaleSearchBtn = false;
}else{
this.disbaleSearchBtn = true;
}
this.phyFieldsObj = obj;
}

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

let fieldsObj = this.phyFieldsObj;


this.searchedInputFields = this.phyFieldsObj;
//Check If there is any value in atleast one of the input search fields.
if(this.getValue(fieldsObj.NPI) == null &&
this.getValue(fieldsObj.firstName) == null &&
this.getValue(fieldsObj.lastName) == null &&
this.getValue(fieldsObj.state) == null &&
this.getValue(fieldsObj.city) == null &&
this.getValue(fieldsObj.zipCode) == null){
this.showNotification("Error!", "At least one field is required to
search.", "Error", "dismissable");
this.searchedNPIPhyData = []; //Empty the NPI Physician Datatable
}else{
this.searchPhyData('Search', 1, fieldsObj); //Call the getNPIPhyData
Apex callout Method
}
}

//Handle Previous Button Functionality


previousHandler(){
this.handleEmptySelectedRows(); //CDP-5234 Empty the Selected Rows in NPI
Phy Datatable
if(this.pageNumber > 1){ //Check the pagenumber
let pageNumber = this.pageNumber - 1;
let searchedInputFields = {...this.searchedInputFields,
numberOfEntriesPerPage: this.phyDTPagesize,
desiredPageNumber: pageNumber
};
this.searchPhyData('Previous', pageNumber, searchedInputFields);
}
}

//Handle Next Button Functionality


nextHandler(){
this.handleEmptySelectedRows(); //CDP-5234 Empty the Selected Rows in NPI
Phy Datatable
if((this.pageNumber < this.totalPages) && this.pageNumber !==
this.totalPages) { //Check the pagenumber
let pageNumber = this.pageNumber + 1;
let searchedInputFields = {...this.searchedInputFields,
numberOfEntriesPerPage: this.phyDTPagesize,
desiredPageNumber: pageNumber
};
//Call the getNPIPhyData callout Apex Method
this.searchPhyData('Next', pageNumber, searchedInputFields);
}
}
//Truncate the field length
handleTruncate(field, fieldLength){
if(field && field != null && field != undefined && field != '' && field !=
""){
if(field && field.length > fieldLength){
return field.substring(0, fieldLength);
}else{
return field;
}
}else{
return null;
}
}

searchPhyData(btnName, currentPageNo, queryInfo){


this.showSpinner = true; //Show Loading Spinner
this.showZeroMatches = false; //Hide Zero Matches

//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 &&

Object.keys(npiInfo.pagingInformation).length > 0){ //CDP-5234


var pageInfo =
npiInfo.pagingInformation; //NPI PageInfo //CDP-5234
//CDP-5234 Total No Of Entries
totalNoOfRecords = (pageInfo.totalEntries
&& pageInfo.totalEntries != null ) ? pageInfo.totalEntries : 0;
}
this.totalRecordCount = totalNoOfRecords;
this.totalPages =
Math.ceil(this.totalRecordCount / this.phyDTPagesize); //Get Total Pages
let phyData = [];
if(this.neoServeCMData != null){
let cmdt = this.neoServeCMData;
for(let i=0; i< npiResult.length; i++){
let newData = new Object();
//CDP-5234 Modified Fields Mapping
newData.NPI =
this.handleTruncate(npiResult[i][cmdt.NPI__c], cmdt.NPILength__c);
newData.FirstName =
this.handleTruncate(npiResult[i][cmdt.FirstName__c], cmdt.FirstNameLength__c);
newData.LastName =
this.handleTruncate(npiResult[i][cmdt.LastName__c], cmdt.LastNameLength__c);
newData.MiddleName =
this.handleTruncate(npiResult[i][cmdt.MiddleName__c], cmdt.MiddleNameLength__c);
newData.MailingZip =
this.handleTruncate(npiResult[i][cmdt.PostalCode__c], cmdt.PostalCodeLength__c);
newData.MailingCity =
this.handleTruncate(npiResult[i][cmdt.City__c], cmdt.CityLength__c);
newData.MailingStreet1 =
this.getValue(npiResult[i][cmdt.FirstLineAddress__c]);
newData.MailingStreet2 =
this.getValue(npiResult[i][cmdt.SecondLineAddress__c]);
let npiState =
this.getValue(npiResult[i][cmdt.State__c]);
//Check NPI State Exists or not in
Salesforce
let sfStates =
this.statePicklistValues.length > 0 ? this.statePicklistValues : [];
let isStateExists = npiState != null &&
sfStates.length > 0 && sfStates.some(value => value.label === npiState);
newData.MailingState = isStateExists &&
npiState != null ? npiState : null;
phyData.push(newData);
}
}
if(btnName =='Search'){
if(phyData.length > this.phyDTPagesize)
{ //Check if PhyData length is greaterthan pagesize
this.searchedNPIPhyData =
phyData.slice(0, this.phyDTPagesize);
}else{
this.searchedNPIPhyData = phyData;
}
this.startingRecord = 1;
this.endingRecord = phyData.length <
this.phyDTPagesize && this.totalRecordCount < this.phyDTPagesize ? phyData.length :
this.phyDTPagesize;
this.pageNumber = 1;

if(totalNoOfRecords > this.phyDTPagesize){


this.showPagenation = true;
}else if(totalNoOfRecords <=
this.phyDTPagesize){
this.showPagenation = false;
}
this.disablePreviousBtn =
this.startingRecord == 1 ? true : false;
this.disableNextBtn = this.endingRecord ==
this.totalRecordCount ? true : false;
}else if(btnName =='Next'){
this.displayRecordPerPage(currentPageNo,
phyData);
this.pageNumber = this.pageNumber + 1;
}else if(btnName =='Previous'){
this.displayRecordPerPage(currentPageNo,
phyData);
this.pageNumber = this.pageNumber - 1;
}
this.sortDirection = 'asc';
this.sortData('LastName', this.sortDirection);
this.onloadSortDirection = 'asc'; //CDP-5234
}else{
this.searchedNPIPhyData = [];
this.showZeroMatches = true;
}
}
}
}else if(key == 'ErrorFromNPI'){
this.searchedNPIPhyData = [];
this.showNotification("Error!", result[key], "Error",
"dismissable"); //CDP-5234
}else if(key == 'Error'){
this.searchedNPIPhyData = [];
this.showNotification("Error!", "Search timed out. Please
try again.", "Error", "dismissable"); //CDP-5234
}
}
}else{
this.searchedNPIPhyData = [];
this.showZeroMatches = true;
}
})
.catch(error => {
this.showSpinner = false;
this.searchedNPIPhyData = [];
this.showNotification("Error!", "Search timed out. Please try again.",
"Error", "dismissable");
let errorMessage = this.createCallOutErrors(error != null ? error :
null);
this.handleCreateExceptionLog(errorMessage, 'NPICallOutError'); //CDP-
5234
});
}

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 Row Selection In NPI Phy Datatable


handleRowSelection(event){
let selectedData = event.detail.selectedRows; //Get the Selected Row Data
if(selectedData && selectedData.length > 0){
this.selectedNPIPhyData = []; //Empty the selected NPI Phy Datatble
this.selectedNPIPhyData = event.detail.selectedRows; //Store Selected
Row Data
this.disableAddPhysician = 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];
};

// cheking reverse direction


let isReverse = direction === 'asc' ? 1 : -1;
// sorting data
parseData.sort((x, y) => {
x = keyValue(x) ? keyValue(x) : '';
y = keyValue(y) ? keyValue(y) : '';
return isReverse * ((x.toLowerCase() > y.toLowerCase()) -
(y.toLowerCase() > x.toLowerCase()));
});
this.searchedNPIPhyData = parseData;
}

//Handle Create Contact(Physician) Records


handleSavePhysician(event) {
this.disableAddPhysician = true;
event.preventDefault();
let selectedRcrd = this.selectedNPIPhyData;
if(selectedRcrd && selectedRcrd.length > 0){
if(this.getValue(selectedRcrd[0].LastName) == null){
this.showNotification("Error!", "Selected Physician's Last Name
cannot be null.", "Error", "dismissable");
this.disableAddPhysician = false;
}else{
this.showSpinner = true;
const fields = event.detail.fields;

let accId = this.getValue(this.conAccountId);


let NPIVal = this.getValue(selectedRcrd[0].NPI);
//Fetch the contact based on NPI number
getContacts({NPINumber: NPIVal, AccountId: accId})
.then(result => {
if(result){
for(var key in result){
if(key == 'Account Matched'){
this.handleShowSelectedPhyInDT(result[key].Id,
result[key].Name, result[key].NPI__c);
}else if(key == 'Account Not Matched'){
this.handleShowSelectedPhyInDT(result[key].Id,
result[key].Name, result[key].NPI__c);
if(accId != null && result[key].Id != null){
this.handleCreateACR(result[key].Id, accId);
}
}else if(key == 'Contacts Not Found'){
/*** Start CDP-3187 ***/ //CDP-5234 Modified Fields
Mapping
fields.NPI__c =
this.getValue(selectedRcrd[0].NPI) != null ? String(selectedRcrd[0].NPI) : null;
fields.FirstName =
this.getValue(selectedRcrd[0].FirstName);
fields.LastName =
this.getValue(selectedRcrd[0].LastName);
fields.MiddleName =
this.getValue(selectedRcrd[0].MiddleName);
fields.MailingCity =
this.getValue(selectedRcrd[0].MailingCity);
fields.MailingPostalCode =
this.getValue(selectedRcrd[0].MailingZip);
fields.MailingStateCode =
this.getValue(selectedRcrd[0].MailingState);
fields.MailingCountry = 'United States';
let Address = null;
if(this.getValue(selectedRcrd[0].MailingStreet1) !=
null){ //Check 1st Line Address not null
Address = selectedRcrd[0].MailingStreet1;

if(this.getValue(selectedRcrd[0].MailingStreet2) != null){ //Check 2nd Line Address


not null
Address += ',
'+selectedRcrd[0].MailingStreet2;
}
}else
if(this.getValue(selectedRcrd[0].MailingStreet2) != null){ //Check 2nd Line Address
not null
Address = selectedRcrd[0].MailingStreet2;
}
if(this.neoServeCMData != null){
fields.MailingStreet =
this.handleTruncate(Address, this.neoServeCMData.StreetLength__c);
}
/*** End CDP-3187 ***/
if(this.cdpclinicalContactRectpId != null &&
this.cdpclinicalContactRectpId != '' &&
this.cdpclinicalContactRectpId != 'undefined')
{
fields.RecordTypeId =
this.cdpclinicalContactRectpId;
}
if(this.conAccountId != null && this.conAccountId !
= '') {
fields.AccountId = this.conAccountId;
}
/*** Start CDP-3186 ***/
if(this.profileName != '' && this.profileName !=
null){
if(this.profileName == OncologistProfileName){
fields.Contact_Type__c = 'Oncologist';
}
}
/*** End CDP-3186 ***/
fields.Is_Ordering_Treating_Physician__c = true;
this.template.querySelector('lightning-record-edit-
form').submit(fields);
}else if(key == 'Error'){
this.disableAddPhysician = false;
this.showSpinner = false;
this.showNewPhyRcrdForm = false;
}
}
}else{
this.disableAddPhysician = false;
this.showSpinner = false;
this.showNewPhyRcrdForm = false;
}
})
.catch(error => {
this.disableAddPhysician = false;
this.showSpinner = false;
this.showNewPhyRcrdForm = false;
});
}
}
}

//Hanlde Create AccountContactRelation record


handleCreateACR(contactId, accId){
createACR({contactId: contactId, accountId: accId})
.then(result => {})
.catch(error => {});
}

//Handle Show Selected Record in Ordering or Treating Phy Datatables


handleShowSelectedPhyInDT(contactId, contactName, contactNPI){
this.showSpinner = false;
let conName = this.getValue(contactName);
let conNPI = this.getValue(contactNPI);
let selectedOrdPhy = this.selectedOrderingPhysician;
let selectedTrtPhy = this.selectedTreatingPhysician;
if(this.newtargetvalue == 0 && selectedOrdPhy && selectedOrdPhy.length > 0)
{
//Check If the selected contact Id is exists or not in OrdPhy Datatable
let checkOrdPhRcrdExists = selectedOrdPhy.some(obj => obj.Id ===
contactId);
if(checkOrdPhRcrdExists == false){
let item = this.template.querySelectorAll('c-lwc_-multi-select-
lookup');
if(item){
item[this.newtargetvalue].handleNewData({ Id: contactId, Name:
conName, NPI__c: conNPI });
}
}
}else if(this.newtargetvalue == 1 && selectedTrtPhy &&
selectedTrtPhy.length > 0){
//Check If the selected contact Id is exists or not in TrtPhy Datatable
let checkTrtRcrdExists = selectedTrtPhy.some(obj => obj.Id ===
contactId);
if(checkTrtRcrdExists == false){
let item = this.template.querySelectorAll('c-lwc_-multi-select-
lookup');
if(item){
item[this.newtargetvalue].handleNewData({ Id: contactId, Name:
conName, NPI__c: conNPI });
}
}
}else{
let item = this.template.querySelectorAll('c-lwc_-multi-select-
lookup');
if(item){
item[this.newtargetvalue].handleNewData({ Id: contactId, Name:
conName, NPI__c: conNPI });
}
}
this.showNotification("Success!", "Physician Added Successfully",
"Success", "dismissable");
this.showNewPhyRcrdForm = false;
this.disableAddPhysician = false;
}
//End CDP-4962/CDP-850

//Once the contact is created showing success meesage


handleSuccess(event) {
this.showSpinner = false;
const fields = event.detail.fields;
let middleName = this.getValue(fields.MiddleName.value) != null ?
((fields.MiddleName.value)+' ') : '';
let conName = (this.getValue(fields.FirstName.value) != null ?
((fields.FirstName.value)+' ') : '') + middleName + fields.LastName.value;
let conNPI = fields.NPI__c.value != null ? fields.NPI__c.value : '';
let item = this.template.querySelectorAll('c-lwc_-multi-select-lookup');
if (item) {
item[this.newtargetvalue].handleNewData({ Id: event.detail.id, Name:
conName, NPI__c: conNPI });
}
this.showNewPhyRcrdForm = false;
this.disableAddPhysician = false;
this.showNotification("Success!", "Physician Added Successfully",
"Success", "dismissable");
}
//While creating contact if there is an error showing the error
handleError(event) {
this.showSpinner = false;
this.disableAddPhysician = false;
//Start CDP-5234
if(event.detail != null){
let errorMsg = this.createCustomErrors(event.detail) != '' ?
this.createCustomErrors(event.detail) : 'An error occurred while trying to create
the record.';
this.showNotification("Error!", errorMsg, "Error", "dismissable");
this.handleCreateExceptionLog(errorMsg, 'ExceptionError');
}else{
this.showNewPhyRcrdForm = false;
}
//End CDP-5234
}

//To close the popup


handleCloseDialog() {
this.showNewPhyRcrdForm = false;
}

//To show toast messages


showNotification(title, message, variant, mode) {
const evt = new ShowToastEvent({
title: title,
message: message,
variant: variant,
mode: mode
});
this.dispatchEvent(evt);
}
/*** End CDP-1285 ***/

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;

//To Disable the Action Link if Ordering Physician is null /**CDP-


1417**/
if (this.selectedOrderingPhysician.length <= 0) {
this.showCopyButton = false;
this.showOrderingData = false;
this.highlightOPlookup = true; //CDP-4777
}
const childComponent = this.template.querySelector('[data-unique-
id="Ordering"]');
childComponent.updateSelectedRecords(this.selectedOrderingPhysician);
}
else if (compName == 'Treating') {
relPhyRole = 'Treating Physician'; //CDP-2921
for (let i = 0; i < this.selectedTreatingPhysician.length; i++) {
if (this.selectedTreatingPhysician[i].Id !== event.detail.rowIds) {

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;
});
}

/*** Start CDP-2988 ***/


//Handle to fetch the primary account
handleFetchPrimayAccount(){
fetchPrimayAccount()
.then(result => {
if(result){
if(typeof result === 'object' && result !== null &&
Object.keys(result).length > 0){
this.prevSelectedClient = result;
}
}
})
.catch(error => {});
}
/*** End CDP-2988 ***/

/*** Start CDP-1655 ***/


//Check If the Required fields on Client and Physician screen are populated and
accordingly
//set the flags which will be later used on Review Order screen to highlight
the sections
//in Red when the Required fields are missing
validateRequiredFields(){
this.highlightClientSection = false;
if(typeof this.selectedClient === 'object' && this.selectedClient !== null
&&
Object.keys(this.selectedClient).length > 0){
if(this.selectedClient.Name == null ||
this.selectedClient.Account_number__c == null){
this.highlightClientSection = true;
}else{
this.highlightClientSection = false;
}
}else{
this.highlightClientSection = true;
}

this.highlightOPSection = this.selectedOrderingPhysician.length <= 0 ? true


: false;
this.highlightTPSection = this.selectedTreatingPhysician.length <= 0 ? true
: false;
//CDP-3817 start
if(this.AdditionalDistribution){
this.faxNumberPatternCheck();
this.verifyFaxNumberMatches();
this.isValidAdditionalDistData = (this.isFaxPatternMatch &&
this.verifyFaxCorrect) ? true: false;
this.AdditionalDistribution.isValidAdditionalDistData
=this.isValidAdditionalDistData ;
if( this.AdditionalDistribution.isValidAdditionalDistData == false ||(
(this.AdditionalDistribution.faxNumber ||
this.AdditionalDistribution.verifyFaxNumber ||
this.AdditionalDistribution.reportRecipientName ||
this.AdditionalDistribution.additionalDistributionAcknowledgement == true
) && !(this.AdditionalDistribution.faxNumber &&
this.AdditionalDistribution.verifyFaxNumber &&
this.AdditionalDistribution.reportRecipientName &&
this.AdditionalDistribution.additionalDistributionAcknowledgement == true
)
)){
this.highlightADSection = true;

}else{
this.highlightADSection = false;
}
}else{
this.highlightADSection = false;
}
this.checkADRequiredFields(); //CDP-3817
//CDP -3817 END
}
/*** End CDP-1655 ***/

//CDP-3452 Starts here


hideLabel(){
const addressInput = this.template.querySelector('.c-label-remover');
if (addressInput) {
const style = document.createElement('style');
style.innerText = '.c-label-remover .slds-form-element__label:empty
{ display: none !important; } .c-label-remover .slds-form-element__label{ padding-
top: 0.5rem !important; }';
this.template.appendChild(style);
}
}
//CDP-3452 Ends here

//CDP -3817 start


checkADRequiredFields(){
if(
(this.faxNumber || this.verifyFaxNumber || this.reportRecipientName ||
this.additionalDistributionAcknowledgement == true) &&
// !(this.faxNumber && this.AdditionalDistribution.verifyFaxNumber &&
this.reportRecipientName && this.additionalDistributionAcknowledgement == true)
!(this.faxNumber && this.verifyFaxNumber && this.reportRecipientName &&
this.additionalDistributionAcknowledgement == true)

){

this.faxNumberMissing = !this.faxNumber ? 'Fax number required' :'';


this.reportRecipientNameMissing = !this.reportRecipientName ? 'Report
recipient name required' :'';
this.additionalDistributionAcknowledgementMissing =
this.additionalDistributionAcknowledgement ==false ? 'Acknowledgment required' :'';
console.log('inside AD if');

}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();
}

//Check value is null or not


getValue(value){
if(value && value != null && value != undefined && value != '' && value !=
""){
return value;
}else{
return null;
}
}

//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 = [];
}
}

handleCreateExceptionLog(errorMessage, logType){ //CDP-5234


createExceptionLog({logData: errorMessage, logType: logType}) //CDP-5234
.then(result => {})
.catch(error => {});
}

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}

placeholder="Search by Client ID or Client Name">


</c-lwc_-
custom-lookup>
</div>
</div>
</div>
</div>
<!-- </div> -->
</div>
</div>
<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-02"
id="combobox-label-id-
19"><abbr class="slds-required" title="required">* </abbr>
Ordering Physician</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">
<!-- CDP-
4777 assigned value for lookup highlight -->
<c-lwc_-
multi-select-lookup type="Ordering" label=""

objectname="Contact" onremove={removehandler}

fieldnames=" Id,Name,NPI__c" data-unique-id="Ordering"

onselected={handleOrderingPhysician} icon-name="standard:contact"
is-
disabled={disableOrderingPhysician}

selected-client-id-setter={selectedClientIdGetter}

selected-data={selectedOrderingPhysician}

require-validate ={requiredValidateOrdering} highlight-


lookup={highlightOPlookup}

onrefresh={onRfreshHandler} placeholder="Search by Name"

onpresssearch={pressSearchMethod} onnew={handlePhyRecordCreation} module-


type="NewOrderingOrder"
data-
label="0">
</c-lwc_-
multi-select-lookup>
</div>
</div>
</div>
</div>
<!-- </div> -->
</div>
</div>
<!--Ordering Physician Datatable START-->
<template if:true={showOrderingData}>
<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 Ordering Physician</h3>
<c-lwc_dynamic-Datatable
page-size={pagesize} columns-data={columns}
comp-
name="Ordering" lst-result={selectedOrderingPhysician} hide-checkbox

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"

onclick={actionLinkHandler} class="c-button-link slds-float_right">


</lightning-
button>
</div>
</template>
</div>
<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_-
multi-select-lookup data-unique-id="Treating" type="Treating"

label="" onremove={removehandler} objectname="Contact"

fieldnames=" Id,Name,NPI__c" onselected={handleTreatingPhysician}


icon-
name="standard:contact" placeholder="Search by Name"

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"

variant="label-hidden" placeholder="Type here" value={reportRecipientName}


onchange={additionalDistributionHandler}>
</lightning-input>
</div>
</div>
<!-- </div> -->
</div>
</div>
<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">Fax Number (Numbers
Only)</label>
<div class="slds-form-
element__control">
<lightning-input
type="text" id="faxNumber" name="faxNumber" class="fax faxNumberReq"
variant="label-hidden" onblur={faxPatternHandler}

placeholder="Type here" value={faxNumber}


onchange={additionalDistributionHandler} maxlength="10">
</lightning-input>
</div>
</div>
<!-- </div> -->

</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"

onchange={additionalDistributionHandler} placeholder="Type here"


value={verifyFaxNumber} disabled={disableVerifyFax}>
</lightning-input>
</div>
</div>
</div>
</div>
<div class="slds-form-element__row">
<div class="slds-size_6-of-6 slds-p-
around_x-small">
<div class="slds-form-element">
<label class="slds-form-
element__label" for="textarea-id-01">Comments</label>
<div class="slds-form-
element__control">
<lightning-textarea
id="orderComment" name="orderComment" placeholder="Type here" maxlength="255"

value={orderComment} rows="3" onchange={additionalDistributionHandler}


variant="label-hidden">
</lightning-textarea>
</div>
</div>
</div>

</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> -->

</div>
</fieldset>
</article>
</div>

<!--Start Physician popup CDP-4961/CDP-850-->


<template if:true={showNewPhyRcrdForm}>
<div class="c-modal-wrapper">
<section role="dialog" tabindex="-1" aria-modal="true" aria-
labelledby="modal-heading-01"
class="slds-modal slds-fade-in-open slds-modal_medium">
<div class="slds-modal__container">
<template if:true={showSpinner}>
<lightning-spinner alternative-text="Loading"
size="medium"></lightning-spinner>
</template>
<button class="slds-button slds-button_icon slds-
modal__close slds-button_icon-inverse"
onclick={handleCloseDialog}>
<svg class="slds-button__icon slds-
button__icon_large" aria-hidden="true">
<use xlink:href="/_slds/icons/utility-
sprite/svg/symbols.svg#close"></use>
</svg>
<span class="slds-assistive-text">Cancel and
close</span>
</button>
<div class="slds-modal__header slds-p-around_small">
<h1 id="modal-heading-01" class="slds-
modal__title slds-hyphenate" tabindex="-1">
Add New Physician
</h1>
</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>

<!-- Input Fields Start -->


<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-01">
NPI Number
</label>
<div class="slds-
form-element__control">
<lightning-
input type="text" placeholder="Type here" data-id="npi"

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}

class="slds-button slds-button_brand slds-m-vertical_xx-small slds-


button_stretch c-disable-button"

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">

<h3 class="slds-p-bottom_x-small">Selected Physician</h3>

<div class="c-table-spacing">

<div class="c-dynamicDataTable c-popup-table">

<lightning-datatable key-field="Id" data={selectedNPIPhyData} hide-


checkbox-column

columns={selectedPhysicianColumns} resize-column-disabled= true>

</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}>

<div class="c-pagination-container slds-align_absolute-center">

<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 class="slds-badge slds-p-around_x-small"><p>

{startingRecord}-{endingRecord} of {totalRecordCount} | Page


{pageNumber} of {totalPages}</p>

</span>

<span class="slds-p-around_x-small">

<lightning-button variant="base" label="Next" icon-


name="utility:chevronright"

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">

<h3 class="slds-p-bottom_x-small">Matched Physicians


({totalRecordCount})</h3>

<div class="c-table-spacing">

<div class="c-dynamicDataTable c-popup-table">

<lightning-datatable key-field="Id" class="phyDataTable"

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>

You might also like