CFE-17 fixed porblem of call history showing

This commit is contained in:
2023-11-19 14:23:06 +03:30
parent 0d88145c74
commit da7b7852b0
4 changed files with 13 additions and 9 deletions

View File

@@ -261,7 +261,8 @@
"call_history_of": "تاریخچه تماس های", "call_history_of": "تاریخچه تماس های",
"call_history_not_found": "تاریخچه ای برای تماس دریافتی یافت نشد", "call_history_not_found": "تاریخچه ای برای تماس دریافتی یافت نشد",
"call_history_error_fetching": "خطا در دریافت تاریخچه تماس دریافتی", "call_history_error_fetching": "خطا در دریافت تاریخچه تماس دریافتی",
"show_more": "نمایش موارد بیشتر" "show_more": "نمایش موارد بیشتر",
"no_data_exist": "اطلاعاتی موجود نیست"
}, },
"CallAction": { "CallAction": {
"call_history_of": "عملیات های مربوط به تماس", "call_history_of": "عملیات های مربوط به تماس",

View File

@@ -1,8 +1,11 @@
import {useTranslations} from "next-intl"; import {useTranslations} from "next-intl";
import {Avatar, Box, ListItem, ListItemAvatar, ListItemText, Typography} from "@mui/material"; import {Avatar, Box, ListItem, ListItemAvatar, ListItemText, Typography} from "@mui/material";
import HeadsetMicIcon from '@mui/icons-material/HeadsetMic'; import HeadsetMicIcon from '@mui/icons-material/HeadsetMic';
import useLanguage from "@/lib/app/hooks/useLanguage";
import moment from "jalali-moment";
const PreviousOperatorData = ({historyItem}) => { const PreviousOperatorData = ({historyItem}) => {
const {languageApp} = useLanguage()
const t = useTranslations(); const t = useTranslations();
return ( return (
<ListItem> <ListItem>
@@ -14,13 +17,13 @@ const PreviousOperatorData = ({historyItem}) => {
<ListItemText primary={ <ListItemText primary={
<Box sx={{display: "flex", alignItems: "end"}}> <Box sx={{display: "flex", alignItems: "end"}}>
<Typography sx={{marginRight: 1, color: "#545151"}}> <Typography sx={{marginRight: 1, color: "#545151"}}>
{historyItem.operator_name} {historyItem.operator_full_name}
</Typography> </Typography>
<Typography variant="caption" sx={{color: "secondary.main"}}> <Typography variant="caption" sx={{color: "secondary.main"}}>
({t("CallHistory.operator")}) ({t("CallHistory.operator")})
</Typography> </Typography>
</Box> </Box>
} secondary={historyItem.answer_date}/> } secondary={moment(historyItem.created_at).locale(languageApp).format("HH:mm:ss | YYYY/MM/DD")}/>
</ListItem> </ListItem>
) )
} }

View File

@@ -12,7 +12,7 @@ const Topics = ({historyItem}) => {
{t("CallHistory.category_name")}: {t("CallHistory.category_name")}:
</Typography> </Typography>
<Typography variant="subtitle2" sx={{color: "#837e7e"}}> <Typography variant="subtitle2" sx={{color: "#837e7e"}}>
{historyItem.category_name} {historyItem.category_name || t("CallHistory.no_data_exist")}
</Typography> </Typography>
</Box> </Box>
</ListItem> </ListItem>
@@ -31,7 +31,7 @@ const Topics = ({historyItem}) => {
textAlign: "end", textAlign: "end",
color: "#837e7e" color: "#837e7e"
}}> }}>
{historyItem.subcategory_name} {historyItem.subcategory_name || t("CallHistory.no_data_exist")}
</Typography> </Typography>
</Box> </Box>
</ListItem> </ListItem>

View File

@@ -6,7 +6,7 @@ import HistoryHeader from "./HistoryHeader";
import ErrorOrEmpty from "./ErrorOrEmpty"; import ErrorOrEmpty from "./ErrorOrEmpty";
import useCallerHistory from "@/lib/callWidget/hooks/useCallerHistory"; import useCallerHistory from "@/lib/callWidget/hooks/useCallerHistory";
import ListItemOfCalls from "./ListItemOfCalls"; import ListItemOfCalls from "./ListItemOfCalls";
import {useState} from "react"; import {Fragment, useState} from "react";
const max_size = 10; const max_size = 10;
const CallHistory = ({tab}) => { const CallHistory = ({tab}) => {
@@ -40,7 +40,7 @@ const CallHistory = ({tab}) => {
<Chip <Chip
icon={<HeadphonesIcon/>} icon={<HeadphonesIcon/>}
onClick={() => setShowRestOfHistory(true)} onClick={() => setShowRestOfHistory(true)}
label={t("show_more")} label={t("CallHistory.show_more")}
disabled={showRestOfHistory} disabled={showRestOfHistory}
/> />
</Divider> </Divider>
@@ -48,10 +48,10 @@ const CallHistory = ({tab}) => {
{showRestOfHistory && ( {showRestOfHistory && (
<> <>
{historyList.map((historyItem, index) => ( {historyList.map((historyItem, index) => (
<> <Fragment key={historyItem.id}>
<ListItemOfCalls key={historyItem.id} historyItem={historyItem}/> <ListItemOfCalls key={historyItem.id} historyItem={historyItem}/>
<Divider/> <Divider/>
</> </Fragment>
))} ))}
</>) </>)
} }