|
|
@ -10,6 +10,7 @@ import { |
|
|
|
import { connect } from "react-redux"; |
|
|
|
import { connect } from "react-redux"; |
|
|
|
import { userProduct, comment, file, form } from "../../../redux/actions"; |
|
|
|
import { userProduct, comment, file, form } from "../../../redux/actions"; |
|
|
|
import onInput from "../../../utils/onInput"; |
|
|
|
import onInput from "../../../utils/onInput"; |
|
|
|
|
|
|
|
import { asyncAwesomeAlert } from "../../../utils/AsyncWrappers"; |
|
|
|
|
|
|
|
|
|
|
|
//components
|
|
|
|
//components
|
|
|
|
import CustomTextInput from "../../../components/CustomTextInput"; |
|
|
|
import CustomTextInput from "../../../components/CustomTextInput"; |
|
|
@ -38,25 +39,23 @@ export const Ticket = ({ |
|
|
|
}, [status]); |
|
|
|
}, [status]); |
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
useEffect(() => { |
|
|
|
if (myProductList.length === 0 && status) { |
|
|
|
if (status) { |
|
|
|
getUserProductList(); |
|
|
|
getUserProductList(); |
|
|
|
} |
|
|
|
} |
|
|
|
}, []); |
|
|
|
}, []); |
|
|
|
|
|
|
|
|
|
|
|
const send = useCallback(async () => { |
|
|
|
const send = useCallback(async () => { |
|
|
|
if (!ticket?.subject) { |
|
|
|
if (!ticket?.unit) { |
|
|
|
setDialog({ |
|
|
|
asyncAwesomeAlert("", "واحد مورد نظر خود را وارد نکرده اید.", { |
|
|
|
text: "موضوع پیام خود را وارد کنید.", |
|
|
|
showCancelButton: false, |
|
|
|
type: "alert", |
|
|
|
|
|
|
|
accept: () => {}, |
|
|
|
|
|
|
|
open: true, |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
} else if (!ticket?.unit) { |
|
|
|
} else if (!ticket?.subject) { |
|
|
|
setDialog({ |
|
|
|
asyncAwesomeAlert("", "موضوع پیام خود را وارد کنید.", { |
|
|
|
text: "واحد مورد نظر خود را وارد نکرده اید.", |
|
|
|
showCancelButton: false, |
|
|
|
type: "alert", |
|
|
|
}); |
|
|
|
accept: () => {}, |
|
|
|
} else if (!ticket?.text) { |
|
|
|
open: true, |
|
|
|
asyncAwesomeAlert("", "متن پیام خود را وارد کنید.", { |
|
|
|
|
|
|
|
showCancelButton: false, |
|
|
|
}); |
|
|
|
}); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
const data = { |
|
|
|
const data = { |
|
|
@ -71,7 +70,7 @@ export const Ticket = ({ |
|
|
|
}; |
|
|
|
}; |
|
|
|
await submit(data); |
|
|
|
await submit(data); |
|
|
|
} |
|
|
|
} |
|
|
|
}, [status]); |
|
|
|
}, [status, ticket]); |
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<SafeAreaView |
|
|
|
<SafeAreaView |
|
|
@ -109,17 +108,17 @@ export const Ticket = ({ |
|
|
|
onChange={(name, value) => setTicket({ name, value })} |
|
|
|
onChange={(name, value) => setTicket({ name, value })} |
|
|
|
value={ticket?.cellphone || ""} |
|
|
|
value={ticket?.cellphone || ""} |
|
|
|
regex={(val) => onInput.phonenumber(val)} |
|
|
|
regex={(val) => onInput.phonenumber(val)} |
|
|
|
maxLength="11" |
|
|
|
maxLength={11} |
|
|
|
/> |
|
|
|
/> |
|
|
|
</> |
|
|
|
</> |
|
|
|
)} |
|
|
|
)} |
|
|
|
{/* <Select |
|
|
|
<Select |
|
|
|
defaultValue={ticket?.unit || myProductList[0]} |
|
|
|
defaultValue={ticket?.unit || opt[0]} |
|
|
|
options={status && myProductList?.length ? opt : opt.slice(0, 3)} |
|
|
|
options={myProductList.length ? opt : opt.slice(0, 3)} |
|
|
|
name="unit" |
|
|
|
name="unit" |
|
|
|
onChange={(name, value) => setTicket({ name, value })} |
|
|
|
onChange={(name, value) => setTicket({ name, value })} |
|
|
|
width={"100%"} |
|
|
|
width={"100%"} |
|
|
|
/> */} |
|
|
|
/> |
|
|
|
{ticket?.unit === "واحد محتوایی" && ( |
|
|
|
{ticket?.unit === "واحد محتوایی" && ( |
|
|
|
<Select |
|
|
|
<Select |
|
|
|
name="bookId" |
|
|
|
name="bookId" |
|
|
@ -144,6 +143,7 @@ export const Ticket = ({ |
|
|
|
value={ticket?.subject || ""} |
|
|
|
value={ticket?.subject || ""} |
|
|
|
regex={(val) => val} |
|
|
|
regex={(val) => val} |
|
|
|
label="موضوع" |
|
|
|
label="موضوع" |
|
|
|
|
|
|
|
textAlign={"right"} |
|
|
|
/> |
|
|
|
/> |
|
|
|
<CustomTextInput |
|
|
|
<CustomTextInput |
|
|
|
name="text" |
|
|
|
name="text" |
|
|
@ -152,10 +152,11 @@ export const Ticket = ({ |
|
|
|
regex={(val) => val} |
|
|
|
regex={(val) => val} |
|
|
|
label="متن پیام" |
|
|
|
label="متن پیام" |
|
|
|
multiline={true} |
|
|
|
multiline={true} |
|
|
|
|
|
|
|
textAlign={"right"} |
|
|
|
/> |
|
|
|
/> |
|
|
|
<View style={tw("mt-4")}></View> |
|
|
|
<View style={tw("mt-4")}></View> |
|
|
|
</ScrollView> |
|
|
|
</ScrollView> |
|
|
|
<View style={tw('w-full px-4')}> |
|
|
|
<View style={tw("w-full px-4")}> |
|
|
|
<CustomPressable |
|
|
|
<CustomPressable |
|
|
|
title={"ارسال پیام"} |
|
|
|
title={"ارسال پیام"} |
|
|
|
backgroundColor={Colors.theme1[theme].greenCF} |
|
|
|
backgroundColor={Colors.theme1[theme].greenCF} |
|
|
|