|
|
@ -10,6 +10,9 @@ import { |
|
|
|
} from "react-native"; |
|
|
|
} from "react-native"; |
|
|
|
import { connect } from "react-redux"; |
|
|
|
import { connect } from "react-redux"; |
|
|
|
import { useNavigation } from "@react-navigation/native"; |
|
|
|
import { useNavigation } from "@react-navigation/native"; |
|
|
|
|
|
|
|
import { comment } from "../../../redux/actions"; |
|
|
|
|
|
|
|
import moment from "jalali-moment"; |
|
|
|
|
|
|
|
|
|
|
|
//components
|
|
|
|
//components
|
|
|
|
import CustomPressable from "../../../components/Pressable"; |
|
|
|
import CustomPressable from "../../../components/Pressable"; |
|
|
|
import Navbar from "../../../components/Navbar"; |
|
|
|
import Navbar from "../../../components/Navbar"; |
|
|
@ -20,29 +23,33 @@ import tw from "tailwind-rn"; |
|
|
|
import Colors from "../../../constants/Colors"; |
|
|
|
import Colors from "../../../constants/Colors"; |
|
|
|
import fontSize from "../../../constants/fontSize"; |
|
|
|
import fontSize from "../../../constants/fontSize"; |
|
|
|
|
|
|
|
|
|
|
|
export const Tickets = ({ theme }) => { |
|
|
|
export const Tickets = ({ theme, getTicketList, list }) => { |
|
|
|
const navigation = useNavigation(); |
|
|
|
const navigation = useNavigation(); |
|
|
|
|
|
|
|
|
|
|
|
const tickets = React.useMemo(() => { |
|
|
|
React.useEffect(() => { |
|
|
|
return [ |
|
|
|
getTicketList({ type: 2 }); |
|
|
|
{ |
|
|
|
}, []); |
|
|
|
title: "موضوع تیکت", |
|
|
|
|
|
|
|
message: "دریافت اشتباه کتاب های ارسالی از سامانه سفارشات", |
|
|
|
// const tickets = React.useMemo(() => {
|
|
|
|
target: "دپارتمان فروش و بازاریابی", |
|
|
|
// return [
|
|
|
|
date: "1400/09/12", |
|
|
|
// {
|
|
|
|
isNew: true, |
|
|
|
// title: "موضوع تیکت",
|
|
|
|
isAnswered: true, |
|
|
|
// message: "دریافت اشتباه کتاب های ارسالی از سامانه سفارشات",
|
|
|
|
}, |
|
|
|
// target: "دپارتمان فروش و بازاریابی",
|
|
|
|
{ |
|
|
|
// date: "1400/09/12",
|
|
|
|
title: "موضوع تیکت", |
|
|
|
// isNew: true,
|
|
|
|
message: "دریافت اشتباه کتاب های ارسالی از سامانه سفارشات", |
|
|
|
// isAnswered: true,
|
|
|
|
target: "دپارتمان فروش و بازاریابی", |
|
|
|
// },
|
|
|
|
date: "1400/09/12", |
|
|
|
// {
|
|
|
|
isNew: false, |
|
|
|
// title: "موضوع تیکت",
|
|
|
|
isAnswered: false, |
|
|
|
// message: "دریافت اشتباه کتاب های ارسالی از سامانه سفارشات",
|
|
|
|
}, |
|
|
|
// target: "دپارتمان فروش و بازاریابی",
|
|
|
|
]; |
|
|
|
// date: "1400/09/12",
|
|
|
|
}, [theme]); |
|
|
|
// isNew: false,
|
|
|
|
|
|
|
|
// isAnswered: false,
|
|
|
|
|
|
|
|
// },
|
|
|
|
|
|
|
|
// ];
|
|
|
|
|
|
|
|
// }, [theme]);
|
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<SafeAreaView |
|
|
|
<SafeAreaView |
|
|
|
style={{ |
|
|
|
style={{ |
|
|
@ -62,14 +69,21 @@ export const Tickets = ({ theme }) => { |
|
|
|
back: true, |
|
|
|
back: true, |
|
|
|
}} |
|
|
|
}} |
|
|
|
/> |
|
|
|
/> |
|
|
|
{tickets.length ? ( |
|
|
|
{list?.length ? ( |
|
|
|
<ScrollView |
|
|
|
<ScrollView |
|
|
|
contentContainerStyle={{ paddingBottom: 100 }} |
|
|
|
contentContainerStyle={{ paddingBottom: 100 }} |
|
|
|
style={tw("px-4 pt-4 flex")} |
|
|
|
style={tw("px-4 pt-4 flex")} |
|
|
|
> |
|
|
|
> |
|
|
|
{tickets.map((ticket, index) => ( |
|
|
|
{list |
|
|
|
<Ticket ticket={ticket} key={index} theme={theme} /> |
|
|
|
?.filter((ticket) => ticket?.pid === null) |
|
|
|
))} |
|
|
|
?.map((ticket, index) => ( |
|
|
|
|
|
|
|
<Ticket |
|
|
|
|
|
|
|
ticket={ticket} |
|
|
|
|
|
|
|
key={index} |
|
|
|
|
|
|
|
theme={theme} |
|
|
|
|
|
|
|
isAnswered={list?.filter((tickett) => tickett?.pid === ticket?.id)?.length} |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
))} |
|
|
|
</ScrollView> |
|
|
|
</ScrollView> |
|
|
|
) : ( |
|
|
|
) : ( |
|
|
|
<Empty text="هیچ تیکتی وجود ندارد." /> |
|
|
|
<Empty text="هیچ تیکتی وجود ندارد." /> |
|
|
@ -88,9 +102,9 @@ export const Tickets = ({ theme }) => { |
|
|
|
); |
|
|
|
); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const Ticket = ({ ticket, theme }) => { |
|
|
|
const Ticket = ({ ticket, theme, isAnswered }) => { |
|
|
|
const navigation = useNavigation(); |
|
|
|
const navigation = useNavigation(); |
|
|
|
const { title, message, isNew, date, target, isAnswered } = ticket; |
|
|
|
const { title, text, isNew, date, unit, createdAt } = ticket; |
|
|
|
|
|
|
|
|
|
|
|
const light = React.useMemo(() => { |
|
|
|
const light = React.useMemo(() => { |
|
|
|
return theme === "light"; |
|
|
|
return theme === "light"; |
|
|
@ -124,7 +138,7 @@ const Ticket = ({ ticket, theme }) => { |
|
|
|
textAlign: "left", |
|
|
|
textAlign: "left", |
|
|
|
}} |
|
|
|
}} |
|
|
|
> |
|
|
|
> |
|
|
|
{date} |
|
|
|
{moment(createdAt).format("jYYYY/jMM/jDD")} |
|
|
|
</Text> |
|
|
|
</Text> |
|
|
|
<Text |
|
|
|
<Text |
|
|
|
style={{ |
|
|
|
style={{ |
|
|
@ -153,7 +167,7 @@ const Ticket = ({ ticket, theme }) => { |
|
|
|
marginTop: 5, |
|
|
|
marginTop: 5, |
|
|
|
}} |
|
|
|
}} |
|
|
|
> |
|
|
|
> |
|
|
|
{message} |
|
|
|
{text} |
|
|
|
</Text> |
|
|
|
</Text> |
|
|
|
<View style={tw("flex flex-row-reverse justify-between mt-4")}> |
|
|
|
<View style={tw("flex flex-row-reverse justify-between mt-4")}> |
|
|
|
<Text |
|
|
|
<Text |
|
|
@ -168,7 +182,7 @@ const Ticket = ({ ticket, theme }) => { |
|
|
|
: Colors.theme1.white, |
|
|
|
: Colors.theme1.white, |
|
|
|
}} |
|
|
|
}} |
|
|
|
> |
|
|
|
> |
|
|
|
{target} |
|
|
|
{unit} |
|
|
|
</Text> |
|
|
|
</Text> |
|
|
|
<Text |
|
|
|
<Text |
|
|
|
style={{ |
|
|
|
style={{ |
|
|
@ -201,8 +215,11 @@ const Ticket = ({ ticket, theme }) => { |
|
|
|
|
|
|
|
|
|
|
|
const mapStateToProps = (state) => ({ |
|
|
|
const mapStateToProps = (state) => ({ |
|
|
|
theme: state.publicApi.theme, |
|
|
|
theme: state.publicApi.theme, |
|
|
|
|
|
|
|
list: state.comment.myList, |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
const mapDispatchToProps = {}; |
|
|
|
const mapDispatchToProps = { |
|
|
|
|
|
|
|
getTicketList: comment.myList, |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(Tickets); |
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(Tickets); |
|
|
|