Commit 35c794d1 authored by Muhammadali's avatar Muhammadali

update

parent 4a0aa256
......@@ -15,7 +15,6 @@ const Root = ({ data, onSetDnd }) => {
// else localStorage.setItem('activeValue', 1);
// }, []);
const [dataSecond, setDataSecond] = useState([]);
const [mainData, setMainData] = useState(data);
if (!data) {
data = {
iscloud: true,
......@@ -32,10 +31,12 @@ const Root = ({ data, onSetDnd }) => {
}
if (window?.alovoice_wsphone) {
// data = window.alovoice_wsphone;
setMainData(window.alovoice_wsphone);
data = window.alovoice_wsphone;
onSetDnd = window.alovoice_onsetdnd;
}
useEffect(() => {
console.log(data, 'data');
}, [data.reason]);
const [phoneModal, setPhoneModal] = useState(false);
const [dynamicValue, setDynamicValue] = useState('pending');
......@@ -44,11 +45,12 @@ const Root = ({ data, onSetDnd }) => {
const boxDialer = window.BoxDialer;
useEffect(() => {
if (mainData && mainData?.number) {
if (data && data?.number) {
boxDialer.setSipStateChangeCallback(setDynamicValue, 'dynamicValue');
boxDialer.setSipStateChangeCallback(setModalState, 'modalState');
boxDialer.sipRegister(mainData);
boxDialer.sipRegister(data);
}
setDataSecond(data);
}, []);
const hangupButton = () => {
......@@ -57,9 +59,10 @@ const Root = ({ data, onSetDnd }) => {
const reasonSelect = async (e) => {
let result = await onSetDnd(e);
console.log(e, 'dropdown_value: ', e);
setDataSecond(result);
console.log(dataSecond, 'select_func');
setMainData(result);
data = result;
};
const selectWidjetType = (type) => {
......@@ -68,11 +71,11 @@ const Root = ({ data, onSetDnd }) => {
return (
<BxMiniWidjetUi
widjetState={dynamicValue}
phoneNumber={mainData?.number}
reason={mainData?.reason}
phoneNumber={data?.number}
reason={data?.reason}
widjetVersion={packageJson?.version}
leftTime={mainData.lefttime}
position={mainData.position || 'bottomLeft'}
leftTime={data.lefttime}
position={data.position || 'bottomLeft'}
onClick={() => {
phoneModal ? setPhoneModal(false) : setPhoneModal(true);
}}
......@@ -82,11 +85,11 @@ const Root = ({ data, onSetDnd }) => {
return (
<DefaultWidjetUi
widjetState={dynamicValue}
phoneNumber={mainData?.number}
reason={mainData?.reason}
phoneNumber={data?.number}
reason={data?.reason}
widjetVersion={packageJson?.version}
leftTime={mainData.lefttime}
position={mainData.position || 'bottomLeft'}
leftTime={data.lefttime}
position={data.position || 'bottomLeft'}
onClick={() => {
phoneModal ? setPhoneModal(false) : setPhoneModal(true);
}}
......@@ -95,22 +98,22 @@ const Root = ({ data, onSetDnd }) => {
}
};
if (!mainData || !mainData?.number || !mainData?.position) return;
if (!data || !data?.number || !data?.position) return;
console.log(modalState, 'modalState');
return (
<>
{selectWidjetType(mainData.variant)}
{selectWidjetType(data.variant)}
<ModalPhoneNumpad
modalState={modalState}
phoneModal={phoneModal}
reasons={mainData?.reasons}
reason={mainData?.reason}
reasons={data?.reasons}
reason={dataSecond?.reason}
onClick={(e) => e.stopPropagation()}
dynamicValue={dynamicValue}
onSetDnd={reasonSelect}
variant={mainData.variant || 'defaultWidjet'}
position={mainData.position || 'bottomLeft'}
variant={data.variant || 'defaultWidjet'}
position={data.position || 'bottomLeft'}
/>
<Modal
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment