@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.
- package/dist/module/actions/JobActions.js +4 -4
- package/dist/module/actions/JobActions.js.map +1 -1
- package/dist/module/actions/index.js +1 -1
- package/dist/module/actions/index.js.map +1 -1
- package/dist/module/actions/types.js +1 -1
- package/dist/module/actions/types.js.map +1 -1
- package/dist/module/apis/index.js +3 -3
- package/dist/module/apis/index.js.map +1 -1
- package/dist/module/apis/maintenanceActions.js +36 -36
- package/dist/module/apis/maintenanceActions.js.map +1 -1
- package/dist/module/apis/userActions.js +5 -5
- package/dist/module/apis/userActions.js.map +1 -1
- package/dist/module/components/FilterPopupMenu.js +49 -49
- package/dist/module/components/FilterPopupMenu.js.map +1 -1
- package/dist/module/components/MaintenanceList.js +38 -38
- package/dist/module/components/MaintenanceList.js.map +1 -1
- package/dist/module/components/MaintenanceListItem.js +62 -62
- package/dist/module/components/MaintenanceListItem.js.map +1 -1
- package/dist/module/components/MaintenanceWidgetItem.js +27 -27
- package/dist/module/components/MaintenanceWidgetItem.js.map +1 -1
- package/dist/module/components/PrioritySelectorPopup.js +15 -15
- package/dist/module/components/PrioritySelectorPopup.js.map +1 -1
- package/dist/module/components/StatusSelectorPopup.js +16 -16
- package/dist/module/components/StatusSelectorPopup.js.map +1 -1
- package/dist/module/components/WidgetLarge.js +2 -2
- package/dist/module/components/WidgetLarge.js.map +1 -1
- package/dist/module/components/WidgetSmall.js +19 -19
- package/dist/module/components/WidgetSmall.js.map +1 -1
- package/dist/module/core.config.js +1 -1
- package/dist/module/core.config.js.map +1 -1
- package/dist/module/feature.config.js +17 -17
- package/dist/module/feature.config.js.map +1 -1
- package/dist/module/helper.js +10 -10
- package/dist/module/helper.js.map +1 -1
- package/dist/module/index.js +11 -11
- package/dist/module/index.js.map +1 -1
- package/dist/module/reducers/JobsReducer.js +13 -13
- package/dist/module/reducers/JobsReducer.js.map +1 -1
- package/dist/module/screens/JobTypePicker.js +17 -17
- package/dist/module/screens/JobTypePicker.js.map +1 -1
- package/dist/module/screens/MaintenancePage.js +10 -10
- package/dist/module/screens/MaintenancePage.js.map +1 -1
- package/dist/module/screens/MaintenanceUserPicker.js +129 -22
- package/dist/module/screens/MaintenanceUserPicker.js.map +1 -1
- package/dist/module/screens/RequestDetail.js +145 -145
- package/dist/module/screens/RequestDetail.js.map +1 -1
- package/dist/module/screens/RequestNotes.js +59 -59
- package/dist/module/screens/RequestNotes.js.map +1 -1
- package/dist/module/screens/ServiceRequest.js +187 -187
- package/dist/module/screens/ServiceRequest.js.map +1 -1
- package/dist/module/values.config.a.js +30 -30
- package/dist/module/values.config.a.js.map +1 -1
- package/dist/module/values.config.default.js +34 -34
- package/dist/module/values.config.default.js.map +1 -1
- package/dist/module/values.config.enquiry.js +34 -34
- package/dist/module/values.config.enquiry.js.map +1 -1
- package/dist/module/values.config.feedback.js +34 -34
- package/dist/module/values.config.feedback.js.map +1 -1
- package/dist/module/values.config.food.js +34 -34
- package/dist/module/values.config.food.js.map +1 -1
- package/dist/module/values.config.forms.js +34 -34
- package/dist/module/values.config.forms.js.map +1 -1
- package/dist/module/values.config.js +34 -34
- package/dist/module/values.config.js.map +1 -1
- package/package.json +51 -51
- package/src/actions/JobActions.js +67 -60
- package/src/actions/index.js +1 -1
- package/src/actions/types.js +1 -2
- package/src/apis/index.js +3 -3
- package/src/apis/maintenanceActions.js +189 -178
- package/src/apis/userActions.js +17 -17
- package/src/components/FilterPopupMenu.js +313 -256
- package/src/components/MaintenanceList.js +396 -317
- package/src/components/MaintenanceListItem.js +347 -288
- package/src/components/MaintenanceWidgetItem.js +145 -124
- package/src/components/PrioritySelectorPopup.js +81 -68
- package/src/components/StatusSelectorPopup.js +81 -70
- package/src/components/WidgetLarge.js +5 -5
- package/src/components/WidgetSmall.js +153 -133
- package/src/core.config.js +27 -3
- package/src/feature.config.js +62 -62
- package/src/helper.js +58 -53
- package/src/index.js +22 -22
- package/src/reducers/JobsReducer.js +85 -66
- package/src/screens/JobTypePicker.js +115 -92
- package/src/screens/MaintenancePage.js +89 -80
- package/src/screens/MaintenanceUserPicker.js +252 -100
- package/src/screens/RequestDetail.js +1348 -1125
- package/src/screens/RequestNotes.js +950 -806
- package/src/screens/ServiceRequest.js +1778 -1550
- package/src/values.config.a.js +33 -33
- package/src/values.config.default.js +39 -39
- package/src/values.config.enquiry.js +39 -39
- package/src/values.config.feedback.js +39 -39
- package/src/values.config.food.js +39 -39
- package/src/values.config.forms.js +39 -39
- package/src/values.config.js +39 -39
|
@@ -1,107 +1,259 @@
|
|
|
1
|
-
import React, { Component } from
|
|
2
|
-
import _ from
|
|
3
|
-
import { TouchableOpacity, View, ScrollView, Text } from
|
|
4
|
-
import { connect } from
|
|
5
|
-
import { Icon } from
|
|
6
|
-
import { Services } from
|
|
7
|
-
import { Components, Colours } from
|
|
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
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
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
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
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);
|