test push du merge
This commit is contained in:
rodzic
d6c7c56f4e
commit
0f7ba3bedd
1 zmienionych plików z 29 dodań i 68 usunięć
|
@ -35,12 +35,8 @@ export default class Stock extends React.Component {
|
|||
categorySorted:false,
|
||||
onSortedCategories:false,
|
||||
onSearch:false,
|
||||
<<<<<<< HEAD
|
||||
sortOrder: 0
|
||||
=======
|
||||
sortOrder: 0,
|
||||
selectedArticles:[]
|
||||
sortOrder: 0
|
||||
>>>>>>> a7884d9a3b4883254a979124e14663b887b85821
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -48,52 +44,26 @@ export default class Stock extends React.Component {
|
|||
this.getArticles()
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
// Implémenter la fonction sortArticles :
|
||||
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) => {
|
||||
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))
|
||||
}
|
||||
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 {
|
||||
this.setState({orderIsVisible: true})
|
||||
this.setState({sortOrder: 0})
|
||||
sorted = [...this.state.articles].sort((a, b) => b[sortType] - a[sortType]);
|
||||
//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'){
|
||||
>>>>>>> a7884d9a3b4883254a979124e14663b887b85821
|
||||
if (sortType === 'category_id'){
|
||||
this.setState({articles:sorted},() => {
|
||||
this.setState({onSortedCategories:true})
|
||||
})
|
||||
|
@ -103,9 +73,6 @@ export default class Stock extends React.Component {
|
|||
this.setState({onSortedCategories:false})
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
getArticles = () => {
|
||||
|
@ -215,29 +182,23 @@ export default class Stock extends React.Component {
|
|||
}
|
||||
|
||||
handleSubmit = event => {
|
||||
<<<<<<< HEAD
|
||||
event.preventDefault()
|
||||
this.searchArticles();
|
||||
=======
|
||||
event.preventDefault()
|
||||
this.searchArticles();
|
||||
}
|
||||
}
|
||||
|
||||
closeWithEscape = (e) => {
|
||||
if (e.keyCode === 27){
|
||||
if (this.state.onEditArticle){
|
||||
this.handleCloseEditArticle()
|
||||
} else if(this.state.onNewArticle){
|
||||
this.handleCloseNewArticle()
|
||||
} else if(this.state.onNewCategory){
|
||||
this.handleCloseNewCategory()
|
||||
} else if(this.state.onEditCategory){
|
||||
this.handleCloseEditCategory()
|
||||
} else if(this.state.onCategories){
|
||||
this.handleCloseCategories()
|
||||
}
|
||||
closeWithEscape = (e) => {
|
||||
if (e.keyCode === 27){
|
||||
if (this.state.onEditArticle){
|
||||
this.handleCloseEditArticle()
|
||||
} else if(this.state.onNewArticle){
|
||||
this.handleCloseNewArticle()
|
||||
} else if(this.state.onNewCategory){
|
||||
this.handleCloseNewCategory()
|
||||
} else if(this.state.onEditCategory){
|
||||
this.handleCloseEditCategory()
|
||||
} else if(this.state.onCategories){
|
||||
this.handleCloseCategories()
|
||||
}
|
||||
>>>>>>> a7884d9a3b4883254a979124e14663b887b85821
|
||||
}
|
||||
|
||||
render() {
|
||||
|
|
Ładowanie…
Reference in a new issue