Do you want to delete this log?
',\n showDenyButton: false,\n showCancelButton: true,\n confirmButtonText: 'Yes',\n denyButtonText: `No`,\n focusConfirm: false,\n customClass: {\n container: 'swal-container',\n },\n }).then((result) => {\n if (result.isConfirmed) {\n const paginationOnCompletion = {\n page: 1,\n limit: logs?.length ?? 1,\n };\n dispatch(\n deleteTimer(\n userData.id,\n {\n ids: taskTimerId,\n },\n paginationOnCompletion,\n () => {\n Toast.fire({\n title: 'Deleted successfully!',\n });\n }\n )\n );\n }\n });\n };\n\n const handleOnAddTags = (tag) => {\n if (!_.isEmpty(activeTimer))\n dispatch(\n updateTags({\n action: _.find(tagsList, (i) => i.title === tag.title)?.is_selected\n ? 'remove'\n : 'add',\n ids: _.find(tagsList, (i) => i.title === tag.title)?.id,\n rel_id: activeTimer?.task_timer_id,\n title: tag?.title,\n type: 'preset',\n })\n );\n else if (_.some(tags, (i) => i.title === tag.title))\n dispatch(\n setTags(\n tags.map((i) =>\n i.title === tag.title ? { ...i, is_selected: !i.is_selected } : i\n )\n )\n );\n else dispatch(setTags([...tags, { title: tag?.title, is_selected: true }]));\n };\n\n const handleUpdateRunningTimerPreset = (timer) => {\n dispatch(\n updateTimer(userData?.id, {\n id: timer.task_timer_id,\n partner_group_id: selectedPartner?.uuid ?? selectedPartner?.id ?? null,\n campaign_id: selectedCampaign?.uuid ?? null,\n concept_id: selectedConcept?.uuid ?? null,\n // tags: tags\n // ?.filter((i) => i.is_selected)\n // .map((i) => {\n // return i.title;\n // }),\n })\n );\n };\n\n const isParent = (log) => log.data?.length > 1;\n\n const hasFilledOutRequiredFields = () => {\n return (\n [\n !_.isNull(selectedPartner) && requiredFields?.includes('partner'),\n !_.isNull(selectedCampaign) && requiredFields?.includes('campaign'),\n !_.isNull(selectedConcept) && requiredFields?.includes('concept'),\n ]?.filter(Boolean).length === requiredFields?.length\n );\n };\n\n const canStopTimer =\n !_.isNull(selectedTaskCategory?.id ?? null) && hasFilledOutRequiredFields();\n\n // These logs are for debugging purposes only if ever an issue occured again.\n // console.log('selectedTaskCategory: ', selectedTaskCategory);\n // console.log('requiredFields: ', requiredFields);\n // console.log('selectedPartner: ', selectedPartner);\n // console.log('selectedCampaign: ', selectedCampaign);\n // console.log('selectedConcept: ', selectedConcept);\n // console.log('activeTimer: ', activeTimer);\n\n const getRequiredFields = (id) => {\n return getItemByKey('id', id, categories ?? []).required_fields ?? [];\n };\n\n const hasActiveTimer = !_.isUndefined(activeTimer) && !_.isEmpty(activeTimer);\n\n const generateRequiredFieldsWarningLabel = () => {\n if (requiredFields?.length === 3) {\n return capitalized(\n `${requiredFields[0] ?? ''}, ${requiredFields[1] ?? ''} and ${\n requiredFields[2] ?? ''\n } fields are required.`\n );\n } else if (requiredFields.length === 2) {\n return capitalized(\n `${requiredFields[0] ?? ''} and ${\n requiredFields[1] ?? ''\n } fields are required.`\n );\n } else {\n return capitalized(`${requiredFields[0] ?? ''} field is required.`);\n }\n };\n\n const capitalized = (str) => {\n return str.charAt(0).toUpperCase() + str.slice(1);\n };\n\n const handleDateRangeChange = async (ranges) => {\n const valueSearchStart = [ranges.selection].map((item) => item.startDate);\n const valueSearchEnd = [ranges.selection].map((item) => item.endDate);\n\n var duration = moment\n .duration(moment(valueSearchEnd[0]).diff(moment(valueSearchStart[0])))\n .asDays();\n\n if (duration <= 7) {\n setUpdateDate(!updateDate);\n dispatch(\n setSelectedDate(\n formatDate(valueSearchStart, 'YYYY-MM-DD') +\n ',' +\n formatDate(valueSearchEnd, 'YYYY-MM-DD')\n )\n );\n dispatch(setFilterSelectedDates([ranges.selection]));\n if (updateDate)\n dispatch(\n fetchUserTimeLogs(\n userData.id,\n {\n page: 1,\n limit: 7,\n dateStart: formatDate(valueSearchStart, 'YYYY-MM-DD'),\n dateEnd: formatDate(valueSearchEnd, 'YYYY-MM-DD'),\n },\n () => {}\n )\n );\n }\n };\n\n const handleTagsList = async (timer) => {\n const params = {\n relId: timer?.task_timer_id,\n relType: 'preset',\n };\n\n dispatch(fetchTags(params));\n };\n\n const handleOnOpenDateRange = (event) => {\n setAnchorEl(event.currentTarget);\n };\n\n const handleOnCloseDateRange = () => {\n setAnchorEl(null);\n setUpdateDate(false);\n };\n\n const handleClearDateRange = () => {\n dispatch(setSelectedDate(initialDate));\n dispatch(setFilterSelectedDates(selectedDatesInitial));\n dispatch(\n fetchUserTimeLogs(\n userData.id,\n {\n page: 1,\n limit: 7,\n },\n () => {}\n )\n );\n setUpdateDate(false);\n };\n\n return (\n \n );\n};\n\nTaskTimer.propTypes = {\n isOpen: PropTypes.bool.isRequired,\n handleClose: PropTypes.any,\n};\n\nexport default TaskTimer;\n","import PropTypes from 'prop-types';\n\nimport { Stack, Box, Typography, Button, Divider } from '@mui/material';\n\nconst Header = ({ onClose }) => {\n return (\nAd-Weave
\n You have ${unread} unread notification(s)