Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
ElyasMehraein committed Apr 18, 2024
1 parent bff9ada commit 2e9130f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
7 changes: 5 additions & 2 deletions components/templates/allBusinesses/AllBusinesses.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"use client"
import { Avatar, Box, Button, Container, List, ListItem, ListItemAvatar, ListItemText, TextField, Typography } from '@mui/material'
import { Avatar, Box, Button, Container, List, ListItem, ListItemAvatar, ListItemButton, ListItemText, TextField, Typography } from '@mui/material'
import MyAppBar from '@/components/modules/MyAppBar'
import { useState } from 'react'
import { useRouter } from 'next/navigation'
Expand All @@ -15,6 +15,8 @@ const ShowMyLocation = dynamic(() => import('@/components/modules/ShowMyLocation


export default function AllBusinesses({ businesses }) {
const router = useRouter()

console.log("businesses", businesses);
const [expanded, setExpanded] = useState(false);

Expand Down Expand Up @@ -43,15 +45,16 @@ export default function AllBusinesses({ businesses }) {
{businesses.map((business) => {
console.log(business.businessName);
return (

<List key={business._id} sx={{ width: '100%', maxWidth: 700, bgcolor: 'background.paper' }}>
<ListItem>
<ListItemButton onClick={() => router.push(`/${business.businessName}`)}>
<ListItemAvatar>
<Avatar sx={{ width: 40, height: 40 }} >
<ItsAvatar userCodeOrBusinessBrand={business.businessName} alt="workers avatar" />
</Avatar>
</ListItemAvatar>
<ListItemText align='right' primary={business.businessBrand} secondary={business.bio} />
</ListItemButton>
</ListItem>
</List>
)
Expand Down
22 changes: 11 additions & 11 deletions components/templates/editBusiness/EditBusiness.jsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
// "use client"
import React from "react";
"use client"
import React, { useState } from "react";
import MyAppBar from "@/components/modules/MyAppBar";
import CountactEdit from '@/components/modules/ContactEdit'
import BioEdit from "@/components/modules/BioEdit";
import ExplainEdit from "@/components/modules/ExplainEdit";
import NameEdit from "@/components/modules/NameEdit";
import EditLocation from "./EditLocation";
import AddressEdit from "./AddressEdit";
// import CustomSnackbar from "@/components/modules/CustomSnackbar";
import CustomSnackbar from "@/components/modules/CustomSnackbar";
import EditHeader from "@/components/modules/EditHeader";
import EditAvatar from "../../modules/EditAvatar";
import EmployeeList from "@/components/modules/EmployeeList";

export default function EditBusiness({ business, logedUserCode ,users}) {
// const [snackbarError, setSnackbarError] = useState(false);
// const [SnackbarMessage, setSnackbarMessage] = useState("محدودیت تعداد کارکتر را رعایت نمایید")
// const maxLengthError = (parameter) => {
// parameter && setSnackbarMessage(parameter)
// setSnackbarError(true)
// };
const [snackbarError, setSnackbarError] = useState(false);
const [SnackbarMessage, setSnackbarMessage] = useState("محدودیت تعداد کارکتر را رعایت نمایید")
const maxLengthError = (parameter) => {
parameter && setSnackbarMessage(parameter)
setSnackbarError(true)
};
return (
<>
<MyAppBar />
Expand All @@ -32,12 +32,12 @@ export default function EditBusiness({ business, logedUserCode ,users}) {
<EditLocation business={business} maxLengthError={maxLengthError} />
<EmployeeList business={business} logedUserCode={logedUserCode} users={users} maxLengthError={maxLengthError}/>

{/* <CustomSnackbar
<CustomSnackbar
open={snackbarError}
onClose={() => setSnackbarError(false)}
message={SnackbarMessage}
severity="error"
/> */}
/>
</>

)
Expand Down

0 comments on commit 2e9130f

Please sign in to comment.