@@ -11,7 +11,8 @@ import {
1111 getAllOpportunities ,
1212 getAllOwners ,
1313 getAllCompanies ,
14- getAllPipelineStages
14+ getAllPipelineStages ,
15+ getAllTags
1516} from './CopperCRMCommonFunc'
1617
1718export default function CopperCRMActions ( { copperCRMConf, setCopperCRMConf, loading, setLoading } ) {
@@ -54,6 +55,14 @@ export default function CopperCRMActions({ copperCRMConf, setCopperCRMConf, load
5455 setActionMdl ( { show : false } )
5556 delete newConf . actions . company
5657 }
58+ } else if ( type === 'tag' ) {
59+ if ( e . target ?. checked ) {
60+ getAllTags ( copperCRMConf , setCopperCRMConf , setLoading )
61+ newConf . actions . tag = true
62+ } else {
63+ setActionMdl ( { show : false } )
64+ delete newConf . actions . tag
65+ }
5766 } else if ( type === 'pipelineStage' ) {
5867 if ( e . target ?. checked ) {
5968 getAllPipelineStages ( copperCRMConf , setCopperCRMConf , setLoading )
@@ -95,14 +104,24 @@ export default function CopperCRMActions({ copperCRMConf, setCopperCRMConf, load
95104 return (
96105 < div className = "pos-rel d-flx flx-wrp" >
97106 { copperCRMConf . actionName === 'person' && (
98- < TableCheckBox
99- checked = { copperCRMConf ?. selectedCompany ?. length || false }
100- onChange = { e => actionHandler ( e , 'company' ) }
101- className = "wdt-200 mt-4 mr-2"
102- value = "company"
103- title = { __ ( 'Add Company' , 'bit-integrations' ) }
104- subTitle = { __ ( 'Add an company' ) }
105- />
107+ < >
108+ < TableCheckBox
109+ checked = { copperCRMConf ?. selectedCompany ?. length || false }
110+ onChange = { e => actionHandler ( e , 'company' ) }
111+ className = "wdt-200 mt-4 mr-2"
112+ value = "company"
113+ title = { __ ( 'Add Company' , 'bit-integrations' ) }
114+ subTitle = { __ ( 'Add an company' ) }
115+ />
116+ < TableCheckBox
117+ checked = { copperCRMConf ?. selectedTags ?. length || false }
118+ onChange = { e => actionHandler ( e , 'tag' ) }
119+ className = "wdt-200 mt-4 mr-2"
120+ value = "tag"
121+ title = { __ ( 'Add Tags' , 'bit-integrations' ) }
122+ subTitle = { __ ( 'Add tags' ) }
123+ />
124+ </ >
106125 ) }
107126 { ( copperCRMConf . actionName === 'person' ||
108127 copperCRMConf . actionName === 'company' ||
@@ -274,13 +293,13 @@ export default function CopperCRMActions({ copperCRMConf, setCopperCRMConf, load
274293 mainMdlCls = "o-v"
275294 btnClass = "purple"
276295 btnTxt = { __ ( 'Ok' , 'bit-integrations' ) }
277- show = { actionMdl . show === 'company ' }
296+ show = { actionMdl . show === 'tag ' }
278297 close = { clsActionMdl }
279298 action = { clsActionMdl }
280299 title = { __ ( 'Companies' , 'bit-integrations' ) } >
281300 < div className = "btcd-hr mt-2 mb-2" />
282- < div className = "mt-2" > { __ ( 'Select Company ' , 'bit-integrations' ) } </ div >
283- { loading . companies ? (
301+ < div className = "mt-2" > { __ ( 'Select tags ' , 'bit-integrations' ) } </ div >
302+ { loading . tags ? (
284303 < Loader
285304 style = { {
286305 display : 'flex' ,
@@ -293,19 +312,18 @@ export default function CopperCRMActions({ copperCRMConf, setCopperCRMConf, load
293312 ) : (
294313 < div className = "flx flx-between mt-2" >
295314 < MultiSelect
296- options = { copperCRMConf ?. companies ?. map ( company => ( {
297- label : company . name ,
298- value : company . id
315+ options = { copperCRMConf ?. tags ?. map ( tag => ( {
316+ label : tag ,
317+ value : tag
299318 } ) ) }
300319 className = "msl-wrp-options"
301- defaultValue = { copperCRMConf ?. selectedCompany }
302- onChange = { val => setChanges ( val , 'selectedCompany' ) }
303- singleSelect
320+ defaultValue = { copperCRMConf ?. selectedTags }
321+ onChange = { val => setChanges ( val , 'selectedTags' ) }
304322 />
305323 < button
306- onClick = { ( ) => getAllCompanies ( copperCRMConf , setCopperCRMConf , setLoading ) }
324+ onClick = { ( ) => getAllTags ( copperCRMConf , setCopperCRMConf , setLoading ) }
307325 className = "icn-btn sh-sm ml-2 mr-2 tooltip"
308- style = { { '--tooltip-txt' : `${ __ ( 'Refresh Companies ' , 'bit-integrations' ) } '` } }
326+ style = { { '--tooltip-txt' : `${ __ ( 'Refresh Tags ' , 'bit-integrations' ) } '` } }
309327 type = "button" >
310328 ↻
311329 </ button >
0 commit comments