test push du merge
This commit is contained in:
parent
d6c7c56f4e
commit
0f7ba3bedd
1 changed files with 29 additions and 68 deletions
|
@ -35,12 +35,8 @@ export default class Stock extends React.Component {
|
||||||
categorySorted:false,
|
categorySorted:false,
|
||||||
onSortedCategories:false,
|
onSortedCategories:false,
|
||||||
onSearch:false,
|
onSearch:false,
|
||||||
<<<<<<< HEAD
|
sortOrder: 0,
|
||||||
sortOrder: 0
|
|
||||||
=======
|
|
||||||
selectedArticles:[]
|
selectedArticles:[]
|
||||||
sortOrder: 0
|
|
||||||
>>>>>>> a7884d9a3b4883254a979124e14663b887b85821
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,52 +44,26 @@ export default class Stock extends React.Component {
|
||||||
this.getArticles()
|
this.getArticles()
|
||||||
}
|
}
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
// Implémenter la fonction sortArticles :
|
// Implémenter la fonction sortArticles :
|
||||||
sortArticles = (sortType) => {
|
sortArticles = (sortType) => {
|
||||||
let sorted;
|
|
||||||
if (sortType === "name"){
|
|
||||||
this.setState({orderIsVisible: false})
|
|
||||||
if (this.state.sortOrder === 0) {
|
|
||||||
//ordre alphabétique croissant
|
|
||||||
sorted = [...this.state.articles].sort((a, b) => a.name.localeCompare(b.name))
|
|
||||||
} else {
|
|
||||||
//ordre alphabétique décroissant
|
|
||||||
sorted = [...this.state.articles].sort((a, b) => b.name.localeCompare(a.name))
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.setState({orderIsVisible: true})
|
|
||||||
this.setState({sortOrder: 0})
|
|
||||||
sorted = [...this.state.articles].sort((a, b) => b[sortType] - a[sortType]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sortType === 'category_id'){
|
|
||||||
this.setState({articles:sorted},() => {
|
|
||||||
this.setState({onSortedCategories:true})
|
|
||||||
})
|
|
||||||
}else{
|
|
||||||
=======
|
|
||||||
|
|
||||||
sortArticles = (sortType) => {
|
|
||||||
|
|
||||||
let sorted;
|
let sorted;
|
||||||
if (sortType === "name"){
|
if (sortType === "name"){
|
||||||
this.setState({orderIsVisible: false})
|
this.setState({orderIsVisible: false})
|
||||||
if (this.state.sortOrder === 0) {
|
if (this.state.sortOrder === 0) {
|
||||||
//ordre alphabétique croissant
|
//ordre alphabétique croissant
|
||||||
sorted = [...this.state.articles].sort((a, b) => a.name.localeCompare(b.name))
|
sorted = [...this.state.articles].sort((a, b) => a.name.localeCompare(b.name))
|
||||||
} else {
|
|
||||||
//ordre alphabétique décroissant
|
|
||||||
sorted = [...this.state.articles].sort((a, b) => b.name.localeCompare(a.name))
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
this.setState({orderIsVisible: true})
|
//ordre alphabétique décroissant
|
||||||
this.setState({sortOrder: 0})
|
sorted = [...this.state.articles].sort((a, b) => b.name.localeCompare(a.name))
|
||||||
sorted = [...this.state.articles].sort((a, b) => b[sortType] - a[sortType]);
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
this.setState({orderIsVisible: true})
|
||||||
|
this.setState({sortOrder: 0})
|
||||||
|
sorted = [...this.state.articles].sort((a, b) => b[sortType] - a[sortType]);
|
||||||
|
}
|
||||||
|
|
||||||
if (sortType === 'category_id'){
|
if (sortType === 'category_id'){
|
||||||
>>>>>>> a7884d9a3b4883254a979124e14663b887b85821
|
|
||||||
this.setState({articles:sorted},() => {
|
this.setState({articles:sorted},() => {
|
||||||
this.setState({onSortedCategories:true})
|
this.setState({onSortedCategories:true})
|
||||||
})
|
})
|
||||||
|
@ -103,9 +73,6 @@ export default class Stock extends React.Component {
|
||||||
this.setState({onSortedCategories:false})
|
this.setState({onSortedCategories:false})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getArticles = () => {
|
getArticles = () => {
|
||||||
|
@ -215,29 +182,23 @@ export default class Stock extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
handleSubmit = event => {
|
handleSubmit = event => {
|
||||||
<<<<<<< HEAD
|
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
this.searchArticles();
|
this.searchArticles();
|
||||||
=======
|
}
|
||||||
event.preventDefault()
|
|
||||||
this.searchArticles();
|
|
||||||
}
|
|
||||||
|
|
||||||
closeWithEscape = (e) => {
|
closeWithEscape = (e) => {
|
||||||
if (e.keyCode === 27){
|
if (e.keyCode === 27){
|
||||||
if (this.state.onEditArticle){
|
if (this.state.onEditArticle){
|
||||||
this.handleCloseEditArticle()
|
this.handleCloseEditArticle()
|
||||||
} else if(this.state.onNewArticle){
|
} else if(this.state.onNewArticle){
|
||||||
this.handleCloseNewArticle()
|
this.handleCloseNewArticle()
|
||||||
} else if(this.state.onNewCategory){
|
} else if(this.state.onNewCategory){
|
||||||
this.handleCloseNewCategory()
|
this.handleCloseNewCategory()
|
||||||
} else if(this.state.onEditCategory){
|
} else if(this.state.onEditCategory){
|
||||||
this.handleCloseEditCategory()
|
this.handleCloseEditCategory()
|
||||||
} else if(this.state.onCategories){
|
} else if(this.state.onCategories){
|
||||||
this.handleCloseCategories()
|
this.handleCloseCategories()
|
||||||
}
|
|
||||||
}
|
}
|
||||||
>>>>>>> a7884d9a3b4883254a979124e14663b887b85821
|
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|
Loading…
Reference in a new issue