Snippets Collections
#include <bits/stdc++.h>

using namespace std;

class Piece
{
private:
    virtual bool AreSquaresLegal(int srcRow, int srcCol, int destRow, int destCol, Piece *GameBoard[8][8]) = 0;
    char mPieceColor;

public:
    Piece(char PieceColor) : mPieceColor(PieceColor) {}
    ~Piece() {}
    virtual char GetPiece() = 0;
    char GetColor()
    {
        return mPieceColor;
    }
    bool IsLegalMove(int srcRow, int srcCol, int destRow, int destCol, Piece *GameBoard[8][8])
    {
        Piece *destPiece = GameBoard[destRow][destCol];
        if ((destPiece == 0) || (mPieceColor != destPiece->GetColor()))
        {
            return AreSquaresLegal(srcRow, srcCol, destRow, destCol, GameBoard);
        }
        return false;
    }
};



class PawnPiece : public Piece
{
public:
    PawnPiece(char PieceColor) : Piece(PieceColor) {}
    ~PawnPiece() {}

private:
    virtual char GetPiece()
    {
        return 'P';
    }
    bool AreSquaresLegal(int srcRow, int srcCol, int destRow, int destCol, Piece *GameBoard[8][8])
    {
        Piece *destPiece = GameBoard[destRow][destCol];
        if (destPiece == 0)
        {
            // Destination square is unoccupied
            if (srcCol == destCol)
            {
                if (GetColor() == 'W')
                {
                    if (destRow == srcRow + 1)
                    {
                        return true;
                    }
                }
                else
                {
                    if (destRow == srcRow - 1)
                    {
                        return true;
                    }
                }
            }
        }
        else
        {
            // Dest holds piece of opposite color
            if ((srcCol == destCol + 1) || (srcCol == destCol - 1))
            {
                if (GetColor() == 'W')
                {
                    if (destRow == srcRow + 1)
                    {
                        return true;
                    }
                }
                else
                {
                    if (destRow == srcRow - 1)
                    {
                        return true;
                    }
                }
            }
        }
        return false;
    }
};



class KnightPiece : public Piece
{
public:
    KnightPiece(char PieceColor) : Piece(PieceColor) {}
    ~KnightPiece() {}

private:
    virtual char GetPiece()
    {
        return 'N';
    }
    bool AreSquaresLegal(int srcRow, int srcCol, int destRow, int destCol, Piece *GameBoard[8][8])
    {
        // Destination square is unoccupied or occupied by opposite color
        if ((srcCol == destCol + 1) || (srcCol == destCol - 1))
        {
            if ((srcRow == destRow + 2) || (srcRow == destRow - 2))
            {
                return true;
            }
        }
        if ((srcCol == destCol + 2) || (srcCol == destCol - 2))
        {
            if ((srcRow == destRow + 1) || (srcRow == destRow - 1))
            {
                return true;
            }
        }
        return false;
    }
};



class BishopPiece : public Piece
{
public:
    BishopPiece(char PieceColor) : Piece(PieceColor) {}
    ~BishopPiece() {}

private:
    virtual char GetPiece()
    {
        return 'B';
    }
    bool AreSquaresLegal(int srcRow, int srcCol, int destRow, int destCol, Piece *GameBoard[8][8])
    {
        if ((destCol - srcCol == destRow - srcRow) || (destCol - srcCol == srcRow - destRow))
        {
            // Make sure that all invervening squares are empty
            int iRowOffset = (destRow - srcRow > 0) ? 1 : -1;
            int iColOffset = (destCol - srcCol > 0) ? 1 : -1;
            int iCheckRow;
            int iCheckCol;
            for (iCheckRow = srcRow + iRowOffset, iCheckCol = srcCol + iColOffset;
                 iCheckRow != destRow;
                 iCheckRow = iCheckRow + iRowOffset, iCheckCol = iCheckCol + iColOffset)
            {
                if (GameBoard[iCheckRow][iCheckCol] != 0)
                {
                    return false;
                }
            }
            return true;
        }
        return false;
    }
};



class RookPiece : public Piece
{
public:
    RookPiece(char PieceColor) : Piece(PieceColor) {}
    ~RookPiece() {}

private:
    virtual char GetPiece()
    {
        return 'R';
    }
    bool AreSquaresLegal(int srcRow, int srcCol, int destRow, int destCol, Piece *GameBoard[8][8])
    {
        if (srcRow == destRow)
        {
            // Make sure that all invervening squares are empty
            int iColOffset = (destCol - srcCol > 0) ? 1 : -1;
            for (int iCheckCol = srcCol + iColOffset; iCheckCol != destCol; iCheckCol = iCheckCol + iColOffset)
            {
                if (GameBoard[srcRow][iCheckCol] != 0)
                {
                    return false;
                }
            }
            return true;
        }
        else if (destCol == srcCol)
        {
            // Make sure that all invervening squares are empty
            int iRowOffset = (destRow - srcRow > 0) ? 1 : -1;
            for (int iCheckRow = srcRow + iRowOffset; iCheckRow != destRow; iCheckRow = iCheckRow + iRowOffset)
            {
                if (GameBoard[iCheckRow][srcCol] != 0)
                {
                    return false;
                }
            }
            return true;
        }
        return false;
    }
};



class QueenPiece : public Piece
{
public:
    QueenPiece(char PieceColor) : Piece(PieceColor) {}
    ~QueenPiece() {}

private:
    virtual char GetPiece()
    {
        return 'Q';
    }
    bool AreSquaresLegal(int srcRow, int srcCol, int destRow, int destCol, Piece *GameBoard[8][8])
    {
        if (srcRow == destRow)
        {
            // Make sure that all invervening squares are empty
            int iColOffset = (destCol - srcCol > 0) ? 1 : -1;
            for (int iCheckCol = srcCol + iColOffset; iCheckCol != destCol; iCheckCol = iCheckCol + iColOffset)
            {
                if (GameBoard[srcRow][iCheckCol] != 0)
                {
                    return false;
                }
            }
            return true;
        }
        else if (destCol == srcCol)
        {
            // Make sure that all invervening squares are empty
            int iRowOffset = (destRow - srcRow > 0) ? 1 : -1;
            for (int iCheckRow = srcRow + iRowOffset; iCheckRow != destRow; iCheckRow = iCheckRow + iRowOffset)
            {
                if (GameBoard[iCheckRow][srcCol] != 0)
                {
                    return false;
                }
            }
            return true;
        }
        else if ((destCol - srcCol == destRow - srcRow) || (destCol - srcCol == srcRow - destRow))
        {
            // Make sure that all invervening squares are empty
            int iRowOffset = (destRow - srcRow > 0) ? 1 : -1;
            int iColOffset = (destCol - srcCol > 0) ? 1 : -1;
            int iCheckRow;
            int iCheckCol;
            for (iCheckRow = srcRow + iRowOffset, iCheckCol = srcCol + iColOffset;
                 iCheckRow != destRow;
                 iCheckRow = iCheckRow + iRowOffset, iCheckCol = iCheckCol + iColOffset)
            {
                if (GameBoard[iCheckRow][iCheckCol] != 0)
                {
                    return false;
                }
            }
            return true;
        }
        return false;
    }
};



class KingPiece : public Piece
{
public:
    KingPiece(char PieceColor) : Piece(PieceColor) {}
    ~KingPiece() {}

private:
    virtual char GetPiece()
    {
        return 'K';
    }
    bool AreSquaresLegal(int srcRow, int srcCol, int destRow, int destCol, Piece *GameBoard[8][8])
    {
        int iRowDelta = destRow - srcRow;
        int iColDelta = destCol - srcCol;
        if (((iRowDelta >= -1) && (iRowDelta <= 1)) &&
            ((iColDelta >= -1) && (iColDelta <= 1)))
        {
            return true;
        }
        return false;
    }
};



class ChessBoard
{
public:
    Piece *MainGameBoard[8][8];
    ChessBoard()
    {
        for (int iRow = 0; iRow < 8; ++iRow)
        {
            for (int iCol = 0; iCol < 8; ++iCol)
            {
                MainGameBoard[iRow][iCol] = 0;
            }
        }
        // Allocate and place black pieces
        for (int iCol = 0; iCol < 8; ++iCol)
        {
            MainGameBoard[6][iCol] = new PawnPiece('B');
        }
        MainGameBoard[7][0] = new RookPiece('B');
        MainGameBoard[7][1] = new KnightPiece('B');
        MainGameBoard[7][2] = new BishopPiece('B');
        MainGameBoard[7][3] = new KingPiece('B');
        MainGameBoard[7][4] = new QueenPiece('B');
        MainGameBoard[7][5] = new BishopPiece('B');
        MainGameBoard[7][6] = new KnightPiece('B');
        MainGameBoard[7][7] = new RookPiece('B');
        // Allocate and place white pieces
        for (int iCol = 0; iCol < 8; ++iCol)
        {
            MainGameBoard[1][iCol] = new PawnPiece('W');
        }
        MainGameBoard[0][0] = new RookPiece('W');
        MainGameBoard[0][1] = new KnightPiece('W');
        MainGameBoard[0][2] = new BishopPiece('W');
        MainGameBoard[0][3] = new KingPiece('W');
        MainGameBoard[0][4] = new QueenPiece('W');
        MainGameBoard[0][5] = new BishopPiece('W');
        MainGameBoard[0][6] = new KnightPiece('W');
        MainGameBoard[0][7] = new RookPiece('W');
    }
    ~ChessBoard()
    {
        for (int iRow = 0; iRow < 8; ++iRow)
        {
            for (int iCol = 0; iCol < 8; ++iCol)
            {
                delete MainGameBoard[iRow][iCol];
                MainGameBoard[iRow][iCol] = 0;
            }
        }
    }

    void Print()
    {
        const int kiSquareWidth = 4;
        const int kiSquareHeight = 3;
        for (int iRow = 0; iRow < 8 * kiSquareHeight; ++iRow)
        {
            int iSquareRow = iRow / kiSquareHeight;
            // Print side border with numbering
            if (iRow % 3 == 1)
            {
                cout << '-' << (char)('1' + 7 - iSquareRow) << '-';
            }
            else
            {
                cout << "---";
            }
            // Print the chess board
            for (int iCol = 0; iCol < 8 * kiSquareWidth; ++iCol)
            {
                int iSquareCol = iCol / kiSquareWidth;
                if (((iRow % 3) == 1) && ((iCol % 4) == 1 || (iCol % 4) == 2) && MainGameBoard[7 - iSquareRow][iSquareCol] != 0)
                {
                    if ((iCol % 4) == 1)
                    {
                        cout << MainGameBoard[7 - iSquareRow][iSquareCol]->GetColor();
                    }
                    else
                    {
                        cout << MainGameBoard[7 - iSquareRow][iSquareCol]->GetPiece();
                    }
                }
                else
                {
                    if ((iSquareRow + iSquareCol) % 2 == 1)
                    {
                        cout << '*';
                    }
                    else
                    {
                        cout << ' ';
                    }
                }
            }
            cout << endl;
        }
        // Print the bottom border with numbers
        for (int iRow = 0; iRow < kiSquareHeight; ++iRow)
        {
            if (iRow % 3 == 1)
            {
                cout << "---";
                for (int iCol = 0; iCol < 8 * kiSquareWidth; ++iCol)
                {
                    int iSquareCol = iCol / kiSquareWidth;
                    if ((iCol % 4) == 1)
                    {
                        cout << (iSquareCol + 1);
                    }
                    else
                    {
                        cout << '-';
                    }
                }
                cout << endl;
            }
            else
            {
                for (int iCol = 1; iCol < 9 * kiSquareWidth; ++iCol)
                {
                    cout << '-';
                }
                cout << endl;
            }
        }
    }

    bool IsInCheck(char PieceColor)
    {
        // Find the king
        int iKingRow;
        int iKingCol;
        for (int iRow = 0; iRow < 8; ++iRow)
        {
            for (int iCol = 0; iCol < 8; ++iCol)
            {
                if (MainGameBoard[iRow][iCol] != 0)
                {
                    if (MainGameBoard[iRow][iCol]->GetColor() == PieceColor)
                    {
                        if (MainGameBoard[iRow][iCol]->GetPiece() == 'K')
                        {
                            iKingRow = iRow;
                            iKingCol = iCol;
                        }
                    }
                }
            }
        }
        // Run through the opponent's pieces and see if any can take the king
        for (int iRow = 0; iRow < 8; ++iRow)
        {
            for (int iCol = 0; iCol < 8; ++iCol)
            {
                if (MainGameBoard[iRow][iCol] != 0)
                {
                    if (MainGameBoard[iRow][iCol]->GetColor() != PieceColor)
                    {
                        if (MainGameBoard[iRow][iCol]->IsLegalMove(iRow, iCol, iKingRow, iKingCol, MainGameBoard))
                        {
                            return true;
                        }
                    }
                }
            }
        }

        return false;
    }

    bool CanMove(char PieceColor)
    {
        // Run through all pieces
        for (int iRow = 0; iRow < 8; ++iRow)
        {
            for (int iCol = 0; iCol < 8; ++iCol)
            {
                if (MainGameBoard[iRow][iCol] != 0)
                {
                    // If it is a piece of the current player, see if it has a legal move
                    if (MainGameBoard[iRow][iCol]->GetColor() == PieceColor)
                    {
                        for (int iMoveRow = 0; iMoveRow < 8; ++iMoveRow)
                        {
                            for (int iMoveCol = 0; iMoveCol < 8; ++iMoveCol)
                            {
                                if (MainGameBoard[iRow][iCol]->IsLegalMove(iRow, iCol, iMoveRow, iMoveCol, MainGameBoard))
                                {
                                    // Make move and check whether king is in check
                                    Piece *tempPiece = MainGameBoard[iMoveRow][iMoveCol];
                                    MainGameBoard[iMoveRow][iMoveCol] = MainGameBoard[iRow][iCol];
                                    MainGameBoard[iRow][iCol] = 0;
                                    bool moreMoves = !IsInCheck(PieceColor);
                                    // Undo the move
                                    MainGameBoard[iRow][iCol] = MainGameBoard[iMoveRow][iMoveCol];
                                    MainGameBoard[iMoveRow][iMoveCol] = tempPiece;
                                    if (moreMoves)
                                    {
                                        return true;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        return false;
    }
};



class Game
{
private:
    ChessBoard board;
    char currentPlayer;

public:
    Game() : currentPlayer('W') {}
    ~Game() {}

    void Start()
    {
        do
        {
            GetNextMove(board.MainGameBoard);
            changeTurn();
        } while (!IsGameOver());
        board.Print();
    }

    void GetNextMove(Piece *GameBoard[8][8])
    {
        bool isValidMove = false;
        do
        {
            system("clear");
            board.Print();

            // Get input and convert to coordinates
            cout << currentPlayer << "'s Move: ";
            int startMove;
            cin >> startMove;
            int startRow = (startMove / 10) - 1;
            int startCol = (startMove % 10) - 1;

            cout << "To: ";
            int endMove;
            cin >> endMove;
            int iEndRow = (endMove / 10) - 1;
            int iEndCol = (endMove % 10) - 1;

            // Check that the indices are in range
            // and that the source and destination are different
            if ((startRow >= 0 && startRow <= 7) &&
                (startCol >= 0 && startCol <= 7) &&
                (iEndRow >= 0 && iEndRow <= 7) &&
                (iEndCol >= 0 && iEndCol <= 7))
            {
                // Additional checks in here
                Piece *currentPiece = GameBoard[startRow][startCol];
                // Check that the piece is the correct color
                if ((currentPiece != nullptr) && (currentPiece->GetColor() == currentPlayer))
                {
                    // Check that the destination is a valid destination
                    if (currentPiece->IsLegalMove(startRow, startCol, iEndRow, iEndCol, GameBoard))
                    {
                        // Make the move
                        Piece *tempPiece = GameBoard[iEndRow][iEndCol];
                        GameBoard[iEndRow][iEndCol] = GameBoard[startRow][startCol];
                        GameBoard[startRow][startCol] = 0;
                        // Make sure that the current player is not in check
                        if (!board.IsInCheck(currentPlayer))
                        {
                            delete tempPiece;
                            isValidMove = true;
                        }
                        else
                        { // Undo the last move
                            GameBoard[startRow][startCol] = GameBoard[iEndRow][iEndCol];
                            GameBoard[iEndRow][iEndCol] = tempPiece;
                        }
                    }
                }
            }
            if (!isValidMove)
            {
                cout << "Invalid Move!" << endl;
            }
        } while (!isValidMove);
    }

    void changeTurn()
    {
        currentPlayer = (currentPlayer == 'W') ? 'B' : 'W';
    }

    bool IsGameOver()
    {
        // Check that the current player can move
        // If not, we have a stalemate or checkmate
        bool moreMoves(false);
        moreMoves = board.CanMove(currentPlayer);
        if (!moreMoves)
        {
            if (board.IsInCheck(currentPlayer))
            {
                changeTurn();
                std::cout << "Checkmate, " << currentPlayer << " Wins!" << std::endl;
            }
            else
            {
                std::cout << "Draw!" << std::endl;
            }
        }
        return !moreMoves;
    }
};

int main()
{
    Game game;
    game.Start();
    return 0;
}
3
2
3 8
2
5 6
6
1 2 3 4 5 10
<!-- QuillJS CDN -->
<link href="https://cdn.quilljs.com/1.3.6/quill.snow.css" rel="stylesheet">
<script src="https://cdn.quilljs.com/1.3.6/quill.min.js"></script>

<!-- Quill Image Resize Module CDN -->
<script src="https://cdn.jsdelivr.net/npm/quill-image-resize-module@3.0.0/image-resize.min.js"></script>

<!-- Quill Editor Container -->
<div id="quill-editor-container" style="height: 500px; border: 1px solid #ddd;"></div>

<script>
  // Add the ImageResize module to Quill
  Quill.register('modules/imageResize', ImageResize);

  // Initialize Quill with the image resize module
  var quill = new Quill('#quill-editor-container', {
    theme: 'snow',
    modules: {
      toolbar: {
        container: [
          [{ 'font': [] }, { 'header': [1, 2, 3, 4, 5, 6, false] }],
          ['bold', 'italic', 'underline', 'strike'],
          [{ 'list': 'ordered' }, { 'list': 'bullet' }],
          ['link', 'image', 'video'],
          [{ 'align': [] }],
          ['clean']
        ],
        handlers: {
          // Custom image handler to embed via URL
          image: function() {
            const imageUrl = prompt('Enter the image URL');
            if (imageUrl) {
              const range = this.quill.getSelection();
              this.quill.insertEmbed(range.index, 'image', imageUrl);
            }
          }
        }
      },
      imageResize: {}  // Enable image resizing module
    }
  });
</script>

<!-- Styles for Editor -->
<style>
  #quill-editor-container {
    height: 500px;
    width: 100%;  /* Set to 100% width */
    max-width: 1200px;  /* Optionally, limit the max width */
    padding: 10px;
    border: 1px solid #ddd;
  }
</style>
"use client";
import React, { useState, useEffect } from "react";

const ImageSlider = () => {
  const [currentImageIndex, setCurrentImageIndex] = useState(0);
  const [prevImageIndex, setPrevImageIndex] = useState(0);

  const images = [
    "https://via.placeholder.com/300x200.png?text=Image+1",
    "https://via.placeholder.com/300x200.png?text=Image+2",
    "https://via.placeholder.com/300x200.png?text=Image+3",
    "https://via.placeholder.com/300x200.png?text=Image+4",
  ];

  useEffect(() => {
    const intervalId = setInterval(() => {
      setPrevImageIndex(currentImageIndex);
      setCurrentImageIndex((prevIndex) => (prevIndex + 1) % images.length);
    }, 3000); // Change image every 3 seconds

    return () => clearInterval(intervalId);
  }, [currentImageIndex, images.length]);

  return (
    <div className="bg-base-100 relative max-h-[28rem] overflow-hidden rounded-t-[3.5rem] border-l-[12px] border-r-[12px] border-t-[12px] border-black/75 md:order-first md:aspect-[9/18] md:max-h-none md:max-w-[24rem] lg:rounded-[4rem] lg:border-[14px]">
      {images.map((image, index) => (
        <img
          key={index}
          alt={`Slide ${index + 1}`}
          fetchpriority={index === 0 ? "high" : "low"}
          className={`absolute inset-0 h-full w-full rounded-t-3xl  transition-all duration-1000 ease-in-out lg:rounded-3xl ${
            index === currentImageIndex
              ? "translate-x-0 opacity-100"
              : index === prevImageIndex
              ? "-translate-x-full opacity-0"
              : "translate-x-full opacity-0"
          }`}
          src={image}
        />
      ))}
    </div>
  );
};

export default ImageSlider;
1.
<!DOCTYPE html>
<html>
<head>
    <title>Registration Form</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 50px;
        }
        h1 {
            text-align: center;
        }
        form {
            max-width: 400px;
            margin: auto;
            padding: 20px;
            border: 1px solid #ccc;
            border-radius: 10px;
        }
        table {
            width: 100%;
            margin-bottom: 10px;
        }
        td {
            padding: 8px;
        }
        input[type="text"], input[type="password"], textarea {
            width: 100%;
            padding: 5px;
            border: 1px solid #ccc;
            border-radius: 5px;
        }
        input[type="submit"] {
            padding: 10px 20px;
            background-color: #4CAF50;
            color: white;
            border: none;
            border-radius: 5px;
            cursor: pointer;
        }
        input[type="submit"]:hover {
            background-color: #45a049;
        }
    </style>
</head>
<body>
    <h1>Registration Form</h1>
    <form action="display.php" method="POST">
        <table>
            <tr>
                <td>Name:</td>
                <td><input type="text" name="name" required></td>
            </tr>
            <tr>
                <td>Username:</td>
                <td><input type="text" name="userName" required></td>
            </tr>
            <tr>
                <td>Password:</td>
                <td><input type="password" name="password" required></td>
            </tr>
            <tr>
                <td>Mobile Number:</td>
                <td><input type="text" name="mobilenumber" maxlength="10" required></td>
            </tr>
            <tr>
                <td>Address:</td>
                <td><textarea name="address" maxlength="200" required></textarea></td>
            </tr>
        </table>
        <div style="text-align: center;">
            <input type="submit" name="register" value="Register">
        </div>
    </form>
</body>
</html>


2.

<!DOCTYPE html>
<html>
<head>
    <title>Event Search</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 50px;
        }
        h1 {
            text-align: center;
        }
        form {
            text-align: center;
            margin-top: 50px;
        }
        input[type="text"] {
            width: 50%;
            padding: 10px;
            border: 1px solid #ccc;
            border-radius: 5px;
        }
        input[type="submit"] {
            padding: 10px 20px;
            background-color: #4CAF50;
            color: white;
            border: none;
            border-radius: 5px;
            cursor: pointer;
        }
        input[type="submit"]:hover {
            background-color: #45a049;
        }
    </style>
</head>
<body>
    <h1>Event Search</h1>
    <form action="search.php" method="POST">
        <input type="text" name="someText" list="text" placeholder="Search for an event..." required>
        <datalist id="text">
            <option value="Bridal party">
            <option value="Engagement parties">
            <option value="Caterer">
            <option value="Wedding ceremony">
            <option value="Wedding reception">
        </datalist>
        <br><br>
        <input type="submit" name="search" value="Search">
    </form>
</body>
</html>
//contactUs.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Contact Us - Pink Frag Event Organizer</title>
</head>
<body>
    <table border="1" width="100%">
        <tr>
            <td>
                <a href="index.html">Home</a><br>
                <a href="events.html">Events</a><br>
                <a href="aboutUs.html">About us</a><br>
                <a href="contactUs.html">Contact Us</a><br>
            </td>
            <td>
                <h1>Pink Frag Event Organizer</h1>
                <h2>Contact Us</h2>
                <p>14/509A, Sterlin Street, Nungambakkam, Chennai - 600034.</p>
            </td>
        </tr>
    </table>
</body>
</html>

//aboutUs.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>About Us - Pink Frag Event Organizer</title>
</head>
<body>
    <table border="1" width="100%">
        <tr>
            <td>
                <a href="index.html">Home</a><br>
                <a href="events.html">Events</a><br>
                <a href="aboutUs.html">About us</a><br>
                <a href="contactUs.html">Contact Us</a><br>
            </td>
            <td>
                <h1>Pink Frag Event Organizer</h1>
                <h2>About Us</h2>
                <p>Pink Frag Event is a reputed organization, which has come into being in 2009, as a Sole Proprietorship Firm, with a sole aim of achieving the trust and support of large customers. We have indulged our all endeavors towards offering trustworthy Wedding Event Management, Promotional Event Management, Birthday Party Management, and many more. To offer these services, we have hired specialized professionals, who are capable of understanding as well as accomplishing the specific customers’ desires.</p>
            </td>
        </tr>
    </table>
</body>
</html>

//events.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Events - Pink Frag Event Organizer</title>
</head>
<body>
    <table border="1" width="100%">
        <tr>
            <td>
                <a href="index.html">Home</a><br>
                <a href="events.html">Events</a><br>
                <a href="aboutUs.html">About us</a><br>
                <a href="contactUs.html">Contact Us</a><br>
            </td>
            <td>
                <h1>Pink Frag Event Organizer</h1>
                <h2>Events</h2>
                <h3>Corporate Events</h3>
                <p>A corporate event can be defined as a gathering that is sponsored by a business for its employees, business partners, clients and/or prospective clients. These events can be for larger audiences such as conventions or smaller events like conferences, meetings, or holiday parties.</p>
                <h3>Wedding Planning</h3>
                <p>A wedding planner is a professional who assists with the design, planning and management of a client's wedding. Weddings are significant events in people's lives and as such, couples are often willing to spend considerable amounts of money to ensure that their weddings are well-organized. Wedding planners are often used by couples who work long hours and have little spare time available for sourcing and managing wedding venues and wedding suppliers.</p>
                <h3>Product Launches</h3>
                <p>The debut of a product into the market. The product launch signifies the point at which consumers first have access to a new product.</p>
            </td>
        </tr>
    </table>
</body>
</html>

//index.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Pink Frag Event Organizer</title>
</head>
<body>
    <table border="1" width="100%">
        <tr>
            <td>
                <a href="index.html">Home</a><br>
                <a href="events.html">Events</a><br>
                <a href="aboutUs.html">About us</a><br>
                <a href="contactUs.html">Contact Us</a><br>
            </td>
            <td>
                <h1>Pink Frag Event Organizer</h1>
                <h2>Pink Frag Event Organizer</h2>
                <p>We are indulged in offering a Promotional Event Management. These services are provided by our team of professionals as per the requirement of the client. These services are highly praised for their features like sophisticated technology, effective results and reliability. We offer these services in a definite time frame and at affordable rates.</p>
            </td>
        </tr>
    </table>
</body>
</html>
/* Remove Second Pricing & Add Starting At to Product Page */
.single-product span.woocommerce-Price-amount.amount {
    margin-right: -100vw !important;
    background-color: #fff !important;
}
.single-product p.price::before {
    content: "STARTING AT";
    font-size: 0.79vw;
    color: black !important;
    font-weight: 600;
    padding-right: 0.79vw;
}
.single-product p.price span.woocommerce-Price-amount:nth-of-type(2) {
    display: none;
}
from django.urls import path

from . import views

urlpatterns = [
    path("", views.index, name="index"),
]
In the more rushing world population, increasing traffic and technological innovation affect most of the things in human life activities, like purchasing their favorite food to clothing. These are the things that have resolved one way to emerge in the booming on-demand industry. The new inventions resolve most of the necessities like food ordering, ride-sharing, grocery purchasing, and a lot more. In that manner, food delivery apps have a well-growing market share in the current year and have a lot of future scope. Doordash is the most important food delivery app in the industry because it is already stronger in some regions like Australia, Canada, Germany, New Zealand, Japan, and the United States That's why entrepreneurs want to adapt their businesses with the same layout and put their brand and add some extra added technological and user-friendly interface to make and achieve it. If these are the things you want to accomplish for your business, then reach out to Appticz, the top-level solution provider, for any kind of on-demand app development business idea. They also provide a premium Doordash clone app that provides most of the entrepreneur's needs.
A interoperabilidade no sistema bancário em Moçambique é uma realidade, tendo a SIMO como ponto central de gestão do sistema integrado de transações. Os bancos passaram a receber um conjunto de dados (em ficheiros de texto) transacionados nos seus terminais como POSs (compras) e ATMs (levantamentos/pagamentos) por meios de cartões. Por forma a garantir o melhor controle e rentabilidade (pelo menos uma transação) dos cartões. Considere a estrutura do ficheiro de transações de clientes (Clientes Ativos - 1 transação dentro de 90 dias, Clientes inativos - Transações acima de 90 dias) recebido abaixo:
Estrutura da tabela a considerar:
| Data | Transacao_ID | Terminal_ID | Tipo_Terminal | Valor | Cliente | Idade | Tipo_Cartao | Provincia | Distrito |
|---|---|---|---|---|---|---|---|---|---|
1. Crie um modelo normalizado e os devidos relacionamentos de acordo com a tabela.
2. Com base nas tabelas normalizadas escreva uma query que indique todos os clientes inactivos da província de Gaza, com mais levantamentos.
3. Tendo em consideração que para o banco uma “boa” rentabilidade é ter transações acima de MZN 1000. Indique a província do cliente menos rentável e com mais transações.
4. Ainda sobre a “boa rentabilidade”, indique a província com maior número de clientes activos e menos rentáveis.
5. Continuando sobre a “boa rentabilidade”, indique o cliente ativo mais velho, que realizou mais pagamentos no dia da independência.
  
-- 1. Criação do modelo normalizado

CREATE TABLE Cliente (
    ClienteID INT PRIMARY KEY,
    Nome VARCHAR(100),
    Idade INT
);

CREATE TABLE Cartao (
    CartaoID INT PRIMARY KEY,
    ClienteID INT,
    Tipo_Cartao VARCHAR(50),
    FOREIGN KEY (ClienteID) REFERENCES Cliente(ClienteID)
);

CREATE TABLE Localizacao (
    LocalizacaoID INT PRIMARY KEY,
    Provincia VARCHAR(50),
    Distrito VARCHAR(50)
);

CREATE TABLE Terminal (
    TerminalID VARCHAR(50) PRIMARY KEY,
    Tipo_Terminal VARCHAR(20),
    LocalizacaoID INT,
    FOREIGN KEY (LocalizacaoID) REFERENCES Localizacao(LocalizacaoID)
);

CREATE TABLE Transacao (
    TransacaoID VARCHAR(50) PRIMARY KEY,
    Data DATE,
    Valor DECIMAL(10,2),
    CartaoID INT,
    TerminalID VARCHAR(50),
    FOREIGN KEY (CartaoID) REFERENCES Cartao(CartaoID),
    FOREIGN KEY (TerminalID) REFERENCES Terminal(TerminalID)
);

-- Inserção de dados de exemplo (opcional, para teste)
-- Inserção de dados de exemplo

-- Clientes
INSERT INTO Cliente (ClienteID, Nome, Idade) VALUES
(1, 'João Silva', 35),
(2, 'Maria Santos', 28),
(3, 'Pedro Nunes', 45),
(4, 'Ana Oliveira', 50),
(5, 'Edson Famanda', 29),
(6, 'Luísa Costa', 42),
(7, 'António Mendes', 55),
(8, 'Sofia Rodrigues', 30),
(9, 'Miguel Almeida', 38),
(10, 'Beatriz Sousa', 47);

-- Cartões
INSERT INTO Cartao (CartaoID, ClienteID, Tipo_Cartao) VALUES
(101, 1, 'Débito'),
(102, 2, 'Crédito'),
(103, 3, 'Débito'),
(104, 4, 'Crédito'),
(105, 5, 'Débito'),
(106, 6, 'Crédito'),
(107, 7, 'Débito'),
(108, 8, 'Crédito'),
(109, 9, 'Débito'),
(110, 10, 'Crédito');

-- Localizações
INSERT INTO Localizacao (LocalizacaoID, Provincia, Distrito) VALUES
(201, 'Gaza', 'Xai-Xai'),
(202, 'Maputo', 'Matola'),
(203, 'Sofala', 'Beira'),
(204, 'Nampula', 'Nampula'),
(205, 'Gaza', 'Chibuto'),
(206, 'Inhambane', 'Inhambane'),
(207, 'Tete', 'Tete'),
(208, 'Zambézia', 'Quelimane'),
(209, 'Cabo Delgado', 'Pemba'),
(210, 'Niassa', 'Lichinga');

-- Terminais
INSERT INTO Terminal (TerminalID, Tipo_Terminal, LocalizacaoID) VALUES
('T001', 'ATM', 201),
('T002', 'POS', 202),
('T003', 'ATM', 203),
('T004', 'POS', 204),
('T005', 'ATM', 205),
('T006', 'POS', 206),
('T007', 'ATM', 207),
('T008', 'POS', 208),
('T009', 'ATM', 209),
('T010', 'POS', 210);

-- Transações (50 transações)
INSERT INTO Transacao (TransacaoID, Data, Valor, CartaoID, TerminalID) VALUES
('TR001', '2024-06-25', 500.00, 101, 'T001'),
('TR002', '2024-06-25', 1200.00, 102, 'T002'),
('TR003', '2024-05-15', 800.00, 103, 'T003'),
('TR004', '2024-06-25', 1500.00, 104, 'T004'),
('TR005', '2024-03-01', 300.00, 105, 'T005'),
('TR006', '2024-06-25', 2000.00, 106, 'T006'),
('TR007', '2024-06-01', 100.00, 107, 'T007'),
('TR008', '2024-06-10', 950.00, 108, 'T008'),
('TR009', '2024-06-15', 1100.00, 109, 'T009'),
('TR010', '2024-06-20', 750.00, 110, 'T010'),
('TR011', '2024-06-25', 600.00, 101, 'T001'),
('TR012', '2024-05-30', 1800.00, 102, 'T002'),
('TR013', '2024-04-22', 400.00, 103, 'T003'),
('TR014', '2024-06-25', 2500.00, 104, 'T004'),
('TR015', '2024-02-15', 200.00, 105, 'T005'),
('TR016', '2024-06-25', 3000.00, 106, 'T006'),
('TR017', '2024-05-18', 150.00, 107, 'T007'),
('TR018', '2024-06-05', 1050.00, 108, 'T008'),
('TR019', '2024-06-12', 900.00, 109, 'T009'),
('TR020', '2024-06-19', 1250.00, 110, 'T010'),
('TR021', '2024-06-25', 700.00, 101, 'T001'),
('TR022', '2024-06-02', 1600.00, 102, 'T002'),
('TR023', '2024-05-10', 550.00, 103, 'T003'),
('TR024', '2024-06-25', 2200.00, 104, 'T004'),
('TR025', '2024-01-20', 350.00, 105, 'T005'),
('TR026', '2024-06-25', 2800.00, 106, 'T006'),
('TR027', '2024-04-30', 180.00, 107, 'T007'),
('TR028', '2024-06-08', 1150.00, 108, 'T008'),
('TR029', '2024-06-14', 980.00, 109, 'T009'),
('TR030', '2024-06-22', 1450.00, 110, 'T010'),
('TR031', '2024-06-25', 850.00, 101, 'T001'),
('TR032', '2024-05-28', 2100.00, 102, 'T002'),
('TR033', '2024-04-18', 480.00, 103, 'T003'),
('TR034', '2024-06-25', 3200.00, 104, 'T004'),
('TR035', '2024-02-10', 280.00, 105, 'T005'),
('TR036', '2024-06-25', 3500.00, 106, 'T006'),
('TR037', '2024-05-22', 220.00, 107, 'T007'),
('TR038', '2024-06-03', 1350.00, 108, 'T008'),
('TR039', '2024-06-11', 1020.00, 109, 'T009'),
('TR040', '2024-06-18', 1650.00, 110, 'T010'),
('TR041', '2024-06-25', 920.00, 101, 'T001'),
('TR042', '2024-06-01', 2400.00, 102, 'T002'),
('TR043', '2024-05-08', 630.00, 103, 'T003'),
('TR044', '2024-06-25', 2900.00, 104, 'T004'),
('TR045', '2024-01-15', 380.00, 105, 'T005'),
('TR046', '2024-06-25', 3800.00, 106, 'T006'),
('TR047', '2024-04-25', 250.00, 107, 'T007'),
('TR048', '2024-06-07', 1550.00, 108, 'T008'),
('TR049', '2024-06-13', 1080.00, 109, 'T009'),
('TR050', '2024-06-21', 1850.00, 110, 'T010');

-- 2. Query para clientes inativos da província de Gaza, com mais levantamentos
SELECT c.ClienteID, c.Nome, COUNT(*) as NumLevantamentos
FROM Cliente c
JOIN Cartao ca ON c.ClienteID = ca.ClienteID
JOIN Transacao t ON ca.CartaoID = t.CartaoID
JOIN Terminal te ON t.TerminalID = te.TerminalID
JOIN Localizacao l ON te.LocalizacaoID = l.LocalizacaoID
WHERE l.Provincia = 'Gaza'
  AND te.Tipo_Terminal = 'ATM'
  AND t.Data < DATE_SUB(CURDATE(), INTERVAL 90 DAY)
GROUP BY c.ClienteID, c.Nome
ORDER BY NumLevantamentos DESC;

-- 3. Província do cliente menos rentável e com mais transações
SELECT l.Provincia
FROM Cliente c
JOIN Cartao ca ON c.ClienteID = ca.ClienteID
JOIN Transacao t ON ca.CartaoID = t.CartaoID
JOIN Terminal te ON t.TerminalID = te.TerminalID
JOIN Localizacao l ON te.LocalizacaoID = l.LocalizacaoID
GROUP BY l.Provincia
ORDER BY SUM(CASE WHEN t.Valor > 1000 THEN 1 ELSE 0 END) ASC, COUNT(*) DESC
LIMIT 1;

-- 4. Província com maior número de clientes ativos e menos rentáveis
SELECT l.Provincia
FROM Cliente c
JOIN Cartao ca ON c.ClienteID = ca.ClienteID
JOIN Transacao t ON ca.CartaoID = t.CartaoID
JOIN Terminal te ON t.TerminalID = te.TerminalID
JOIN Localizacao l ON te.LocalizacaoID = l.LocalizacaoID
WHERE t.Data >= DATE_SUB(CURDATE(), INTERVAL 90 DAY)
GROUP BY l.Provincia
ORDER BY COUNT(DISTINCT c.ClienteID) DESC, SUM(CASE WHEN t.Valor <= 1000 THEN 1 ELSE 0 END) DESC
LIMIT 1;

-- 5. Cliente ativo mais velho, com mais pagamentos no dia da independência
SELECT c.ClienteID, c.Nome, c.Idade, COUNT(*) as NumPagamentos
FROM Cliente c
JOIN Cartao ca ON c.ClienteID = ca.ClienteID
JOIN Transacao t ON ca.CartaoID = t.CartaoID
JOIN Terminal te ON t.TerminalID = te.TerminalID
WHERE te.Tipo_Terminal = 'POS'
  AND DAY(t.Data) = 25 AND MONTH(t.Data) = 6
  AND t.Data >= DATE_SUB(CURDATE(), INTERVAL 90 DAY)
GROUP BY c.ClienteID, c.Nome, c.Idade
ORDER BY c.Idade DESC, NumPagamentos DESC
LIMIT 1;
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Event Schedule List</title>
</head>
<body>
    <h1>Event Schedule List</h1>
    
    <div id="CommonEvents">
        <h2>Supported Events</h2>
        <ul type="circle">
            <li>Concerts</li>
            <li>Conferences</li>
            <li>Films</li>
            <li>Panel Debates</li>
            <li>Performances</li>
            <li>Seminars</li>
            <li>Talks & Discussions</li>
            <li>Workshops</li>
        </ul>
    </div>
    
    <div id="CorporateEvents">
        <h2>Corporate Events</h2>
        <ul type="square">
            <li>Team Building Events</li>
            <li>Trade Shows</li>
            <li>Business Dinners</li>
            <li>Networking Events</li>
            <li>Opening Ceremonies</li>
            <li>Product Launches2018</li>
            <li>Theme Parties</li>
            <li>Shareholder Meetings</li>
        </ul>
    </div>
</body>
</html>
function create_faqs()
{
	$labels = array(
		'name' => _x('FAQs', 'Post Type General Name', 'textdomain'),
		'singular_name' => _x('FAQ', 'Post Type Singular Name', 'textdomain'),
		'menu_name' => _x('FAQs', 'Admin Menu text', 'textdomain'),
		'name_admin_bar' => _x('FAQs', 'Add New on Toolbar', 'textdomain'),
		'archives' => __('FAQs Archives', 'textdomain'),
		'attributes' => __('FAQs Attributes', 'textdomain'),
		'parent_item_colon' => __('Parent FAQs:', 'textdomain'),
		'all_items' => __('All FAQs', 'textdomain'),
		'add_new_item' => __('Add New FAQs', 'textdomain'),
		'add_new' => __('Add New', 'textdomain'),
		'new_item' => __('New FAQs', 'textdomain'),
		'edit_item' => __('Edit FAQs', 'textdomain'),
		'update_item' => __('Update FAQs', 'textdomain'),
		'view_item' => __('View FAQs', 'textdomain'),
		'view_items' => __('View FAQs', 'textdomain'),
		'search_items' => __('Search FAQs', 'textdomain'),
		'not_found' => __('Not found', 'textdomain'),
		'not_found_in_trash' => __('Not found in Trash', 'textdomain'),
		'featured_image' => __('Featured Image', 'textdomain'),
		'set_featured_image' => __('Set featured image', 'textdomain'),
		'remove_featured_image' => __('Remove featured image', 'textdomain'),
		'use_featured_image' => __('Use as featured image', 'textdomain'),
		'insert_into_item' => __('Insert into FAQs', 'textdomain'),
		'uploaded_to_this_item' => __('Uploaded to this FAQs', 'textdomain'),
		'items_list' => __('FAQs list', 'textdomain'),
		'items_list_navigation' => __('FAQs list navigation', 'textdomain'),
		'filter_items_list' => __('Filter FAQs list', 'textdomain'),
	);
	$rewrite = array(
		'slug' => 'faqS',
		'with_front' => true,
		'pages' => true,
		'feeds' => true,
	);
	$args = array(
		'label' => __('FAQs', 'textdomain'),
		'description' => __('', 'textdomain'),
		'labels' => $labels,
		'menu_icon' => 'dashicons-format-status',
		'supports' => array('title', 'editor', 'excerpt', 'thumbnail', 'page-attributes', 'post-formats', 'custom-fields'),
		'taxonomies' => array(),
		'public' => true,
		'show_ui' => true,
		'show_in_menu' => true,
		'menu_position' => 5,
		'show_in_admin_bar' => true,
		'show_in_nav_menus' => true,
		'can_export' => true,
		'has_archive' => true,
		'hierarchical' => true,
		'exclude_from_search' => true,
		'show_in_rest' => true,
		'publicly_queryable' => true,
		'capability_type' => 'post',
		'rewrite' => $rewrite,
	);
	register_post_type('faqs', $args);
	register_taxonomy('faqs_category', 'faqs', array('hierarchical' => true, 'label' => 'Category', 'query_var' => true, 'rewrite' => array('slug' => 'faqs-category')));
}
add_action('init', 'create_faqs', 0);






function faq_loops($atts) {
    // Default attributes.
    $default = array(
        'category' => '',
    );
    // Merge user-defined attributes with defaults.
    $button_attrs = shortcode_atts($default, $atts);

    // Argument to fetch FAQs based on category.
    $arg = array(
        'post_type' => 'faqs',
        'posts_per_page' => -1,
        'tax_query' => array(
            array(
                'taxonomy' => 'faqs_category',
                'field'    => 'slug',
                'terms'    => $button_attrs['category'], // Use category attribute passed in shortcode
                // 'operator' => 'IN',
            ),
        ),
    );
// print_r($arg);
    // Display FAQs
    $faqsPost = new WP_Query($arg);

    ?>
    <div id="mainfaqs" class="faq-list">
        <?php if ($faqsPost->have_posts()) : ?>
            <?php while ($faqsPost->have_posts()) : $faqsPost->the_post(); ?>
			<div class="faq">
                <div class="faq__question">
                    <div class="faq__ttl "><?php the_title(); ?></div>
                    <div class="faq__close"></div>
                </div>
                <div class="faq__answer" style="display: none; transition: max-height 0.3s ease;">
                    <div class="faq__txt" style="  ">
                        <?php the_content(); ?>
                    </div>
                </div>
            </div>
        <?php
        $x++;

    ?>

            <?php endwhile; ?>
        <?php else : ?>
            <p>No FAQs found in this category.</p>
        <?php endif; ?>
    </div>
    <?php
    wp_reset_postdata();
}
add_shortcode('mainfaqs', 'faq_loops');

// pass shortcode like this: [mainfaqs category="mainhome"]





//jquery


jQuery(function () {
  jQuery(".faq__question").on('click', function () {
      let box = jQuery(this).closest(".faq");
      let openBox = jQuery(".faq_active");

      // Check if the clicked FAQ is not the currently open one
      if (box.hasClass('faq_active')) {
          // If it's the same one, just toggle it
          box.find('.faq__answer').slideUp(300);
          box.removeClass('faq_active');
      } else {
          // Otherwise, close the currently open FAQ and open the new one
          openBox.find('.faq__answer').slideUp(300);
          openBox.removeClass('faq_active');
          
          box.find('.faq__answer').slideDown(300);
          box.addClass('faq_active');
      }
  });
});
Most entrepreneurs want to start their business in the crypto field, but many don't have a proper idea of how to kickstart their business. Therefore, most of them choose their business with cryptocurrency wallet development services. Let's see the way to start their business in the crypto industry.

1. Choose your Audience
Fixing your crypto wallet business is beneficial for your users that avail unique benefits and provide value from your business. Define your audience who will benefit from and use your crypto wallet services.

2. Legal and Regulatory Compliance
Comply with and follow the legal regulations that are related to your crypto wallet business

3. Select a Suitable Wallet Solution
In this stage, you have 3 ways to lead your crypto wallet business in an open-source, white-label solution and develop from scratch. This choice may differ from every entrepreneur to others because it depends upon the time and budget.

4. Incorporate Essential features
Your platform should support multiple cryptocurrencies and be combined with a lot of security features such as two-factor authentication, cold storage, and encryption. Create a platform whose user interface is more clear and easy to access for all users. Ensure you should incorporate a prominent payment gateway for receiving your payments, deposits, or withdrawals in fiat currencies.

5. Additional Features
Permit your platform users to buy, sell, and trade cryptocurrencies within the wallet. Integrate Defi features such as staking and lending to avail your users to expand your revenue stream. Further, it enables buying and selling NFTs with your crypto wallet.

6. Security and Testing
Conduct rigorous testing and identify your platform bugs and any tech vulnerabilities. Take necessary security periodic security audits to find your platform data security.

7. Marketing and Promotion
Create your marketing plan to reach your audience by advertising in targeted paid ads. Leverage famous social networks like Twitter, Telegram, and Reddit to engage your audience at all times. In the tech world, influencer marketing is a remarkable way to collaborate with other crypto businesses or influencers to promote your business in the internet world.

If you're looking to create your crypto wallet for your business, then Appticz is the best crypto wallet development solution provider in the competitive crypto industry.
<?php

/**
 * Checkout billing information form
 *
 * This template can be overridden by copying it to yourtheme/woocommerce/checkout/form-billing.php.
 *
 * HOWEVER, on occasion WooCommerce will need to update template files and you
 * (the theme developer) will need to copy the new files to your theme to
 * maintain compatibility. We try to do this as little as possible, but it does
 * happen. When this occurs the version of the template file will be bumped and
 * the readme will list any important changes.
 *
 * @see     https://woocommerce.com/document/template-structure/
 * @package WooCommerce\Templates
 * @version 3.6.0
 * @global WC_Checkout $checkout
 */

defined('ABSPATH') || exit;
$fields = $checkout->get_checkout_fields('billing');
?>
<?php if (!is_user_logged_in() && $checkout->is_registration_enabled()) : ?>
  <div class="woocommerce-billing-fields woocommerce-billing-fields-top">
    <h3><?php esc_html_e('Login', 'woocommerce'); ?></h3>
    <p>Log in to place your order</p>
    <div class="woocommerce-billing-fields__field-wrapper">
      <?php
      foreach ($fields as $key => $field) {
        if ($key === 'billing_email') {
          woocommerce_form_field($key, $field, $checkout->get_value($key));
        }
      }
      ?>
      <p class="form-row form-row-wide" id="billing_password_field" data-priority="110">
        <span class="woocommerce-input-wrapper">
          <input type="password" class="input-text" name="billing_password" id="billing_password" placeholder="Password">
        </span>
      </p>
      <div class="flogin-btn">
        <button type="button"><?php _e('Login and place order', 'wp'); ?></button>
      </div>
      <div class="flogin-footer">
        <div>Not yet a member?</div>
        <div>create an account</div>
        <div>Create an account and place your order</div>
      </div>
    </div>
  </div>
<?php else : ?>
  <div class="woocommerce-billing-fields">
    <h3><?php esc_html_e('Account', 'woocommerce'); ?></h3>
    <div class="woocommerce-billing-fields__field-wrapper">
      <?php
      foreach ($fields as $key => $field) {
        if ($key === 'billing_email') {
          woocommerce_form_field($key, $field, $checkout->get_value($key));
        }
      }
      ?>
    </div>
  </div>
<?php endif; ?>
<div class="woocommerce-billing-fields">
  <?php if (wc_ship_to_billing_address_only() && WC()->cart->needs_shipping()) : ?>

    <h3><?php esc_html_e('Billing & Shipping', 'woocommerce'); ?></h3>

  <?php else : ?>

    <h3><?php esc_html_e('Billing Info', 'woocommerce'); ?></h3>

  <?php endif; ?>

  <?php do_action('woocommerce_before_checkout_billing_form', $checkout); ?>

  <div class="woocommerce-billing-fields__field-wrapper">
    <?php
    foreach ($fields as $key => $field) {
      if ($key !== 'billing_email') {
        woocommerce_form_field($key, $field, $checkout->get_value($key));
      }
    }
    ?>
	 
      <?php woocommerce_form_field('billing_notes', array(
            'type' => 'textarea',
            'class' => array('form-row-wide'),
            'label' => false,
            'placeholder' => __('Order notes(optional)', 'woocommerce'),
            'required' => false,
        ), $checkout->get_value('billing_notes')); ?>
    
    <div class="form-row shipping-address-method-field">
      <input type="radio" name="shipping-address-method[]" value="billing_address" id="method-billing_address" checked>
      <label for="method-billing_address">Ship to this address</label>
    </div>
  </div>

  <?php do_action('woocommerce_after_checkout_billing_form', $checkout); ?>
</div>

<?php if (!is_user_logged_in() && $checkout->is_registration_enabled()) : ?>
  <div class="woocommerce-account-fields">
    <?php if (!$checkout->is_registration_required()) : ?>

      <p class="form-row form-row-wide create-account">
        <label class="woocommerce-form__label woocommerce-form__label-for-checkbox checkbox">
          <input class="woocommerce-form__input woocommerce-form__input-checkbox input-checkbox" id="createaccount" <?php checked((true === $checkout->get_value('createaccount') || (true === apply_filters('woocommerce_create_account_default_checked', false))), true); ?> type="checkbox" name="createaccount" value="1" /> <span><?php esc_html_e('Create an account?', 'woocommerce'); ?></span>
        </label>
      </p>

    <?php endif; ?>

    <?php do_action('woocommerce_before_checkout_registration_form', $checkout); ?>

    <?php if ($checkout->get_checkout_fields('account')) : ?>

      <div class="create-account">
        <?php foreach ($checkout->get_checkout_fields('account') as $key => $field) : ?>
          <?php woocommerce_form_field($key, $field, $checkout->get_value($key)); ?>
        <?php endforeach; ?>
        <div class="clear"></div>
      </div>

    <?php endif; ?>

    <?php do_action('woocommerce_after_checkout_registration_form', $checkout); ?>
  </div>
<?php endif; ?>
function custom_modify_query( $query ) {
    if ( ! is_admin() && $query->is_main_query() ) {
        if ( is_shop() ) {
            $query->set( 'posts_per_page', 12 );
        }
    }
}
add_action( 'pre_get_posts', 'custom_modify_query' );
// Check product has sale
function is_product_on_sale($product_id) {
    $product = wc_get_product($product_id);

    if ($product->is_on_sale()) {
        return true; 
    }

    if ($product->is_type('variable')) {
        $variants = $product->get_children();

        foreach ($variants as $variant_id) {
            $variant = wc_get_product($variant_id);
            if ($variant->is_on_sale()) {
                return true;
            }
        }
    }

    return false;
}
// Check product has sale
function count_sale_products() {
    $transient_key = 'count_sale_products';
    $cached_count = get_transient($transient_key);
    if ($cached_count !== false) {
        return $cached_count;
    } else {
        $products = wc_get_products(['return' => 'ids', 'status' => 'publish', 'limit' => -1, 'type' => array('simple', 'variable', 'bundle', 'external', 'grouped')]);
        $saleProduct = [];
        foreach ($products as $product_id) {
            if (is_product_on_sale($product_id)) {
                $saleProduct[] = $product_id;
            }
        }
        $sale_count = count($saleProduct);
        set_transient($transient_key, $sale_count, 5 * MINUTE_IN_SECONDS);
        return $sale_count;
    }
}
function get_discounted_variants_of_product($product_id) {
    $product = wc_get_product($product_id);

    if ($product->is_type('variable')) {
        $variants = $product->get_children();

        $discounted_variants = array();

        foreach ($variants as $variant_id) {
            $variant = wc_get_product($variant_id);
			//print_r($variant->status); die;
			if( $variant->status == 'publish')
				$discounted_variants[] = array(
					'id' => $variant->get_id(),
					'sale_price' => $variant->get_sale_price(),
					'regular_price' => $variant->get_regular_price(),
					'name' => $variant->get_name(),
					'sku' => $variant->get_sku(),
				);
        }

        return $discounted_variants;
    }
    return false;
}

function getStockStatusCountProduct($instock = true){
	$stock_status = 'instock';
	if(!$instock) $stock_status = 'outofstock';
	$args = array(
		'stock_status' => $stock_status,
		'limit' => -1,
		'status' => 'publish',
		'type' => array('simple', 'variable'),
	);
	$products = wc_get_products( $args );
	return count($products);
}
function customRatingScoreHTML($productID){
	$product = wc_get_product($productID);
	$average      = $product->get_average_rating();
	$rating_whole = floor($average);
	$rating_fraction = $average - $rating_whole;
	$flug = 0;
	for($i = 1; $i <= 5; $i++){
		if( $i <= $rating_whole ){
			echo '<i class="fas fa-star"></i>';
		}
		else{
			if( $rating_fraction > 0 && $flug == 0 ){
				 echo '<i class="fas fa-star-half-alt"></i>';
				$flug = 1;
			}
			else{
				echo '<i class="far fa-star empty"></i>';
			}
		}
	}
}
function customShopGridShortcode($atts=[]){
	ob_start();
	$availability = isset($_GET['availability'])?$_GET['availability']:'instock';
	$category = isset($_GET['category'])?$_GET['category']:'';
	$tag = isset($_GET['tg'])?$_GET['tg']:'';
	//$on_sale = isset($_GET['on_sale'])?$_GET['on_sale']:'';
	$orderBy = isset($_GET['orderby'])?$_GET['orderby']:'';
	$keyword = isset($_GET['s'])?$_GET['s']:'';
	$paged = max(get_query_var('paged'),1);
	$args = [
		'post_type' => ['product'],
		'paged' => $paged,
		'posts_per_page' => 12,
	];
	if(!empty($category) && $category!= 'all')
		$args['tax_query'] = [
			'relation' => 'AND',  
			[
				'taxonomy' => 'product_cat',
				'field' => 'slug',
				'terms' => array( $category ), 
			],
		];
	if(!empty($tag)){
		if(array_key_exists ('tax_query',$args)){
			$args['tax_query'][] = [
				'taxonomy' => 'product_tag',
				'field' => 'slug',
				'terms' => array( $tag ), 
			];
		}
		else{
			$args['tax_query'] = [
				'relation' => 'AND',  
				[
					'taxonomy' => 'product_tag',
					'field' => 'slug',
					'terms' => array( $tag ), 
				],
			];
		}
	}
// 	if(!empty($on_sale) && $on_sale == 1){
		
// 	}
	if(!empty($availability)){
		if($availability == 'sale'){
			$products = wc_get_products( ['return' => 'ids','status' => 'publish','limit' => -1,'type' => array('simple', 'variable', 'bundle','external','grouped')] );
			$saleProduct = [];
			foreach($products as $vv){
				if(is_product_on_sale($vv)){
					$saleProduct[] = $vv;
				}
			}
			if(!empty($saleProduct))
				$args['post__in'] = $saleProduct;
			else
				$args['post__in'] = [0];
			
// 			if(array_key_exists('tax_query',$args)){
// 				$args['tax_query'][] = [
// 					 'key' => '_sale_price',
// 					 'value' => '',
// 					 'compare' => '!='
// 				];
// 			}
// 			else{
// 				$args['tax_query'] = [
// 					'relation' => 'AND',  
// 					[
// 						'key' => '_sale_price',
//                 		'value' => '',
//                 		'compare' => '!='
// 					],
// 				];
// 			}
		}
		else{
			$products = wc_get_products( ['stock_status' => $availability,'return' => 'ids','status' => 'publish','limit' => -1,'type' => array('simple', 'variable', 'bundle','external','grouped')] );
			if(!empty($products))
				$args['post__in'] = $products;
			else
				$args['post__in'] = [0];
		}
		
		//print_r($products);
		
	}
	if(!empty($orderBy)){
		if($orderBy == 'popularity'){
			$args['meta_key'] = 'total_sales';
			$args['orderby'] = 'meta_value_num';
			$args['order'] = 'DESC';
		}
		if($orderBy == 'rating'){
			$args['meta_key'] = '_wc_average_rating';
			$args['orderby'] = 'meta_value_num';
			$args['order'] = 'DESC';
		}
		if($orderBy == 'date'){
			$args['orderby'] = 'date';
			$args['order'] = 'DESC';
		}
		if($orderBy == 'price'){
			$args['meta_key'] = '_price';
			$args['orderby'] = 'meta_value_num';
			$args['order'] = 'ASC';
		}
		if($orderBy == 'price-desc'){
			$args['meta_key'] = '_price';
			$args['orderby'] = 'meta_value_num';
			$args['order'] = 'DESC';
		}
	}
	if(!empty($keyword)){
		$args['s'] = $keyword;
	}
	if(isset($_GET['dev']))
		print_r($args);
	$the_query = new WP_Query( $args );
?>

<div class="customShopGrid-wrap">
	<form id="frmFilterProduct" method="GET" action="">
		<div class="frmFilterProduct-ajax">
			<?php 
				$sort_arr = [
						'menu_order' => __('Default Sorting'),	
						'popularity' => __('Best Selling'),
						'rating' => __('Average Rating'),
						'date' => __('Latest Product'),
						'price' => __('Price Low To High'),
						'price-desc' => __('Price High To Low'),
				];
			?>
			<div class="customShopGrid-order-wrap">
				<div class="customShopGrid-order orderbyPC">
					<span>Sort By:</span>
					<select id="orderby" class="slOrder" name="orderby">
						<?php foreach($sort_arr as $key => $value):?>
						<option value="<?php echo $key; ?>" <?php if($orderBy == $key) echo 'selected'?>><?php echo $value; ?></option>
						<?php endforeach; ?>
					</select>
				</div>
			</div>
	<div class="customShopGrid">
		
		<div class="customShopGrid-left">
			<div class="customShopGrid-filter">
				<div class="customShopGrid-filter-top customShopGrid-filter-space">
					<h2 class="customShopGrid-filter-heading">Filter Products</h2>
					<img src="https://vancitylabs.co/wp-content/uploads/2024/04/setting-ic.svg" />
				</div>
				<div class="customShopGrid-filter-list">
					
					<div class="customShopGrid-filter-group">
						<div class="customShopGrid-filter-group-head customShopGrid-filter-space">
							<h3 class="customShopGrid-filter-heading">Availability</h3>
						</div>
						<div class="customShopGrid-filter-group-content">
							<ul>
								<li>
									<label class="custom-checkbox">
										<input id="Availability-instock" class="filter-checkbox" type="checkbox" name="availability" value="instock" <?php if($availability == 'instock') echo 'checked' ?> />
										<span style='font-size: 18px'>In Stock (<?php echo getStockStatusCountProduct()?>)</span>
									</label>
								</li>
								<li>
									<label class="custom-checkbox">
										<input id="Availability-outstock" class="filter-checkbox" type="checkbox" name="availability" value="outofstock" <?php if($availability == 'outofstock') echo 'checked' ?> />
										<span style='font-size: 18px'>Out of Stock (<?php echo getStockStatusCountProduct(false)?>)</span>
									</label>
								</li>
								<li>
									<label class="custom-checkbox">
										<input id="Availability-outstock" class="filter-checkbox" type="checkbox" name="availability" value="sale" <?php if($availability == 'sale') echo 'checked' ?> />
										<span style='font-size: 18px'>On Sale (<?php echo count_sale_products();?>)</span>
									</label>
								</li>
							</ul>
						</div>
					</div>
					<!--end group-->
					<?php  
						$cats = get_terms([
							'taxonomy' => 'product_cat',
							'hide_empty' => true,
							'parent'   => 0,
						]);
						if(!empty($cats)):
					?>
					<div class="customShopGrid-filter-group">
						<div class="customShopGrid-filter-group-head customShopGrid-filter-space">
							<h3 class="customShopGrid-filter-heading">Categories</h3>
						</div>
						<div class="customShopGrid-filter-group-content">
							<ul>
								<li>
									<label class="custom-checkbox">	
										<input class="filter-checkbox" type="checkbox" name="category" value="all" <?php if($category == 'all') echo 'checked' ?> />
										<span style='font-size: 18px'>All</span>
									</label>
								</li>
								<?php 
									foreach ($cats as $key => $value): 
									$childs = get_term_children( $value->term_id, 'product_cat' );
									$isChildOpen = false;
									if(!empty($childs)): 
										foreach($childs as $child):
											$child = get_term_by('id',$child,'product_cat');
											
											//print_r($category);
											if($category == $child->slug){
												$isChildOpen =  true;
												break;
											}
										endforeach;
									endif;
									
								?>
									<li class="<?php if(!empty($childs)) echo 'has-child'; ?>">
										<?php if(!empty($childs)):?>
											<div class="custom-checkbox">
										<?php else: ?>	
											<label class="custom-checkbox">	
										<?php endif;?>	
											<input class="filter-checkbox" type="checkbox" name="category" value="<?php echo $value->slug ?>" <?php if($category == $value->slug) echo 'checked' ?> />
												
											<span style='font-size: 18px'><?php echo $value->name ?> (<?php echo $value->count ?>)</span>
										<?php if(!empty($childs)):?>
											</div>
										<?php else: ?>
											</label>
										<?php endif;?>			
										<?php if(!empty($childs)): ?>
										<ul class="customShopGrid-filter-group-content-child" style="<?php if(!$isChildOpen) echo 'display: none;'?>">
											<?php foreach($childs as $child): $child = get_term_by('id',$child,'product_cat'); if($child->count > 0): ?>
												<li>
													<label class="custom-checkbox">
														<input class="filter-checkbox" type="checkbox" name="category" value="<?php echo $child->slug ?>" <?php if($category == $child->slug) echo 'checked' ?> />
														<span style='font-size: 18px'><?php echo $child->name;  ?> (<?php echo $child->count ?>)</span>
													</label>
												</li>
											<?php endif; endforeach ?>
										</ul>
										<?php endif;?>
									</li>
								<?php endforeach ?>
							</ul>
						</div>
					</div>
					<!--end group-->
					<?php endif; ?>
					
					<div class="customShopGrid-filter-reset">
						<a class="customShopGrid-filter-reset-button" href="<?php echo get_permalink( wc_get_page_id( 'shop' ) )?>">Reset Filters</a>
					</div>
				</div>
			</div>
		</div>
		<div class="customShopGrid-right">
			<div class="customShopGrid-order show-mb-flex" hidden>
				<h3 class="customShopGrid-filter-heading">Sort by:</h3>
				<div class="orderbyMB">
				</div>
			</div>
			<!--end group-->
			<?php if ( !empty($keyword) ) :?>
				<p class="customShopGrid-seach-keyword-label">Search results for <span>"<?php echo $keyword; ?>"</span> <a href="https://vancitylabs.co/shop/">Remove</a></p>
			<?php endif; ?>
			<div class="customShopGrid-list">
				
				<?php if ( $the_query->have_posts() ) :?>
				<?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
				<div class="customShopGrid-product">
					<div class="customShopGrid-product-inner">
					   <div class="customShopGrid-product-image-wrap">
						   <?php 
						   		$product = wc_get_product(get_the_ID());
								$product_type = $product->get_type();
								if(!$product->is_in_stock()):
						   ?>
						  		<span class="customShopGrid-product-stockout customShopGrid-product-label">Out of stock</span>  
						   <?php endif; ?>
						   <?php if(is_product_on_sale(get_the_ID())):?>
						   		<span class="customShopGrid-product-has-sale customShopGrid-product-label">Sale</span>  
						   <?php endif; ?>
						  <div class="customShopGrid-product-image">
							 <a href="<?php the_permalink();?>" tabindex="0"> 
							 	<?php the_post_thumbnail('medium')?>
							 </a>
						  </div>
					   </div>
					   <div class="customShopGrid-product-content">
						  <div class="customShopGrid-product-content-inner">
							  <div class="customShopGrid-product-ratting-wrap">
								<div class="top-rated-rating">
									<?php 
							   			$types = get_the_terms(get_the_ID(),'product-type');
										$type = '';
										if(!empty($types)) $type = reset($types);
										if(is_object($type)):
											$color = get_field('color',$type);
									?>
								   <span class="customShopGrid-product-type" style="<?php if($color) echo 'background:'.$color;?>"><?php echo $type->name;?></span>
									<?php endif; ?>
								   <span class="customShopGrid-product-ratting">
								   		<span class="customShopGrid-product-user-ratting">
								   			<?php customRatingScoreHTML(get_the_ID());?>              
									   </span>
									   <span class="customShopGrid-product-user-ratting-count" hidden>(<?php echo $product->get_rating_count(); ?>)</span>
									</span>
									<?php 
										$thc = get_field('thc');
										if($thc > 0):
									?>
									<span class="customShopGrid-product-thc"><b>THC</b> <?php echo $thc.'%'?></span>
									<?php endif; ?>
								</div>
							 </div>
							 <h4 class="customShopGrid-product-title"><a href="<?php the_permalink();?>" tabindex="0"><?php the_title();?></a></h4>
							 
							 <?php 
								$add_to_card_id = get_the_ID();
							  	$discounted_variants = get_discounted_variants_of_product(get_the_ID());
								if($discounted_variants):
									$add_to_card_id = $discounted_variants[0]['id'];
							 ?>
							  <select class="customShopGrid-product-list-variable">
							  	<?php 
										foreach($discounted_variants as $key => $value):
											//print_r($value);
											$variable_price = ($value['sale_price']> 0)?$value['sale_price'] : $value['regular_price'];
											$name_parts = explode(' - ', $value['name']);
											//$variable_price = 0;
								?>
								  <option value="<?php echo $value['id']?>" <?php if(strtolower(end($name_parts)) == '28g'){$add_to_card_id = $value['id']; echo 'selected';}?>><?php echo end($name_parts);?> - $<?php echo $variable_price;?></option>
								<?php endforeach;?>
							  </select>
							  <?php else: ?>
							  <div class="customShopGrid-product-price">
								  <?php woocommerce_template_loop_price();?>
							  </div>
							  <?php endif;?>
							  <div class="wrap-btn">
								  <?php if($product_type !== 'bundle'):?>
								 	<a class="pb-btn-style add_to_cart_button ajax_add_to_cart" href="<?php site_url();?>?add-to-cart=<?php echo $add_to_card_id;?>&quantity=1" data-quantity="1" data-product_id="<?php echo $add_to_card_id;?>"><span>Add to cart</span> <img src="https://vancitylabs.co/wp-content/uploads/2024/04/right-arrow.svg" /></a>
								  <?php else: ?>
								  	<a class="pb-btn-style" href="<?php the_permalink(); ?>"><span>Buy Now</span> <img src="https://vancitylabs.co/wp-content/uploads/2024/04/right-arrow.svg" /></a>
								  <?php endif;?>
							  </div>
						  </div>
					   </div>
					</div>
				</div>
				<?php endwhile;?>
				<?php else: ?>
					<p>No product found!</p>
				<?php endif;wp_reset_postdata();?>
				
			</div>
			<?php if($the_query->max_num_pages > 1):?>
			<div class="customShopGrid-pagenavi">
				<?php echo paginate_links(array(
					'total'   => $the_query->max_num_pages,
					'current' => $paged,
					'prev_text' => '<img src="'.CHILD_THEME_URI.'/images/prev-arrow-green.svg" />',
					'next_text' => '<img src="'.CHILD_THEME_URI.'/images/next-arrow-green.svg" />'
				));?>
			</div>
			<?php endif;?>
		</div>
	</div>
	</div>
	</form>
	<script type="text/javascript">
		(function($){
			var sortDiv = $('body').find('#orderby');
			//var spinner = $('')
			$('body').on('change','.filter-checkbox',function(){
				$(this).parents('li').siblings().find('.filter-checkbox').prop('checked', false)
				$('#frmFilterProduct').submit();
			})
			$('body').on('click','.customShopGrid-filter-group-head',function(e){
				$(this).toggleClass('close')
				$(this).parent().find('.customShopGrid-filter-group-content').slideToggle();
			})
			$('body').on('change','.slOrder',function(){
				$('#frmFilterProduct').submit();
			})
			$('body').on('click','.customShopGrid-filter-top',function(e){
				$(this).toggleClass('close')
				$(this).parent().find('.customShopGrid-filter-list').slideToggle();
			})
			$('body').on('click','li.has-child .custom-checkbox',function(e){
				var $div = $(this);
				var divOffset = $div.offset();
				var clickX = e.pageX - divOffset.left;
				if (clickX <= 28) {
					$(this).parents('ul').find('.filter-checkbox').prop('checked', false);
					$(this).find('.filter-checkbox').prop('checked', true)
					$('#frmFilterProduct').submit();
				}
				else{
					$(this).parent().find('.customShopGrid-filter-group-content-child').slideToggle();
				}
			})
			function moveSortDiv(){
				if($(window).innerWidth() < 768){
					if(!$('.orderbyMB .slOrder').length)
						sortDiv.appendTo('.orderbyMB');
				}
				else{
					if(!$('.orderbyPC .slOrder').length)
						sortDiv.appendTo('.orderbyPC');
				}
			}
			moveSortDiv();
			$(window).on('resize',function(){
				moveSortDiv();
			})
			function customAjaxSend(form,fullUrl){
				history.pushState({}, '', fullUrl);
				$.ajax({
					url: fullUrl,
					method: form.attr('method'),
					data: form.serialize(),
					dataType: 'html',
					beforeSend: function () {
						$('.customShopGrid-list').html(`<div class="cspinner">
				<div class="loadingio-spinner" style="/* display: none; */">
					<div class="loadingio-spinner-spinner-gakt1tin5n">
						<div class="ldio-7ufvexzivn">
							<div></div>
							<div></div>
							<div></div>
							<div></div>
							<div></div>
							<div></div>
							<div></div>
							<div></div>
							<div></div>
							<div></div>
							<div></div>
							<div></div>
						</div>
					</div>
				</div>
			</div>`);
						$('.cspinner .loadingio-spinner').show();
						$('.customShopGrid-pagenavi').css('display','none');
					},
					success: function(response) {
						 	const html = $(response);
							const items = html.find('.frmFilterProduct-ajax');
							$('#frmFilterProduct').html(items);
							$('.cspinner .loadingio-spinner').hide();
							$('.customShopGrid-pagenavi').css('display','flex');
// 							if (items.length) {
// 								$('.project-box').html(items);
// 							} else {
// 								$('.project-box').html('<p>Aucun résultat trouvé</p>');
// 							}
							//console.log(response);
							moveSortDiv();
					},
					error: function(jqXHR, textStatus, errorThrown) {
						console.log('Error submitting form');
						console.log(textStatus, errorThrown);
					}
				});
			}
			$('#frmFilterProduct').on('submit', function(e) {
				e.preventDefault(); 
				var form = $(this); 
				var url = form.attr('action'); 
				var fullUrl = url + '?' + form.serialize();
				history.pushState({}, '', fullUrl);
				let currentUrl = window.location.href;
				let newUrl = currentUrl.replace(/page\/\d+\//, '');
				customAjaxSend(form, newUrl);
			});
			$('body').on('click','.customShopGrid-pagenavi a',function(e){
				e.preventDefault();
				var form = $('#frmFilterProduct'); 
				var fullUrl = $(this).attr('href');
				$('html, body').animate({
					scrollTop: $(".customShopGrid-right").offset().top - 300
				}, 1000); // 1000 milliseconds for the scroll animation
				customAjaxSend(form, fullUrl);
// 				setTimeout(function() {
					
// 				}, 200); // 1000 milliseconds delay before starting the scroll
				
			})
		})(jQuery)
	</script>
</div>
<?php	return ob_get_clean();
}
add_shortcode('customShopGrid','customShopGridShortcode');
<head>
    <meta charset="<?php bloginfo('charset'); ?>">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="preconnect" href="https://fonts.googleapis.com/" />
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
    <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap" rel="stylesheet" />
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
    <link rel="stylesheet" href="https://unpkg.com/tippy.js@6/dist/tippy.css" />
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/swiper@11.0.5/swiper-bundle.min.css" />
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/jquery-range@1.0.0/jquery.range.min.css" />
    <link rel="stylesheet" href="https://unpkg.com/intl-tel-input@18.2.1/build/css/intlTelInput.css" />
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/flatpickr@4.6.13/flatpickr.min.css" />
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/lazyload@17.8.5/dist/lazyload.min.js" />
    <link rel="stylesheet" href="<?php echo get_stylesheet_directory_uri() . '/assets/css/tvh-custom.css?ver=' . filemtime(get_stylesheet_directory() . '/assets/css/tvh-custom.css') ?>" />
    <script defer src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
    <script defer src="https://unpkg.com/@popperjs/core@2"></script>
    <script defer src="https://cdn.jsdelivr.net/npm/swiper@11.0.5/swiper-bundle.min.js"></script>
    <script defer src="https://cdn.jsdelivr.net/npm/jquery-range@1.0.0/jquery.range-min.js"></script>
    <script defer src="https://unpkg.com/intl-tel-input@18.2.1/build/js/intlTelInput.min.js"></script>
    <script defer src="https://cdn.jsdelivr.net/npm/flatpickr@4.6.13/flatpickr.min.js"></script>
    <script defer src="https://cdn.jsdelivr.net/npm/vanilla-lazyload@17.8.5/dist/lazyload.min.js"></script>
    <link rel="profile" href="https://gmpg.org/xfn/11" />
    
    <?php if (is_page_template('template-home.php')): ?>
        <link rel="preload stylesheet" href="<?php echo get_stylesheet_directory_uri() . '/assets/css/home.css?ver=' . filemtime(get_stylesheet_directory() . '/assets/css/home.css') ?>" as="style">
        <link rel="preload" fetchpriority="high" href="<?php echo get_template_directory_uri() . '/assets/img/home-hero.webp'; ?>" type="image/webp">
    <?php endif; ?>
    
    <?php if (is_page_template('template-about.php')): ?>
        <link rel="preload stylesheet" href="<?php echo get_stylesheet_directory_uri() . '/assets/css/about-us.css?ver=' . filemtime(get_stylesheet_directory() . '/assets/css/about-us.css') ?>" as="style">
    <?php endif; ?>
    
    <?php if (is_page_template('template-services.php')): ?>
        <link rel="preload stylesheet" href="<?php echo get_stylesheet_directory_uri() . '/assets/css/about-us.css?ver=' . filemtime(get_stylesheet_directory() . '/assets/css/about-us.css') ?>" as="style">
    <?php endif; ?>
</head>
function customRatingScoreHTML($productID)
{
  $product = wc_get_product($productID);
  $average      = $product->get_average_rating();
  $rating_whole = floor($average);
  $rating_fraction = $average - $rating_whole;
  $flug = 0;
  for ($i = 1; $i <= 5; $i++) {
    if ($i <= $rating_whole) {
      echo '<i class="fas fa-star"></i>';
    } else {
      if ($rating_fraction > 0 && $flug == 0) {
        echo '<i class="fas fa-star-half-alt"></i>';
        $flug = 1;
      } else {
        echo '<i class="far fa-star empty"></i>';
      }
    }
  }
}
<?php
/**
 * Review order table
 *
 * This template can be overridden by copying it to yourtheme/woocommerce/checkout/review-order.php.
 *
 * HOWEVER, on occasion WooCommerce will need to update template files and you
 * (the theme developer) will need to copy the new files to your theme to
 * maintain compatibility. We try to do this as little as possible, but it does
 * happen. When this occurs the version of the template file will be bumped and
 * the readme will list any important changes.
 *
 * @see https://woocommerce.com/document/template-structure/
 * @package WooCommerce\Templates
 * @version 5.2.0
 */

defined( 'ABSPATH' ) || exit;
$total_order = WC()->cart->total;
$total_sale = 0;

foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
    $product = $cart_item['data'];
    if ( $product->is_on_sale() ) {
        $total_sale += ( $product->get_regular_price() - $product->get_sale_price() ) * $cart_item['quantity'];
    }
}
?>
<div class="woocommerce-checkout-review-order-table">
	<?php do_action('custom-freeshiping-bar');?>
    <div id="total-header">
    <button type="button" id="toggle-cart-items" class="button-toggle-cart">
        Order Summary
		<i class="fa-solid fa-chevron-down"></i>
    </button>
	<div class="total-money">
       <span class="total-sale">$<?php echo number_format($total_sale, 2); ?></span>
       <span class="total-order">$<?php echo number_format($total_order, 2); ?></span>
    </div>
</div>
    <div id="cart-details">
		<div class="title-in-review">
				<h3 class="co-h3">PURCHARE SUMMARY</h3>
				<?php do_action('custom-freeshiping-bar');?>
			</div>
        <ul id="cart-items-list" class="woocommerce-mini-cart cart_list product_list_widget">
            <?php if ( ! WC()->cart->is_empty() ) : ?>
                <?php
                    do_action( 'woocommerce_review_order_before_cart_contents' );

                    foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
                        $_product     = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key );
                        $product_id   = apply_filters( 'woocommerce_cart_item_product_id', $cart_item['product_id'], $cart_item, $cart_item_key );

                        if ( $_product && $_product->exists() && $cart_item['quantity'] > 0 && apply_filters( 'woocommerce_checkout_cart_item_visible', true, $cart_item, $cart_item_key ) ) {
                            $product_name      = apply_filters( 'woocommerce_cart_item_name', $_product->get_name(), $cart_item, $cart_item_key );
                            $thumbnail         = apply_filters( 'woocommerce_cart_item_thumbnail', $_product->get_image(), $cart_item, $cart_item_key );
                            $product_price     = apply_filters( 'woocommerce_cart_item_subtotal', WC()->cart->get_product_subtotal( $_product, $cart_item['quantity'] ), $cart_item, $cart_item_key );
                            $product_permalink = apply_filters( 'woocommerce_cart_item_permalink', $_product->is_visible() ? $_product->get_permalink( $cart_item ) : '', $cart_item, $cart_item_key );

                            if ( empty( $product_permalink ) ) {
                                $product_name = '<span class="nm-cart-panel-product-title">' . wp_kses_post( $product_name ) . '</span>';
                            } else {
                                $product_permalink = esc_url( $product_permalink );
                                $thumbnail = '<a href="' . $product_permalink . '">' . $thumbnail . '</a>';
                                $product_name = '<a href="' . $product_permalink . '" class="nm-cart-panel-product-title">' . wp_kses_post( $product_name ) . '</a>';
                            }

                            $product = wc_get_product($product_id);

                            ?>
                            <li id="nm-cart-panel-item-<?php echo esc_attr( $cart_item_key ); ?>" class="woocommerce-mini-cart-item <?php echo esc_attr( apply_filters( 'woocommerce_mini_cart_item_class', 'mini_cart_item', $cart_item, $cart_item_key ) ); ?>">
                                <div class="nm-cart-panel-item-thumbnail">
                                    <div class="nm-cart-item-loader nm-loader"></div>
                                    <div class="nm-cart-panel-thumbnail-wrap">
                                        <?php echo $thumbnail; ?>
                                        <div class="nm-cart-panel-thumbnail-loader nm-loader"></div>
                                    </div>
                                </div>
                                <div class="nm-cart-panel-item-details">
                                    <?php echo apply_filters( 'woocommerce_cart_item_remove_link',
                                        sprintf(
                                            '<a href="%s" class="remove remove_from_cart_button" aria-label="%s" data-product_id="%s" data-cart_item_key="%s" data-product_sku="%s"><i class="nm-font nm-font-close2"></i></a>',
                                            esc_url( wc_get_cart_remove_url( $cart_item_key ) ),
                                            esc_attr( sprintf( __( 'Remove %s from cart', 'woocommerce' ), wp_strip_all_tags( $product_name ) ) ),
                                            esc_attr( $product_id ),
                                            esc_attr( $cart_item_key ),
                                            esc_attr( $_product->get_sku() )
                                        ), $cart_item_key );
                                    ?>
                                    <?php echo $product_name; ?>
                                    <?php echo wc_get_formatted_cart_item_data( $cart_item ); ?>
                                    <div class="nm-cart-panel-quantity-pricing">
                                        <?php if ( $_product->is_sold_individually() ) : ?>
                                            <?php echo apply_filters( 'woocommerce_widget_cart_item_quantity', '<span class="quantity">' . esc_html__( 'Qty', 'woocommerce' ) . ': ' . $cart_item['quantity'] . '</span>', $cart_item, $cart_item_key ); ?>
                                        <?php else: ?>
                                            <div class="product-quantity" data-title="<?php esc_html_e( 'Quantity', 'woocommerce' ); ?>">
                                                <?php
                                                    $product_quantity = woocommerce_quantity_input( array(
                                                        'input_name'  => "cart[{$cart_item_key}][qty]",
                                                        'input_value' => $cart_item['quantity'],
                                                        'max_value'   => $_product->backorders_allowed() ? '' : $_product->get_stock_quantity(),
                                                        'min_value'   => '1',
                                                        'nm_mini_cart_quantity' => true 
                                                    ), $_product, false );

                                                    echo apply_filters( 'woocommerce_widget_cart_item_quantity', $product_quantity, $cart_item, $cart_item_key );
                                                ?>
                                            </div>
                                        <?php endif; ?>

                                        <div class="nm-cart-panel-item-price">
                                            <?php if ( $price_html = $product->get_price_html() ) : ?>
                                                <span class="price"><?php echo $price_html; ?></span>
                                            <?php endif; ?>
                                        </div>
                                    </div>
                                </div>
                            </li>
                            <?php
                        }
                    }

                    do_action( 'woocommerce_review_order_after_cart_contents' );
                ?>
            <?php else: ?>
                <li class="empty">
                    <i class="nm-font nm-font-close2"></i>
                    <span><?php esc_html_e( 'No products in the cart.', 'woocommerce' ); ?></span>
                </li>
            <?php endif; ?>
        </ul>

        <?php do_action( 'woocommerce_custom_checkout_counpon' ); ?>
        <table class="shop_table">
            <tfoot>
                <tr class="cart-subtotal">
                    <th><?php esc_html_e( 'Subtotal', 'woocommerce' ); ?></th>
                    <td><?php wc_cart_totals_subtotal_html(); ?></td>
                </tr>

                <?php foreach ( WC()->cart->get_coupons() as $code => $coupon ) : ?>
                    <tr class="cart-discount coupon-<?php echo esc_attr( sanitize_title( $code ) ); ?>">
                        <th><?php wc_cart_totals_coupon_label( $coupon ); ?></th>
                        <td><?php wc_cart_totals_coupon_html( $coupon ); ?></td>
                    </tr>
                <?php endforeach; ?>

                <?php if ( WC()->cart->needs_shipping() && WC()->cart->show_shipping() ) : ?>
				<?php
				// Get available shipping methods
				$available_methods = WC()->shipping->get_packages()[0]['rates'];
				$chosen_methods = WC()->session->get('chosen_shipping_methods');
				$chosen_method = !empty($chosen_methods[0]) ? $chosen_methods[0] : '';

				// Only display the chosen method
				if (!empty($available_methods[$chosen_method])) {
					echo '<tr class="shipping">';
					echo '<th>' . esc_html__('Shipping', 'woocommerce') . '</th>';
					echo '<td data-title="Shipping">' . wp_kses_post($available_methods[$chosen_method]->label . ': ' . wc_price($available_methods[$chosen_method]->cost)) . '</td>';
					echo '</tr>';
				}
				?>
			<?php endif; ?>


                <?php foreach ( WC()->cart->get_fees() as $fee ) : ?>
                    <tr class="fee">
                        <th><?php echo esc_html( $fee->name ); ?></th>
                        <td><?php wc_cart_totals_fee_html( $fee ); ?></td>
                    </tr>
                <?php endforeach; ?>

                <?php if ( wc_tax_enabled() && ! WC()->cart->display_prices_including_tax() ) : ?>
                    <?php if ( 'itemized' === get_option( 'woocommerce_tax_total_display' ) ) : ?>
                        <?php foreach ( WC()->cart->get_tax_totals() as $code => $tax ) : ?>
                            <tr class="tax-rate tax-rate-<?php echo esc_attr( sanitize_title( $code ) ); ?>">
                                <th><?php echo esc_html( $tax->label ); ?></th>
                                <td><?php echo wp_kses_post( $tax->formatted_amount ); ?></td>
                            </tr>
                        <?php endforeach; ?>
                    <?php else : ?>
                        <tr class="tax-total">
                            <th><?php echo esc_html( WC()->countries->tax_or_vat() ); ?></th>
                            <td><?php wc_cart_totals_taxes_total_html(); ?></td>
                        </tr>
                    <?php endif; ?>
                <?php endif; ?>

                <?php do_action( 'woocommerce_review_order_before_order_total' ); ?>

                <tr class="order-total">
                    <th><?php esc_html_e( 'Total', 'woocommerce' ); ?></th>
                    <td><?php wc_cart_totals_order_total_html(); ?></td>
                </tr>

                <?php do_action( 'woocommerce_review_order_after_order_total' ); ?>
            </tfoot>
        </table>
    </div>
</div>


/**
 * @snippet       Remove Zoom, Gallery @ Single Product Page
 * @how-to        Get CustomizeWoo.com FREE
 * @author        Rodolfo Melogli
 * @testedwith    WooCommerce 5
 * @community     https://businessbloomer.com/club/
 */
  
//add_action( 'wp', 'bbloomer_remove_zoom_lightbox_theme_support', 99 );
  
function bbloomer_remove_zoom_lightbox_theme_support() { 
    //remove_theme_support( 'wc-product-gallery-zoom' );
    //remove_theme_support( 'wc-product-gallery-lightbox' );
    remove_theme_support( 'wc-product-gallery-slider' );
}

////Remove actions for single product
remove_action('woocommerce_before_main_content','woocommerce_breadcrumb',20);
remove_action('woocommerce_single_product_summary','woocommerce_template_single_meta',40);
remove_action('woocommerce_single_product_summary','woocommerce_template_single_excerpt',20);
remove_action('woocommerce_after_single_product_summary','woocommerce_output_product_data_tabs',10);
remove_action('woocommerce_after_single_product_summary','woocommerce_upsell_display',15);
remove_action('woocommerce_after_single_product_summary','woocommerce_output_related_products',20);
//Add actions for single product
add_action('woocommerce_single_product_summary','woocommerce_template_single_excerpt',35);

function addTHCForSingleProduct(){
	$thc = get_field('thc');
	if(!empty($thc)) echo '<h4 class="single-product-thc">'.$thc.'</h4>';
}
add_action('woocommerce_single_product_summary','addTHCForSingleProduct',6);
function customTabForSingleProduct(){
?>
<div class="rst-accordion-description">
	<?php if($ingredient = get_field('ingredient_field_name')):?>
	<div class="rst-item-accordion-description">
		<h3 class="rst-heading-item-accordion-description rst-heading-item-toggle">
			Ingredients
			<span>
				<img src="https://sweedies.co/wp-content/uploads/2024/05/arrows-down.png" />
			</span>
		</h3>
		<div class="rst-content-item-accordion-description">
			<?php echo $ingredient; ?>
		</div>
	</div>
	<?php endif;?>
	<?php  $lab_test_report = get_field('lab_test_report');if(!empty($lab_test_report)):?>
	<div class="rst-item-accordion-description">
		<a class="rst-heading-item-accordion-description" href="<?php echo $lab_test_report['url']; ?>" download>
			Lab test report
			<span>
				<img src="https://sweedies.co/wp-content/uploads/2024/05/PDF-Print-Icon.png" />
			</span>
		</a>
	</div>
	<?php endif;?>
</div>
<script>
	(function($){
		$('.rst-heading-item-toggle').click(function(){
			if($(this).hasClass('active')){
				$(this).parent().find('.rst-content-item-accordion-description').slideUp();
				$(this).removeClass('active');
			}else{
				$('.rst-content-item-accordion-description').slideUp();
				$(this).parent().find('.rst-content-item-accordion-description').slideDown();
				$('.rst-heading-item-toggle').removeClass('active');
				$(this).addClass('active');
			}
			return false;
		});
	})(jQuery)
</script>
<?php
}
add_action('woocommerce_single_product_summary','customTabForSingleProduct',45);

function customBestSellerForShop(){
?>
<?php 
	$args = [
		'post_type' => 'product',
		'posts_per_page' => 15,
		'meta_key' => 'total_sales',
		'orderby' => 'meta_value_num',
		'order' => 'DESC',
	];
	$the_query = new WP_Query($args);
	if($the_query->have_posts()):
?>
<div class="customBestSellerForSingleProduct" style="clear: both;">
	<div class="customBestSellerForSingleProduct-head">
		<h2 class="nt-heading">
			Best Sellers
		</h2>
	</div>
	<div class="customBestSellerForSingleProduct-list">
		<div class="slider-product custom-slider-product-bestSellers">
			<div class="swiper-wrapper">
				<?php
                while ($the_query->have_posts()):
                    $the_query->the_post();
                    $product = wc_get_product(get_the_ID());
                    $categories = wp_get_post_terms(get_the_ID(), 'product_cat');
                    $category_name = !empty($categories) ? $categories[0]->name : '';
                    $rating_count = $product->get_rating_count();
                    $average = $product->get_average_rating();
                    $regular_price = $product->get_regular_price();
                    $sale_price = $product->get_sale_price();
                    ?>

                    <div class="swiper-slide">
                        <div class="slider-product-item">
                            <a class="product-link" href="<?php the_permalink(); ?>">
                                <div class="slider-product-image">
                                    <?php echo woocommerce_get_product_thumbnail('shop_catalog'); ?>

                                    <div class="add-to-cart-btn">
                                        <?php //echo $this->get_add_to_cart_button(get_the_ID()); ?>
                                    </div>
                                </div>
                            </a>
                            <div class="slider-product-details">
                                <div class="product-category"><?php echo esc_html($category_name); ?></div>
								<a href="<?php the_permalink(); ?>">
									<h2 class="slider-product-title">
										<?php the_title(); ?>
									</h2>
								</a>
                                <div class="slider-product-description"><?php echo wp_trim_words(get_the_excerpt(), 15); ?></div>
								<div class="product-rating">
									<?php
									$rating = $average; 
									$full_stars = floor($rating);
									$half_star = ($rating - $full_stars >= 0.5) ? 1 : 0;
									$empty_stars = 5 - $full_stars - $half_star;

									
									for ($i = 0; $i < $full_stars; $i++) {
										echo '<i class="fa-solid fa-star"></i>';
									}

									
									if ($half_star) {
										echo '<i class="fa-solid fa-star-half-alt"></i>';
									}

									
									for ($i = 0; $i < $empty_stars; $i++) {
										echo '<i class="fa-regular fa-star"></i>';
									}
									?>
									<span class="rating-count">(<?php echo $rating_count; ?>)</span>
								</div>
								<div class="slider-product-prices">
                                    <?php if ($sale_price): ?>
                                        <span class="slider-product-new-price"><?php echo wc_price($sale_price); ?></span>
                                        <span class="slider-product-old-price"><?php echo wc_price($regular_price); ?></span>
                                    <?php else: ?>
                                        <span class="slider-product-new-price"><?php echo wc_price($regular_price); ?></span>
                                    <?php endif; ?>
                                </div>
                                
                            </div>
                        </div>
                    </div>

                <?php endwhile; ?>
			</div>
			<div class="swiper-pagination"></div>
		</div>
		<div class="swiper-button-prev"></div>
        <div class="swiper-button-next"></div>
	</div>
</div>
<script>
	jQuery(document).ready(function ($) {

		var swiper_bestSellers = new Swiper(".custom-slider-product-bestSellers", {
			slidesPerView: 3,
			slidesPerGroup: 1,
			centeredSlides: true,
			loop: true,
			autoplay: {
				delay: 5000,
			},
			spaceBetween: 24,
// 			pagination: {
// 				el: ".swiper-pagination",
// 				clickable: true,
// 			},
			navigation: {
				nextEl: '.swiper-button-next',
				prevEl: '.swiper-button-prev',
			},
			breakpoints: {
				1025: {
					slidesPerView: 3,
					centeredSlides: true,
				},
				768: {
					slidesPerView: 2,
					centeredSlides: true,
				},
				320: {
					slidesPerView: 1.5,
					centeredSlides: true,
				},
			}
		});


	});

	jQuery(document).ready(function($) {
		$('.slider-product .slider-product-item ').matchHeight();
	});


</script>
<?php
	endif; wp_reset_postdata();
}
add_action('woocommerce_after_single_product','customBestSellerForSingleProduct',25);

function customReviewForSingleProduct(){
?>
<div class="customReviewForSingleProduct">
	<div class="customReviewForSingleProduct-head">
		<h2 class="nt-heading">
			Customer reviews
		</h2>
	</div>
	<div class="customReviewForSingleProduct-content">
		<?php echo do_shortcode('[Woo_stamped_io type="widget"]');?>
	</div>
</div>
<?php	
}
add_action('woocommerce_after_single_product','customBestSellerForShop',30);
<?php 

class Elementor_Custom_Video_Widget extends \Elementor\Widget_Base {

    public function get_name() {
        return 'custom_video_widget';
    }

    public function get_title() {
        return __('Custom Video Widget', 'plugin-name');
    }

    public function get_icon() {
        return 'eicon-video-camera';
    }

    public function get_categories() {
        return ['basic'];
    }

    protected function _register_controls() {
        $this->start_controls_section(
            'content_section',
            [
                'label' => __('Content', 'plugin-name'),
                'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
            ]
        );

        $this->add_control(
            'source',
            [
                'label' => __('Source', 'plugin-name'),
                'type' => \Elementor\Controls_Manager::SELECT,
                'options' => [
                    'self_hosted' => __('Self Hosted', 'plugin-name'),
                    'external' => __('External URL', 'plugin-name'),
                ],
                'default' => 'self_hosted',
            ]
        );

        $this->add_control(
            'video_url',
            [
                'label' => __('Choose Video File', 'plugin-name'),
                'type' => \Elementor\Controls_Manager::MEDIA,
                'media_type' => 'video',
                'condition' => [
                    'source' => 'self_hosted',
                ],
            ]
        );

        $this->add_control(
            'autoplay',
            [
                'label' => __('Autoplay', 'plugin-name'),
                'type' => \Elementor\Controls_Manager::SWITCHER,
                'label_on' => __('Yes', 'plugin-name'),
                'label_off' => __('No', 'plugin-name'),
                'return_value' => 'yes',
                'default' => 'yes', // Set default to 'yes'
            ]
        );

        $this->add_control(
            'play_on_mobile',
            [
                'label' => __('Play on Mobile', 'plugin-name'),
                'type' => \Elementor\Controls_Manager::SWITCHER,
                'label_on' => __('Yes', 'plugin-name'),
                'label_off' => __('No', 'plugin-name'),
                'return_value' => 'yes',
                'default' => 'yes',
            ]
        );

        $this->add_control(
            'mute',
            [
                'label' => __('Mute', 'plugin-name'),
                'type' => \Elementor\Controls_Manager::SWITCHER,
                'label_on' => __('Yes', 'plugin-name'),
                'label_off' => __('No', 'plugin-name'),
                'return_value' => 'yes',
                'default' => 'no',
            ]
        );

        $this->add_control(
            'loop',
            [
                'label' => __('Loop', 'plugin-name'),
                'type' => \Elementor\Controls_Manager::SWITCHER,
                'label_on' => __('Yes', 'plugin-name'),
                'label_off' => __('No', 'plugin-name'),
                'return_value' => 'yes',
                'default' => 'no',
            ]
        );

        $this->add_control(
            'player_controls',
            [
                'label' => __('Player Controls', 'plugin-name'),
                'type' => \Elementor\Controls_Manager::SWITCHER,
                'label_on' => __('Show', 'plugin-name'),
                'label_off' => __('Hide', 'plugin-name'),
                'return_value' => 'yes',
                'default' => 'yes',
            ]
        );

        $this->add_control(
            'download_button',
            [
                'label' => __('Download Button', 'plugin-name'),
                'type' => \Elementor\Controls_Manager::SWITCHER,
                'label_on' => __('Show', 'plugin-name'),
                'label_off' => __('Hide', 'plugin-name'),
                'return_value' => 'yes',
                'default' => 'no',
            ]
        );

        $this->add_control(
            'poster',
            [
                'label' => __('Poster', 'plugin-name'),
                'type' => \Elementor\Controls_Manager::MEDIA,
                'media_type' => 'image',
            ]
        );

        $this->add_control(
            'show_play_button',
            [
                'label' => __('Show Play/Pause Button', 'plugin-name'),
                'type' => \Elementor\Controls_Manager::SWITCHER,
                'label_on' => __('Show', 'plugin-name'),
                'label_off' => __('Hide', 'plugin-name'),
                'return_value' => 'yes',
                'default' => 'yes',
            ]
        );

        $this->end_controls_section();
    }

    protected function render() {
        $settings = $this->get_settings_for_display();

        // Video HTML
        echo '<video id="custom-video" src="' . $settings['video_url']['url'] . '" ' . ($settings['autoplay'] === 'yes' ? 'autoplay' : '') . ' ' . ($settings['mute'] === 'yes' ? 'muted' : '') . ' ' . ($settings['loop'] === 'yes' ? 'loop' : '') . ' ' . ($settings['player_controls'] === 'yes' ? 'controls' : '') . ' poster="' . $settings['poster']['url'] . '"></video>';

        // Play/Pause Button
        if ($settings['show_play_button'] === 'yes') {
            // Default to pause icon if autoplay is enabled
            $icon_class = $settings['autoplay'] === 'yes' ? 'fa-pause' : 'fa-play';
            echo '<button id="custom-play-pause" class="play-button"><i class="fas ' . $icon_class . '"></i></button>';
        }

        // JavaScript for Play/Pause Button
        echo '<script>
                document.addEventListener("DOMContentLoaded", function() {
                    var video = document.getElementById("custom-video");
                    var playPauseButton = document.getElementById("custom-play-pause");
                    var icon = playPauseButton.querySelector("i");

                    // Play video if autoplay is enabled and video is muted (required by some browsers)
                    video.addEventListener("loadedmetadata", function() {
                        if (video.hasAttribute("autoplay")) {
                            video.play().then(function() {
                                icon.classList.remove("fa-play");
                                icon.classList.add("fa-pause");
                            }).catch(function(error) {
                                console.log("Autoplay failed: ", error);
                                icon.classList.remove("fa-pause");
                                icon.classList.add("fa-play");
                            });
                        }
                    });

                    playPauseButton.addEventListener("click", function() {
                        if (video.paused) {
                            video.play();
                            icon.classList.remove("fa-play");
                            icon.classList.add("fa-pause");
                        } else {
                            video.pause();
                            icon.classList.remove("fa-pause");
                            icon.classList.add("fa-play");
                        }
                    });
                });
            </script>';
    }
}


//-------------------------------------------------END-------------------------------------//
Dưới đây là đoạn đăng ký widget 
function register_custom_widget($widgets_manager)
{
    // Custom video widget
    require_once(__DIR__ . '/widgets/custom-video.php');
    $widgets_manager->register(new \Elementor_Custom_Video_Widget());
}
add_action('elementor/widgets/register', 'register_custom_widget');
<?php

class Product_Search_Widget extends \Elementor\Widget_Base
{
    public function get_name()
    {
        return 'product-search-widget';
    }

    public function get_title()
    {
        return __('Product Search Widget', 'text-domain');
    }

    public function get_icon()
    {
        return 'eicon-search'; 
    }

    public function get_categories()
    {
        return ['general'];
    }

    protected function render()
    {
        ?>

        <form class="pp-search-form" role="search" action="<?php echo esc_url(home_url('/')); ?>" method="get" aria-label="Search form">
            <div class="pp-search-form__toggle">
                <i class="fa fa-search" aria-hidden="true"></i>
            </div>
            <div class="pp-search-form__container pp-search-form--lightbox">
                <div class="search-form">
                    <label class="pp-screen-reader-text" for="pp-search-form__input-<?php echo esc_attr($this->get_id()); ?>">
                        Search our products
                    </label>
                    <input id="pp-search-form__input-<?php echo esc_attr($this->get_id()); ?>" class="pp-search-form__input" type="search" name="s" title="Search" value="">
                </div>
                <button type="submit" class="pp-search-form__button">
                    <span class="pp-icon-search" aria-hidden="true">
                        <i class="fa fa-search" aria-hidden="true"></i>
                    </span>
                </button>
                <input type="hidden" name="post_type" value="product"> 
                <div class="pp-search-form--lightbox-close">
                    <span class="pp-icon-close" aria-hidden="true">
                        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path d="M342.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192 210.7 86.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L146.7 256 41.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192 301.3 297.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.3 256 342.6 150.6z"/></svg>
                    </span>
                </div>
            </div>
        </form>
        
        <?php
    }
}

\Elementor\Plugin::instance()->widgets_manager->register_widget_type(new Product_Search_Widget());



<?php
/**
 * The Template for displaying product archives, including the main shop page which is a post type archive
 *
 * This template can be overridden by copying it to yourtheme/woocommerce/archive-product.php.
 *
 * HOWEVER, on occasion WooCommerce will need to update template files and you
 * (the theme developer) will need to copy the new files to your theme to
 * maintain compatibility. We try to do this as little as possible, but it does
 * happen. When this occurs the version of the template file will be bumped and
 * the readme will list any important changes.
 *
 * @see https://docs.woocommerce.com/document/template-structure/
 * @package WooCommerce\Templates
 * @version 3.4.0
 */

defined( 'ABSPATH' ) || exit;

get_header( 'shop' );

/**
 * Hook: woocommerce_before_main_content.
 *
 * @hooked woocommerce_output_content_wrapper - 10 (outputs opening divs for the content)
 * @hooked woocommerce_breadcrumb - 20
 * @hooked WC_Structured_Data::generate_website_data() - 30
 */
do_action( 'woocommerce_before_main_content' );

?>
<div class="container-fluid">
<header class="woocommerce-products-header">
	<?php if ( apply_filters( 'woocommerce_show_page_title', true ) ) : ?>
		<h1 class="woocommerce-products-header__title page-title"><?php woocommerce_page_title(); ?></h1>
	<?php endif; ?>

	<?php
	/**
	 * Hook: woocommerce_archive_description.
	 *
	 * @hooked woocommerce_taxonomy_archive_description - 10
	 * @hooked woocommerce_product_archive_description - 10
	 */
	do_action( 'woocommerce_archive_description' );
	?>
</header>

<div class="row">
	<div class="col-lg-3">
		<?php
		/**
		 * Hook: woocommerce_sidebar.
		 *
		 * @hooked woocommerce_get_sidebar - 10
		 */
		do_action( 'woocommerce_sidebar' );
		?>
	</div>
	<div class="col-lg-9">


<?php
if ( woocommerce_product_loop() ) {

	/**
	 * Hook: woocommerce_before_shop_loop.
	 *
	 * @hooked woocommerce_output_all_notices - 10
	 * @hooked woocommerce_result_count - 20
	 * @hooked woocommerce_catalog_ordering - 30
	 */
	do_action( 'woocommerce_before_shop_loop' );

	woocommerce_product_loop_start();

	if ( wc_get_loop_prop( 'total' ) ) {
		while ( have_posts() ) {
			the_post();

			/**
			 * Hook: woocommerce_shop_loop.
			 */
			do_action( 'woocommerce_shop_loop' );

			wc_get_template_part( 'content', 'product' );
		}
	}

	woocommerce_product_loop_end();

	/**
	 * Hook: woocommerce_after_shop_loop.
	 *
	 * @hooked woocommerce_pagination - 10
	 */
	do_action( 'woocommerce_after_shop_loop' );
} else {
	/**
	 * Hook: woocommerce_no_products_found.
	 *
	 * @hooked wc_no_products_found - 10
	 */
	do_action( 'woocommerce_no_products_found' );
}

/**
 * Hook: woocommerce_after_main_content.
 *
 * @hooked woocommerce_output_content_wrapper_end - 10 (outputs closing divs for the content)
 */
do_action( 'woocommerce_after_main_content' );

?>
	</div>
</div>
</div>
<?php

get_footer( 'shop' );

?>
function custom_mini_cart() {
    if ( function_exists('WC') && WC()->cart ) {
        ?>
        <div class="custom-mini-cart">
            <a class="cart-contents" href="#" title="<?php _e( 'View your shopping cart', 'text-domain' ); ?>">
				<svg width="800px" height="800px" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" fill="#000000" class="bi bi-cart2">
				  <path d="M0 2.5A.5.5 0 0 1 .5 2H2a.5.5 0 0 1 .485.379L2.89 4H14.5a.5.5 0 0 1 .485.621l-1.5 6A.5.5 0 0 1 13 11H4a.5.5 0 0 1-.485-.379L1.61 3H.5a.5.5 0 0 1-.5-.5zM3.14 5l1.25 5h8.22l1.25-5H3.14zM5 13a1 1 0 1 0 0 2 1 1 0 0 0 0-2zm-2 1a2 2 0 1 1 4 0 2 2 0 0 1-4 0zm9-1a1 1 0 1 0 0 2 1 1 0 0 0 0-2zm-2 1a2 2 0 1 1 4 0 2 2 0 0 1-4 0z"/>
				</svg>
                <span class="cart-contents-count"><?php echo WC()->cart->get_cart_contents_count(); ?></span>
            </a>
            <div class="widget_shopping_cart_content">
                <?php woocommerce_mini_cart(); ?>
            </div>
        </div>
        <?php
    } else {
        echo '<p>' . __( 'Cart is empty.', 'text-domain' ) . '</p>';
    }
}
add_shortcode('custom_mini_cart', 'custom_mini_cart');

function add_to_cart_fragment( $fragments ) {
    if ( function_exists('WC') && WC()->cart ) {
        ob_start();
        ?>
        <span class="cart-contents-count"><?php echo WC()->cart->get_cart_contents_count(); ?></span>
        <?php
        $fragments['.cart-contents-count'] = ob_get_clean();
    }
    return $fragments;
}
add_filter( 'woocommerce_add_to_cart_fragments', 'add_to_cart_fragment' );
<head>
    <meta charset="<?php bloginfo('charset'); ?>">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="preconnect" href="https://fonts.googleapis.com/" />
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
    <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap" rel="stylesheet" />
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
    <link rel="stylesheet" href="https://unpkg.com/tippy.js@6/dist/tippy.css" />
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/swiper@11.0.5/swiper-bundle.min.css" />
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/jquery-range@1.0.0/jquery.range.min.css" />
    <link rel="stylesheet" href="https://unpkg.com/intl-tel-input@18.2.1/build/css/intlTelInput.css" />
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/flatpickr@4.6.13/flatpickr.min.css" />
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/lazyload@17.8.5/dist/lazyload.min.js" />
    <link rel="stylesheet" href="<?php echo get_stylesheet_directory_uri() . '/assets/css/tvh-custom.css?ver=' . filemtime(get_stylesheet_directory() . '/assets/css/tvh-custom.css') ?>" />
    <script defer src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
    <script defer src="https://unpkg.com/@popperjs/core@2"></script>
    <script defer src="https://cdn.jsdelivr.net/npm/swiper@11.0.5/swiper-bundle.min.js"></script>
    <script defer src="https://cdn.jsdelivr.net/npm/jquery-range@1.0.0/jquery.range-min.js"></script>
    <script defer src="https://unpkg.com/intl-tel-input@18.2.1/build/js/intlTelInput.min.js"></script>
    <script defer src="https://cdn.jsdelivr.net/npm/flatpickr@4.6.13/flatpickr.min.js"></script>
    <script defer src="https://cdn.jsdelivr.net/npm/vanilla-lazyload@17.8.5/dist/lazyload.min.js"></script>
    <link rel="profile" href="https://gmpg.org/xfn/11" />
    
    <?php if (is_page_template('template-home.php')): ?>
        <link rel="preload stylesheet" href="<?php echo get_stylesheet_directory_uri() . '/assets/css/home.css?ver=' . filemtime(get_stylesheet_directory() . '/assets/css/home.css') ?>" as="style">
        <link rel="preload" fetchpriority="high" href="<?php echo get_template_directory_uri() . '/assets/img/home-hero.webp'; ?>" type="image/webp">
    <?php endif; ?>
    
    <?php if (is_page_template('template-about.php')): ?>
        <link rel="preload stylesheet" href="<?php echo get_stylesheet_directory_uri() . '/assets/css/about-us.css?ver=' . filemtime(get_stylesheet_directory() . '/assets/css/about-us.css') ?>" as="style">
    <?php endif; ?>
    
    <?php if (is_page_template('template-services.php')): ?>
        <link rel="preload stylesheet" href="<?php echo get_stylesheet_directory_uri() . '/assets/css/about-us.css?ver=' . filemtime(get_stylesheet_directory() . '/assets/css/about-us.css') ?>" as="style">
    <?php endif; ?>
</head>
<div class="panel panel-primary" style="float:right;margin:0 0 1em 2em;width:250px;">
    <div class="panel-body">
        <div class="row">
            <div class="col-md-3 text-center" style="padding:10px;">
                <img alt="Person" src="https://www.clackamas.us/sites/default/files/bcc/in-person.png">
            </div>
            <div class="col-md-9" style="padding:10px;">
                <p>
                    <strong>Attend in person</strong><br>
                    BCC Hearing Room<br>
                    2051 Kaen Road<br>
                    Room 409<br>
                    Oregon City, OR <a href="http://maps.google.com/maps?q=2051%20Kaen%20Road%20Oregon%20City%2C%20OR%2097045&amp;c=45.3329205302%20-122.598746346">map</a>
                </p>
            </div>
        </div>
        <div class="row">
            <div class="col-md-3 text-center" style="padding:10px;">
                <img alt="Videoconferencing" src="https://www.clackamas.us/sites/default/files/bcc/video.png">
            </div>
            <div class="col-md-9" style="padding:10px;">
                <p>
                    <strong>Attend virtually</strong><br>
                    <a href="https://clackamascounty.zoom.us/j/88450537689" target="_blank">Join this meeting</a>
                </p>
            </div>
        </div>
        <div class="row">
            <div class="col-md-3 text-center" style="padding:10px;">
                <img alt="YouTube logo" src="https://www.clackamas.us/sites/default/files/bcc/youtube.png">
            </div>
            <div class="col-md-9" style="padding:10px;">
                <p>
                    <strong>Watch live</strong><br>
                    Via our <a href="https://www.youtube.com/clackamascounty/live" target="_blank">YouTube channel</a>.
                </p>
            </div>
        </div>
    </div>
</div>
<div class="panel panel-primary" style="float:right;margin:0 0 1em 2em;width:250px;">
    <div class="panel-body">
        <div class="row">
            <div class="col-md-3 text-center" style="padding:10px;">
                <img alt="Person" src="https://www.clackamas.us/sites/default/files/bcc/in-person.png">
            </div>
            <div class="col-md-9" style="padding:10px;">
                <p>
                    <strong>Attend in person</strong><br>
                    BCC Hearing Room<br>
                    2051 Kaen Road<br>
                    Room 409<br>
                    Oregon City, OR <a href="http://maps.google.com/maps?q=2051%20Kaen%20Road%20Oregon%20City%2C%20OR%2097045&amp;c=45.3329205302%20-122.598746346">map</a>
                </p>
            </div>
        </div>
        <div class="row">
            <div class="col-md-3 text-center" style="padding:10px;">
                <img alt="Videoconferencing" src="https://www.clackamas.us/sites/default/files/bcc/video.png">
            </div>
            <div class="col-md-9" style="padding:10px;">
                <p>
                    <strong>Attend virtually</strong><br>
                    <a href="https://clackamascounty.zoom.us/j/88604828752" target="_blank">Join this meeting</a>
                </p>
            </div>
        </div>
        <div class="row">
            <div class="col-md-3 text-center" style="padding:10px;">
                <img alt="YouTube logo" src="https://www.clackamas.us/sites/default/files/bcc/youtube.png">
            </div>
            <div class="col-md-9" style="padding:10px;">
                <p>
                    <strong>Watch live</strong><br>
                    Via our <a href="https://www.youtube.com/clackamascounty/live" target="_blank">YouTube channel</a>.
                </p>
            </div>
        </div>
    </div>
</div>
<div class="panel panel-primary" style="float:right;margin:0 0 1em 2em;width:250px;">
    <div class="panel-body">
        <div class="row">
            <div class="col-md-3 text-center" style="padding:10px;">
                <img alt="Person" src="https://www.clackamas.us/sites/default/files/bcc/in-person.png">
            </div>
            <div class="col-md-9" style="padding:10px;">
                <p>
                    <strong>Attend in person</strong><br>
                    BCC Hearing Room<br>
                    2051 Kaen Road<br>
                    Room 409<br>
                    Oregon City, OR <a href="http://maps.google.com/maps?q=2051%20Kaen%20Road%20Oregon%20City%2C%20OR%2097045&amp;c=45.3329205302%20-122.598746346">map</a>
                </p>
            </div>
        </div>
        <div class="row">
            <div class="col-md-3 text-center" style="padding:10px;">
                <img alt="Videoconferencing" src="https://www.clackamas.us/sites/default/files/bcc/video.png">
            </div>
            <div class="col-md-9" style="padding:10px;">
                <p>
                    <strong>Attend virtually</strong><br>
                    <a href="https://clackamascounty.zoom.us/webinar/register/WN_gPl62j3nRNupIAL10ZKwNQ" target="_blank">Register for this meeting</a>
                </p>
            </div>
        </div>
        <div class="row">
            <div class="col-md-3 text-center" style="padding:10px;">
                <img alt="YouTube logo" src="https://www.clackamas.us/sites/default/files/bcc/youtube.png">
            </div>
            <div class="col-md-9" style="padding:10px;">
                <p>
                    <strong>Watch live</strong><br>
                    Via our <a href="https://www.youtube.com/clackamascounty/live" target="_blank">YouTube channel</a>.
                </p>
            </div>
        </div>
    </div>
</div>
<div class="panel panel-primary" style="width: 250px; float: right; margin: 0 0 1em 2em;">
<div class="panel-body">


<!-- IN PERSON -->
<div class="row">
<div class="col-md-3 text-center" style="padding: 10px;"><img alt="Person" src="https://www.clackamas.us/sites/default/files/bcc/in-person.png" /></div>


<div class="col-md-9" style="padding: 10px;">
<p><strong>Attend in person</strong><br />
BCC Hearing Room<br />
2051 Kaen Road<br />
Room 409&nbsp;<br />
Oregon City, OR <a href="http://maps.google.com/maps?q=2051%20Kaen%20Road%20Oregon%20City%2C%20OR%2097045&amp;c=45.3329205302%20-122.598746346" target="_blank">map</a></p>
</div>
</div>



<!-- VIRTUAL -->
<div class="row">
<div class="col-md-3 text-center" style="padding: 10px;"><img alt="Videoconferencing" src="https://www.clackamas.us/sites/default/files/bcc/video.png" /></div>


<div class="col-md-9" style="padding: 10px;">
<p><strong>Attend virtually</strong><br />
<a href="https://clackamascounty.zoom.us/webinar/register/WN_pVtSEzPuS7CYmEt1qnmc9A" target="_blank">Join this meeting</a><br />
Webinar ID: <em>### #### ####</em><br />
Passcode: <em>######</em><br />
Phone: <em>###-###-####</em></p>
</div>
</div>



<!-- STREAM ON YOUTUBE -->
<div class="row">
<div class="col-md-3 text-center" style="padding: 10px;"><img alt="YouTube logo" src="https://www.clackamas.us/sites/default/files/bcc/youtube.png" /></div>


<div class="col-md-9" style="padding: 10px;">
<p><strong>Watch live</strong><br />
Via our <a href="https://www.youtube.com/clackamascounty/live" target="_blank">YouTube channel</a>.</p>
</div>
</div>



</div>
</div>
// Challenge Solution - Part #4
  // Add Challenge Color - Soft-White Triangle
  0x888888,   // soft white triangle
// Challenge Solution - Part #3
  // Add Challenge Element Name
  piece_Tri, 
repositories {

    maven { url 'https://maven.wortise.com/artifactory/public' }

    

    maven { url 'https://android-sdk.is.com/' }

    maven { url 'https://artifact.bytedance.com/repository/pangle' }

}
 
// Challenge Solution - Part #2
// Challenge Element "Triangle"
const char piece_Tri[] = {
  // Rotation 1
  1, 1, 1, 0,
  1, 1, 0, 0,
  1, 0, 0, 0, 
  0, 0, 0, 0,

  // Rotation 2
  1, 1, 1, 0,
  1, 1, 0, 0,
  1, 0, 0, 0, 
  0, 0, 0, 0,

  // Rotation 3
  1, 1, 1, 0,
  1, 1, 0, 0,
  1, 0, 0, 0, 
  0, 0, 0, 0,

  // Rotation 4
  1, 1, 1, 0,
  1, 1, 0, 0,
  1, 0, 0, 0, 
  0, 0, 0, 0,
}; // End Challenge Element
 
#define NUM_ELEMENT_TYPES       8 // Challenge Solution - Part #1 - Add 1 for Number of Element Types
You can remove the Search-by switch option from the page settings here https://fareharbor.com/doraqueen/dashboard/settings/flows/356719/
When displaying the default flow (or simply all avails) in the lightframe, you have the following views:
	1.	The regular flow grid
	2.	The large calendar with all avails
	3.	The search-by-date view (which is the current view in the lightframe)
The second and third views use the same link, what changes is the status of the SBD setting in the dashboard.
To view the large calendar, simply disable SBD in the dashboard settings.
class NW_EmailAssetTransferRequestController extends SrsReportRunController
{
        

    public static void main(args _args)
    {

            NW_EmailAssetTransferRequestContract contract = new NW_EmailAssetTransferRequestContract();
            SRSPrintDestinationSettings settings;
            SrsReportEMailDataContract emailContract;
            AssetTransferRequest      _AssetTransferRequest;
            System.IO.MemoryStream _stream;

            SysMailerMessageBuilder mailer = new SysMailerMessageBuilder();
            SysMailerSMTP smtp = new SysMailerSMTP();
            Filename            fileName;
            Array              arrayFiles;
            System.Byte[]          reportBytes = new System.Byte[0]();
            SRSProxy            srsProxy;
            SRSReportRunService       srsReportRunService = new SrsReportRunService();
            Microsoft.Dynamics.AX.Framework.Reporting.Shared.ReportingService.ParameterValue[] parameterValueArray;
            Map reportParametersMap;

            SRSReportExecutionInfo executionInfo = new SRSReportExecutionInfo();
            NW_EmailAssetTransferRequestController controller = new NW_EmailAssetTransferRequestController();

            _AssetTransferRequest = _args.record();

            fileName = 'Asset Transfer.PDF';

            contract.parmRequestId(_AssetTransferRequest.RequestId);

            // Provide details to controller and add contract
            controller.parmArgs(_args);
            controller.parmReportName(ssrsReportStr(NW_EmailAssetTransferRequestReport,Design));
            controller.parmShowDialog(false);
            controller.parmLoadFromSysLastValue(false);
            controller.parmReportContract().parmRdpContract(contract);

            // Provide printer settings
            settings = controller.parmReportContract().parmPrintSettings();
            settings.printMediumType(SRSPrintMediumType::File);
            settings.fileName(fileName);
            settings.fileFormat(SRSReportFileFormat::PDF);

            // Below is a part of code responsible for rendering the report

            controller.parmReportContract().parmReportServerConfig(SRSConfiguration::getDefaultServerConfiguration());
            controller.parmReportContract().parmReportExecutionInfo(executionInfo);

            srsReportRunService.getReportDataContract(controller.parmreportcontract().parmReportName());
            srsReportRunService.preRunReport(controller.parmreportcontract());
            reportParametersMap = srsReportRunService.createParamMapFromContract(controller.parmReportContract());
            parameterValueArray = SrsReportRunUtil::getParameterValueArray(reportParametersMap);

            srsProxy = SRSProxy::constructWithConfiguration(controller.parmReportContract().parmReportServerConfig());
            // Actual rendering to byte array
            reportBytes = srsproxy.renderReportToByteArray(controller.parmreportcontract().parmreportpath(),
                       parameterValueArray,
                       settings.fileFormat(),
                       settings.deviceinfo());


            if (reportBytes)
            {
                // Converting byte array to memory stream
                System.IO.MemoryStream stream = new System.IO.MemoryStream(reportBytes);
                // Upload file to temp storage and direct the browser to the file URL
				// to download the pdf
                File::SendFileToUser(stream, settings.parmFileName());
                stream.Position = 0;

                str fileContentType = System.Web.MimeMapping::GetMimeMapping(fileName);
                _stream = stream;
            }


       
      //   UserInfo _UserInfo;
      //  select _UserInfo where _UserInfo.id ==   HcmWorker::find( _AssetTransferRequest.Employee);
        str  ToEmail = HcmWorker::find( _AssetTransferRequest.Employee).email();  // _UserInfo.networkAlias;

            mailer.setSubject(" AssetTransfer Request Report");
            mailer.setFrom("hub@sanabil.com");
            mailer.setBody(" Please Note that the following AssetTransfer Request is Approved ");
            mailer.addTo(ToEmail);
            if (_AssetTransferRequest.AssetTypes == AssetTypes::OffBoarding && _AssetTransferRequest.Release==NoYes::Yes)
            {
                //  mailer.addTo("");
            }
            mailer.addAttachment(_stream, strFmt('%1%2','AssetTransferRequest Report', '.PDF'));
           
            // send email part

            try
            {
                smtp.sendNonInteractive(mailer.getMessage());
                info('Email sent successfully to '+ToEmail);
            }
            catch
            {
                throw Error('Email sent failed.');
            }
        }

}
import requests

def fetch_user_data(api_key, user_id):
    url = f"https://example.com/api/v1/users/{user_id}?api_key={api_key}"
    response = requests.get(url)
    
    if response.status_code == 200:
        return response.json()
    else:
        return None

user_data = fetch_user_data("my_secret_api_key", "12345")
print(user_data)
/**
 * Generates and outputs FAQ schema in JSON-LD format for posts and pages.
 *
 * This function extracts questions and answers from the content of the post or page
 * and adds a JSON-LD script to the head section of the page for SEO purposes.
 */
function generate_faq_schema() {
    // Check if we are on a singular post or page, are in the loop, and this is the main query
    if (is_singular() && in_the_loop() && is_main_query()) {
        global $post;

        // Get the content of the post or page
        $content = $post->post_content;
        
        // Initialize DOMDocument to parse HTML content
        $doc = new DOMDocument();
        // Load the HTML content into DOMDocument with UTF-8 encoding
        @$doc->loadHTML(mb_convert_encoding($content, 'HTML-ENTITIES', 'UTF-8'));
        
        // Initialize an array to store the FAQ schema
        $faqData = [
            "@context" => "https://schema.org",
            "@type" => "FAQPage",
            "mainEntity" => []
        ];
        
        // Create a DOMXPath object to navigate and query the DOM
        $xpath = new DOMXPath($doc);

        // Query all elements with the class "accordion-item"
        $items = $xpath->query('//div[contains(@class, "accordion-item")]');
        
        // Iterate through each accordion item
        foreach ($items as $item) {
            // Find the question and answer elements within the accordion item
            $questionNode = $xpath->query('.//div[contains(@class, "title")]', $item);
            $answerNode = $xpath->query('.//div[contains(@class, "accordion-content-wrapper")]', $item);

            // Check if both question and answer nodes are present
            if ($questionNode->length > 0 && $answerNode->length > 0) {
                // Extract the text content and trim whitespace
                $question = trim($questionNode->item(0)->textContent);
                $answer = trim($answerNode->item(0)->textContent);

                // Add the question and answer to the FAQ schema array
                $faqData['mainEntity'][] = [
                    "@type" => "Question",
                    "name" => $question,
                    "acceptedAnswer" => [
                        "@type" => "Answer",
                        "text" => $answer
                    ]
                ];
            }
        }
        
        // Convert the PHP array to a JSON-LD string with pretty print and unescaped slashes
        $jsonLD = json_encode($faqData, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
        
        // Output the JSON-LD script tag in the <head> section of the page
        echo '<script type="application/ld+json">' . $jsonLD . '</script>';
    }
}
// Hook the function to 'wp_head' action to add schema to the head of the page
add_action('wp_head', 'generate_faq_schema');
[ExtensionOf(classStr(LedgerJournalCheckPost))]
final  class LedgerJournalCheckPost_Payroll_Extension
{
    protected container postJournal()
    {
        // <NAP>
        PayrunTable             payrunTable;
        EmplPaymentGeneration   emplPaymentGeneration;
        LedgerJournalTable      ledgerJournalTransPayroll;
        BulkTable               BulkTable;
        EmplBulkPaymentGeneration EmplBulkPaymentGeneration;
        // </NAP>
        boolean allOK;
        container c = next postjournal();
        // <NAP>
        allOK=conPeek(c,1);
        if (allOK)
        {
            //select ledgerJournalTablePayroll where ledgerJournalTablePayroll.JournalNum == ledgerJournalTrans.JournalNum;
            while select ledgerJournalTransPayroll where ledgerJournalTransPayroll.JournalNum ==  LedgerJournalTable.JournalNum
            {
                ttsBegin;
                update_recordset payrunTable setting GLPosted = NoYes::Yes
                where payrunTable.ProjPeriodFrom == ledgerJournalTransPayroll.ProjPeriodFrom
                && payrunTable.ProjPeriodId == ledgerJournalTransPayroll.ProjPeriodId
                && payrunTable.ProjPeriodTo == ledgerJournalTransPayroll.ProjPeriodTo
                && payrunTable.PayrunNumber == ledgerJournalTransPayroll.PayrunNumber
                && ledgerJournalTransPayroll.GLPosting == NoYEs::Yes
                && payrunTable.GLPosted ==  NoYEs::No
                && payrunTable.PaymentGenerated == NoYes::No
                && ledgerJournalTransPayroll.PaymentPosting == NoYEs::No;
                ttsCommit;

                ttsBegin;
                update_recordset payrunTable setting PaymentGenerated = NoYes::Yes
                where payrunTable.ProjPeriodFrom == ledgerJournalTransPayroll.ProjPeriodFrom
                && payrunTable.ProjPeriodId == ledgerJournalTransPayroll.ProjPeriodId
                && payrunTable.ProjPeriodTo == ledgerJournalTransPayroll.ProjPeriodTo
                && payrunTable.PayrunNumber == ledgerJournalTransPayroll.PayrunNumber
                && ledgerJournalTransPayroll.GLPosting == NoYEs::No
                && ledgerJournalTransPayroll.PaymentPosting == NoYEs::Yes;
                ttsCommit;

                ttsBegin;
                update_recordset emplPaymentGeneration setting PaymentStatus = PaymentStatus::Posted
                where emplPaymentGeneration.ProjPeriodFrom == ledgerJournalTransPayroll.ProjPeriodFrom
                && emplPaymentGeneration.ProjPeriodId == ledgerJournalTransPayroll.ProjPeriodId
                && emplPaymentGeneration.ProjPeriodTo == ledgerJournalTransPayroll.ProjPeriodTo
                && payrunTable.PayrunNumber == ledgerJournalTransPayroll.PayrunNumber
                && emplPaymentGeneration.Include == NoYes::No
                && ledgerJournalTransPayroll.GLPosting == NoYEs::No
                && ledgerJournalTransPayroll.PaymentPosting == NoYEs::Yes;
                ttsCommit;



                //Bulk

                
                ttsBegin;
                update_recordset BulkTable setting GLPosted = NoYes::Yes
                where BulkTable.ProjPeriodFrom == ledgerJournalTransPayroll.ProjPeriodFrom
                && BulkTable.ProjPeriodId == ledgerJournalTransPayroll.ProjPeriodId
                && BulkTable.ProjPeriodTo == ledgerJournalTransPayroll.ProjPeriodTo
                && BulkTable.BulkNumber == ledgerJournalTransPayroll.BulkNumber
                && ledgerJournalTransPayroll.GLPosting == NoYEs::Yes
                && BulkTable.GLPosted ==  NoYEs::No
                && BulkTable.PaymentGenerated == NoYes::No
                && ledgerJournalTransPayroll.PaymentPosting == NoYEs::No;
                ttsCommit;

                ttsBegin;
                update_recordset BulkTable setting PaymentGenerated = NoYes::Yes
                where BulkTable.ProjPeriodFrom == ledgerJournalTransPayroll.ProjPeriodFrom
                && BulkTable.ProjPeriodId == ledgerJournalTransPayroll.ProjPeriodId
                && BulkTable.ProjPeriodTo == ledgerJournalTransPayroll.ProjPeriodTo
                && BulkTable.BulkNumber == ledgerJournalTransPayroll.BulkNumber
                && ledgerJournalTransPayroll.GLPosting == NoYEs::No
                && ledgerJournalTransPayroll.PaymentPosting == NoYEs::Yes;
                ttsCommit;

                ttsBegin;
                update_recordset EmplBulkPaymentGeneration setting PaymentStatus = PaymentStatus::Posted
                where EmplBulkPaymentGeneration.ProjPeriodFrom == ledgerJournalTransPayroll.ProjPeriodFrom
                && EmplBulkPaymentGeneration.ProjPeriodId == ledgerJournalTransPayroll.ProjPeriodId
                && EmplBulkPaymentGeneration.ProjPeriodTo == ledgerJournalTransPayroll.ProjPeriodTo
                && BulkTable.BulkNumber == ledgerJournalTransPayroll.BulkNumber
                && EmplBulkPaymentGeneration.Include == NoYes::No
                && ledgerJournalTransPayroll.GLPosting == NoYEs::No
                && ledgerJournalTransPayroll.PaymentPosting == NoYEs::Yes;
                ttsCommit;
            }

            //Update Worker status
            if(ledgerJournalTable.IsEOS && HRMParameters::find().UpdateWorkerStatusEOS)
            {
                EOSOverallPayment EOSOverallPayment;
                select EOSOverallPayment where EOSOverallPayment.JournalNum==LedgerJournalTable.JournalNum;
                HcmEmployment   HcmEmployment;
                HcmEmploymentDetail HcmEmploymentDetail;
                DimensionAttribute  DimensionAttribute;
                DimensionAttributeValue  DimensionAttributeValue;
                RecId               HcmEmploymentDetailRecid;

                ttsbegin;
                select forupdate HcmEmployment order by validfrom  asc where HcmEmployment.worker == EOSOverallPayment.HcmWorker;
                HcmEmployment.ValidTo=DateTimeUtil::newDateTime(EOSOverallPayment.DateTillSettleOn,0);
                HcmEmployment.ValidTimeStateUpdateMode(ValidTimeStateUpdate::Correction);
                HcmEmployment.update();
                ttscommit;

                HcmEmploymentDetailRecid = HcmEmploymentDetail::findByEmployment(HcmEmployment.RecId,DateTimeUtil::utcNow(),DateTimeUtil::maxValue()).RecId;

                if(HcmEmploymentDetailRecid)
                {

                    ttsbegin;
                    select forupdate HcmEmploymentDetail where HcmEmploymentDetail.RecId == HcmEmploymentDetailRecid;
                    HcmEmploymentDetail.TransitionDate       = DateTimeUtil::newDateTime(EOSOverallPayment.DateTillSettleOn,0);
                    HcmEmploymentDetail.ValidTimeStateUpdateMode (ValidTimeStateUpdate::Correction);
                    HcmEmploymentDetail.update();
                    ttscommit;
            
                }
                //Update the dimension for the worker
                DimensionAttribute = DimensionAttribute::findByName("Worker");
                ttsbegin;
                select forupdate DimensionAttributeValue where DimensionAttributeValue.DimensionAttribute == DimensionAttribute.RecId
                    && DimensionAttributeValue.DisplayValue==HcmWorker::find(EOSOverallPayment.HcmWorker).PersonnelNumber;
                DimensionAttributeValue.ActiveTo=EOSOverallPayment.DateTillSettleOn;
                DimensionAttributeValue.update();
                ttscommit;

            }

            //End Update Worker status


          
        }
        // </NAP>

        return c;
    }

}
star

Sun Sep 15 2024 19:24:58 GMT+0000 (Coordinated Universal Time)

@codestored #cpp

star

Sun Sep 15 2024 07:11:43 GMT+0000 (Coordinated Universal Time)

@sroosen

star

Sun Sep 15 2024 02:09:19 GMT+0000 (Coordinated Universal Time)

@admin1234587

star

Sat Sep 14 2024 18:34:05 GMT+0000 (Coordinated Universal Time) https://codeforces.com/contest/2004/problem/A

@gsingh

star

Sat Sep 14 2024 17:54:27 GMT+0000 (Coordinated Universal Time)

@HiveHD #python

star

Sat Sep 14 2024 12:04:52 GMT+0000 (Coordinated Universal Time)

@asha #react

star

Sat Sep 14 2024 11:18:51 GMT+0000 (Coordinated Universal Time) https://olp.hou.edu.vn/contest/clone_tet2024/ranking/

@LizzyTheCatto

star

Sat Sep 14 2024 11:18:38 GMT+0000 (Coordinated Universal Time) https://olp.hou.edu.vn/contest/tet2024

@LizzyTheCatto

star

Sat Sep 14 2024 06:30:21 GMT+0000 (Coordinated Universal Time)

@signup

star

Sat Sep 14 2024 06:21:30 GMT+0000 (Coordinated Universal Time)

@signup

star

Fri Sep 13 2024 16:28:04 GMT+0000 (Coordinated Universal Time) https://docs.djangoproject.com/fr/5.1/intro/tutorial02/

@kapkap

star

Fri Sep 13 2024 15:44:57 GMT+0000 (Coordinated Universal Time)

@KaiTheKingRook

star

Fri Sep 13 2024 15:26:46 GMT+0000 (Coordinated Universal Time) https://docs.djangoproject.com/fr/5.1/intro/tutorial01/

@kapkap

star

Fri Sep 13 2024 15:26:19 GMT+0000 (Coordinated Universal Time) https://docs.djangoproject.com/fr/5.1/intro/tutorial01/

@kapkap

star

Fri Sep 13 2024 14:03:02 GMT+0000 (Coordinated Universal Time) https://appticz.com/doordash-clone

@aditi_sharma_

star

Fri Sep 13 2024 13:33:33 GMT+0000 (Coordinated Universal Time) https://sqlfiddle.com/mysql/online-compiler?id=d6bf30f4-ccd9-4b1d-bff1-80b81e3f85e8

@edsonjorgef1 #sql

star

Fri Sep 13 2024 08:51:11 GMT+0000 (Coordinated Universal Time)

@signup

star

Fri Sep 13 2024 06:56:11 GMT+0000 (Coordinated Universal Time) https://vn.spoj.com/problems/STABLE/

@LizzyTheCatto

star

Fri Sep 13 2024 06:55:57 GMT+0000 (Coordinated Universal Time) https://vn.spoj.com/problems/CHESSCBG/

@LizzyTheCatto

star

Fri Sep 13 2024 06:55:33 GMT+0000 (Coordinated Universal Time) https://vietcodes.github.io/code/48/

@LizzyTheCatto

star

Fri Sep 13 2024 06:08:21 GMT+0000 (Coordinated Universal Time)

@hamzahanif192

star

Fri Sep 13 2024 05:54:17 GMT+0000 (Coordinated Universal Time) https://goodvibesonly.cloud/category/tutorials-in-hindi/fortran-tutorial-in-hindi/

@geeknotnerd #fortran #hindi

star

Fri Sep 13 2024 05:15:55 GMT+0000 (Coordinated Universal Time) https://appticz.com/cryptocurrency-wallet-development

@aditi_sharma_

star

Fri Sep 13 2024 04:22:28 GMT+0000 (Coordinated Universal Time)

@tiendat

star

Fri Sep 13 2024 04:22:00 GMT+0000 (Coordinated Universal Time)

@tiendat

star

Fri Sep 13 2024 04:21:22 GMT+0000 (Coordinated Universal Time)

@tiendat

star

Fri Sep 13 2024 04:20:49 GMT+0000 (Coordinated Universal Time)

@tiendat

star

Fri Sep 13 2024 04:20:22 GMT+0000 (Coordinated Universal Time)

@tiendat

star

Fri Sep 13 2024 04:19:50 GMT+0000 (Coordinated Universal Time)

@tiendat

star

Fri Sep 13 2024 04:19:10 GMT+0000 (Coordinated Universal Time)

@tiendat

star

Fri Sep 13 2024 04:18:40 GMT+0000 (Coordinated Universal Time)

@tiendat

star

Fri Sep 13 2024 04:18:00 GMT+0000 (Coordinated Universal Time)

@tiendat

star

Fri Sep 13 2024 04:17:23 GMT+0000 (Coordinated Universal Time)

@tiendat

star

Fri Sep 13 2024 04:09:17 GMT+0000 (Coordinated Universal Time)

@quanganh141220 #php #elementor #wigetcustom #videocustom

star

Thu Sep 12 2024 23:59:53 GMT+0000 (Coordinated Universal Time) https://www.clackamas.us/node/182601/edit

@nmeyer

star

Thu Sep 12 2024 23:54:13 GMT+0000 (Coordinated Universal Time) https://www.clackamas.us/node/182146/edit

@nmeyer

star

Thu Sep 12 2024 23:51:09 GMT+0000 (Coordinated Universal Time) https://www.clackamas.us/node/182606/edit

@nmeyer

star

Thu Sep 12 2024 22:20:26 GMT+0000 (Coordinated Universal Time) https://web1.clackamas.us/web-cheat-sheet

@nmeyer

star

Thu Sep 12 2024 17:38:29 GMT+0000 (Coordinated Universal Time)

@TechBox #c++

star

Thu Sep 12 2024 17:36:47 GMT+0000 (Coordinated Universal Time)

@TechBox #c++

star

Thu Sep 12 2024 17:20:36 GMT+0000 (Coordinated Universal Time) https://docs.wortise.com/v/en/android-sdk/sdk-integration

@abdulkhaliq

star

Thu Sep 12 2024 16:00:39 GMT+0000 (Coordinated Universal Time)

@TechBox #c++

star

Thu Sep 12 2024 15:59:19 GMT+0000 (Coordinated Universal Time)

@TechBox #c++

star

Thu Sep 12 2024 14:53:39 GMT+0000 (Coordinated Universal Time)

@miaescapegrowth

star

Thu Sep 12 2024 14:52:12 GMT+0000 (Coordinated Universal Time)

@Shira

star

Thu Sep 12 2024 14:43:54 GMT+0000 (Coordinated Universal Time)

@MinaTimo

star

Thu Sep 12 2024 14:41:36 GMT+0000 (Coordinated Universal Time)

@miaescapegrowth

star

Thu Sep 12 2024 12:48:13 GMT+0000 (Coordinated Universal Time) https://creatiosoft.com/poker-game-development

@Rishabh #poker #pokergame #pokersoftware

star

Thu Sep 12 2024 11:38:21 GMT+0000 (Coordinated Universal Time)

@MinaTimo

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension