What is Amazon Nova Act AI?

Image
  What is Amazon Nova Act AI? Okay so, let me tell you about something super cool Amazon made. It's called Nova Act , and it's like a super smart robot brain that can use the internet just like we do! You know how we open websites, click stuff, type in boxes, and buy things online? Nova Act can do all that ... by itself! 1. It’s an AI Agent for Browsing the Internet So this Nova Act thing is like a robot helper that knows how to use a browser (like Chrome or Safari). It can go to websites, click buttons, fill forms, buy stuff, and even follow hard instructions without us telling it every little thing. Like imagine you said, "Hey Nova, go buy me a red t-shirt from Amazon." And guess what? It actually can go and do it all by itself! How crazy is that! 2. It Works on Its Own! One of the coolest thing about Nova Act is, once you give it a job, you don’t have to sit and watch it or tell it every step. It just knows what to do next, and it finish the task for you. Li...

How to create a Full-Stack Billing System with JavaScript, Node.js, Express, MySQL, and Semantic UI (1.0)

 


About the EJS Structure

 This index.ejs template is designed for a billing system's admin dashboard. It features a responsive vertical navigation bar and uses multiple card components to display important sales and inventory metrics such as total sales, stock, and orders. The template is styled using a combination of Bootstrap, Semantic UI, and custom CSS to create a clean, functional layout for managing the system's backend.

index.ejs file

<!DOCTYPE html>

<html lang="en">

<head>

 <meta charset="UTF-8">

  <meta http-equiv="X-UA-Compatible" content="IE=edge">

  <meta name="viewport" content="width=device-width, initial-scale=1.0">

  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">

<!--Custom CSS-->

  <link rel="stylesheet" href="/css/style.css">

  <!-- Semantic UI CSS -->

  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.2.13/semantic.min.css">

  <!-- Bootstrap CSS -->

  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BmbxuPwQa2lc/FVzBcNJ7UAyJxM6wuqIj61tLrc4wSX0szH/Ev+nYRRuWlolflfl" crossorigin="anonymous">

  <title>Billing Techno</title>

  <style>

    .bg-pink {

  background-color: pink !important;

}

  </style>

</head>

<body>

  <!--Vertical Navbar-->

  <div class="vertical-nav bg-white" id="sidebar">

    <div class="py-4 px-3 mb-4" style="background: linear-gradient(to top, #90EE90 40%,  #FFB385 68%);">

      <div class="media d-flex align-items-center"><img src="/css/admin.svg" alt="..." width="65" class="mr-3 rounded-circle img-thumbnail shadow-sm">

        &emsp;<div class="media-body">

          <h4 class="m-0"><p class="text-white">Hubuk Garments</h4>

            <p class="font-weight-light text-white mb-0"></p>

        </div>

      </div>

    </div>

    <form action="/logout?_method=DELETE" method="POST">

      <center>

        <button type="submit" class="btn btn-danger">

          <p class="text-white">Log Out</p>

        </button>

      </center>

    </form>

    <h5 class="ui horizontal divider header text-primary">

      MAIN

    </h5>

   <ul class="nav flex-column bg-white mb-0">

      <li class="nav-item">

        <a href="/" class="nav-link text-dark font-italic" style="background: linear-gradient(to right, #90EE90 0%, #FFB385 68%);">

                  <p class="text-white"><i class="home icon"></i>

                  Dashboard

                </p>

              </a>

      </li>

      <li class="nav-item">

        <a href="/bill" class="nav-link text-dark font-italic">

          <i class="rupee sign icon"></i>

                  Bill

              </a>

      </li>

      <li class="nav-item">

        <a href="/orders" class="nav-link text-dark font-italic">

          <i class="eye icon"></i>

                  View Orders

              </a>

      </li>

      <li class="nav-item">

        <a href="/viewstocks" class="nav-link text-dark font-italic">

          <i class="tags icon"></i>

                  View Stocks

              </a>

      </li>

      <li class="nav-item">

        <a href="/stocks" class="nav-link text-dark font-italic">

          <i class="plus circle icon"></i>

                  Add Stock

              </a>

      </li>

    </ul>

  <h5 class="ui horizontal divider header text-primary">

      CUSTOMIZE

    </h5>

  <ul class="nav flex-column bg-white mb-0">

      <li class="nav-item">

        <a href="/brands" class="nav-link text-dark font-italic">

          <i class="yelp icon"></i>

                  Brand

              </a>

      </li>

      <li class="nav-item">

        <a href="/categories" class="nav-link text-dark font-italic">

          <i class="bookmark icon"></i>

                  Category

              </a>

      </li>

      <li class="nav-item">

        <a href="/sizes" class="nav-link text-dark font-italic">

          <i class="check square icon"></i>

                  Size

              </a>

      </li>

    </ul>

   <h5 class="ui horizontal divider header text-primary">

      FILTERS

    </h5>

  <ul class="nav flex-column bg-white mb-0">

      <li class="nav-item">

        <a href="/sales_filter" class="nav-link text-dark font-italic">

          <i class="yelp icon"></i>

                  Sales

              </a>

      </li>

      <li class="nav-item">

        <a href="/stock_filter" class="nav-link text-dark font-italic">

          <i class="bookmark icon"></i>

                  Stock

              </a>

      </li>

    </ul>

  </div>

  <!-- End vertical navbar -->

  <!-- Page content holder -->

  <div class="page-content p-5" id="content" style="background: linear-gradient(to right, #90EE90 47%, #FFB385 100%);">

    <!-- Toggle button -->

    <button id="sidebarCollapse" type="button" class="btn btn-light bg-white rounded-pill shadow-sm px-4 mb-4"><i class="align justify icon"></i><small class="text-uppercase font-weight-bold">Menu</small></button>

   <!-- Page content -->

    <br>

    <h1><%= title %></h1>

    <br>

<% if (userId) { %>

      <p>Welcome: <%= userId %></p>

    <% } else { %>

      <p>Welcome, Guest</p>

    <% } %>

 <br>

    <h1>Dashboard</h1>

    <br>

    <center><img class="ui large rounded image" src="css/dashboard.svg"></center>

    <br>

    <br>

    <br>

    <div class="fluid container">

    <div class="ui four column grid">

      <div class="col-sm-6">

        <div class="ui fluid card text-white" style="background-color: #66CDAA;">

        <div class="content">

         <center>

         <div class="ui statistic">

         <div class="value">

          <p class="text-white"><span>&#8377;</span></p>

          </div>

           <div class="label"> Total Sales: <%= SalesValue %></div>

            </div>

          </center>

          </div>

        </div>

      </div>

      <div class="col-sm-6">

        <div class="ui fluid card text-white" style="background-color: #BC8F8F;">

        <div class="fluid content">

            <center>

            <div class="ui statistic">

              <div class="value">

                <p class="text-white"><i class="shopping cart icon"></i></p>

              </div>

              <div class="label">

                Total Orders: <%= TotalOrders %>

              </div>

            </div>

          </center>

          </div>

        </div>

      </div>

      <div class="col-sm-6">

        <div class="ui fluid card text-dark" style="background-color: #D2691E;">

          <div class="content">

            <center>

            <div class="ui statistic">

              <div class="value">

               <p class="text-white"> <i class="tags icon"></i> </p>

              </div>

              <div class="label"> Total Stock:  <%= totalStock %> </div>

            </div>

          </center>

          </div>

        </div>

      </div>

     <div class="col-sm-6">

        <div class="ui fluid card text-white " style="background-color: #B8860B;">

          <div class="fluid content">

            <center>

            <div class="ui statistic">

              <div class="value">

                <p class="text-white"> <i class="rupee sign icon"></i> </p>

              </div>

              <div class="label">Total Stock Value:  <%= StockValue %></div>

            </div>

          </center>

          </div>

        </div>

      </div>

 <div class="col-sm-6">

        <div class="ui fluid card text-white" style="background-color: #00FA9A;">

          <div class="fluid content">

            <center>

            <div class="ui statistic">

              <div class="value">

                <p class="text-white"> <i class="fas fa-box"></i> </p>

              </div>

              <div class="label">  Total Stock BY SIZE

              </div>

            </div>

            <ul>

             <% stockBySize.forEach(size => { %>

             <li><%= size.Size %>: <%= size.totalQuantity %>  items : <%= size.ItemName %></li>

              <% }) %>

            </ul>

          </center>

          </div>

        </div>

      </div>

      </div>

    </div>

    </div>

 <!-- page-content" -->

  <script src="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.2.13/semantic.min.js"></script>

  <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.2/dist/umd/popper.min.js" integrity="sha384-IQsoLXlY3/7NVhbBh+LrSIN+OASL75PZT1GRI+5URnbE6I1FZpJ0Qqg9Kg/21L1G" crossorigin="anonymous"></script>

  <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/js/bootstrap.min.js" integrity="sha384-pzjw8f+ua7Kw1TIqPTh5f1O6tL9/ScQsAP7rP2xK91QV8zI1GzU5U5i2beYgo6K" crossorigin="anonymous"></script>

  </body>

</html>

index.js file

&lt;pre&gt;

&lt;code&gt;

const express = require('express');

const router = express.Router();

const db = require('../db/connect.js');

router.get('/', async (req, res) =&gt; {

  const userId = req.session.userId;

 if (!userId) {

    // If user is not logged in, redirect to the login page

    return res.redirect('/login');

  }

  try {

    // Queries

    const stockQuery = `SELECT SUM(quantity) AS totalStock FROM add_stock`;

    const stockValueQuery = `SELECT SUM(Amount * Quantity) AS StockValue FROM add_stock`;

    const salesValueQuery = `SELECT SUM(Amount * Quantity) AS SalesValue FROM bills`;

    const ordersQuery = `SELECT SUM(quantity) AS TotalOrders FROM bills`;

    const stockByBrandQuery = `SELECT Brand, SUM(quantity) AS totalQuantity, ItemName FROM add_stock GROUP BY Brand`;

    const stockByCategoryQuery = `SELECT Category, SUM(quantity) AS totalQuantity FROM add_stock GROUP BY Category`;

    const stockBySizeQuery = `SELECT Size, SUM(quantity) AS totalQuantity, ItemName FROM add_stock GROUP BY Size`;

 // Execute queries asynchronously

    const [stockResults] = await db.promise().query(stockQuery);

    const [stockValueResults] = await db.promise().query(stockValueQuery);

    const [salesValueResults] = await db.promise().query(salesValueQuery);

    const [ordersResults] = await db.promise().query(ordersQuery);

    const [stockBySizeResults] = await db.promise().query(stockBySizeQuery);

    const [stockByCategoryResults] = await db.promise().query(stockByCategoryQuery);

    const [stockByBrandResults] = await db.promise().query(stockByBrandQuery);

 // Variables for rendering

    const totalStock = stockResults[0].totalStock || 0;

    const StockValue = stockValueResults[0].StockValue || 0;

    const SalesValue = salesValueResults[0].SalesValue || 0;

    const TotalOrders = ordersResults[0].TotalOrders || 0;

    const stockBySize = stockBySizeResults || [];

    const stockByCategory = stockByCategoryResults || [];

    const stockByBrand = stockByBrandResults || [];

 // Render the page with the fetched data

    res.render('index', {

      title: 'Welcome to the home Management System',

      userId,

      totalStock,

      StockValue,

      SalesValue,

      TotalOrders,

      stockBySize,

      stockByCategory,

      stockByBrand,

    });

  } catch (err) {

    console.error('Database error:', err);

    res.status(500).send('Internal Server Error');

  }

});

module.exports = router;

&lt;/code&gt;

&lt;/pre&gt;


indexControllers.js file 

&lt;pre&gt;
&lt;code&gt;
const db = require('../db/connect.js');

// Define a controller function
const indexControllers = () =&gt; {
  // You can include any setup code or basic operations here
  console.log('Index Controller is set up and ready to use.');
  
  db.connect((err) =&gt; {
    if (err) {
      console.error('Database connection failed: ' + err.stack);
      return;
    }
    console.log('Connected to MySQL database as ID ' + db.threadId);
  });
};

// Export the controller
module.exports = indexControllers;
&lt;/code&gt;
&lt;/pre&gt;



Comments

Post a Comment

Popular posts from this blog

What Is an API?

How to Turn Your Photos into Studio Ghibli-Style Art for Free!