@plusscommunities/pluss-maintenance-app 8.0.8 → 8.0.9-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 +121 -24
  44. package/dist/module/screens/MaintenanceUserPicker.js.map +1 -1
  45. package/dist/module/screens/RequestDetail.js +147 -149
  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 +196 -194
  50. package/dist/module/screens/ServiceRequest.js.map +1 -1
  51. package/dist/module/values.config.a.js +31 -30
  52. package/dist/module/values.config.a.js.map +1 -1
  53. package/dist/module/values.config.default.js +35 -34
  54. package/dist/module/values.config.default.js.map +1 -1
  55. package/dist/module/values.config.enquiry.js +35 -34
  56. package/dist/module/values.config.enquiry.js.map +1 -1
  57. package/dist/module/values.config.feedback.js +35 -34
  58. package/dist/module/values.config.feedback.js.map +1 -1
  59. package/dist/module/values.config.food.js +35 -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 +35 -34
  64. package/dist/module/values.config.js.map +1 -1
  65. package/package.json +52 -53
  66. package/src/actions/JobActions.js +60 -67
  67. package/src/actions/index.js +1 -1
  68. package/src/actions/types.js +2 -1
  69. package/src/apis/index.js +3 -3
  70. package/src/apis/maintenanceActions.js +178 -189
  71. package/src/apis/userActions.js +17 -17
  72. package/src/components/FilterPopupMenu.js +256 -313
  73. package/src/components/MaintenanceList.js +317 -396
  74. package/src/components/MaintenanceListItem.js +288 -347
  75. package/src/components/MaintenanceWidgetItem.js +124 -145
  76. package/src/components/PrioritySelectorPopup.js +68 -81
  77. package/src/components/StatusSelectorPopup.js +70 -81
  78. package/src/components/WidgetLarge.js +5 -5
  79. package/src/components/WidgetSmall.js +133 -153
  80. package/src/core.config.js +3 -27
  81. package/src/feature.config.js +62 -62
  82. package/src/helper.js +53 -58
  83. package/src/index.js +22 -22
  84. package/src/reducers/JobsReducer.js +66 -85
  85. package/src/screens/JobTypePicker.js +92 -115
  86. package/src/screens/MaintenancePage.js +80 -89
  87. package/src/screens/MaintenanceUserPicker.js +186 -117
  88. package/src/screens/RequestDetail.js +1125 -1347
  89. package/src/screens/RequestNotes.js +806 -947
  90. package/src/screens/ServiceRequest.js +1557 -1783
  91. package/src/values.config.a.js +34 -33
  92. package/src/values.config.default.js +40 -39
  93. package/src/values.config.enquiry.js +40 -39
  94. package/src/values.config.feedback.js +40 -39
  95. package/src/values.config.food.js +40 -39
  96. package/src/values.config.forms.js +39 -39
  97. package/src/values.config.js +40 -39
@@ -1,131 +1,200 @@
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 "@rneui/themed";
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, Keyboard } 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';
8
8
 
9
9
  class MaintenanceUserPicker extends Component {
10
- state = {
11
- currentUser: null,
12
- };
10
+ state = {
11
+ currentUser: null,
12
+ searchText: '',
13
+ };
13
14
 
14
- UNSAFE_componentWillMount() {
15
- this.setState({ currentUser: this.props.currentUser });
16
- }
15
+ UNSAFE_componentWillMount() {
16
+ this.setState({ currentUser: this.props.currentUser });
17
+ }
17
18
 
18
- onPressBack() {
19
- Services.navigation.goBack();
20
- }
19
+ onPressBack() {
20
+ Services.navigation.goBack();
21
+ }
21
22
 
22
- onUserPress(user) {
23
- this.props.onSelectUser(user);
24
- this.setState({ currentUser: user });
25
- setTimeout(() => {
26
- this.onPressBack();
27
- }, 200);
28
- }
23
+ onUserPress(user) {
24
+ Keyboard.dismiss();
25
+ this.props.onSelectUser(user);
26
+ this.setState({ currentUser: user });
27
+ setTimeout(() => {
28
+ this.onPressBack();
29
+ }, 200);
30
+ }
29
31
 
30
- renderMain() {
31
- if (_.isEmpty(this.props.users)) {
32
- return (
33
- <View style={{ marginTop: 16 }}>
34
- <Components.Spinner />
35
- </View>
36
- );
37
- }
32
+ onChangeSearch = (text) => {
33
+ this.setState({ searchText: text });
34
+ };
38
35
 
39
- return (
40
- <Components.FormCard style={{ marginTop: 16 }}>
41
- {this.renderOptions()}
42
- </Components.FormCard>
43
- );
44
- }
36
+ getFilteredUsers = () => {
37
+ const { searchText } = this.state;
38
+ const { users } = this.props;
39
+ if (!users) return [];
40
+ if (!searchText || searchText.length === 0) return users;
41
+ const searchLower = searchText.toLowerCase();
42
+ return users.filter(user => {
43
+ const displayName = (user.displayName || '').toLowerCase();
44
+ const unit = (user.unit || '').toLowerCase();
45
+ return displayName.includes(searchLower) || unit.includes(searchLower);
46
+ });
47
+ };
45
48
 
46
- renderOptions() {
47
- return this.props.users.map((user, index) => {
48
- return (
49
- <TouchableOpacity
50
- key={index}
51
- onPress={this.onUserPress.bind(this, user)}
52
- >
53
- <Components.FormCardSection
54
- label={user.displayName}
55
- labelStyle={{ height: 0, margin: 0 }}
56
- hasUnderline
57
- hasContent
58
- >
59
- <View style={styles.rowContainer}>
60
- <View style={styles.userContainer}>
61
- <Components.ProfilePic
62
- ProfilePic={user.profilePic}
63
- Diameter={30}
64
- />
65
- <Text style={styles.labelText}>{user.displayName}</Text>
66
- </View>
67
- <Icon
68
- name="check-circle"
69
- type="font-awesome"
70
- iconStyle={[
71
- { color: "#d5d9e0", fontSize: 20 },
72
- _.isEqual(user, this.state.currentUser) && {
73
- color: Colours.COLOUR_GREEN,
74
- },
75
- ]}
76
- />
77
- </View>
78
- </Components.FormCardSection>
79
- </TouchableOpacity>
80
- );
81
- });
82
- }
49
+ renderMain() {
50
+ if (_.isEmpty(this.props.users)) {
51
+ return (
52
+ <View style={{ marginTop: 16 }}>
53
+ <Components.Spinner />
54
+ </View>
55
+ );
56
+ }
83
57
 
84
- render() {
85
- return (
86
- <View style={styles.container}>
87
- <Components.Header
88
- leftIcon="angle-left"
89
- onPressLeft={this.onPressBack.bind(this)}
90
- text="Select user"
91
- />
92
- <ScrollView style={{ flex: 1 }}>{this.renderMain()}</ScrollView>
93
- </View>
94
- );
95
- }
58
+ const filteredUsers = this.getFilteredUsers();
59
+ if (filteredUsers.length === 0 && this.state.searchText.length > 0) {
60
+ return (
61
+ <View style={styles.noResultsContainer}>
62
+ <Text style={styles.noResultsText}>No users found</Text>
63
+ </View>
64
+ );
65
+ }
66
+
67
+ return <Components.FormCard style={{ marginTop: 16 }}>{this.renderOptions(filteredUsers)}</Components.FormCard>;
68
+ }
69
+
70
+ renderOptions(users) {
71
+ return users.map((user, index) => {
72
+ return (
73
+ <TouchableOpacity key={index} onPress={this.onUserPress.bind(this, user)}>
74
+ <Components.FormCardSection label={user.displayName} labelStyle={{ height: 0, margin: 0 }} hasUnderline hasContent>
75
+ <View style={styles.rowContainer}>
76
+ <View style={styles.userContainer}>
77
+ <Components.ProfilePic ProfilePic={user.profilePic} Diameter={30} />
78
+ <Text style={styles.labelText}>{user.displayName}</Text>
79
+ </View>
80
+ <Icon
81
+ name="check-circle"
82
+ type="font-awesome"
83
+ iconStyle={[{ color: '#d5d9e0', fontSize: 20 }, _.isEqual(user, this.state.currentUser) && { color: Colours.COLOUR_GREEN }]}
84
+ />
85
+ </View>
86
+ </Components.FormCardSection>
87
+ </TouchableOpacity>
88
+ );
89
+ });
90
+ }
91
+
92
+ renderSearch() {
93
+ return (
94
+ <View style={styles.searchContainer}>
95
+ <Icon name="search" type="font-awesome" iconStyle={styles.searchIcon} />
96
+ <TextInput
97
+ placeholder="Search by name or unit"
98
+ autoCorrect={false}
99
+ placeholderTextColor={Colours.TEXT_DARK_ALPHA10}
100
+ onChangeText={this.onChangeSearch}
101
+ value={this.state.searchText}
102
+ style={styles.searchText}
103
+ underlineColorAndroid={'rgba(0,0,0,0)'}
104
+ returnKeyType="search"
105
+ />
106
+ {this.state.searchText.length > 0 && (
107
+ <TouchableOpacity onPress={() => this.onChangeSearch('')} style={styles.clearButton}>
108
+ <Icon name="times-circle" type="font-awesome" iconStyle={styles.clearIcon} />
109
+ </TouchableOpacity>
110
+ )}
111
+ </View>
112
+ );
113
+ }
114
+
115
+ render() {
116
+ return (
117
+ <View style={styles.container}>
118
+ <Components.Header leftIcon="angle-left" onPressLeft={this.onPressBack.bind(this)} text="Select user" />
119
+ {this.renderSearch()}
120
+ <ScrollView style={{ flex: 1 }} keyboardShouldPersistTaps="handled" keyboardDismissMode="on-drag">
121
+ {this.renderMain()}
122
+ </ScrollView>
123
+ </View>
124
+ );
125
+ }
96
126
  }
97
127
 
98
128
  const styles = {
99
- container: {
100
- flex: 1,
101
- position: "relative",
102
- backgroundColor: "#f0f0f5",
103
- },
104
- row: {
105
- flexDirection: "row",
106
- alignItems: "center",
107
- minHeight: 22,
108
- },
109
- text: {
110
- flex: 1,
111
- fontFamily: "sf-regular",
112
- fontSize: 14,
113
- color: Colours.TEXT_DARK,
114
- },
115
- rowContainer: {
116
- flexDirection: "row",
117
- justifyContent: "space-between",
118
- },
119
- userContainer: {
120
- flexDirection: "row",
121
- alignItems: "center",
122
- },
123
- labelText: {
124
- fontFamily: "sf-medium",
125
- fontSize: 16,
126
- color: Colours.TEXT_DARK,
127
- marginLeft: 8,
128
- },
129
+ container: {
130
+ flex: 1,
131
+ position: 'relative',
132
+ backgroundColor: '#f0f0f5',
133
+ },
134
+ row: {
135
+ flexDirection: 'row',
136
+ alignItems: 'center',
137
+ minHeight: 22,
138
+ },
139
+ text: {
140
+ flex: 1,
141
+ fontFamily: 'sf-regular',
142
+ fontSize: 14,
143
+ color: Colours.TEXT_DARK,
144
+ },
145
+ rowContainer: {
146
+ flexDirection: 'row',
147
+ justifyContent: 'space-between',
148
+ },
149
+ userContainer: {
150
+ flexDirection: 'row',
151
+ alignItems: 'center',
152
+ },
153
+ labelText: {
154
+ fontFamily: 'sf-medium',
155
+ fontSize: 16,
156
+ color: Colours.TEXT_DARK,
157
+ marginLeft: 8,
158
+ },
159
+ searchContainer: {
160
+ flexDirection: 'row',
161
+ alignItems: 'center',
162
+ margin: 15,
163
+ backgroundColor: '#fff',
164
+ borderRadius: 8,
165
+ paddingHorizontal: 12,
166
+ paddingVertical: 8,
167
+ },
168
+ searchIcon: {
169
+ fontSize: 16,
170
+ marginRight: 10,
171
+ color: Colours.TEXT_MID_ALPHA50,
172
+ },
173
+ searchText: {
174
+ flex: 1,
175
+ fontSize: 16,
176
+ fontFamily: 'sf-regular',
177
+ color: Colours.TEXT_DARK,
178
+ padding: 0,
179
+ },
180
+ clearButton: {
181
+ padding: 4,
182
+ },
183
+ clearIcon: {
184
+ fontSize: 16,
185
+ color: Colours.TEXT_MID_ALPHA50,
186
+ },
187
+ noResultsContainer: {
188
+ alignItems: 'center',
189
+ justifyContent: 'center',
190
+ paddingVertical: 40,
191
+ },
192
+ noResultsText: {
193
+ fontSize: 16,
194
+ fontFamily: 'sf-regular',
195
+ color: Colours.TEXT_LIGHT,
196
+ textAlign: 'center',
197
+ },
129
198
  };
130
199
 
131
- export default connect(null, {})(MaintenanceUserPicker);
200
+ export default connect(null, {})(MaintenanceUserPicker);