درست کردن قسمت ارسال تیکت | 32

temp
mahdi 3 years ago
parent 81fd4b9be2
commit 453e99aed9
  1. 1
      src/redux/actions/comment.js
  2. 2
      src/redux/reducers/form.js
  3. 5
      src/views/Contact/layouts/Ticket.js
  4. 8
      src/views/Products/layouts/Desktop/Main.js

@ -13,6 +13,7 @@ const comment = {
(data = {}, data2) => (data = {}, data2) =>
async (dispatch) => { async (dispatch) => {
await proxy.post("comment/add", data, { dispatch }); await proxy.post("comment/add", data, { dispatch });
dispatch({ type : "form/ticket/reset" });
if (data2) await proxy.get("book/info", data2, { dispatch }); if (data2) await proxy.get("book/info", data2, { dispatch });
}, },
del: del:

@ -15,6 +15,8 @@ export default function form(state = initialState, action) {
ticket: { ...state.ticket, [data.name]: data.value }, ticket: { ...state.ticket, [data.name]: data.value },
error: null, error: null,
}; };
case "form/ticket/reset":
return { ...state, ticket: {} };
case "form/loading": case "form/loading":
return { ...state, loading: true }; return { ...state, loading: true };
case "form/error": case "form/error":

@ -60,9 +60,6 @@ export const Ticket = ({
accept: () => {}, accept: () => {},
open: true, open: true,
}); });
// console.log("mahdi");
console.log(ticket?.subject);
// console.log("mahdi");
} else if (!ticket?.unit) { } else if (!ticket?.unit) {
setDialog({ setDialog({
text: window.t("واحد مورد نظر خود را وارد نکرده اید."), text: window.t("واحد مورد نظر خود را وارد نکرده اید."),
@ -83,7 +80,7 @@ export const Ticket = ({
}; };
await submit(data); await submit(data);
} }
}, [status]); }, [status, ticket]);
useEffect(() => { useEffect(() => {
window.scrollTo(0, 0); window.scrollTo(0, 0);

@ -26,6 +26,7 @@ export const Main = ({
}) => { }) => {
const [filterLoading, setFilterLoading] = useState(false); const [filterLoading, setFilterLoading] = useState(false);
const [page, setPage] = useState(1); const [page, setPage] = useState(1);
console.log(page);
const [total, setTotal] = useState(books.length); const [total, setTotal] = useState(books.length);
useEffect(() => { useEffect(() => {
@ -97,7 +98,6 @@ export const Main = ({
const elements = Items(1); const elements = Items(1);
const vods = Items(2); const vods = Items(2);
console.log(elements.length); console.log(elements.length);
const lastPage = Math.floor((elements.length - 1) / num) + 1; const lastPage = Math.floor((elements.length - 1) / num) + 1;
@ -262,11 +262,13 @@ export const Main = ({
/> />
))} ))}
{/* pagination */}
<div className="w-full flex justify-center gap-x-2"> <div className="w-full flex justify-center gap-x-2">
{pages.map((e) => ( {pages.map((e) => (
<div <div
style={{ backgroundColor: "#DEFFF188" }} className={`w-8 p-2 text-sm text-center rounded-md text-green7B cursor-pointer transform translate ${
className="w-8 p-2 text-sm text-center rounded-md text-green7B cursor-pointer transform translate" pages ? "bg-red-400" : "bg-blue-600"
}`}
onClick={() => setPage(e)} onClick={() => setPage(e)}
> >
{e} {e}

Loading…
Cancel
Save