import React, { useEffect, useRef, useState } from 'react';
import { Accordion, Button, Card, Col, Container, Dropdown, FloatingLabel, Form, ListGroup, Modal, Placeholder, Row, SSRProvider, Table } from 'react-bootstrap';
import { useForm } from 'react-hook-form';
import {TabulatorFull as Tabulator} from 'tabulator-tables';
import {data, getBarchartData, getSearchResults, predefinedRanges, tableData, tableData1, wordcloudData} from "./Components/TabulatorData";
import { DatePicker, RangeSlider, SelectPicker } from 'rsuite';
import { CheckPicker } from 'rsuite';
import './jqueryloader'
import { DateRangePicker } from 'rsuite';
import { Checkbox, CheckboxGroup } from 'rsuite';
import { Radio, RadioGroup } from 'rsuite';
import ReactEcharts from "echarts-for-react";
import { getPieChartData } from './Components/TabulatorData';
import axios from 'axios';
import * as anychart from 'anychart'
import Link from 'next/link';
import { confirmAlert } from "react-confirm-alert";
const data1 = ['A', 'B', 'C', 'D'];
var table;
let option1;
var app = {};
var tablePaymentsGrid = '';
var toggleValue = '';
// export svg
const exportcsv = '/images/contacts/Excel.svg';
const gridEditIcon = '/images/refine_by_icons/edit.svg';
const gridDeleteIcon = '/images/cross_gray.svg';
const microview = '/images/microview_active.svg';
const key_icon = '/images/primary_indication.svg';
export default function Home() {
// Custom tabulator start
function ActionFormatter(){
return(
`
`
);
}
function microViewFormat(){
return(
` `
)
}
function keyViewFormat(){
return(
` `
)
}
function idViewFormat(){
return(
`# `
)
}
const customTabulator = () =>{
var table = new Tabulator("#customTabulator", {
height:"311px",
data:tableData,
layout:window?.innerWidth > 800 ? "fitColumns" : "fitData",
resizableColumnFit:true,
addRowPos:"top",
initialSort:[
{column:"name", dir:"asc"},
],
filterMode:"local",
pagination:true,
paginationMode:"local",
paginationSize:10,
paginationSizeSelector:[10, 25, 50, 75],
columns:[
{title:"#", field:"id", headerSort:false, titleFormatter:idViewFormat, width:50},
{title:" ", field:"id", headerSort:false, formatter:microViewFormat, width:50},
{title:" ", field:"id", headerSort:false, formatter:keyViewFormat, width:50},
{title:"Name", field:"name", headerFilter:true, headerFilterPlaceholder:'Search', tooltip:tooltipValue, width:200},
{title:"Age", field:"age", hozAlign:"left", sorter:"number", headerFilter:true, headerFilterPlaceholder:'Search', width:70},
{title:"Gender", field:"gender", headerFilter:true, headerFilterPlaceholder:'Search', width:90},
{title:"Height", field:"height", hozAlign:"left", headerFilter:true, headerFilterPlaceholder:'Search'},
{title:"Color", field:"col", headerFilter:true, headerFilterPlaceholder:'Search'},
{title:"Date Of Birth", field:"dob", hozAlign:"left", sorter:"date", headerFilter:true, headerFilterPlaceholder:'Search'},
{title:"Cheese", field:"cheese", hozAlign:"left", headerFilter:true, headerFilterPlaceholder:'Search'},
{title:"Action", field:"name", hozAlign:"left", formatter: ActionFormatter},
],
ajaxResponse:function(url, params, response){
return response.data;
},
});
return table;
}
// Custom tabulator end
// Tabulator Collapse start
//Title Formatter
var titleCustomization = function(cell, formatterParams, onRendered){
var column_title = cell.getValue();
var response = checkBGforblock(column_title);
onRendered(function(){
var buttonFor = '';
switch(cell.getValue()){
case 'Events Total': buttonFor = 'eventsCollapse'; break;
case 'Affiliations Total': buttonFor = 'affiliationsCollapse'; break;
case 'Publications Total': buttonFor = 'publicationsCollapse'; break;
case 'Referral Total': buttonFor = 'referralCollapse'; break;
}
if(buttonFor != ""){
$(cell.getElement()).parent("div").parent("div").append('
');
}
$(cell.getElement()).parent("div").parent("div").parent("div").addClass(response);
switch(buttonFor){
case 'eventsCollapse':
$("#eventsCollapse").click(function(event){
table.toggleColumn('numspc');
table.toggleColumn('numocc');
var type = $(this).attr("toggle-type");
if(type == "" || type == "collapse"){
$(this).attr("toggle-type", "collapsed");
$(this).children("i").removeClass("bi-skip-backward").addClass("bi-skip-forward");
}else{
$(this).attr("toggle-type", "collapse");
$(this).children("i").removeClass("bi-skip-forward").addClass("bi-skip-backward");
}
event.stopPropagation();
});
break;
case 'affiliationsCollapse':
$("#affiliationsCollapse").click(function(event){
table.toggleColumn('numia');
table.toggleColumn('numas');
table.toggleColumn('numeb');
table.toggleColumn('numec');
table.toggleColumn('numgc');
var type = $(this).attr("toggle-type");
if(type == "" || type == "collapse"){
$(this).attr("toggle-type", "collapsed");
$(this).children("i").removeClass("bi-skip-backward").addClass("bi-skip-forward");
}else{
$(this).attr("toggle-type", "collapse");
$(this).children("i").removeClass("bi-skip-forward").addClass("bi-skip-backward");
}
event.stopPropagation();
});
break;
case 'publicationsCollapse':
$("#publicationsCollapse").click(function(event){
table.toggleColumn('leadc');
table.toggleColumn('numma');
table.toggleColumn('numsa');
table.toggleColumn('numfa');
table.toggleColumn('numla');
var type = $(this).attr("toggle-type");
if(type == "" || type == "collapse"){
$(this).attr("toggle-type", "collapsed");
$(this).children("i").removeClass("bi-skip-backward").addClass("bi-skip-forward");
}else{
$(this).attr("toggle-type", "collapse");
$(this).children("i").removeClass("bi-skip-forward").addClass("bi-skip-backward");
}
event.stopPropagation();
});
break;
case 'referralCollapse':
$("#referralCollapse").click(function(event){
table.toggleColumn('kref');
table.toggleColumn('oref');
var type = $(this).attr("toggle-type");
if(type == "" || type == "collapse"){
$(this).attr("toggle-type", "collapsed");
$(this).children("i").removeClass("bi-skip-backward").addClass("bi-skip-forward");
}else{
$(this).attr("toggle-type", "collapse");
$(this).children("i").removeClass("bi-skip-forward").addClass("bi-skip-backward");
}
event.stopPropagation();
});
break;
}
});
return cell.getValue();
};
//Cell Formatter
var cellCustomization = function(column, formatterParams, onRendered){
var column_field = column.getField();
var response = checkBGforblock(column_field);
$(column.getElement()).addClass(response);
return column.getValue();
};
function checkBGforblock(column_value){
switch(column_value){
case 'Events Total': case 'numevc': var class_name = 'eventsBgPrimary'; break;
case 'Speaking': case 'numspc': var class_name = 'eventsBgSecondary'; break;
case 'Organizing Committee': case 'numocc': var class_name = 'eventsBgTertiary'; break;
case 'Affiliations Total': case 'numed': var class_name = 'affiliationsBgPrimary'; break;
case 'Industry': case 'numia': var class_name = 'affiliationsBgSecondary'; break;
case 'Associations': case 'numas': var class_name = 'affiliationsBgSecondary'; break;
case 'Editorial Boards': case 'numeb': var class_name = 'affiliationsBgSecondary'; break;
case 'Univ/Hospital': case 'numec': var class_name = 'affiliationsBgTertiary'; break;
case 'Guidelines': case 'numgc': var class_name = 'affiliationsBgfourth'; break;
case 'Publications Total': case 'nump': var class_name = 'publicationsBgPrimary'; break;
case 'Lead Author': case 'leadc': var class_name = 'publicationsBgSecondary'; break;
case 'Contributng Author': case 'numma': var class_name = 'publicationsBgTertiary'; break;
case 'Single Author': case 'numsa': var class_name = 'publicationsBgTertiary'; break;
case 'First Author': case 'numfa': var class_name = 'publicationsBgTertiary'; break;
case 'Last Author': case 'numla': var class_name = 'publicationsBgTertiary'; break;
case 'Trails Total': case 'numtc': var class_name = 'trailBgPrimary'; break;
case 'Referral Total': case 'ref': var class_name = 'referralBgPrimary'; break;
case 'HCP': case 'kref': var class_name = 'referralBgSecondary'; break;
case 'HCO': case 'oref': var class_name = 'referralBgSecondary'; break;
case 'Previous Tier (2014-2018)': case 'prev_tier': var class_name = 'prev_tierBg'; break;
case 'Current Tier (2015-2019)': case 'current_tier': var class_name = 'current_tierBg'; break;
case 'Status': case 'status': var class_name = 'statusBg'; break;
}
return class_name;
}
var addSelectAllBox = function(cell, formatterParams, onRendered){
return '
';
};
var nameCustomization = function(column, formatterParams, onRendered){
return ''+column.getValue()+' '
};
var tooltipValue = function formatTooltip(e, cell, onRendered) {
let data = cell.getData()['name']
return data;
}
//microprofile view icon
var viewMicroIcon = function(cell, formatterParams){
return '';
};
const getData = () =>{
table = new Tabulator('#collapsibleTabulator', {
selectable:true,
height:475,
data:tableData1,
layout:"fitDataStretch",
addRowPos:"top",
initialSort:[
{column:"name", dir:"asc"},
],
filterMode:"local",
pagination:true,
paginationMode:"local",
paginationSize:50,
paginationSizeSelector:[10, 25, 50, 75],
placeholder:"No Data Available",
columns:[
{title:"", formatter:'rownum',hozAlign:'center',headerSort:false,tooltip:false,frozen:true,width:10},
{formatter:"rowSelection", titleFormatter:"rowSelection", hozAlign:"center", headerSort:false, cellClick:function(e, cell){
cell.getRow().toggleSelect();
}},
// {title:"",formatter:viewMicroIcon, headerSort:false, hozhozAlign:"center",titleFormatter:addSelectAllBox, frozen:true,width:10},
{title:"Name", field:"name", headerFilter:true, headerFilterPlaceholder:'Search',hozAlign:"left", formatter:nameCustomization,frozen:true, tooltip:tooltipValue},
{title:"Tier", field:"tier", hozAlign:"center",width:70},
{title:"Rank", field:"rank", hozAlign:"center",width:70},
{title:"Score", field:"score",hozAlign:"center",width:70},
{title:"Events Total", field:"numevc",hozAlign:"center",titleFormatter:titleCustomization, formatter:cellCustomization, width:90},
{title:"Speaking", field:"numspc",hozAlign:"center", titleFormatter:titleCustomization, formatter:cellCustomization, width:90},
{title:"Organizing Committee", field:"numocc",hozAlign:"center", titleFormatter:titleCustomization, formatter:cellCustomization, width:100},
{title:"Affiliations Total", field:"numed",hozAlign:"center",titleFormatter:titleCustomization, formatter:cellCustomization, width:100},
{title:"Industry", field:"numia",hozAlign:"center", titleFormatter:titleCustomization, formatter:cellCustomization, width:90},
{title:"Associations", field:"numas",hozAlign:"center", titleFormatter:titleCustomization, formatter:cellCustomization, width:100},
{title:"Editorial Boards", field:"numeb",hozAlign:"center", titleFormatter:titleCustomization, formatter:cellCustomization, width:90},
{title:"Univ/Hospital", field:"numec",hozAlign:"center", titleFormatter:titleCustomization, formatter:cellCustomization, width:100},
{title:"Guidelines", field:"numgc",hozAlign:"center", titleFormatter:titleCustomization, formatter:cellCustomization, width:100},
{title:"Publications Total", field:"nump",hozAlign:"center",titleFormatter:titleCustomization, formatter:cellCustomization, width:100},
{title:"Lead Author", field:"leadc",hozAlign:"center", titleFormatter:titleCustomization, formatter:cellCustomization, width:90},
{title:"Contributng Author", field:"numma",hozAlign:"center", titleFormatter:titleCustomization, formatter:cellCustomization, width:100},
{title:"Single Author", field:"numsa",hozAlign:"center", titleFormatter:titleCustomization, formatter:cellCustomization, width:90},
{title:"First Author", field:"numfa",hozAlign:"center", titleFormatter:titleCustomization, formatter:cellCustomization, width:90},
{title:"Last Author", field:"numla",hozAlign:"center", titleFormatter:titleCustomization, formatter:cellCustomization, width:90},
{title:"Trails Total", field:"numtc",hozAlign:"center", titleFormatter:titleCustomization, formatter:cellCustomization, width:90},
{title:"Referral Total", field:"ref",hozAlign:"center",titleFormatter:titleCustomization, formatter:cellCustomization, width:90},
{title:"HCP", field:"kref",hozAlign:"center",titleFormatter:titleCustomization, formatter:cellCustomization, width:90},
{title:"HCO", field:"oref",hozAlign:"center", titleFormatter:titleCustomization, formatter:cellCustomization, width:90}
],
ajaxResponse:function(url, params, response){
return response.data;
},
});
}
function addToMyContacts(){
alert("test");
}
// Tabulator Collapse end
// Forms validation start
/* Declaring a variable called pswdshow and setting it to false. */
const [pswdshow, setPswd] = useState(false);
/* Creating a state variable called confpswdshow and setting it to false. */
const [confpswdshow, setConfPswd] = useState(false);
/**
* If the password is shown, then hide it. If the password is hidden, then show it
*/
const showPassword = () =>{
setPswd(pswdshow ? false : true);
}
/**
* If the value of confpswdshow is true, then setConfPswd(false) else setConfPswd(true)
*/
const showConfirmPassword = () =>{
setConfPswd(confpswdshow ? false : true);
}
const {register, formState: { errors }, reset, watch, getValues, handleSubmit} = useForm();
const registerUser = (data) =>{
// console.log(data);
}
// Forms validation end
// fullscreen
const fullScreen = (e) =>{
e.preventDefault();
if (typeof window !== "undefined") {
var targetelement = document.getElementById("fullscreen");
const requestFullScreen = targetelement.requestFullscreen || targetelement.webkitRequestFullScreen || targetelement.mozRequestFullScreen || targetelement.msRequestFullScreen;
requestFullScreen.call(targetelement);
if (document.fullscreen) { document.exitFullscreen(); }
}
}
// fullscreen end
// rsuite selectpicker
const dataset = ['Eugenia', 'Bryan', 'Linda', 'Nancy', 'Lloyd', 'Alice', 'Julia', 'Albert'].map(
item => ({ label: item, value: item })
);
const [value4, setValue4] = React.useState(null);
const handleSelectPicker = (value) =>{
setValue4(value)
}
// rsuite selectpicker end
// rsuite check picker
const [value3, setValue3] = React.useState([]);
const handleCheckPicker = (value) =>{
setValue3(value)
}
// rsuite check picker end
// rsuite daterangepicker
const [value, setValue] = useState();
const handleDateChange = (data) =>{
setValue(data);
}
// rsuite daterangepicker end
// rsuite range slider
const [value1, setValue1] = React.useState([10, 50]);
// rsuite range slider end
// rsuite checkbox
const [value2, setValue2] = React.useState(['A', 'C']);
const handleCheckAll = (value, checked) => setValue2(checked ? data1 : []);
const handleChange = value => setValue2(value);
// rsuite checkbox end
// rsuite radio
const [value5, setValue5] = React.useState('A');
// rsuite radio
// autocomplete search
const [searchTerm, updateSearchTerm] = useState('');
const [filteredResults, updateFilteredResults] = useState([]);
const [searchResults, updateSearchResults] = useState([]);
const [displayResults, updateDisplayResults] = useState(false);
const [focusIndex, updateFocusIndex] = useState(-1);
const linkRefs = [];
const keys = {
ENTER: 13,
UP: 38,
DOWN: 40
};
const updateSearch = e => {
var input = e.target?.value;
updateSearchTerm(e.target.value);
updateFilteredResults(searchResults.filter(result =>{
if(input?.length >= 3){
return result.title.match(new RegExp(e.target.value, 'gi'))
}
}))
};
const hideAutoSuggest = e => {
e.persist();
var input = e.target?.value;
if (e.relatedTarget && e.relatedTarget.className === 'autosuggest-link') {
return false;
}
if(input?.length >= 0){
$('#search-card-results').css('border-color', 'transparent');
}
if(input?.length >= 3){
updateDisplayResults(false);
}else{
updateDisplayResults(true);
updateFocusIndex(-1);
}
};
const showAutoSuggest = (e) => {
updateDisplayResults(false);
};
const handleInput = (e) =>{
var input = e.target?.value;
if(input?.length < 3){
$('.search-suggestions').css('display', 'none');
}
if(input?.length >= 3){
$('.search-suggestions').removeClass('d-none');
$('.search-suggestions').css('display', 'block');
$('.search-suggestions').css('border-color', 'rgba(0, 0, 0, 0.175)')
}else{
$('.search-suggestions').css('border-color', 'transparent')
}
}
const handleNavigation = e => {
switch (e.keyCode) {
case keys.ENTER:
if (focusIndex !== -1) {
window.open(linkRefs[focusIndex].href);
}
hideAutoSuggest(e);
break;
case keys.UP:
if (focusIndex > -1) {
updateFocusIndex(focusIndex - 1);
}
break;
case keys.DOWN:
if (focusIndex < filteredResults.length - 1) {
updateFocusIndex(focusIndex + 1);
}
break;
}
};
const SearchResults = () => {
const Message = ({ text }) => (
);
if (!displayResults) {
return null;
}
if (!searchResults.length) {
return
}
if (!searchTerm) {
return
}
if (!filteredResults.length) {
return
}
return (
{filteredResults.map((article, index) => (
{/* ⚠️ You may want to outsource this part to make the component less heavy */}
))}
);
}
// autocomplete seacrh end
// Echarts Pichart
const [apiData, setapiData] = useState()
const option = {
tooltip: {
trigger: 'item',
},
legend: {
type:'scroll',
orient: "horizontal",
bottom : "0%",
legendHoverLink: true,
},
series: [
{
type: 'pie',
data: apiData?.map((item, index)=>{
return(
{ value: item?.value, name: item?.title }
)
}),
label: {
width: 64,
overflow: "break",
fontSize: 12,
fontWeight : 'normal'
},
labelLine: {
width : 1.5,
length2: 7,
length: 7
},
width: "100%",
height: "100%",
center : ['48%', '50%']
}
]
};
const onChartClick = (params) => {
console.log('Chart clicked', params);
};
// Echarts Pichart end
// Echarts Barchart
const [apiData1, setapiData1] = useState();
const series = apiData1?.map((item)=>({
name: item?.name,
data: item?.data,
}))
app.config = {
rotate: 67,
align: 'right',
verticalAlign: 'middle',
position: 'bottom',
distance: 6,
};
const labelOption = {
show: true,
position: app.config.position,
distance: app.config.distance,
align: app.config.align,
verticalAlign: app.config.verticalAlign,
rotate: app.config.rotate,
formatter: '{c} {name|{a}}',
fontSize: 12,
rich: {
name: {
color: '#0066cc',
fontSize: 12,
},
}
};
option1 = {
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow'
}
},
legend: {
data: series?.map(item => item?.name),
top:"2%",
},
toolbox: {
show: true,
orient: 'vertical',
left: 'right',
top: 'center',
feature: {
mark: { show: true },
dataView: { show: true, readOnly: false },
magicType: { show: true, type: ['bar', 'line'] },
restore: { show: true },
saveAsImage: {
type: "png"
}
}
},
xAxis: [
{
type: 'category',
axisTick: { show: false },
data: ['', '', '', '', ''],
boundaryGap: true,
triggerEvent : true
},
],
yAxis: [
{
type: 'value',
}
],
series: series?.map((item, index) => Object.assign(item, {
type: 'bar',
label: labelOption,
}))
};
const onBarChartClick = (params) => {
console.log('BarChart clicked', params);
};
// Echart Barchart end
// Echarts Bubblechart
const [apiData2, setapiData2] = useState()
const scatterData = apiData2?.map((item)=>({
name: item?.title,
value: [item?.id, item?.discountPercentage, item?.title],
itemStyle: 'blue'
}));
const option2 = {
xAxis: {},
yAxis: {},
tooltip: {
triggerOn: "mousemove",
alwaysShowContent: true,
position: 'top'
},
series: [
{
symbolSize: 20,
data: scatterData,
type: 'scatter'
}
]
};
const onBubbleChartClick = (params) => {
console.log('Chart clicked', params);
};
// Echarts Bubblechart end
// Echarts events
const onEvents = {
click: onChartClick,
click: onBarChartClick,
click: onBubbleChartClick,
};
// Echarts events end
// Filters datepicker
const [datevalue, setDateValue] = React.useState(new Date());
const [datevalue1, setDateValue1] = React.useState(new Date());
const [datevalue2, setDateValue2] = React.useState(new Date());
const [datevalue3, setDateValue3] = React.useState(new Date());
// Filters datepicker end
// Client form modal
const [show, setShow] = useState(false);
const handleClose = () => setShow(false);
const handleShow = () => setShow(true);
// Client form modal end
// Plan new record modal
const [show1, setShow1] = useState(false);
const [dateone, setDateOne] = React.useState(new Date());
const [datetwo, setDateTwo] = React.useState(new Date());
const [selectedOptions, setSelectedOptions] = useState();
const optionList = ['Eugenia', 'Bryan', 'Linda', 'Nancy', 'Lloyd', 'Alice', 'Julia', 'Albert'].map(
item => ({ label: item, value: item })
);
// Add Rows
const [assignProfiles, setAssignProfiles] = useState([{hcpname : "", assignto : "", status : ""}]);
const hcpnameref = useRef();
const assigntoref = useRef();
const statusref = useRef();
/* It takes the index of the key and the event object, and then it creates a copy of the keys array,
* changes the value of the key at the given index, and then sets the keys array to the new array
* @param index - the index of the key in the array
* @param event - The event that triggered the function.
*/
const handleFormChange = (index, event) => {
let data = [...assignProfiles];
data[index][event.target.name] = event.target.value;
setAssignProfiles(data);
}
const addRow = (e) =>{
setAssignProfiles([...assignProfiles, {hcpname : "", assignto : "", status : ""}]);
}
const removeRow = (index) =>{
const list = [...assignProfiles];
list.splice(index, 1);
setAssignProfiles(list);
}
// Add Rows
function handleSelect(data) {
setSelectedOptions(data);
}
const handleClose1 = () => setShow1(false);
const handleShow1 = () => setShow1(true);
const registerPlan = (e) =>{
e.preventDefault();
console.log(assignProfiles);
}
// Plan new record modal end
// Accordions
const icon = '/microview_active.svg';
const viewsimilar = '/view_similar.svg';
//Accordions end
// confirm alert
const submit = () => {
confirmAlert({
title: 'Confirm to submit',
message: 'Are you sure to do this.',
buttons: [
{
label: 'Yes',
onClick: () => alert('Click Yes')
},
{
label: 'No',
onClick: () => alert('Click No')
}
]
});
};
const submit1 = () => {
confirmAlert({
customUI: ({ onClose }) => {
return (
Are you sure?
You want to delete this file?
No
{
// handleClickDelete();
onClose();
}}
>
Yes, Delete it!
);
}
});
}
// confirm alert end
//group by HCP tabulator
function toggleKolGrouping(){
toggleValue = $("#toggleKolGrouping").text();
if(toggleValue == 'Remove Grouping'){
tablePaymentsGrid.setGroupBy(false);
$("#toggleKolGrouping").text("Group By HCP");
}else{
tablePaymentsGrid.setGroupStartOpen(false);
tablePaymentsGrid.setGroupBy("kol_name");
$("#toggleKolGrouping").text("Remove Grouping");
}
}
function listPayments(){
//Tabulator Grid parameters
var gridFor='payments';
var gridHeaderText= "Payments";
var gridId= gridFor+'-grid-table';
var actionLink = "";
actionLink += "";
//Data for grid to load
var tableData2 = [
{micro:'1',kol_name:'Aaron James Miller',date:"14/05/2020",type: "General",amount: "555.00",status: "Completed",act:''},
{micro:'2',kol_name:'Aaron James Miller',date:"20/05/2020",type: "General",amount: "550.00",status: "Completed",act:''},
{micro:'3',kol_name:'Aaron James',date:"14/05/2020",type: "General",amount: "555.00",status: "Completed",act:''},
{micro:'4',kol_name:'Aaron James',date:"20/05/2020",type: "General",amount: "550.00",status: "Completed",act:''},
]
//Tabulator Gird initialisation
tablePaymentsGrid = new Tabulator("#"+gridId, {
//var tableData = ;
data:tableData2,
columns:[
{title:"#", formatter:'rownum',align:'center',headerSort:false,tooltip:false, width:"5%"},
{title:"", field:"micro",formatter:function(cell, formatterParams, onRendered){
return ""; //return the contents of the cell;
},headerFilter:false,headerSort:false,align:'center', width:"5%"},
{title:"HCP Name", field:"kol_name",formatter:function(cell, formatterParams, onRendered){
return "" + cell.getValue() + " "; //return the contents of the cell;
},headerFilter:true, headerFilterPlaceholder:'Search', align:'left', width:"42%"},
{title:"Date", field:"date",headerFilter:true, headerFilterPlaceholder:'Search', align:'left', width:"10%"},
{title:"Type", field:"type",headerFilter:true, headerFilterPlaceholder:'Search', align:'left', width:"10%"},
{title:"Amount", field:"amount",headerFilter:true, headerFilterPlaceholder:'Search', align:'left',bottomCalc:"sum", width:"10%"},
{title:"Status", field:"status",headerFilter:true, headerFilterPlaceholder:'Search', align:'left', width:"10%"},
{title:"Action", field:"act",formatter:function(cell, formatterParams){
return actionLink;
},headerFilter:false,headerSort:false,width:80,align:'center', width:"8%"}
],
layout:"fitDataStretch",
tooltips:true,
ajaxSorting:false,
ajaxFiltering:false,
initialSort:[{column:"date", dir:"desc"}],
groupClosedShowCalcs:true,
paginationSize:10, // this option can take any positive integer value (default = 10),possible values 10,20,50,100
pagination:"local",
paginationSizeSelector:[10, 20, 50, 100],
tableBuilt:function(){
$("#"+gridFor+"-grid-header .grid-header-text").html(gridHeaderText);
}
});
var grid_options ='';
grid_options +='';
$("#"+gridFor+"-grid-header .grid-header-text").append(grid_options);
}
// group by HCP tabulator end
// training grid tabulator
var trainingData = [
{id:1, name:"Billy Bob", degree:"xyz", speciality:"ABC", frame:'NA-1991', type:"Education", },
{id:2, name:"Mary May", degree:"NOP", speciality:"DEF", frame:'NA-1991', type:"Teaching", },
{id:3, name:"Christine Lobowski", degree:"PAN", speciality:"GHI", frame:'NA-1991', type:"Educamp", },
{id:4, name:"Brendon Philips", degree:"BE", speciality:"PQR", frame:'NA-1991', type:"Education", },
{id:5, name:"Margret Marmajuke", degree:"BED", speciality:"MNO", frame:'NA-1991', type:"Technology", },
]
const trainingGridTabulator = () =>{
var table = new Tabulator("#trainingGridTable", {
height:"311px",
data:trainingData,
layout:window?.innerWidth > 800 ? "fitColumns" : "fitData",
resizableColumnFit:true,
addRowPos:"top",
initialSort:[
{column:"name", dir:"asc"},
],
filterMode:"local",
footerElement:"Show more ",
columns:[
{title:"#", field:"id", headerSort:false, titleFormatter:idViewFormat, width:50},
{title:"Name", field:"name", headerFilter:true, headerFilterPlaceholder:'Search', tooltip:tooltipValue, width:200},
{title:"Degree", field:"degree", hozAlign:"left", sorter:"number", headerFilter:true, headerFilterPlaceholder:'Search'},
{title:"Speciality", field:"speciality", headerFilter:true, headerFilterPlaceholder:'Search'},
{title:"Frame", field:"frame", hozAlign:"left", headerFilter:true, headerFilterPlaceholder:'Search'},
{title:"Type", field:"type", headerFilter:true, headerFilterPlaceholder:'Search'},
{title:"Action", field:"name", hozAlign:"left", formatter: ActionFormatter},
],
ajaxResponse:function(url, params, response){
return response.data;
},
});
return table;
}
// training grid tabulator end
/* useEffect hook */
useEffect(()=>{
customTabulator();
getData();
// autocomplete search
const getSearchResult = () => {
// ⚠️ This is where you should pull data in from your server
const searchResultsResponse = getSearchResults();
updateSearchResults(searchResultsResponse);
};
getSearchResult();
// autocomplete search end
// Echarts Pichart
const getPieChartResult = () => {
// ⚠️ This is where you should pull data in from your server
const piechartResultsResponse = getPieChartData();
setapiData(piechartResultsResponse);
};
getPieChartResult();
// Echarts Pichart end
// Echarts Barchart
const getBarChartResult = () => {
// ⚠️ This is where you should pull data in from your server
const barchartResultsResponse = getBarchartData();
setapiData1(barchartResultsResponse);
};
getBarChartResult();
// Echarts Barchart end
// Echarts Bubble chart
axios.get('https://dummyjson.com/products')
.then(res => {
const values = res?.data?.products;
setapiData2(values);
})
// Echarts Bubble chart end
// wordcloud anychart
const getWordCloudResult = () => {
const wordclouddatas = wordcloudData();
$('#anychart').empty();
// create a tag (word) cloud chart
var chart = anychart.tagCloud(wordclouddatas);
// set a chart title
chart.title('15 most spoken languages')
// display the word cloud chart
chart.container("anychart");
chart.draw();
}
getWordCloudResult();
// wordcloud anychart end
// groupby HCP tabulator
listPayments();
// groupby HCP tabulator end
// training grid tabulator
trainingGridTabulator();
// training grid tabulator end
}, [])
return (
<>
Custom Tabulator
{' '}Add Users
Custom Tabulator
{' '}Group By HCP
Training{' '}(Recent 5 of 10)
{' '}Add Training
Collapsible Tabulator
{' '}Add Contacts
Record New User
User Details
Form Components
Components
Echarts Components
Pichart
Barchart
Bubblechart
WordCloud Chart
Text Colors
text orange- paragraph tag
text orange- header tag(h4)
text blue- anchor tag with text underline on hover
Placeholder component-(react-bootstrap) :
card component-(react-bootstrap) with border blue on top :
Users
Filters
Date From
setDateValue(value)} placement='auto'/>
Date To
setDateValue1(value)} placement='auto'/>
Apply
Month From
setDateValue2(value)} placement='auto'/>
Month To
setDateValue3(value)} placement='auto'/>
Apply
View Interactions
Interaction Details
discussion type
attendees
{/* Client popup form modal */}
{/* Modal */}
Create Client
{/* Client popup form modal end */}
{/* Plan new record modal */}
Plan Modal
Record New Plan
Plan Details
{/* */}
{/* Plan new record modal end */}
Button Types
Custom Button
Primary Button
Secondary Button
Tertiary Button
{/* Accordion */}
Accordion
View Similar
Similar HCPs who have published on same concepts
Adil Javed
Andrew Michael Miller
Brenda Louise Banwell
Bruce A. Cree
Daniel D Mikol
{/* Similar HCPs who received top referrals */}
Similar HCPs who received top referrals
Adil Javed
Andrew Michael Miller
Brenda Louise Banwell
Bruce A. Cree
Daniel D Mikol
{/* Co-authors of the HCP */}
Co-authors of the HCP
Adil Javed
Andrew Michael Miller
Brenda Louise Banwell
Bruce A. Cree
Daniel D Mikol
{/* Accordion end */}
{/* React Confirm Alert */}
React Confirm Alert Section
Confirm dialog
CustomUI dialog
{/* React Confirm Alert end */}
>
)
}
function Highlight({ children: text = "", tags }) {
if (!tags?.length) return text;
const matches = [...text.matchAll(new RegExp(tags, "ig"))];
const startText = text.slice(0, matches[0]?.index);
return (
{startText}
{matches.map((match, i) => {
const startIndex = match.index;
const currentText = match[0];
const endIndex = startIndex + currentText.length;
const nextIndex = matches[i + 1]?.index;
const untilNextText = text.slice(endIndex, nextIndex);
return (
{currentText} {untilNextText}
);
})}
);
}