@openmrs/esm-stock-management-app 1.0.1-pre.420 → 1.0.1-pre.435
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/699.js +1 -0
- package/dist/699.js.map +1 -0
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/openmrs-esm-stock-management-app.js +1 -1
- package/dist/openmrs-esm-stock-management-app.js.buildmanifest.json +28 -28
- package/dist/openmrs-esm-stock-management-app.js.map +1 -1
- package/dist/routes.json +1 -1
- package/package.json +1 -1
- package/src/core/api/types/stockItem/StockItemInventory.ts +1 -0
- package/src/core/api/types/stockItem/StockItemTransaction.ts +1 -0
- package/src/core/components/carbon/controlled-number-input/controlled-number-input.component.tsx +2 -0
- package/src/core/components/table/table.component.tsx +1 -1
- package/src/core/components/table/table.scss +2 -2
- package/src/stock-items/add-stock-item/add-stock-item.component.tsx +1 -1
- package/src/stock-items/add-stock-item/batch-information/batch-information-locations/batch-information-locations-filter.component.tsx +58 -0
- package/src/stock-items/add-stock-item/batch-information/batch-information.component.tsx +36 -25
- package/src/stock-items/add-stock-item/batch-information/batch-information.resource.tsx +15 -7
- package/src/stock-items/add-stock-item/dispensing-package-measurement/dispensing-package-measurement.component.tsx +10 -3
- package/src/stock-items/add-stock-item/packaging-units/packaging-units.component.tsx +27 -7
- package/src/stock-items/add-stock-item/quantities/quantities.component.tsx +8 -21
- package/src/stock-items/add-stock-item/stock-item-rules/add-stock-rules.component.tsx +5 -2
- package/src/stock-items/add-stock-item/stock-item-units-edit/stock-item-units-edit.component.tsx +4 -0
- package/src/stock-items/add-stock-item/transactions/transaction-filters/transaction-locations-filter.component.tsx +57 -0
- package/src/stock-items/add-stock-item/transactions/transactions.component.tsx +64 -24
- package/src/stock-items/add-stock-item/transactions/transactions.resource.tsx +13 -7
- package/src/stock-items/stock-items-table.component.tsx +13 -1
- package/src/stock-items/stock-items-table.scss +85 -76
- package/src/stock-items/stock-items.resource.ts +0 -6
- package/src/stock-locations/stock-locations-table.component.tsx +3 -1
- package/src/stock-operations/batch-no-selector/batch-no-selector.component.tsx +2 -3
- package/src/stock-operations/stock-operations-table.component.tsx +10 -0
- package/src/stock-reports/report-list/stock-reports.component.tsx +13 -1
- package/src/stock-sources/stock-sources-items-table.component.tsx +13 -1
- package/src/stock-user-role-scopes/stock-user-role-scopes-items-table.component.tsx +12 -1
- package/dist/314.js +0 -1
- package/dist/314.js.map +0 -1
@@ -49,34 +49,21 @@ const StockQuantities: React.FC<StockQuantitiesProps> = ({ stockItemUuid }) => {
|
|
49
49
|
location: row?.partyName,
|
50
50
|
quantity: row?.quantity?.toLocaleString() ?? "",
|
51
51
|
batch: row.batchNumber ?? "",
|
52
|
-
packaging: row.quantityUoM ?? ""
|
52
|
+
packaging: `${row.quantityUoM ?? ""} of ${row.quantityFactor ?? ""}`,
|
53
53
|
}));
|
54
54
|
}, [items]);
|
55
55
|
|
56
56
|
if (isLoading) {
|
57
57
|
return <DataTableSkeleton role="progressbar" />;
|
58
58
|
}
|
59
|
-
|
60
|
-
if (items?.length > 0) {
|
61
|
-
return (
|
62
|
-
<DataList
|
63
|
-
columns={tableHeaders}
|
64
|
-
data={tableRows}
|
65
|
-
totalItems={totalCount}
|
66
|
-
goToPage={setCurrentPage}
|
67
|
-
hasToolbar={false}
|
68
|
-
/>
|
69
|
-
);
|
70
|
-
}
|
71
|
-
|
72
59
|
return (
|
73
|
-
<
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
60
|
+
<DataList
|
61
|
+
columns={tableHeaders}
|
62
|
+
data={tableRows}
|
63
|
+
totalItems={totalCount}
|
64
|
+
goToPage={setCurrentPage}
|
65
|
+
hasToolbar={false}
|
66
|
+
/>
|
80
67
|
);
|
81
68
|
};
|
82
69
|
|
@@ -67,7 +67,10 @@ const StockRulesAddOrUpdate: React.FC<AddStockRuleProps> = ({
|
|
67
67
|
isLoading: loadingRoles,
|
68
68
|
} = useRoles({ v: ResourceRepresentation.Default });
|
69
69
|
|
70
|
-
const [formModel, setFormModel] = useState<StockRule>(
|
70
|
+
const [formModel, setFormModel] = useState<StockRule>({
|
71
|
+
enabled: true,
|
72
|
+
...model,
|
73
|
+
});
|
71
74
|
|
72
75
|
useEffect(() => {
|
73
76
|
if (model != null && Object.keys(model).length != 0) {
|
@@ -190,7 +193,7 @@ const StockRulesAddOrUpdate: React.FC<AddStockRuleProps> = ({
|
|
190
193
|
)
|
191
194
|
.catch();
|
192
195
|
},
|
193
|
-
[formModel, model, t]
|
196
|
+
[formModel, model, t, stockItemUuid]
|
194
197
|
);
|
195
198
|
|
196
199
|
return (
|
package/src/stock-items/add-stock-item/stock-item-units-edit/stock-item-units-edit.component.tsx
CHANGED
@@ -34,6 +34,7 @@ const StockItemUnitsEdit: React.FC<StockItemUnitsEditProps> = ({
|
|
34
34
|
return (
|
35
35
|
<>
|
36
36
|
<DispensingPackageMeasurement
|
37
|
+
dispensingUnitPackagingUoMUuid={stockItem?.purchasePriceUoMUuid}
|
37
38
|
name="dispensingUnitPackagingUoMUuid"
|
38
39
|
controllerName="dispensingUnitPackagingUoMUuid"
|
39
40
|
control={control}
|
@@ -51,6 +52,7 @@ const StockItemUnitsEdit: React.FC<StockItemUnitsEditProps> = ({
|
|
51
52
|
}
|
52
53
|
/>
|
53
54
|
<DispensingPackageMeasurement
|
55
|
+
dispensingUnitPackagingUoMUuid={stockItem?.purchasePriceUoMUuid}
|
54
56
|
name="defaultStockOperationsUoMUuid"
|
55
57
|
controllerName="defaultStockOperationsUoMUuid"
|
56
58
|
control={control}
|
@@ -84,6 +86,7 @@ const StockItemUnitsEdit: React.FC<StockItemUnitsEditProps> = ({
|
|
84
86
|
/>
|
85
87
|
)}
|
86
88
|
<DispensingPackageMeasurement
|
89
|
+
dispensingUnitPackagingUoMUuid={stockItem?.purchasePriceUoMUuid}
|
87
90
|
name="reorderLevelUoMUuid"
|
88
91
|
controllerName="reorderLevelUoMUuid"
|
89
92
|
control={control}
|
@@ -113,6 +116,7 @@ const StockItemUnitsEdit: React.FC<StockItemUnitsEditProps> = ({
|
|
113
116
|
/>
|
114
117
|
)}
|
115
118
|
<DispensingPackageMeasurement
|
119
|
+
dispensingUnitPackagingUoMUuid={stockItem?.purchasePriceUoMUuid}
|
116
120
|
name="purchasePriceUoMUuid"
|
117
121
|
controllerName="purchasePriceUoMUuid"
|
118
122
|
control={control}
|
@@ -0,0 +1,57 @@
|
|
1
|
+
import React, { ReactNode } from "react";
|
2
|
+
import { ComboBox } from "@carbon/react";
|
3
|
+
import { Control, Controller, FieldValues } from "react-hook-form";
|
4
|
+
import { useTranslation } from "react-i18next";
|
5
|
+
import { useStockTagLocations } from "../../../../stock-lookups/stock-lookups.resource";
|
6
|
+
|
7
|
+
interface TransactionsLocationsFilterProps<T> {
|
8
|
+
onLocationIdChange?: (location: string) => void;
|
9
|
+
title?: string;
|
10
|
+
placeholder?: string;
|
11
|
+
invalid?: boolean;
|
12
|
+
invalidText?: ReactNode;
|
13
|
+
|
14
|
+
// Control
|
15
|
+
controllerName: string;
|
16
|
+
name: string;
|
17
|
+
control: Control<FieldValues, T>;
|
18
|
+
}
|
19
|
+
|
20
|
+
const TransactionsLocationsFilter = <T,>(
|
21
|
+
props: TransactionsLocationsFilterProps<T>
|
22
|
+
) => {
|
23
|
+
const { t } = useTranslation();
|
24
|
+
const { stockLocations } = useStockTagLocations();
|
25
|
+
|
26
|
+
return (
|
27
|
+
<Controller
|
28
|
+
name={props.controllerName}
|
29
|
+
control={props.control}
|
30
|
+
render={({ field: { onChange, value, ref } }) => (
|
31
|
+
<ComboBox
|
32
|
+
titleText={props.title}
|
33
|
+
name={props.name}
|
34
|
+
control={props.control}
|
35
|
+
controllerName={props.controllerName}
|
36
|
+
id={props.name}
|
37
|
+
size={"md"}
|
38
|
+
items={stockLocations ?? []}
|
39
|
+
onChange={(data: { selectedItem }) => {
|
40
|
+
props.onLocationIdChange?.(data?.selectedItem?.id ?? "");
|
41
|
+
onChange(data?.selectedItem?.name || "");
|
42
|
+
}}
|
43
|
+
initialSelectedItem={`${stockLocations[0]?.name}`}
|
44
|
+
itemToString={(item) => t("location", `${item?.name}`)}
|
45
|
+
shouldFilterItem={() => true}
|
46
|
+
placeholder={props.placeholder}
|
47
|
+
ref={ref}
|
48
|
+
value={value}
|
49
|
+
invalid={props.invalid}
|
50
|
+
invalidText={props.invalidText}
|
51
|
+
/>
|
52
|
+
)}
|
53
|
+
/>
|
54
|
+
);
|
55
|
+
};
|
56
|
+
|
57
|
+
export default TransactionsLocationsFilter;
|
@@ -1,14 +1,26 @@
|
|
1
|
-
import React, { useEffect, useMemo } from "react";
|
1
|
+
import React, { useEffect, useMemo, useState } from "react";
|
2
2
|
import { ResourceRepresentation } from "../../../core/api/api";
|
3
3
|
import { useStockItemsTransactions } from "./transactions.resource";
|
4
|
-
import {
|
5
|
-
|
4
|
+
import {
|
5
|
+
DataTableSkeleton,
|
6
|
+
Tile,
|
7
|
+
DatePicker,
|
8
|
+
DatePickerInput,
|
9
|
+
} from "@carbon/react";
|
10
|
+
import {
|
11
|
+
DATE_PICKER_CONTROL_FORMAT,
|
12
|
+
DATE_PICKER_FORMAT,
|
13
|
+
formatDisplayDate,
|
14
|
+
} from "../../../core/utils/datetimeUtils";
|
6
15
|
import { ArrowLeft } from "@carbon/react/icons";
|
7
16
|
import DataList from "../../../core/components/table/table.component";
|
8
17
|
import styles from "../../stock-items-table.scss";
|
9
|
-
import { URL_STOCK_OPERATION } from "../../../constants";
|
10
18
|
import { StockOperationType } from "../../../core/api/types/stockOperation/StockOperationType";
|
11
19
|
import EditStockOperationActionMenu from "../../../stock-operations/edit-stock-operation/edit-stock-operation-action-menu.component";
|
20
|
+
import TransactionsLocationsFilter from "./transaction-filters/transaction-locations-filter.component";
|
21
|
+
import { useForm } from "react-hook-form";
|
22
|
+
import { StockItemInventoryFilter } from "../../stock-items.resource";
|
23
|
+
import { useTranslation } from "react-i18next";
|
12
24
|
|
13
25
|
interface TransactionsProps {
|
14
26
|
onSubmit?: () => void;
|
@@ -16,20 +28,29 @@ interface TransactionsProps {
|
|
16
28
|
}
|
17
29
|
|
18
30
|
const Transactions: React.FC<TransactionsProps> = ({ stockItemUuid }) => {
|
31
|
+
const { t } = useTranslation();
|
32
|
+
|
33
|
+
const [stockItemFilter, setStockItemFilter] =
|
34
|
+
useState<StockItemInventoryFilter>();
|
19
35
|
const {
|
20
36
|
isLoading,
|
21
37
|
items,
|
22
38
|
tableHeaders,
|
23
|
-
|
24
39
|
totalCount,
|
25
40
|
setCurrentPage,
|
26
41
|
setStockItemUuid,
|
27
|
-
|
42
|
+
setLocationUuid,
|
43
|
+
} = useStockItemsTransactions(stockItemFilter);
|
44
|
+
|
45
|
+
const [selectedFromDate, setSelectedFromDate] = useState(null);
|
46
|
+
const [selectedToDate, setSelectedToDate] = useState(null);
|
28
47
|
|
29
48
|
useEffect(() => {
|
30
49
|
setStockItemUuid(stockItemUuid);
|
31
50
|
}, [stockItemUuid, setStockItemUuid]);
|
32
51
|
|
52
|
+
const { control } = useForm({});
|
53
|
+
|
33
54
|
let operations: StockOperationType[] | null | undefined;
|
34
55
|
const tableRows = useMemo(() => {
|
35
56
|
return items?.map((stockItemTransaction) => ({
|
@@ -112,13 +133,13 @@ const Transactions: React.FC<TransactionsProps> = ({ stockItemUuid }) => {
|
|
112
133
|
stockItemTransaction?.quantity >= 0
|
113
134
|
? `${stockItemTransaction?.quantity?.toLocaleString()} ${
|
114
135
|
stockItemTransaction?.packagingUomName ?? ""
|
115
|
-
}`
|
136
|
+
} of ${stockItemTransaction.packagingUomFactor}`
|
116
137
|
: "",
|
117
138
|
out:
|
118
139
|
stockItemTransaction?.quantity < 0
|
119
140
|
? `${(-1 * stockItemTransaction?.quantity)?.toLocaleString()} ${
|
120
141
|
stockItemTransaction?.packagingUomName ?? ""
|
121
|
-
}`
|
142
|
+
} of ${stockItemTransaction.packagingUomFactor}`
|
122
143
|
: "",
|
123
144
|
}));
|
124
145
|
}, [items, operations]);
|
@@ -127,24 +148,43 @@ const Transactions: React.FC<TransactionsProps> = ({ stockItemUuid }) => {
|
|
127
148
|
return <DataTableSkeleton role="progressbar" />;
|
128
149
|
}
|
129
150
|
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
151
|
+
const handleDateFilterChange = ([startDate, endDate]) => {
|
152
|
+
if (startDate) {
|
153
|
+
setSelectedFromDate(startDate);
|
154
|
+
if (selectedToDate && startDate && selectedToDate < startDate) {
|
155
|
+
setSelectedToDate(startDate);
|
156
|
+
}
|
157
|
+
}
|
158
|
+
if (endDate) {
|
159
|
+
setSelectedToDate(endDate);
|
160
|
+
if (selectedFromDate && endDate && selectedFromDate > endDate) {
|
161
|
+
setSelectedFromDate(endDate);
|
162
|
+
}
|
163
|
+
}
|
164
|
+
};
|
141
165
|
|
142
166
|
return (
|
143
|
-
<
|
144
|
-
|
145
|
-
<
|
146
|
-
|
147
|
-
|
167
|
+
<DataList
|
168
|
+
children={() => (
|
169
|
+
<div style={{ display: "flex", justifyContent: "space-between" }}>
|
170
|
+
<TransactionsLocationsFilter
|
171
|
+
onLocationIdChange={(q) => {
|
172
|
+
setLocationUuid(q);
|
173
|
+
setStockItemFilter({ ...stockItemFilter, locationUuid: q });
|
174
|
+
}}
|
175
|
+
name={"TransactionLocationUuid"}
|
176
|
+
placeholder={t("filterByLocation", "Filter by Location")}
|
177
|
+
control={control}
|
178
|
+
controllerName="TransactionLocationUuid"
|
179
|
+
/>
|
180
|
+
</div>
|
181
|
+
)}
|
182
|
+
columns={tableHeaders}
|
183
|
+
data={tableRows}
|
184
|
+
totalItems={totalCount}
|
185
|
+
goToPage={setCurrentPage}
|
186
|
+
hasToolbar={true}
|
187
|
+
/>
|
148
188
|
);
|
149
189
|
};
|
150
190
|
|
@@ -5,13 +5,13 @@ import {
|
|
5
5
|
useStockItemTransactions,
|
6
6
|
} from "../../stock-items.resource";
|
7
7
|
|
8
|
-
export function useStockItemsTransactions(
|
8
|
+
export function useStockItemsTransactions(filter?: StockItemInventoryFilter) {
|
9
9
|
const [stockItemFilter, setStockItemFilter] =
|
10
10
|
useState<StockItemInventoryFilter>({
|
11
11
|
startIndex: 0,
|
12
|
-
v: v || ResourceRepresentation.Default,
|
12
|
+
v: filter?.v || ResourceRepresentation.Default,
|
13
13
|
limit: 10,
|
14
|
-
q:
|
14
|
+
q: filter?.q,
|
15
15
|
totalCount: true,
|
16
16
|
});
|
17
17
|
|
@@ -21,10 +21,16 @@ export function useStockItemsTransactions(v?: ResourceRepresentation) {
|
|
21
21
|
|
22
22
|
const [currentPage, setCurrentPage] = useState(1);
|
23
23
|
|
24
|
-
const [stockItemUuid, setStockItemUuid] = useState<string | null>(
|
25
|
-
|
26
|
-
|
27
|
-
const [
|
24
|
+
const [stockItemUuid, setStockItemUuid] = useState<string | null>(
|
25
|
+
filter?.stockItemUuid
|
26
|
+
);
|
27
|
+
const [partyUuid, setPartyUuid] = useState<string | null>(filter?.partyUuid);
|
28
|
+
const [locationUuid, setLocationUuid] = useState<string | null>(
|
29
|
+
filter?.locationUuid
|
30
|
+
);
|
31
|
+
const [stockBatchUuid, setStockBatchUuid] = useState<string | null>(
|
32
|
+
filter?.stockBatchUuid
|
33
|
+
);
|
28
34
|
|
29
35
|
useEffect(() => {
|
30
36
|
setStockItemFilter({
|
@@ -17,9 +17,11 @@ import {
|
|
17
17
|
TableToolbarSearch,
|
18
18
|
Tile,
|
19
19
|
Tooltip,
|
20
|
+
TableToolbarAction,
|
21
|
+
TableToolbarMenu,
|
20
22
|
} from "@carbon/react";
|
21
23
|
import { Edit } from "@carbon/react/icons";
|
22
|
-
import { isDesktop } from "@openmrs/esm-framework";
|
24
|
+
import { isDesktop, restBaseUrl } from "@openmrs/esm-framework";
|
23
25
|
import React, { useMemo, useState, useEffect } from "react";
|
24
26
|
import { useTranslation } from "react-i18next";
|
25
27
|
import { ResourceRepresentation } from "../core/api/api";
|
@@ -31,6 +33,7 @@ import styles from "./stock-items-table.scss";
|
|
31
33
|
import AddStockItemsBulktImportActionButton from "./add-bulk-stock-item/add-stock-items-bulk-import-action-button.component";
|
32
34
|
import EditStockItemActionsMenu from "./edit-stock-item/edit-stock-item-action-menu.component";
|
33
35
|
import { useDebounce } from "../core/hooks/debounce-hook";
|
36
|
+
import { handleMutate } from "../utils";
|
34
37
|
|
35
38
|
interface StockItemsTableProps {
|
36
39
|
from?: string;
|
@@ -40,6 +43,10 @@ const StockItemsTableComponent: React.FC<StockItemsTableProps> = () => {
|
|
40
43
|
const { t } = useTranslation();
|
41
44
|
const [searchInput, setSearchInput] = useState("");
|
42
45
|
|
46
|
+
const handleRefresh = () => {
|
47
|
+
handleMutate(`${restBaseUrl}/stockmanagement/stockitem`);
|
48
|
+
};
|
49
|
+
|
43
50
|
const {
|
44
51
|
isLoading,
|
45
52
|
items,
|
@@ -201,6 +208,11 @@ const StockItemsTableComponent: React.FC<StockItemsTableProps> = () => {
|
|
201
208
|
changeFilterType={setDrug}
|
202
209
|
/>
|
203
210
|
<AddStockItemsBulktImportActionButton />
|
211
|
+
<TableToolbarMenu>
|
212
|
+
<TableToolbarAction onClick={handleRefresh}>
|
213
|
+
Refresh
|
214
|
+
</TableToolbarAction>
|
215
|
+
</TableToolbarMenu>
|
204
216
|
<AddStockItemActionButton />
|
205
217
|
</TableToolbarContent>
|
206
218
|
</TableToolbar>
|
@@ -2,89 +2,98 @@
|
|
2
2
|
@use '@carbon/styles/scss/type';
|
3
3
|
@import "~@openmrs/esm-styleguide/src/vars";
|
4
4
|
@import '../root.scss';
|
5
|
+
|
5
6
|
.headerBtnContainer {
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
background-color: $ui-background;
|
8
|
+
padding: spacing.$spacing-05;
|
9
|
+
text-align: right;
|
10
|
+
}
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
.tileContent {
|
23
|
-
display: flex;
|
24
|
-
flex-direction: column;
|
25
|
-
align-items: center;
|
26
|
-
}
|
27
|
-
.content {
|
28
|
-
@include type.type-style('heading-compact-02');
|
29
|
-
color: $text-02;
|
30
|
-
margin-bottom: 0.5rem;
|
31
|
-
}
|
32
|
-
|
33
|
-
.helper {
|
34
|
-
@include type.type-style('body-compact-01');
|
35
|
-
color: $text-02;
|
36
|
-
}
|
37
|
-
|
38
|
-
.separator {
|
39
|
-
@include type.type-style('body-compact-02');
|
40
|
-
color: $text-02;
|
41
|
-
width: 80%;
|
42
|
-
margin: 1.5rem auto;
|
43
|
-
overflow: hidden;
|
44
|
-
text-align: center;
|
45
|
-
|
46
|
-
&::before,
|
47
|
-
&::after {
|
48
|
-
background-color: $text-03;
|
49
|
-
content: '';
|
50
|
-
display: inline-block;
|
51
|
-
height: 1px;
|
52
|
-
position: relative;
|
53
|
-
vertical-align: middle;
|
54
|
-
width: 50%;
|
55
|
-
}
|
56
|
-
|
57
|
-
&::before {
|
58
|
-
right: 0.5rem;
|
59
|
-
margin-left: -50%;
|
60
|
-
}
|
61
|
-
|
62
|
-
&::after {
|
63
|
-
left: 0.5rem;
|
64
|
-
margin-right: -50%;
|
65
|
-
}
|
66
|
-
}
|
12
|
+
.tileContainer {
|
13
|
+
background-color: $ui-02;
|
14
|
+
border-top: 1px solid $ui-03;
|
15
|
+
padding: 5rem 0;
|
16
|
+
}
|
17
|
+
|
18
|
+
.tile {
|
19
|
+
margin: auto;
|
20
|
+
width: fit-content;
|
21
|
+
}
|
67
22
|
|
68
|
-
|
69
|
-
|
70
|
-
|
23
|
+
.tileContent {
|
24
|
+
display: flex;
|
25
|
+
flex-direction: column;
|
26
|
+
align-items: center;
|
27
|
+
}
|
28
|
+
|
29
|
+
.content {
|
30
|
+
@include type.type-style('heading-compact-02');
|
31
|
+
color: $text-02;
|
32
|
+
margin-bottom: 0.5rem;
|
33
|
+
}
|
34
|
+
|
35
|
+
.helper {
|
36
|
+
@include type.type-style('body-compact-01');
|
37
|
+
color: $text-02;
|
38
|
+
}
|
39
|
+
|
40
|
+
.separator {
|
41
|
+
@include type.type-style('body-compact-02');
|
42
|
+
color: $text-02;
|
43
|
+
width: 80%;
|
44
|
+
margin: 1.5rem auto;
|
45
|
+
overflow: hidden;
|
46
|
+
text-align: center;
|
47
|
+
|
48
|
+
&::before,
|
49
|
+
&::after {
|
50
|
+
background-color: $text-03;
|
51
|
+
content: '';
|
52
|
+
display: inline-block;
|
53
|
+
height: 1px;
|
54
|
+
position: relative;
|
55
|
+
vertical-align: middle;
|
56
|
+
width: 50%;
|
71
57
|
}
|
72
58
|
|
73
|
-
|
74
|
-
|
75
|
-
|
59
|
+
&::before {
|
60
|
+
right: 0.5rem;
|
61
|
+
margin-left: -50%;
|
76
62
|
}
|
77
|
-
|
78
|
-
|
79
|
-
|
63
|
+
|
64
|
+
&::after {
|
65
|
+
left: 0.5rem;
|
66
|
+
margin-right: -50%;
|
80
67
|
}
|
81
|
-
|
82
|
-
|
68
|
+
}
|
69
|
+
|
70
|
+
.toolbarContent {
|
71
|
+
display: flex;
|
72
|
+
align-items: center;
|
73
|
+
}
|
74
|
+
|
75
|
+
.filterContainer {
|
76
|
+
display: flex;
|
77
|
+
align-items: center;
|
78
|
+
}
|
79
|
+
|
80
|
+
.dateAlign {
|
81
|
+
padding-top: spacing.$spacing-03;
|
82
|
+
height: 100%;
|
83
|
+
}
|
84
|
+
|
85
|
+
.filtersAlign {
|
86
|
+
padding-bottom: spacing.$spacing-03;
|
83
87
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
}
|
88
|
+
:global(.cds--list-box__menu) {
|
89
|
+
min-width: 15rem;
|
90
|
+
z-index: 1;
|
88
91
|
}
|
89
|
-
|
92
|
+
}
|
90
93
|
|
94
|
+
.filterContainer {
|
95
|
+
display: flex;
|
96
|
+
align-items: center;
|
97
|
+
justify-content: space-between;
|
98
|
+
margin-bottom: spacing.$spacing-05;
|
99
|
+
}
|
@@ -321,12 +321,6 @@ export function useStockRules(filter: StockRuleFilter) {
|
|
321
321
|
Error
|
322
322
|
>(apiUrl, openmrsFetch);
|
323
323
|
|
324
|
-
// return {
|
325
|
-
// items: data.data ? data.data : [],
|
326
|
-
// isLoading,
|
327
|
-
// isError: error,
|
328
|
-
// };
|
329
|
-
|
330
324
|
return {
|
331
325
|
items: data?.data || <PageableResult<StockRule>>{},
|
332
326
|
isLoading,
|
@@ -15,6 +15,8 @@ import { useTranslation } from "react-i18next";
|
|
15
15
|
import { mutate } from "swr";
|
16
16
|
import NewLocationForm from "./add-locations-form.component";
|
17
17
|
import { Add } from "@carbon/react/icons";
|
18
|
+
import { handleMutate } from "../utils";
|
19
|
+
import { restBaseUrl } from "@openmrs/esm-framework";
|
18
20
|
|
19
21
|
interface StockLocationsTableProps {
|
20
22
|
status?: string;
|
@@ -30,7 +32,7 @@ const StockLocationsItems: React.FC<StockLocationsTableProps> = () => {
|
|
30
32
|
});
|
31
33
|
|
32
34
|
const handleRefresh = () => {
|
33
|
-
|
35
|
+
handleMutate(`${restBaseUrl}/Location?_summary=data`);
|
34
36
|
};
|
35
37
|
|
36
38
|
const createStockLocation = () => {
|
@@ -32,9 +32,8 @@ const BatchNoSelector = <T,>(props: BatchNoSelectorProps<T>) => {
|
|
32
32
|
) ?? "",
|
33
33
|
[stockItemBatchNos, props.batchUuid]
|
34
34
|
);
|
35
|
-
|
36
|
-
|
37
|
-
);
|
35
|
+
|
36
|
+
const { items, setStockItemUuid } = useStockItemBatchInformationHook();
|
38
37
|
|
39
38
|
useEffect(() => {
|
40
39
|
setStockItemUuid(props.stockItemUuid);
|
@@ -28,6 +28,8 @@ import {
|
|
28
28
|
OverflowMenuItem,
|
29
29
|
DatePickerInput,
|
30
30
|
DatePicker,
|
31
|
+
TableToolbarMenu,
|
32
|
+
TableToolbarAction,
|
31
33
|
} from "@carbon/react";
|
32
34
|
import { ArrowRight } from "@carbon/react/icons";
|
33
35
|
import { formatDisplayDate } from "../core/utils/datetimeUtils";
|
@@ -64,6 +66,9 @@ interface StockOperationsTableProps {
|
|
64
66
|
|
65
67
|
const StockOperations: React.FC<StockOperationsTableProps> = () => {
|
66
68
|
const { t } = useTranslation();
|
69
|
+
const handleRefresh = () => {
|
70
|
+
handleMutate(`${restBaseUrl}/stockmanagement/stockoperation`);
|
71
|
+
};
|
67
72
|
const operation: StockOperationType = useMemo(
|
68
73
|
() => ({
|
69
74
|
uuid: "",
|
@@ -434,6 +439,11 @@ const StockOperations: React.FC<StockOperationsTableProps> = () => {
|
|
434
439
|
onFilterChange={handleOnFilterChange}
|
435
440
|
/>
|
436
441
|
</div>
|
442
|
+
<TableToolbarMenu>
|
443
|
+
<TableToolbarAction onClick={handleRefresh}>
|
444
|
+
Refresh
|
445
|
+
</TableToolbarAction>
|
446
|
+
</TableToolbarMenu>
|
437
447
|
|
438
448
|
<StockOperationTypesSelector
|
439
449
|
onOperationTypeSelected={(operation) => {
|
@@ -18,8 +18,10 @@ import {
|
|
18
18
|
Tile,
|
19
19
|
Button,
|
20
20
|
InlineLoading,
|
21
|
+
TableToolbarMenu,
|
22
|
+
TableToolbarAction,
|
21
23
|
} from "@carbon/react";
|
22
|
-
import { isDesktop } from "@openmrs/esm-framework";
|
24
|
+
import { isDesktop, restBaseUrl } from "@openmrs/esm-framework";
|
23
25
|
import NewReportActionButton from "./new-report-button.component";
|
24
26
|
import styles from "./stock-reports.scss";
|
25
27
|
import { useGetReports } from "../stock-reports.resource";
|
@@ -41,9 +43,14 @@ import {
|
|
41
43
|
View,
|
42
44
|
WarningAltFilled,
|
43
45
|
} from "@carbon/react/icons";
|
46
|
+
import { handleMutate } from "../../utils";
|
44
47
|
|
45
48
|
const StockReports: React.FC = () => {
|
46
49
|
const { t } = useTranslation();
|
50
|
+
|
51
|
+
const handleRefresh = () => {
|
52
|
+
handleMutate(`${restBaseUrl}/stockmanagement/report?v=default`);
|
53
|
+
};
|
47
54
|
const {
|
48
55
|
reports,
|
49
56
|
isLoading,
|
@@ -237,6 +244,11 @@ const StockReports: React.FC = () => {
|
|
237
244
|
>
|
238
245
|
<TableToolbarContent className={styles.toolbarContent}>
|
239
246
|
<TableToolbarSearch persistent onChange={onInputChange} />
|
247
|
+
<TableToolbarMenu>
|
248
|
+
<TableToolbarAction onClick={handleRefresh}>
|
249
|
+
Refresh
|
250
|
+
</TableToolbarAction>
|
251
|
+
</TableToolbarMenu>
|
240
252
|
<NewReportActionButton />
|
241
253
|
</TableToolbarContent>
|
242
254
|
</TableToolbar>
|