@openmrs/esm-stock-management-app 1.0.1-pre.554 → 1.0.1-pre.575

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. package/dist/271.js +1 -1
  2. package/dist/319.js +1 -1
  3. package/dist/460.js +1 -1
  4. package/dist/574.js +1 -1
  5. package/dist/757.js +1 -1
  6. package/dist/769.js +1 -0
  7. package/dist/769.js.map +1 -0
  8. package/dist/788.js +1 -1
  9. package/dist/807.js +1 -1
  10. package/dist/833.js +1 -1
  11. package/dist/main.js +1 -1
  12. package/dist/main.js.map +1 -1
  13. package/dist/openmrs-esm-stock-management-app.js +1 -1
  14. package/dist/openmrs-esm-stock-management-app.js.buildmanifest.json +52 -52
  15. package/dist/openmrs-esm-stock-management-app.js.map +1 -1
  16. package/dist/routes.json +1 -1
  17. package/package.json +1 -1
  18. package/src/core/api/types/stockOperation/StockOperationDTO.ts +0 -1
  19. package/src/core/components/card/metrics-card.scss +7 -7
  20. package/src/core/components/overlay/overlay.scss +6 -6
  21. package/src/core/components/privilages-component/privilages.scss +6 -5
  22. package/src/core/components/side-nav/side-nav.scss +12 -12
  23. package/src/core/components/table/table.scss +16 -16
  24. package/src/core/components/tabs/vertical-tabs.scss +15 -15
  25. package/src/dashboard/home-dashboard.scss +1 -1
  26. package/src/stock-home/stock-home-detail-card.scss +7 -7
  27. package/src/stock-home/stock-home.scss +7 -7
  28. package/src/stock-items/add-stock-item/stock-item-details/stock-item-details.component.tsx +2 -4
  29. package/src/stock-items/add-stock-item/stock-item-details/stock-item-details.scss +33 -4
  30. package/src/stock-items/stock-items-table.scss +8 -9
  31. package/src/stock-management-header/stock-management-header.scss +5 -5
  32. package/src/stock-operations/add-stock-operation/add-stock-operation.component.tsx +13 -9
  33. package/src/stock-operations/add-stock-operation/add-stock-operation.scss +5 -5
  34. package/src/stock-operations/add-stock-operation/add-stock-operation.utils.tsx +1 -4
  35. package/src/stock-operations/add-stock-operation/base-operation-details.component.tsx +2 -4
  36. package/src/stock-operations/add-stock-operation/base-operation-details.scss +30 -0
  37. package/src/stock-operations/add-stock-operation/stock-operation-submission.component.tsx +17 -17
  38. package/src/stock-operations/stock-operations-dialog/stock-operations-complete-button.component.tsx +3 -2
  39. package/src/stock-operations/stock-operations-dialog/stock-operations-completed-dispatch-button.component.tsx +3 -2
  40. package/src/stock-operations/stock-operations-dialog/stock-operations-dialog.scss +5 -5
  41. package/src/stock-operations/stock-operations-table.component.tsx +19 -65
  42. package/src/stock-operations/stock-operations-table.scss +8 -9
  43. package/src/stock-reports/report-list/stock-reports.scss +2 -1
  44. package/src/stock-settings/stock-settings.component.tsx +1 -1
  45. package/src/stock-settings/stock-settings.scss +7 -4
  46. package/src/stock-sources/add-stock-sources/add-stock-sources.scss +6 -6
  47. package/src/stock-sources/delete-stock-modal.component.tsx +3 -3
  48. package/src/stock-sources/delete-stock-modal.scss +11 -0
  49. package/src/stock-sources/stock-sources-filter/stock-sources-filter.scss +3 -1
  50. package/src/stock-sources/stock-sources.scss +9 -9
  51. package/src/stock-user-role-scopes/delete-stock-user-scope-modal.component.tsx +1 -1
  52. package/src/stock-user-role-scopes/delete-stock-user-scope-modal.scss +11 -0
  53. package/src/stock-user-role-scopes/stock-user-role-scopes.scss +8 -7
  54. package/translations/am.json +1 -0
  55. package/translations/ar.json +1 -0
  56. package/translations/en.json +2 -1
  57. package/translations/es.json +1 -0
  58. package/translations/fr.json +1 -0
  59. package/translations/he.json +1 -0
  60. package/translations/km.json +1 -0
  61. package/translations/zh.json +1 -0
  62. package/dist/281.js +0 -1
  63. package/dist/281.js.map +0 -1
  64. package/src/root.scss +0 -108
@@ -1,7 +1,7 @@
1
- @use '@carbon/styles/scss/colors';
2
- @use '@carbon/styles/scss/spacing';
3
- @use '@carbon/styles/scss/type';
4
- @import '~@openmrs/esm-styleguide/src/vars';
1
+ @use '@carbon/colors';
2
+ @use '@carbon/type';
3
+ @use '@carbon/layout';
4
+ @use '~@openmrs/esm-styleguide/src/vars' as *;
5
5
 
6
6
  .widgetContainer {
7
7
  background-color: $ui-background;
@@ -11,7 +11,7 @@
11
11
  display: flex;
12
12
  justify-content: space-between;
13
13
  align-items: center;
14
- padding: spacing.$spacing-04 0 spacing.$spacing-04 spacing.$spacing-05;
14
+ padding: layout.$spacing-04 0 layout.$spacing-04 layout.$spacing-05;
15
15
  }
16
16
 
17
17
  .widgetHeaderContainer > h4:after {
@@ -24,7 +24,7 @@
24
24
 
25
25
  .toggleButtons {
26
26
  width: fit-content;
27
- margin: 0 spacing.$spacing-03;
27
+ margin: 0 layout.$spacing-03;
28
28
  }
29
29
 
30
30
  .searchField {
@@ -69,7 +69,7 @@
69
69
  .tileContainer {
70
70
  background-color: $ui-02;
71
71
  border-top: 1px solid $ui-03;
72
- padding: 5rem 0;
72
+ padding: layout.$spacing-11 0;
73
73
  }
74
74
 
75
75
  .tile {
@@ -91,29 +91,29 @@
91
91
  display: flex;
92
92
  flex-direction: column;
93
93
  align-items: flex-start;
94
- margin-top: spacing.$spacing-03;
95
- min-height: spacing.$spacing-10;
94
+ margin-top: layout.$spacing-03;
95
+ min-height: layout.$spacing-10;
96
96
  width: 100%;
97
97
  @include type.type-style('body-compact-01');
98
98
  }
99
99
 
100
100
  .radioButton {
101
- padding: spacing.$spacing-02 spacing.$spacing-02;
102
- margin: spacing.$spacing-03 0;
101
+ padding: layout.$spacing-02 layout.$spacing-02;
102
+ margin: layout.$spacing-03 0;
103
103
  }
104
104
 
105
105
  .section {
106
- margin: spacing.$spacing-03;
106
+ margin: layout.$spacing-03;
107
107
  }
108
108
 
109
109
  .sectionTitle {
110
110
  @include type.type-style('heading-compact-02');
111
111
  color: colors.$gray-70;
112
- margin-bottom: spacing.$spacing-04;
112
+ margin-bottom: layout.$spacing-04;
113
113
  }
114
114
 
115
115
  .modalBody {
116
- padding-bottom: spacing.$spacing-05;
116
+ padding-bottom: layout.$spacing-05;
117
117
  }
118
118
 
119
119
  .tabContainer div[role='tabpanel'] {
@@ -145,11 +145,11 @@
145
145
  }
146
146
 
147
147
  tr {
148
- width: spacing.$spacing-01;
148
+ width: layout.$spacing-01;
149
149
  }
150
150
 
151
151
  .toolbarContent {
152
- height: spacing.$spacing-09;
152
+ height: layout.$spacing-09;
153
153
  }
154
154
  }
155
155
 
@@ -1,31 +1,31 @@
1
- @use '@carbon/styles/scss/colors';
2
- @use '@carbon/styles/scss/spacing';
3
- @use '@carbon/styles/scss/type';
4
- @import '~@openmrs/esm-styleguide/src/vars';
1
+ @use '@carbon/colors';
2
+ @use '@carbon/layout';
3
+ @use '@carbon/type';
4
+ @use '~@openmrs/esm-styleguide/src/vars' as *;
5
5
 
6
6
  .heading {
7
7
  @include type.type-style('productive-heading-02');
8
8
  color: colors.$gray-70;
9
- margin-bottom: spacing.$spacing-05;
9
+ margin-bottom: layout.$spacing-05;
10
10
  }
11
11
 
12
12
  .heading:after {
13
13
  content: "";
14
14
  display: block;
15
- width: 2rem;
15
+ width: layout.$spacing-07;
16
16
  padding-top: 0.188rem;
17
17
  border-bottom: 0.375rem solid var(--brand-03);
18
18
  }
19
19
 
20
20
  .mainContainer {
21
- padding-bottom: 1.5rem;
21
+ padding-bottom: layout.$spacing-06;
22
22
  background: $ui-01;
23
23
  display: flex;
24
24
  justify-content: center;
25
25
  }
26
26
 
27
27
  .title {
28
- padding: 1rem;
28
+ padding: layout.$spacing-05;
29
29
  font-size: 1.2rem;
30
30
  }
31
31
 
@@ -84,7 +84,7 @@
84
84
  outline-offset: 0 !important;
85
85
  }
86
86
 
87
- max-height: 4rem;
87
+ max-height: layout.$spacing-10;
88
88
  }
89
89
 
90
90
  :global(.cds--col) {
@@ -107,10 +107,10 @@
107
107
 
108
108
  .tabContainer {
109
109
  background: white;
110
- padding-left: 1.5rem;
111
- padding-right: 1rem;
112
- padding-top: 1rem;
113
- margin-bottom: 1rem;
110
+ padding-left: layout.$spacing-06;
111
+ padding-right: layout.$spacing-05;
112
+ padding-top: layout.$spacing-05;
113
+ margin-bottom: layout.$spacing-05;
114
114
  }
115
115
 
116
116
  .optionCell {
@@ -118,10 +118,10 @@
118
118
  }
119
119
 
120
120
  .optionHeader {
121
- width: 1.5rem !important;
121
+ width: layout.$spacing-06 !important;
122
122
  }
123
123
 
124
124
  .text {
125
125
  font-size: 0.9rem;
126
- padding: 0.5rem;
126
+ padding: layout.$spacing-03;
127
127
  }
@@ -1,5 +1,5 @@
1
1
  @use '@carbon/colors';
2
- @use '@carbon/styles/scss/spacing';
2
+ @use '@carbon/layout';
3
3
 
4
4
  .homePageWrapper {
5
5
  display: flex;
@@ -1,6 +1,6 @@
1
1
  @use '@carbon/layout';
2
2
  @use '@carbon/type';
3
- @import '~@openmrs/esm-styleguide/src/vars';
3
+ @use '~@openmrs/esm-styleguide/src/vars' as *;
4
4
 
5
5
  .container {
6
6
  margin: 2rem 0;
@@ -57,7 +57,7 @@
57
57
  }
58
58
 
59
59
  .emptyRow {
60
- padding: 0 1rem;
60
+ padding: 0 layout.$spacing-05;
61
61
  display: flex;
62
62
  align-items: center;
63
63
  }
@@ -65,7 +65,7 @@
65
65
  .visitSummaryContainer {
66
66
  width: 100%;
67
67
  max-width: 768px;
68
- margin: 1rem auto;
68
+ margin: layout.$spacing-10 auto;
69
69
  }
70
70
 
71
71
  .expandedActiveVisitRow > td > div {
@@ -73,11 +73,11 @@
73
73
  }
74
74
 
75
75
  .expandedActiveVisitRow td {
76
- padding: 0 2rem;
76
+ padding: 0 layout.$spacing-07;
77
77
  }
78
78
 
79
79
  .expandedActiveVisitRow th[colspan] td[colspan] > div:first-child {
80
- padding: 0 1rem;
80
+ padding: 0 layout.$spacing-05;
81
81
  }
82
82
 
83
83
  .action {
@@ -107,7 +107,7 @@
107
107
  &:after {
108
108
  content: '';
109
109
  display: block;
110
- width: 2rem;
110
+ width: layout.$spacing-07;
111
111
  padding-top: 3px;
112
112
  border-bottom: 0.375rem solid;
113
113
  @include brand-03(border-bottom-color);
@@ -136,7 +136,7 @@
136
136
  .filterEmptyStateContent {
137
137
  @include type.type-style('heading-compact-02');
138
138
  color: $text-02;
139
- margin-bottom: 0.5rem;
139
+ margin-bottom: layout.$spacing-03;
140
140
  }
141
141
 
142
142
  .filterEmptyStateHelper {
@@ -1,13 +1,13 @@
1
- @use '@carbon/styles/scss/spacing';
2
- @use '@carbon/styles/scss/type';
1
+ @use '@carbon/layout';
2
+ @use '@carbon/type';
3
3
  @use '@carbon/colors';
4
- @import '~@openmrs/esm-styleguide/src/vars';
4
+ @use '~@openmrs/esm-styleguide/src/vars' as *;
5
5
  .cardContainer {
6
6
  background-color: colors.$white;
7
7
  display: flex;
8
8
  justify-content: space-between;
9
- margin: 0 spacing.$spacing-05 0 spacing.$spacing-05;
9
+ margin: 0 layout.$spacing-05 0 layout.$spacing-05;
10
10
  flex-flow: row wrap;
11
- column-gap: spacing.$spacing-05;
12
- row-gap: spacing.$spacing-05;
13
- }
11
+ column-gap: layout.$spacing-05;
12
+ row-gap: layout.$spacing-05;
13
+ }
@@ -20,7 +20,7 @@ import StockItemCategorySelector from "../stock-item-category-selector/stock-ite
20
20
  import StockItemUnitsEdit from "../stock-item-units-edit/stock-item-units-edit.component";
21
21
  import { SaveStockItem } from "../../types";
22
22
  import ConceptsSelector from "../concepts-selector/concepts-selector.component";
23
- import rootStyles from "../../../root.scss";
23
+ import styles from "../../add-stock-item/add-stock-item.scss";
24
24
  import { closeOverlay } from "../../../core/components/overlay/hook";
25
25
  import { expirationOptions, radioOptions } from "./stock-item-details.resource";
26
26
  import { restBaseUrl } from "@openmrs/esm-framework";
@@ -70,9 +70,7 @@ const StockItemDetails = forwardRef<never, StockItemDetailsProps>(
70
70
  }, [model.hasExpiration, model.isDrug]);
71
71
 
72
72
  return (
73
- <form
74
- className={`${rootStyles.formContainer} ${rootStyles.verticalForm}`}
75
- >
73
+ <form className={`${styles.formContainer} ${styles.verticalForm}`}>
76
74
  {!isEditing && (
77
75
  <FormGroup
78
76
  className="clear-margin-bottom"
@@ -1,9 +1,9 @@
1
- @use '@carbon/styles/scss/spacing';
2
- @use '@carbon/styles/scss/type';
3
- @import '~@openmrs/esm-styleguide/src/vars';
1
+ @use '@carbon/layout';
2
+ @use '@carbon/type';
3
+ @use '~@openmrs/esm-styleguide/src/vars' as *;
4
4
 
5
5
  .section {
6
- margin: spacing.$spacing-03;
6
+ margin: layout.$spacing-03;
7
7
  }
8
8
 
9
9
  .form {
@@ -11,3 +11,32 @@
11
11
  gap: 1.5rem;
12
12
  padding-top: 1rem;
13
13
  }
14
+
15
+ .formContainer {
16
+ height: calc(100vh - 100px) !important;
17
+ overflow: scroll;
18
+ padding: 0 1rem;
19
+ }
20
+
21
+ .verticalForm {
22
+ display: flex;
23
+ grid-row-gap: 2em;
24
+ padding-top: layout.$spacing-05;
25
+ align-content: space-between;
26
+ flex-direction: column;
27
+
28
+ :global(.cds--form-item) {
29
+ flex: none !important;
30
+ }
31
+
32
+ :global(.cds--label) {
33
+ color: black;
34
+ display: inline-block;
35
+ font-size: var(--cds-label-01-font-size);
36
+ font-weight: bold;
37
+ letter-spacing: var(--cds-label-01-letter-spacing, .32px);
38
+ line-height: layout.$spacing-05;
39
+ margin-bottom: layout.$spacing-03;
40
+ vertical-align: baseline;
41
+ }
42
+ }
@@ -1,18 +1,17 @@
1
- @use '@carbon/styles/scss/spacing';
1
+ @use '@carbon/layout';
2
2
  @use '@carbon/styles/scss/type';
3
- @import "~@openmrs/esm-styleguide/src/vars";
4
- @import '../root.scss';
3
+ @use '~@openmrs/esm-styleguide/src/vars' as *;
5
4
 
6
5
  .headerBtnContainer {
7
6
  background-color: $ui-background;
8
- padding: spacing.$spacing-05;
7
+ padding: layout.$spacing-05;
9
8
  text-align: right;
10
9
  }
11
10
 
12
11
  .tileContainer {
13
12
  background-color: $ui-02;
14
13
  border-top: 1px solid $ui-03;
15
- padding: 5rem 0;
14
+ padding: layout.$spacing-11 0;
16
15
  }
17
16
 
18
17
  .tile {
@@ -78,12 +77,12 @@
78
77
  }
79
78
 
80
79
  .dateAlign {
81
- padding-top: spacing.$spacing-03;
80
+ padding-top: layout.$spacing-03;
82
81
  height: 100%;
83
82
  }
84
83
 
85
84
  .filtersAlign {
86
- padding-bottom: spacing.$spacing-03;
85
+ padding-bottom: layout.$spacing-03;
87
86
 
88
87
  :global(.cds--list-box__menu) {
89
88
  min-width: 15rem;
@@ -95,5 +94,5 @@
95
94
  display: flex;
96
95
  align-items: center;
97
96
  justify-content: space-between;
98
- margin-bottom: spacing.$spacing-05;
99
- }
97
+ margin-bottom: layout.$spacing-05;
98
+ }
@@ -1,12 +1,12 @@
1
- @use '@carbon/styles/scss/colors';
2
- @use '@carbon/styles/scss/spacing';
3
- @use '@carbon/styles/scss/type';
4
- @import '~@openmrs/esm-styleguide/src/vars';
1
+ @use '@carbon/colors';
2
+ @use '@carbon/layout';
3
+ @use '@carbon/type';
4
+ @use '~@openmrs/esm-styleguide/src/vars' as *;
5
5
 
6
6
  .header {
7
7
  @include type.type-style('body-compact-02');
8
8
  color: colors.$gray-70;
9
- height: spacing.$spacing-12;
9
+ height: layout.$spacing-12;
10
10
  background-color: $ui-02;
11
11
  display: flex;
12
12
  padding-left: 8px;
@@ -82,10 +82,12 @@ const AddStockOperation: React.FC<AddStockOperationProps> = (props) => {
82
82
  }, [currentStockOperationType, requisition, props.model?.uuid]);
83
83
 
84
84
  const [selectedIndex, setSelectedIndex] = useState(0);
85
- const [canReceiveItems, setCanReceiveItems] = useState(false);
85
+ const [canDisplayReceivedItems, setCanDisplayReceivedItems] = useState(false);
86
86
 
87
87
  useEffect(() => {
88
- setCanReceiveItems(props?.model?.permission?.canReceiveItems ?? false);
88
+ setCanDisplayReceivedItems(
89
+ props?.model?.permission?.canDisplayReceivedItems ?? false
90
+ );
89
91
  }, [props?.model?.permission]);
90
92
 
91
93
  if (isLoading) return <AccordionSkeleton />;
@@ -182,6 +184,9 @@ const AddStockOperation: React.FC<AddStockOperationProps> = (props) => {
182
184
  : result.requiresDispatchAcknowledgement
183
185
  }
184
186
  actions={{
187
+ onGoBack: () => {
188
+ setSelectedIndex(1);
189
+ },
185
190
  onSave: async (model) => {
186
191
  // TODO: Update
187
192
  await addOrEditStockOperation(
@@ -193,17 +198,15 @@ const AddStockOperation: React.FC<AddStockOperationProps> = (props) => {
193
198
  props.canPrint
194
199
  );
195
200
  },
196
- onGoBack: () => {
197
- setSelectedIndex(1);
198
- },
201
+
199
202
  onComplete: async () => {
200
- await showActionDialogButton("Complete", true, props?.model);
203
+ await showActionDialogButton("Complete", false, props?.model);
201
204
  },
202
205
  onSubmit: async () => {
203
- await showActionDialogButton("Submit", true, props?.model);
206
+ await showActionDialogButton("Submit", false, props?.model);
204
207
  },
205
208
  onDispatch: async () => {
206
- await showActionDialogButton("Dispatch", true, props?.model);
209
+ await showActionDialogButton("Dispatch", false, props?.model);
207
210
  },
208
211
  }}
209
212
  />
@@ -213,7 +216,7 @@ const AddStockOperation: React.FC<AddStockOperationProps> = (props) => {
213
216
  ].concat(
214
217
  StockOperationTypeIsStockIssue(
215
218
  props?.model?.operationType as OperationType
216
- ) || canReceiveItems
219
+ ) || canDisplayReceivedItems
217
220
  ? status === "DISPATCHED" || status === "COMPLETED"
218
221
  ? [
219
222
  {
@@ -505,6 +508,7 @@ const AddStockOperation: React.FC<AddStockOperationProps> = (props) => {
505
508
  <div style={{ margin: "2px" }}>
506
509
  <StockOperationCompleteDispatchButton
507
510
  operation={props?.model}
511
+ reason={false}
508
512
  />
509
513
  </div>
510
514
  <div style={{ margin: "2px" }}>
@@ -1,14 +1,14 @@
1
- @use '@carbon/styles/scss/spacing';
2
- @use '@carbon/styles/scss/type';
3
- @import '~@openmrs/esm-styleguide/src/vars';
1
+ @use '@carbon/layout';
2
+ @use '@carbon/type';
3
+ @use '~@openmrs/esm-styleguide/src/vars' as *;
4
4
  .sectionTitle {
5
5
  @include type.type-style('heading-compact-02');
6
6
  color: $text-02;
7
- margin-bottom: spacing.$spacing-04;
7
+ margin-bottom: layout.$spacing-04;
8
8
  }
9
9
 
10
10
  .modalBody {
11
- padding-bottom: spacing.$spacing-05;
11
+ padding-bottom: layout.$spacing-05;
12
12
  }
13
13
 
14
14
  .actionsContainer {
@@ -59,10 +59,7 @@ export async function initializeNewStockOperation(
59
59
  let destinationPartyList: Party[] | null | undefined;
60
60
 
61
61
  if (isNew) {
62
- model = structuredClone({
63
- ...initialStockOperationValue(),
64
- receivedItems: [],
65
- });
62
+ model = structuredClone(initialStockOperationValue());
66
63
  model = Object.assign(model, {
67
64
  operationDate: today(),
68
65
  operationTypeName: currentStockOperationType?.name,
@@ -35,7 +35,7 @@ import { useStockOperationPages } from "../stock-operations-table.resource";
35
35
  import { createBaseOperationPayload } from "./add-stock-utils";
36
36
  import { showSnackbar, useSession } from "@openmrs/esm-framework";
37
37
 
38
- import rootStyles from "../../root.scss";
38
+ import styles from "../add-stock-operation/base-operation-details.scss";
39
39
 
40
40
  interface BaseOperationDetailsProps {
41
41
  isEditing?: boolean;
@@ -116,9 +116,7 @@ const BaseOperationDetails: React.FC<BaseOperationDetailsProps> = ({
116
116
  };
117
117
  return (
118
118
  <div style={{ margin: "10px" }}>
119
- <form
120
- className={`${rootStyles.formContainer} ${rootStyles.verticalForm}`}
121
- >
119
+ <form className={`${styles.formContainer} ${styles.verticalForm}`}>
122
120
  {canEdit && (
123
121
  <Controller
124
122
  control={control}
@@ -0,0 +1,30 @@
1
+ @use '@carbon/layout';
2
+ @use '@carbon/type';
3
+ @use '~@openmrs/esm-styleguide/src/vars' as *;
4
+
5
+ .verticalForm {
6
+ display: flex;
7
+ grid-row-gap: 2em;
8
+ padding-top: layout.$spacing-05;
9
+ align-content: space-between;
10
+ flex-direction: column;
11
+
12
+ :global(.cds--form-item) {
13
+ flex: none !important;
14
+ }
15
+
16
+ :global(.cds--label) {
17
+ color: black;
18
+ display: inline-block;
19
+ font-size: var(--cds-label-01-font-size);
20
+ font-weight: bold;
21
+ letter-spacing: var(--cds-label-01-letter-spacing, .32px);
22
+ line-height: layout.$spacing-05;
23
+ margin-bottom: layout.$spacing-03;
24
+ vertical-align: baseline;
25
+ }
26
+ }
27
+
28
+ .formContainer {
29
+ margin: layout.$spacing-05;
30
+ }
@@ -46,11 +46,12 @@ const StockOperationSubmission: React.FC<StockOperationSubmissionProps> = ({
46
46
  model,
47
47
  requiresDispatchAcknowledgement,
48
48
  actions,
49
+ isEditing,
49
50
  }) => {
50
51
  const { t } = useTranslation();
51
52
  const [isSaving, setIsSaving] = useState(false);
52
53
  const [approvalRequired, setApprovalRequired] = useState<boolean | null>(
53
- null
54
+ model?.approvalRequired
54
55
  );
55
56
 
56
57
  const handleRadioButtonChange = (selectedItem: boolean) => {
@@ -68,7 +69,9 @@ const StockOperationSubmission: React.FC<StockOperationSubmissionProps> = ({
68
69
  "Does the transaction require approval ?"
69
70
  )}
70
71
  onChange={handleRadioButtonChange}
71
- defaultSelected={approvalRequired}
72
+ defaultSelected={
73
+ model?.approvalRequired === null ? false : approvalRequired
74
+ }
72
75
  >
73
76
  <RadioButton
74
77
  value={true}
@@ -111,15 +114,15 @@ const StockOperationSubmission: React.FC<StockOperationSubmissionProps> = ({
111
114
  kind="primary"
112
115
  onClick={async () => {
113
116
  delete model?.dateCreated;
114
- delete model?.status;
115
117
  setIsSaving(true);
116
- await actions.onSave(model).then(() => {
117
- delete model?.dateCreated;
118
- model.status = "COMPLETED";
119
- setIsSaving(true);
120
- actions.onComplete(model);
118
+ if (!isEditing) {
119
+ delete model.status;
120
+ await actions.onSave(model);
121
121
  setIsSaving(false);
122
- });
122
+ }
123
+ model.status = "COMPLETED";
124
+ actions.onComplete(model);
125
+ setIsSaving(false);
123
126
  }}
124
127
  renderIcon={ListChecked}
125
128
  >
@@ -137,13 +140,9 @@ const StockOperationSubmission: React.FC<StockOperationSubmissionProps> = ({
137
140
  delete model?.dateCreated;
138
141
  delete model?.status;
139
142
  setIsSaving(true);
140
- await actions.onSave(model).then(() => {
141
- delete model?.dateCreated;
142
- model.status = "COMPLETED";
143
- setIsSaving(true);
144
- actions.onDispatch(model);
145
- setIsSaving(false);
146
- });
143
+ model.status = "DISPATCHED";
144
+ await actions.onDispatch(model);
145
+ setIsSaving(false);
147
146
  }}
148
147
  renderIcon={Departure}
149
148
  >
@@ -160,7 +159,7 @@ const StockOperationSubmission: React.FC<StockOperationSubmissionProps> = ({
160
159
  onClick={actions.onSubmit}
161
160
  renderIcon={SendFilled}
162
161
  >
163
- {t("submit", "Submit For Review")}
162
+ {t("submitForReview", "Submit For Review")}
164
163
  </Button>
165
164
  )}
166
165
  </>
@@ -175,6 +174,7 @@ const StockOperationSubmission: React.FC<StockOperationSubmissionProps> = ({
175
174
  delete model?.dateCreated;
176
175
  delete model?.status;
177
176
  setIsSaving(true);
177
+ model.approvalRequired = approvalRequired ? true : false;
178
178
  await actions.onSave(model);
179
179
  setIsSaving(false);
180
180
  }}
@@ -8,17 +8,18 @@ import { StockOperationDTO } from "../../core/api/types/stockOperation/StockOper
8
8
 
9
9
  interface StockOperationCompleteButtonProps {
10
10
  operation: StockOperationDTO;
11
+ reason: boolean;
11
12
  }
12
13
 
13
14
  const StockOperationCompleteButton: React.FC<
14
15
  StockOperationCompleteButtonProps
15
- > = ({ operation }) => {
16
+ > = ({ operation, reason }) => {
16
17
  const { t } = useTranslation();
17
18
  const launchCompleteModal = useCallback(() => {
18
19
  const dispose = showModal("stock-operation-dialog", {
19
20
  title: "Complete",
20
21
  operation: operation,
21
- requireReason: true,
22
+ requireReason: reason,
22
23
  closeModal: () => dispose(),
23
24
  });
24
25
  }, [operation]);
@@ -8,17 +8,18 @@ import { StockOperationDTO } from "../../core/api/types/stockOperation/StockOper
8
8
 
9
9
  interface StockOperationCompleteDispatchButtonProps {
10
10
  operation: StockOperationDTO;
11
+ reason: boolean;
11
12
  }
12
13
 
13
14
  const StockOperationCompleteDispatchButton: React.FC<
14
15
  StockOperationCompleteDispatchButtonProps
15
- > = ({ operation }) => {
16
+ > = ({ operation, reason }) => {
16
17
  const { t } = useTranslation();
17
18
  const launchcompletedDispatchModal = useCallback(() => {
18
19
  const dispose = showModal("stock-operation-dialog", {
19
20
  title: "Complete Dispatch",
20
21
  operation: operation,
21
- requireReason: false,
22
+ requireReason: reason,
22
23
  closeModal: () => dispose(),
23
24
  });
24
25
  }, [operation]);
@@ -1,14 +1,14 @@
1
- @use '@carbon/styles/scss/spacing';
2
- @use '@carbon/styles/scss/type';
1
+ @use '@carbon/layout';
2
+ @use '@carbon/type';
3
3
 
4
4
  .section {
5
- margin: spacing.$spacing-03;
5
+ margin: layout.$spacing-03;
6
6
  }
7
7
 
8
8
  .sectionTitle {
9
- margin-bottom: spacing.$spacing-04;
9
+ margin-bottom: layout.$spacing-04;
10
10
  }
11
11
 
12
12
  .modalBody {
13
- padding-bottom: spacing.$spacing-05;
13
+ padding-bottom: layout.$spacing-05;
14
14
  }