diff --git a/src/layouts/mainLayout/components/Header.jsx b/src/layouts/mainLayout/components/Header.jsx index ea47174..40c9d4c 100644 --- a/src/layouts/mainLayout/components/Header.jsx +++ b/src/layouts/mainLayout/components/Header.jsx @@ -24,7 +24,7 @@ function Header() { {user?.userType == USER_ROLES.SUPER_ADMIN.toLowerCase() ? null : `Welcome to ${user?.created_clinics?.[0]?.name}`} - + {/* */} { .catch((err) => reject(err)); }); }; + +export const createClinicOffer = (data) => { + const url = `/admin/clinic/offer`; + return new Promise((resolve, reject) => { + axiosInstance + .post(url, data) + .then((response) => resolve(response)) + .catch((err) => reject(err)); + }); +}; + +export const getClinicOffer = (params) => { + + let searchParams = new URLSearchParams(); + searchParams.append("size", params?.pagination?.pageSize ?? 10); + searchParams.append("page", params?.pagination.pageIndex ?? 0); + searchParams.append("search", params?.globalFilter ?? ""); + + const url = `/admin/clinic/offers?${searchParams.toString()}`; + return new Promise((resolve, reject) => { + axiosInstance + .get(url) + .then((response) => resolve(response)) + .catch((err) => reject(err)); + }); +}; + +export const updateClinicOffer = (data) => { + const url = `/admin/clinic/offer`; + return new Promise((resolve, reject) => { + axiosInstance + .put(url, data) + .then((response) => resolve(response)) + .catch((err) => reject(err)); + }); +}; + +export const deleteClinicOffer = (id) => { + const url = `/admin/clinic/offer/${id}`; + return new Promise((resolve, reject) => { + axiosInstance + .delete(url) + .then((response) => resolve(response)) + .catch((err) => reject(err)); + }); +}; diff --git a/src/services/masterData.services.js b/src/services/masterData.services.js new file mode 100644 index 0000000..e7c40df --- /dev/null +++ b/src/services/masterData.services.js @@ -0,0 +1,35 @@ +import { axiosInstance } from "../config/api"; + +export const getMasterData = (params) => { + let searchParams = new URLSearchParams(); + searchParams.append("search", params?.globalFilter ?? ""); + + const url = `/admin/master-data?${searchParams.toString()}`; + + return new Promise((resolve, reject) => { + axiosInstance + .get(url) + .then((response) => resolve(response)) + .catch((err) => reject(err)); + }); +}; + +export const setMasterData = (data) => { + const url = "/admin/master-data"; + return new Promise((resolve, reject) => { + axiosInstance + .post(url, data) + .then((response) => resolve(response)) + .catch((err) => reject(err)); + }); +}; + +export const updateMasterData = (data) => { + const url = "/admin/master-data"; + return new Promise((resolve, reject) => { + axiosInstance + .put(url, data) + .then((response) => resolve(response)) + .catch((err) => reject(err)); + }); +}; diff --git a/src/utils/regex.js b/src/utils/regex.js index e17f2c0..58d771c 100644 --- a/src/utils/regex.js +++ b/src/utils/regex.js @@ -9,3 +9,5 @@ export const passwordNumberRegex = /\d/; // passwordSpacesRegex.js export const passwordSpacesRegex = /^\S.*\S$/; + +export const emailRegex = /^\S+@\S+\.\S+$/; \ No newline at end of file diff --git a/src/views/ClinicsList/index.jsx b/src/views/ClinicsList/index.jsx index 6ba0c42..924ab9a 100644 --- a/src/views/ClinicsList/index.jsx +++ b/src/views/ClinicsList/index.jsx @@ -249,7 +249,7 @@ const ClinicsList = () => { [ // ..............sro number column...................... { - size: 60, + size: 100, header: "Sr. No.", Cell: (props) => { const tableState = props?.table?.getState(); @@ -330,68 +330,6 @@ const ClinicsList = () => { ); }, }, - // ........................... sent email column............................. - // { - // enableSorting: true, - // accessorKey: 'hasActiveCustomPlan', - // minSize: 250, - // header: 'Sent Mail', - // Cell: ({ row }) => ( - // <> - // {row?.original?.plans?.[0]?.status === - // PLAN_STATUS_TYPE.ACTIVATED && ( - //
- // handleRegisterEmailSent(row)} - // className={classes.sendEmailStatus} - // > - // Resend Subscription Mail - // - //
- // Last Sent On:{' '} - // {format( - // new Date(row?.original?.lastCustomPlanEmailSent), - // 'dd MMM yyyy' - // )} - //
- //
- // )} - // - // ), - // }, - - // ................add plan column.............................. - // { - // enableSorting: true, - // isBold: true, - // size: 120, - // accessorKey: 'hasActiveCustomPlan', - // header: 'Custom Plan', - // Cell: ({ row }) => ( - // <> - // {row?.original?.plans?.[0]?.status === - // PLAN_STATUS_TYPE.ACTIVATED ? ( - // - //
- // Plan Added - //
- //
- // ) : ( - // - // - // ADD PLAN - // - // - // )} - // - // ), - // }, ].filter(Boolean), [type] ); diff --git a/src/views/MasterData/index.jsx b/src/views/MasterData/index.jsx index cf3cd23..a6f4c10 100644 --- a/src/views/MasterData/index.jsx +++ b/src/views/MasterData/index.jsx @@ -1,61 +1,38 @@ import AddIcon from "@mui/icons-material/Add"; -import ArrowBackIosNewIcon from "@mui/icons-material/ArrowBackIosNew"; -import ArrowForwardIosIcon from "@mui/icons-material/ArrowForwardIos"; +import DescriptionIcon from '@mui/icons-material/Description'; import CloseIcon from "@mui/icons-material/Close"; import PersonAddIcon from "@mui/icons-material/PersonAdd"; -import SearchIcon from "@mui/icons-material/Search"; import { - Alert, Box, Button, - Container, Dialog, DialogActions, DialogContent, DialogTitle, Divider, IconButton, - InputAdornment, - Paper, - Snackbar, - Table, - TableBody, - TableCell, - TableContainer, - TableHead, - TableRow, TextField, Typography, } from "@mui/material"; -import React, { useState } from "react"; +import React, { useMemo, useRef, useState } from "react"; import CustomBreadcrumbs from "../../components/CustomBreadcrumbs"; import PageHeader from "../../components/PageHeader"; +import { pushNotification } from "../../utils/notification"; +import { NOTIFICATION } from "../../constants"; +import { useStyles } from "./masterDataStyles"; +import Table from "../../components/Table"; +import { getMasterData, setMasterData } from "../../services/masterData.services"; + const MasterDataManagement = () => { + const classes = useStyles(); + const ref = useRef(null); // State for form fields - const [appointmentType, setAppointmentType] = useState(""); - const queryParams = new URLSearchParams(location.search); + const [type, setType] = useState(""); - // State for staff list - const [staffList, setStaffList] = useState([]); - - // State for staff dialog + // State for dialog const [openDialog, setOpenDialog] = useState(false); - // State for search - const [searchQuery, setSearchQuery] = useState(""); - - // State for pagination - const [page, setPage] = useState(1); - const rowsPerPage = 10; - - // State for notification - const [notification, setNotification] = useState({ - open: false, - message: "", - severity: "success", - }); - - // Handle staff dialog open/close + // Handle dialog open/close const handleOpenDialog = () => { setOpenDialog(true); }; @@ -63,38 +40,50 @@ const MasterDataManagement = () => { const handleCloseDialog = () => { setOpenDialog(false); // Clear form - setAppointmentType(""); + setType(""); }; // Handle form submission - const handleSubmit = (e) => { + const handleSubmit = async (e) => { e.preventDefault(); - // Add new staff member - const newStaff = { - id: staffList.length + 1, - appointmentType, + const payload = { + type, }; - setStaffList([...staffList, newStaff]); + const response = await setMasterData(payload); + + if (response?.data?.data) { + pushNotification("Master Data created successfully!", NOTIFICATION.SUCCESS); + } else { + pushNotification(response?.data?.message, NOTIFICATION.ERROR); + } // Close dialog handleCloseDialog(); - - // Show success notification - setNotification({ - open: true, - message: "Staff member added successfully!", - severity: "success", - }); }; - // Handle notification close - const handleCloseNotification = () => { - setNotification({ - ...notification, - open: false, - }); + const getData = async (filters) => { + try { + // Remove the type parameter since it's not defined + let params = { + ...filters + }; + + const resp = await getMasterData(params); + console.log('API Response:', resp); + + return { + data: resp?.data?.data?.data, + rowCount: resp?.data?.data?.total || 0, + }; + } catch (error) { + console.error('Error fetching admins:', error); + return { + data: [], + rowCount: 0, + }; + } }; // ...................breadcrumbs array........................ @@ -109,244 +98,144 @@ const MasterDataManagement = () => { }, ]; + const columns = useMemo(() => [ + { + size: 100, + header: "Sr. No.", + Cell: (props) => { + const tableState = props?.table?.getState(); + const serialNumber = ( + props?.row?.index + + 1 + + tableState?.pagination?.pageIndex * tableState?.pagination?.pageSize + ) + ?.toString() + ?.padStart(2, "0"); + return {serialNumber}; + }, + enableSorting: false, + }, + { + id: "type", // Add an id to match the accessorKey + size: 280, + accessorKey: "type", + header: "Type", + enableColumnFilter: false, + } + // Removed the empty object that was causing the error + ]); + return ( - - - + + } + onAddButtonClick={handleOpenDialog} + /> - - - {/* Staff List Header with Add Button */} - - - Master Appointment Type List - - - - - - {/* Search Box */} - - setSearchQuery(e.target.value)} - InputProps={{ - startAdornment: ( - - - - ), - }} - sx={{ - backgroundColor: "#fff", - "& .MuiOutlinedInput-root": { - borderRadius: 2, - }, + + + { + + // }, + // text: "Remove", + // icon: ( + // + // // transaction history + // ), + // }, + // ]} /> - - {/* Staff List Table */} - -
- - - Sr. No. - - Appointment Type - - - - - {staffList.length > 0 ? ( - staffList - .filter((staff) => - `${staff.appointmentType}` - .toLowerCase() - .includes(searchQuery.toLowerCase()) - ) - .slice((page - 1) * rowsPerPage, page * rowsPerPage) - .map((staff, index) => ( - - - {(page - 1) * rowsPerPage + index + 1} - - {staff.appointmentType} - - )) - ) : ( - - - No Appointment Type added yet - - - )} - -
- - - {/* Pagination */} - {staffList.length > 0 && ( - + + + - + + + + Add Appointment Type + + + + + + + + + + + setType(e.target.value)} + placeholder="Appointment Type" + required + InputLabelProps={{ + shrink: true, + }} + /> + + + + - - - - )} -
- - - - {/* Add Staff Dialog */} - - - - - - Add New Appointment Type - - - - - - - - - - - - setAppointmentType(e.target.value)} - placeholder="Appointment Type" - required - InputLabelProps={{ - shrink: true, - }} - /> - - - - - - - - - {/* Notification */} - - - {notification.message} - - -
+ + +
+
); }; diff --git a/src/views/MasterData/masterDataStyles.js b/src/views/MasterData/masterDataStyles.js new file mode 100644 index 0000000..a2a130e --- /dev/null +++ b/src/views/MasterData/masterDataStyles.js @@ -0,0 +1,119 @@ +import makeStyles from '@mui/styles/makeStyles'; +import { pxToRem } from '../../theme/typography'; + +export const useStyles = makeStyles((theme) => ({ + chipClass: { + height: 'fit-content', + minHeight: '30px', + padding: '2px', + alignItems: 'center', + }, + statusColor: { + color: theme.palette.primary.main, + fontSize: pxToRem(10), + }, + tabsBox: { + display: 'flex', + justifyContent: ' space-around', + // width: '55%', + marginTop: theme.spacing(0.5), + marginRight: theme.spacing(5.0), + alignItems: 'center', + }, + secondaryButton: { + width: '200px', + height: '46px', + borderRadius: '8px', + justifyContent: 'space-evenly', + fontSize: pxToRem(16), + }, + tableActionIcons: { + marginRight: theme.spacing(1.4), + width: '15px', + }, + companyNameTableColumn: { + display: 'flex', + alignItems: 'center', + }, + companyName: { + marginLeft: theme.spacing(1), + fontSize: pxToRem(14), + objectFit: 'contain', + width: '260px', + }, + companyNameLink: { + textDecoration: 'none', + color: theme.palette.grey[10], + '&:hover': { + color: theme.palette.info.main, + textDecoration: 'underline', + }, + }, + companyWebsiteLabel: { + fontSize: pxToRem(12), + }, + companyNameLogo: { + height: '40px', + width: '40px', + borderRadius: theme.shape.borderRadiusComponent, + objectFit: 'contain', + }, + sendEmailStatus: { + fontSize: pxToRem(14), + color: theme.palette.primary.main, + }, + sendEmailLastSentMailDate: { + fontSize: pxToRem(12), + }, + addDiscountCodeLink: { + fontSize: pxToRem(12), + color: theme.palette.primary.main, + }, + addDiscountCodeLabel: { + fontSize: pxToRem(14), + backgroundColor: theme.palette.common.white, + color: theme.palette.common.black, + }, + customModel: { + display: 'flex', + flexDirection: 'column', + justifyContent: 'center', + alignItems: 'center', + height: '100%', + }, + customModelBox: { + paddingLeft: theme.spacing(5), + paddingRight: theme.spacing(5), + textAlign: 'center', + display: 'flex', + flexDirection: 'column', + justifyContent: 'center', + alignItems: 'center', + // height: '100%', + border: 'none', + }, + newPlanTitleText: { + fontSize: pxToRem(28), + fontFamily: theme.fontFamily.bold, + }, + newPlanSubTitleText: { + fontSize: pxToRem(18), + padding: theme.spacing(1), + }, + addPlanSuccessIcon: { + padding: theme.spacing(2), + paddingTop: theme.spacing(1), + }, + planAddedText: { + fontSize: pxToRem(12), + color: theme.palette.grey[54], + display: 'flex', + alignItems: 'center', + alignSelf: 'center', + }, + verifyIcon: { + marginLeft: theme.spacing(0.3), + fontSize: pxToRem(12), + color: theme.palette.grey[54], + }, +})); diff --git a/src/views/PaymentManagement/index.jsx b/src/views/PaymentManagement/index.jsx index 61a6405..6be4a6c 100644 --- a/src/views/PaymentManagement/index.jsx +++ b/src/views/PaymentManagement/index.jsx @@ -1,10 +1,10 @@ import AddIcon from "@mui/icons-material/Add"; +import EditIcon from "@mui/icons-material/Edit"; import CloseIcon from "@mui/icons-material/Close"; import { Box, Button, Checkbox, - Container, Dialog, DialogActions, DialogContent, @@ -13,113 +13,173 @@ import { IconButton, MenuItem, Paper, - Snackbar, - Alert, - Table, - TableBody, - TableCell, - TableContainer, - TableHead, - TableRow, TextField, Typography, + Divider, } from "@mui/material"; -import React, { useState } from "react"; +import React, { useMemo, useRef, useState } from "react"; import CustomBreadcrumbs from "../../components/CustomBreadcrumbs"; import PageHeader from "../../components/PageHeader"; +import { useStyles } from "./paymentStyles"; +import Table from "../../components/Table"; +import { getAdmins } from "../../services/auth.services"; +import { pushNotification } from "../../utils/notification"; +import { NOTIFICATION } from "../../constants"; +import { emailRegex } from "../../utils/regex"; +import { + createClinicOffer, + getClinicOffer, +} from "../../services/clinics.service"; const PaymentManagement = () => { + const classes = useStyles(); + const ref = useRef(null); + const tableRef = useRef(null); + // State for payment dialog const [paymentDialogOpen, setPaymentDialogOpen] = useState(false); const [paymentData, setPaymentData] = useState({ - clinicName: "", + clinicEmail: "", setupFeeWaived: false, specialOffer: false, - configurationMonth: 3 + configurationMonth: 3, }); - + // State for payments list const [paymentsList, setPaymentsList] = useState([]); const [editPaymentIndex, setEditPaymentIndex] = useState(null); - // State for notification - const [notification, setNotification] = useState({ - open: false, - message: "", - severity: "success", - }); + const handleSubmit = () => {}; + + const columns = useMemo(() => [ + { + size: 100, + header: "Sr. No.", + Cell: (props) => { + const tableState = props?.table?.getState(); + const serialNumber = ( + props?.row?.index + + 1 + + tableState?.pagination?.pageIndex * tableState?.pagination?.pageSize + ) + ?.toString() + ?.padStart(2, "0"); + return {serialNumber}; + }, + enableSorting: false, + }, + { + size: 260, + accessorKey: "clinic_email", + header: "Clinic Email", + enableColumnFilter: false, + }, + { + size: 200, + accessorKey: "setup_fees_waived", + header: "Setup Fees Waived", + Cell: (props) => (props.renderedCellValue ? "Yes" : "No"), + enableColumnFilter: false, + enableSorting: false, + }, + { + size: 200, + accessorKey: "special_offer_for_month", + header: "Special Offer For Month", + enableColumnFilter: false, + enableSorting: false, + }, + ]); + + const getData = async (filters) => { + try { + let params = { + ...filters, + }; + + const resp = await getClinicOffer(params); + console.log("API Response:", resp); + + return { + data: resp?.data?.data?.data, + rowCount: resp?.data?.total || 0, + }; + } catch (error) { + console.error("Error fetching admins:", error); + return { + data: [], + rowCount: 0, + }; + } + }; // Handle payment dialog submission - const handleAddPayment = () => { + const handleAddPayment = async () => { // Validate input - if (!paymentData.clinicName.trim()) { - setNotification({ - open: true, - message: "Please enter a clinic name", - severity: "error", - }); + if (!paymentData.clinicEmail.trim()) { + pushNotification("Please enter a clinic email", NOTIFICATION.ERROR); return; } - - if (editPaymentIndex !== null) { - // Update existing payment - const updatedPayments = [...paymentsList]; - updatedPayments[editPaymentIndex] = {...paymentData}; - setPaymentsList(updatedPayments); - - setNotification({ - open: true, - message: "Payment configuration updated successfully", - severity: "success", - }); - } else { - // Add new payment - setPaymentsList([...paymentsList, {...paymentData}]); - - setNotification({ - open: true, - message: "Payment configuration added successfully", - severity: "success", - }); + + if (!emailRegex.test(paymentData.clinicEmail)) { + pushNotification("Please enter a valid clinic email", NOTIFICATION.ERROR); + return; } - + + // either setup fees waived or special offer for month should be true + if (!paymentData.setupFeeWaived && !paymentData.specialOffer) { + pushNotification( + "Please select either setup fees waived or special offer for month", + NOTIFICATION.ERROR + ); + return; + } + + const payload = { + clinic_email: paymentData.clinicEmail, + setup_fees_waived: paymentData.setupFeeWaived, + special_offer_for_month: paymentData.specialOffer + ? paymentData.configurationMonth.toString() + : "0", + }; + + const resp = await createClinicOffer(payload); + console.log("API Response:", resp); + // Reset form and close dialog setPaymentData({ - clinicName: "", + clinicEmail: "", setupFeeWaived: false, specialOffer: false, - configurationMonth: 3 + configurationMonth: 3, }); setEditPaymentIndex(null); setPaymentDialogOpen(false); + + // Refresh the table data + if (tableRef.current) { + tableRef.current.reFetchData(); + pushNotification("Payment configuration added successfully", NOTIFICATION.SUCCESS); + } }; - + // Handle edit payment const handleEditPayment = (index) => { setEditPaymentIndex(index); - setPaymentData({...paymentsList[index]}); + setPaymentData({ ...paymentsList[index] }); setPaymentDialogOpen(true); }; - + // Handle delete payment const handleDeletePayment = (index) => { const updatedPayments = [...paymentsList]; updatedPayments.splice(index, 1); setPaymentsList(updatedPayments); - - setNotification({ - open: true, - message: "Payment configuration deleted successfully", - severity: "success", - }); - }; - // Handle notification close - const handleCloseNotification = () => { - setNotification({ - ...notification, - open: false, - }); + pushNotification( + "Payment configuration deleted successfully", + NOTIFICATION.SUCCESS + ); }; // Breadcrumbs @@ -129,202 +189,229 @@ const PaymentManagement = () => { ]; return ( - - - - - - - {/* Payment Management Header with Add Button */} - - - Payment Configurations - - - + <> + + } + onAddButtonClick={() => setPaymentDialogOpen(true)} + /> + + + + handleEditPayment(row), + text: "Edit", + icon: , + }, + ]} + /> + - {/* Payment List Table */} - -
- - - Clinic Name - Setup Fee Waived - Special Offer - Configuration Month - Actions - - - - {paymentsList.length > 0 ? ( - paymentsList.map((payment, index) => ( - - {payment.clinicName} - {payment.setupFeeWaived ? "Yes" : "No"} - {payment.specialOffer ? "Yes" : "No"} - - {payment.specialOffer ? payment.configurationMonth : "-"} - - - - - - - )) - ) : ( - - - No payment configurations found - - - )} - -
- -
- - {/* Payment Dialog */} - setPaymentDialogOpen(false)} - maxWidth="sm" - fullWidth - > - - {editPaymentIndex !== null ? "Edit Payment" : "Add New Payment"} - setPaymentDialogOpen(false)} + {/* Improved Dialog Box */} + setPaymentDialogOpen(false)} + maxWidth="sm" + fullWidth + PaperProps={{ + sx: { + borderRadius: "12px", + overflow: "hidden", + }, + }} + > + theme.palette.grey[500], + padding: "16px 24px", + backgroundColor: (theme) => theme.palette.primary.main, + color: "white", + fontWeight: "bold", + position: "relative", }} > - - - - - - setPaymentData({...paymentData, clinicName: e.target.value})} - sx={{ mb: 2 }} - /> - - setPaymentData({...paymentData, setupFeeWaived: e.target.checked})} - /> - } - label="Setup fee waived" - sx={{ mb: 1 }} - /> - - setPaymentData({...paymentData, specialOffer: e.target.checked})} - /> - } - label="Special Offer: First 3 months free" - sx={{ mb: 1 }} - /> - - {paymentData.specialOffer && ( + {editPaymentIndex !== null + ? "Edit Payment Configuration" + : "Add New Payment"} + setPaymentDialogOpen(false)} + sx={{ + position: "absolute", + right: 8, + top: 8, + color: "white", + }} + > + + + + + + + + Clinic Information + + setPaymentData({...paymentData, configurationMonth: e.target.value})} - sx={{ mt: 1 }} - > - {[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12].map((month) => ( - - {month} - - ))} - - )} - - - - - - - + value={paymentData.clinicEmail} + onChange={(e) => + setPaymentData({ + ...paymentData, + clinicEmail: e.target.value, + }) + } + sx={{ mb: 3 }} + /> - {/* Notification Snackbar */} - - - {notification.message} - - -
+ + Payment Options + + + theme.palette.grey[50], + p: 2, + mb: 2, + border: "1px solid", + borderColor: (theme) => theme.palette.grey[200], + borderRadius: "8px", + }} + > + + setPaymentData({ + ...paymentData, + setupFeeWaived: e.target.checked, + }) + } + color="primary" + /> + } + label={ + + Setup fee waived + + No initial setup fee will be charged + + + } + sx={{ mb: 1, display: "flex", alignItems: "flex-start" }} + /> + + + + + setPaymentData({ + ...paymentData, + specialOffer: e.target.checked, + }) + } + color="primary" + /> + } + label={ + + Special Offer + + First 3 months free of charge + + + } + sx={{ display: "flex", alignItems: "flex-start" }} + /> + + + {paymentData.specialOffer && ( + + setPaymentData({ + ...paymentData, + configurationMonth: parseInt(e.target.value), + }) + } + sx={{ mt: 1 }} + helperText="Number of months for special configuration" + > + {[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12].map((month) => ( + + {month} {month === 1 ? "month" : "months"} + + ))} + + )} + + + + theme.palette.grey[200], + justifyContent: "space-between", + }} + > + + + + + + ); }; -export default PaymentManagement; \ No newline at end of file +export default PaymentManagement; diff --git a/src/views/PaymentManagement/paymentStyles.js b/src/views/PaymentManagement/paymentStyles.js new file mode 100644 index 0000000..a2a130e --- /dev/null +++ b/src/views/PaymentManagement/paymentStyles.js @@ -0,0 +1,119 @@ +import makeStyles from '@mui/styles/makeStyles'; +import { pxToRem } from '../../theme/typography'; + +export const useStyles = makeStyles((theme) => ({ + chipClass: { + height: 'fit-content', + minHeight: '30px', + padding: '2px', + alignItems: 'center', + }, + statusColor: { + color: theme.palette.primary.main, + fontSize: pxToRem(10), + }, + tabsBox: { + display: 'flex', + justifyContent: ' space-around', + // width: '55%', + marginTop: theme.spacing(0.5), + marginRight: theme.spacing(5.0), + alignItems: 'center', + }, + secondaryButton: { + width: '200px', + height: '46px', + borderRadius: '8px', + justifyContent: 'space-evenly', + fontSize: pxToRem(16), + }, + tableActionIcons: { + marginRight: theme.spacing(1.4), + width: '15px', + }, + companyNameTableColumn: { + display: 'flex', + alignItems: 'center', + }, + companyName: { + marginLeft: theme.spacing(1), + fontSize: pxToRem(14), + objectFit: 'contain', + width: '260px', + }, + companyNameLink: { + textDecoration: 'none', + color: theme.palette.grey[10], + '&:hover': { + color: theme.palette.info.main, + textDecoration: 'underline', + }, + }, + companyWebsiteLabel: { + fontSize: pxToRem(12), + }, + companyNameLogo: { + height: '40px', + width: '40px', + borderRadius: theme.shape.borderRadiusComponent, + objectFit: 'contain', + }, + sendEmailStatus: { + fontSize: pxToRem(14), + color: theme.palette.primary.main, + }, + sendEmailLastSentMailDate: { + fontSize: pxToRem(12), + }, + addDiscountCodeLink: { + fontSize: pxToRem(12), + color: theme.palette.primary.main, + }, + addDiscountCodeLabel: { + fontSize: pxToRem(14), + backgroundColor: theme.palette.common.white, + color: theme.palette.common.black, + }, + customModel: { + display: 'flex', + flexDirection: 'column', + justifyContent: 'center', + alignItems: 'center', + height: '100%', + }, + customModelBox: { + paddingLeft: theme.spacing(5), + paddingRight: theme.spacing(5), + textAlign: 'center', + display: 'flex', + flexDirection: 'column', + justifyContent: 'center', + alignItems: 'center', + // height: '100%', + border: 'none', + }, + newPlanTitleText: { + fontSize: pxToRem(28), + fontFamily: theme.fontFamily.bold, + }, + newPlanSubTitleText: { + fontSize: pxToRem(18), + padding: theme.spacing(1), + }, + addPlanSuccessIcon: { + padding: theme.spacing(2), + paddingTop: theme.spacing(1), + }, + planAddedText: { + fontSize: pxToRem(12), + color: theme.palette.grey[54], + display: 'flex', + alignItems: 'center', + alignSelf: 'center', + }, + verifyIcon: { + marginLeft: theme.spacing(0.3), + fontSize: pxToRem(12), + color: theme.palette.grey[54], + }, +})); diff --git a/src/views/StaffManagement/index.jsx b/src/views/StaffManagement/index.jsx index 369a4dd..6c699d8 100644 --- a/src/views/StaffManagement/index.jsx +++ b/src/views/StaffManagement/index.jsx @@ -1,28 +1,15 @@ import AddIcon from "@mui/icons-material/Add"; -import ArrowBackIosNewIcon from "@mui/icons-material/ArrowBackIosNew"; -import ArrowForwardIosIcon from "@mui/icons-material/ArrowForwardIos"; import CloseIcon from "@mui/icons-material/Close"; import PersonAddIcon from "@mui/icons-material/PersonAdd"; -import SearchIcon from "@mui/icons-material/Search"; import { - Alert, Box, Button, - Container, Dialog, DialogActions, DialogContent, DialogTitle, Divider, IconButton, - InputAdornment, - Paper, - Snackbar, - TableBody, - TableCell, - TableContainer, - TableHead, - TableRow, TextField, Typography, } from "@mui/material"; @@ -32,12 +19,10 @@ import PageHeader from "../../components/PageHeader"; import { createAdmin, getAdmins } from "../../services/auth.services"; import { pushNotification } from "../../utils/notification"; import { NOTIFICATION } from "../../constants"; -import { useTheme } from "@emotion/react"; import { useStyles } from "./staffStyles"; import Table from "../../components/Table"; const StaffManagement = () => { - const theme = useTheme(); const classes = useStyles(); const ref = useRef(null); // State for form fields @@ -46,26 +31,9 @@ const StaffManagement = () => { const [email, setEmail] = useState(""); const [emailError, setEmailError] = useState(""); - // State for staff list - const [staffList, setStaffList] = useState([]); - // State for dialog const [openDialog, setOpenDialog] = useState(false); - // State for search - const [searchQuery, setSearchQuery] = useState(""); - - // State for pagination - const [page, setPage] = useState(1); - const rowsPerPage = 10; - - // State for notification - const [notification, setNotification] = useState({ - open: false, - message: "", - severity: "success", - }); - // Email validation function const validateEmail = (email) => { const regex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; @@ -113,14 +81,6 @@ const StaffManagement = () => { handleCloseDialog(); }; - // Handle notification close - const handleCloseNotification = () => { - setNotification({ - ...notification, - open: false, - }); - }; - const getData = async (filters) => { try { // Remove the type parameter since it's not defined