fix feedback emotion
This commit is contained in:
@ -102,8 +102,8 @@ const ManageFeedbackMemberProvider = ({ children }: { children: React.ReactNode
|
||||
}
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.feedbacks_emotion,
|
||||
id: 'feedback_emotion',
|
||||
accessorFn: (row) => row.emotion_label,
|
||||
id: 'emotion_label',
|
||||
header: ({ column }) => <DataGridColumnHeader title="Emotion" column={column} />,
|
||||
enableSorting: false,
|
||||
enableHiding: false,
|
||||
@ -152,6 +152,17 @@ const ManageFeedbackMemberProvider = ({ children }: { children: React.ReactNode
|
||||
[]
|
||||
);
|
||||
|
||||
const getEmotionLabel = (emotion: string) => {
|
||||
const emotions: Record<string, string> = {
|
||||
'1': 'Very Dissatisfied',
|
||||
'2': 'Dissatisfied',
|
||||
'3': 'Neutral',
|
||||
'4': 'Satisfied',
|
||||
'5': 'Very Satisfied'
|
||||
};
|
||||
return emotions[emotion] || 'N/A';
|
||||
};
|
||||
|
||||
const getfeedbackLists = async (page: number, limit: number, sorting: any, filter: any) => {
|
||||
try {
|
||||
setLastFetchParams({
|
||||
@ -170,9 +181,13 @@ const ManageFeedbackMemberProvider = ({ children }: { children: React.ReactNode
|
||||
order_field: sorting[0].id,
|
||||
order_direction: sorting[0].desc == false ? 'ASC' : 'DESC'
|
||||
});
|
||||
let resFeedback = response?.data.list.map((el: any) => {
|
||||
el.emotion_label = getEmotionLabel(el.feedbacks_emotion)
|
||||
return el;
|
||||
});
|
||||
// console.log(response?.data);
|
||||
setFeedback(response?.data.list);
|
||||
return { data: response?.data.list, totalCount: response?.data.total_count };
|
||||
setFeedback(resFeedback);
|
||||
return { data: resFeedback, totalCount: response?.data.total_count };
|
||||
} catch (error) {
|
||||
console.error('Error fetching Feedback Member', error);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user