diff --git a/pages/cart/publishers/stats.tsx b/pages/cart/publishers/stats.tsx
index 049706b..26bd534 100644
--- a/pages/cart/publishers/stats.tsx
+++ b/pages/cart/publishers/stats.tsx
@@ -37,7 +37,8 @@ function ContactsPage({ allPublishers }) {
const [hideEmptyFields, setHideEmptyFields] = useState({
availability: false,
assignments: false,
- lastLogin: false
+ lastLogin: false,
+ notifiications: false
});
function handleSort(field) {
@@ -56,6 +57,7 @@ function ContactsPage({ allPublishers }) {
&& (!hideEmptyFields.availability || publisher.currentMonthAvailabilityDaysCount > 0)
&& (!hideEmptyFields.assignments || publisher.currentMonthAssignments > 0)
&& (!hideEmptyFields.lastLogin || publisher.lastLogin)
+ && (!hideEmptyFields.notifiications || publisher.isPushActive)
);
if (sortField) {
@@ -177,6 +179,17 @@ function ContactsPage({ allPublishers }) {
type="checkbox" className='ml-2'
checked={hideEmptyFields.lastLogin}
onChange={() => setHideEmptyFields({ ...hideEmptyFields, lastLogin: !hideEmptyFields.lastLogin })}
+ title="Скрий редове без нотификации"
+ />
+
+
+
+ Нотификации
+
+ setHideEmptyFields({ ...hideEmptyFields, notifiications: !hideEmptyFields.notifiications })}
title="Скрий редове без последно влизане"
/>
|
@@ -228,6 +241,14 @@ function ContactsPage({ allPublishers }) {
| {/* Empty cell for alignment */}
>
)}
+
+ {/* show notification checkmark badge if isPushActive */}
+ {pub.isPushActive ? (
+ ✔
+ ) : (
+ -
+ )}
+ |
);
})}
diff --git a/src/helpers/data.js b/src/helpers/data.js
index 3f4c350..fdad7a1 100644
--- a/src/helpers/data.js
+++ b/src/helpers/data.js
@@ -346,7 +346,6 @@ async function filterPublishersNew(selectFields, filterDate, isExactTime = false
}
}
-
console.log(`getting publishers for date: ${filterDate}, isExactTime: ${isExactTime}, isForTheMonth: ${isForTheMonth}`);
console.log`whereClause: ${JSON.stringify(whereClause)}`
//include availabilities if flag is true
@@ -532,6 +531,7 @@ async function getAllPublishersWithStatistics(filterDate, noEndDateFilter = fals
desiredShiftsPerMonth: true,
lastLogin: true,
type: true,
+ pushSubscription: true,
assignments: {
select: {
id: true,
@@ -575,6 +575,8 @@ async function getAllPublishersWithStatistics(filterDate, noEndDateFilter = fals
allPublishers.forEach(publisher => {
+ publisher.isPushActive = publisher.pushSubscription ? true : false;
+ delete publisher.pushSubscription
// Use helper functions to calculate and assign assignment counts
publisher.currentMonthAssignments = countAssignments(publisher.assignments, monthInfo.firstMonday, monthInfo.lastSunday);
publisher.previousMonthAssignments = countAssignments(publisher.assignments, prevMonthInfo.firstMonday, prevMonthInfo.lastSunday);