Skip to content

Commit

Permalink
Merge pull request #40 from AlexandrePereon/fix/global
Browse files Browse the repository at this point in the history
fix/cancel
  • Loading branch information
yanisenco authored Apr 10, 2024
2 parents 394cf88 + 0847506 commit 06f3aa3
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/components/BrandCard/brandCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import React from "react";
</div>


<div className=" items-center justify-center p-2.5 sm:flex xl:p-5">
<div className="items-center justify-center p-2.5 sm:flex xl:p-5">
{children}
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Collapse/collapse.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const Collapse = ({title, handleOnChange, submissionTunnelFormListArticle, resta
<p>Aucun article</p>

return(
<div className="collapse collapse-plus rounded-sm border border-stroke bg-white px-5 pt-6 pb-2.5 shadow-default sm:px-7.5 xl:pb-1">
<div className="collapse collapse-plus rounded-sm border border-stroke bg-white sm:px-5 pt-6 pb-2.5 shadow-default sm:px-7.5 xl:pb-1">
<input type="checkbox" />
<div className="collapse-title mb-6 text-xl font-semibold text-black">
{title}
Expand Down
2 changes: 2 additions & 0 deletions src/components/MyAccountForm/MyProductsAccountList.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ const MyProductsAccountList = ({restaurantId}) => {
const handleSetPagination = (value, type) => {
if((value>0) && (value<=maxPageArticles)){
type === "article" && setPaginationArticles(value)
}
if((value>0) && (value<=maxPageMenus)){
type === "menu" && setPaginationMenus(value)
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/SubmissionTunnel/submissionTunnel.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import Tab from "../../components/Tab/tab";
import TitleFade from "../../components/TitleFade/titleFade";
import Collapse from "../../components/Collapse/collapse";
import Input from "../../components/Input/input";
import Loader from "../../components/Loader/loader";
import usePostRestaurantArticle from "../../hooks/data/post/usePostRestaurantArticle";
import usePostRestaurantMenu from "../../hooks/data/post/usePostRestaurantMenu";
import productFormData from "../../formData/productFormData";
Expand Down Expand Up @@ -75,6 +74,7 @@ const SubmissionTunnel = ({restaurantId}) => {
<Input
title={item.title[steps]}
handleOnChange={handleInputChange}
defaultValue={item.value}
id={item.id}
type={item.type}
size={item.size}
Expand Down Expand Up @@ -113,7 +113,7 @@ const SubmissionTunnel = ({restaurantId}) => {
{submissionTunnelFormInput}
</div>
<div className="mt-6 flex items-center justify-end gap-x-6 pb-2">
{isLoading ? <Loader/> : <ButtonValidationForm title="Ajouter" isLoading={isLoading} size={"w-small"}/>}
<ButtonValidationForm title="Ajouter" isLoading={isLoading} size={"w-small"}/>
</div>
</form>
)
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/data/post/useCancelOrder.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const useCancelOrder = () => {
const handleCancelOrder = async (orderId, refetch) => {
setIsLoading(true);
try {
const response = await axiosReq.put(`${process.env.REACT_APP_API_PREFIX_ORDER}cancel/`,{
const response = await axiosReq.delete(`${process.env.REACT_APP_API_PREFIX_ORDER}cancel/`,{
orderId : orderId
});
if (response) {
Expand Down
3 changes: 2 additions & 1 deletion src/hooks/data/post/usePostRestaurantArticle.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const usePostRestaurantArticle = () => {
const [isLoading, setIsLoading] = useState(false);
const [message, setMessage] = useState({ code: null, description: null });

const handleSubmitArticle = async (formData) => {
const handleSubmitArticle = async (formData, resetFormData) => {
setIsLoading(false);
try {
const response = await axiosReq.post(`${process.env.REACT_APP_API_PREFIX_RESTAURANT}article/create`, {
Expand All @@ -25,6 +25,7 @@ const usePostRestaurantArticle = () => {
if (response) {
setMessage({ code: response.status, description: response.data.message });
setIsLoading(false);
window.location.reload();
}
} catch (error) {
setMessage({ code: error.response.status, description: error.response.data.message });
Expand Down
3 changes: 2 additions & 1 deletion src/hooks/data/post/usePostRestaurantMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const usePostRestaurantMenu = () => {
const [isLoading, setIsLoading] = useState(false);
const [message, setMessage] = useState({ code: null, description: null });

const handleSubmitMenu = async (formData) => {
const handleSubmitMenu = async (formData, resetFormData) => {
setIsLoading(false);
try {
const response = await axiosReq.post(`${process.env.REACT_APP_API_PREFIX_RESTAURANT}menu/create`, {
Expand All @@ -26,6 +26,7 @@ const usePostRestaurantMenu = () => {
if (response) {
setMessage({ code: response.status, description: response.data.message });
setIsLoading(false);
window.location.reload();
}
} catch (error) {
setMessage({ code: error.response.status, description: error.response.data.message });
Expand Down
2 changes: 1 addition & 1 deletion src/pages/RestaurantPages/addProductPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const AddProductPage = () => {
return (
<Fragment>
<Header role={userInfosFromSessionStorage?.role}/>
<div className="w-4/6 m-auto">
<div className="sm:w-4/6 m-auto">
<SubmissionTunnel restaurantId={userInfosFromSessionStorage.restaurant || userInfosData?.restaurant}/>
</div>
<Footer/>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/historyOrderPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const HistoryOrderPage = () => {
return (
<Fragment>
<Header role={userInfos?.role}/>
<div className="sm:w-page m-auto pb-10 h-screen">
<div className="lg:w-page m-auto pb-10 h-screen">
<Tab partsName={parts} steps={steps} handleOnSwitchSteps={handleOnSwitchSteps}/>
{content[steps]}
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/myAccountPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const MyAccountPage = () => {
return (
<Fragment>
<Header role={userInfosData?.role}/>
<div className="sm:w-page m-auto pb-10 h-screen">
<div className="sm:w-page m-auto pb-10 h-min-screen">
{userInfosData?.role === "restaurant" &&
<Tab
steps={steps}
Expand Down

0 comments on commit 06f3aa3

Please sign in to comment.