Skip to content

Commit

Permalink
Merge pull request #58 from Life-Pill/dev-test-frontend
Browse files Browse the repository at this point in the history
pharmacy details updated
  • Loading branch information
TheTharz committed Jun 26, 2024
2 parents 9511f0e + 75f3195 commit 2aba498
Show file tree
Hide file tree
Showing 7 changed files with 187 additions and 165 deletions.
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
import { useState } from 'react';
import useAxiosInstance from '../../login/services/useAxiosInstance';
import { BranchSalesDetails } from '../interfaces/BranchSaleDetails';
import { useUserContext } from '../../../context/UserContext';

const useSalesSummary = () => {
const http = useAxiosInstance();
const [loading, setLoading] = useState(false);
const [salesSummary, setSalesSummary] = useState<BranchSalesDetails[]>([]);

const user = useUserContext();
const getSalesSummary = async () => {
setLoading(true);
try {
const response = await http.get('/branch-summary/sales-summary/daily/3');
const response = await http.get(
`/branch-summary/sales-summary/daily/${user.user?.branchId}`
);
console.log(response.data.data);
setSalesSummary(response.data.data);
setLoading(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
ComponentState,
usePaymentContext,
} from '../../layout/MainCashierDashboard';
import { toast } from 'react-toastify';

const PaymentDrawer = () => {
const { setCurrentComponent, paymentDetails, setPaymentDetails } =
Expand Down Expand Up @@ -50,6 +51,10 @@ const PaymentDrawer = () => {
// Popup state here

const footerButtonClick = () => {
if (paymentDetails.paidAmount < paymentDetails.paymentAmount) {
toast.warn('Payment amount is less than total amount');
return;
}
setCurrentComponent(ComponentState.PopupPayment);
};

Expand Down
14 changes: 6 additions & 8 deletions src/features/cashier-dashboard/services/AuthService.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const useAuthService = () => {
if (confirm) {
try {
setLogging(true);
const res = await http.post('/session/logout/permanent', {
const res = await http.post('/auth/logout', {
username: user.user?.employerEmail,
});

Expand All @@ -41,14 +41,12 @@ const useAuthService = () => {
if (confirm) {
try {
setTemporaryLogout(true);
const res = await http.post('/session/logout/temporary', {
username: user.user?.employerEmail,
});
// const res = await http.post('/session/logout/temporary', {
// username: user.user?.employerEmail,
// });

if (res.status === 200) {
toast.success('Logged out successfully');
navigate('/temporary-logout');
}
toast.success('Logged out successfully');
navigate('/temporary-logout');
} catch (error) {
console.log(error);
} finally {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const useOnlineOrderService = () => {
try {
setLoadingOnlineOrders(true);
const res = await axios.get(
`http://52.200.74.128/prescriptionOrders/myOrders/${user.user?.branchId}`
`http://44.196.149.99/prescriptionOrders/myOrders/${user.user?.branchId}`
);
const orders: OnlineOrder[] = res.data;
setOnlineOrders(orders);
Expand All @@ -35,7 +35,7 @@ const useOnlineOrderService = () => {
const imagesPromises = orders.map((order) =>
axios
.get(
`http://52.200.74.128/prescriptionImages/${order.prescriptionId}`,
`http://44.196.149.99/prescriptionImages/${order.prescriptionId}`,
{
responseType: 'arraybuffer',
}
Expand Down Expand Up @@ -65,7 +65,7 @@ const useOnlineOrderService = () => {
console.log(messages[orderId]);
try {
const res = await axios.put(
`http://52.200.74.128/prescriptionOrders/${orderId}/${user.user?.branchId}`,
`http://44.196.149.99/prescriptionOrders/${orderId}/${user.user?.branchId}`,
messages[orderId],
{
headers: {
Expand Down
Loading

0 comments on commit 2aba498

Please sign in to comment.