diff options
Diffstat (limited to 'src/modules/result')
| -rw-r--r-- | src/modules/result/components/Table.tsx | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/modules/result/components/Table.tsx b/src/modules/result/components/Table.tsx index 20cc2d6..082f988 100644 --- a/src/modules/result/components/Table.tsx +++ b/src/modules/result/components/Table.tsx @@ -76,6 +76,13 @@ const Table = () => { stockOpnames.refetch() } + const recompute = async (productId: number, companyId: string) => { + const response = await fetch(`/api/company/${companyId}/product/${productId}/compute-different`, { method: 'POST' }) + const stockOpname = await response.json() + toast(`Berhasil menghitung ulang status barang, hasilnya ${stockOpname.data.isDifferent ? 'selisih' : 'aman'}`) + stockOpnames.refetch() + } + const isLoading = stockOpnames.isLoading || stockOpnames.isRefetching const COL_LENGTH = 9 @@ -149,6 +156,9 @@ const Table = () => { </Button> </DropdownTrigger> <DropdownMenu> + <DropdownItem key="recompute" onPress={() => recompute(stockOpname.id, company)}> + Re-compute + </DropdownItem> <DropdownItem key="toggleDifferent" onPress={() => toggleDifferent(stockOpname.id)}> Tandai {stockOpname.isDifferent ? 'aman' : 'selisih'} </DropdownItem> |
