@@ -77,21 +77,14 @@ interface CategorySignature {
77
77
name: string ;
78
78
}
79
79
80
- // interface TaskSignature {
81
- // taskId: string | null;
82
- // subject: string | null;
83
- // dueDate: Date | any;
84
- // comments: string | null;
85
- // isCompleted: boolean;
86
- // }
87
-
88
80
interface GroupedTasksSignature {
89
- month: any ;
81
+ month: string | null ;
90
82
taskId: string | null ;
91
83
subject: string | null ;
92
84
dueDate: Date | any ;
93
85
comments: string | null ;
94
86
isCompleted: boolean ;
87
+ relatedTo: any ;
95
88
}
96
89
97
90
// *task-form
@@ -387,6 +380,23 @@ class IsolatedSecForSaleHub extends Component<typeof SaleHub> {
387
380
this .isTaskFormModalVisible = false ;
388
381
}
389
382
383
+ // task-form modal by Id
384
+ @tracked selectedTask: GroupedTasksSignature | null = null ;
385
+ @tracked isTaskFormModalByIdVisible = false ;
386
+
387
+ @action
388
+ openTaskFormModaById(id : string ) {
389
+ this .isTaskFormModalByIdVisible = true ;
390
+ const filteredTask = this .tasks .find ((task ) => task .taskId == id );
391
+ if (! filteredTask ) return ;
392
+ this .selectedTask = filteredTask ;
393
+ }
394
+
395
+ @action
396
+ closeTaskFormModalById() {
397
+ this .isTaskFormModalByIdVisible = false ;
398
+ }
399
+
390
400
// auto bind form
391
401
@action
392
402
updateAccountForm() {
@@ -566,34 +576,43 @@ class IsolatedSecForSaleHub extends Component<typeof SaleHub> {
566
576
567
577
// upcoming task list
568
578
get tasks() {
569
- if ( ! this .args .model . scheduledTask ) return [] ;
579
+ const { scheduledTask } = this .args .model ;
570
580
571
- const mapTasks = this .args .model .scheduledTask .map ((task ) => {
581
+ if (! scheduledTask ) return [];
582
+
583
+ return scheduledTask .map ((task ) => {
584
+ const { taskForm } = task ;
572
585
return {
573
- month: task .taskForm .dueDate
574
- ? this .formatDueDate (task .taskForm .dueDate )
575
- : null ,
576
- taskId: task .taskForm .taskId ,
577
- subject: task .taskForm .subject ,
578
- dueDate: task .taskForm .dueDate ,
579
- comments: task .taskForm .comments ,
580
- isCompleted: task .taskForm .isCompleted ,
586
+ month: taskForm .dueDate ? this .formatDueDate (taskForm .dueDate ) : null ,
587
+ taskId: taskForm .taskId ,
588
+ subject: taskForm .subject ,
589
+ dueDate: taskForm .dueDate ,
590
+ comments: taskForm .comments ,
591
+ isCompleted: taskForm .isCompleted ,
592
+ relatedTo: taskForm .relatedTo ,
581
593
};
582
594
});
583
- return mapTasks ;
584
595
}
585
596
586
597
get groupedTasks() {
587
598
if (! this .tasks ) return ;
588
599
589
600
const groupedTasks: { [key : string ]: GroupedTasksSignature [] } =
590
- this .tasks .reduce ((acc : any , task : GroupedTasksSignature ) => {
591
- if (! acc [task .month ]) {
592
- acc [task .month ] = [];
593
- }
594
- acc [task .month ].push (task );
595
- return acc ;
596
- }, {});
601
+ this .tasks .reduce (
602
+ (
603
+ acc : { [key : string ]: GroupedTasksSignature [] },
604
+ task : GroupedTasksSignature ,
605
+ ) => {
606
+ if (!! task .month ) {
607
+ if (! acc [task .month ]) {
608
+ acc [task .month ] = [];
609
+ }
610
+ acc [task .month ].push (task );
611
+ }
612
+ return acc ;
613
+ },
614
+ {},
615
+ );
597
616
598
617
const sortedMonths = Object .keys (groupedTasks ).sort ((a , b ) => {
599
618
if (a === ' Upcoming' ) return - 1 ;
@@ -811,6 +830,50 @@ class IsolatedSecForSaleHub extends Component<typeof SaleHub> {
811
830
</div >
812
831
</CardContainer >
813
832
</Modal >
833
+ <Modal
834
+ @ size ={{' large' }}
835
+ @ isOpen ={{this .isTaskFormModalByIdVisible }}
836
+ @ onClose ={{this .closeTaskFormModalById }}
837
+ class =' dialog'
838
+ >
839
+ <CardContainer class =' container' >
840
+ <IconButton
841
+ @ icon ={{IconX }}
842
+ @ width =' 12'
843
+ @ height =' 12'
844
+ {{on ' click' this . closeTaskFormModalById}}
845
+ class =' dialog-box__close'
846
+ aria-label =' close modal'
847
+ />
848
+ <div class =' dialog-box' >
849
+ <CardContainer @ displayBoundaries ={{ false }} >
850
+ <FieldContainer @ tag =' label' @ label =' Task Id' @ vertical ={{ false }} >
851
+ {{this .selectedTask.taskId }}
852
+ </FieldContainer >
853
+
854
+ <FieldContainer @ tag =' label' @ label =' Subject' @ vertical ={{ false }} >
855
+ {{this .selectedTask.subject }}
856
+ </FieldContainer >
857
+
858
+ <FieldContainer @ tag =' label' @ label =' Comments' @ vertical ={{ false }} >
859
+ {{this .selectedTask.comments }}
860
+ </FieldContainer >
861
+
862
+ <FieldContainer @ tag =' label' @ label =' Due Date' @ vertical ={{ false }} >
863
+ {{this .selectedTask.dueDate }}
864
+ </FieldContainer >
865
+
866
+ <FieldContainer
867
+ @ tag =' label'
868
+ @ label =' Related To'
869
+ @ vertical ={{ false }}
870
+ >
871
+ {{this .selectedTask.relatedTo.accountName }}
872
+ </FieldContainer >
873
+ </CardContainer >
874
+ </div >
875
+ </CardContainer >
876
+ </Modal >
814
877
815
878
<div class =' sale-hub' >
816
879
<section >
@@ -892,9 +955,6 @@ class IsolatedSecForSaleHub extends Component<typeof SaleHub> {
892
955
893
956
<section class =' activity-panel' >
894
957
<div class =' activity-button-group' >
895
- <button class =' button' >
896
- New Event
897
- </button >
898
958
<button class =' button' {{on ' click' this . openTaskFormModal}} >
899
959
New Task
900
960
</button >
@@ -912,19 +972,29 @@ class IsolatedSecForSaleHub extends Component<typeof SaleHub> {
912
972
<div >
913
973
{{#each tasks as | task | }}
914
974
<div class =' checkbox-card' >
915
- <label class =' checkbox-label' >
916
- <input
917
- type =' checkbox'
918
- checked ={{task.isCompleted }}
975
+ <div >
976
+ <label >
977
+ <input
978
+ type =' checkbox'
979
+ checked ={{task.isCompleted }}
980
+ {{on
981
+ ' change'
982
+ ( fn this . toggleOnCheckTask task.taskId )
983
+ }}
984
+ />
985
+ <span
986
+ class ={{if task.isCompleted ' line-through' }}
987
+ >You had an event/a task -
988
+ </span >
989
+ </label >
990
+ <span
991
+ class =' highlight-link'
919
992
{{on
920
- ' change '
921
- ( fn this . toggleOnCheckTask task.taskId )
993
+ ' click '
994
+ ( fn this . openTaskFormModaById task.taskId )
922
995
}}
923
- />
924
- <span class ={{if task.isCompleted ' line-through' }} >You
925
- had an event/a task -
926
- {{task.subject }} </span >
927
- </label >
996
+ >{{task.subject }} </span >
997
+ </div >
928
998
929
999
<span class =' dueDate' >{{this .formatDay
930
1000
task.dueDate
@@ -1142,6 +1212,11 @@ class IsolatedSecForSaleHub extends Component<typeof SaleHub> {
1142
1212
justify-content : end ;
1143
1213
gap : var (--boxel-sp-xs );
1144
1214
}
1215
+ .highlight-link {
1216
+ text-decoration : underline ;
1217
+ font-weight : bold ;
1218
+ cursor : pointer ;
1219
+ }
1145
1220
< /style >
1146
1221
</template >
1147
1222
}
0 commit comments