Index: backend/routes/orderRoutes.js
===================================================================
--- backend/routes/orderRoutes.js	(revision ee056633af77f8879114a594a34f49f87fdf0765)
+++ backend/routes/orderRoutes.js	(revision 55ed1718e29f3bb840f3e7b798f4728e2b431499)
@@ -21,4 +21,6 @@
       isPaid: req.body.isPaid,
       paidAt: req.body.paidAt,
+      isConfirmed: req.body.isConfirmed,
+      contactNumber: req.body.contactNumber,
     });
     const order = await newOrder.save();
@@ -33,4 +35,46 @@
     const orders = await Order.find({ user: req.user._id });
     res.send(orders);
+  })
+);
+const PAGE_SIZE = 10;
+orderRouter.get(
+  "/",
+  expressAsyncHandler(async (req, res) => {
+    const { query } = req;
+    const pageSize = query.pageSize || PAGE_SIZE;
+    const page = query.page || 1;
+    const isConfirmed = query.isConfirmed || "";
+    const isShipped = query.isShipped || "";
+    const searchQuery = query.query || "";
+    const isDelivered = false;
+    const queryFilter =
+      searchQuery && searchQuery !== "all"
+        ? { _: { $regex: searchQuery, $options: "i" } }
+        : {};
+    const isConfirmedFilter =
+      isConfirmed && isConfirmed !== "all" ? { isConfirmed } : {};
+    const isShippedFilter =
+      isShipped && isShipped !== "all" ? { isShipped } : {};
+
+    const orders = await Order.find({
+      ...queryFilter,
+      ...isConfirmedFilter,
+      ...isShippedFilter,
+      ...isDelivered,
+    })
+      .skip(pageSize * (page - 1))
+      .limit(pageSize);
+    const countOrders = await Order.countDocuments({
+      ...isConfirmedFilter,
+      ...isShippedFilter,
+    });
+    res.send({
+      orders,
+      countOrders,
+      page,
+      pages: Math.ceil(countOrders / pageSize),
+    });
+    //const orders = await Order.find();
+    //res.send(orders);
   })
 );
@@ -49,3 +93,53 @@
 );
 
+orderRouter.put(
+  "/action",
+  expressAsyncHandler(async (req, res) => {
+    if (req.body.isConfirmed) {
+      const order = await Order.updateOne(
+        { _id: req.body._id },
+        {
+          $set: {
+            isConfirmed: req.body.isConfirmed,
+          },
+        }
+      );
+    } else if (req.body.isShipped) {
+      const order = await Order.updateOne(
+        { _id: req.body._id },
+        {
+          $set: {
+            isShipped: req.body.isShipped,
+            shippedAt: req.body.shippedAt,
+          },
+        }
+      );
+    } else if (req.body.isDelivered && req.body.isPaid) {
+      const order = await Order.updateOne(
+        { _id: req.body._id },
+        {
+          $set: {
+            isDelivered: req.body.isDelivered,
+            deliveredAt: req.body.deliveredAt,
+            isPaid: req.body.isPaid,
+            paidAt: req.body.paidAt,
+          },
+        }
+      );
+    } else {
+      const order = await Order.updateOne(
+        { _id: req.body._id },
+        {
+          $set: {
+            isDelivered: req.body.isDelivered,
+            deliveredAt: req.body.deliveredAt,
+          },
+        }
+      );
+    }
+
+    res.status(200).send({ message: "Succesful" });
+  })
+);
+
 export default orderRouter;
Index: backend/routes/productRoutes.js
===================================================================
--- backend/routes/productRoutes.js	(revision ee056633af77f8879114a594a34f49f87fdf0765)
+++ backend/routes/productRoutes.js	(revision 55ed1718e29f3bb840f3e7b798f4728e2b431499)
@@ -1,12 +1,107 @@
-import express from "express";
+import express, { query } from "express";
 import Product from "../models/productModel.js";
+import multer from "multer";
+import expressAsyncHandler from "express-async-handler";
+import userRouter from "./userRoutes.js";
 
 const productRouter = express.Router();
 
+const storage = multer.diskStorage({
+  destination: (req, file, callback) => {
+    callback(null, "../frontend/public/uploads/");
+  },
+  filename: (req, file, callback) => {
+    callback(null, file.originalname);
+  },
+});
+
+const upload = multer({ storage: storage });
+const multipleUpload = upload.fields([
+  { name: "image", maxCount: 1 },
+  { name: "sideImage", maxCount: 1 },
+  { name: "sideImage2", maxCount: 1 },
+  { name: "dimension", maxCount: 1 },
+  { name: "scheme", maxCount: 1 },
+]);
+productRouter.post(
+  "/add",
+  multipleUpload,
+  expressAsyncHandler(async (req, res) => {
+    const newProduct = new Product({
+      name: req.body.name,
+      slug: req.body.slug,
+      image: `/uploads/${req.files.image[0].originalname}`,
+      sideImage: `/uploads/${req.files.sideImage[0].originalname}`,
+      sideImage2: `/uploads/${req.files.sideImage2[0].originalname}`,
+      dimension: `/uploads/${req.files.dimension[0].originalname}`,
+      scheme: `/uploads/${req.files.scheme[0].originalname}`,
+      category: req.body.category,
+      subCategory: req.body.subCategory,
+      description: req.body.description,
+      price: req.body.price,
+      priceMontaza: req.body.priceMontaza,
+      countInStock: req.body.countInStock,
+    });
+
+    const product = await newProduct.save();
+    if (product)
+      res.status(201).send({ message: "New Product Created", product });
+    else res.status(404).send({ message: "Error creating product" });
+  })
+);
+
+const PAGE_SIZE = 20;
+productRouter.get(
+  "/",
+  expressAsyncHandler(async (req, res) => {
+    const { query } = req;
+    const pageSize = query.pageSize || PAGE_SIZE;
+    const page = query.page || 1;
+    const category = query.category || "";
+    const subCategory = query.subCategory || "";
+    const order = query.order || "";
+    const searchQuery = query.query || "";
+
+    const queryFilter =
+      searchQuery && searchQuery !== "all"
+        ? { name: { $regex: searchQuery, $options: "i" } }
+        : {};
+    const categoryFilter = category && category !== "all" ? { category } : {};
+    const subCategoryFilter =
+      subCategory && subCategory !== "all" ? { subCategory } : {};
+    const sortOrder =
+      order === "lowFirst"
+        ? { price: 1 }
+        : order === "highFirst"
+        ? { price: -1 }
+        : { createdAt: -1 };
+    const products = await Product.find({
+      ...queryFilter,
+      ...categoryFilter,
+      ...subCategoryFilter,
+    })
+      .sort(sortOrder)
+      .skip(pageSize * (page - 1))
+      .limit(pageSize);
+
+    const countProducts = await Product.countDocuments({
+      ...queryFilter,
+      ...categoryFilter,
+      ...subCategoryFilter,
+    });
+    res.send({
+      products,
+      countProducts,
+      page,
+      pages: Math.ceil(countProducts / pageSize),
+    });
+  })
+);
+/*
 productRouter.get("/", async (req, res) => {
   const products = await Product.find();
   res.send(products);
 });
-
+*/
 productRouter.get("/slug/:slug", async (req, res) => {
   const product = await Product.findOne({ slug: req.params.slug });
@@ -27,3 +122,41 @@
 });
 
+productRouter.put(
+  "/edit",
+  expressAsyncHandler(async (req, res) => {
+    const product = await Product.updateOne(
+      { slug: req.body.slug },
+      {
+        $set: {
+          name: req.body.name,
+          category: req.body.category,
+          slug: req.body.slug,
+          subCategory: req.body.subCategory,
+          description: req.body.description,
+          price: req.body.price,
+          priceMontaza: req.body.priceMontaza,
+          countInStock: req.body.countInStock,
+        },
+      }
+    );
+    /*
+    if (product) {
+      product.name = req.body.name || product.name;
+      product.slug = req.body.slug || product.slug;
+      product.price = req.body.price || product.price;
+      product.category = req.body.category || product.category;
+      product.subCategory = req.body.subCategory || product.subCategory;
+      product.description = req.body.description || product.description;
+      product.priceMontaza = req.body.priceMontaza || product.priceMontaza;
+      product.countInStock = req.body.countInStock || product.countInStock;
+      product.image = product.image;
+      product.sideImage = product.sideImage2;
+      product.sideImage2 = product.sideImage2;
+
+      const updatedProduct = await product.save();*/
+    res.status(200).send({ message: "Succesful" });
+    //else {
+    //res.status(404).send({ message: "Product Not Found" });
+  })
+);
 export default productRouter;
