@plusscommunities/pluss-maintenance-app 6.1.1-beta.0 → 7.0.0-auth.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 +44 -1
- package/dist/module/actions/JobActions.js.map +1 -1
- package/dist/module/actions/types.js +3 -0
- package/dist/module/actions/types.js.map +1 -1
- package/dist/module/apis/index.js +3 -1
- package/dist/module/apis/index.js.map +1 -1
- package/dist/module/apis/{generalActions.js → maintenanceActions.js} +44 -45
- package/dist/module/apis/maintenanceActions.js.map +1 -0
- package/dist/module/components/FilterPopupMenu.js +78 -26
- package/dist/module/components/FilterPopupMenu.js.map +1 -1
- package/dist/module/components/MaintenanceList.js +70 -45
- package/dist/module/components/MaintenanceList.js.map +1 -1
- package/dist/module/components/MaintenanceListItem.js +54 -42
- package/dist/module/components/MaintenanceListItem.js.map +1 -1
- package/dist/module/components/MaintenanceWidgetItem.js +16 -20
- package/dist/module/components/MaintenanceWidgetItem.js.map +1 -1
- package/dist/module/components/PrioritySelectorPopup.js +82 -0
- package/dist/module/components/PrioritySelectorPopup.js.map +1 -0
- package/dist/module/components/StatusSelectorPopup.js +9 -13
- package/dist/module/components/StatusSelectorPopup.js.map +1 -1
- package/dist/module/components/WidgetSmall.js +14 -10
- package/dist/module/components/WidgetSmall.js.map +1 -1
- package/dist/module/feature.config.js +3 -3
- package/dist/module/feature.config.js.map +1 -1
- package/dist/module/helper.js +39 -17
- package/dist/module/helper.js.map +1 -1
- package/dist/module/reducers/JobsReducer.js +33 -3
- package/dist/module/reducers/JobsReducer.js.map +1 -1
- package/dist/module/screens/JobTypePicker.js +3 -3
- package/dist/module/screens/JobTypePicker.js.map +1 -1
- package/dist/module/screens/MaintenancePage.js +2 -2
- package/dist/module/screens/RequestDetail.js +340 -88
- package/dist/module/screens/RequestDetail.js.map +1 -1
- package/dist/module/screens/RequestNotes.js +437 -26
- package/dist/module/screens/RequestNotes.js.map +1 -1
- package/dist/module/screens/ServiceRequest.js +596 -93
- package/dist/module/screens/ServiceRequest.js.map +1 -1
- package/dist/module/values.config.a.js +9 -1
- package/dist/module/values.config.a.js.map +1 -1
- package/dist/module/values.config.default.js +15 -1
- package/dist/module/values.config.default.js.map +1 -1
- package/dist/module/values.config.forms.js +42 -0
- package/dist/module/values.config.forms.js.map +1 -0
- package/dist/module/values.config.js +15 -1
- package/dist/module/values.config.js.map +1 -1
- package/package.json +16 -12
- package/src/actions/JobActions.js +53 -1
- package/src/actions/types.js +4 -0
- package/src/apis/index.js +5 -1
- package/src/apis/{generalActions.js → maintenanceActions.js} +51 -43
- package/src/components/FilterPopupMenu.js +75 -24
- package/src/components/MaintenanceList.js +64 -33
- package/src/components/MaintenanceListItem.js +53 -31
- package/src/components/MaintenanceWidgetItem.js +18 -14
- package/src/components/PrioritySelectorPopup.js +79 -0
- package/src/components/StatusSelectorPopup.js +8 -13
- package/src/components/WidgetSmall.js +10 -8
- package/src/feature.config.js +15 -13
- package/src/helper.js +51 -13
- package/src/reducers/JobsReducer.js +27 -2
- package/src/screens/JobTypePicker.js +1 -1
- package/src/screens/RequestDetail.js +324 -75
- package/src/screens/RequestNotes.js +434 -33
- package/src/screens/ServiceRequest.js +642 -157
- package/src/values.config.a.js +8 -0
- package/src/values.config.default.js +14 -0
- package/src/values.config.forms.js +42 -0
- package/src/values.config.js +14 -0
- package/dist/module/apis/generalActions.js.map +0 -1
- package/dist/module/values.config.b.js +0 -28
- package/dist/module/values.config.b.js.map +0 -1
- package/dist/module/values.config.c.js +0 -28
- package/dist/module/values.config.c.js.map +0 -1
- package/dist/module/values.config.d.js +0 -28
- package/dist/module/values.config.d.js.map +0 -1
- package/src/values.config.b.js +0 -28
- package/src/values.config.c.js +0 -28
- package/src/values.config.d.js +0 -28
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@plusscommunities/pluss-maintenance-app",
|
3
|
-
"version": "
|
3
|
+
"version": "7.0.0-auth.0",
|
4
4
|
"description": "Extension package to enable maintenance on Pluss Communities Platform",
|
5
5
|
"main": "dist/module/index.js",
|
6
6
|
"module": "dist/module/index.js",
|
@@ -10,11 +10,14 @@
|
|
10
10
|
"src/"
|
11
11
|
],
|
12
12
|
"scripts": {
|
13
|
-
"build": "npm i
|
13
|
+
"build": "npm i && bob build",
|
14
14
|
"betapatch": "npm version prepatch --preid=beta",
|
15
15
|
"patch": "npm version patch",
|
16
16
|
"betaupload": "npm run build && npm publish --access public --tag beta",
|
17
17
|
"betaupload:p": "npm run betapatch && npm run betaupload",
|
18
|
+
"authpatch": "npm version prepatch --preid=auth",
|
19
|
+
"authupload": "npm run build && npm publish --access public --tag auth",
|
20
|
+
"authupload:p": "npm run authpatch && npm run authupload",
|
18
21
|
"upload": "npm run build && npm publish --access public",
|
19
22
|
"upload:p": "npm run patch && npm run upload",
|
20
23
|
"copy:add": "run(){ ext=${1:-default}; test -f src/values.config.$ext.js || cp src/values.config.default.js src/values.config.$ext.js; }; run",
|
@@ -22,23 +25,24 @@
|
|
22
25
|
"copy:set": "run(){ target='\\@plusscommunities\\/pluss-maintenance-app'; ext=${1:-default}; [ $ext == 'default' ] && replace=$target || replace=$target'-'$ext; echo 'Setting target to '$replace; test -f src/values.config.$ext.js && cp -f src/values.config.$ext.js src/values.config.js; sed -i '' -e 's/'$target'.*\"/'$replace'\"/g' package.json; }; run",
|
23
26
|
"copy:uploadnopatch": "for file in `ls ./src/values.config.*.js`; do dup=`echo $file | sed 's/.*values\\.config\\.\\(.*\\)\\.js/\\1/'`; npm run copy:set $dup; npm run upload; done; npm run copy:set;",
|
24
27
|
"copy:upload": "npm run patch; npm run copy:uploadnopatch;",
|
25
|
-
"copy:betaupload": "npm run betapatch; for file in `ls ./src/values.config.*.js`; do dup=`echo $file | sed 's/.*values\\.config\\.\\(.*\\)\\.js/\\1/'`; npm run copy:set $dup; npm run betaupload; done; npm run copy:set;"
|
28
|
+
"copy:betaupload": "npm run betapatch; for file in `ls ./src/values.config.*.js`; do dup=`echo $file | sed 's/.*values\\.config\\.\\(.*\\)\\.js/\\1/'`; npm run copy:set $dup; npm run betaupload; done; npm run copy:set;",
|
29
|
+
"copy:authupload": "npm run authpatch; for file in `ls ./src/values.config.*.js`; do dup=`echo $file | sed 's/.*values\\.config\\.\\(.*\\)\\.js/\\1/'`; npm run copy:set $dup; npm run authupload; done; npm run copy:set;"
|
26
30
|
},
|
27
31
|
"author": "Thorbjorn Kappel Davis",
|
28
32
|
"license": "ISC",
|
29
|
-
"dependencies": {
|
30
|
-
|
33
|
+
"dependencies": {},
|
34
|
+
"peerDependencies": {
|
35
|
+
"@plusscommunities/pluss-core-app": "7.0.1-auth.0",
|
31
36
|
"axios": "^1.6.8",
|
32
37
|
"lodash": "^4.17.4",
|
33
38
|
"moment": "^2.30.1",
|
34
|
-
"react": "18.
|
35
|
-
"react-native": "0.
|
36
|
-
"
|
39
|
+
"react": "18.3.1",
|
40
|
+
"react-native": "0.76.9",
|
41
|
+
"@rneui/base": "^4.0.0-rc.8",
|
42
|
+
"@rneui/themed": "^4.0.0-rc.8",
|
37
43
|
"react-native-iphone-x-helper": "^1.3.1",
|
38
|
-
"react-native-webview": "13.
|
39
|
-
"react-redux": "^7.2.6"
|
40
|
-
},
|
41
|
-
"peerDependencies": {
|
44
|
+
"react-native-webview": "13.12.5",
|
45
|
+
"react-redux": "^7.2.6",
|
42
46
|
"redux-persist": "^6.0.0"
|
43
47
|
},
|
44
48
|
"devDependencies": {
|
@@ -1,4 +1,7 @@
|
|
1
|
-
import { JOBS_LOADED, JOB_ADDED, JOBS_ADDED } from './types';
|
1
|
+
import { JOBS_LOADED, JOB_ADDED, JOBS_ADDED, JOBS_STATUSES_LOADED, JOBS_HIDE_SEEN, JOB_FILTER_LOADED } from './types';
|
2
|
+
import { stringActions } from '../apis';
|
3
|
+
import { values } from '../values.config';
|
4
|
+
import { jobStatusOptions } from '../helper';
|
2
5
|
|
3
6
|
export const jobsLoaded = jobs => {
|
4
7
|
return {
|
@@ -20,3 +23,52 @@ export const jobsAdded = jobs => {
|
|
20
23
|
payload: jobs,
|
21
24
|
};
|
22
25
|
};
|
26
|
+
|
27
|
+
export const jobStatusesUpdate = (site, callback = null) => {
|
28
|
+
return dispatch => {
|
29
|
+
stringActions
|
30
|
+
.getString(site, values.stringConfigJobStatus)
|
31
|
+
.then(res => {
|
32
|
+
dispatch({
|
33
|
+
type: JOBS_STATUSES_LOADED,
|
34
|
+
payload: res.data,
|
35
|
+
});
|
36
|
+
if (callback) callback(res.data);
|
37
|
+
})
|
38
|
+
.catch(() => {
|
39
|
+
dispatch({
|
40
|
+
type: JOBS_STATUSES_LOADED,
|
41
|
+
payload: jobStatusOptions,
|
42
|
+
});
|
43
|
+
if (callback) callback(jobStatusOptions);
|
44
|
+
});
|
45
|
+
};
|
46
|
+
};
|
47
|
+
|
48
|
+
export const jobHideSeenUpdate = (site, callback = null) => {
|
49
|
+
return (dispatch) => {
|
50
|
+
stringActions
|
51
|
+
.getString(site, values.stringConfigHideSeen)
|
52
|
+
.then((res) => {
|
53
|
+
dispatch({
|
54
|
+
type: JOBS_HIDE_SEEN,
|
55
|
+
payload: res.data,
|
56
|
+
});
|
57
|
+
if (callback) callback(res.data);
|
58
|
+
})
|
59
|
+
.catch((_error) => {
|
60
|
+
dispatch({
|
61
|
+
type: JOBS_HIDE_SEEN,
|
62
|
+
payload: false,
|
63
|
+
});
|
64
|
+
if (callback) callback(false);
|
65
|
+
});
|
66
|
+
};
|
67
|
+
};
|
68
|
+
|
69
|
+
export const jobsFilterLoaded = filters => {
|
70
|
+
return {
|
71
|
+
type: JOB_FILTER_LOADED,
|
72
|
+
payload: filters,
|
73
|
+
};
|
74
|
+
};
|
package/src/actions/types.js
CHANGED
@@ -3,3 +3,7 @@ import { values } from '../values.config';
|
|
3
3
|
export const JOBS_LOADED = values.actionJobsLoaded;
|
4
4
|
export const JOB_ADDED = values.actionJobAdded;
|
5
5
|
export const JOBS_ADDED = values.actionJobsAdded;
|
6
|
+
export const JOBS_STATUSES_LOADED = values.actionJobsStatusesLoaded;
|
7
|
+
export const JOBS_HIDE_SEEN = values.actionJobsHideSeen;
|
8
|
+
export const JOB_FILTER_LOADED = values.actionJobFilterLoaded;
|
9
|
+
|
package/src/apis/index.js
CHANGED
@@ -1,10 +1,7 @@
|
|
1
|
-
// import axios from 'axios';
|
2
|
-
// import { getUrl } from './helper';
|
3
|
-
// import { authedFunction } from '../js';
|
4
1
|
import { Helper, Session } from '../core.config';
|
5
2
|
import { values } from '../values.config';
|
6
3
|
|
7
|
-
export const
|
4
|
+
export const maintenanceActions = {
|
8
5
|
getJob: (site, id) => {
|
9
6
|
return Session.authedFunction({
|
10
7
|
method: 'POST',
|
@@ -26,11 +23,14 @@ export const generalActions = {
|
|
26
23
|
data: { site, status, type },
|
27
24
|
});
|
28
25
|
},
|
29
|
-
getJobs2: (site, status, type, lastKey) => {
|
26
|
+
getJobs2: (site, status, priority, type, lastKey) => {
|
30
27
|
const query = { site };
|
31
28
|
if (status) {
|
32
29
|
query.status = status;
|
33
30
|
}
|
31
|
+
if (priority) {
|
32
|
+
query.priority = priority;
|
33
|
+
}
|
34
34
|
if (type) {
|
35
35
|
query.type = type;
|
36
36
|
}
|
@@ -42,18 +42,32 @@ export const generalActions = {
|
|
42
42
|
url: Helper.getUrl(values.serviceKey, 'get/requests', query),
|
43
43
|
});
|
44
44
|
},
|
45
|
-
getJobsRecursive: (site, status, type, lastKey, jobs = []) => {
|
45
|
+
getJobsRecursive: (site, status, priority, type, lastKey, jobs = []) => {
|
46
46
|
return new Promise(resolve => {
|
47
|
-
|
47
|
+
maintenanceActions.getJobs2(site, status, priority, type, lastKey).then(jobRes => {
|
48
48
|
const newJobs = [...jobs, ...jobRes.data.Items];
|
49
49
|
if (!jobRes.data.LastKey) {
|
50
50
|
return resolve(newJobs);
|
51
51
|
}
|
52
|
-
return resolve(
|
52
|
+
return resolve(maintenanceActions.getJobsRecursive(site, status, priority, type, jobRes.data.LastKey, newJobs));
|
53
53
|
});
|
54
54
|
});
|
55
55
|
},
|
56
|
-
sendMaintenanceRequest: (
|
56
|
+
sendMaintenanceRequest: (
|
57
|
+
userID,
|
58
|
+
userName,
|
59
|
+
phone,
|
60
|
+
room,
|
61
|
+
title,
|
62
|
+
description,
|
63
|
+
date,
|
64
|
+
type,
|
65
|
+
images,
|
66
|
+
location,
|
67
|
+
isHome,
|
68
|
+
homeText,
|
69
|
+
customFields,
|
70
|
+
) => {
|
57
71
|
const request = {
|
58
72
|
method: 'POST',
|
59
73
|
url: Helper.getUrl(values.serviceKey, 'sendMaintenance'),
|
@@ -70,6 +84,7 @@ export const generalActions = {
|
|
70
84
|
location,
|
71
85
|
isHome,
|
72
86
|
homeText,
|
87
|
+
customFields,
|
73
88
|
},
|
74
89
|
};
|
75
90
|
return Session.authedFunction(request);
|
@@ -88,7 +103,30 @@ export const generalActions = {
|
|
88
103
|
data: { id, status },
|
89
104
|
});
|
90
105
|
},
|
91
|
-
|
106
|
+
editJobPriority: (id, priority) => {
|
107
|
+
return Session.authedFunction({
|
108
|
+
method: 'POST',
|
109
|
+
url: Helper.getUrl(values.serviceKey, 'update/priority'),
|
110
|
+
data: { id, priority },
|
111
|
+
});
|
112
|
+
},
|
113
|
+
assignJob: (jobId, userId) => {
|
114
|
+
return Session.authedFunction({
|
115
|
+
method: 'POST',
|
116
|
+
url: Helper.getUrl(values.serviceKey, 'update/assign'),
|
117
|
+
data: {
|
118
|
+
id: jobId,
|
119
|
+
userId,
|
120
|
+
},
|
121
|
+
});
|
122
|
+
},
|
123
|
+
getAssignees: site => {
|
124
|
+
return Session.authedFunction({
|
125
|
+
method: 'GET',
|
126
|
+
url: Helper.getUrl(values.serviceKey, 'get/assignees', { site }),
|
127
|
+
});
|
128
|
+
},
|
129
|
+
addNote: (jobId, note, attachments, images) => {
|
92
130
|
return Session.authedFunction({
|
93
131
|
method: 'POST',
|
94
132
|
url: Helper.getUrl(values.serviceKey, 'requests/note'),
|
@@ -96,11 +134,12 @@ export const generalActions = {
|
|
96
134
|
id: jobId,
|
97
135
|
note,
|
98
136
|
attachments,
|
137
|
+
images,
|
99
138
|
action: 'AddNote',
|
100
139
|
},
|
101
140
|
});
|
102
141
|
},
|
103
|
-
editNote: (jobId, noteId, note, attachments) => {
|
142
|
+
editNote: (jobId, noteId, note, attachments, images) => {
|
104
143
|
return Session.authedFunction({
|
105
144
|
method: 'POST',
|
106
145
|
url: Helper.getUrl(values.serviceKey, 'requests/note'),
|
@@ -108,6 +147,7 @@ export const generalActions = {
|
|
108
147
|
id: jobId,
|
109
148
|
note,
|
110
149
|
attachments,
|
150
|
+
images,
|
111
151
|
noteId,
|
112
152
|
action: 'EditNote',
|
113
153
|
},
|
@@ -124,10 +164,6 @@ export const generalActions = {
|
|
124
164
|
},
|
125
165
|
});
|
126
166
|
},
|
127
|
-
// getWeeklyMenu: async time => {
|
128
|
-
// //deprecated
|
129
|
-
// return null;
|
130
|
-
// },
|
131
167
|
getJobTypes: async site => {
|
132
168
|
const url = Helper.getUrl(values.serviceKey, 'getjobtypes');
|
133
169
|
return Session.authedFunction({
|
@@ -136,32 +172,4 @@ export const generalActions = {
|
|
136
172
|
data: { site },
|
137
173
|
});
|
138
174
|
},
|
139
|
-
// sendBookingRequest: async bookingInfo => {
|
140
|
-
// return authedFunction({
|
141
|
-
// method: 'POST',
|
142
|
-
// data: {
|
143
|
-
// bookingInfo,
|
144
|
-
// },
|
145
|
-
// url: getUrl('utility', 'sendBookingRequest'),
|
146
|
-
// });
|
147
|
-
// },
|
148
|
-
// getString: async (site, id, useDefault) => {
|
149
|
-
// return axios({
|
150
|
-
// method: 'GET',
|
151
|
-
// url: getUrl('strings', `get/${site}_${id}`, useDefault ? { useDefault } : undefined),
|
152
|
-
// }).catch(error => {
|
153
|
-
// console.log('getString error', error);
|
154
|
-
// throw error;
|
155
|
-
// });
|
156
|
-
// },
|
157
|
-
// getGeneralTerms: async () => {
|
158
|
-
// return axios({
|
159
|
-
// method: 'GET',
|
160
|
-
// url: 'https://pluss.plussapp.com.au/strings-prd/get/plussSpace_termsofuse',
|
161
|
-
// });
|
162
|
-
// },
|
163
|
-
// declineTerms: async (site, userID) => {
|
164
|
-
// //deprecated
|
165
|
-
// return null;
|
166
|
-
// },
|
167
175
|
};
|
@@ -1,9 +1,13 @@
|
|
1
1
|
import React, { Component } from 'react';
|
2
|
-
import { View, Text, TouchableOpacity, Modal } from 'react-native';
|
2
|
+
import { View, Text, TouchableOpacity, Modal, ScrollView, Dimensions } from 'react-native';
|
3
3
|
import { connect } from 'react-redux';
|
4
4
|
import _ from 'lodash';
|
5
|
-
import {
|
5
|
+
import { maintenanceActions } from '../apis';
|
6
6
|
import { Colours, Helper } from '../core.config';
|
7
|
+
import { getJobStatusOptions, getIncompleteJobStatuses, jobPriorityOptions } from '../helper';
|
8
|
+
import { values } from '../values.config';
|
9
|
+
|
10
|
+
const SCREEN_HEIGHT = Dimensions.get('window').height;
|
7
11
|
|
8
12
|
class FilterPopupMenu extends Component {
|
9
13
|
constructor(props) {
|
@@ -12,33 +16,25 @@ class FilterPopupMenu extends Component {
|
|
12
16
|
this.state = {
|
13
17
|
types: props.types || [],
|
14
18
|
selectedStatus: props.status || '',
|
19
|
+
selectedPriority: props.priority || '',
|
15
20
|
selectedType: props.type || '',
|
21
|
+
selectedAssignee: props.assignee || '',
|
22
|
+
assignees: [],
|
16
23
|
};
|
17
|
-
this.
|
24
|
+
this.priorityOptions = [
|
18
25
|
{
|
19
26
|
label: 'All',
|
20
27
|
value: '',
|
21
28
|
},
|
22
|
-
{
|
23
|
-
label:
|
24
|
-
value:
|
25
|
-
}
|
26
|
-
{
|
27
|
-
label: 'Unassigned',
|
28
|
-
value: 'Unassigned',
|
29
|
-
},
|
30
|
-
{
|
31
|
-
label: 'In Progress',
|
32
|
-
value: 'In Progress',
|
33
|
-
},
|
34
|
-
{
|
35
|
-
label: 'Completed',
|
36
|
-
value: 'Completed',
|
37
|
-
},
|
29
|
+
...jobPriorityOptions.map(p => ({
|
30
|
+
label: p.label,
|
31
|
+
value: p.label,
|
32
|
+
}))
|
38
33
|
];
|
39
34
|
}
|
40
35
|
|
41
36
|
componentDidMount() {
|
37
|
+
this.getAssignees();
|
42
38
|
if (_.isEmpty(this.state.types)) this.refreshTypes();
|
43
39
|
}
|
44
40
|
|
@@ -48,8 +44,50 @@ class FilterPopupMenu extends Component {
|
|
48
44
|
}
|
49
45
|
}
|
50
46
|
|
47
|
+
getStatusOptions = () => {
|
48
|
+
const statusOptions = getJobStatusOptions(this.props);
|
49
|
+
const options = [
|
50
|
+
{
|
51
|
+
label: 'All',
|
52
|
+
value: '',
|
53
|
+
},
|
54
|
+
{
|
55
|
+
label: 'Incomplete',
|
56
|
+
value: `Unassigned|${getIncompleteJobStatuses(this.props).map(s => s.text).join('|')}`,
|
57
|
+
},
|
58
|
+
...statusOptions.map(s => ({
|
59
|
+
label: s.text,
|
60
|
+
value: s.text,
|
61
|
+
})),
|
62
|
+
];
|
63
|
+
// console.log('getStatusOptions', options);
|
64
|
+
return options;
|
65
|
+
}
|
66
|
+
|
67
|
+
getAssignees = async () => {
|
68
|
+
try {
|
69
|
+
const res = await maintenanceActions.getAssignees(this.props.site);
|
70
|
+
let assignees = res.data.Users.map(t => {
|
71
|
+
return { label: t.displayName, value: t.id };
|
72
|
+
});
|
73
|
+
assignees = _.orderBy(assignees, 'label');
|
74
|
+
|
75
|
+
assignees.splice(0, 0, { label: 'All', value: '' });
|
76
|
+
|
77
|
+
const newState = { assignees };
|
78
|
+
|
79
|
+
if (!assignees.some(a => a.value === this.state.selectedAssignee)) {
|
80
|
+
newState.selectedAssignee = '';
|
81
|
+
}
|
82
|
+
// console.log('refreshassignees', assignees);
|
83
|
+
this.setState(newState);
|
84
|
+
} catch (error) {
|
85
|
+
console.error('getAssignees', error);
|
86
|
+
}
|
87
|
+
};
|
88
|
+
|
51
89
|
refreshTypes = async () => {
|
52
|
-
const { data } = await
|
90
|
+
const { data } = await maintenanceActions.getJobTypes(Helper.getSite(this.props.site));
|
53
91
|
const types = data.map(t => {
|
54
92
|
return { label: t.typeName, value: t.typeName };
|
55
93
|
});
|
@@ -66,11 +104,15 @@ class FilterPopupMenu extends Component {
|
|
66
104
|
|
67
105
|
onDone = () => {
|
68
106
|
const { onClose } = this.props;
|
69
|
-
const { selectedStatus, selectedType } = this.state;
|
107
|
+
const { selectedStatus, selectedPriority, selectedType, selectedAssignee } = this.state;
|
70
108
|
if (onClose)
|
71
109
|
onClose({
|
72
110
|
status: selectedStatus,
|
111
|
+
statusText: this.getStatusOptions().find(o => o.value === selectedStatus)?.label,
|
112
|
+
priority: selectedPriority,
|
73
113
|
type: selectedType,
|
114
|
+
assignee: selectedAssignee,
|
115
|
+
assigneeName: this.state.assignees.find(a => a.value === selectedAssignee)?.label,
|
74
116
|
});
|
75
117
|
};
|
76
118
|
|
@@ -118,15 +160,21 @@ class FilterPopupMenu extends Component {
|
|
118
160
|
}
|
119
161
|
|
120
162
|
render() {
|
163
|
+
// console.log('FilterPopupMenu', JSON.stringify({ category: this.props.user.category, permissions: this.props.user.permissions }, null, 2))
|
164
|
+
const isStaff = this.props.user.category === 'staff'
|
165
|
+
const canFilterAssignee = !_.includes(this.props.user.permissions, values.permissionMaintenanceAssignment);
|
166
|
+
|
121
167
|
return (
|
122
168
|
<Modal visible transparent animationType="slide" onRequestClose={this.onDone}>
|
123
169
|
<View style={styles.container}>
|
124
170
|
<View style={styles.menu}>
|
125
171
|
{this.renderTitle()}
|
126
|
-
<
|
127
|
-
{this.renderOptions('Status', this.
|
172
|
+
<ScrollView style={styles.optionContent}>
|
173
|
+
{this.renderOptions('Status', this.getStatusOptions(), 'selectedStatus')}
|
174
|
+
{isStaff ? this.renderOptions('Priority', this.priorityOptions, 'selectedPriority') : null}
|
128
175
|
{this.renderOptions('Type', this.state.types, 'selectedType')}
|
129
|
-
|
176
|
+
{canFilterAssignee ? this.renderOptions('Assigned To', this.state.assignees, 'selectedAssignee') : null}
|
177
|
+
</ScrollView>
|
130
178
|
{this.renderCancel()}
|
131
179
|
</View>
|
132
180
|
</View>
|
@@ -153,6 +201,7 @@ const styles = {
|
|
153
201
|
backgroundColor: '#fff',
|
154
202
|
borderTopLeftRadius: 12,
|
155
203
|
borderTopRightRadius: 12,
|
204
|
+
maxHeight: SCREEN_HEIGHT * 0.8,
|
156
205
|
},
|
157
206
|
cancelContainer: {
|
158
207
|
paddingVertical: 16,
|
@@ -216,8 +265,10 @@ const mapStateToProps = state => {
|
|
216
265
|
const { user } = state;
|
217
266
|
|
218
267
|
return {
|
268
|
+
user,
|
219
269
|
site: user.site,
|
220
270
|
colourBrandingMain: Colours.getMainBrandingColourFromState(state),
|
271
|
+
statusTypes: state[values.reducerKey].jobstatuses,
|
221
272
|
};
|
222
273
|
};
|
223
274
|
|