Skip to content

Commit

Permalink
there is a error in ategory
Browse files Browse the repository at this point in the history
  • Loading branch information
TheTharz committed Jun 17, 2024
1 parent f870728 commit a54a671
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ const ConfirmPaymentPopUp = () => {
className='signup_button w-28 rounded-full'
onClick={confirmClick}
>
Pay
{loading ? 'Wait...' : 'Pay'}
</button>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,12 @@ const Medicine = () => {
</td>
<td className='px-6 py-4'>{cashier.status}</td>
<td className='px-6 py-4'>
<CountRoundButton
onClick={() => handleAddClick(cashier)}
icon={<IoIosAdd />}
/>
{cashier.quantity > 0 && (
<CountRoundButton
onClick={() => handleAddClick(cashier)}
icon={<IoIosAdd />}
/>
)}
</td>
</tr>
))}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ const MedicineGrid = () => {

const handleAddAmount = (index: number) => {
const updatedMedicines = [...orderedMedicine];
console.log(updatedMedicines);
console.log(filteredMedicine);

if (updatedMedicines[index].availableQuantity > 0) {
updatedMedicines[index].amount += 1;
Expand Down
8 changes: 6 additions & 2 deletions src/features/cashier-dashboard/services/ItemService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { mapIItemsToIMedicine } from '../utils/mapIItemsToIMedicine';
import { useUserContext } from '../../../context/UserContext';
import { toast } from 'react-toastify';
import { IMedicine } from '../../../interfaces/IMedicine';
import { usePaymentContext } from '../layout/MainCashierDashboard';

const useItemService = () => {
const http = useAxiosInstance();
Expand All @@ -24,10 +25,13 @@ const useItemService = () => {
// }
// };
const user = useUserContext();
const [medicine, setMedicine] = useState<IMedicine[]>([]);
const [filteredMedicine, setFilteredMedicine] = useState<IMedicine[]>([]);
// const [medicine, setMedicine] = useState<IMedicine[]>([]);
// const [filteredMedicine, setFilteredMedicine] = useState<IMedicine[]>([]);
const [loading, setLoading] = useState<boolean>(false);

const { setMedicine, medicine, setFilteredMedicine, filteredMedicine } =
usePaymentContext();

const getAllItems = async () => {
try {
if (!user) {
Expand Down
4 changes: 2 additions & 2 deletions src/features/cashier-dashboard/services/OrderService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ const useOrderService = () => {
paymentDetails: paymentDetails,
});
console.log(res);
setLoading(false);
// Display success toast
toast.success('Order placed successfully!');

Expand All @@ -43,10 +42,11 @@ const useOrderService = () => {
return res.data;
} catch (error) {
console.log(error);
setLoading(false);
toast.error('Error with the server: ' + (error as Error).message);

return error;
} finally {
setLoading(false);
}
};

Expand Down

0 comments on commit a54a671

Please sign in to comment.