Skip to content

Commit

Permalink
Merge pull request #34 from danial117/admin_dev_14
Browse files Browse the repository at this point in the history
ss
  • Loading branch information
danial117 authored Sep 7, 2024
2 parents d981a79 + 11f947f commit b238d8e
Show file tree
Hide file tree
Showing 22 changed files with 980 additions and 219 deletions.
2 changes: 1 addition & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
<title>Infovit</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
Expand Down
10 changes: 5 additions & 5 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import ProductsList from "./Data Lists/Products/ProductsList";
import ProductEdit from "./Data Lists/Products/ProductsEdit";
import './main.css'
import AddressList from "./Data Lists/Addresses/AddressList";
import CustomRecordList from "./Data Lists/Users/UsersList";
import UsersList from "./Data Lists/Users/UsersList";
import ProductCreate from "./Data Lists/Products/ProductsCreate";
import OrdersList from "./Data Lists/orders/OrdersList";
import CartsList from "./Data Lists/Carts/CartsList";
Expand All @@ -30,8 +30,8 @@ import OtpPage from "./componenets/OTP_Validation";
import ContactList from "./Data Lists/contact/ContactList";
import { ContactShow } from "./Data Lists/contact/ContactShow";
import ProtectedLayout from "./componenets/ProtectedLayout";


import CMS_Create from "./Data Lists/DOM/DOM_Edit";
import { UserShow } from "./Data Lists/Users/OrdersShow";

const AppContent = () => {
const location = useLocation();
Expand All @@ -43,14 +43,14 @@ const AppContent = () => {
<>
{showSearchData && <SearchData />}
{!isFetching &&<div className={`${showSearchData && 'mt-28'} `}> <Admin dataProvider={customDataProvider} loginPage={<MyLoginPage />} authProvider={authProvider}>
<Resource name="users" list={<CustomRecordList resource="user" />} />
<Resource name="user" show={<UserShow/>} list={<UsersList />} />
<Resource name="news" list={<NewsList/>} show={NewsShow} create={NewsCreate} edit={NewsEdit} hasCreate hasEdit hasShow/>
<Resource name="address" list={<AddressList />} />
<Resource name="order" show={OrderShow} list={<OrdersList />} edit={OrderEdit} hasShow />
<Resource name="cart" list={<CartsList />} />
<Resource name="products" list={ProductsList} edit={ProductEdit} create={ProductCreate} hasCreate />
<Resource name="brands" show={BrandShow} edit={BrandEdit} list={BrandsList} create={BrandsCreate} hasShow hasCreate />
{/* <Resource name="content" list={DomList} show={DOM_Show} edit={DomEdit} hasEdit hasShow /> */}
<Resource name="Cms" list={DomList} edit={CMS_Create} hasShow hasEdit hasCreate/>
<Resource name="contact" list={ContactList} show={ContactShow} hasEdit hasShow />

</Admin>
Expand Down
1 change: 1 addition & 0 deletions src/Data Lists/Brands/BrandsCreate.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ return(
<ImageField source="src" title="title" />
</ImageInput>
</div>




Expand Down
74 changes: 64 additions & 10 deletions src/Data Lists/Brands/BrandsList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,70 @@ import { List, Datagrid, TextField, useRecordContext, useResourceContext,CreateB
SelectColumnsButton,
TopToolbar,
SearchInput,
ShowButton, } from 'react-admin';
ShowButton,FilterForm ,TextInput} from 'react-admin';
import { Stack } from '@mui/material';
import { UploadFileRounded,AddPhotoAlternateRounded } from '@mui/icons-material';
import CsvMenu from '../../utils/CSVFileHandling';
import FolderUploadMenu from '../../utils/uploadImagesFolder';
import { useState } from 'react';


const ListActions = () => (
<TopToolbar>
<SelectColumnsButton />

<CreateButton/>
<ExportButton/>
</TopToolbar>
);
const postFilters = [

<TextInput label="Brand Name" source="name" defaultValue="" />,



];

const ListToolbar = () => {

const [anchorEl, setAnchorEl] = useState(null);
const [anchorE2, setAnchorE2] = useState(null);

const handleClick = (event) => {
setAnchorEl(event.currentTarget);
};


const handleClose = () => {
setAnchorEl(null);
};

const FolderMenuClick = (event) => {
setAnchorE2(event.currentTarget);
};


const FolderMenuClose = () => {
setAnchorE2(null);
};


return( <Stack direction="column" >
<FilterForm filters={postFilters} />
<div >
<FilterButton filters={postFilters} />
<ExportButton/>
<CreateButton />

<UploadFileRounded
style={{ margin: '4px', color: 'blue', cursor: 'pointer',fontSize:35 }}
onClick={handleClick}
/>
<CsvMenu anchorEl={anchorEl} handleClose={handleClose} />
<AddPhotoAlternateRounded
style={{ margin: '4px', color: 'blue', cursor: 'pointer',fontSize:35 }}
onClick={FolderMenuClick}
/>
<FolderUploadMenu anchorE2={anchorE2} handleClose={FolderMenuClose} />



</div>
</Stack>
)
}

const ImageField = ({ source }) => {
const record = useRecordContext();
Expand All @@ -28,7 +82,7 @@ const BrandsList = (props) =>{


return(
<List actions={<ListActions/>}>
<List actions={<ListToolbar/>}>
<Datagrid rowClick="edit">
<TextField source="id" />
<ImageField />
Expand Down
7 changes: 3 additions & 4 deletions src/Data Lists/Carts/CartsList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ import { List, Datagrid, TextField, useRecordContext, useResourceContext,CreateB

const ListActions = () => (
<TopToolbar>
<SelectColumnsButton />

<CreateButton/>

<ExportButton/>
</TopToolbar>
);
Expand All @@ -23,7 +21,8 @@ const CartsList = () =>{
<List actions={<ListActions/>}>
<Datagrid >
<TextField source="id" />
<TextField source="user" />
<TextField source="user.name" />
<TextField source="user.email" />
<TextField label='items' source="items.length" />

</Datagrid>
Expand Down
29 changes: 15 additions & 14 deletions src/Data Lists/DOM/DOMList.jsx
Original file line number Diff line number Diff line change
@@ -1,33 +1,34 @@

import { List, Datagrid, TextField, useRecordContext, useResourceContext,CreateButton,
DatagridConfigurable,
import { List, Datagrid, TextField,CreateButton,

ExportButton,
FilterButton,

SelectColumnsButton,
TopToolbar,
SearchInput,
ShowButton } from 'react-admin';

ShowButton,
EditButton} from 'react-admin';

const ListActions = () => (
<TopToolbar>
<SelectColumnsButton />
<CreateButton/>



<ExportButton/>
</TopToolbar>
);

const DomList = () =>{
const DomList = (props) =>{


return(
<List actions={<ListActions/>}>
<Datagrid >
<Datagrid rowClick='edit'>
<TextField source="id" />
<TextField source="HomePageMainBanner" />
<TextField source="AboutPageImage1" />
<TextField source="AboutPageImage2" />
<ShowButton />
<TextField source="HomePageMainBanner" />
<TextField source="HomePageMainBannerText.text1" />
<TextField source="HomePageMainBannerText.text2" />



</Datagrid>
Expand Down
Loading

0 comments on commit b238d8e

Please sign in to comment.