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.9)

 

About The EJS Template Structure

This HTML structure implements a stock filter page for a garment shop's admin dashboard. It includes a vertical navigation sidebar with links for various pages like "Bill," "View Stocks," "Add Stock," and "Filters" for sales and stock. The main content section allows the admin to filter stock by brand or category using radio buttons and a form submission.

When a filter is selected, the filtered results (either by brand or category) display the total stock, stock left, size, and stock value in a styled table. The page also uses external libraries such as Semantic UI, Bootstrap, and jQuery for styling and functionality. Additionally, it includes a toggleable sidebar for navigation.

stock_filter.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">
  <!--Custom CSS-->
  <link rel="stylesheet" href="/css/style.css">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.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>Stock Filter</title>
</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 0%, #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" >
                  <i class="home icon"></i>
                  Dashboard
              </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-info">
      CUSTOMIZE
    </h5>
 
    <ul class="nav flex-column bg-white mb-0">
      <!-- <li class="nav-item">
        <a href="/stocks" class="nav-link text-dark font-italic">
                  <i class="fa fa-area-chart mr-3 text-primary fa-fw"></i>
                  Add Stock
              </a>
      </li> -->
      <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" style="background: linear-gradient(to right, #90EE90 0%, #FFB385 68%);">
          <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 -->
   
       <!-- <h1 class="text-primary">DASHBOARD</h1> -->
       <h1>Stocks Filter</h1>
       <br>
        <center><img class="ui large rounded image" src="/css/stock_filter.svg"></center>
        <br>
        <form action="/stock_filter/stock_filter_query" method="POST">
        <div class="ui three column grid">
          <div class="row">
          <div class="column">
          <h3>Select Filter</h3>
          </div>
          <div class="column">
            <div class="form-check form-check-inline form-switch">
                <input class="form-check-input" type="radio" name="exampleRadios1" id="exampleRadios11" value="brand">
                <label class="form-check-label" for="exampleRadios11">
                    Brand
                </label>
            </div>
            <div class="form-check form-check-inline form-switch">
                 <input class="form-check-input" type="radio" name="exampleRadios1" id="exampleRadios22" value="category">
                <label class="form-check-label" for="exampleRadios22">
                    Category
                </label>
            </div>
         
            </div>
           
            </div>
            </div>

            <br>

    <center>
    <div class="ui left corner labeled action input">
      <button class="ui teal button" type="submit">Apply Filter</button>
      <div class="ui corner label">
        <i class="asterisk icon"></i>
      </div>
    </div>
  </center>
  </form>
  <% if (filter_type == 'brand') { %>
    <center>
      <br>
      <h2 class="text-primary">Showing Results for BRAND </h2>
      <br>
      <div class="ui container">
        <div class="ui card">
          <div class="content">
            <div class="center aligned header"></div>
            <div class="center aligned description">
              <h1 class="text-success"><i class="shopping cart icon"></i><% total_items.forEach(function(order){ %>
                <%= order.quantity %>
              <% }); %></h1>
            </div>
          </div>
          <div class="extra content">
            <div class="center aligned author">
              Total Items in Stock
            </div>
          </div>
        </div>
      </div>
    <table class="ui inverted violet table table-bordered" >
      <thead>
      <tr class="table-success">
          <th>Brand <i class="yelp icon"></i></th>
          <th>Size <i class="fas fa-ruler"></i></th>
          <th>Stock Left<i class="cart arrow down icon"></i></th>
          <th>Stock Value <i class="rupee sign icon"></i></th>
      </tr>
  </thead>
  <tbody>
      <% display_content.forEach(function(order){ %>
          <tr style="background: linear-gradient(to left, #90EE90 0%, #FFB385 68%);">
              <td><%= order.Brand %></td>
              <td><%= order.Size %></td>
              <td><%= order.quantity %></td>
              <td><i class="rupee sign icon"></i> <%= order.quantity * order.Amount %> </td>
          </tr>
      <% }); %>
    </tbody>
  </table>
</center>
  <% } %>

  <% if (filter_type == 'category') { %>
    <center>
      <br>
      <h2 class="text-primary">Showing Results for Filter_Type = CATEGORY </h2>
      <br>
      <div class="ui container">
        <div class="ui card">
          <div class="content">
            <div class="center aligned header"></div>
            <div class="center aligned description">
              <h1 class="text-success"><i class="shopping cart icon"></i><% total_items.forEach(function(order){ %>
                <%= order.quantity %>
              <% }); %></h1>
            </div>
          </div>
          <div class="extra content">
            <div class="center aligned author">
              <i class="shopping cart icon"></i> Total Items in Stock
            </div>
          </div>
        </div>
    <table class="ui inverted violet table table-bordered" >
      <thead>
      <tr class="table-success">
          <th>Category <i class="list icon"></i></th>
          <th>Size <i class="fas fa-ruler"></i></th>
          <th>Stock Left <i class="cart arrow down icon"></i></th>
          <th>Stock Value <i class="rupee sign icon"></i></th>
      </tr>
  </thead>
  <tbody>
      <% display_content.forEach(function(order){ %>
          <tr style="background: linear-gradient(to left, #90EE90 0%, #FFB385 68%);">
              <td><%= order.Category %></td>
              <td><%= order.Size %></td>
              <td><%= order.quantity %></td>
              <td><i class="rupee sign icon"></i> <%= order.quantity * order.Amount %> </td>
          </tr>
      <% }); %>
    </tbody>
  </table>
</center>
  <% } %>
   </div>
  <!-- End demo content -->
 
 
 
  <br>
 
 
  <!--Semantic UI Scripts-->
  <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.2.13/semantic.min.js"></script>
  <!-- Option 1: Bootstrap Bundle with Popper -->
  <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/js/bootstrap.bundle.min.js" integrity="sha384-b5kHyXgcpbZJO/tY9Ul7kGkf1S0CWuKcCD38l8YkeH8z8QjE0GmW1gYU5S9FOnJ0" crossorigin="anonymous"></script>
  <script>
    $(function() {
  // Sidebar toggle behavior
  $('#sidebarCollapse').on('click', function() {
    $('#sidebar, #content').toggleClass('active');
  });
});

  </script>
</body>
</html>

stock_filterController.js file


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

const stock_filterControllers = {
  getBrands: (callback) => {
    const query = "SELECT DISTINCT Brand, Size,  quantity, Amount FROM add_stock";
    db.query(query, (err, results) => {
      if (err) {
        console.error('Error fetching brands: ' + err.stack);
        callback(err, null);
      } else {
        callback(null, results);
      }
    });
  },

  getCategories: (callback) => {
    const query = "SELECT DISTINCT Category, Size, quantity, Amount FROM add_stock";
    db.query(query, (err, results) => {
      if (err) {
        console.error('Error fetching categories: ' + err.stack);
        callback(err, null);
      } else {
        callback(null, results);
      }
    });
  }
};

module.exports = stock_filterControllers;


stock_filter.js file

const express = require('express');
const router = express.Router();
const stock_filterControllers = require('../controllers/stock_filterControllers');

// GET route to display the stock filter page
router.get('/', (req, res) => {
  res.render('stock_filter', { title: 'Stock Filter Management', filter_type: 'all' });
});

// POST route to handle filter form submission
router.post('/stock_filter_query', (req, res) => {
  const filterType = req.body.exampleRadios1;

  if (filterType === 'brand') {
    stock_filterControllers.getBrands((err, results) => {
      if (err) {
        return res.status(500).send('Error fetching brands');
      }
      res.render('stock_filter', {
        title: 'Stock Filter Management',
        filter_type: 'brand',
        display_content: results,
        total_items: [{ quantity: results.reduce((sum, item) => sum + item.quantity, 0) }] // Sum of all quantities
      });
    });
  } else if (filterType === 'category') {
    stock_filterControllers.getCategories((err, results) => {
      if (err) {
        return res.status(500).send('Error fetching categories');
      }
      res.render('stock_filter', {
        title: 'Stock Filter Management',
        filter_type: 'category',
        display_content: results,
        total_items: [{ quantity: results.reduce((sum, item) => sum + item.quantity, 0) }] // Sum of all quantities
      });
    });
  } else {
    res.status(400).send('Invalid filter type selected');
  }
});

module.exports = router;


Comments

Popular posts from this blog

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

What Is an API?

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