Skip to content
GitLab
Explorer
Connexion
Navigation principale
Rechercher ou aller à…
Projet
M
mydressin-front
Gestion
Activité
Membres
Labels
Programmation
Tickets
0
Tableaux des tickets
Jalons
Wiki
Jira
Code
Requêtes de fusion
0
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Extraits de code
Compilation
Pipelines
Jobs
Planifications de pipeline
Artéfacts
Déploiement
Releases
Registre de paquets
Opération
Environnements
Modules Terraform
Surveillance
Incidents
Service d'assistance
Analyse
Données d'analyse des chaînes de valeur
Contributor analytics
Données d'analyse CI/CD
Données d'analyse du dépôt
Expériences du modèle
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
mydressin
mydressin-front
Validations
e20210f0
Valider
e20210f0
rédigé
il y a un an
par
Mohamed Lemine BAILLAHI
Parcourir les fichiers
Options
Téléchargements
Plain Diff
Merge branch 'feature/
MYD-101
' into 'develop'
MYD-101
/Add date to filter See merge request
!86
parents
f95bd51d
23da5492
Branches
Branches contenant la validation
1 requête de fusion
!86
MYD-101/Add date to filter
Pipeline
#458
réussi avec l'étape
in 3 minutes et 49 secondes
Modifications
2
Pipelines
1
Masquer les modifications d'espaces
En ligne
Côte à côte
Affichage de
2 fichiers modifiés
src/shared/sections/order/all-orders/order-table-toolbar.tsx
+1
-18
1 ajout, 18 suppressions
src/shared/sections/order/all-orders/order-table-toolbar.tsx
src/shared/sections/order/filter-view.tsx
+115
-64
115 ajouts, 64 suppressions
src/shared/sections/order/filter-view.tsx
avec
116 ajouts
et
82 suppressions
src/shared/sections/order/all-orders/order-table-toolbar.tsx
+
1
−
18
Voir le fichier @
e20210f0
import
React
,
{
useCallback
}
from
"
react
"
;
import
Stack
from
"
@mui/material/Stack
"
;
import
MenuItem
from
"
@mui/material/MenuItem
"
;
import
TextField
from
"
@mui/material/TextField
"
;
import
IconButton
from
"
@mui/material/IconButton
"
;
import
InputAdornment
from
"
@mui/material/InputAdornment
"
;
import
{
DatePicker
}
from
"
@mui/x-date-pickers/DatePicker
"
;
import
{
formHelperTextClasses
}
from
"
@mui/material/FormHelperText
"
;
import
Iconify
from
"
../../../components/iconify
"
;
import
CustomPopover
,
{
usePopover
}
from
"
../../../components/custom-popover
"
;
...
...
@@ -24,14 +20,12 @@ import ColumnView from "../column-view";
type
Props
=
{
filters
:
IOrderTableFilters
;
onFilters
:
(
name
:
string
,
value
:
IOrderTableFilterValue
)
=>
void
;
//
dateError
:
boolean
;
};
export
default
function
OrderTableToolbar
({
filters
,
onFilters
,
dateError
,
}:
Props
)
{
const
popover
=
usePopover
();
...
...
@@ -42,12 +36,6 @@ export default function OrderTableToolbar({
[
onFilters
]
);
const
handleFilterStartDate
=
useCallback
(
(
newValue
:
Date
|
null
)
=>
{
onFilters
(
"
startDate
"
,
newValue
);
},
[
onFilters
]
);
const
[
open
,
setOpen
]
=
React
.
useState
(
false
);
const
handleClickOpen
=
()
=>
{
...
...
@@ -66,12 +54,6 @@ export default function OrderTableToolbar({
const
handleCloseColumn
=
()
=>
{
setOpenColumn
(
false
);
};
const
handleFilterEndDate
=
useCallback
(
(
newValue
:
Date
|
null
)
=>
{
onFilters
(
"
endDate
"
,
newValue
);
},
[
onFilters
]
);
return
(
<>
...
...
@@ -117,6 +99,7 @@ export default function OrderTableToolbar({
<
Dialog
open
=
{
open
}
onClose
=
{
handleClose
}
fullWidth
PaperProps
=
{
{
component
:
"
form
"
,
onSubmit
:
(
event
:
React
.
FormEvent
<
HTMLFormElement
>
)
=>
{
...
...
This diff is collapsed.
Click to expand it.
src/shared/sections/order/filter-view.tsx
+
115
−
64
Voir le fichier @
e20210f0
import
React
,
{
useState
}
from
"
react
"
;
import
{
Card
,
Grid
,
Stack
,
TextField
,
IconButton
,
InputAdornment
,
Checkbox
,
FormControlLabel
,
MenuItem
,
Select
,
}
from
"
@mui/material
"
;
import
Autocomplete
from
'
@mui/material/Autocomplete
'
;
import
AddIcon
from
'
@mui/icons-material/Add
'
;
import
DeleteIcon
from
'
@mui/icons-material/Delete
'
;
import
Autocomplete
from
"
@mui/material/Autocomplete
"
;
import
AddIcon
from
"
@mui/icons-material/Add
"
;
import
DeleteIcon
from
"
@mui/icons-material/Delete
"
;
import
LoadingButton
from
"
@mui/lab/LoadingButton
"
;
interface
Entry
{
colonnes
:
string
;
operateur
:
string
;
valeur
:
string
;
colonnes
:
string
;
operateur
:
string
;
valeur
:
string
|
Date
;
}
const
OPERATEURS_PAR_COLONNES
:
{
[
key
:
string
]:
string
[]
}
=
{
date
:
[
"
supérieur à
"
,
"
inférieur à
"
,
"
égal à
"
],
commande
:
[
"
contient
"
,
"
commence avec
"
,
"
se termine par
"
],
client
:
[
"
contient
"
,
"
commence avec
"
,
"
se termine par
"
],
Article
:
[
"
contient
"
,
"
commence avec
"
,
"
se termine par
"
],
prix
:
[
"
supérieur à
"
,
"
inférieur à
"
,
"
égal à
"
],
origine
:
[
"
égal à
"
],
};
export
default
function
FilterView
()
{
const
[
entries
,
setEntries
]
=
useState
<
Entry
[]
>
([{
colonnes
:
""
,
operateur
:
""
,
valeur
:
""
}]);
const
[
expedition
,
setExpedition
]
=
useState
<
string
>
(
""
);
const
[
expeditionPrice
,
setExpeditionPrice
]
=
useState
<
string
>
(
""
);
const
[
taxe
,
setTaxe
]
=
useState
<
string
>
(
""
);
const
[
frais
,
setFrais
]
=
useState
<
string
>
(
""
);
const
[
coupon
,
setCoupon
]
=
useState
<
string
>
(
""
);
const
[
entries
,
setEntries
]
=
useState
<
Entry
[]
>
([
{
colonnes
:
""
,
operateur
:
""
,
valeur
:
""
},
]);
const
handleAddEntry
=
()
=>
{
setEntries
([...
entries
,
{
colonnes
:
""
,
operateur
:
""
,
valeur
:
""
}]);
setEntries
([...
entries
,
{
colonnes
:
""
,
operateur
:
""
,
valeur
:
""
}]);
};
const
handleRemoveEntry
=
(
index
:
number
)
=>
{
...
...
@@ -38,75 +42,122 @@ export default function FilterView() {
setEntries
(
newEntries
);
};
const
handleInputChange
=
(
index
:
number
,
field
:
keyof
Entry
,
value
:
string
)
=>
{
const
handleInputChange
=
(
index
:
number
,
field
:
keyof
Entry
,
value
:
string
|
Date
)
=>
{
const
newEntries
=
[...
entries
];
newEntries
[
index
][
field
]
=
value
;
newEntries
[
index
]
=
{
...
newEntries
[
index
],
[
field
]:
value
};
if
(
field
===
"
colonnes
"
)
{
const
colonne
=
value
as
string
;
const
operateurOptions
=
OPERATEURS_PAR_COLONNES
[
colonne
]
||
[];
newEntries
[
index
].
operateur
=
operateurOptions
[
0
]
||
""
;
if
(
colonne
===
"
origine
"
)
{
newEntries
[
index
].
valeur
=
"
site
"
;
}
}
setEntries
(
newEntries
);
};
const
handleSubmit
=
(
event
:
React
.
FormEvent
<
HTMLFormElement
>
)
=>
{
event
.
preventDefault
();
console
.
log
(
"
Formulaire soumis !
"
);
};
return
(
<
form
onSubmit
=
{
handleSubmit
}
>
<
Stack
spacing
=
{
1
}
sx
=
{
{
p
:
5
}
}
>
{
entries
.
map
((
entry
,
index
)
=>
(
<
Grid
container
spacing
=
{
1
}
alignItems
=
"center"
key
=
{
index
}
>
<
Grid
item
xs
=
{
4
}
md
=
{
4
}
>
<
Autocomplete
value
=
{
entry
.
colonnes
}
onChange
=
{
(
event
,
newValue
)
=>
handleInputChange
(
index
,
"
colonnes
"
,
newValue
!==
null
?
newValue
:
""
)
<
form
onSubmit
=
{
handleSubmit
}
style
=
{
{
maxWidth
:
"
100%
"
,
padding
:
"
20px
"
}
}
>
<
Stack
spacing
=
{
1
}
style
=
{
{
marginTop
:
"
40px
"
}
}
>
{
entries
.
map
((
entry
,
index
)
=>
(
<
Grid
container
spacing
=
{
1
}
alignItems
=
"center"
key
=
{
index
}
>
<
Grid
item
xs
=
{
3
}
>
<
Autocomplete
value
=
{
entry
.
colonnes
}
onChange
=
{
(
_event
,
newValue
:
string
|
null
)
=>
{
const
colonne
=
newValue
!==
null
?
newValue
:
""
;
handleInputChange
(
index
,
"
colonnes
"
,
colonne
);
}
}
options
=
{
[
"
date
"
,
"
commande
"
,
"
client
"
,
"
Article
"
,
"
prix
"
,
"
origine
"
,
]
}
fullWidth
renderInput
=
{
(
params
:
any
)
=>
(
<
TextField
{
...
params
}
label
=
"Colonnes"
/>
)
}
/>
</
Grid
>
<
Grid
item
xs
=
{
4
}
>
<
Autocomplete
value
=
{
entry
.
operateur
}
onChange
=
{
(
_event
,
newValue
:
string
|
null
)
=>
handleInputChange
(
index
,
"
operateur
"
,
newValue
!==
null
?
newValue
:
""
)
}
options
=
{
OPERATEURS_PAR_COLONNES
[
entry
.
colonnes
]
||
[]
}
fullWidth
renderInput
=
{
(
params
:
any
)
=>
(
<
TextField
{
...
params
}
label
=
"Opérateur"
/>
)
}
/>
</
Grid
>
<
Grid
item
xs
=
{
3
}
>
{
entry
.
colonnes
===
"
date
"
?
(
<
TextField
value
=
{
entry
.
valeur
as
Date
}
type
=
"date"
onChange
=
{
(
event
)
=>
handleInputChange
(
index
,
"
valeur
"
,
event
.
target
.
value
)
}
options
=
{
[
"
commande
"
,
"
client
"
,
"
Article
"
]
}
fullWidth
renderInput
=
{
(
params
)
=>
<
TextField
{
...
params
}
label
=
"Colonnes"
/>
}
/>
</
Grid
>
<
Grid
item
xs
=
{
4
}
md
=
{
4
}
>
<
Autocomplete
value
=
{
entry
.
operateur
}
onChange
=
{
(
event
,
newValue
)
=>
handleInputChange
(
index
,
"
operateur
"
,
newValue
!==
null
?
newValue
:
""
)
)
:
entry
.
colonnes
===
"
origine
"
?
(
<
Select
value
=
{
entry
.
valeur
as
string
}
onChange
=
{
(
event
)
=>
handleInputChange
(
index
,
"
valeur
"
,
event
.
target
.
value
)
}
options
=
{
[
"
contient
"
,
"
commence avec
"
,
"
se termine par
"
]
}
fullWidth
renderInput
=
{
(
params
)
=>
<
TextField
{
...
params
}
label
=
"Opérateur"
/>
}
/>
</
Grid
>
<
Grid
item
xs
=
{
3
}
md
=
{
2
}
>
>
<
MenuItem
value
=
"site"
>
Site
</
MenuItem
>
<
MenuItem
value
=
"en direct"
>
En direct
</
MenuItem
>
</
Select
>
)
:
(
<
TextField
value
=
{
entry
.
valeur
}
value
=
{
entry
.
valeur
as
string
}
onChange
=
{
(
event
)
=>
handleInputChange
(
index
,
"
valeur
"
,
event
.
target
.
value
)
}
fullWidth
label
=
"
v
aleur"
label
=
"
V
aleur"
/>
</
Grid
>
<
Grid
item
xs
=
{
1
}
md
=
{
1
}
container
justifyContent
=
"flex-end"
>
<
IconButton
onClick
=
{
handleAddEntry
}
>
<
AddIcon
fontSize
=
"small"
/
>
<
/
Icon
Button
>
</
Grid
>
)
}
<
/
Grid
>
<
Grid
item
xs
=
{
2
}
container
alignItems
=
"center"
>
<
IconButton
onClick
=
{
handleAddEntry
}
>
<
Add
Icon
fontSize
=
"small"
/
>
</
IconButton
>
{
index
>
0
&&
(
<
Grid
item
xs
=
{
1
}
md
=
{
1
}
container
>
<
IconButton
onClick
=
{
()
=>
handleRemoveEntry
(
index
)
}
>
<
DeleteIcon
fontSize
=
"small"
/>
</
IconButton
>
</
Grid
>
<
IconButton
onClick
=
{
()
=>
handleRemoveEntry
(
index
)
}
>
<
DeleteIcon
fontSize
=
"small"
/>
</
IconButton
>
)
}
</
Grid
>
))
}
</
Stack
>
<
LoadingButton
type
=
"submit"
variant
=
"contained"
fullWidth
>
Filtrer les commandes
</
LoadingButton
>
</
Grid
>
))
}
<
Grid
item
xs
=
{
12
}
style
=
{
{
marginTop
:
"
20px
"
}
}
>
<
LoadingButton
type
=
"submit"
variant
=
"contained"
fullWidth
>
Filtrer les commandes
</
LoadingButton
>
</
Grid
>
</
Stack
>
</
form
>
);
}
\ No newline at end of file
}
This diff is collapsed.
Click to expand it.
Aperçu
0%
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter