reza fixed ticket components again

master
Reza_ashrafi 3 years ago
parent bb8cf28c52
commit e0ce642e8c
  1. 41
      src/screens/Contact/layouts/Ticket.js

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

Loading…
Cancel
Save