diff --git a/src/common_components/ViewBookDetails/ShowBookDetails.jsx b/src/common_components/ViewBookDetails/ShowBookDetails.jsx
index 63a3e943..dbc212be 100644
--- a/src/common_components/ViewBookDetails/ShowBookDetails.jsx
+++ b/src/common_components/ViewBookDetails/ShowBookDetails.jsx
@@ -3,6 +3,7 @@ import '../../pages/user/bookDetails/BookDetailsDesign.css'
import { useNavigate, useParams } from "react-router-dom";
import { useDispatch, useSelector } from 'react-redux';
import { fetchRelatedBookList } from '../../features/relatedBoolReducer/RelatedBookReducer';
+import { setSearchQueryResult } from '../../features/searchBookReducer/SearchBookReducer';
import { setOverlayState } from '../../features/showOverlayReducer/ShowOverlayReducer';
//Material ui icons
import ArrowBackOutlinedIcon from '@mui/icons-material/ArrowBackOutlined';
@@ -30,9 +31,11 @@ export default function ShowBookDetails(props) {
const apiURL = import.meta.env.VITE_APP_API_URL;
- const [book, setBook] = useState(undefined); //Initially book will be undefined, if changed to null then gives error as we are reading book.book.description
- const [loading, setLoading] = useState(true);
+ const [user_book, setUserBook] = useState(undefined); //Initially book will be undefined, if changed to null then gives error as we are reading book.book.description
+ const admin_book = useSelector((state)=>state.searchBookList.books)[isbn];
+ const book = props.type === 'user'?user_book:admin_book;
+ const [loading, setLoading] = useState(true);
const description_length = 50;//Describe description length to be shown in frontend.
useEffect(() => {
@@ -43,10 +46,14 @@ export default function ShowBookDetails(props) {
);
if (response.status === 200) {
const data = await response.json();
- setBook(data);
- setDetails(data.book.description.substring(0, description_length));
+ if(props.type === 'admin'){
+ dispatch(setSearchQueryResult([data]));
+ }
+ setUserBook(data);
setLoading(false);
dispatch(setOverlayState(false));
+
+ setDetails(data.book.description.substring(0, description_length));
console.log("overlay after: ",showOverlay);
}
}
diff --git a/src/common_components/cards_admin/AdminCard.jsx b/src/common_components/cards_admin/AdminCard.jsx
index ddf56f41..19bed771 100644
--- a/src/common_components/cards_admin/AdminCard.jsx
+++ b/src/common_components/cards_admin/AdminCard.jsx
@@ -5,7 +5,7 @@ import TravelExploreTwoToneIcon from '@mui/icons-material/TravelExploreTwoTone'
const AdminCard = ({ Object }) => {
- const path = `/admin/book/viewdetails/${Object.book.isbn}`
+ const path = `/admin/books/view-details/${Object.book.isbn}`
return (
diff --git a/src/common_components/footer/Footer.jsx b/src/common_components/footer/Footer.jsx
index 7f7a26cb..164b507f 100644
--- a/src/common_components/footer/Footer.jsx
+++ b/src/common_components/footer/Footer.jsx
@@ -8,17 +8,17 @@ export default function Footer() {
-

-
LitLib
+

+
LitLib
Contact Support
-
About
+
About
LitLib is an attempt to create a digital platform for streamlining the physical processes involved with college libraries, for both users and admins.
-
Library Details
+ Library Details
Name: JU ETCE Departmental Library
Address: Kolkata
Contact no.: 123
diff --git a/src/features/searchBookReducer/SearchBookReducer.jsx b/src/features/searchBookReducer/SearchBookReducer.jsx
index 0d97e1b4..22a0ee90 100644
--- a/src/features/searchBookReducer/SearchBookReducer.jsx
+++ b/src/features/searchBookReducer/SearchBookReducer.jsx
@@ -15,14 +15,16 @@ const searchBookListSlice = createSlice({
return acc
}, {})
},
-
+
updateSearchBookDetails: (state, action)=>{
const book_details = action.payload;
state.books[book_details.book.isbn] = book_details;
},
updateSearchBookAvailability: (state, action)=>{
+ console.log("called update search book avl : ",action.payload);
const {isbn, noOfCopies} = action.payload;
- state.books[isbn].availability = noOfCopies;
+ console.log("isbn: ",isbn," no: ",noOfCopies);
+ state.books[isbn].book.no_of_copies = noOfCopies;
}
},
diff --git a/src/pages/admin/adminBookDetails/AdminButtonSection.jsx b/src/pages/admin/adminBookDetails/AdminButtonSection.jsx
index 15c9c026..cb74d2dc 100644
--- a/src/pages/admin/adminBookDetails/AdminButtonSection.jsx
+++ b/src/pages/admin/adminBookDetails/AdminButtonSection.jsx
@@ -22,6 +22,7 @@ export default function AdminButtonSection(props) {
const ISBN = props.isbn;
const searchBookList = useSelector((state) => state.searchBookList.books);
const book_data = searchBookList[ISBN];
+ // const book_data = props.book;
console.log("book at admin book details section: ",book_data);
@@ -108,9 +109,8 @@ export default function AdminButtonSection(props) {
if(response.status === 200){
toast.success("Book details updated successfully.")
- dispatch(setOverlayState(false));
-
- const book_details= book_data;
+
+ let book_details={book:{},};
book_details.book.shelving_no = shelVingNo;
book_details.book.isbn = isbn;
book_details.book.date_of_publication = date_publication;
@@ -121,9 +121,9 @@ export default function AdminButtonSection(props) {
book_details.author_name = author;
book_details.sub_name = book_title;
book_details.book.no_of_copies = noOfCopies;
-
+ console.log("updated book admin: ",book_details);
dispatch(updateSearchBookDetails(book_details));// TODO check correctness.
-
+ dispatch(setOverlayState(false));
}
else{
toast.error("Error! updating book details.");
diff --git a/src/pages/user/bookDetails/UserButtonSection.jsx b/src/pages/user/bookDetails/UserButtonSection.jsx
index 619c5874..4da07368 100644
--- a/src/pages/user/bookDetails/UserButtonSection.jsx
+++ b/src/pages/user/bookDetails/UserButtonSection.jsx
@@ -55,7 +55,7 @@ export default function UserButtonSection(props) {
const dispatch = useDispatch();
const noOfCopies = props.no_of_copies;
- const isbn_no = props.book.book.isbn;
+ const isbn_no = props.book.book.isbn;
const navigate = useNavigate();
const wishListBook = useSelector((state)=> state.user.wishList);