Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
BoxDialer
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
BoxDialer
Commits
f3db2f02
Commit
f3db2f02
authored
Aug 22, 2023
by
Muhammadali
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test update verison: 0.1.3
parent
c84bbccb
Changes
8
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
2962 additions
and
21 deletions
+2962
-21
package.json
package.json
+1
-1
index.jsx
src/components/CallCardDropDown/index.jsx
+40
-0
style.js
src/components/CallCardDropDown/style.js
+127
-0
index.jsx
src/components/Modal/index.jsx
+31
-9
style.js
src/components/Modal/style.js
+3
-0
index.jsx
src/components/WidjetButton/index.jsx
+15
-7
mockTest.js
src/components/WidjetButton/mockTest.js
+2720
-0
boxDIaler.js
src/lib/boxDIaler.js
+25
-4
No files found.
package.json
View file @
f3db2f02
{
{
"name"
:
"boxdialer"
,
"name"
:
"boxdialer"
,
"version"
:
"0.1.
2
"
,
"version"
:
"0.1.
3
"
,
"description"
:
""
,
"description"
:
""
,
"main"
:
"src/boxDialer.js"
,
"main"
:
"src/boxDialer.js"
,
"scripts"
:
{
"scripts"
:
{
...
...
src/components/CallCardDropDown/index.jsx
0 → 100644
View file @
f3db2f02
/** @format */
import
React
,
{
useState
}
from
'
react
'
;
import
Block
from
'
./style
'
;
import
{
data
as
mockData
}
from
'
../WidjetButton/mockTest
'
;
const
CallCardDropDown
=
({
hiddenState
,
selectUserFunc
})
=>
{
const
[
inputValue
,
setinputValue
]
=
useState
(
''
);
return
(
<
Block
onClick=
{
(
e
)
=>
e
.
stopPropagation
()
}
hiddenState=
{
hiddenState
}
>
<
Block
.
Input
placeholder=
'Search'
hiddenState=
{
hiddenState
}
onChange=
{
(
e
)
=>
setinputValue
(
e
.
target
.
value
)
}
/>
<
Block
.
Inset
hiddenState=
{
hiddenState
}
>
{
mockData
.
map
(
({
NAME
,
UF_PHONE_INNER
,
LAST_NAME
})
=>
(
NAME
.
toLocaleLowerCase
().
includes
(
inputValue
.
toLocaleLowerCase
(),
)
||
LAST_NAME
.
toLocaleLowerCase
().
includes
(
inputValue
.
toLocaleLowerCase
(),
)
||
UF_PHONE_INNER
.
toString
().
includes
(
inputValue
.
toString
()))
&&
(
<
Block
.
Section
onClick=
{
()
=>
selectUserFunc
(
UF_PHONE_INNER
)
}
>
<
p
className=
'name'
>
{
NAME
}
{
LAST_NAME
}
</
p
>
<
p
className=
'phone_number'
>
{
UF_PHONE_INNER
}
</
p
>
</
Block
.
Section
>
),
)
}
</
Block
.
Inset
>
</
Block
>
);
};
export
default
CallCardDropDown
;
src/components/CallCardDropDown/style.js
0 → 100644
View file @
f3db2f02
/** @format */
import
styled
from
'
styled-components
'
;
const
Block
=
styled
.
div
`
transition: 0.3s;
${({
hiddenState
})
=>
console
.
log
(
hiddenState
,
'
dhjgdasjhgdasjhg
'
)}
${({
hiddenState
})
=>
hiddenState
?
{
width
:
'
0
'
,
height
:
'
0
'
,
padding
:
'
0
'
,
}
:
{
width
:
'
280px
'
,
height
:
'
250px
'
,
padding
:
'
60px 3px 5px 0
'
,
}}
position
:
absolute
;
bottom
:
45
px
;
left
:
50
%
;
transform
:
translate
(
-
50
%
,
0
);
background
-
color
:
#
232932
f2
;
border
-
radius
:
10
px
;
/* width */
::
-
webkit
-
scrollbar
{
width
:
10
px
!
important
;
}
/* Track */
::
-
webkit
-
scrollbar
-
track
{
background
:
#
ffffff00
!
important
;
}
/* Handle */
::
-
webkit
-
scrollbar
-
thumb
{
background
:
#
ffffff4a
!
important
;
border
-
radius
:
20
px
;
}
/* Handle on hover */
::
-
webkit
-
scrollbar
-
thumb
:
hover
{
background
:
#
ffffff4a
!
important
;
}
`;
Block.Inset = styled.div`
$
{({
hiddenState
})
=>
(
hiddenState
?
{
padding
:
'
0
'
}
:
{
padding
:
'
5px
'
})}
padding: 0 2px 0 5px;
height: 100%;
width: 100%;
overflow-y: scroll;
border-radius: 10px;
display: grid;
grid-template-columns: 1fr;
grid-gap: 5px;
`
;
Block
.
Section
=
styled
.
div
`
border-radius: 15px;
width: 100%;
height: 30px;
background-color: #ffffff8a;
padding: 0 8px;
display: grid;
grid-template-columns: 1fr 30px;
align-items: center;
grid-gap: 10px;
p {
margin: 0;
padding: 0;
}
display: flex;
justify-content: space-between;
.name {
font-size: 14px;
}
.phone_number {
font-size: 12px;
background-color: #a0c13d;
padding: 2px 5px;
min-width: 40px;
border-radius: 20px;
display: flex;
align-items: center;
justify-content: center;
}
`
;
Block
.
Input
=
styled
.
input
`
${({
hiddenState
})
=>
hiddenState
?
{
display
:
'
none
'
}
:
{
display
:
'
block
'
}}
color
:
#
fff
;
position
:
absolute
;
width
:
258
px
;
height
:
40
px
;
top
:
3
px
;
background
-
color
:
#
ffffff1c
;
transform
:
translate
(
5
px
,
10
px
);
border
-
radius
:
10
px
;
padding
:
3
px
;
font
-
size
:
20
px
;
:
focus
{
border
-
color
:
inherit
;
-
webkit
-
box
-
shadow
:
none
;
box
-
shadow
:
none
;
padding
:
0
10
px
;
font
-
size
:
24
px
;
outline
:
0
none
;
}
outline
:
none
;
&
::
-
webkit
-
outer
-
spin
-
button
,
&
::
-
webkit
-
inner
-
spin
-
button
{
-
webkit
-
appearance
:
none
;
margin
:
0
;
}
/* Firefox */
&
[
type
=
'
number
'
]
{
-
moz
-
appearance
:
textfield
;
}
`;
export default Block;
src/components/Modal/index.jsx
View file @
f3db2f02
...
@@ -10,6 +10,7 @@ import PlayArrowIcon from '@mui/icons-material/PlayArrow';
...
@@ -10,6 +10,7 @@ import PlayArrowIcon from '@mui/icons-material/PlayArrow';
import
PauseIcon
from
'
@mui/icons-material/Pause
'
;
import
PauseIcon
from
'
@mui/icons-material/Pause
'
;
import
SendToMobileIcon
from
'
@mui/icons-material/SendToMobile
'
;
import
SendToMobileIcon
from
'
@mui/icons-material/SendToMobile
'
;
import
DialpadIcon
from
'
@mui/icons-material/Dialpad
'
;
import
DialpadIcon
from
'
@mui/icons-material/Dialpad
'
;
import
CallCardDropDown
from
'
../CallCardDropDown
'
;
const
Modal
=
({
const
Modal
=
({
children
,
children
,
hidden
,
hidden
,
...
@@ -23,7 +24,7 @@ const Modal = ({
...
@@ -23,7 +24,7 @@ const Modal = ({
const
[
rollUp
,
setRollUp
]
=
useState
(
false
);
const
[
rollUp
,
setRollUp
]
=
useState
(
false
);
const
[
modalHidden
,
setModalHidden
]
=
useState
(
false
);
const
[
modalHidden
,
setModalHidden
]
=
useState
(
false
);
const
[
callEvents
,
setCallEvents
]
=
useState
({});
const
[
callEvents
,
setCallEvents
]
=
useState
({});
const
[
transferModel
,
setTransferModel
]
=
useState
(
true
);
useEffect
(()
=>
{
useEffect
(()
=>
{
boxDialer
.
setSipStateChangeCallback
(
setCallEvents
,
'
setCallEvents
'
);
boxDialer
.
setSipStateChangeCallback
(
setCallEvents
,
'
setCallEvents
'
);
},
[]);
},
[]);
...
@@ -32,9 +33,19 @@ const Modal = ({
...
@@ -32,9 +33,19 @@ const Modal = ({
setModalHidden
(
hidden
);
setModalHidden
(
hidden
);
},
[
hidden
]);
},
[
hidden
]);
const
selectUserFunc
=
(
e
)
=>
{
if
(
e
)
{
boxDialer
.
transferButtonClick
(
e
);
setTransferModel
(
true
);
}
};
if
(
!
modalHidden
)
return
;
if
(
!
modalHidden
)
return
;
return
(
return
(
<
MainBlock
hidden=
{
modalHidden
||
modalHidden
}
rollUp=
{
rollUp
}
>
<
MainBlock
hidden=
{
modalHidden
||
modalHidden
}
rollUp=
{
rollUp
}
onClick=
{
(
e
)
=>
e
.
stopPropagation
()
}
>
<
ModalContainer
onClick=
{
(
e
)
=>
e
.
stopPropagation
()
}
rollUp=
{
rollUp
}
>
<
ModalContainer
onClick=
{
(
e
)
=>
e
.
stopPropagation
()
}
rollUp=
{
rollUp
}
>
{
children
}
{
children
}
<
ModalContainer
.
Top
className=
{
'
top
'
}
rollUp=
{
rollUp
}
>
<
ModalContainer
.
Top
className=
{
'
top
'
}
rollUp=
{
rollUp
}
>
...
@@ -59,10 +70,7 @@ const Modal = ({
...
@@ -59,10 +70,7 @@ const Modal = ({
<
ModalContainer
.
Bottom
rollUp=
{
rollUp
}
></
ModalContainer
.
Bottom
>
<
ModalContainer
.
Bottom
rollUp=
{
rollUp
}
></
ModalContainer
.
Bottom
>
<
hr
/>
<
hr
/>
{
callType
===
'
outcoming
'
?
(
{
callType
===
'
outcoming
'
?
(
<
ModalContainer
.
Footer
<
ModalContainer
.
Footer
justify=
{
'
space-between
'
}
rollUp=
{
rollUp
}
>
justify=
{
'
space-between
'
}
rollUp=
{
rollUp
}
onClick=
{
()
=>
hangupButton
()
}
>
<
div
className=
'outcomingEventStyle'
>
<
div
className=
'outcomingEventStyle'
>
<
div
onClick=
{
()
=>
boxDialer
.
holdButtonClick
()
}
>
<
div
onClick=
{
()
=>
boxDialer
.
holdButtonClick
()
}
>
{
callEvents
.
callHold
?
(
{
callEvents
.
callHold
?
(
...
@@ -78,14 +86,21 @@ const Modal = ({
...
@@ -78,14 +86,21 @@ const Modal = ({
<
MicIcon
style=
{
{
color
:
'
#fff
'
}
}
/>
<
MicIcon
style=
{
{
color
:
'
#fff
'
}
}
/>
)
}
)
}
</
div
>
</
div
>
<
div
onClick=
{
()
=>
boxDialer
.
transferButtonClick
()
}
>
<
div
className=
'transferAreaIcon'
onClick=
{
()
=>
setTransferModel
(
!
transferModel
)
}
>
<
SendToMobileIcon
style=
{
{
color
:
'
#fff
'
}
}
/>
<
SendToMobileIcon
style=
{
{
color
:
'
#fff
'
}
}
/>
<
CallCardDropDown
hiddenState=
{
transferModel
}
selectUserFunc=
{
selectUserFunc
}
/>
</
div
>
</
div
>
<
div
>
<
div
>
<
DialpadIcon
style=
{
{
color
:
'
#fff
'
}
}
/>
<
DialpadIcon
style=
{
{
color
:
'
#fff
'
}
}
/>
</
div
>
</
div
>
</
div
>
</
div
>
<
button
className=
'redButton'
>
<
button
className=
'redButton'
onClick=
{
()
=>
hangupButton
()
}
>
<
CallEndIcon
/>
<
CallEndIcon
/>
ЗАКРЫТЬ
ЗАКРЫТЬ
</
button
>
</
button
>
...
@@ -121,8 +136,15 @@ const Modal = ({
...
@@ -121,8 +136,15 @@ const Modal = ({
<
MicIcon
style=
{
{
color
:
'
#fff
'
}
}
/>
<
MicIcon
style=
{
{
color
:
'
#fff
'
}
}
/>
)
}
)
}
</
div
>
</
div
>
<
div
onClick=
{
()
=>
boxDialer
.
transferButtonClick
()
}
>
<
div
className=
'transferAreaIcon'
onClick=
{
()
=>
setTransferModel
(
!
transferModel
)
}
>
<
SendToMobileIcon
style=
{
{
color
:
'
#fff
'
}
}
/>
<
SendToMobileIcon
style=
{
{
color
:
'
#fff
'
}
}
/>
<
CallCardDropDown
hiddenState=
{
transferModel
}
selectUserFunc=
{
selectUserFunc
}
/>
</
div
>
</
div
>
<
div
>
<
div
>
<
DialpadIcon
style=
{
{
color
:
'
#fff
'
}
}
/>
<
DialpadIcon
style=
{
{
color
:
'
#fff
'
}
}
/>
...
...
src/components/Modal/style.js
View file @
f3db2f02
...
@@ -125,6 +125,9 @@ ModalContainer.Footer = styled.div`
...
@@ -125,6 +125,9 @@ ModalContainer.Footer = styled.div`
align-items: center;
align-items: center;
}
}
}
}
.transferAreaIcon {
position: relative;
}
.redButton {
.redButton {
background-color: #9d0f23;
background-color: #9d0f23;
border-radius: 50px;
border-radius: 50px;
...
...
src/components/WidjetButton/index.jsx
View file @
f3db2f02
...
@@ -37,7 +37,7 @@ const WidjetButton = ({ data, onSetDnd }) => {
...
@@ -37,7 +37,7 @@ const WidjetButton = ({ data, onSetDnd }) => {
console
.
log
(
console
.
log
(
window
.
BX
.
rest
.
callMethod
(
'
user.get
'
,
{},
(
rr
)
=>
{
window
.
BX
.
rest
.
callMethod
(
'
user.get
'
,
{},
(
rr
)
=>
{
console
.
log
(
rr
.
answer
.
result
);
console
.
log
(
rr
.
answer
.
result
);
})
})
,
);
);
}
}
...
@@ -57,8 +57,6 @@ const WidjetButton = ({ data, onSetDnd }) => {
...
@@ -57,8 +57,6 @@ const WidjetButton = ({ data, onSetDnd }) => {
}
}
},
[]);
},
[]);
console
.
log
(
data
,
'
data
'
);
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
!
modalState
.
bool
)
setInputValue
(
''
);
if
(
!
modalState
.
bool
)
setInputValue
(
''
);
},
[
modalState
.
bool
]);
},
[
modalState
.
bool
]);
...
@@ -96,7 +94,7 @@ const WidjetButton = ({ data, onSetDnd }) => {
...
@@ -96,7 +94,7 @@ const WidjetButton = ({ data, onSetDnd }) => {
}
}
};
};
document
.
onkeydown
=
function
(
e
)
{
document
.
onkeydown
=
function
(
e
)
{
if
(
phoneModal
)
{
if
(
phoneModal
&&
modalState
.
bool
?
false
:
true
)
{
e
=
e
||
window
.
event
;
e
=
e
||
window
.
event
;
if
(
e
.
ctrlKey
&&
e
.
keyCode
===
86
)
{
if
(
e
.
ctrlKey
&&
e
.
keyCode
===
86
)
{
navigator
.
clipboard
navigator
.
clipboard
...
@@ -113,11 +111,19 @@ const WidjetButton = ({ data, onSetDnd }) => {
...
@@ -113,11 +111,19 @@ const WidjetButton = ({ data, onSetDnd }) => {
};
};
const
gameState
=
{
const
gameState
=
{
toggleCP
:
(
e
)
=>
{
toggleCP
:
(
e
)
=>
{
if
(
phoneModal
&&
e
.
key
===
'
Enter
'
)
{
if
(
phoneModal
&&
(
modalState
.
bool
?
false
:
true
)
&&
e
.
key
===
'
Enter
'
)
{
boxDialer
.
initialized
(
inputValue
,
data
.
number
);
boxDialer
.
initialized
(
inputValue
,
data
.
number
);
}
else
if
(
phoneModal
&&
e
.
key
===
'
Backspace
'
)
{
}
else
if
(
phoneModal
&&
(
modalState
.
bool
?
false
:
true
)
&&
e
.
key
===
'
Backspace
'
)
{
inputController
({
type
:
'
delete
'
,
from
:
'
button
'
,
value
:
e
.
value
});
inputController
({
type
:
'
delete
'
,
from
:
'
button
'
,
value
:
e
.
value
});
}
else
if
(
phoneModal
&&
!
isNaN
(
+
e
.
key
))
{
}
else
if
(
phoneModal
&&
(
modalState
.
bool
?
false
:
true
)
&&
!
isNaN
(
+
e
.
key
)
)
{
inputController
({
type
:
'
add
'
,
value
:
e
.
key
,
from
:
'
button
'
});
inputController
({
type
:
'
add
'
,
value
:
e
.
key
,
from
:
'
button
'
});
}
}
},
},
...
@@ -159,7 +165,9 @@ const WidjetButton = ({ data, onSetDnd }) => {
...
@@ -159,7 +165,9 @@ const WidjetButton = ({ data, onSetDnd }) => {
return
(
return
(
<>
<>
<
WidjetBlock
<
WidjetBlock
id=
{
'
responsible-button
'
}
onClick=
{
(
e
)
=>
{
onClick=
{
(
e
)
=>
{
boxDialer
.
selectUser
(
e
)
phoneModal
?
setPhoneModal
(
false
)
:
setPhoneModal
(
true
);
phoneModal
?
setPhoneModal
(
false
)
:
setPhoneModal
(
true
);
}
}
>
}
}
>
<
WidjetBlock
.
AccauntInfo
status=
{
dynamicValue
}
>
<
WidjetBlock
.
AccauntInfo
status=
{
dynamicValue
}
>
...
...
src/components/WidjetButton/mockTest.js
0 → 100644
View file @
f3db2f02
This diff is collapsed.
Click to expand it.
src/lib/boxDIaler.js
View file @
f3db2f02
...
@@ -347,6 +347,29 @@ export class BoxDialer {
...
@@ -347,6 +347,29 @@ export class BoxDialer {
break
;
break
;
}
}
}
}
selectUser
(
param
)
{
BX
.
Runtime
.
loadExtension
(
'
ui.entity-selector
'
).
then
((
exports
)
=>
{
const
{
Dialog
,
TagSelector
}
=
exports
;
const
button
=
param
;
const
dialog
=
new
BX
.
UI
.
EntitySelector
.
Dialog
({
targetNode
:
button
,
enableSearch
:
true
,
context
:
'
MY_MODULE_CONTEXT
'
,
entities
:
[
{
id
:
'
user
'
,
// пользователи
},
{
id
:
'
department
'
,
// структура компании: выбор только пользователей
},
],
});
dialog
.
show
();
});
}
// call_connected;
// call_connected;
setSipStateChangeCallback
(
callback
,
funcName
)
{
setSipStateChangeCallback
(
callback
,
funcName
)
{
this
.
onSipStateChange
[
funcName
]
=
callback
.
bind
(
this
);
this
.
onSipStateChange
[
funcName
]
=
callback
.
bind
(
this
);
...
@@ -459,11 +482,9 @@ export class BoxDialer {
...
@@ -459,11 +482,9 @@ export class BoxDialer {
closeButtonClick
()
{
closeButtonClick
()
{
console
.
log
(
'
closeButtonClick
'
);
console
.
log
(
'
closeButtonClick
'
);
}
}
transferButtonClick
()
{
transferButtonClick
(
number
)
{
if
(
this
.
oSipSessionCall
)
{
if
(
this
.
oSipSessionCall
)
{
console
.
log
(
'
transferButtonClick
'
);
if
(
this
.
oSipSessionCall
.
transfer
(
number
)
!=
0
)
{
var
s_destination
=
prompt
(
'
Enter destination number
'
,
''
);
if
(
this
.
oSipSessionCall
.
transfer
(
s_destination
)
!=
0
)
{
toast
.
error
(
'
Call transfer failed
'
);
toast
.
error
(
'
Call transfer failed
'
);
return
;
return
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment