-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #99 from WildCodeSchool/feat/no-ticket/standardize…
…-the-linter Strandardize linter and fixed all files with new config
- Loading branch information
Showing
16 changed files
with
1,185 additions
and
618 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,32 @@ | ||
import { GetAllArticlesDocument, useDeleteArticleMutation} from '../generated/graphql-types'; | ||
import { Button, message, Popconfirm } from 'antd'; | ||
|
||
function DeleteProductButton( {articleId} : {articleId: string}) { | ||
import { | ||
GetAllArticlesDocument, | ||
useDeleteArticleMutation, | ||
} from "../generated/graphql-types"; | ||
import { Button, message, Popconfirm } from "antd"; | ||
|
||
function DeleteProductButton({ articleId }: { articleId: string }) { | ||
const [deleteArticle] = useDeleteArticleMutation({ | ||
onCompleted(){ | ||
message.success('article supprimé avec succès') | ||
} | ||
}) | ||
onCompleted() { | ||
message.success("article supprimé avec succès"); | ||
}, | ||
}); | ||
|
||
return ( | ||
<Popconfirm | ||
title="Supprimer cet article ? " | ||
description="Toutes les données le concernant seront perdues." | ||
okText="Oui" | ||
cancelText="Non" | ||
onConfirm={() => deleteArticle({variables: {deleteArticleId: articleId.toString()}, refetchQueries: [GetAllArticlesDocument]})} | ||
<Popconfirm | ||
title="Supprimer cet article ? " | ||
description="Toutes les données le concernant seront perdues." | ||
okText="Oui" | ||
cancelText="Non" | ||
onConfirm={() => | ||
deleteArticle({ | ||
variables: { deleteArticleId: articleId.toString() }, | ||
refetchQueries: [GetAllArticlesDocument], | ||
}) | ||
} | ||
> | ||
<Button>Supprimer</Button> | ||
</Popconfirm> | ||
) | ||
|
||
); | ||
} | ||
|
||
export default DeleteProductButton | ||
export default DeleteProductButton; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,33 @@ | ||
import { GetAllArticlesDocument, GetAllProductsDocument, useDeleteProductMutation } from '../generated/graphql-types'; | ||
import { Button, message, Popconfirm } from 'antd'; | ||
|
||
function DeleteProductButton( {productId} : {productId: string}) { | ||
import { | ||
GetAllArticlesDocument, | ||
GetAllProductsDocument, | ||
useDeleteProductMutation, | ||
} from "../generated/graphql-types"; | ||
import { Button, message, Popconfirm } from "antd"; | ||
|
||
function DeleteProductButton({ productId }: { productId: string }) { | ||
const [deleteProduct] = useDeleteProductMutation({ | ||
onCompleted(){ | ||
message.success('produit supprimé avec succès') | ||
} | ||
}) | ||
onCompleted() { | ||
message.success("produit supprimé avec succès"); | ||
}, | ||
}); | ||
|
||
return ( | ||
<Popconfirm | ||
title="Supprimer ce produit ?" | ||
description="Tous les articles associés seront également supprimés." | ||
okText="Oui" | ||
cancelText="Non" | ||
onConfirm={() => deleteProduct({variables: {deleteProductId : productId.toString()}, refetchQueries: [GetAllProductsDocument, GetAllArticlesDocument]})} | ||
<Popconfirm | ||
title="Supprimer ce produit ?" | ||
description="Tous les articles associés seront également supprimés." | ||
okText="Oui" | ||
cancelText="Non" | ||
onConfirm={() => | ||
deleteProduct({ | ||
variables: { deleteProductId: productId.toString() }, | ||
refetchQueries: [GetAllProductsDocument, GetAllArticlesDocument], | ||
}) | ||
} | ||
> | ||
<Button>Supprimer</Button> | ||
</Popconfirm> | ||
) | ||
|
||
); | ||
} | ||
|
||
export default DeleteProductButton | ||
export default DeleteProductButton; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,48 @@ | ||
import { message, Select } from 'antd' | ||
import { GetAllArticlesDocument, GetAllProductsDocument, useEditArticleMutation } from '../generated/graphql-types' | ||
import { message, Select } from "antd"; | ||
import { | ||
GetAllArticlesDocument, | ||
GetAllProductsDocument, | ||
useEditArticleMutation, | ||
} from "../generated/graphql-types"; | ||
|
||
function EditArticleDropdown( {availability, id} : {availability: boolean, id: number}) { | ||
function EditArticleDropdown({ | ||
availability, | ||
id, | ||
}: { | ||
availability: boolean; | ||
id: number; | ||
}) { | ||
const [editArticle] = useEditArticleMutation({ | ||
onCompleted(data) { | ||
console.log("mutation completed data", data); | ||
message.success("La disponibilité de l'article a bien été modifiée"); | ||
}, | ||
onError(error) { | ||
console.log("error after executing mutation", error); | ||
}, | ||
refetchQueries: [GetAllProductsDocument, GetAllArticlesDocument], | ||
}); | ||
|
||
const [editArticle] = useEditArticleMutation({ | ||
onCompleted(data) { | ||
console.log("mutation completed data", data) | ||
message.success("La disponibilité de l'article a bien été modifiée"); | ||
|
||
}, | ||
onError(error) { | ||
console.log("error after executing mutation", error); | ||
}, | ||
refetchQueries: [GetAllProductsDocument, GetAllArticlesDocument] | ||
}) | ||
|
||
const onChange = async (value: boolean) => { | ||
await editArticle({ | ||
variables: { | ||
article: id.toString(), | ||
data: {availability: value}, | ||
} | ||
}) | ||
} | ||
const onChange = async (value: boolean) => { | ||
await editArticle({ | ||
variables: { | ||
article: id.toString(), | ||
data: { availability: value }, | ||
}, | ||
}); | ||
}; | ||
|
||
return ( | ||
<Select | ||
defaultValue={availability} | ||
style={{ width: 120 }} | ||
options={[ | ||
{ value: false, label: "unavailable" }, | ||
{ value: true, label: "available" } | ||
]} | ||
onChange={onChange} | ||
/> | ||
) | ||
return ( | ||
<Select | ||
defaultValue={availability} | ||
style={{ width: 120 }} | ||
options={[ | ||
{ value: false, label: "unavailable" }, | ||
{ value: true, label: "available" }, | ||
]} | ||
onChange={onChange} | ||
/> | ||
); | ||
} | ||
|
||
export default EditArticleDropdown | ||
export default EditArticleDropdown; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
import { Reservation } from "../interface/types"; | ||
|
||
export const ReservationCard = ( {reservation}: Reservation) => { | ||
export const ReservationCard = ({ reservation }: Reservation) => { | ||
return ( | ||
<div> | ||
<div>id de la réservation : {reservation.id} </div> | ||
<div>date de début : {reservation.startDate} </div> | ||
<div>date de fin : {reservation.endDate} </div> | ||
<div>nombre d'articles : {reservation.articles.length}</div> | ||
<div>prix : </div> | ||
<div>status: {reservation.status}</div> | ||
<div>détails</div> | ||
<div>-------</div> | ||
<div>id de la réservation : {reservation.id} </div> | ||
<div>date de début : {reservation.startDate} </div> | ||
<div>date de fin : {reservation.endDate} </div> | ||
<div>nombre d'articles : {reservation.articles.length}</div> | ||
<div>prix : </div> | ||
<div>status: {reservation.status}</div> | ||
<div>détails</div> | ||
<div>-------</div> | ||
</div> | ||
) | ||
} | ||
); | ||
}; |
Oops, something went wrong.