@plusscommunities/pluss-maintenance-web 1.1.16 → 1.1.18-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/index.cjs.js +4847 -14535
- package/dist/index.esm.js +4823 -14523
- package/dist/index.umd.js +4850 -14525
- package/package.json +7 -2
- package/src/actions/types.js +6 -4
- package/src/apis/maintenanceActions.js +34 -35
- package/src/components/ActivityText.js +12 -11
- package/src/components/AnalyticsHub.js +21 -12
- package/src/components/JobList.js +66 -24
- package/src/components/JobTypes.js +10 -162
- package/src/components/PreviewGrid.js +20 -7
- package/src/feature.config.js +41 -33
- package/src/index.js +15 -2
- package/src/screens/AddJob.js +482 -121
- package/src/screens/AddJobType.js +841 -0
- package/src/screens/Job.js +98 -40
- package/src/screens/RequestsHub.js +16 -8
- package/src/values.config.a.js +57 -0
- package/src/values.config.b.js +57 -0
- package/src/values.config.c.js +57 -0
- package/src/values.config.d.js +57 -0
- package/src/values.config.default.js +57 -0
- package/src/values.config.js +57 -0
|
@@ -4,30 +4,22 @@ import { connect } from 'react-redux';
|
|
|
4
4
|
import _ from 'lodash';
|
|
5
5
|
import FontAwesome from 'react-fontawesome';
|
|
6
6
|
import { withRouter } from 'react-router';
|
|
7
|
+
import { Link } from 'react-router-dom';
|
|
7
8
|
import { jobTypesLoaded, jobTypesUpdate } from '../actions';
|
|
8
9
|
import { maintenanceActions } from '../apis';
|
|
9
|
-
|
|
10
10
|
import Config, { PlussCore } from '../feature.config';
|
|
11
|
+
import { values } from '../values.config';
|
|
11
12
|
|
|
12
|
-
const { Session, Components
|
|
13
|
+
const { Session, Components } = PlussCore;
|
|
13
14
|
|
|
14
15
|
class JobTypes extends Component {
|
|
15
16
|
constructor(props) {
|
|
16
17
|
super(props);
|
|
17
18
|
this.state = {
|
|
18
19
|
jobList: [],
|
|
19
|
-
showCompleted: false,
|
|
20
20
|
sortColumn: 'name',
|
|
21
21
|
sortDesc: false,
|
|
22
22
|
loading: true,
|
|
23
|
-
showJobType: false,
|
|
24
|
-
jobTypeId: null,
|
|
25
|
-
jobTypeName: '',
|
|
26
|
-
jobTypeEmail: '',
|
|
27
|
-
jobTypeDescription: '',
|
|
28
|
-
jobTypeLevel: 1,
|
|
29
|
-
showWarnings: false,
|
|
30
|
-
submitting: false,
|
|
31
23
|
};
|
|
32
24
|
}
|
|
33
25
|
|
|
@@ -67,21 +59,6 @@ class JobTypes extends Component {
|
|
|
67
59
|
}
|
|
68
60
|
};
|
|
69
61
|
|
|
70
|
-
validateEmail = () => {
|
|
71
|
-
const { jobTypeEmail } = this.state;
|
|
72
|
-
return !_.isEmpty(jobTypeEmail) && Helper.isEmail(jobTypeEmail);
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
isJobTypeValid = () => {
|
|
76
|
-
const { jobTypeName, jobTypeDescription } = this.state;
|
|
77
|
-
|
|
78
|
-
if (_.isEmpty(jobTypeName)) return false;
|
|
79
|
-
if (!this.validateEmail()) return false;
|
|
80
|
-
if (_.isEmpty(jobTypeDescription)) return false;
|
|
81
|
-
|
|
82
|
-
return true;
|
|
83
|
-
};
|
|
84
|
-
|
|
85
62
|
onRemoveJobType = async (ev) => {
|
|
86
63
|
if (!window.confirm(`Are you sure you want to delete ${ev.typeName}?`)) return;
|
|
87
64
|
|
|
@@ -101,64 +78,6 @@ class JobTypes extends Component {
|
|
|
101
78
|
}
|
|
102
79
|
};
|
|
103
80
|
|
|
104
|
-
onShowJobType = (job = null) => {
|
|
105
|
-
this.setState({
|
|
106
|
-
showJobType: true,
|
|
107
|
-
jobTypeId: job ? job.id : null,
|
|
108
|
-
jobTypeName: job ? job.typeName : '',
|
|
109
|
-
jobTypeEmail: job ? job.email : '',
|
|
110
|
-
jobTypeDescription: job ? job.description : '',
|
|
111
|
-
jobTypeLevel: job ? job.level : 1,
|
|
112
|
-
});
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
onHideJobType = () => {
|
|
116
|
-
if (this.state.submitting) return;
|
|
117
|
-
|
|
118
|
-
this.setState({
|
|
119
|
-
showWarnings: false,
|
|
120
|
-
showJobType: false,
|
|
121
|
-
jobTypeId: null,
|
|
122
|
-
jobTypeName: '',
|
|
123
|
-
jobTypeEmail: '',
|
|
124
|
-
jobTypeDescription: '',
|
|
125
|
-
jobTypeLevel: 1,
|
|
126
|
-
});
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
onHandleChange = (event) => {
|
|
130
|
-
var stateChange = {};
|
|
131
|
-
stateChange[event.target.getAttribute('id')] = event.target.value;
|
|
132
|
-
this.setState(stateChange);
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
onSave = () => {
|
|
136
|
-
const { site } = this.props.auth;
|
|
137
|
-
const { submitting, jobTypeId, jobTypeName, jobTypeEmail, jobTypeDescription, jobTypeLevel } = this.state;
|
|
138
|
-
|
|
139
|
-
if (submitting) return;
|
|
140
|
-
if (!this.isJobTypeValid()) {
|
|
141
|
-
this.setState({ showWarnings: true });
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
this.setState({ submitting: true }, async () => {
|
|
146
|
-
try {
|
|
147
|
-
if (jobTypeId) {
|
|
148
|
-
await maintenanceActions.editJobType(site, jobTypeId, jobTypeName, jobTypeEmail, jobTypeDescription, jobTypeLevel);
|
|
149
|
-
} else {
|
|
150
|
-
await maintenanceActions.addJobType(site, jobTypeName, jobTypeEmail, jobTypeDescription, jobTypeLevel);
|
|
151
|
-
}
|
|
152
|
-
this.props.jobTypesUpdate(site);
|
|
153
|
-
this.setState({ submitting: false }, this.onHideJobType);
|
|
154
|
-
} catch (error) {
|
|
155
|
-
console.error('onSave', error);
|
|
156
|
-
this.setState({ submitting: false });
|
|
157
|
-
alert('Something went wrong with the request. Please try again.');
|
|
158
|
-
}
|
|
159
|
-
});
|
|
160
|
-
};
|
|
161
|
-
|
|
162
81
|
renderList() {
|
|
163
82
|
let source = _.sortBy(this.state.jobList, this.state.sortColumn);
|
|
164
83
|
if (this.state.sortDesc) source.reverse();
|
|
@@ -173,18 +92,18 @@ class JobTypes extends Component {
|
|
|
173
92
|
return (
|
|
174
93
|
<tr key={index}>
|
|
175
94
|
<td className="table-TitleColumn">
|
|
176
|
-
<
|
|
95
|
+
<Link to={`${values.routeAddRequestType}/${ev.id}`}>{ev.typeName}</Link>
|
|
177
96
|
</td>
|
|
178
97
|
<td>{ev.description}</td>
|
|
179
98
|
<td>{ev.email}</td>
|
|
180
99
|
<td className="table-options">
|
|
181
100
|
<div style={{ display: 'flex', alignItems: 'center' }}>
|
|
182
|
-
{Session.validateAccess(this.props.auth.site,
|
|
183
|
-
<
|
|
101
|
+
{Session.validateAccess(this.props.auth.site, values.permissionMaintenanceTypes, this.props.auth) && (
|
|
102
|
+
<Link to={`${values.routeAddRequestType}/${ev.id}`}>
|
|
184
103
|
<FontAwesome style={{ fontSize: 20, padding: 5, marginLeft: 12, cursor: 'pointer' }} name="pencil" />
|
|
185
|
-
</
|
|
104
|
+
</Link>
|
|
186
105
|
)}
|
|
187
|
-
{Session.validateAccess(this.props.auth.site,
|
|
106
|
+
{Session.validateAccess(this.props.auth.site, values.permissionMaintenanceTypes, this.props.auth) && (
|
|
188
107
|
<a onClick={() => this.onRemoveJobType(ev)}>
|
|
189
108
|
<FontAwesome style={{ fontSize: 20, padding: 5, marginLeft: 8, cursor: 'pointer' }} name="minus-circle" />
|
|
190
109
|
</a>
|
|
@@ -256,87 +175,17 @@ class JobTypes extends Component {
|
|
|
256
175
|
return (
|
|
257
176
|
<div style={{ minWidth: '100%' }}>
|
|
258
177
|
<div className="marginBottom-32">
|
|
259
|
-
<Components.AddButton onClick={
|
|
178
|
+
<Components.AddButton onClick={this.props.onNew} text="NEW REQUEST TYPE" />
|
|
260
179
|
</div>
|
|
261
180
|
{this.renderContent()}
|
|
262
181
|
</div>
|
|
263
182
|
);
|
|
264
183
|
}
|
|
265
184
|
|
|
266
|
-
renderNewUserTypePopup() {
|
|
267
|
-
const { submitting, showJobType, jobTypeId, showWarnings, jobTypeName, jobTypeEmail, jobTypeDescription } = this.state;
|
|
268
|
-
if (!showJobType) return null;
|
|
269
|
-
|
|
270
|
-
return (
|
|
271
|
-
<Components.Popup
|
|
272
|
-
maxWidth={800}
|
|
273
|
-
hasPadding
|
|
274
|
-
buttons={[
|
|
275
|
-
{
|
|
276
|
-
type: 'primaryAction',
|
|
277
|
-
onClick: this.onSave,
|
|
278
|
-
isActive: !submitting && this.isJobTypeValid(),
|
|
279
|
-
text: submitting ? 'Saving...' : 'Save',
|
|
280
|
-
className: 'popupButton',
|
|
281
|
-
},
|
|
282
|
-
{
|
|
283
|
-
type: 'outlinedAction',
|
|
284
|
-
onClick: this.onHideJobType,
|
|
285
|
-
isActive: !submitting,
|
|
286
|
-
text: 'Cancel',
|
|
287
|
-
className: 'popupButton',
|
|
288
|
-
},
|
|
289
|
-
]}
|
|
290
|
-
onClose={this.onHideJobType}
|
|
291
|
-
title={jobTypeId ? 'Edit Request Type' : 'Create New Request Type'}
|
|
292
|
-
>
|
|
293
|
-
<Components.GenericInput
|
|
294
|
-
id="jobTypeName"
|
|
295
|
-
type="text"
|
|
296
|
-
label="Request type title"
|
|
297
|
-
placeholder="Request type title"
|
|
298
|
-
value={jobTypeName}
|
|
299
|
-
onChange={this.onHandleChange}
|
|
300
|
-
isRequired
|
|
301
|
-
isValid={() => !_.isEmpty(jobTypeName)}
|
|
302
|
-
showError={() => showWarnings && _.isEmpty(jobTypeName)}
|
|
303
|
-
alwaysShowLabel
|
|
304
|
-
/>
|
|
305
|
-
<Components.GenericInput
|
|
306
|
-
id="jobTypeEmail"
|
|
307
|
-
type="text"
|
|
308
|
-
label="Email"
|
|
309
|
-
placeholder="Request email"
|
|
310
|
-
help="This is the email address that'll receive service requests of this type"
|
|
311
|
-
value={jobTypeEmail}
|
|
312
|
-
onChange={this.onHandleChange}
|
|
313
|
-
isRequired
|
|
314
|
-
isValid={this.validateEmail}
|
|
315
|
-
showError={() => showWarnings && !this.validateEmail()}
|
|
316
|
-
alwaysShowLabel
|
|
317
|
-
/>
|
|
318
|
-
<Components.GenericInput
|
|
319
|
-
id="jobTypeDescription"
|
|
320
|
-
type="text"
|
|
321
|
-
label="Description"
|
|
322
|
-
placeholder="Add a description. "
|
|
323
|
-
help="This description will be visible to the people to help them select the correct request type."
|
|
324
|
-
value={jobTypeDescription}
|
|
325
|
-
onChange={this.onHandleChange}
|
|
326
|
-
isRequired
|
|
327
|
-
isValid={() => !_.isEmpty(jobTypeDescription)}
|
|
328
|
-
showError={() => showWarnings && _.isEmpty(jobTypeDescription)}
|
|
329
|
-
alwaysShowLabel
|
|
330
|
-
/>
|
|
331
|
-
</Components.Popup>
|
|
332
|
-
);
|
|
333
|
-
}
|
|
334
|
-
|
|
335
185
|
render() {
|
|
336
186
|
return (
|
|
337
187
|
<div style={{ minWidth: '100%' }}>
|
|
338
188
|
<div>{this.renderJobTypes()}</div>
|
|
339
|
-
{this.renderNewUserTypePopup()}
|
|
340
189
|
<div className="hub_tidioPadding"></div>
|
|
341
190
|
</div>
|
|
342
191
|
);
|
|
@@ -344,9 +193,8 @@ class JobTypes extends Component {
|
|
|
344
193
|
}
|
|
345
194
|
|
|
346
195
|
const mapStateToProps = (state) => {
|
|
347
|
-
const { jobtypes } = state.maintenance;
|
|
348
196
|
const { auth } = state;
|
|
349
|
-
return { jobtypes, auth };
|
|
197
|
+
return { jobtypes: state[values.reducerKey].jobtypes, auth };
|
|
350
198
|
};
|
|
351
199
|
|
|
352
200
|
export default connect(mapStateToProps, { jobTypesLoaded, jobTypesUpdate })(withRouter(JobTypes));
|
|
@@ -1,15 +1,28 @@
|
|
|
1
1
|
import React, { Component } from 'react';
|
|
2
|
+
import { values } from '../values.config';
|
|
3
|
+
|
|
4
|
+
const SVG_PATH = values.svgPathGridIcon;
|
|
5
|
+
const SVG_VIEWBOX = values.svgPathGridIconViewBox || '0 0 30 30';
|
|
2
6
|
|
|
3
7
|
class PreviewGrid extends Component {
|
|
4
8
|
render() {
|
|
5
9
|
const { colour } = this.props;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
|
|
11
|
+
if (Array.isArray(SVG_PATH)) {
|
|
12
|
+
return (
|
|
13
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox={SVG_VIEWBOX}>
|
|
14
|
+
{SVG_PATH.map((p) => {
|
|
15
|
+
return <path key={p.substring(0, 20)} d={p} fill={colour} />;
|
|
16
|
+
})}
|
|
17
|
+
</svg>
|
|
18
|
+
);
|
|
19
|
+
} else {
|
|
20
|
+
return (
|
|
21
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox={SVG_VIEWBOX}>
|
|
22
|
+
<path key={SVG_PATH.substring(0, 20)} d={SVG_PATH} fill={colour} />
|
|
23
|
+
</svg>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
13
26
|
}
|
|
14
27
|
}
|
|
15
28
|
|
package/src/feature.config.js
CHANGED
|
@@ -1,80 +1,88 @@
|
|
|
1
|
-
import * as PlussCore from '../../pluss-core/src';
|
|
2
|
-
|
|
1
|
+
// import * as PlussCore from '../../pluss-core/src';
|
|
2
|
+
import * as PlussCore from '@plusscommunities/pluss-core-web';
|
|
3
|
+
import { values } from './values.config';
|
|
3
4
|
|
|
4
5
|
export { PlussCore };
|
|
5
6
|
|
|
6
7
|
const FeatureConfig = {
|
|
7
|
-
key:
|
|
8
|
-
aliases:
|
|
9
|
-
singularName:
|
|
8
|
+
key: values.featureKey,
|
|
9
|
+
aliases: values.aliases,
|
|
10
|
+
singularName: values.textSingularName,
|
|
10
11
|
description: 'Submit maintenance requests and track the progress.',
|
|
11
|
-
emptyText:
|
|
12
|
+
emptyText: values.textYourRequestHere,
|
|
12
13
|
widgetOptions: [],
|
|
13
14
|
menu: {
|
|
14
|
-
order:
|
|
15
|
-
text:
|
|
15
|
+
order: values.menuOrder,
|
|
16
|
+
text: values.textMenuTitle,
|
|
16
17
|
icon: 'maintenance',
|
|
17
18
|
isFontAwesome: false,
|
|
18
|
-
url:
|
|
19
|
+
url: values.routeRequestsHub,
|
|
19
20
|
countProps: null,
|
|
20
21
|
visibleExps: {
|
|
21
22
|
type: 'and',
|
|
22
23
|
exps: [
|
|
23
|
-
{ type: 'feature', value:
|
|
24
|
+
{ type: 'feature', value: values.featureKey },
|
|
24
25
|
{
|
|
25
26
|
type: 'or',
|
|
26
27
|
exps: [
|
|
27
|
-
{ type: 'permission', value:
|
|
28
|
-
{ type: 'permission', value:
|
|
29
|
-
{ type: 'permission', value:
|
|
28
|
+
{ type: 'permission', value: values.permissionMaintenanceTracking },
|
|
29
|
+
{ type: 'permission', value: values.permissionMaintenanceTypes },
|
|
30
|
+
{ type: 'permission', value: values.permissionMaintenanceAssignment },
|
|
30
31
|
],
|
|
31
32
|
},
|
|
32
33
|
],
|
|
33
34
|
},
|
|
34
35
|
},
|
|
35
|
-
addUrl:
|
|
36
|
-
addPermission:
|
|
37
|
-
activities: [
|
|
36
|
+
addUrl: values.routeAddRequest,
|
|
37
|
+
addPermission: values.permissionMaintenanceTracking,
|
|
38
|
+
activities: [
|
|
39
|
+
values.activityMaintenanceJobStatusChanged,
|
|
40
|
+
values.activityAddMaintenanceJob,
|
|
41
|
+
values.activityEditMaintenanceJob,
|
|
42
|
+
values.activityDeleteMaintenanceJob,
|
|
43
|
+
],
|
|
38
44
|
permissions: [
|
|
39
45
|
{
|
|
40
|
-
displayName:
|
|
41
|
-
key:
|
|
46
|
+
displayName: values.textPermissionMaintenanceTracking,
|
|
47
|
+
key: values.permissionMaintenanceTracking,
|
|
42
48
|
hq: false,
|
|
43
49
|
},
|
|
44
50
|
{
|
|
45
|
-
displayName:
|
|
46
|
-
key:
|
|
51
|
+
displayName: values.textPermissionManageMaintenanceTypes,
|
|
52
|
+
key: values.permissionMaintenanceTypes,
|
|
47
53
|
hq: false,
|
|
48
54
|
},
|
|
49
55
|
{
|
|
50
|
-
displayName:
|
|
51
|
-
key:
|
|
56
|
+
displayName: values.textPermissionManageAssignedMaintenance,
|
|
57
|
+
key: values.permissionMaintenanceAssignment,
|
|
52
58
|
hq: false,
|
|
53
59
|
},
|
|
54
60
|
],
|
|
55
61
|
hiddenSections: [
|
|
56
62
|
{
|
|
57
|
-
displayName:
|
|
58
|
-
key:
|
|
63
|
+
displayName: values.textHiddenSectionMaintenanceRequests,
|
|
64
|
+
key: values.keyHiddenSectionMaintenanceRequests,
|
|
59
65
|
defaultNew: false,
|
|
60
66
|
default: false,
|
|
61
67
|
},
|
|
62
68
|
],
|
|
63
69
|
moreSections: [
|
|
64
70
|
{
|
|
65
|
-
displayName:
|
|
66
|
-
featureKey:
|
|
67
|
-
optionKey:
|
|
68
|
-
hiddenKey:
|
|
71
|
+
displayName: values.textMoreSectionMaintenance,
|
|
72
|
+
featureKey: values.featureKeyMoreSectionMaintenance,
|
|
73
|
+
optionKey: values.optionKeyMoreSectionMaintenance,
|
|
74
|
+
hiddenKey: values.hiddenKeyMoreSectionMaintenance,
|
|
69
75
|
inverseOption: true,
|
|
70
76
|
},
|
|
71
77
|
],
|
|
72
78
|
routes: [
|
|
73
|
-
{ path:
|
|
74
|
-
{ path:
|
|
75
|
-
{ path:
|
|
76
|
-
{ path:
|
|
77
|
-
{ path:
|
|
79
|
+
{ path: values.routeRequestsHub, component: values.screenRequestsHub, exact: false },
|
|
80
|
+
{ path: values.routeAddRequest, component: values.screenAddJob, exact: true },
|
|
81
|
+
{ path: `${values.routeAddRequest}/:jobId`, component: values.screenAddJob, exact: true },
|
|
82
|
+
{ path: `${values.routeRequestDetails}/:jobId`, component: values.screenJob, exact: true },
|
|
83
|
+
{ path: values.routeRequestTypes, component: values.screenJobTypes, exact: false },
|
|
84
|
+
{ path: values.routeAddRequestType, component: values.screenAddJobType, exact: true },
|
|
85
|
+
{ path: `${values.routeAddRequestType}/:jobTypeId`, component: values.screenAddJobType, exact: true },
|
|
78
86
|
],
|
|
79
87
|
env: {
|
|
80
88
|
baseStage: '',
|
package/src/index.js
CHANGED
|
@@ -1,11 +1,24 @@
|
|
|
1
1
|
import RequestsHub from './screens/RequestsHub';
|
|
2
2
|
import Job from './screens/Job';
|
|
3
3
|
import AddJob from './screens/AddJob';
|
|
4
|
+
import AddJobType from './screens/AddJobType.js';
|
|
4
5
|
import { AnalyticsHub } from './components/AnalyticsHub.js';
|
|
5
6
|
import MaintenanceReducer from './reducers/MaintenanceReducer';
|
|
7
|
+
import { values } from './values.config';
|
|
6
8
|
|
|
7
|
-
export const Reducers =
|
|
8
|
-
|
|
9
|
+
export const Reducers = (() => {
|
|
10
|
+
const reducers = {};
|
|
11
|
+
reducers[values.reducerKey] = MaintenanceReducer;
|
|
12
|
+
return reducers;
|
|
13
|
+
})();
|
|
14
|
+
export const Screens = (() => {
|
|
15
|
+
const screens = {};
|
|
16
|
+
screens[values.screenRequestsHub] = RequestsHub;
|
|
17
|
+
screens[values.screenJob] = Job;
|
|
18
|
+
screens[values.screenAddJob] = AddJob;
|
|
19
|
+
screens[values.screenAddJobType] = AddJobType;
|
|
20
|
+
return screens;
|
|
21
|
+
})();
|
|
9
22
|
export { default as Config } from './feature.config';
|
|
10
23
|
export { default as ActivityText } from './components/ActivityText';
|
|
11
24
|
export { default as ViewWidget } from './components/ViewWidget';
|