@@ -220,25 +220,23 @@ const leaveTypeTemplate = (args: any) => {
220220 }
221221 } ;
222222
223- const statusTemplate = ( args : any ) => {
224- return (
225- < div >
226- { args . Status === 'Closed' ? (
227- < div id = "status" className = "statustemp closed" >
228- < span className = "statustxt closed" > { args . Status } </ span >
229- </ div >
230- ) : args . Status === 'Approved' ? (
231- < div id = "status" className = "statustemp approved" >
232- < span className = "statustxt approved" > { args . Status } </ span >
233- </ div >
234- ) : (
235- < div id = "status" className = "statustemp needtoapprove" >
236- < span className = "statustxt needtoapprove" > { args . Status } </ span >
237- </ div >
238- ) }
239- </ div >
240- ) ;
241- } ;
223+ const statusTemplate = ( args : any ) => {
224+ const rawStatus = args . Status || 'N/A' ;
225+ // normalize id-safe key, e.g. "Need to Approve" → "need-to-approve"
226+ const key = rawStatus
227+ . toString ( )
228+ . trim ( )
229+ . toLowerCase ( )
230+ . replace ( / \s + / g, '-' ) ;
231+
232+ return (
233+ < div className = "status-badge-wrapper" >
234+ < span className = { `e-badge status-${ key } ` } title = { rawStatus } >
235+ { rawStatus }
236+ </ span >
237+ </ div >
238+ ) ;
239+ } ;
242240
243241 const approveChange = ( args : ChangeEventArgs ) => {
244242 const td = ( ( args . event as any ) . target as HTMLElement ) ?. closest ( 'td' ) ;
@@ -268,15 +266,11 @@ const leaveTypeTemplate = (args: any) => {
268266 < div className = 'employee-leave-detail' >
269267 < div className = "employeeLeave-header" >
270268 < div className = "leaveinfo" >
271- < div className = 'leave-headerinfo' >
272- < b > Leave:</ b > { ' ' }
273- </ div >
274- < div className = 'leave-value' >
269+ < b > Leave:</ b > { ' ' }
275270 < span className = "e-badge badge-casual" > { leaveCount . casual } d</ span > Casual |{ ' ' }
276271 < span className = "e-badge badge-sick" > { leaveCount . sick } d</ span > Sick |{ ' ' }
277272 < span className = "e-badge badge-others" > { leaveCount . others } d</ span > Others |{ ' ' }
278273 < span className = "e-badge badge-request" > { leaveCount . request } d</ span > Request
279- </ div >
280274 </ div >
281275 < div className = "daterange" >
282276 < Presets dateRangeChange = { dateRangeChange } />
@@ -311,7 +305,7 @@ const leaveTypeTemplate = (args: any) => {
311305 < ColumnDirective field = "From" type = "date" format = "MMM d yyyy" textAlign = "Right" width = "120" />
312306 < ColumnDirective field = "To" type = "date" format = "MMM d yyyy" textAlign = "Right" width = "120" />
313307 < ColumnDirective field = "Days" headerText = "Day(s)" textAlign = "Right" width = "120" />
314- < ColumnDirective field = "Status" template = { statusTemplate } width = "150" />
308+ < ColumnDirective field = "Status" headerText = "Status" template = { statusTemplate } width = "150" />
315309 { props . employeeData &&
316310 props . userInfo &&
317311 props . employeeData . TeamLead === props . userInfo . Name && (
0 commit comments