Skip to content

Commit

Permalink
Merge pull request #16 from imkarimkarim/bugFix
Browse files Browse the repository at this point in the history
hopfuly will fix back button issue in windows
  • Loading branch information
imkarimkarim authored Aug 18, 2021
2 parents 13dbb1d + bdf3c7f commit 95ca9c1
Show file tree
Hide file tree
Showing 25 changed files with 229 additions and 187 deletions.
2 changes: 1 addition & 1 deletion src/App/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default function App() {
return (
<Router>
{/* redirect to /welcome in first load */}
{redirectToIndex.current ? <Redirect to="/searchProducts" /> : <div></div>}
{redirectToIndex.current ? <Redirect to="/welcome" /> : <div></div>}
<Container>
<Switch>
<NotifProvider>
Expand Down
25 changes: 15 additions & 10 deletions src/App/Components/Loading.jsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
import React from 'react';
import React from "react";
import Button from "@material-ui/core/Button";
import CircularProgress from '@material-ui/core/CircularProgress';
import './Loading.css';
import CircularProgress from "@material-ui/core/CircularProgress";
import "./Loading.css";

export default function Loading() {
return(
export default function Loading({ history }) {
return (
<div className="loadingLoading">
<CircularProgress />
<p className="hint">
درحال دریافت اطلاعات...
</p>
<p className="hint">درحال دریافت اطلاعات...</p>
<Button variant="outlined">
<span className="button-title" onClick={() => {window.history.back();}}>انصراف</span>
<span
className="button-title"
onClick={() => {
history.goBack();
}}
>
انصراف
</span>
</Button>
</div>
)
);
}
1 change: 0 additions & 1 deletion src/App/Components/Name/NewCustomer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ export default function NewCustomer() {

return (
<div className="NewCustomer-form">
<Nav />
<div>
<Grid container spacing={3}>
<Grid item xs={12}>
Expand Down
1 change: 0 additions & 1 deletion src/App/Components/Name/NewProductOwner.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ export default function NewProductOwner() {

return (
<div className="newProductOwner-form">
<Nav />
<div>
<Grid container spacing={3}>
<Grid item xs={12}>
Expand Down
10 changes: 8 additions & 2 deletions src/App/Components/Nav.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import Button from "@material-ui/core/Button";
import Menu from "@material-ui/core/Menu";
import MenuItem from "@material-ui/core/MenuItem";

export default function Nav({ title }) {
export default function Nav({ title, history }) {
const [anchorEl, setAnchorEl] = React.useState(null);

const handleClick = (event) => {
Expand All @@ -32,7 +32,7 @@ export default function Nav({ title }) {
className="goBack"
fontSize="large"
onClick={() => {
window.history.back();
history.goBack();
}}
/>
<div>
Expand Down Expand Up @@ -71,6 +71,12 @@ export default function Nav({ title }) {
بارها
</Link>
</MenuItem>
<MenuItem onClick={handleClose}>
<Link to="/searchCars">
<ShoppingCartIcon />
صافی ها
</Link>
</MenuItem>
<MenuItem onClick={handleClose}>
<Link to="/includeCar">
<ImportExportIcon />
Expand Down
6 changes: 3 additions & 3 deletions src/App/Components/NotFound.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ import Button from "@material-ui/core/Button";
import Nav from "./Nav.jsx";
import "./NotFound.css";

export default function NotFound() {
export default function NotFound({ history }) {
return (
<div>
<Nav title="خطا" />
<Nav history={history} />
<div className="notFound">
<ErrorIcon />
<p className="hint">مشکلی پیش آمده است! با پشتیبانی تماس بگیرید.</p>
<Button variant="outlined">
<span
className="button-title"
onClick={() => {
window.history.back();
history.goBack();
}}
>
انصراف
Expand Down
4 changes: 2 additions & 2 deletions src/App/Pages/Car/Car.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ function SaleSection({ products, car }) {
);
}

const Car = () => {
const Car = ({ history }) => {
const [products, setProducts] = useState();
const [car, setCar] = useState();
let { id } = useParams();
Expand Down Expand Up @@ -369,7 +369,7 @@ const Car = () => {

return car && products && products.length === car.products.length ? (
<div>
<Nav />
<Nav history={history} />
<div className="car">
<InfoSection car={car} />
<SaleSection products={products} car={car} />
Expand Down
4 changes: 2 additions & 2 deletions src/App/Pages/Car/EditCar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { generateInputByUserCarSchema } from "../../../schemas.js";

const schema = {};

export default function EditCar() {
export default function EditCar({ history }) {
const [formData, formDispatch] = useReducer(reducer, schema);
const [submit, setSubmit] = useState(false);
const [createStatus, setCreateStatus] = useState(null);
Expand Down Expand Up @@ -80,7 +80,7 @@ export default function EditCar() {

return (
<div>
<Nav />
<Nav history={history} />
<form className="EditCar-form goje-container">
<Grid container spacing={3}>
<Grid item xs={12}>
Expand Down
4 changes: 2 additions & 2 deletions src/App/Pages/Car/IncludeCar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { generateInputByUserCarSchema } from "../../../schemas.js";

const schema = generateInputByUserCarSchema();

export default function IncludeCar() {
export default function IncludeCar({ history }) {
const [formData, formDispatch] = useReducer(reducer, schema);
const [submit, setSubmit] = useState(false);
const [createStatus, setCreateStatus] = useState(null);
Expand Down Expand Up @@ -66,7 +66,7 @@ export default function IncludeCar() {

return (
<div>
<Nav />
<Nav history={history} />
<form className="IncludeCar-form goje-container">
<Grid container spacing={3}>
<Grid item xs={12}>
Expand Down
4 changes: 2 additions & 2 deletions src/App/Pages/Factor/EditFactor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import ShowDate from "../../Components/ShowDate.jsx";
import reducer from "../../Reducers/EditFactorReducer.jsx";
import { NotifContext } from "../../Contexts/NotifContext.jsx";

export default function EditFactor() {
export default function EditFactor({ history }) {
const [formData, formDispatch] = useReducer(reducer, {});
const [submit, setSubmit] = useState(false);
const [editStatus, setEditStatus] = useState(null);
Expand Down Expand Up @@ -80,7 +80,7 @@ export default function EditFactor() {

return (
<div>
<Nav />
<Nav history={history} />
<form className="EditFactor-form goje-container">
<Grid container spacing={3}>
<Grid className="header" item xs={12}>
Expand Down
4 changes: 2 additions & 2 deletions src/App/Pages/Factor/Factor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import "./Factor.css";
// TODO: installer
// TODO: test + test on windows

export default function Factor() {
export default function Factor({ history }) {
const [factor, setFactor] = useState({});
let { id } = useParams();
const init = useRef(true);
Expand Down Expand Up @@ -52,7 +52,7 @@ export default function Factor() {
else if (factor && factor.isPayed === "receipt") tmpStatus = "وصولی";
return factor ? (
<div>
<Nav />
<Nav history={history} />
<div className="factor-reports goje-container">
<Grid container spacing={3}>
<Grid className="header" item xs={12}>
Expand Down
4 changes: 2 additions & 2 deletions src/App/Pages/Factor/NewFactor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import "./NewFactor.css";
import { reducer, schema } from "../../Reducers/NewFactorReducer.jsx";
import { NotifContext } from "../../Contexts/NotifContext.jsx";

export default function NewFactor() {
export default function NewFactor({ history }) {
const [formData, formDispatch] = useReducer(reducer, schema);
const [submit, setSubmit] = useState(false);
const [createStatus, setCreateStatus] = useState(null);
Expand Down Expand Up @@ -58,7 +58,7 @@ export default function NewFactor() {

return (
<div>
<Nav />
<Nav history={history} />
<form className="NewFactor-form goje-container">
<Grid container spacing={3}>
<Grid className="header" item xs={10}>
Expand Down
14 changes: 8 additions & 6 deletions src/App/Pages/NewName/NewName.jsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import React from 'react'
import NewCustomer from '../../Components/Name/NewCustomer.jsx';
import NewProductOwner from '../../Components/Name/NewProductOwner.jsx';
import React from "react";
import NewCustomer from "../../Components/Name/NewCustomer.jsx";
import NewProductOwner from "../../Components/Name/NewProductOwner.jsx";
import "./NewName.css";
import Nav from "../../Components/Nav.jsx";

const NewName = (props) => {
const NewName = ({ history }) => {
return (
<div className="NewName goje-container">
<Nav history={history} />
<NewCustomer />
<div className="gap"></div>
<NewProductOwner />
</div>
)
}
);
};

export default NewName;
4 changes: 2 additions & 2 deletions src/App/Pages/Product/EditProduct.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import ProductOwnerInput from "../../Components/ProductOwner/ProductOwnerInput.j

const schema = {};

export default function EditProduct() {
export default function EditProduct({ history }) {
const [formData, formDispatch] = useReducer(reducer, schema);
const [submit, setSubmit] = useState(false);
const [editStatus, setEditStatus] = useState(null);
Expand Down Expand Up @@ -79,7 +79,7 @@ export default function EditProduct() {

return (
<div>
<Nav />
<Nav history={history} />
<form className="EditProduct-form goje-container">
<Grid container spacing={3}>
<Grid item xs={12}>
Expand Down
10 changes: 6 additions & 4 deletions src/App/Pages/Product/Product.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ function SaleSection({ productId, product }) {
);
}

export default function Product() {
export default function Product({ history }) {
const [product, setProduct] = useState();

let { id } = useParams();
Expand Down Expand Up @@ -239,7 +239,7 @@ export default function Product() {
return product ? (
product.inCar ? (
<div>
<Nav />
<Nav history={history} />
<div className="product-reports">
<br />
<InfoSection product={product} />
Expand Down Expand Up @@ -271,7 +271,7 @@ export default function Product() {
</div>
) : (
<div>
<Nav />
<Nav history={history} />
<div className="product-reports">
<InfoSection product={product} />
<SaleSection productId={product.customeId} product={product} />
Expand All @@ -291,7 +291,9 @@ export default function Product() {
</Button>
</Link>
) : (
<div className="red-color">(به دلیل تمام نشدن بار گزارش گیری مقدور نیست)</div>
<div className="red-color">
(به دلیل تمام نشدن بار گزارش گیری مقدور نیست)
</div>
)}

<Link to={`/editProduct/${product.customeId}`}>
Expand Down
13 changes: 7 additions & 6 deletions src/App/Pages/Product/ProductDetails.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import ShowDate from "../../Components/ShowDate.jsx";
import { conflictFinder } from "../../../modules/conflictFinder.js";
import "./ProductDetails.css";

export default function ProductDetails() {
export default function ProductDetails({ history }) {
const [factorsWithProduct, setFactorsWithProduct] = useState();
let { id } = useParams();
const init = useRef(true);
Expand Down Expand Up @@ -101,19 +101,20 @@ export default function ProductDetails() {

return (
<div>
<Nav title={"/ریزفروش/" + id} />
<Nav history={history} />
<div className="product-details">
{resultsList.length > 5 ? (
<h3>
ریز فروش {id} | (سیستم خطایابی{" "}
<span className="green-color">فعال است!</span> ردیف های با رنگ زرد
یا قرمز احتمال وجود خطا در ورود فاکتور را نمایان میکنید اما فراموش
نکنید که سیستم خطایابی فقط یک دستیار کاربر است و نه بیشتر)
یا قرمز احتمال وجود اشتباه را نمایان میکنند اما فراموش نکنید که
سیستم خطایابی فقط یک دستیار است و نه بیشتر)
</h3>
) : (
<h3>
ریز فروش {id} | (سیستم خطایابی به دلیل کافی نبودن ردیف ها{" "}
<span className="red-color">غیرفعال است!</span> لطفا به صورت دستی بررسی کنید)
ریز فروش {id} | (سیستم خطایابی به دلیل کافی نبودن تعداد ردیف ها{" "}
<span className="red-color">غیرفعال است!</span> لطفا به صورت دستی
خطایابی کنید)
</h3>
)}

Expand Down
Loading

0 comments on commit 95ca9c1

Please sign in to comment.