Skip to content

Commit 7e6313e

Browse files
author
lucas
committed
seperate and resorting the date by upcoming, today date and overdue
1 parent 312a9e9 commit 7e6313e

File tree

2 files changed

+66
-6
lines changed

2 files changed

+66
-6
lines changed

packages/drafts-realm/SaleHub/bcbf2e7d-16ad-41e0-95a4-03dc988809e5.json

+58-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,44 @@
104104
"percentage": null,
105105
"forecastCategory": null
106106
},
107-
"scheduledTask": [],
107+
"scheduledTask": [
108+
{
109+
"taskForm": {
110+
"taskId": "0",
111+
"subject": "1",
112+
"dueDate": "2024-06-29",
113+
"comments": null,
114+
"isCompleted": false
115+
}
116+
},
117+
{
118+
"taskForm": {
119+
"taskId": "1",
120+
"subject": "task b",
121+
"dueDate": "2024-06-27",
122+
"comments": null,
123+
"isCompleted": false
124+
}
125+
},
126+
{
127+
"taskForm": {
128+
"taskId": "2",
129+
"subject": "task ccc",
130+
"dueDate": "2024-06-30",
131+
"comments": null,
132+
"isCompleted": false
133+
}
134+
},
135+
{
136+
"taskForm": {
137+
"taskId": "3",
138+
"subject": "task xx",
139+
"dueDate": "2024-07-03",
140+
"comments": null,
141+
"isCompleted": false
142+
}
143+
}
144+
],
108145
"title": null,
109146
"description": null,
110147
"thumbnailURL": null
@@ -129,6 +166,26 @@
129166
"links": {
130167
"self": null
131168
}
169+
},
170+
"scheduledTask.0.taskForm.relatedTo": {
171+
"links": {
172+
"self": "http://localhost:4201/drafts/CardDef/7298c9c6-2964-41a0-87f7-42127a16e12b"
173+
}
174+
},
175+
"scheduledTask.1.taskForm.relatedTo": {
176+
"links": {
177+
"self": "http://localhost:4201/drafts/CrmAccount/4802eeed-bec6-4d7a-8f05-6370866edd40"
178+
}
179+
},
180+
"scheduledTask.2.taskForm.relatedTo": {
181+
"links": {
182+
"self": null
183+
}
184+
},
185+
"scheduledTask.3.taskForm.relatedTo": {
186+
"links": {
187+
"self": "http://localhost:4201/drafts/CardDef/992531db-9912-49eb-9b72-f710cbcdb085"
188+
}
132189
}
133190
},
134191
"meta": {

packages/drafts-realm/sale-hub.gts

+8-5
Original file line numberDiff line numberDiff line change
@@ -969,8 +969,8 @@ class IsolatedSecForSaleHub extends Component<typeof SaleHub> {
969969
}, {});
970970

971971
const sortedMonths = Object.keys(groupedTasks).sort((a, b) => {
972-
if (a === 'Upcoming & Overdue') return -1;
973-
if (b === 'Upcoming & Overdue') return 1;
972+
if (a === 'Upcoming') return -1;
973+
if (b === 'Overdue') return 1;
974974
return new Date(a).getTime() - new Date(b).getTime();
975975
});
976976

@@ -990,15 +990,18 @@ class IsolatedSecForSaleHub extends Component<typeof SaleHub> {
990990

991991
@action formatDueDate(date: Date) {
992992
const todayDate = new Date();
993-
if (date > todayDate || isToday(date))
994-
return formatDate(new Date(date), 'MMMM yyyy');
995-
return 'Upcoming & Overdue';
993+
994+
if (isToday(date)) return formatDate(new Date(date), 'MMMM yyyy');
995+
if (date > todayDate) return 'Upcoming';
996+
return 'Overdue';
996997
}
997998

998999
@action formatDay(date: Date) {
9991000
const todayDate = new Date();
10001001
if (isToday(date)) return 'Today';
10011002
if (isTomorrow(date)) return 'Tomorrow';
1003+
if (date > todayDate || isTomorrow(date))
1004+
return formatDate(new Date(date), 'dd/MM/yyyy');
10021005
if (date < todayDate) return null;
10031006
if (isThisMonth(date)) return 'This Month';
10041007
return null;

0 commit comments

Comments
 (0)