@@ -41,6 +41,7 @@ function componentsMixin() {
4141 replacement_hours : '' ,
4242 replacement_days : '' ,
4343 tbo_critical : true ,
44+ on_condition : false ,
4445 inspection_critical : true ,
4546 replacement_critical : false ,
4647 } ,
@@ -99,6 +100,31 @@ function componentsMixin() {
99100 } ,
100101
101102 getHoursRemainingClass ( component ) {
103+ // On-condition: positive color scheme (blue approaching TBO, green past TBO).
104+ // Only applies when TBO is the primary tracked interval (not service replacement).
105+ const useOnCondition = component . on_condition && component . tbo_critical &&
106+ ! ( component . replacement_critical &&
107+ ( component . replacement_hours || component . replacement_days ) ) ;
108+ if ( useOnCondition ) {
109+ if ( component . tbo_hours ) {
110+ const ratio = ( component . hours_since_overhaul || 0 ) / component . tbo_hours ;
111+ if ( ratio >= 1.5 ) return 'hours-on-condition-extended' ; // > 150% TBO: green
112+ if ( ratio >= 1.0 ) return 'hours-on-condition-over' ; // 100–150% TBO: teal
113+ if ( ratio >= 0.9 ) return 'hours-on-condition' ; // 90–100% TBO: blue
114+ return '' ;
115+ }
116+ if ( component . tbo_days ) {
117+ const calDays = this . getCalendarDaysRemaining ( component ) ;
118+ if ( calDays !== null ) {
119+ const ratio = ( component . tbo_days - calDays ) / component . tbo_days ;
120+ if ( ratio >= 1.5 ) return 'hours-on-condition-extended' ;
121+ if ( ratio >= 1.0 ) return 'hours-on-condition-over' ;
122+ if ( ratio >= 0.9 ) return 'hours-on-condition' ;
123+ }
124+ }
125+ return '' ;
126+ }
127+ // Standard alert coloring
102128 const remaining = this . calculateHoursRemaining ( component ) ;
103129 if ( remaining !== 'N/A' ) {
104130 const hours = parseFloat ( remaining ) ;
@@ -173,6 +199,24 @@ function componentsMixin() {
173199 return Math . round ( ( due - now ) / ( 1000 * 60 * 60 * 24 ) ) ;
174200 } ,
175201
202+ // CSS class for the "Calendar Remaining" value in the expanded detail panel.
203+ // On-condition mode uses a flat informational blue when past TBO (no gradient —
204+ // calendar time is a secondary indicator and we don't want to reward over-TBO
205+ // operation the way the hours gradient does).
206+ getCalendarRemainingClass ( component ) {
207+ const calDays = this . getCalendarDaysRemaining ( component ) ;
208+ if ( calDays === null ) return '' ;
209+ const useOnCondition = component . on_condition && component . tbo_critical &&
210+ ! ( component . replacement_critical && component . replacement_days ) ;
211+ if ( useOnCondition && component . tbo_days && calDays <= 0 ) {
212+ return 'hours-on-condition' ;
213+ }
214+ if ( calDays <= 0 ) return 'hours-overdue' ;
215+ if ( calDays < 30 ) return 'hours-critical' ;
216+ if ( calDays < 90 ) return 'hours-warning' ;
217+ return '' ;
218+ } ,
219+
176220 // Formats a signed number of days as a human-readable duration string.
177221 // Negative values append " over".
178222 formatDuration ( days ) {
@@ -284,6 +328,7 @@ function componentsMixin() {
284328 replacement_hours : '' ,
285329 replacement_days : '' ,
286330 tbo_critical : true ,
331+ on_condition : false ,
287332 inspection_critical : true ,
288333 replacement_critical : false ,
289334 } ;
@@ -313,6 +358,7 @@ function componentsMixin() {
313358 replacement_hours : component . replacement_hours || '' ,
314359 replacement_days : component . replacement_days || '' ,
315360 tbo_critical : component . tbo_critical ?? true ,
361+ on_condition : component . on_condition ?? false ,
316362 inspection_critical : component . inspection_critical ?? true ,
317363 replacement_critical : component . replacement_critical ?? false ,
318364 } ;
@@ -342,6 +388,7 @@ function componentsMixin() {
342388 hours_in_service : parseFloat ( this . componentForm . hours_in_service ) || 0 ,
343389 hours_since_overhaul : parseFloat ( this . componentForm . hours_since_overhaul ) || 0 ,
344390 tbo_critical : this . componentForm . tbo_critical ,
391+ on_condition : this . componentForm . on_condition ,
345392 inspection_critical : this . componentForm . inspection_critical ,
346393 replacement_critical : this . componentForm . replacement_critical ,
347394 } ;
@@ -540,6 +587,11 @@ function componentsMixin() {
540587
541588 getStatusClass ( component ) {
542589 if ( component . status === 'IN-USE' ) {
590+ // On-condition: suppress red/orange warnings; blue when at/past TBO
591+ if ( component . on_condition && component . tbo_critical && component . tbo_hours ) {
592+ const ratio = ( component . hours_since_overhaul || 0 ) / component . tbo_hours ;
593+ return ratio >= 1.0 ? 'pf-m-blue' : 'pf-m-green' ;
594+ }
543595 const hoursToTBO = this . calculateHoursToTBO ( component ) ;
544596 if ( hoursToTBO !== 'N/A' ) {
545597 const hours = parseFloat ( hoursToTBO ) ;
0 commit comments