@openmrs/esm-stock-management-app 3.0.1-pre.833 → 3.0.1-pre.840

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 (39) hide show
  1. package/dist/119.js +1 -0
  2. package/dist/119.js.map +1 -0
  3. package/dist/467.js +1 -0
  4. package/dist/467.js.map +1 -0
  5. package/dist/574.js +1 -1
  6. package/dist/642.js.map +1 -1
  7. package/dist/{780.js → 769.js} +1 -1
  8. package/dist/769.js.map +1 -0
  9. package/dist/793.js +1 -1
  10. package/dist/93.js +1 -0
  11. package/dist/93.js.map +1 -0
  12. package/dist/main.js +1 -1
  13. package/dist/main.js.map +1 -1
  14. package/dist/openmrs-esm-stock-management-app.js +1 -1
  15. package/dist/openmrs-esm-stock-management-app.js.buildmanifest.json +87 -15
  16. package/dist/routes.json +1 -1
  17. package/package.json +1 -1
  18. package/src/index.ts +21 -0
  19. package/src/routes.json +33 -19
  20. package/src/stock-items/add-stock-item/transactions/transactions.resource.tsx +5 -1
  21. package/src/stock-locations/stock-locations-table.component.tsx +1 -1
  22. package/src/stock-lookups/stock-lookups.resource.ts +1 -1
  23. package/src/stock-reports/generate-report/create-stock-report.scss +15 -16
  24. package/src/stock-reports/generate-report/{create-stock-report.component.tsx → create-stock-report.workspace.tsx} +29 -18
  25. package/src/stock-reports/report-list/new-report-button.component.tsx +5 -4
  26. package/src/stock-sources/add-stock-source-button.component.tsx +6 -5
  27. package/src/stock-sources/add-stock-sources/add-stock-sources.scss +24 -0
  28. package/src/stock-sources/add-stock-sources/add-stock-sources.test.tsx +68 -39
  29. package/src/stock-sources/add-stock-sources/{add-stock-sources.component.tsx → add-stock-sources.workspace.tsx} +65 -58
  30. package/src/stock-sources/edit-stock-source/edit-stock-source.component.tsx +7 -5
  31. package/src/stock-user-role-scopes/add-stock-user-role-scope-button.component.tsx +7 -6
  32. package/src/stock-user-role-scopes/add-stock-user-scope/add-stock-user-role-scope.scss +48 -0
  33. package/src/stock-user-role-scopes/add-stock-user-scope/{add-stock-user-role-scope.component.tsx → add-stock-user-role-scope.workspace.tsx} +188 -208
  34. package/src/stock-user-role-scopes/edit-stock-user-scope/edit-stock-user-scope-action-menu.component.tsx +7 -5
  35. package/src/stock-user-role-scopes/stock-user-role-scopes-items-table.component.tsx +20 -19
  36. package/src/stock-user-role-scopes/stock-user-role-scopes.scss +4 -0
  37. package/translations/en.json +2 -2
  38. package/dist/780.js.map +0 -1
  39. /package/src/stock-locations/{add-locations-form.component.tsx → add-locations-form.workspace.tsx} +0 -0
@@ -1,21 +1,31 @@
1
+ import React, { type ChangeEvent, useEffect, useState } from 'react';
2
+ import classNames from 'classnames';
1
3
  import {
2
4
  Button,
5
+ ButtonSet,
3
6
  Checkbox,
4
7
  CheckboxGroup,
8
+ ComboBox,
9
+ DatePicker,
10
+ DatePickerInput,
5
11
  Form,
6
- ModalBody,
7
- ModalFooter,
8
- ModalHeader,
12
+ FormGroup,
9
13
  InlineLoading,
10
- Toggle,
11
- DatePickerInput,
12
- DatePicker,
13
- ComboBox,
14
14
  Select,
15
15
  SelectItem,
16
+ Stack,
17
+ Toggle,
16
18
  } from '@carbon/react';
17
- import React, { type ChangeEvent, useEffect, useState } from 'react';
18
- import styles from './add-stock-user-role-scope.scss';
19
+ import { Save } from '@carbon/react/icons';
20
+ import { useTranslation } from 'react-i18next';
21
+ import {
22
+ type DefaultWorkspaceProps,
23
+ getCoreTranslation,
24
+ restBaseUrl,
25
+ showSnackbar,
26
+ useLayoutType,
27
+ useSession,
28
+ } from '@openmrs/esm-framework';
19
29
  import {
20
30
  useRoles,
21
31
  useStockOperationTypes,
@@ -24,44 +34,45 @@ import {
24
34
  useUsers,
25
35
  } from '../../stock-lookups/stock-lookups.resource';
26
36
  import { ResourceRepresentation } from '../../core/api/api';
27
- import { closeOverlay } from '../../core/components/overlay/hook';
28
- import { useTranslation } from 'react-i18next';
29
37
  import { type UserRoleScope } from '../../core/api/types/identity/UserRoleScope';
30
38
  import { createOrUpdateUserRoleScope } from '../stock-user-role-scopes.resource';
31
- import { restBaseUrl, showSnackbar, useSession } from '@openmrs/esm-framework';
32
39
  import { type UserRoleScopeOperationType } from '../../core/api/types/identity/UserRoleScopeOperationType';
33
40
  import { type UserRoleScopeLocation } from '../../core/api/types/identity/UserRoleScopeLocation';
34
41
  import {
35
42
  DATE_PICKER_CONTROL_FORMAT,
36
43
  DATE_PICKER_FORMAT,
44
+ formatForDatePicker,
37
45
  INVENTORY_ADMNISTRATOR_ROLE_UUID,
38
46
  INVENTORY_CLERK_ROLE_UUID,
39
47
  INVENTORY_DISPENSING_ROLE_UUID,
40
48
  INVENTORY_MANAGER_ROLE_UUID,
41
49
  INVENTORY_REPORTING_ROLE_UUID,
42
- formatForDatePicker,
43
50
  today,
44
51
  } from '../../constants';
45
- import { type User } from '../../core/api/types/identity/User';
46
52
  import { type Role } from '../../core/api/types/identity/Role';
47
53
  import { type StockOperationType } from '../../core/api/types/stockOperation/StockOperationType';
54
+ import { type User } from '../../core/api/types/identity/User';
48
55
  import { handleMutate } from '../../utils';
56
+ import styles from './add-stock-user-role-scope.scss';
49
57
 
50
58
  const MinDate: Date = today();
51
59
 
52
- interface AddStockUserRoleScopeProps {
60
+ type AddStockUserRoleScopeProps = DefaultWorkspaceProps & {
53
61
  model?: UserRoleScope;
54
62
  editMode?: boolean;
55
- }
63
+ };
56
64
 
57
- const AddStockUserRoleScope: React.FC<AddStockUserRoleScopeProps> = ({ model, editMode }) => {
65
+ const AddStockUserRoleScope: React.FC<AddStockUserRoleScopeProps> = ({ model, editMode, closeWorkspace }) => {
58
66
  const { t } = useTranslation();
59
67
  const currentUser = useSession();
60
68
  const [formModel, setFormModel] = useState<UserRoleScope>({ ...model });
69
+ const isTablet = useLayoutType() === 'tablet';
61
70
 
62
71
  const [roles, setRoles] = useState<Role[]>([]);
63
72
 
64
73
  const loggedInUserUuid = currentUser?.user?.uuid;
74
+ const [selectedUserUuid, setSelectedUserUuid] = useState<string | null>(null);
75
+ const { data: user } = useUser(selectedUserUuid);
65
76
 
66
77
  // operation types
67
78
  const {
@@ -74,9 +85,6 @@ const AddStockUserRoleScope: React.FC<AddStockUserRoleScopeProps> = ({ model, ed
74
85
  v: ResourceRepresentation.Default,
75
86
  });
76
87
 
77
- const [selectedUserUuid, setSelectedUserUuid] = useState<string | null>(null);
78
- const { data: user } = useUser(selectedUserUuid);
79
-
80
88
  // get roles
81
89
  const { isLoading: loadingRoles } = useRoles({
82
90
  v: ResourceRepresentation.Default,
@@ -220,7 +228,7 @@ const AddStockUserRoleScope: React.FC<AddStockUserRoleScopeProps> = ({ model, ed
220
228
  kind: 'success',
221
229
  subtitle: t('successfullysaved', 'You have successfully saved user role scope'),
222
230
  });
223
- closeOverlay();
231
+ closeWorkspace();
224
232
  },
225
233
  (err) => {
226
234
  showSnackbar({
@@ -230,7 +238,7 @@ const AddStockUserRoleScope: React.FC<AddStockUserRoleScopeProps> = ({ model, ed
230
238
  subtitle: err?.message,
231
239
  });
232
240
 
233
- closeOverlay();
241
+ closeWorkspace();
234
242
  },
235
243
  );
236
244
  };
@@ -240,196 +248,168 @@ const AddStockUserRoleScope: React.FC<AddStockUserRoleScopeProps> = ({ model, ed
240
248
  );
241
249
  }
242
250
  return (
243
- <div>
244
- <Form>
245
- <ModalHeader />
246
- <ModalBody>
247
- <section className={styles.section}>
248
- <div>
249
- {users?.results?.length > 0 && (
250
- <>
251
- <span className={styles.subTitle}>{t('user', 'User')}</span>
252
- <ComboBox
253
- id="userName"
254
- size="md"
255
- labelText={t('user', 'User')}
256
- items={filteredItems.length ? filteredItems : usersResults}
257
- onChange={onUserChanged}
258
- shouldFilterItem={() => true}
259
- itemToString={(item) => `${item?.person?.display ?? item?.display ?? ''}`}
260
- onInputChange={handleSearchQueryChange}
261
- placeholder="Filter..."
262
- initialSelectedItem={usersResults.find((user) => user.uuid === model?.userUuid) ?? null}
263
- />
264
- </>
265
- )}
266
- </div>
267
- </section>
268
- <section className={styles.section}>
269
- <div>
270
- <Select
271
- name="role"
272
- className="select-field"
273
- labelText={t('role', 'Role')}
274
- id="select-role"
275
- value={formModel.role ?? 'placeholder-item'}
276
- onChange={onRoleChange}
251
+ <Form className={styles.container}>
252
+ <Stack className={styles.form} gap={5}>
253
+ <div>
254
+ {users?.results?.length > 0 && (
255
+ <>
256
+ <FormGroup legendText={t('user', 'User')}>
257
+ <ComboBox
258
+ id="userName"
259
+ initialSelectedItem={usersResults.find((user) => user.uuid === model?.userUuid) ?? null}
260
+ items={filteredItems.length ? filteredItems : usersResults}
261
+ itemToString={(item) => `${item?.person?.display ?? item?.display ?? ''}`}
262
+ labelText={t('user', 'User')}
263
+ onChange={onUserChanged}
264
+ onInputChange={handleSearchQueryChange}
265
+ placeholder="Filter..."
266
+ shouldFilterItem={() => true}
267
+ size="md"
268
+ />
269
+ </FormGroup>
270
+ </>
271
+ )}
272
+ </div>
273
+ <Select
274
+ id="select-role"
275
+ labelText={t('role', 'Role')}
276
+ name="role"
277
+ onChange={onRoleChange}
278
+ value={formModel.role}
279
+ >
280
+ <SelectItem value={''} text={t('chooseARole', 'Choose a role')} />
281
+ {editMode ? (
282
+ <SelectItem key={formModel?.role} value={formModel?.role} text={formModel?.role} />
283
+ ) : (
284
+ (user?.roles ?? roles)?.map((role) => {
285
+ return <SelectItem key={role.display} value={role.display} text={role.display} />;
286
+ })
287
+ )}
288
+ </Select>
289
+ <CheckboxGroup className={styles.checkboxGrid}>
290
+ <Checkbox
291
+ checked={formModel?.enabled}
292
+ id="chk-userEnabled"
293
+ labelText={t('enabled', 'Enabled')}
294
+ onChange={onEnabledChanged}
295
+ value={model?.enabled}
296
+ />
297
+ <Checkbox
298
+ checked={formModel?.permanent}
299
+ id="chk-userPermanent"
300
+ labelText={t('permanent', 'Permanent')}
301
+ name="isPermanent"
302
+ onChange={onPermanentChanged}
303
+ value={model?.permanent}
304
+ />
305
+
306
+ {!formModel?.permanent && (
307
+ <>
308
+ <DatePicker
309
+ dateFormat={DATE_PICKER_CONTROL_FORMAT}
310
+ datePickerType="range"
311
+ light
312
+ locale="en"
313
+ minDate={formatForDatePicker(MinDate)}
314
+ onChange={onActiveDatesChange}
277
315
  >
278
- <SelectItem disabled hidden value="placeholder-item" text={t('chooseARole', 'Choose a role')} />
316
+ <DatePickerInput
317
+ id="date-picker-input-id-start"
318
+ labelText={t('activeFrom', 'Active From')}
319
+ name="activeFrom"
320
+ placeholder={DATE_PICKER_FORMAT}
321
+ value={formatForDatePicker(formModel?.activeFrom)}
322
+ />
323
+ <DatePickerInput
324
+ id="date-picker-input-id-finish"
325
+ labelText={t('activeTo', 'Active To')}
326
+ name="activeTo"
327
+ placeholder={DATE_PICKER_FORMAT}
328
+ value={formatForDatePicker(formModel?.activeTo)}
329
+ />
330
+ </DatePicker>
331
+ </>
332
+ )}
333
+ </CheckboxGroup>
334
+ <FormGroup legendText={t('stockOperation', 'Stock Operations')}>
335
+ <span className={styles.subTitle}>
336
+ {t('roleDescription', 'The role will be applicable to only selected stock operations.')}
337
+ </span>
338
+ </FormGroup>
339
+ <CheckboxGroup className={styles.checkboxGrid}>
340
+ {stockOperations?.length > 0 &&
341
+ stockOperations.map((type) => {
342
+ return (
343
+ <div className={styles.flexRow}>
344
+ <Checkbox
345
+ checked={isOperationChecked(type)}
346
+ className={styles.checkbox}
347
+ id={type.uuid}
348
+ labelText={type.name}
349
+ onChange={(event) => onStockOperationTypeChanged(event)}
350
+ value={type.uuid}
351
+ />
352
+ </div>
353
+ );
354
+ })}
355
+ </CheckboxGroup>
356
+ <FormGroup legendText={t('locations', 'Locations')}>
357
+ <span className={styles.subTitle}>
358
+ {t('toggleMessage', 'Use the toggle to apply this scope to the locations under the selected location.')}
359
+ </span>
360
+ </FormGroup>
361
+ <CheckboxGroup className={styles.checkboxGrid}>
362
+ {stockLocations?.length > 0 &&
363
+ stockLocations.map((type) => {
364
+ const checkedLocation = findCheckedLocation(type);
279
365
 
280
- {editMode ? (
281
- <SelectItem key={formModel?.role} value={formModel?.role} text={formModel?.role} />
282
- ) : (
283
- (user?.roles ?? roles)?.map((role) => {
284
- return <SelectItem key={role.display} value={role.display} text={role.display} />;
285
- })
286
- )}
287
- </Select>
288
- </div>
289
- </section>
290
- <section className={styles.section}>
291
- <CheckboxGroup className={styles.checkboxGrid}>
292
- <Checkbox
293
- onChange={onEnabledChanged}
294
- checked={formModel?.enabled}
295
- labelText={t('enabled', 'Enabled ?')}
296
- value={model?.enabled}
297
- id="chk-userEnabled"
298
- />
299
- <Checkbox
300
- onChange={onPermanentChanged}
301
- name="isPermanent"
302
- checked={formModel?.permanent}
303
- value={model?.permanent}
304
- labelText={t('permanent', 'Permanent ?')}
305
- id="chk-userPermanent"
306
- />
366
+ const getToggledValue = (locationUuid) => {
367
+ const location = checkedLocation?.locationUuid === locationUuid ? checkedLocation : null;
368
+ return location?.enableDescendants === true;
369
+ };
307
370
 
308
- {!formModel?.permanent && (
309
- <>
310
- <DatePicker
311
- datePickerType="range"
312
- light
313
- minDate={formatForDatePicker(MinDate)}
314
- locale="en"
315
- dateFormat={DATE_PICKER_CONTROL_FORMAT}
316
- onChange={onActiveDatesChange}
317
- >
318
- <DatePickerInput
319
- id="date-picker-input-id-start"
320
- name="activeFrom"
321
- placeholder={DATE_PICKER_FORMAT}
322
- labelText={t('activeFrom', 'Active From')}
323
- value={formatForDatePicker(formModel?.activeFrom)}
324
- />
325
- <DatePickerInput
326
- id="date-picker-input-id-finish"
327
- name="activeTo"
328
- placeholder={DATE_PICKER_FORMAT}
329
- labelText={t('activeTo', 'Active To')}
330
- value={formatForDatePicker(formModel?.activeTo)}
371
+ return (
372
+ <div className={styles.flexRow}>
373
+ <Checkbox
374
+ checked={checkedLocation != null}
375
+ className={styles.checkbox}
376
+ id={`chk-loc-child-${type.id}`}
377
+ key={`chk-loc-child-key-${type.id}`}
378
+ labelText={type.name}
379
+ name="location"
380
+ onChange={(event) => onLocationCheckBoxChanged(event)}
381
+ value={type.id}
382
+ />
383
+ {checkedLocation && (
384
+ <Toggle
385
+ className={styles.toggle}
386
+ hideLabel
387
+ id={`tg-loc-child-${type.id}`}
388
+ key={`tg-loc-child-key-${type.id}`}
389
+ onToggleClick={getToggledValue(type.id)}
390
+ size="sm"
391
+ value={type.id}
331
392
  />
332
- </DatePicker>
333
- </>
334
- )}
335
- </CheckboxGroup>
336
- </section>
337
- <br />
338
- <section className={styles.section}>
339
- <div style={{ display: 'flex', flexDirection: 'column' }}>
340
- <span className={styles.sectionTitle}> {t('stockOperation', 'Stock Operations')}</span>
341
- <div className={styles.hr} />
342
- <span className={styles.subTitle}>
343
- {t('roleDescription', 'The role will be applicable to only selected stock operations.')}
344
- </span>
345
- </div>
346
- </section>
347
- <section className={styles.section}>
348
- <CheckboxGroup className={styles.checkboxGrid}>
349
- {stockOperations?.length > 0 &&
350
- stockOperations.map((type) => {
351
- return (
352
- <div style={{ display: 'flex', flexDirection: 'row' }}>
353
- <Checkbox
354
- value={type.uuid}
355
- checked={isOperationChecked(type)}
356
- className={styles.checkbox}
357
- onChange={(event) => onStockOperationTypeChanged(event)}
358
- labelText={type.name}
359
- id={type.uuid}
360
- />
361
- </div>
362
- );
363
- })}
364
- </CheckboxGroup>
365
- </section>
366
- <br />
367
- <section className={styles.section}>
368
- <div style={{ display: 'flex', flexDirection: 'column' }}>
369
- <span className={styles.sectionTitle}> {t('locations', 'Locations')}</span>
370
- <div className={styles.hr} />
371
- <span className={styles.subTitle}>
372
- {t('toggleMessage', 'Use the toggle to apply this scope to the locations under the selected location.')}
373
- </span>
374
- </div>
375
- </section>
376
- <section className={styles.section}>
377
- <CheckboxGroup className={styles.checkboxGrid}>
378
- {stockLocations?.length > 0 &&
379
- stockLocations.map((type) => {
380
- const checkedLocation = findCheckedLocation(type);
381
-
382
- const getToggledValue = (locationUuid) => {
383
- const location = checkedLocation?.locationUuid === locationUuid ? checkedLocation : null;
384
- return location?.enableDescendants === true;
385
- };
386
-
387
- return (
388
- <div
389
- style={{
390
- display: 'flex',
391
- flexDirection: 'row',
392
- margin: '4px',
393
- padding: '5px',
394
- }}
395
- >
396
- <Checkbox
397
- name="location"
398
- key={`chk-loc-child-key-${type.id}`}
399
- id={`chk-loc-child-${type.id}`}
400
- value={type.id}
401
- onChange={(event) => onLocationCheckBoxChanged(event)}
402
- className={styles.checkbox}
403
- labelText={type.name}
404
- checked={checkedLocation != null}
405
- />
406
- {checkedLocation && (
407
- <Toggle
408
- value={type.id}
409
- hideLabel
410
- className={styles.toggle}
411
- size={'sm'}
412
- onToggleClick={getToggledValue(type.id)}
413
- key={`tg-loc-child-key-${type.id}`}
414
- id={`tg-loc-child-${type.id}`}
415
- />
416
- )}
417
- </div>
418
- );
419
- })}
420
- </CheckboxGroup>
421
- </section>
422
- </ModalBody>
423
- <ModalFooter>
424
- <Button kind="secondary" onClick={closeOverlay}>
425
- {t('cancel', 'Cancel')}
426
- </Button>
427
- <Button type="submit" onClick={addStockUserRole}>
428
- {t('save', 'Save')}
429
- </Button>
430
- </ModalFooter>
431
- </Form>
432
- </div>
393
+ )}
394
+ </div>
395
+ );
396
+ })}
397
+ </CheckboxGroup>
398
+ </Stack>
399
+ <ButtonSet
400
+ className={classNames(styles.buttonSet, {
401
+ [styles.tablet]: isTablet,
402
+ [styles.desktop]: !isTablet,
403
+ })}
404
+ >
405
+ <Button kind="secondary" onClick={closeWorkspace} className={styles.button}>
406
+ {getCoreTranslation('cancel', 'Cancel')}
407
+ </Button>
408
+ <Button type="submit" className={styles.button} onClick={addStockUserRole} renderIcon={Save}>
409
+ {getCoreTranslation('save', 'Save')}
410
+ </Button>
411
+ </ButtonSet>
412
+ </Form>
433
413
  );
434
414
  };
435
415
 
@@ -3,9 +3,8 @@ import { Edit } from '@carbon/react/icons';
3
3
 
4
4
  import React, { useCallback } from 'react';
5
5
  import { useTranslation } from 'react-i18next';
6
- import { launchOverlay } from '../../core/components/overlay/hook';
7
- import AddStockUserRoleScope from '../add-stock-user-scope/add-stock-user-role-scope.component';
8
6
  import { type UserRoleScope } from '../../core/api/types/identity/UserRoleScope';
7
+ import { launchWorkspace } from '@openmrs/esm-framework';
9
8
 
10
9
  interface EditStockUserRoleActionsMenuProps {
11
10
  data: UserRoleScope;
@@ -15,14 +14,17 @@ const EditStockUserRoleActionsMenu: React.FC<EditStockUserRoleActionsMenuProps>
15
14
  const { t } = useTranslation();
16
15
 
17
16
  const handleClick = useCallback(() => {
18
- launchOverlay('Edit Stock User Role', <AddStockUserRoleScope model={data} editMode={true} />);
19
- }, [data]);
17
+ launchWorkspace('stock-user-role-scopes-form-workspace', {
18
+ workspaceTitle: t('editUserScope', 'Edit user scope role'),
19
+ model: data,
20
+ });
21
+ }, [data, t]);
20
22
 
21
23
  return (
22
24
  <Button
23
25
  kind="ghost"
24
26
  onClick={handleClick}
25
- iconDescription={t('editUserScope', 'Edit UserScope')}
27
+ iconDescription={t('editUserScope', 'Edit user scope role')}
26
28
  renderIcon={(props) => <Edit size={16} {...props} />}
27
29
  />
28
30
  );
@@ -4,7 +4,6 @@ import {
4
4
  DataTable,
5
5
  DataTableSkeleton,
6
6
  Link,
7
- TabPanel,
8
7
  Pagination,
9
8
  Table,
10
9
  TableBody,
@@ -14,28 +13,29 @@ import {
14
13
  TableHeader,
15
14
  TableRow,
16
15
  TableToolbar,
16
+ TableToolbarAction,
17
17
  TableToolbarContent,
18
+ TableToolbarMenu,
18
19
  TableToolbarSearch,
20
+ TabPanel,
19
21
  Tile,
20
- TableToolbarMenu,
21
- TableToolbarAction,
22
22
  } from '@carbon/react';
23
- import styles from './stock-user-role-scopes.scss';
24
23
  import { ArrowDownLeft, ArrowLeft } from '@carbon/react/icons';
25
24
  import { isDesktop, restBaseUrl, useSession } from '@openmrs/esm-framework';
25
+ import { formatDisplayDate } from '../core/utils/datetimeUtils';
26
+ import { handleMutate } from '../utils';
26
27
  import { ResourceRepresentation } from '../core/api/api';
27
- import useStockUserRoleScopesPage from './stock-user-role-scopes-items-table.resource';
28
+ import { URL_USER_ROLE_SCOPE } from '../constants';
28
29
  import AddStockUserRoleScopeActionButton from './add-stock-user-role-scope-button.component';
29
- import { formatDisplayDate } from '../core/utils/datetimeUtils';
30
30
  import EditStockUserRoleActionsMenu from './edit-stock-user-scope/edit-stock-user-scope-action-menu.component';
31
31
  import StockUserScopeDeleteActionMenu from './delete-stock-user-scope/delete-stock-user-scope.component';
32
- import { URL_USER_ROLE_SCOPE } from '../constants';
33
- import { handleMutate } from '../utils';
32
+ import useStockUserRoleScopesPage from './stock-user-role-scopes-items-table.resource';
33
+ import styles from './stock-user-role-scopes.scss';
34
34
 
35
35
  function StockUserRoleScopesItems() {
36
36
  const { t } = useTranslation();
37
-
38
37
  const currentUser = useSession();
38
+
39
39
  const handleRefresh = () => {
40
40
  handleMutate(`${restBaseUrl}/stockmanagement/userrolescope`);
41
41
  };
@@ -46,6 +46,7 @@ function StockUserRoleScopesItems() {
46
46
  v: ResourceRepresentation.Default,
47
47
  totalCount: true,
48
48
  });
49
+
49
50
  const tableHeaders = useMemo(
50
51
  () => [
51
52
  {
@@ -71,7 +72,7 @@ function StockUserRoleScopesItems() {
71
72
  },
72
73
  {
73
74
  id: 4,
74
- header: t('permanent', 'Permanent ?'),
75
+ header: t('permanent', 'Permanent'),
75
76
  key: 'permanent',
76
77
  },
77
78
  {
@@ -164,15 +165,11 @@ function StockUserRoleScopesItems() {
164
165
  'To access stock management features, users must have assigned roles specifying location and stock operation type scopes.',
165
166
  )}
166
167
  </TabPanel>
167
- <div id="table-tool-bar">
168
- <div></div>
169
- <div className="right-filters"></div>
170
- </div>
171
168
  <DataTable
172
- rows={tableRows ?? []}
173
169
  headers={tableHeaders}
174
- isSortable={true}
175
- useZebraStyles={true}
170
+ isSortable
171
+ rows={tableRows ?? []}
172
+ useZebraStyles
176
173
  render={({ rows, headers, getHeaderProps, getTableProps, getRowProps, onInputChange }) => (
177
174
  <TableContainer>
178
175
  <TableToolbar
@@ -185,7 +182,9 @@ function StockUserRoleScopesItems() {
185
182
  <TableToolbarContent className={styles.toolbarContent}>
186
183
  <TableToolbarSearch persistent onChange={onInputChange} />
187
184
  <TableToolbarMenu>
188
- <TableToolbarAction onClick={handleRefresh}>Refresh</TableToolbarAction>
185
+ <TableToolbarAction className={styles.toolbarAction} onClick={handleRefresh}>
186
+ {t('refresh', 'Refresh')}
187
+ </TableToolbarAction>
189
188
  </TableToolbarMenu>
190
189
  <AddStockUserRoleScopeActionButton />
191
190
  </TableToolbarContent>
@@ -230,7 +229,9 @@ function StockUserRoleScopesItems() {
230
229
  <div className={styles.tileContainer}>
231
230
  <Tile className={styles.tile}>
232
231
  <div className={styles.tileContent}>
233
- <p className={styles.content}>{t('noUserScopesToDisplay', 'No Stock User scopes to display')}</p>
232
+ <p className={styles.content}>
233
+ {t('noStockUserRoleScopesToDisplay', 'No stock user role scopes to display')}
234
+ </p>
234
235
  <p className={styles.helper}>{t('checkFilters', 'Check the filters above')}</p>
235
236
  </div>
236
237
  </Tile>
@@ -60,3 +60,7 @@
60
60
  flex-direction: column;
61
61
  align-items: center;
62
62
  }
63
+
64
+ .toolbarAction {
65
+ max-width: none;
66
+ }
@@ -101,7 +101,7 @@
101
101
  "editStockOperation": "Edit stock operation",
102
102
  "editStockRule": "Edit Stock Rule",
103
103
  "editUserScope": "Edit UserScope",
104
- "enabled": "Enabled ?",
104
+ "enabled": "Enabled",
105
105
  "endDate": "End Date",
106
106
  "ended": "Ended",
107
107
  "enterRemarks": "Enter remarks",
@@ -217,7 +217,7 @@
217
217
  "partialFulfillment": "Partial Fulfillment",
218
218
  "partieserror": "Error launching base operation details form",
219
219
  "patients": "Patients",
220
- "permanent": "Permanent ?",
220
+ "permanent": "Permanent",
221
221
  "pleaseFillField": "",
222
222
  "pleaseSpecify": "Please Specify",
223
223
  "poorquality": "Poor Quality",