summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src-migrate/pages/shop/cart/index.tsx39
-rw-r--r--src-migrate/types/auth.ts4
2 files changed, 26 insertions, 17 deletions
diff --git a/src-migrate/pages/shop/cart/index.tsx b/src-migrate/pages/shop/cart/index.tsx
index 4b4de92b..9866be46 100644
--- a/src-migrate/pages/shop/cart/index.tsx
+++ b/src-migrate/pages/shop/cart/index.tsx
@@ -16,13 +16,17 @@ import Image from '~/components/ui/image';
const CartPage = () => {
const auth = getAuth();
+ const [isStepApproval, setIsStepApproval] = React.useState(false);
const { loadCart, cart, summary } = useCartStore();
const useDivvice = useDevice();
useEffect(() => {
- if (typeof auth === 'object' && !cart) loadCart(auth.id);
+ if (typeof auth === 'object' && !cart) {
+ loadCart(auth.id);
+ setIsStepApproval(auth?.feature?.soApproval);
+ }
}, [auth, loadCart, cart]);
const hasSelectedPromo = useMemo(() => {
@@ -123,23 +127,24 @@ const CartPage = () => {
Quotation
</Button>
</Tooltip>
-
- <Tooltip
- label={clsxm({
- 'Tidak ada item yang dipilih': !hasSelected,
- 'Terdapat item yang tidak ada harga': hasSelectNoPrice,
- })}
- >
- <Button
- colorScheme='red'
- w='full'
- isDisabled={!hasSelected || hasSelectNoPrice}
- as={Link}
- href='/shop/checkout'
+ {!isStepApproval && (
+ <Tooltip
+ label={clsxm({
+ 'Tidak ada item yang dipilih': !hasSelected,
+ 'Terdapat item yang tidak ada harga': hasSelectNoPrice,
+ })}
>
- Checkout
- </Button>
- </Tooltip>
+ <Button
+ colorScheme='red'
+ w='full'
+ isDisabled={!hasSelected || hasSelectNoPrice}
+ as={Link}
+ href='/shop/checkout'
+ >
+ Checkout
+ </Button>
+ </Tooltip>
+ )}
</div>
</div>
</div>
diff --git a/src-migrate/types/auth.ts b/src-migrate/types/auth.ts
index 02e3623d..e93a475a 100644
--- a/src-migrate/types/auth.ts
+++ b/src-migrate/types/auth.ts
@@ -15,6 +15,10 @@ export type AuthProps = {
company: boolean;
pricelist: string | null;
token: string;
+ feature : {
+ onlyReadyStock : boolean,
+ soApproval : boolean
+ }
};
export type AuthApiProps = OdooApiRes<AuthProps>;