@plusscommunities/pluss-maintenance-app 6.0.20 → 6.0.21-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/dist/module/actions/JobActions.js +4 -4
  2. package/dist/module/actions/JobActions.js.map +1 -1
  3. package/dist/module/actions/index.js +1 -1
  4. package/dist/module/actions/index.js.map +1 -1
  5. package/dist/module/actions/types.js +1 -1
  6. package/dist/module/actions/types.js.map +1 -1
  7. package/dist/module/apis/index.js +3 -3
  8. package/dist/module/apis/index.js.map +1 -1
  9. package/dist/module/apis/maintenanceActions.js +36 -36
  10. package/dist/module/apis/maintenanceActions.js.map +1 -1
  11. package/dist/module/apis/userActions.js +5 -5
  12. package/dist/module/apis/userActions.js.map +1 -1
  13. package/dist/module/components/FilterPopupMenu.js +49 -49
  14. package/dist/module/components/FilterPopupMenu.js.map +1 -1
  15. package/dist/module/components/MaintenanceList.js +38 -38
  16. package/dist/module/components/MaintenanceList.js.map +1 -1
  17. package/dist/module/components/MaintenanceListItem.js +62 -62
  18. package/dist/module/components/MaintenanceListItem.js.map +1 -1
  19. package/dist/module/components/MaintenanceWidgetItem.js +27 -27
  20. package/dist/module/components/MaintenanceWidgetItem.js.map +1 -1
  21. package/dist/module/components/PrioritySelectorPopup.js +15 -15
  22. package/dist/module/components/PrioritySelectorPopup.js.map +1 -1
  23. package/dist/module/components/StatusSelectorPopup.js +16 -16
  24. package/dist/module/components/StatusSelectorPopup.js.map +1 -1
  25. package/dist/module/components/WidgetLarge.js +2 -2
  26. package/dist/module/components/WidgetLarge.js.map +1 -1
  27. package/dist/module/components/WidgetSmall.js +19 -19
  28. package/dist/module/components/WidgetSmall.js.map +1 -1
  29. package/dist/module/core.config.js +1 -1
  30. package/dist/module/core.config.js.map +1 -1
  31. package/dist/module/feature.config.js +17 -17
  32. package/dist/module/feature.config.js.map +1 -1
  33. package/dist/module/helper.js +10 -10
  34. package/dist/module/helper.js.map +1 -1
  35. package/dist/module/index.js +11 -11
  36. package/dist/module/index.js.map +1 -1
  37. package/dist/module/reducers/JobsReducer.js +13 -13
  38. package/dist/module/reducers/JobsReducer.js.map +1 -1
  39. package/dist/module/screens/JobTypePicker.js +17 -17
  40. package/dist/module/screens/JobTypePicker.js.map +1 -1
  41. package/dist/module/screens/MaintenancePage.js +10 -10
  42. package/dist/module/screens/MaintenancePage.js.map +1 -1
  43. package/dist/module/screens/MaintenanceUserPicker.js +129 -22
  44. package/dist/module/screens/MaintenanceUserPicker.js.map +1 -1
  45. package/dist/module/screens/RequestDetail.js +145 -145
  46. package/dist/module/screens/RequestDetail.js.map +1 -1
  47. package/dist/module/screens/RequestNotes.js +59 -59
  48. package/dist/module/screens/RequestNotes.js.map +1 -1
  49. package/dist/module/screens/ServiceRequest.js +187 -187
  50. package/dist/module/screens/ServiceRequest.js.map +1 -1
  51. package/dist/module/values.config.a.js +30 -30
  52. package/dist/module/values.config.a.js.map +1 -1
  53. package/dist/module/values.config.default.js +34 -34
  54. package/dist/module/values.config.default.js.map +1 -1
  55. package/dist/module/values.config.enquiry.js +34 -34
  56. package/dist/module/values.config.enquiry.js.map +1 -1
  57. package/dist/module/values.config.feedback.js +34 -34
  58. package/dist/module/values.config.feedback.js.map +1 -1
  59. package/dist/module/values.config.food.js +34 -34
  60. package/dist/module/values.config.food.js.map +1 -1
  61. package/dist/module/values.config.forms.js +34 -34
  62. package/dist/module/values.config.forms.js.map +1 -1
  63. package/dist/module/values.config.js +34 -34
  64. package/dist/module/values.config.js.map +1 -1
  65. package/package.json +51 -51
  66. package/src/actions/JobActions.js +67 -60
  67. package/src/actions/index.js +1 -1
  68. package/src/actions/types.js +1 -2
  69. package/src/apis/index.js +3 -3
  70. package/src/apis/maintenanceActions.js +189 -178
  71. package/src/apis/userActions.js +17 -17
  72. package/src/components/FilterPopupMenu.js +313 -256
  73. package/src/components/MaintenanceList.js +396 -317
  74. package/src/components/MaintenanceListItem.js +347 -288
  75. package/src/components/MaintenanceWidgetItem.js +145 -124
  76. package/src/components/PrioritySelectorPopup.js +81 -68
  77. package/src/components/StatusSelectorPopup.js +81 -70
  78. package/src/components/WidgetLarge.js +5 -5
  79. package/src/components/WidgetSmall.js +153 -133
  80. package/src/core.config.js +27 -3
  81. package/src/feature.config.js +62 -62
  82. package/src/helper.js +58 -53
  83. package/src/index.js +22 -22
  84. package/src/reducers/JobsReducer.js +85 -66
  85. package/src/screens/JobTypePicker.js +115 -92
  86. package/src/screens/MaintenancePage.js +89 -80
  87. package/src/screens/MaintenanceUserPicker.js +252 -100
  88. package/src/screens/RequestDetail.js +1348 -1125
  89. package/src/screens/RequestNotes.js +950 -806
  90. package/src/screens/ServiceRequest.js +1778 -1550
  91. package/src/values.config.a.js +33 -33
  92. package/src/values.config.default.js +39 -39
  93. package/src/values.config.enquiry.js +39 -39
  94. package/src/values.config.feedback.js +39 -39
  95. package/src/values.config.food.js +39 -39
  96. package/src/values.config.forms.js +39 -39
  97. package/src/values.config.js +39 -39
@@ -1,107 +1,259 @@
1
- import React, { Component } from 'react';
2
- import _ from 'lodash';
3
- import { TouchableOpacity, View, ScrollView, Text } from 'react-native';
4
- import { connect } from 'react-redux';
5
- import { Icon } from 'react-native-elements';
6
- import { Services } from '../feature.config';
7
- import { Components, Colours } from '../core.config';
1
+ import React, { Component } from "react";
2
+ import _ from "lodash";
3
+ import { TouchableOpacity, View, ScrollView, Text, TextInput } from "react-native";
4
+ import { connect } from "react-redux";
5
+ import { Icon } from "react-native-elements";
6
+ import { Services } from "../feature.config";
7
+ import { Components, Colours, Fonts } from "../core.config";
8
8
 
9
9
  class MaintenanceUserPicker extends Component {
10
- state = {
11
- currentUser: null,
12
- };
13
-
14
- UNSAFE_componentWillMount() {
15
- this.setState({ currentUser: this.props.currentUser });
16
- }
17
-
18
- onPressBack() {
19
- Services.navigation.goBack();
20
- }
21
-
22
- onUserPress(user) {
23
- this.props.onSelectUser(user);
24
- this.setState({ currentUser: user });
25
- setTimeout(() => {
26
- this.onPressBack();
27
- }, 200);
28
- }
29
-
30
- renderMain() {
31
- if (_.isEmpty(this.props.users)) {
32
- return (
33
- <View style={{ marginTop: 16 }}>
34
- <Components.Spinner />
35
- </View>
36
- );
37
- }
38
-
39
- return <Components.FormCard style={{ marginTop: 16 }}>{this.renderOptions()}</Components.FormCard>;
40
- }
41
-
42
- renderOptions() {
43
- return this.props.users.map((user, index) => {
44
- return (
45
- <TouchableOpacity key={index} onPress={this.onUserPress.bind(this, user)}>
46
- <Components.FormCardSection label={user.displayName} labelStyle={{ height: 0, margin: 0 }} hasUnderline hasContent>
47
- <View style={styles.rowContainer}>
48
- <View style={styles.userContainer}>
49
- <Components.ProfilePic ProfilePic={user.profilePic} Diameter={30} />
50
- <Text style={styles.labelText}>{user.displayName}</Text>
51
- </View>
52
- <Icon
53
- name="check-circle"
54
- type="font-awesome"
55
- iconStyle={[{ color: '#d5d9e0', fontSize: 20 }, _.isEqual(user, this.state.currentUser) && { color: Colours.COLOUR_GREEN }]}
56
- />
57
- </View>
58
- </Components.FormCardSection>
59
- </TouchableOpacity>
60
- );
61
- });
62
- }
63
-
64
- render() {
65
- return (
66
- <View style={styles.container}>
67
- <Components.Header leftIcon="angle-left" onPressLeft={this.onPressBack.bind(this)} text="Select user" />
68
- <ScrollView style={{ flex: 1 }}>{this.renderMain()}</ScrollView>
69
- </View>
70
- );
71
- }
10
+ state = {
11
+ currentUser: null,
12
+ searchText: '',
13
+ filteredUsers: []
14
+ };
15
+
16
+ UNSAFE_componentWillMount() {
17
+ this.setState({
18
+ currentUser: this.props.currentUser,
19
+ filteredUsers: this.props.users || []
20
+ });
21
+ }
22
+
23
+ UNSAFE_componentWillReceiveProps(nextProps) {
24
+ if (nextProps.users !== this.props.users) {
25
+ this.setState({
26
+ filteredUsers: this.getFilteredUsers(this.state.searchText, nextProps.users)
27
+ });
28
+ }
29
+ if (nextProps.currentUser !== this.props.currentUser) {
30
+ this.setState({
31
+ currentUser: nextProps.currentUser
32
+ });
33
+ }
34
+ }
35
+
36
+ onPressBack() {
37
+ Services.navigation.goBack();
38
+ }
39
+
40
+ onUserPress(user) {
41
+ this.props.onSelectUser(user);
42
+ this.setState({ currentUser: user });
43
+ setTimeout(() => {
44
+ this.onPressBack();
45
+ }, 200);
46
+ }
47
+
48
+ onChangeSearch = (text) => {
49
+ this.setState({
50
+ searchText: text,
51
+ filteredUsers: this.getFilteredUsers(text)
52
+ });
53
+ }
54
+
55
+ getFilteredUsers = (searchText, users) => {
56
+ const usersList = users || this.props.users || [];
57
+
58
+ if (!searchText || searchText.length === 0) {
59
+ return usersList;
60
+ }
61
+
62
+ if (!usersList || usersList.length === 0) {
63
+ return [];
64
+ }
65
+
66
+ return usersList.filter(user => {
67
+ const displayName = user.displayName || '';
68
+ const unit = user.unit || '';
69
+ const searchLower = searchText.toLowerCase();
70
+
71
+ return displayName.toLowerCase().includes(searchLower) ||
72
+ unit.toLowerCase().includes(searchLower);
73
+ });
74
+ }
75
+
76
+ renderSearch = () => {
77
+ return (
78
+ <View style={styles.searchContainer}>
79
+ <Fonts.PlIcon name="nav-search" style={styles.searchIcon} />
80
+ <TextInput
81
+ placeholder='Search by name or unit'
82
+ autoCorrect={false}
83
+ placeholderTextColor={'rgba(60, 60, 80, .1)'}
84
+ onChangeText={this.onChangeSearch}
85
+ value={this.state.searchText}
86
+ style={styles.searchText}
87
+ underlineColorAndroid={'rgba(0,0,0,0)'}
88
+ returnKeyType="search"
89
+ />
90
+ {this.state.searchText.length > 0 && (
91
+ <TouchableOpacity
92
+ onPress={() => this.onChangeSearch('')}
93
+ style={styles.clearButton}
94
+ >
95
+ <Icon
96
+ name="times-circle"
97
+ type="font-awesome"
98
+ iconStyle={styles.clearIcon}
99
+ />
100
+ </TouchableOpacity>
101
+ )}
102
+ </View>
103
+ );
104
+ }
105
+
106
+ renderMain() {
107
+ if (_.isEmpty(this.props.users)) {
108
+ return (
109
+ <View style={{ marginTop: 16 }}>
110
+ <Components.Spinner />
111
+ </View>
112
+ );
113
+ }
114
+
115
+ return (
116
+ <Components.FormCard style={{ marginTop: 16 }}>
117
+ {this.renderOptions()}
118
+ </Components.FormCard>
119
+ );
120
+ }
121
+
122
+ renderOptions() {
123
+ const users = this.state.filteredUsers;
124
+
125
+ if (users.length === 0 && this.state.searchText.length > 0) {
126
+ return (
127
+ <View style={styles.noResultsContainer}>
128
+ <Text style={styles.noResultsText}>
129
+ No users found matching "{this.state.searchText}"
130
+ </Text>
131
+ </View>
132
+ );
133
+ }
134
+
135
+ return users.map((user, index) => {
136
+ return (
137
+ <TouchableOpacity
138
+ key={index}
139
+ onPress={this.onUserPress.bind(this, user)}
140
+ >
141
+ <Components.FormCardSection
142
+ label={user.displayName}
143
+ labelStyle={{ height: 0, margin: 0 }}
144
+ hasUnderline
145
+ hasContent
146
+ >
147
+ <View style={styles.rowContainer}>
148
+ <View style={styles.userContainer}>
149
+ <Components.ProfilePic
150
+ ProfilePic={user.profilePic}
151
+ Diameter={30}
152
+ />
153
+ <Text style={styles.labelText}>{user.displayName}</Text>
154
+ </View>
155
+ <Icon
156
+ name="check-circle"
157
+ type="font-awesome"
158
+ iconStyle={[
159
+ { color: "#d5d9e0", fontSize: 20 },
160
+ _.isEqual(user, this.state.currentUser) && {
161
+ color: Colours.COLOUR_GREEN,
162
+ },
163
+ ]}
164
+ />
165
+ </View>
166
+ </Components.FormCardSection>
167
+ </TouchableOpacity>
168
+ );
169
+ });
170
+ }
171
+
172
+ render() {
173
+ return (
174
+ <View style={styles.container}>
175
+ <Components.Header
176
+ leftIcon="angle-left"
177
+ onPressLeft={this.onPressBack.bind(this)}
178
+ text="Select user"
179
+ />
180
+ {this.renderSearch()}
181
+ <ScrollView style={{ flex: 1 }}>{this.renderMain()}</ScrollView>
182
+ </View>
183
+ );
184
+ }
72
185
  }
73
186
 
74
187
  const styles = {
75
- container: {
76
- flex: 1,
77
- position: 'relative',
78
- backgroundColor: '#f0f0f5',
79
- },
80
- row: {
81
- flexDirection: 'row',
82
- alignItems: 'center',
83
- minHeight: 22,
84
- },
85
- text: {
86
- flex: 1,
87
- fontFamily: 'sf-regular',
88
- fontSize: 14,
89
- color: Colours.TEXT_DARK,
90
- },
91
- rowContainer: {
92
- flexDirection: 'row',
93
- justifyContent: 'space-between',
94
- },
95
- userContainer: {
96
- flexDirection: 'row',
97
- alignItems: 'center',
98
- },
99
- labelText: {
100
- fontFamily: 'sf-medium',
101
- fontSize: 16,
102
- color: Colours.TEXT_DARK,
103
- marginLeft: 8,
104
- },
188
+ container: {
189
+ flex: 1,
190
+ position: "relative",
191
+ backgroundColor: "#f0f0f5",
192
+ },
193
+ row: {
194
+ flexDirection: "row",
195
+ alignItems: "center",
196
+ minHeight: 22,
197
+ },
198
+ text: {
199
+ flex: 1,
200
+ fontFamily: "sf-regular",
201
+ fontSize: 14,
202
+ color: Colours.TEXT_DARK,
203
+ },
204
+ rowContainer: {
205
+ flexDirection: "row",
206
+ justifyContent: "space-between",
207
+ },
208
+ userContainer: {
209
+ flexDirection: "row",
210
+ alignItems: "center",
211
+ },
212
+ labelText: {
213
+ fontFamily: "sf-medium",
214
+ fontSize: 16,
215
+ color: Colours.TEXT_DARK,
216
+ marginLeft: 8,
217
+ },
218
+ searchContainer: {
219
+ flexDirection: 'row',
220
+ alignItems: 'center',
221
+ paddingHorizontal: 16,
222
+ paddingVertical: 12,
223
+ backgroundColor: '#fff',
224
+ borderBottomWidth: 1,
225
+ borderBottomColor: '#f0f0f5'
226
+ },
227
+ searchIcon: {
228
+ fontSize: 20,
229
+ marginRight: 10,
230
+ color: 'rgba(90, 90, 110, .5)'
231
+ },
232
+ searchText: {
233
+ flex: 1,
234
+ fontSize: 16,
235
+ fontFamily: 'sf-regular',
236
+ color: Colours.TEXT_DARK
237
+ },
238
+ clearButton: {
239
+ padding: 8
240
+ },
241
+ clearIcon: {
242
+ fontSize: 18,
243
+ color: 'rgba(90, 90, 110, .5)'
244
+ },
245
+ noResultsContainer: {
246
+ flex: 1,
247
+ alignItems: 'center',
248
+ justifyContent: 'center',
249
+ paddingVertical: 40
250
+ },
251
+ noResultsText: {
252
+ fontSize: 16,
253
+ fontFamily: 'sf-regular',
254
+ color: Colours.TEXT_LIGHT,
255
+ textAlign: 'center'
256
+ }
105
257
  };
106
258
 
107
- export default connect(null, {})(MaintenanceUserPicker);
259
+ export default connect(null, {})(MaintenanceUserPicker);