<|start_filename|>routes/shoppingcart.js<|end_filename|>
var express = require('express');
var router = express.Router();
var Product = require("../models/product");
var Cart = require('../models/cart');
var Order = require('../models/order');
var ObjectId = require('mongoose').Types.ObjectId;

const nodemailer = require('nodemailer');

router.get('/add-to-cart/:id', function (req, res) {    
    var productId = req.params.id;
    var cart = new Cart(req.session.cart ? req.session.cart : {});

    Product.findById(productId, function (err, product) {
        if (err) {
            return res.redirect('/');
        }
        cart.add(product, product.id);
        req.session.cart = cart;
        req.flash('success', 'Added to Cart');
        res.redirect("back");
        //res.redirect('/category/'+product.category);  
    });
});

router.get('/reduce/:id', function (req, res) {
    var productId = req.params.id;
    var cart = new Cart(req.session.cart ? req.session.cart : {});

    cart.reduceByOne(productId);
    req.session.cart = cart;
    res.redirect('/shopping-cart');
});

router.get('/increase/:id', function (req, res) {
    var productId = req.params.id;
    var cart = new Cart(req.session.cart ? req.session.cart : {});

    cart.increaseByOne(productId);
    req.session.cart = cart;
    res.redirect('/shopping-cart');
});

router.get('/remove/:id', function (req, res) {
    var productId = req.params.id;
    var cart = new Cart(req.session.cart ? req.session.cart : {});
    console.log(cart);
    cart.removeItem(productId);
    req.session.cart = cart;
    res.redirect('/shopping-cart');
});

router.get('/shopping-cart', function (req, res) {  
    var errMsg = req.flash('error')[0];
    if (!req.session.cart) {
        return res.render('shop/shopping-cart', { products: null });
    }
    var cart = new Cart(req.session.cart);
    res.render('shop/shopping-cart', { products: cart.generateArray(), totalPrice: cart.totalPrice,errMsg: errMsg, noErrors: !errMsg});
});


router.get('/products/:id', function(req,res){
    var successMsg = req.flash('success')[0];
    var isIcon;
    if(successMsg==="Added to Cart"){
        isIcon = true;
    }

    var productId = req.params.id;
    Product.findById(productId, function(err,foundProduct){
    if(err){
        console.log(err);
    }
    else{
        res.render('shop/show',{product: foundProduct, successMsg: successMsg,noMessages: !successMsg, isIcon: isIcon })
    }
    });
});


router.get('/checkout', isLoggedIn, isNotAdmin, function (req, res) {
    var errMsg = req.flash('error')[0];
    if (!req.session.cart) {
        res.redirect('/shopping-cart');
    }
    var cart = new Cart(req.session.cart);
    var flag = 0;
    var cartItems =  Object.values(cart.items);
    for(var i=0; i<cartItems.length; i++){
        if(cartItems[i].qty>cartItems[i].item.qty){
            flag = 1;
            break;
        } 
    };
    if(flag === 1){
        var outOfStockProduct = cartItems[i].item.title;
        req.flash('error',`Product - '${outOfStockProduct}' is out of stock. Please decrease its quantity. `);
        res.redirect('/shopping-cart');
    } else {
        Order.find({user: req.user} ,function(err,result){
            var previousOrderDetails;
            if(result.length === 0){
                previousOrderDetails = {};
            } else if(result.length === 1){
                previousOrderDetails = result[0];
            } else {
                result.sort(function(a, b) {
                    a = new Date(a.purchaseDate);
                    b = new Date(b.purchaseDate);
                    return a>b ? -1 : a<b ? 1 : 0;
                });
                previousOrderDetails = result[0];
            }            
            res.render('shop/checkout', {cart: cart, total: cart.totalPrice, errMsg: errMsg, noErrors: !errMsg, previousOrderDetails: previousOrderDetails });
        });
    }
});

router.post('/checkout', isLoggedIn, isNotAdmin, function (req, res) {
    if (!req.session.cart) {
        res.redirect('/shopping-cart');
    }
    var cart = new Cart(req.session.cart);
    if(req.body.name==="" || req.body.address==="" || req.body.city==="" || req.body.state==="" || req.body.zip===""){
        req.flash('error', "Please fill out all the shipping details");
        return res.redirect('/checkout');
    }
    if(req.body.Radio==='online')
    {
        var stripe = require('stripe')('sk_test_D7997ZtAIPpJolaDEaFl4cp0007MSV4quL');
        // `source` is obtained with Stripe.js; see https://stripe.com/docs/payments/accept-a-payment-charges#web-create-token
        //console.log(req.body.Radio);
    stripe.charges.create(
        {
            amount: cart.totalPrice * 100,
            currency: 'inr',
            source: req.body.stripeToken,
            description: 'MedEasy',
        },
        function (err, charge) {
            // asynchronously called
            if (err) {
                req.flash('error', err.message);
                return res.redirect('/checkout');
            }
            var date = new Date();
            date.setHours(0,0,0,0);
            console.log("Date: ",date);
            console.log("DATE: ",date.getDate(),"-",date.getMonth(),"-",date.getFullYear());
            var order = new Order({
                user: req.user,
                cart: cart,
                address: req.body.address,
                name: req.body.name,
                paymentId: charge.id,
                paymentMode: "Online",
                purchaseDate: date,
                city: req.body.city,
                state: req.body.state,
                zip: req.body.zip
            });
            Object.values(cart.items).forEach(function(product){
                let prevQty = product.item.qty;
                let newQty = prevQty-product.qty; 
                //UPDATE QTY in database
                Product.findOneAndUpdate({"_id": ObjectId(`${product.item._id}`)},{$set: {"qty": newQty}},function(err,data){
                    if(err){
                        console.log(err);
                    }
                });
            });
            //SEND ORDER CONFIRMATION EMAIL TO CUSTOMER
            let transporter = nodemailer.createTransport({
                service: 'gmail',
                auth: {
                    user: '<EMAIL>',
                    pass: process.env.MAILPASS
                }
            });

            let mailOptions = {
                from: '<EMAIL>',
                to: req.user.email,
                subject: 'MedEasy',
                text: '',
                html: ` <h2>Successfully recieved your order ${order.user.fullname}</h2>
                        <br>
                        Your order quantity: <b>${cart.totalQty}</b>
                        <br>
                        Your order price: <b>₹ ${cart.totalPrice}</b>
                        <p>You can view you order details in order history under your account</p>
                        <hr>
                        <b>
                        <h3>Thank you for ordering with MedEasy!</h3>
                        <h4>Get Well Soon !!</h4>
                        </b>`
            };

            transporter.sendMail(mailOptions, function (err, data) {
                if (err) {
                    console.log("Failed ", err);
                }
                else {
                    console.log("Email sent !!");
                }
            });
            order.save(function (err, result) {
                req.flash('success', 'Order Placed Succesfully.');
                req.session.cart = null;
                res.redirect('/');
            });
        });
    }
    else if(req.body.Radio==='b') /* Cash On Delivery */
    {
        var date = new Date();
        date.setHours(0,0,0,0);
        console.log("Date: ",date);
        console.log("DATE: ",date.getDate(),"-",date.getMonth(),"-",date.getFullYear());
        var order = new Order({
            user: req.user,
            cart: cart,
            address: req.body.address,
            name: req.body.name,
            paymentMode: "Cash",
            purchaseDate: date,
            city: req.body.city,
            state: req.body.state,
            zip: req.body.zip
        });
        Object.values(cart.items).forEach(function(product){
            let prevQty = product.item.qty;
            let newQty = prevQty-product.qty; 

            let newsoldQty = product.item.soldQty + product.qty;

            //UPDATE QTY in database
            Product.findOneAndUpdate({"_id": ObjectId(`${product.item._id}`)},{$set: {qty: newQty, soldQty: newsoldQty}},function(err,data){
                if(err){
                    console.log(err);
                }
            });
        });

        //SEND ORDER CONFIRMATION EMAIL TO CUSTOMER
        let transporter = nodemailer.createTransport({
            service: 'gmail',
            auth: {
                user: '<EMAIL>',
                pass: <PASSWORD>.MAILPASS
            }
        });
        let mailOptions = {
            from: '<EMAIL>',
            to: req.user.email,
            subject: 'MedEasy',
            text: '',
            html: `<h2>Successfully recieved your order ${order.user.fullname}</h2>
                    <br>
                    Your order quantity: <b>${cart.totalQty}</b>
                    <br>
                    Your order price: <b>₹ ${cart.totalPrice}</b>
                    <p>You can view you order details in order history under your account</p>
                    <hr>
                    <b>
                    <h3>Thank you for ordering with MedEasy!</h3>
                    <h4>Get Well Soon !!</h4>
                    </b>`
        };
        
        transporter.sendMail(mailOptions, function (err, data) {
            if (err) {
                console.log("Failed ", err);
            }
            else {
                console.log("Email sent !!");
            }
        });
        order.save(function (err, result) {
            req.flash('success', 'Order Placed Succesfully.');
            req.session.cart = null;
            res.redirect('/');
        });
    }
    else{
        res.redirect('/');
    }
});

module.exports = router;

//MIDDLEWARE
function isLoggedIn(req, res, next) {
    if (req.isAuthenticated()) {
        return next();
    }
    req.session.oldUrl = req.url;
    res.redirect('/user/signin');
}

function isNotAdmin(req, res, next){
    if(!req.user.isSeller){
        return next();
    }
    req.session.oldUrl = req.url;
    req.flash('error','Please signin as user to order');
    res.redirect('/admin');
}

<|start_filename|>public/stylesheets/checkout.css<|end_filename|>
@import url('https://fonts.googleapis.com/css?family=Baloo+Bhaijaan|Ubuntu');
body
{
	font-family:Roboto;
	/* background: #2196F3;
	background: -webkit-linear-gradient(to right, #8ef7ff, #2196F3); 
  background: linear-gradient(to right, #8ef7ff, #2196F3);  */
    background: -webkit-gradient(linear, left bottom, left top, from(#fbc2eb), to(#a18cd1));
    background: -webkit-linear-gradient(bottom, #fbc2eb 0%, #a18cd1 100%);
    background: -moz-linear-gradient(bottom, #fbc2eb 0%, #a18cd1 100%);
    background: -o-linear-gradient(bottom, #fbc2eb 0%, #a18cd1 100%);
    background: linear-gradient(to top, #fbc2eb 0%, #a18cd1 100%);
    background-repeat: no-repeat;
    background-attachment: fixed;
}

.container {
    /* margin-top:1rem; */
    /* padding: 5px 5px 5px 5px; */
    border-radius: 5px;
    padding:0;
  }
/*  
#pay
{
  transition:10s linear;
}  */
/* .con2 
{
  background-color:white;
}
.con3
{
  background-color:white;
} */
  .check_inp {
    width: 100%;
    margin-bottom: 20px;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 3px;
  }
  
  label {
    margin-bottom: 10px;
    display: block;
  }
  
  .pay_method
  {
    font-size: larger;
    font-family: 'Times New Roman', Times, serif;
  }
  /* .icon-container {
    margin-bottom: 20px;
    padding: 7px 0;
    font-size: 20px;
  } */
  
  .btn {
    background-color: #4CAF50;
    color: white;
    padding: 12px;
    margin: 10px 0;
    border: none;
    width: 100%;
    border-radius: 3px;
    cursor: pointer;
    font-size: 17px;
  }
  
  .btn:hover {
    background-color: #45a049;
  }
  
  span.price {
    float: right;
    color: grey;
  }
  
  .jumbo
  {
    border:1px solid black;
    width:10rem;
    padding:1rem;
  }
  .not_selected
  {
    display:none;
  }
  
  .payment-logo{
    position: absolute;
    top: -50px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 100px;
    background: #f8f8f8;
    border-radius: 50%;
    box-shadow: 0 0 5px rgba(0,0,0,0.2);
    text-align: center;
    line-height: 85px;
  }
  
  .payment-logo:before{
    content: "";
    position: absolute;
    top: 5px;
    left: 5px;
    width: 90px;
    height: 90px;
    background: #7952b3;
    border-radius: 50%;
  }
  
  .payment-logo p{
    position: relative;
    color: #f8f8f8;
    font-family: 'Baloo Bhaijaan', cursive;
    font-size: 58px;
  }
  .payment{
    background: #f8f8f8;
    /* max-width: 360px; */
    margin: 80px auto;
    height: auto;
    padding: 35px;
    padding-top: 70px;
    border-radius: 5px;
    position: relative;
  } 

  .payment h2{
    text-align: center;
    letter-spacing: 2px;
    margin-bottom: 20px;
    color: #0d3c61;
  }

<|start_filename|>routes/admin.js<|end_filename|>
var express = require('express');
var router = express.Router();

var Order = require("../models/order");
var Product = require("../models/product");
var User = require("../models/user");


router.get('/admin',isLoggedIn,isAdmin,function(req,res){
    var errMsg = req.flash('error')[0];
    Order.countDocuments({},function(err,c){
        if(!err){
            Product.countDocuments({},function(err,pc){
                if(!err){
                    User.countDocuments({isSeller: false},function(err,uc){
                        if(!err){
                            Order.aggregate(
                                [
                                    {$match: {}},
                                    {$group: {_id: '',total: {$sum: "$cart.totalPrice"}}},
                                    {$project: {total: '$total' }}
                                ], function(err,result){
                                    Order.aggregate(
                                        [
                                            {$match: {}},
                                            {$group: {_id: "$user",  name : { $first: '$name' },total: {$sum: "$cart.totalPrice"}}},
                                            {$sort: {total: -1}},
                                            {$limit: 5}
                                        ], function(err,result2){
                                            Product.aggregate(
                                                [
                                                    {$match: {}},
                                                    {$project: {_id: 1,title: 1,price: 1,soldQty: 1,brand: 1,qty: 1}},
                                                    {$sort: {soldQty: -1}},
                                                    {$limit: 5}
                                                ], function(err,results){
                                                    var orderCount = c;
                                                    var productCount = pc;
                                                    var userCount = uc;
                                                    var revenue = result[0].total;
                                                    res.render('admin/dashboard', {orderCount: orderCount, productCount: productCount, userCount: userCount, revenue: revenue, topUser: result2, topProduct: results, errMsg: errMsg, noMessages: !errMsg  });
                                                }
                                            )
                                            
                                            
                                        }
                                    )
                                }
                            )
                        }
                    })
                }
            });
        }
    });
});


router.get("/admin/store", isLoggedIn, isAdmin, function(req,res){
    var successMsg = req.flash('success')[0];
    Product.find({}, function(err,foundProduct){
        if(err){
            console.log(err);
        } else {
            res.render('admin/store', {products: foundProduct, successMsg: successMsg, noMessages: !successMsg });
        }
    })
});

router.get('/admin/store/new', isLoggedIn, isAdmin, function(req,res){
    var errMsg = req.flash('error')[0];
    res.render("admin/new", {errMsg: errMsg, noMessages: !errMsg });
}); 

//CREATE
router.post('/admin/store', isLoggedIn, isAdmin, function(req,res){
    var title = req.body.title; 
    var brand = req.body.brand; 
    var mfgDate = req.body.mfgDate; 
    var expDate = req.body.expDate; 
    var price = req.body.price;
    var tablets = req.body.tablets; 
    var image = req.body.image;
    var qty = req.body.qty;
    var tags = req.body._tags;
    var _tags = tags.split(",");

    var composition = req.body.composition; 
    var desc = req.body.description; 
    var precautions = req.body.precautions; 
    var category = req.body.select;

    var newProduct = {
        title: title, 
        brand: brand, 
        mfgDate: mfgDate, 
        expDate: expDate, 
        price: price, 
        tablets: tablets, 
        image: image, 
        qty: qty,
        _tags: _tags,
        composition: composition,
        description: desc,
        precautions: precautions,
        category: category
    };

    if(title.length == 0 || brand.length == 0 || mfgDate.length == 0 || expDate.length == 0 || price.length == 0 || 
        tablets.length == 0 || image.length == 0 || qty.length == 0 || composition.length == 0 || 
        desc.length == 0 || precautions.length == 0 || category.length == 0 ){
            req.flash('error', 'Please fill all the fields'); 
            res.redirect("/admin/store/new");
    } else {
        //create new cmpground and save to db
        Product.create(newProduct,  function(err, newlyCreated){
            if(err){
                console.log(err);
            }
            else{
                console.log(newlyCreated);  
                req.flash('success', 'Sucessfully added product'); 
                res.redirect("/admin/store");
            }
        });
    }
});



router.get("/admin/store/:category", isLoggedIn, isAdmin, function(req,res){
    var successMsg = req.flash('success')[0];
    var cat = req.params.category;
    Product.find({category: cat}, function(err,foundProducts){
        if(err){
            console.log(err);
        } else {
            res.render('admin/store', {products: foundProducts, successMsg: successMsg, noMessages: !successMsg });
        }
    });
});


router.get('/admin/orders', isLoggedIn, isAdmin, function(req,res){
    Order.find({}, function(err,allOrder){
        if(err){
            console.log(err);
        } else {
            res.render('admin/orders',{orders: allOrder});
        }
    })
});


router.get('/admin/order-details/:id',isLoggedIn, isAdmin, function(req,res){
    Order.findById(req.params.id, function(err, foundOrder){
        if(err){
            console.log(err);
        } else {
            res.render('admin/order_list',{order: foundOrder});
        }
    });
});


router.get('/admin/pending-orders',isLoggedIn, isAdmin, function(req,res){
    var successMsg = req.flash('success')[0];
    Order.find({isDelivered: false}, function(err,allOrder){
        if(err){
            console.log(err);
        } else {
            res.render('admin/pending-orders',{orders: allOrder, successMsg: successMsg, noMessages: !successMsg});
        }
    });
});

router.put('/admin/orders/status/:id/confirmed',isLoggedIn, isAdmin, function(req,res){
    var orderId = req.params.id;
    Order.findByIdAndUpdate(orderId, {isConfirmed: true}, function(err,order){
        if(err){
            console.log(err);
        } else {
            req.flash('success',"Order Confirmed");
            res.redirect("/admin/pending-orders");
        }
    });
});

router.put('/admin/orders/status/:id/delivered',isLoggedIn, isAdmin, function(req,res){
    var orderId = req.params.id;
    Order.findByIdAndUpdate(orderId, {isDelivered: true}, function(err,order){
        if(err){
            console.log(err);
        } else {
            req.flash('success',"Order Delivered");
            res.redirect("/admin/pending-orders");
        }
    });
});



router.get('/admin/users',isLoggedIn, isAdmin, function(req,res){
    User.find({isSeller: 'false'}, function(err,allUser){
        if(err){
            console.log(err);
        } else {
            res.render('admin/users',{users: allUser});
        }   
    })
});

router.get('/admin/admins',isLoggedIn, isAdmin, function(req,res){
    User.find({isSeller: 'true'}, function(err,allAdmin){
        if(err){
            console.log(err);
        } else {
            res.render('admin/admins',{admins: allAdmin});
        }   
    })
});


//EDIT 
router.get("/admin/store/:id/edit", isLoggedIn,isAdmin, function(req,res){  
    var errMsg = req.flash('error')[0];
    Product.findById(req.params.id, function(err, foundProduct){
        if(err){
            res.redirect("/admin/store");
        }
        else{                
            res.render("admin/edit", {product: foundProduct, errMsg: errMsg, noMessages: !errMsg });
        }
    }); 
});


router.put("/admin/store/:id", isLoggedIn, isAdmin, function(req,res){
    var successMsg = req.flash('success')[0];
    //find and update
    var title = req.body.title; 
    var brand = req.body.brand; 
    var mfgDate = req.body.mfgDate; 
    var expDate = req.body.expDate; 
    var price = req.body.price;
    var tablets = req.body.tablets; 
    var image = req.body.image;
    var qty = req.body.qty;
    var tags = req.body._tags;
    var composition = req.body.composition; 
    var desc = req.body.description; 
    var precautions = req.body.precautions; 

    var tags = req.body._tags;
    var _tags = tags.split(",");
    var category = req.body.select
    if(title.length == 0 || brand.length == 0 || mfgDate.length == 0 || expDate.length == 0 || price.length == 0 || 
        tablets.length == 0 || image.length == 0 || qty.length == 0 || composition.length == 0 || 
        desc.length == 0 || precautions.length == 0 || category.length == 0 ){
            req.flash('error', 'Please fill all the fields'); 
            res.redirect(`/admin/store/${req.params.id}/edit`);
        } else {
            var updatedProduct = {
                title: title, 
                brand: brand, 
                mfgDate: mfgDate, 
                expDate: expDate, 
                price: price, 
                tablets: tablets, 
                image: image, 
                qty: qty,
                _tags: _tags,
                composition: composition,
                description: desc,
                precautions: precautions,
                category: category
            };
        
            Product.findByIdAndUpdate(req.params.id, updatedProduct, function(err,product){
                if(err){
                    res.redirect("/admin");  
                }
                else{
                    req.flash('success', 'Sucessfully Updated product'); 
                    res.redirect("/admin/store");
                }
            });
        }   
    
});


//Destroy Route
router.delete("/admin/store/:id",isLoggedIn, isAdmin, function(req,res){
    Product.findByIdAndRemove(req.params.id, function(err){
        if(err){
            res.redirect("/admin");
        }
        else{
            req.flash('success','Product Deleted sucessfully');
            res.redirect("/admin/store");
        }
    });
});

module.exports = router;

function isLoggedIn(req, res, next) {
    if (req.isAuthenticated()) {
        return next();
    }
    req.session.oldUrl = req.url;
    res.redirect('/user/signin');
}

function isAdmin(req, res, next){
    if(req.user.isSeller){
        return next();
    }
    req.session.oldUrl = req.url;
    req.flash('error', 'Sorry, you are not an admin'); 
    res.redirect('/');
}


<|start_filename|>app.js<|end_filename|>
var createError = require('http-errors');
var express = require('express');
var path = require('path');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
var session = require('express-session');
var logger = require('morgan');
var mongoose = require('mongoose');
var passport = require('passport');
var LocalStrategy = require('passport-local');
var MongoStore = require('connect-mongo')(session);
var methodOverride = require("method-override");
require('dotenv').config()


var app = express();

var flash = require('connect-flash');
var indexRoutes = require('./routes/index');
var userRoutes = require('./routes/user');
var cartRoutes = require('./routes/shoppingcart');
var adminRoutes = require('./routes/admin');


require('./config/passport');




mongoose.set('useNewUrlParser', true);
mongoose.set('useUnifiedTopology', true);
var url = process.env.DATABASEURL || "mongodb://localhost/medlife";
//mongodb+srv://shubh:<EMAIL>/test?retryWrites=true&w=majority
mongoose.connect(process.env.DATABASEURL);
//mongoose.connect("mongodb://localhost/medlife");


// view engine setup
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'ejs');

app.use(logger('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(session({
  secret: 'supersecret',
  resave: false,
  saveUninitialized: false,
  store: new MongoStore({ mongooseConnection: mongoose.connection }),
  cookie: { maxAge: 180 * 60 * 1000 }/* 180 minutes */ 
}));

app.use(methodOverride("_method"));
app.use(flash());

app.use(passport.initialize());
app.use(passport.session());

app.use(express.static(path.join(__dirname, 'public')));

app.use(function(req, res, next){
  res.locals.currentUser = req.user;
  res.locals.session = req.session;
  next();
});

app.use(userRoutes);
app.use(indexRoutes);
app.use(cartRoutes);
app.use(adminRoutes);


// catch 404 and forward to error handler
app.use(function(req, res, next) {
  next(createError(404));
});

// error handler
app.use(function(err, req, res, next) {
  // set locals, only providing error in development
  res.locals.message = err.message;
  res.locals.error = req.app.get('env') === 'development' ? err : {};

  // render the error page
  res.status(err.status || 500);
  res.render('error');
});

app.listen(process.env.PORT || 3000, process.env.IP, function(){
  console.log("medlife server Started");
});

<|start_filename|>public/stylesheets/csshome/home_pg.css<|end_filename|>

.con2 .box-row a{
  text-decoration: none !important;
}


.hh1{  

    color:black;
    text-shadow: 0 2px 2px gray;
    font-size :50px;
    margin-block-end: 0em;

} 

.carousel-inner img {
  vertical-align: middle;
  border-style: none;
  max-height: 700px;
  height: 600px;
  width: 100%;

}

.carousel-inner
{
  background-color:white;
}


.offer
{
  width:100%;
  height:100%;
}


.carousel-control-next-icon:hover
{
filter:invert(100%)
}

.carousel-control-prev-icon:hover
{
filter:invert(100%)
}
 




.con1
{
    background-color: white;
    max-width:100%;
    height: 100%;
    padding-bottom:1.5em;
    display: block;
    text-align: center;
    
}

.head_name{
  height: 40px;
  align-content: center;
  vertical-align: center;
}

.image
{
    align-content: center;
    display:block;
    margin-left:auto;
    margin-right: auto; 
    max-width: 200px;
    max-height: 200px;

}
div .image
{
    text-align: center;
}
.inner
{
    background :  #7952b3;
    align-content: center;
    padding: 15px;
    height : 260px;
    transition: all 0.9s ease 0s;
    margin-bottom: 10px; 
    border-radius: 7%;   
    opacity:0.8;

}
.inner h4
{
    color:#fff;
    font-size:22px;
    font-weight:bold;
    text-align: center;
    
}

.inner img{
    transition: all 0.9s ease;
    width: 143px;
    height: 143px;
    align-content: center;
    border-radius: 50%;

}
 
.inner:hover img{
    transform: scale(1.15);
}
.inner:hover{
  box-shadow: 0 5px 10px 0 rgba(0,0,0,0.2);
}

.cat_head
{
  text-align: left;
  padding-left: 5px;
}

.view
{
  text-align: right;
  font-size:20px; 
}


.line
{
  width: 200px;
    height: 30px;
    border-style: solid;
    border-color:  #7952b3;
    border-width: 1px 0 0 0;
    border-radius: 20px; 
}
hr.line:before {
  display: block;
  content: "";
  height: 30px;
  margin-top: -31px;
  border-style: solid;
  border-color: #7952b3;
  border-width: 0 0 1px 0;
  border-radius: 20px;
  }
  
  .con2,.con3{
    /* width: 100%; */
    text-align: center;
    margin-left: 40px;
    margin-right:40px ;
    padding-left: 30px;
    padding-right: 30px;
  }

  .con3{
    background-color: #e6e6f3;
    margin: 0;
  }

  .con2
  {
    padding-bottom: 20px;
  }

  .inner-width{
    max-width: 1200px;
    margin: auto;
    padding: 0 20px;
  }

  .services_head
  {
    text-align: center;
  }
  
  .services-section h1{
    text-align: center;
    font-size:40px;
    font-weight: 500;
    /* margin-bottom: 1em; */
  }
  
  .services-section h1 strong{
    color:rgb(159, 44, 212);
  }
  
  .service{
    text-align: center;
    margin: 20px 20px;
    width:240px;
    height:270px;
    background-color: rgb(255, 255, 255);
    border-radius: 10%;
   
  }

  
  .service-icon{
    width: 60px;
    height: 60px;
    margin: auto;
    background: #ecf6ff;
    border-radius: 50%;
    color: rgb(159, 44, 212);
    line-height: 60px;
    font-size: 25px;
  }
  
  .service-name{
    font-weight: 600;
    font-size: 18px;
    margin: 20px 0;
  }
  
  .service-desc{
    max-width: 400px;
    margin: auto;
    color: #333;
    font-size: 17px;
  }
  
  .owl-dots{
    text-align: center;
    margin-top: 40px;
  }
  

  
  .owl-dot{
    width: 14px;
    height: 14px;
    background: #808080 !important;
    margin: 0 6px;
    border-radius: 14px;
    outline: none;
    transition: .3s linear;
  }
  
  .owl-dot.active{
    width: 36px;
    background: rgb(159, 44, 212) !important;
  }
  
  .owl-dot:hover{
    width: 36px;
    background: rgb(159, 44, 212) !important;
  }
  

.services-section .service{
  padding: 20px;
}

<|start_filename|>public/stylesheets/style.css<|end_filename|>

*{
  margin: 0;
  padding: 0;
}

.container .row{
  padding-bottom: 10px;
  padding-top: 10px;
}
.img-thumbnail img{
  max-height: 150px;
}
.price{
  font-weight: bold;
  font-size: 16px;
}



<|start_filename|>public/stylesheets/show.css<|end_filename|>
@import url('https://fonts.googleapis.com/css?family=Baloo+Bhaijaan|Ubuntu');
body
{
	font-family:Roboto;
	/* background: #2196F3;
	background: -webkit-linear-gradient(to right, #8ef7ff, #2196F3); 
  background: linear-gradient(to right, #8ef7ff, #2196F3);  */
    background: -webkit-gradient(linear, left bottom, left top, from(#eb99eb), to(#a18cd1));
    background: -webkit-linear-gradient(bottom, #fbc2eb 0%, #a18cd1 100%);
    background: -moz-linear-gradient(bottom, #fbc2eb 0%, #a18cd1 100%);
    background: -o-linear-gradient(bottom, #fbc2eb 0%, #a18cd1 100%);
    background: linear-gradient(to top, #fbc2eb 0%, #a18cd1 100%);
    background-repeat: no-repeat;
    background-attachment: fixed;
}
.container.con1
{
    background-color: white;
    margin-top:50px;
    margin-bottom: 50px;
    border: 1px solid lightgrey;
    border-radius: 10px;
    padding: 5px 20px 15px 20px;
    width:63%;
    height:100%;
}
/* .container.con2
{
    height: fit-content;
} */
/* .con3
{
    margin-top: 5rem;

} */
b{
    color: gray;
}
.col-lg-5 .image
{
    border-right: 1.5px solid lightgrey;
    align-content: center;
    display:inline-block;
    height:100%;  
} 
.col-xs-12 .image
{
    height:100%;
    display:inline-block;
}
.category_name
{
    background-color: green;
    width: 200px;
    height:30px;
    color:white;
    font-size:16px;
    font-weight: bold;
    text-transform: uppercase;
}
.cont h2
{
    color: #555;
}

.price
{
    color:#7952b3;
    font-size: 26px;
    font-weight: bold;

}

/* input[type="number"]
{
    
    font-weight: bold;
    height: 33px;
    text-align: center;
    width: 60px;
}  */


.cart_button
{
    background-color:#7952b3;
    color: whitesmoke;
    display: inline-block;
    font-weight: 400;
    vertical-align: middle;
    border: 1px solid transparent;
    padding: .375rem .75rem;
    font-size: 1rem;
    line-height: 1.5;
    border-radius: .28rem;
    width:100%;
}

.exp
{
    text-align: center;

}
button:hover
{
    opacity:1;
}

#myTab{
    margin-top: 10px;
}

.nav-link
{
    color: #7952b3;
    /* font-weight: bolder; */
}
/* .minus:hover{
    background-color:  #7952b3 !important;
}
.plus:hover{
    background-color: #7952b3 !important;
}
.t_amt span .tp
{
    line-height: 10px;
    font-weight: bolder;
    font-size: 23px;
    font-family: sans-serif;

}

.qty .count {
    padding: 0;
    margin: 0;
    color: #000;
    display: inline-block;
    vertical-align: top;
    font-size: 20px;
    font-weight: 700;
    line-height: 25px;
    padding: 0 2px;
    text-align: center;
}
.qty .plus {
    cursor: pointer;
    display: inline-block;
    vertical-align: top;
    color: white;
    width: 30px;
    height: 30px;
    font: 30px/1 Arial,sans-serif;
    text-align: center;
    border-radius: 50%;
    }
.qty .minus {
    cursor: pointer;
    display: inline-block;
    vertical-align: top;
    color: white;
    width: 30px;
    height: 30px;
    font: 30px/1 Arial,sans-serif;
    text-align: center;
    border-radius: 50%;
    background-clip: padding-box;
} */

/*Prevent text selection*/
span{
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}
input{  
    border: 0;
    width: 2%;
}
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input:disabled{
    background-color:white;
}





/* 

.detail1{
    margin-top: 20px;
}
.detail2{
    margin-bottom: 50px;
} */


button:disabled{
    border: 1px solid #999999;
    background-color: #cccccc;
    color: #666666;
} 

.inStock{
    color: green;
    font-weight: 700;
}

.outOfStock{
    color: red;
    font-weight: 700;
}






/* .payment{
  padding: 5px 20px 15px 20px;
  border-radius: 3px;
  margin-top:1rem;
  background: #f8f8f8;
  margin: 80px auto;
  height: 90%;
  padding: 35px;
  padding-top:40px;
  border-radius: 5px;
  position: relative;
} 

.jumbo
{
border:1px solid black;
width:10rem;
padding:1rem;
}
.not_selected
{
display:none;
} */
  
  /* .payment-logo{
    position: absolute;
    top: -50px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 100px;
    background: #f8f8f8;
    border-radius: 50%;
    box-shadow: 0 0 5px rgba(0,0,0,0.2);
    text-align: center;
    line-height: 85px;
  }
  
  .payment-logo:before{
    content: "";
    position: absolute;
    top: 5px;
    left: 5px;
    width: 90px;
    height: 90px;
    background:#7952b3;
    border-radius: 50%;
  }
  
  .payment-logo p{
    position: relative;
    color: #f8f8f8;
    font-family: '<NAME>', cursive;
    font-size: 58px;
    vertical-align: middle;
  }
  */

  /* .payment h2{
    text-align: center;
    letter-spacing: 2px;
    margin-bottom: 15px;
    color: #0d3c61;
  } */

<|start_filename|>public/stylesheets/css/orders.css<|end_filename|>

input::-webkit-datetime-edit{ color: transparent; }
input:focus::-webkit-datetime-edit{ color: #a9afbbd1; }

.idd
{
  color: #8b92a9;
}
.dark-edition a {
   color: #8b92a9;
}

#orders tr:hover {
    background-color: rgb(66, 60, 88);
}

#orders td:hover {
    cursor: pointer;
}
#pending_orders tr:hover {
  background-color: rgb(66, 60, 88);
}

#pending_orders td:hover {
  cursor: pointer;
}



.btnn
{
  color: #fff;
  background-color:#913f9e;
}

.label
{
  display:inline-block;
  padding:3px 10px;
  color:white;
  font-weight: 400;
  border-radius: .25rem;
  font-size: 75%;
}


.dark-edition .btn
{
   background-color: none;
}



.form-control:focus
{
  color: rgb(255, 255, 255);
}

.searchh
{
color:rgb(255, 255, 255);
 font-size:15px;
  width:25%;
  outline: 1px ridge rgb(109, 58, 114);
  background-color: transparent;
}

#checked
{
  display: inline-block;
  margin: 5px auto;
  width: 30%;
  outline: 3px ridge rgb(225, 157, 231);
}

input.checkmark
{
  height: 20px;
  width: 20px;
}

 .btn-group {
		float: right;
	}

.btn-group .btn {
  min-width: 90px;
  border-radius: 2px;
  border: none;
  padding: 6px 12px;
font-size: 15px;
  outline: none !important;
  height: 40px;
  }
  

  button{
    border: none;
  }

  button:disabled{
  border: 1px solid #999999;
  background-color: #cccccc;
  color: #666666;
} 






<|start_filename|>public/stylesheets/css/my_orders.css<|end_filename|>
@import url('https://fonts.googleapis.com/css?family=Baloo+Bhaijaan|Ubuntu');
body
{
	font-family:Roboto;
	/* background: #2196F3;
	background: -webkit-linear-gradient(to right, #8ef7ff, #2196F3); 
  background: linear-gradient(to right, #8ef7ff, #2196F3);  */
    background: -webkit-gradient(linear, left bottom, left top, from(#eb99eb), to(#a18cd1));
    background: -webkit-linear-gradient(bottom, #fbc2eb 0%, #a18cd1 100%);
    background: -moz-linear-gradient(bottom, #fbc2eb 0%, #a18cd1 100%);
    background: -o-linear-gradient(bottom, #fbc2eb 0%, #a18cd1 100%);
    background: linear-gradient(to top, #fbc2eb 0%, #a18cd1 100%);
    background-repeat: no-repeat;
    background-attachment: fixed;
}
.payment{
  padding: 5px 20px 15px 20px;
  /*border: 1px solid lightgrey;*/
  border-radius: 3px;
  margin-top:1rem;
  background: #f8f8f8;
  margin: 80px auto;
  padding: 35px;
  padding-top: 40px;
  border-radius: 5px;
  position: relative;
} 

  .jumbo
  {
    border:1px solid black;
    width:10rem;
    padding:1rem;
  }
  .not_selected
  {
    display:none;
  }
  
  .payment-logo{
    position: absolute;
    top: -50px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 100px;
    background: #f8f8f8;
    border-radius: 50%;
    box-shadow: 0 0 5px rgba(0,0,0,0.2);
    text-align: center;
    line-height: 85px;
  }
  
  .payment-logo:before{
    content: "";
    position: absolute;
    top: 5px;
    left: 5px;
    width: 90px;
    height: 90px;
    background:#7952b3;
    border-radius: 50%;
  }
  
  .payment-logo p{
    position: relative;
    color: #f8f8f8;
    font-family: '<NAME>', cursive;
    font-size: 58px;
    vertical-align: middle;
  }
 

  .payment h2{
    text-align: center;
    letter-spacing: 2px;
    margin-bottom: 15px;
    color: #0d3c61;
  }

<|start_filename|>public/javascripts/checkout.js<|end_filename|>
$('input:radio[name=Radio]').change(function(){
    if($(this).attr("value")==="online")
    {
        Stripe.setPublishableKey('<KEY>');
        var $form = $('#checkout-form');
        $form.submit(function(event){
        $('#charge-error').addClass('d-none');
        $form.find('button').prop('disabled', true);
        Stripe.card.createToken({
            number: $('#ccnum').val(),
            cvc: $('#cvc').val(),
            exp_month: $('#expmonth').val(),
            exp_year: $('#expyear').val(),
            name: $('#cname').val()
        }, stripeResponseHandler);
        return false;
        });
        function stripeResponseHandler(status, response){
            if(response.error){
                $('#charge-error').text(response.error.message);
                $('#charge-error').removeClass('d-none');
                $form.find('button').prop('disabled', false);
            } else {
                var token = response.id;
                $form.append($('<input type="hidden" name="stripeToken" />').val(token));
                $form.get(0).submit();
            }
        }
    }
});
    
var pay=document.querySelector("#pay");
$('input[type=radio]').click(function()
{
    if($('input[value=online]').prop("checked")) {
        pay.classList.remove("not_selected");

    }else if($('input[value=b]').prop("checked")){
        pay.classList.add("not_selected");
    }
});


<|start_filename|>public/stylesheets/css/search.css<|end_filename|>

.searchh
{
color:rgb(255, 255, 255);
 font-size:15px;
  width:25%;
  outline: 1px ridge rgb(109, 58, 114);
  background-color: transparent;
}



<|start_filename|>config/passport.js<|end_filename|>
const passport = require('passport');
const fetch = require('node-fetch');

const User = require('../models/user');
const LocalStrategy = require('passport-local').Strategy;
const adminCode = "secretcode";

/*done(err,__) err as a first parameter*/
passport.serializeUser(function(user, done){
    done(null, user.id);
});

passport.deserializeUser(function(id, done){
    User.findById(id, function(err,user){
        done(err, user);
    });
});

passport.use('local.signup', new LocalStrategy({
    usernameField: 'email',
    passwordField: 'password',
    passReqToCallback: true
}, function (req,email, password, done){
    User.findOne({'email': email}, async function(err, user){
        if(err){
            return done(err);
        }
        if(req.body.fullname=="" || req.body.username==""){
            return done(null, false, {message: 'Missing credentials'});
        }

        /* Google recaptcha v2 */
        let captcha = Object.values(req.body)[4];
        const secretKey = process.env.CAPTCHASECRETKEY;
        if(captcha === undefined || captcha==='' || captcha === null){
            return done(null, false, {message: 'Please select captcha'});
        }
        
        const verifyUrl = `https://www.google.com/recaptcha/api/siteverify?secret=${secretKey}&response=${captcha}&remoteip=${req.connection.remoteAddress}`;
        //make request
        const body = await fetch(verifyUrl).then(res => res.json());
        //If not success
        if(body.success !== undefined && !body.success){
            return done(null, false, {message: 'Failed captcha'});
        }
        /* If reached here then recaptcha success */
        if(user){
            return done(null, false, {message: 'Email is already in use'});
        }
        if(req.body.isseller!=""){
            if(req.body.isseller!=adminCode){
                return done(null, false, {message: 'Admin Code is incorrect. Please signup as a user instead'});
            }
        }
        var newUser = new User();
        newUser.fullname = req.body.fullname;
        newUser.email = email;
        newUser.password = <PASSWORD>(password);
        if(req.body.isseller==adminCode){
            newUser.isSeller = true;
        }
        newUser.save(function(err, result){
            if(err){
                return done(err);
            }
            return done(null, newUser);
        });
    });
}));

passport.use('local.signin', new LocalStrategy({
    usernameField: 'email',
    passwordField: 'password',
    passReqToCallback: true
}, function(req, email, password, done){
    User.findOne({'email': email},function(err, user){
        if(err){
            return done(err);
        }
        if(!user){
            return done(null, false, {message: 'No user found.'});
        }
        if(!user.validPassword(password)){
            return done(null, false, {message: 'Incorrect password.'});
        }
        return done(null, user);
    });
}))

<|start_filename|>routes/index.js<|end_filename|>
var express = require('express');
var router = express.Router();

var Product = require("../models/product");
var Order = require("../models/order");
var User = require("../models/user");
var ObjectId = require('mongoose').Types.ObjectId;


function Paginator(items, page, per_page) {
  var page = parseInt(page) || 1,
  per_page = parseInt(per_page) || 6,
  offset = (page - 1) * per_page,

  paginatedItems = items.slice(offset).slice(0, per_page),
  total_pages = Math.ceil(items.length / per_page);
  return {
    page: page,
    limit: per_page,
    prev_page: page - 1 ? page - 1 : null,
    next_page: (total_pages > page) ? page + 1 : null,
    total: items.length,
    total_pages: total_pages,
    data: paginatedItems
  };
}

/* GET home page. */
router.get('/', function(req, res, next) {
    var successMsg = req.flash('success')[0];
    var errorMsg = req.flash('error')[0];
    var isIcon;
    if(successMsg==="Added to Cart"){
      isIcon = true;
    }
    
    Product.find({},function(err, allProducts){
      if(err){
        console.log(err);
      }else{
        res.render('shop/homepg', { products: allProducts, successMsg: successMsg, errorMsg: errorMsg ,noMessages: !successMsg, noError: !errorMsg, isIcon: isIcon});
      }
    });
});

router.get('/category/allproducts' ,(req, res) => {
  var successMsg = req.flash('success')[0];
  var errorMsg = req.flash('error')[0];
  var isIcon;
  if(successMsg==="Added to Cart"){
    isIcon = true;
  }
  var catg = "All products";
  Product.find({}, function(err, foundProducts){
    if(err){
      console.log(err);
    } else {
      console.log("Found: ",foundProducts);
      var result = Paginator(foundProducts,req.query.page,req.query.limit || 12);
      res.render('shop/all-products', { products: result.data, paginationResult: result ,category: catg ,successMsg: successMsg, errorMsg: errorMsg ,noMessages: !successMsg, noError: !errorMsg, isIcon: isIcon});
    }
  })
});

router.get('/category/:name' ,(req, res) => {
  var successMsg = req.flash('success')[0];
  var errorMsg = req.flash('error')[0];
  var isIcon;
  if(successMsg==="Added to Cart"){
    isIcon = true;
  }
  var catg = req.params.name;
  Product.find({category: catg}, function(err, foundProducts){
    if(err){
      console.log(err);
    } else {
      var result = Paginator(foundProducts,req.query.page,req.query.limit);
      //console.log(result);
      res.render('shop/category_products', { products: result.data, paginationResult: result ,category: catg ,successMsg: successMsg, errorMsg: errorMsg ,noMessages: !successMsg, noError: !errorMsg, isIcon: isIcon});
    }
  })
});




router.get('/developer',function(req,res){
  res.render('developers/developer');
});


/* ************************************************ */

router.get('/api/products',function(req,res){
  Product.find({},function(err,allProducts){
    if(err){
      console.log(err);
    }
    else{
      res.json(allProducts);
    }
  });
});

/* Daily Sales Data */ 
router.get('/api/daily-sales',function(req,res){
  Order.aggregate(
    [
      {$match: {}},
      {$group: {_id: "$purchaseDate", total: {$sum: "$cart.totalPrice"}}}
    ], function(err,result){
      res.json(result);
    }
  )
});

/*
router.get('/test1',function(req,res){
  Order.aggregate(
    [
      {$match: {}},
      {$group: {
                _id: {
                      month: {$month: "$purchaseDate"},
                      year: {$year: "$purchaseDate"}
                    }, total: {$sum: "$cart.totalPrice"}}}
    ], function(err,result){
      res.json(result);
    }
  )
});*/

/* Every Product Sales Data */ 

router.get('/api/product-sales/:category',function(req,res){
  Product.aggregate(
    [
      {$match: { $and: [ {category: req.params.category}, { soldQty: { $gt: 0 } } ] } },
      {$project: {_id: 1,title: 1,price: 1,soldQty: 1,brand: 1,qty: 1,category: 1}},
      {$sort: {soldQty: -1}}    
    ], function(err,result){
      res.json(result);
    }
  )

});


/* Daily Orders Data */

router.get('/api/daily-orders-count',function(req,res){
  Order.aggregate(
    [
      {$match: {}},
      {$group: {_id: "$purchaseDate", count: {$sum: 1}}}
      
    ], function(err,result){
      res.json(result);
    }
  )
});



module.exports = router;

function isLoggedIn(req, res, next){
  if(req.isAuthenticated()){
      return next();
  }
  req.session.oldUrl = req.url;
  res.redirect('/user/signin');
}



<|start_filename|>public/stylesheets/css/developer.css<|end_filename|>
@import url('https://fonts.googleapis.com/css?family=Poppins:100,200,300,400,500,600,700,800,900&display=swap');
body{
    margin: 0;
    padding: 0;
    text-align: center;
    min-height: 100vh;
    background: #060c21;
    font-family: 'Poppins', sans-serif;
}

h1{
    color: #fff;
    font-size: 36px;
}
h1:after{
    content: "";
    position: absolute;
    top: 75px;
    width: 125px;
    height: 2px;
    bottom: 0;
    left: 46%;
    border-bottom: 2px solid #fff;
    opacity: 0.3;
}
.container
{
    position: relative;
    align-items: center;
    margin-left: auto;
    margin-right: auto;
    width: 60%;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    grid-template-rows: auto;
    grid-gap: 0 40px;
}

.container .box
{
    position: relative;
    height: 500px;
    background: #060c21;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid #000;
    margin-top: 20px;
    margin-bottom: 20px;
}

.container .box:before
{
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: #fff;
    transform: skew(2deg,2deg);
    z-index: -1;
}

.container .box:nth-child(1):before
{
    background: linear-gradient(315deg, #ff0057,#e64a19);
}
.container .box:nth-child(2):before
{
    background: linear-gradient(315deg, #89ff00,#00bcd4);
}
.container .box:nth-child(3):before
{
    background: linear-gradient(315deg, #e91e63,#5d02ff);
}

.container .box:after
{
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;
    height: 100%;
    background: rgba(255,255,255,.05);
    pointer-events: none;
}


.content
{
    position: relative;
    padding: 20px;
}
.box .content h2
{
    position: absolute;
    top: -60px;
    right: -20px;
    margin: 0;
    padding: 0;
    font-size: 10em;
    color: rgba(255,255,255,.05);
    transition: 0.5s;
}

.box:hover .content h2
{
    top: -110px;
}

.box .content h3
{
    margin: 0 0 10px;
    padding: 0;
    font-size: 24px;
    font-weight: 500;
    color: #fff;
}

.box .content p
{
    margin: 0;
    padding: 0;
    font-size: 16px;
    color: #fff;
}

.box .content a
{
    position: relative;
    margin: 20px 0 0;
    padding: 10px 20px;
    text-decoration: none;
    display: inline-block;
    color: #fff;
    transition: 0.5s;
    transform: translateY(-40px);
    opacity: 0;
    visibility: hidden;
    border-radius: 10px;

}

.box .content a i
{
    font-size: 24px;
}

.box:hover .content a
{
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

.box:hover .content a:hover
{
    color: #000;
    background:rgb(255, 255, 255);
    transition: 0.5s;
}



.box .content img
{
    display: block;
    margin-left: auto;
    margin-right: auto;
    height: 175px;
    width: 200px;
    border-radius: 50%;
    padding-bottom: 20px;
    padding-top: 20px;

}

<|start_filename|>public/stylesheets/csshome/finalheader.css<|end_filename|>

@import url('https://fonts.googleapis.com/css?family=Baloo+Bhaijaan|Ubuntu');

.con_head {
    margin: 0 auto;
    width: 100%;
  }


.headd
{
 
  background-color: #563d7c;
  box-shadow: 0 0.5rem 1rem rgba(0,0,0,.05), inset 0 -1px 0 rgba(0,0,0,.1);
  width:100%;
  background-color:#563d7c;
  text-decoration:none;
  width: 100%;
  font-family: "Lato";
  color: black;
  background-size: cover;
  background-position: center; 
  height:65px;
  
}


.logo
{
    max-width: 50px;
    max-height:50px ;
}

#navBarSearchForm
{
    display: flex;
    margin-right: 10px;
    margin-left: 70px;
}


.name
{
    color: white;
    font-weight: 400;
    font-size:27px;
    vertical-align: middle;

}

.ni
{
    color:white;
    font-size: 20px;
    font-weight: 400;
    text-decoration: none;
    vertical-align: middle;
}

.ni:hover {
    text-decoration: none;
    }


    


/* search */


.pulse{
  background: none;
  border: 2px solid;
  font: inherit;
  font-weight: 200;
  line-height: 1;
  margin: 0.5em;
  padding: .25em .25em;
  color: #563d7c;
  transition: 0.25s;

} 
.pulse:focus {
  animation: pulse 1s;
  border-color: #563d7c;
  color: #7952b3;
  box-shadow: 0 0 0 2em rgba(#fff,0);
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 var(--hover); }
}

.offset {  
  box-shadow: 
    0.3em 0.3em 0 0 var(--color),
    inset 0.3em 0.3em 0 0 var(--color);

}

.offst:hover,.offset:focus
{
  box-shadow: 
      0 0 0 0 var(--hover),
      inset 6em 3.5em 0 0 var(--hover);
}

.center {
  width: 60px;
  height: 60px;
  margin-top: 13px;
  max-width: 60px;
  max-height: 60px;
}

body::-webkit-scrollbar {
  width: 10px;               /* width of the entire scrollbar */
}

body::-webkit-scrollbar-track {
  background: #efe8f8;        /* color of the tracking area */
}
body::-webkit-scrollbar-thumb {
  background-color:#9b939e ; /* color of the scroll thumb */
  border-radius: 20px;       /* roundness of the scroll thumb */
  /* border: 2.5px solid #6f00ca ; creates padding around scroll thumb */
}
/* 
.search_input:focus+div#match-list{
  display:block;
} */

.match_list {
  height: 328px;
  overflow-y:auto;
  
}
.dropp
{
  color:rgb(0, 0, 0);
  font-size: 18px;
} 
.rightt
{
  color:black;
} 

.dropp:hover{
  text-decoration: none;
  color:rgb(0, 0, 0);

}
.prdct-detail
{
  color:rgb(81, 85, 81);
  font-size: 15px;
}
.prdct-brand
{
  background-color: rgb(203, 200, 240);
}
.prdct-price
{
  color: rgb(201, 27, 62);
  font-size: 17px;
  font-weight: 700;
}
.itemm{
  max-width:100%;
  max-height:100%;
  margin-bottom:-20px;
  margin-top:-20px ;
  padding-right: 0px;
   padding-left: 0px;

}
.itemm:hover
{
  text-decoration: none;
}
.dropdown-content{
  padding-left: 0.5em;
  padding-right: 0.25em;
}
.dropdown-content:hover
{
  background-color: rgb(226, 222, 222);
  text-decoration: none;
}
  
.searchbar{
    margin-left:27px;
    margin-bottom: auto;
    margin-top: auto;
    height: 50px;
    background-color: white;
    border-radius: 25px;
    padding: 10px;
    align-content: center;
    vertical-align: middle;
    }

    .search_input{
    color: black;
    border: 0;
    outline: 0;
    background: none;
    width: 0;
    caret-color:transparent;
    transition: width 0.4s linear;
    vertical-align: middle;
    align-content: center;
    font-size: 22px;
    justify-content: center;
    }

    .s_label
    {
      vertical-align: middle;
      align-content: center;
      font-size: 22px;
      justify-content: center;
      color: black;
    }

    .searchbar:hover > .search_input{
    width: 400px;
    caret-color:black;
    transition: width 0.4s linear;
    vertical-align: middle;
    }

    .searchbar:hover > .search_icon{
    background: white;
    color:  #7952b3;
    }


    .search_icon{
    height: 25px;
    width: 25px;
    float: right;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    color: #7952b3;
    text-decoration:none;
    }

    body{
      padding-top: 65px;
    }

    .search-add-to-cart:hover > button{
      color: white;
      background-color: #7952b3;
      border-color: #7952b3;
    }

<|start_filename|>public/stylesheets/csshome/map.css<|end_filename|>
.mapouter
{
    position:relative;
    text-align:left;
    height:400px;
}

.gmap_canvas 
{
    overflow:hidden;
    background:none!important;
    height:400px;
}

.contact
{
 border-style: solid;
 border-color: #7952b3;
 border-radius: 10px;
}
.head_contact
{
    font-weight: bold;
    font-size:2rem;
}

<|start_filename|>models/product.js<|end_filename|>
var mongoose = require('mongoose');
var productSchema = new mongoose.Schema({
    image: {type: String, required: true},
    title: {type: String, required: true},
    description: {type: String, required: true},
    price: {type: Number, required: true},
    qty: {type: Number, required: true},
    soldQty: {type: Number, default: 0},
    _tags: {type: Array},
    category: {type: String, required: true},
    composition: {type: String, required: true},
    mfgDate: {type: String, required: true},
    expDate: {type: String, required: true},
    brand: {type: String, required: true},
    precautions: {type: String, required: true},
    tablets: {type: String, required: true}
});

module.exports = mongoose.model("Product", productSchema);

<|start_filename|>public/javascripts/new.js<|end_filename|>

$(".dropdown-menu li").click(function(){
    var selText = $(this).text();
    $(this).parents('.btn-group').find('.dropdown-toggle').html(selText+' <span class="caret"></span>');
  });

<|start_filename|>public/javascripts/search.js<|end_filename|>

function myFunction() {
  var input, filter, table, tr, td, i;
  input = document.getElementById("myInput");
  filter = input.value.toUpperCase();
  table = document.getElementById("myTable1");
  tr = table.getElementsByTagName("tr");
for (i = 1; i < tr.length; i++) {
    // Hide the row initially.
    tr[i].style.display = "none";

    td = tr[i].getElementsByTagName("td");
    for (var j = 0; j < td.length; j++) {
      cell = tr[i].getElementsByTagName("td")[j];
      if (cell) {
        if (cell.innerHTML.toUpperCase().indexOf(filter) > -1) {
          tr[i].style.display = "";
          break;
        } 
      }
    }
}
}

 
function order_list_search() {
  var input, filter, table, tr, td, i;
  input = document.getElementById("myInput");
  filter = input.value.toUpperCase();
  table = document.getElementById("order_list");
  tr = table.getElementsByTagName("tr");
for (i = 1; i < tr.length; i++) {
    // Hide the row initially.
    tr[i].style.display = "none";

    td = tr[i].getElementsByTagName("td");
    for (var j = 0; j < td.length; j++) {
      cell = tr[i].getElementsByTagName("td")[j];
      if (cell) {
        if (cell.innerHTML.toUpperCase().indexOf(filter) > -1) {
          tr[i].style.display = "";
          break;
        } 
      }
    }
}
}

function orders_search(id) {
  var input, filter, table, tr, td, i;
  input = document.getElementById(id);
  filter = input.value.toUpperCase();
  table = document.getElementById("orders"); 
  tr = table.getElementsByTagName("tr");
for (i = 1; i < tr.length; i++) {
    // Hide the row initially.
    tr[i].style.display = "none";

    td = tr[i].getElementsByTagName("td");
    for (var j = 0; j < td.length; j++) {
      cell = tr[i].getElementsByTagName("td")[j];
      if (cell) {
        if (cell.innerHTML.toUpperCase().indexOf(filter) > -1) {
          tr[i].style.display = "";
          break;
        } 
      }
    }
}
}

function pending_orders_search(id) {
  var input, filter, table, tr, td, i;
  input = document.getElementById(id);
  filter = input.value.toUpperCase();
  table = document.getElementById("pending_orders");
  tr = table.getElementsByTagName("tr");
for (i = 1; i < tr.length; i++) {
    // Hide the row initially.
    tr[i].style.display = "none";

    td = tr[i].getElementsByTagName("td");
    for (var j = 0; j < td.length; j++) {
      cell = tr[i].getElementsByTagName("td")[j];
      if (cell) {
        if (cell.innerHTML.toUpperCase().indexOf(filter) > -1) {
          tr[i].style.display = "";
          break;
        } 
      }
    }
}
}

function user_search() {
  var input, filter, table, tr, td, i;
  input = document.getElementById("myInput");
  filter = input.value.toUpperCase();
  table = document.getElementById("users");
  tr = table.getElementsByTagName("tr");
for (i = 1; i < tr.length; i++) {
    // Hide the row initially.
    tr[i].style.display = "none";

    td = tr[i].getElementsByTagName("td");
    for (var j = 0; j < td.length; j++) {
      cell = tr[i].getElementsByTagName("td")[j];
      if (cell) {
        if (cell.innerHTML.toUpperCase().indexOf(filter) > -1) {
          tr[i].style.display = "";
          break;
        } 
      }
    }
}
}


<|start_filename|>public/stylesheets/css/store.css<|end_filename|>
button,
input {
    font-family: "Montserrat", "Helvetica Neue", Arial, sans-serif;
}

.nav-item .nav-link,
.nav-tabs .nav-link {
    -webkit-transition: all 300ms ease 0s;
    -moz-transition: all 300ms ease 0s;
    -o-transition: all 300ms ease 0s;
    -ms-transition: all 300ms ease 0s;
    transition: all 300ms ease 0s;
}

.nav-tabs {
    border: 0;
    padding: 15px 0.7rem;
}

div .nav-tabs .nav-link:hover {
    background-color: transparent;
    border-radius: 30px;
    background-color:#7b1fa2;
}
div .nav-tabs .nav-link
{
   color:#FFFFFF;
   border:0;
}
div .nav-tabs .nav-item.show .nav-link, 
div .nav-tabs .nav-link.active {
    background-color:#7b1fa2;
    border-radius: 30px;
    color: #FFFFFF;
}
.searchh
{
 font-size:15px;
  width:25%;
  /* border-bottom: red; */
  outline: 1px ridge rgb(109, 58, 114);
}


<|start_filename|>models/order.js<|end_filename|>
var mongoose = require('mongoose');
var Schema = mongoose.Schema;

var orderSchema = new Schema({
    user: {type: Schema.Types.ObjectId, ref: 'User'},
    cart: {type: Object, required: true},
    address: {type: String, required: true},
    name: {type: String, required: true},
    paymentId: {type: String},
    paymentMode: {type: String, required: true},
    purchaseDate: { type: Date, default: Date.now },
    isConfirmed: {type: Boolean, default: false},
    isDelivered: {type:Boolean, default: false},
    city: {type: String, required: true},
    state: {type: String, required: true},
    zip: {type: String, required: true}
});

module.exports = mongoose.model("Order", orderSchema);

<|start_filename|>public/stylesheets/css/category_products.css<|end_filename|>

.pagination {
    margin-top: 20px;
} 
.pr
{
    font-size: larger;
    font-weight: bold;
}
.line_hr
{
    height: 30px;
    border-style: solid;
    border-color:  #7952b3;
    border-width: 1px 0 0 0;
    border-radius: 20px; 
}
hr.line_hr:before {
  display: block;
  content: "";
  height: 30px;
  margin-top: -31px;
  border-style: solid;
  border-color: #7952b3;
  border-width: 0 0 1px 0;
  border-radius: 20px;
  }
  .cat_hd
{
  margin-top:10px;
  text-align: left;
  padding-left: 5px;
  text-shadow: 0 2px 2px grey;
  font-size: 30px;

}
.cart_button
{
    background-color:#7952b3;
    opacity: 0.9;
    color: whitesmoke;
    display: inline-block;
    font-weight: 400;
    vertical-align: middle;
    border: 1px solid transparent;
    padding: .375rem .75rem;
    font-size: 1rem;
    line-height: 1.5;
    border-radius: .28rem;
}
a span{
    color:black;
}
button:hover
{
    opacity:1;
}
.container .con1
{
    width:100%;
    height:200px;
    padding:0;
}
.container .con1 img
{
    max-width: 100%;
    height:100%;
}

.card-body
{
    background-color: rgb(241, 240, 243);
}

button:disabled{
    border: 1px solid #999999;
    background-color: #cccccc;
    color: #666666;
} 

.card-img-top
{
    width:100%;
    height:100%;
}




.pagination{
    justify-content: center;
    align-items: center;
}

.page-link{
    border: 1px solid #7952b3;
    color: #7952b3;
    margin: 2px;
}

<|start_filename|>public/stylesheets/css/map.css<|end_filename|>
.mapouter
{
    position:relative;
    text-align:left;
    height:550px;
    max-width: 100%

}

.gmap_canvas 
{
    overflow:hidden;
    background:none!important;
    height:700px;
}

.contact
{
 border-style: solid;
 border-color: #7952b3;
 border-radius: 10px;
 color: white;

}
.head_contact
{
    font-weight: 400;
    font-size:2rem;
    color: white;
}
