@@ -3,7 +3,7 @@ import dayjs from "dayjs";
33import { chain } from "lodash" ;
44import { useState } from "react" ;
55import { Helmet } from "react-helmet" ;
6- import { EventType } from "~/Components/Event/Enums" ;
6+ import { EventStatus , EventType } from "~/Components/Event/Enums" ;
77import { EventItem } from "~/Components/History/EventItem" ;
88import { useStatus } from "~/Services/Status" ;
99
@@ -21,6 +21,7 @@ export function History() {
2121 serviceName : "" ,
2222 region : "" ,
2323 eventType : "" ,
24+ eventStatus : "" ,
2425 } ) ;
2526
2627 const [ validation , setValidation ] = useState ( {
@@ -51,6 +52,7 @@ export function History() {
5152 serviceName : "" ,
5253 region : "" ,
5354 eventType : "" ,
55+ eventStatus : "" ,
5456 } ) ;
5557 setValidation ( {
5658 startDate : "" ,
@@ -97,6 +99,10 @@ export function History() {
9799 return false ;
98100 }
99101
102+ if ( filters . eventStatus && event . Status !== filters . eventStatus ) {
103+ return false ;
104+ }
105+
100106 return true ;
101107 } )
102108 . orderBy ( x => x . Start , "desc" )
@@ -114,7 +120,7 @@ export function History() {
114120 </ section >
115121
116122 < section className = "flex flex-col rounded-lg bg-white shadow-md p-5 gap-y-1.5" >
117- < div className = "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5 gap-4" >
123+ < div className = "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-6 gap-4" >
118124 < ScaleTextField
119125 type = "date"
120126 label = "Start Date"
@@ -153,6 +159,7 @@ export function History() {
153159 label = "Service Name"
154160 placeholder = "Search service name"
155161 value = { filters . serviceName }
162+ inputAutocomplete = "off"
156163 onScale-input = { ( e ) => setFilters ( prev => ( {
157164 ...prev ,
158165 serviceName : e . target . value as string
@@ -190,6 +197,22 @@ export function History() {
190197 </ ScaleDropdownSelectItem >
191198 ) ) }
192199 </ ScaleDropdownSelect >
200+
201+ < ScaleDropdownSelect
202+ label = "Event Status"
203+ value = { filters . eventStatus }
204+ onScale-change = { ( e ) => setFilters ( prev => ( {
205+ ...prev ,
206+ eventStatus : e . target . value as string
207+ } ) ) }
208+ >
209+ < ScaleDropdownSelectItem value = "" > All Status</ ScaleDropdownSelectItem >
210+ { Object . values ( EventStatus ) . map ( ( status , i ) => (
211+ < ScaleDropdownSelectItem value = { status } key = { i } >
212+ { status }
213+ </ ScaleDropdownSelectItem >
214+ ) ) }
215+ </ ScaleDropdownSelect >
193216 </ div >
194217
195218 < div className = "flex justify-between items-center mt-4" >
0 commit comments