Compare commits

...

3 Commits

3 changed files with 84 additions and 29 deletions

View File

@@ -64,7 +64,7 @@ const transformNotificationData = (apiData) => {
}) + ' WIB' }) + ' WIB'
: 'N/A', : 'N/A',
location: item.plant_sub_section_name || item.device_location || 'Location not specified', location: item.plant_sub_section_name || item.device_location || 'Location not specified',
details: item.message_error_issue || 'No details available', details: item.device_name || '-',
link: `/verification-sparepart/${item.notification_error_id}`, // Dummy URL untuk verifikasi spare part link: `/verification-sparepart/${item.notification_error_id}`, // Dummy URL untuk verifikasi spare part
subsection: item.plant_sub_section_name || 'N/A', subsection: item.plant_sub_section_name || 'N/A',
isRead: item.is_read, isRead: item.is_read,
@@ -396,7 +396,7 @@ const ListNotification = memo(function ListNotification(props) {
</div> </div>
</Col> </Col>
<Col flex="auto"> <Col flex="auto">
<div {/* <div
style={{ style={{
display: 'flex', display: 'flex',
gap: '8px', gap: '8px',
@@ -419,12 +419,18 @@ const ListNotification = memo(function ListNotification(props) {
> >
{notification.details} {notification.details}
</Paragraph> </Paragraph>
</div> </div> */}
<Space <Space
direction="vertical" direction="vertical"
size={4} size={4}
style={{ fontSize: '13px', color: '#8c8c8c' }} style={{ fontSize: '13px', color: '#8c8c8c' }}
> >
<Space>
<MobileOutlined />
<Text type="secondary">
{notification.details}
</Text>
</Space>
<Space> <Space>
<ClockCircleOutlined /> <ClockCircleOutlined />
<Text type="secondary"> <Text type="secondary">
@@ -438,17 +444,10 @@ const ListNotification = memo(function ListNotification(props) {
</Text> </Text>
</Space> </Space>
<Space> <Space>
<LinkOutlined />
<AntdLink
href={notification.link}
target="_blank"
>
{notification.link}
</AntdLink>
<Button <Button
type="link" type="link"
icon={<SendOutlined />} icon={<SendOutlined />}
style={{ paddingLeft: '8px' }} style={{ paddingLeft: '0px' }}
onClick={(e) => { onClick={(e) => {
e.stopPropagation(); e.stopPropagation();
handleResend(notification); handleResend(notification);
@@ -646,7 +645,7 @@ const ListNotification = memo(function ListNotification(props) {
padding: '0 16px', padding: '0 16px',
position: 'relative', position: 'relative',
border: '1px solid #f0f0f0', border: '1px solid #f0f0f0',
borderRadius: '4px' borderRadius: '4px',
}} }}
> >
<div style={{ position: 'relative' }}> <div style={{ position: 'relative' }}>
@@ -708,7 +707,9 @@ const ListNotification = memo(function ListNotification(props) {
</Text> </Text>
</Space> </Space>
<div> <div>
<Text strong>Added by: {log.addedBy.name}</Text> <Text strong>
Added by: {log.addedBy.name}
</Text>
<span <span
style={{ style={{
marginLeft: '8px', marginLeft: '8px',
@@ -1412,7 +1413,7 @@ const ListNotification = memo(function ListNotification(props) {
</div> </div>
) : ( ) : (
<Typography.Title level={4} style={{ margin: 0 }}> <Typography.Title level={4} style={{ margin: 0 }}>
{modalContent === 'user' && 'User History Notification'} {modalContent === 'user' && 'History User Notification'}
{modalContent === 'log' && 'Log History Notification'} {modalContent === 'log' && 'Log History Notification'}
</Typography.Title> </Typography.Title>
)} )}

View File

@@ -1,6 +1,12 @@
import React from 'react'; import React from 'react';
import { Modal, Typography, Card, Row, Col, Avatar, Tag, Button, Space } from 'antd'; import { Modal, Typography, Card, Row, Col, Avatar, Tag, Button, Space } from 'antd';
import { UserOutlined, PhoneOutlined, CheckCircleOutlined, SyncOutlined, SendOutlined } from '@ant-design/icons'; import {
UserOutlined,
PhoneOutlined,
CheckCircleOutlined,
SyncOutlined,
SendOutlined,
} from '@ant-design/icons';
const { Text } = Typography; const { Text } = Typography;
@@ -41,9 +47,17 @@ const UserHistoryModal = ({ visible, onCancel, notificationData }) => {
const getStatusTag = (status) => { const getStatusTag = (status) => {
switch (status) { switch (status) {
case 'delivered': case 'delivered':
return <Tag icon={<CheckCircleOutlined />} color="success">Delivered</Tag>; return (
<Tag icon={<CheckCircleOutlined />} color="success">
Delivered
</Tag>
);
case 'sent': case 'sent':
return <Tag icon={<SyncOutlined spin />} color="processing">Sent</Tag>; return (
<Tag icon={<SyncOutlined spin />} color="processing">
Sent
</Tag>
);
case 'failed': case 'failed':
return <Tag color="error">Failed</Tag>; return <Tag color="error">Failed</Tag>;
default: default:
@@ -55,7 +69,7 @@ const UserHistoryModal = ({ visible, onCancel, notificationData }) => {
<Modal <Modal
title={ title={
<Text strong style={{ fontSize: '18px' }}> <Text strong style={{ fontSize: '18px' }}>
User History Notification History User Notification
</Text> </Text>
} }
open={visible} open={visible}
@@ -78,7 +92,13 @@ const UserHistoryModal = ({ visible, onCancel, notificationData }) => {
<Avatar size="large" icon={<UserOutlined />} /> <Avatar size="large" icon={<UserOutlined />} />
<div> <div>
<Text strong>{user.name}</Text> <Text strong>{user.name}</Text>
<div style={{ display: 'flex', alignItems: 'center', gap: '4px' }}> <div
style={{
display: 'flex',
alignItems: 'center',
gap: '4px',
}}
>
<PhoneOutlined style={{ color: '#8c8c8c' }} /> <PhoneOutlined style={{ color: '#8c8c8c' }} />
<Text type="secondary">{user.phone}</Text> <Text type="secondary">{user.phone}</Text>
</div> </div>

View File

@@ -1,14 +1,37 @@
import React from 'react'; import React from 'react';
import { Button, Row, Col, Card, Badge, Typography, Space, Divider } from 'antd'; import { Button, Row, Col, Card, Badge, Typography, Space, Divider } from 'antd';
import { SendOutlined, MobileOutlined, CheckCircleFilled, ArrowLeftOutlined } from '@ant-design/icons'; import {
SendOutlined,
MobileOutlined,
CheckCircleFilled,
ArrowLeftOutlined,
} from '@ant-design/icons';
const { Text } = Typography; const { Text } = Typography;
// Dummy data for user history // Dummy data for user history
const userHistoryData = [ const userHistoryData = [
{ id: 1, name: 'John Doe', phone: '081234567890', status: 'Delivered', timestamp: '04-11-2025 11:40 WIB' }, {
{ id: 2, name: 'Jane Smith', phone: '087654321098', status: 'Delivered', timestamp: '04-11-2025 11:41 WIB' }, id: 1,
{ id: 3, name: 'Peter Jones', phone: '082345678901', status: 'Delivered', timestamp: '04-11-2025 11:42 WIB' }, name: 'John Doe',
phone: '081234567890',
status: 'Delivered',
timestamp: '04-11-2025 11:40 WIB',
},
{
id: 2,
name: 'Jane Smith',
phone: '087654321098',
status: 'Delivered',
timestamp: '04-11-2025 11:41 WIB',
},
{
id: 3,
name: 'Peter Jones',
phone: '082345678901',
status: 'Delivered',
timestamp: '04-11-2025 11:42 WIB',
},
]; ];
const UserHistory = ({ notification, onBack }) => { const UserHistory = ({ notification, onBack }) => {
@@ -18,7 +41,9 @@ const UserHistory = ({ notification, onBack }) => {
<Col> <Col>
<Space align="center"> <Space align="center">
<Button type="text" icon={<ArrowLeftOutlined />} onClick={onBack} /> <Button type="text" icon={<ArrowLeftOutlined />} onClick={onBack} />
<Typography.Title level={4} style={{ margin: 0 }}>User History Notification</Typography.Title> <Typography.Title level={4} style={{ margin: 0 }}>
History User Notification
</Typography.Title>
</Space> </Space>
<Text type="secondary" style={{ marginLeft: '40px' }}> <Text type="secondary" style={{ marginLeft: '40px' }}>
{notification.title} - {notification.issue} {notification.title} - {notification.issue}
@@ -27,25 +52,34 @@ const UserHistory = ({ notification, onBack }) => {
</Row> </Row>
<Space direction="vertical" size="middle" style={{ display: 'flex' }}> <Space direction="vertical" size="middle" style={{ display: 'flex' }}>
{userHistoryData.map(user => ( {userHistoryData.map((user) => (
<Card key={user.id} style={{ backgroundColor: '#e6f7ff', borderColor: '#91d5ff' }}> <Card
key={user.id}
style={{ backgroundColor: '#e6f7ff', borderColor: '#91d5ff' }}
>
<Row align="middle" justify="space-between"> <Row align="middle" justify="space-between">
<Col> <Col>
<Space align="center"> <Space align="center">
<Text strong>{user.name}</Text> <Text strong>{user.name}</Text>
<Text>|</Text> <Text>|</Text>
<Text><MobileOutlined /> {user.phone}</Text> <Text>
<MobileOutlined /> {user.phone}
</Text>
<Text>|</Text> <Text>|</Text>
<Badge status="success" text={user.status} /> <Badge status="success" text={user.status} />
</Space> </Space>
<Divider style={{ margin: '8px 0' }} /> <Divider style={{ margin: '8px 0' }} />
<Space align="center"> <Space align="center">
<CheckCircleFilled style={{ color: '#52c41a' }} /> <CheckCircleFilled style={{ color: '#52c41a' }} />
<Text type="secondary">Success Delivered at {user.timestamp}</Text> <Text type="secondary">
Success Delivered at {user.timestamp}
</Text>
</Space> </Space>
</Col> </Col>
<Col> <Col>
<Button type="primary" ghost icon={<SendOutlined />}>Resend</Button> <Button type="primary" ghost icon={<SendOutlined />}>
Resend
</Button>
</Col> </Col>
</Row> </Row>
</Card> </Card>