@@ -14,14 +14,7 @@ import Modal from '../../Utilities/Modal'
1414import TitleModal from '../../Utilities/TitleModal'
1515import { refreshAssigmentRules , refreshOwners , refreshTags } from './ZohoCRMCommonFunc'
1616
17- export default function ZohoCRMActions ( {
18- crmConf,
19- setCrmConf,
20- formFields,
21- tab,
22- formID,
23- setSnackbar
24- } ) {
17+ export default function ZohoCRMActions ( { crmConf, setCrmConf, formFields, tab, formID, setSnackbar } ) {
2518 const [ upsertMdl , setUpsertMdl ] = useState ( false )
2619 const [ isLoading , setIsLoading ] = useState ( false )
2720 const [ actionMdl , setActionMdl ] = useState ( { show : false , action : ( ) => { } } )
@@ -181,13 +174,13 @@ export default function ZohoCRMActions({
181174 ]
182175
183176 if ( crmConf . default . tags ?. [ module ] ) {
184- arr [ 0 ] . childs = Object . values ( crmConf . default . tags ?. [ module ] ) . map ( ( tagName ) => ( {
177+ arr [ 0 ] . childs = Object . values ( crmConf . default . tags ?. [ module ] ) . map ( tagName => ( {
185178 label : tagName ,
186179 value : tagName
187180 } ) )
188181 }
189182
190- arr [ 1 ] . childs = formFields . map ( ( itm ) => ( { label : itm . label , value : `\${${ itm . name } }` } ) )
183+ arr [ 1 ] . childs = formFields . map ( itm => ( { label : itm . label , value : `\${${ itm . name } }` } ) )
191184 return arr
192185 }
193186
@@ -248,118 +241,119 @@ export default function ZohoCRMActions({
248241 < div className = "pos-rel" >
249242 < div className = "d-flx flx-wrp" >
250243 < TableCheckBox
251- onChange = { ( e ) => actionHandler ( e , 'workflow' ) }
252- checked = {
253- tab === 0
254- ? 'workflow' in crmConf . actions
255- : 'workflow' in crmConf . relatedlists [ tab - 1 ] . actions
256- }
257- className = "wdt-200 mt-4 mr-2"
258- value = "Workflow"
259- title = { __ ( 'Workflow' , 'bit-integrations' ) }
260- subTitle = { __ ( 'Trigger CRM workflows' , 'bit-integrations' ) }
261- />
262- < TableCheckBox
263- onChange = { ( ) => setActionMdl ( { show : 'attachment' } ) }
264- checked = {
265- tab === 0
266- ? 'attachment' in crmConf . actions
267- : 'attachment' in crmConf . relatedlists [ tab - 1 ] . actions
268- }
269- className = "wdt-200 mt-4 mr-2"
270- value = "Attachment"
271- title = { __ ( 'Attachment' , 'bit-integrations' ) }
272- subTitle = { __ ( 'Add attachments or signatures from Trigger to CRM' , 'bit-integrations' ) }
273- />
274- < TableCheckBox
275- onChange = { ( e ) => actionHandler ( e , 'approval' ) }
276- checked = {
277- tab === 0
278- ? 'approval' in crmConf . actions
279- : 'approval' in crmConf . relatedlists [ tab - 1 ] . actions
280- }
281- className = "wdt-200 mt-4 mr-2"
282- value = "Approval"
283- title = { __ ( 'Approval' , 'bit-integrations' ) }
284- subTitle = { __ ( 'Send entries to CRM approval list' , 'bit-integrations' ) }
285- />
286- < TableCheckBox
287- onChange = { ( e ) => actionHandler ( e , 'blueprint' ) }
288- checked = {
289- tab === 0
290- ? 'blueprint' in crmConf . actions
291- : 'blueprint' in crmConf . relatedlists [ tab - 1 ] . actions
292- }
293- className = "wdt-200 mt-4 mr-2"
294- value = "Blueprint"
295- title = { __ ( 'Blueprint' , 'bit-integrations' ) }
296- subTitle = { __ ( 'Trigger CRM Blueprint' , 'bit-integrations' ) }
297- />
298- < TableCheckBox
299- onChange = { ( e ) => actionHandler ( e , 'gclid' ) }
300- checked = {
301- tab === 0
302- ? 'gclid' in crmConf . actions
303- : 'gclid' in crmConf . relatedlists [ tab - 1 ] . actions
304- }
305- className = "wdt-200 mt-4 mr-2"
306- value = "Capture_GCLID"
307- title = { __ ( 'Capture GCLID' , 'bit-integrations' ) }
308- subTitle = { __ ( 'Sends the click details of AdWords Ads to Zoho CRM' , 'bit-integrations' ) }
309- />
310- < TitleModal action = { openUpsertModal } >
311- < TableCheckBox
312- onChange = { ( e ) => actionHandler ( e , 'upsert' ) }
313- checked = {
314- tab === 0
315- ? 'upsert' in crmConf . actions
316- : 'upsert' in crmConf . relatedlists [ tab - 1 ] . actions
317- }
318- className = "wdt-200 mt-4 mr-2"
319- value = "Upsert_Record"
320- title = { __ ( 'Upsert Records' , 'bit-integrations' ) }
321- subTitle = { __ (
322- 'The record is updated if it already exists else it is inserted as a new record' ,
323- 'bit-integrations'
324- ) }
325- />
326- </ TitleModal >
327- < TableCheckBox
328- onChange = { openAssignmentRulesModal }
244+ onChange = { openRecOwnerModal }
329245 checked = {
330246 tab === 0
331- ? 'assignment_rules ' in crmConf . actions
332- : 'assignment_rules ' in crmConf . relatedlists [ tab - 1 ] . actions
247+ ? 'rec_owner ' in crmConf . actions
248+ : 'rec_owner ' in crmConf . relatedlists [ tab - 1 ] . actions
333249 }
334250 className = "wdt-200 mt-4 mr-2"
335- value = "Assignment_Rule "
336- title = { __ ( 'Assignment Rules ' , 'bit-integrations' ) }
337- subTitle = { __ ( 'Trigger Assignment Rules in Zoho CRM' , 'bit-integrations' ) }
251+ value = "Record_Owner "
252+ title = { __ ( 'Record Owner ' , 'bit-integrations' ) }
253+ subTitle = { __ ( 'Add a owner to records pushed to Zoho CRM' , 'bit-integrations' ) }
338254 />
339255 < TableCheckBox
340256 onChange = { ( ) => setActionMdl ( { show : 'tag_rec' } ) }
341257 checked = {
342- tab === 0
343- ? 'tag_rec' in crmConf . actions
344- : 'tag_rec' in crmConf . relatedlists [ tab - 1 ] . actions
258+ tab === 0 ? 'tag_rec' in crmConf . actions : 'tag_rec' in crmConf . relatedlists [ tab - 1 ] . actions
345259 }
346260 className = "wdt-200 mt-4 mr-2"
347261 value = "Tag_Records"
348262 title = { __ ( 'Tag Records' , 'bit-integrations' ) }
349263 subTitle = { __ ( 'Add a tag to records pushed to Zoho CRM' , 'bit-integrations' ) }
350264 />
351265 < TableCheckBox
352- onChange = { openRecOwnerModal }
266+ onChange = { ( ) => setActionMdl ( { show : 'attachment' } ) }
353267 checked = {
354268 tab === 0
355- ? 'rec_owner ' in crmConf . actions
356- : 'rec_owner ' in crmConf . relatedlists [ tab - 1 ] . actions
269+ ? 'attachment ' in crmConf . actions
270+ : 'attachment ' in crmConf . relatedlists [ tab - 1 ] . actions
357271 }
358272 className = "wdt-200 mt-4 mr-2"
359- value = "Record_Owner "
360- title = { __ ( 'Record Owner ' , 'bit-integrations' ) }
361- subTitle = { __ ( 'Add a owner to records pushed to Zoho CRM' , 'bit-integrations' ) }
273+ value = "Attachment "
274+ title = { __ ( 'Attachment ' , 'bit-integrations' ) }
275+ subTitle = { __ ( 'Add attachments or signatures from Trigger to CRM' , 'bit-integrations' ) }
362276 />
277+
278+ { crmConf . module !== 'Tasks' && (
279+ < >
280+ < TableCheckBox
281+ onChange = { e => actionHandler ( e , 'workflow' ) }
282+ checked = {
283+ tab === 0
284+ ? 'workflow' in crmConf . actions
285+ : 'workflow' in crmConf . relatedlists [ tab - 1 ] . actions
286+ }
287+ className = "wdt-200 mt-4 mr-2"
288+ value = "Workflow"
289+ title = { __ ( 'Workflow' , 'bit-integrations' ) }
290+ subTitle = { __ ( 'Trigger CRM workflows' , 'bit-integrations' ) }
291+ />
292+ < TableCheckBox
293+ onChange = { e => actionHandler ( e , 'approval' ) }
294+ checked = {
295+ tab === 0
296+ ? 'approval' in crmConf . actions
297+ : 'approval' in crmConf . relatedlists [ tab - 1 ] . actions
298+ }
299+ className = "wdt-200 mt-4 mr-2"
300+ value = "Approval"
301+ title = { __ ( 'Approval' , 'bit-integrations' ) }
302+ subTitle = { __ ( 'Send entries to CRM approval list' , 'bit-integrations' ) }
303+ />
304+ < TableCheckBox
305+ onChange = { e => actionHandler ( e , 'blueprint' ) }
306+ checked = {
307+ tab === 0
308+ ? 'blueprint' in crmConf . actions
309+ : 'blueprint' in crmConf . relatedlists [ tab - 1 ] . actions
310+ }
311+ className = "wdt-200 mt-4 mr-2"
312+ value = "Blueprint"
313+ title = { __ ( 'Blueprint' , 'bit-integrations' ) }
314+ subTitle = { __ ( 'Trigger CRM Blueprint' , 'bit-integrations' ) }
315+ />
316+ < TableCheckBox
317+ onChange = { e => actionHandler ( e , 'gclid' ) }
318+ checked = {
319+ tab === 0 ? 'gclid' in crmConf . actions : 'gclid' in crmConf . relatedlists [ tab - 1 ] . actions
320+ }
321+ className = "wdt-200 mt-4 mr-2"
322+ value = "Capture_GCLID"
323+ title = { __ ( 'Capture GCLID' , 'bit-integrations' ) }
324+ subTitle = { __ ( 'Sends the click details of AdWords Ads to Zoho CRM' , 'bit-integrations' ) }
325+ />
326+ < TitleModal action = { openUpsertModal } >
327+ < TableCheckBox
328+ onChange = { e => actionHandler ( e , 'upsert' ) }
329+ checked = {
330+ tab === 0
331+ ? 'upsert' in crmConf . actions
332+ : 'upsert' in crmConf . relatedlists [ tab - 1 ] . actions
333+ }
334+ className = "wdt-200 mt-4 mr-2"
335+ value = "Upsert_Record"
336+ title = { __ ( 'Upsert Records' , 'bit-integrations' ) }
337+ subTitle = { __ (
338+ 'The record is updated if it already exists else it is inserted as a new record' ,
339+ 'bit-integrations'
340+ ) }
341+ />
342+ </ TitleModal >
343+ < TableCheckBox
344+ onChange = { openAssignmentRulesModal }
345+ checked = {
346+ tab === 0
347+ ? 'assignment_rules' in crmConf . actions
348+ : 'assignment_rules' in crmConf . relatedlists [ tab - 1 ] . actions
349+ }
350+ className = "wdt-200 mt-4 mr-2"
351+ value = "Assignment_Rule"
352+ title = { __ ( 'Assignment Rules' , 'bit-integrations' ) }
353+ subTitle = { __ ( 'Trigger Assignment Rules in Zoho CRM' , 'bit-integrations' ) }
354+ />
355+ </ >
356+ ) }
363357 </ div >
364358
365359 < ConfirmModal
@@ -375,15 +369,13 @@ export default function ZohoCRMActions({
375369 < div className = "mt-2" > { __ ( 'Select File Upload Fields' , 'bit-integrations' ) } </ div >
376370 < MultiSelect
377371 defaultValue = {
378- tab === 0
379- ? crmConf . actions . attachment
380- : crmConf . relatedlists [ tab - 1 ] . actions . attachment
372+ tab === 0 ? crmConf . actions . attachment : crmConf . relatedlists [ tab - 1 ] . actions . attachment
381373 }
382374 className = "mt-2 w-9"
383- onChange = { ( val ) => actionHandler ( val , 'attachment' ) }
375+ onChange = { val => actionHandler ( val , 'attachment' ) }
384376 options = { formFields
385- . filter ( ( itm ) => itm . type === 'file' )
386- . map ( ( itm ) => ( { label : itm . label , value : itm . name } ) ) }
377+ . filter ( itm => itm . type === 'file' )
378+ . map ( itm => ( { label : itm . label , value : itm . name } ) ) }
387379 />
388380 </ ConfirmModal >
389381
@@ -417,10 +409,10 @@ export default function ZohoCRMActions({
417409 : crmConf . relatedlists [ tab - 1 ] . actions . assignment_rules
418410 }
419411 className = "btcd-paper-inp"
420- onChange = { ( e ) => actionHandler ( e . target . value , 'assignment_rules' ) } >
412+ onChange = { e => actionHandler ( e . target . value , 'assignment_rules' ) } >
421413 < option value = "" > { __ ( 'Select Assignment Rule' , 'bit-integrations' ) } </ option >
422414 { crmConf ?. default ?. assignmentRules ?. [ module ] &&
423- Object . keys ( crmConf . default . assignmentRules [ module ] ) . map ( ( assignmentName ) => (
415+ Object . keys ( crmConf . default . assignmentRules [ module ] ) . map ( assignmentName => (
424416 < option
425417 key = { assignmentName }
426418 value = { crmConf . default . assignmentRules [ module ] [ assignmentName ] } >
@@ -429,9 +421,7 @@ export default function ZohoCRMActions({
429421 ) ) }
430422 </ select >
431423 < button
432- onClick = { ( ) =>
433- refreshAssigmentRules ( tab , crmConf , setCrmConf , setIsLoading , setSnackbar )
434- }
424+ onClick = { ( ) => refreshAssigmentRules ( tab , crmConf , setCrmConf , setIsLoading , setSnackbar ) }
435425 className = "icn-btn sh-sm ml-2 mr-2 tooltip"
436426 style = { {
437427 '--tooltip-txt' : `'${ __ ( 'Refresh CRM Assignment Rules' , 'bit-integrations' ) } '`
@@ -474,13 +464,11 @@ export default function ZohoCRMActions({
474464 tab === 0 ? crmConf . actions . tag_rec : crmConf . relatedlists [ tab - 1 ] . actions . tag_rec
475465 }
476466 options = { getTags ( ) }
477- onChange = { ( val ) => actionHandler ( val , 'tag_rec' ) }
467+ onChange = { val => actionHandler ( val , 'tag_rec' ) }
478468 customValue
479469 />
480470 < button
481- onClick = { ( ) =>
482- refreshTags ( tab , formID , crmConf , setCrmConf , setIsLoading , setSnackbar )
483- }
471+ onClick = { ( ) => refreshTags ( tab , formID , crmConf , setCrmConf , setIsLoading , setSnackbar ) }
484472 className = "icn-btn sh-sm ml-2 mr-2 tooltip"
485473 style = { { '--tooltip-txt' : `${ __ ( 'Refresh CRM Tags' , 'bit-integrations' ) } '` } }
486474 type = "button"
@@ -516,15 +504,13 @@ export default function ZohoCRMActions({
516504 < div className = "flx flx-between mt-2" >
517505 < select
518506 value = {
519- tab === 0
520- ? crmConf . actions . rec_owner
521- : crmConf . relatedlists [ tab - 1 ] . actions . rec_owner
507+ tab === 0 ? crmConf . actions . rec_owner : crmConf . relatedlists [ tab - 1 ] . actions . rec_owner
522508 }
523509 className = "btcd-paper-inp"
524- onChange = { ( e ) => actionHandler ( e . target . value , 'rec_owner' ) } >
510+ onChange = { e => actionHandler ( e . target . value , 'rec_owner' ) } >
525511 < option value = "" > { __ ( 'Select Owner' , 'bit-integrations' ) } </ option >
526512 { crmConf . default ?. crmOwner &&
527- Object . values ( crmConf . default . crmOwner ) ?. map ( ( owner ) => (
513+ Object . values ( crmConf . default . crmOwner ) ?. map ( owner => (
528514 < option key = { owner . id } value = { owner . id } >
529515 { owner . full_name }
530516 </ option >
@@ -542,11 +528,7 @@ export default function ZohoCRMActions({
542528 ) }
543529 </ ConfirmModal >
544530
545- < Modal
546- md
547- show = { upsertMdl }
548- setModal = { setUpsertMdl }
549- title = { __ ( 'Upsert Record' , 'bit-integrations' ) } >
531+ < Modal md show = { upsertMdl } setModal = { setUpsertMdl } title = { __ ( 'Upsert Record' , 'bit-integrations' ) } >
550532 < div className = "o-a" >
551533 { tab === 0
552534 ? crmConf ?. actions ?. upsert && (
@@ -557,8 +539,8 @@ export default function ZohoCRMActions({
557539 </ small >
558540 < ReactSortable
559541 list = { crmConf . actions . upsert ?. crmField }
560- setList = { ( l ) => setUpsertSettings ( l , 'list' ) } >
561- { crmConf . actions . upsert ?. crmField ?. map ( ( itm ) => (
542+ setList = { l => setUpsertSettings ( l , 'list' ) } >
543+ { crmConf . actions . upsert ?. crmField ?. map ( itm => (
562544 < div key = { `cf-${ itm . i } ` } className = "upsert_rec w-7 mt-1 flx" >
563545 < span className = "btcd-icn btcd-mnu mr-2" />
564546 { itm . name }
@@ -599,8 +581,8 @@ export default function ZohoCRMActions({
599581 </ small >
600582 < ReactSortable
601583 list = { crmConf . relatedlists [ tab - 1 ] . actions . upsert ?. crmField }
602- setList = { ( l ) => setUpsertSettings ( l , 'list' ) } >
603- { crmConf . relatedlists [ tab - 1 ] . actions . upsert ?. crmField ?. map ( ( itm ) => (
584+ setList = { l => setUpsertSettings ( l , 'list' ) } >
585+ { crmConf . relatedlists [ tab - 1 ] . actions . upsert ?. crmField ?. map ( itm => (
604586 < div key = { `cf-${ itm . i } ` } className = "upsert_rec w-7 mt-1 flx" >
605587 < span className = "btcd-icn btcd-mnu mr-2" />
606588 { itm . name }
0 commit comments