@plusscommunities/pluss-maintenance-app-feedback 6.0.20 → 6.0.21

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.
@@ -103,8 +103,13 @@ class MaintenanceRequest extends Component {
103
103
  loadSiteUsers = async () => {
104
104
  try {
105
105
  const response = await userActions.getSiteUsers(this.props.site);
106
- // PC-1255: Load all users (not just residents) to match web admin behavior
107
- const users = _.sortBy(response.data.Items || [], u => (u.displayName || '').toLowerCase());
106
+
107
+ let items = response.data.Items || [];
108
+ if (this.props.optionOnlyForResidents) {
109
+ items = _.filter(items, u => u.category === 'resident');
110
+ }
111
+
112
+ const users = _.sortBy(items, u => (u.displayName || '').toLowerCase());
108
113
  this.setState({ users });
109
114
  } catch (error) {
110
115
  console.log('Error loading site users:', error);
@@ -173,25 +178,23 @@ class MaintenanceRequest extends Component {
173
178
  if (userDetails.unit) {
174
179
  update.roomNumber = userDetails.unit;
175
180
  }
176
- if (!this.state.customFields || !_.some(this.state.customFields, 'isTitle')) {
177
- update.title = userDetails.displayName || null;
178
- }
181
+ if (!this.state.customFields || !_.some(this.state.customFields, 'isTitle')) {
182
+ update.title = userDetails.displayName || null;
183
+ }
179
184
  }
180
185
  } catch (error) {
181
186
  // Permission denied (403) or other error - continue without auto-population
182
187
  // User can still manually enter contact details
183
188
  console.log('Could not fetch user details for auto-population:', error);
184
189
  } finally {
185
- // In any case, we still need a title. Inform the user to set one form field as a title.
186
- if (!state.title && !update.title) {
187
- update.title = "[Missing title - Set one of the form field as title in the community manager]"
188
- }
189
-
190
+ // In any case, we still need a title. Inform the user to set one form field as a title.
191
+ if (!state.title && !update.title) {
192
+ update.title = '[Missing title - Set one of the form field as title in the community manager]';
193
+ }
190
194
  }
191
195
  this.setState(update);
192
196
  };
193
197
 
194
-
195
198
  onChangeAnswer = (fieldId, answer) => {
196
199
  const update = { customFields: _.cloneDeep(this.state.customFields) };
197
200
  const field = update.customFields[fieldId];
@@ -1558,6 +1561,7 @@ const mapStateToProps = state => {
1558
1561
  permissions,
1559
1562
  colourBrandingMain: Colours.getMainBrandingColourFromState(state),
1560
1563
  strings: state.strings?.config || {},
1564
+ optionOnlyForResidents: Helper.getSiteSettingFromState(state, values.optionOnlyForResidents),
1561
1565
  };
1562
1566
  };
1563
1567
 
@@ -32,6 +32,7 @@ const values = {
32
32
  textEntityName: 'Job',
33
33
  stringConfigJobStatus: 'maintenanceJobStatusA',
34
34
  stringConfigHideSeen: 'maintenanceDisableSeenA',
35
+ optionOnlyForResidents: 'onlyForResidentsMaintenanceA',
35
36
  };
36
37
 
37
38
  export { values };
@@ -38,6 +38,7 @@ const values = {
38
38
  forceCustomFields: false,
39
39
  stringConfigJobStatus: 'maintenanceJobStatus',
40
40
  stringConfigHideSeen: 'maintenanceDisableSeen',
41
+ optionOnlyForResidents: 'onlyForResidentsMaintenance',
41
42
  };
42
43
 
43
44
  export { values };
@@ -38,6 +38,7 @@ const values = {
38
38
  forceCustomFields: true,
39
39
  stringConfigJobStatus: 'maintenanceJobStatusEnquiry',
40
40
  stringConfigHideSeen: 'maintenanceDisableSeenEnquiry',
41
+ optionOnlyForResidents: 'onlyForResidentsMaintenanceEnquiry',
41
42
  };
42
43
 
43
44
  export { values };
@@ -38,6 +38,7 @@ const values = {
38
38
  forceCustomFields: true,
39
39
  stringConfigJobStatus: 'maintenanceJobStatusFeedback',
40
40
  stringConfigHideSeen: 'maintenanceDisableSeenFeedback',
41
+ optionOnlyForResidents: 'onlyForResidentsMaintenanceFeedback',
41
42
  };
42
43
 
43
44
  export { values };
@@ -38,6 +38,7 @@ const values = {
38
38
  forceCustomFields: true,
39
39
  stringConfigJobStatus: 'maintenanceJobStatusFood',
40
40
  stringConfigHideSeen: 'maintenanceDisableSeenFood',
41
+ optionOnlyForResidents: 'onlyForResidentsMaintenanceFood',
41
42
  };
42
43
 
43
44
  export { values };
@@ -38,6 +38,7 @@ const values = {
38
38
  forceCustomFields: true,
39
39
  stringConfigJobStatus: 'maintenanceJobStatusFeedback',
40
40
  stringConfigHideSeen: 'maintenanceDisableSeenFeedback',
41
+ optionOnlyForResidents: 'onlyForResidentsMaintenanceFeedback',
41
42
  };
42
43
 
43
44
  export { values };