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