Browse Source

Added colors depending on stock quantity for proximo

keplyx 4 years ago
parent
commit
b7ef071565
1 changed files with 14 additions and 1 deletions
  1. 14
    1
      screens/Proximo/ProximoListScreen.js

+ 14
- 1
screens/Proximo/ProximoListScreen.js View File

@@ -132,6 +132,17 @@ export default class ProximoListScreen extends React.Component<Props, State> {
132 132
         this.setSortMode(this.state.currentSortMode, this.state.isSortReversed);
133 133
     }
134 134
 
135
+    getStockColor(availableStock: number) {
136
+        let color : string;
137
+        if (availableStock > 3)
138
+            color = ThemeManager.getCurrentThemeVariables().brandSuccess;
139
+        else if (availableStock > 0)
140
+            color = ThemeManager.getCurrentThemeVariables().brandWarning;
141
+        else
142
+            color = ThemeManager.getCurrentThemeVariables().brandDanger;
143
+        return color;
144
+    }
145
+
135 146
     /**
136 147
      * Set the sort menu icon based on the given mode.
137 148
      *
@@ -221,7 +232,9 @@ export default class ProximoListScreen extends React.Component<Props, State> {
221 232
                                     <Text style={{marginLeft: 20}}>
222 233
                                         {item.name}
223 234
                                     </Text>
224
-                                    <Text note style={{marginLeft: 20}}>
235
+                                    <Text note style={{
236
+                                        marginLeft: 20,
237
+                                    color: this.getStockColor(parseInt(item.quantity))}}>
225 238
                                         {item.quantity + ' ' + i18n.t('proximoScreen.inStock')}
226 239
                                     </Text>
227 240
                                 </Body>

Loading…
Cancel
Save