Snippets Collections
npm install xlsx file-saver
npm install ts-md5 --save
npm install xlsx-style
npm install xlsx file-saver
npm install ts-md5 --save
IFS(
[_THISROW] = MAXROW("Expenses", "_ROWNUMBER", [_THISROW].[Title] = [Title]),True
)
import { HttpClient } from '@angular/common/http';
import { ChangeDetectorRef, Component, OnInit } from '@angular/core';
import { FormBuilder } from '@angular/forms';
import { Router } from '@angular/router';
import { Md5 } from 'ts-md5';
import { environment } from '../../environments/environment';
import { OrderService } from '../Services/order.service';
import { MatSnackBar } from '@angular/material/snack-bar';
import { UserService } from '../Services/userprofile.service';
import { CartItemViewModel, OrderViewModel } from '../shared/order';
import { PaymentViewModel } from '../shared/payment';
import { PaymentService } from '../Services/payment.service';
import { Subscription } from 'rxjs';

declare global {
  interface Window {
    payfast_do_onsite_payment: (param1: any, callback: any) => any;
  }
}

  @Component({
    selector: 'app-payfast',
    standalone: true,
    imports: [],
    templateUrl: './payfast.component.html',
    styleUrl: './payfast.component.css'
  })
  export class PayfastComponent implements OnInit {
    memberId!: number;
    finalAmount: number = 0;
    private finalAmountSubscription!: Subscription;

    constructor(private router : Router, private orderService : OrderService, private paymentService : PaymentService , private userService: UserService, private formBuilder: FormBuilder, private snackBar: MatSnackBar, private cdr: ChangeDetectorRef) {
      
    }

    ngOnInit(): void {
      this.fetchMemberId();
      this.finalAmountSubscription = this.paymentService.getFinalAmount().subscribe(amount => {
        this.finalAmount = amount;
        console.log("Retrieved final amount from subscription:", this.finalAmount); // Debugging line
        this.cdr.detectChanges(); // Force change detection
      });
    }

    ngOnDestroy(): void {
      if (this.finalAmountSubscription) {
        this.finalAmountSubscription.unsubscribe();
      }
    }

    getSignature(data : Map<string, string>) : string {
      let tmp = new URLSearchParams();
      data.forEach((v, k)=> {
        tmp.append(k, v)
      });
      let queryString = tmp.toString();
      let sig = Md5.hashStr(queryString);
      return sig;
    }

    async doOnSitePayment() {
      await this.fetchMemberId();

      let onSiteUserData = new Map<string, string>();
      onSiteUserData.set("merchant_id", "10033427")
      onSiteUserData.set("merchant_key", "mu83ipbgas9p7")

      onSiteUserData.set('return_url', window.location.origin + '/payment-success')
      onSiteUserData.set('cancel_url', window.location.origin + '/payment-cancel')

      // Gather required user data from orderService or other sources
      const userData = this.orderService.getUserData();
      onSiteUserData.set("email_address", userData.email);
      
      // Set amount and item_name
      onSiteUserData.set('amount', this.finalAmount.toFixed(2)); // Use the final amount from shared service
      onSiteUserData.set('item_name', 'Cart Purchase');

      // Optional passphrase for added security
      onSiteUserData.set('passphrase', 'HelloWorldHello'); // Use if you have a passphrase

      let signature = this.getSignature(onSiteUserData);
      onSiteUserData.set('signature', signature);

      let formData = new FormData();
      onSiteUserData.forEach((val, key) => {
        formData.append(key, val);
      });

      fetch(environment.payfastOnsiteEndpoint, {
        method: 'POST',
        body: formData,
        redirect: 'follow'
      })
      .then(response => response.json())
      .then(respJson => {
          let uuid = respJson['uuid'];
          window.payfast_do_onsite_payment({ 'uuid': uuid }, (res: any) => {
            if (res == true) {
              this.createOrder().then((orderResponse) => {
                this.createPayment(orderResponse);
                this.snackBar.open('Payment Successful', 'Close', { duration: 5000 });
              });         
            } else {
              this.snackBar.open('Payment Failed', 'Close', { duration: 5000 });              
            }
          });
        })
        .catch(error => {
          console.error('Error processing payment:', error);
          this.router.navigate(['/cancel']);
        });
      }

      //order
      private fetchMemberId() {
        const user = localStorage.getItem('User');
        if (user) {
          const userData = JSON.parse(user);
          this.memberId = userData.userId;
      
          // Optional: Fetch and validate member details if needed
          this.userService.getMemberByUserId(this.memberId).subscribe({
            next: (member) => {
              if (member && member.member_ID) {
                this.memberId = member.member_ID;
                console.log('Member ID:', this.memberId); // Check if this logs the correct ID
              } else {
                console.error('Member ID is undefined in the response');
                this.snackBar.open('Failed to retrieve member information', 'Close', { duration: 5000 });
              }
            },
            error: (error) => {
              console.error('Error fetching member:', error);
              this.snackBar.open('Failed to retrieve member information', 'Close', { duration: 5000 });
            }
          });
        } else {
          this.snackBar.open('User not logged in', 'Close', { duration: 5000 });
          this.router.navigate(['/login']);
        }
      }

      private createOrder(): Promise<OrderViewModel> {
        return new Promise((resolve, reject) => {
          if (this.memberId === undefined) {
            this.snackBar.open('Member ID is not available', 'Close', { duration: 5000 });
            reject('Member ID is not available');
          } else {
            this.orderService.getCartItems().subscribe({
              next: (cartItems) => {
                const order = this.prepareOrderDetails(cartItems);
                this.orderService.createOrder(order).subscribe({
                  next: (orderResponse) => {
                    this.snackBar.open('Order Created Successfully', 'Close', { duration: 5000 });
                    resolve(orderResponse);
                  },
                  error: (error) => {
                    console.error('Error creating order:', error);
                    this.snackBar.open('Failed to create order', 'Close', { duration: 5000 });
                    reject(error);
                  }
                });
              },
              error: (error) => {
                console.error('Error fetching cart items:', error);
                this.snackBar.open('Failed to fetch cart items', 'Close', { duration: 5000 });
                reject(error);
              }
            });
          }
        });
      }
      
    private prepareOrderDetails(cartItems: CartItemViewModel[]): OrderViewModel {
      const order: OrderViewModel = {
        order_ID: 0, // ID will be generated by backend
        member_ID: this.memberId,
        order_Date: new Date().toISOString(),
        total_Price: this.finalAmount, // Use the final amount from shared service
        order_Status_ID: 1, // Ready for Collection
        isCollected: false,
        orderLines: cartItems.map(item => ({
          order_Line_ID: 0, // ID will be generated by backend
          product_ID: item.product_ID,
          product_Name: item.product_Name,
          quantity: item.quantity,
          unit_Price: item.unit_Price
        }))
      };
    
      console.log('Prepared order details:', order);
      return order;
    }

    private createPayment(order: OrderViewModel) {
      const paymentData: PaymentViewModel = {
        payment_ID: 0,
        amount: order.total_Price, // Ensure this reflects VAT and discounts
        payment_Date: new Date().toISOString(),
        order_ID: order.order_ID,
        payment_Type_ID: 1 // Default to 1
      };

      this.paymentService.createPayment(paymentData).subscribe({
        next: (response) => {
          console.log('Payment record created successfully:', response);
          this.router.navigate(['/orders']);
        },
        error: (error) => {
          console.error('Error creating payment record:', error);
        }
      });
    }  
  }
vector<int> parent;
vector<int> rank;

int find (int x) {
    if (x == parent[x]) 
        return x;

    return parent[x] = find(parent[x]);
}

void Union (int x, int y) {
    int x_parent = find(x);
    int y_parent = find(y);

    if (x_parent == y_parent) 
        return;

    if(rank[x_parent] > rank[y_parent]) {
        parent[y_parent] = x_parent;
    } else if(rank[x_parent] < rank[y_parent]) {
        parent[x_parent] = y_parent;
    } else {
        parent[x_parent] = y_parent;
        rank[y_parent]++;
    }
}
INDEX(
  UNIQUE(Database[Name]),
  MOD([_ROWNUMBER] - 1, COUNT(UNIQUE(Database[Name]))) + 1
)
Understanding of meme coin development
In the world of digital money, meme coins stand out because they mix humor, strong community support, and the chance to make risky investments that could pay off big. These coins start from online trends and jokes, catching the interest of both seasoned investors and newbies. While they can be unpredictable and risky, seeing how holding meme coins can benefit users means looking closely at how they work.
Possibilities for Massive Profits:

Meme coins' main attraction is the possibility of large investment returns. Unlike traditional investments, which might take years to gain value, meme coins can see sudden price increases driven by social media enthusiasm, celebrity endorsements, or coordinated community projects. Early adopters of meme coins—like Dogecoin and Shiba Inu, for instance—have profited financially from periods of increased public interest and swings in markets.

Participation and Importance of the Community
Meme currencies become successful when their communities are strong. Having a meme currency usually means joining a passionate and active group that comes together around shared values and interests. Through conversation, memes, and social media campaigns, this engagement may result in more awareness, wider acceptance, and even control over the coin's fate. Within meme currency circles, community-led projects like fundraisers, charitable campaigns, and artistic collaborations are typical, fostering a sense of community and shared ambition among holders.

Accessibility and Small Entry Barriers
Meme coins also have the benefit of being easily accessible. In contrast to conventional financial markets, which could have high entrance hurdles like minimal investment amounts or complex registration procedures, meme coins are frequently easily available on a variety of cryptocurrency exchanges and platforms. Because of its accessibility, investing opportunities become more accessible to a wider range of users, who may participate in the market and maybe profit from early adoption or market speculation.

Specialization of Portfolios
Memes might provide investors looking for alternatives to their holdings an unusual but possibly profitable addition. Although many investing plans are based on traditional assets like bonds and stocks, a portion of funds may be allocated to meme coins to gain exposure to the rapidly growing cryptocurrency market. By distributing risk over several asset classes, diversification helps to possibly reduce losses resulting from downturns in other industries.

Cultural and Trend Awareness
Investing in meme coins can also furnish insights into burgeoning cultural trends and digital conduct. As digital natives and internet culture aficionados gravitate toward meme coins, monitoring their ascent and descent can impart valuable lessons in comprehending online communities, consumer behavior, and the convergence of humor and finance in the digital epoch. This cultural acumen can be particularly beneficial for marketers, content creators, and enterprises striving to resonate with younger cohorts and digital natives.

Conclusion
Block Sentinels' service of developing meme coin development company represents a promising step toward engaging a broader audience and pushing the boundaries of blockchain innovation. By leveraging the entertaining and accessible nature of meme coins, the company has the potential to simplify entry into cryptocurrency for new users and stimulate fresh technological advancements. This approach not only fosters a sense of community and belonging but also contributes positively to the growth and evolution of the cryptocurrency ecosystem.

Visit — https://beleaftechnologies.com/meme-coin-development-company
Contact details:
Phone +91 8148147362
Email:  business@beleaftechnologies.com
and(
    if(isnotblank(any(Filters[JetSkis])), [Boat Name] = any(Filters[JetSkis]), true),
    if(isnotblank(any(Filters[Date from])), [Date] >= any(Filters[Date from]), true),
    if(isnotblank(any(Filters[Date to])), [Date] <= any(Filters[Date to]), true)
)
app.get(%27/ab?cd%27, (req, res) => {
  res.send(%27ab?cd%27)
})
app.get(%27/random.text%27, (req, res) => {
  res.send(%27random.text%27)
})
app.get(%27/about%27, (req, res) => {
  res.send(%27about%27)
})
app.get(%27/%27, (req, res) => {
  res.send(%27root%27)
})
app.all(%27/secret%27, (req, res, next) => {
  console.log(%27Accessing the secret section ...%27)
  next() // pass control to the next handler
})
// GET method route
app.get('/', (req, res) => {
  res.send('GET request to the homepage')
})

// POST method route
app.post('/', (req, res) => {
  res.send('POST request to the homepage')
})
linktoview("Data")&"&at="&encodeurl(now() + 1)
SWITCH(LOOKUP(USEREMAIL(), "Accounts", "Email", "Position"), 
  "dev", "ALL_CHANGES", 
  "accountant", "ALL_CHANGES", 
  "READ_ONLY")
const BasicComponent = () => {
  return (
    <div>
      <h1>This is basic component!</h1>
    </div>
  );
};

export default BasicComponent;
//controller
using av_motion_api.Data;
using av_motion_api.Models;
using av_motion_api.ViewModels;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using System.Security.Claims;

// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860

namespace av_motion_api.Controllers
{
    [Route("api/supplier/[controller]")]
    [ApiController]
    public class SupplierController : ControllerBase
    {
        private readonly AppDbContext _appContext;
        private readonly ILogger<SupplierController> _logger;

        public SupplierController(AppDbContext context, ILogger<SupplierController> logger)
        {
            _appContext = context;
            _logger = logger;
        }

        // GET: api/supplier/GetSuppliers
        [HttpGet]
        [Route("GetSuppliers")]
        //[Authorize(Roles = "Administrator")]
        public async Task<ActionResult<IEnumerable<Supplier>>> GetSuppliers()
        {
            var suppliers = await _appContext.Suppliers.ToListAsync();
            return suppliers;
        }

        // GET: api/supplier/GetSupplier/{id}
        [HttpGet]
        [Route("GetSupplier/{id}")]
        //[Authorize(Roles = "Administrator")]
        public async Task<ActionResult<Supplier>> GetSupplier(int id)
        {
            if (_appContext.Suppliers == null)
            {
                return NotFound();
            }
            var supplier = await _appContext.Suppliers.FindAsync(id);
            if (supplier == null)
            {
                return NotFound();
            }
            return supplier;
        }

        // POST: api/supplier/PostSupplier
        [HttpPost]
        [Route("PostSupplier")]
        //[Authorize(Roles = "Administrator")]
        public async Task<ActionResult<Supplier>> PostSupplier([FromBody] Supplier supplier)
        {
            if (_appContext.Suppliers == null)
            {
                return Problem("Entity set 'AppDbContext.Suppliers' is null.");
            }

            var supplierEntity = new Supplier
            {
                Name = supplier.Name,
                Contact_Number = supplier.Contact_Number,
                Email_Address = supplier.Email_Address,
                Physical_Address = supplier.Physical_Address,
            };

            _appContext.Suppliers.Add(supplierEntity);
            await _appContext.SaveChangesAsync();
            return Ok(supplier);
        }

        // PUT: api/supplier/PutSupplier/{id}
        [HttpPut]
        [Route("PutSupplier/{id}")]
        //[Authorize(Roles = "Administrator")]
        public async Task<IActionResult> PutSupplier(int id, [FromBody] SupplierViewModel supplier)
        {
            var supplierEntity = await _appContext.Suppliers.FindAsync(id);

            if (supplierEntity == null)
            {
                return NotFound();
            }

            supplierEntity.Name = supplier.Name;
            supplierEntity.Contact_Number = supplier.Contact_Number;
            supplierEntity.Email_Address = supplier.Email_Address;
            supplierEntity.Physical_Address = supplier.Physical_Address;

            try
            {
                _appContext.Suppliers.Update(supplierEntity);
                await _appContext.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!SupplierExists(id))
                {
                    return NotFound();
                }
                else
                {
                    throw;
                }
            }

            return NoContent();
        }

        // DELETE: api/supplier/DeleteSupplier/{id}
        [HttpDelete]
        [Route("DeleteSupplier/{id}")]
        //[Authorize(Roles = "Administrator")]
        public async Task<IActionResult> DeleteSupplier(int id)
        {
            if (_appContext.Suppliers == null)
            {
                return NotFound();
            }
            var supplier = await _appContext.Suppliers.FindAsync(id);
            if (supplier == null)
            {
                return NotFound();
            }

            _appContext.Suppliers.Remove(supplier);
            await _appContext.SaveChangesAsync();
            return NoContent();
        }

        private bool SupplierExists(int id)
        {
            return (_appContext.Suppliers?.Any(e => e.Supplier_ID == id)).GetValueOrDefault();
        }

        // GET: api/supplier/GetAllSupplierOrders
        [HttpGet]
        [Route("GetAllSupplierOrders")]
        //[Authorize(Roles = "Administrator")]
        public async Task<IActionResult> GetAllSupplierOrders()
        {
            var orders = await _appContext.Supplier_Orders
                    .Include(o => o.Supplier)
                    .Include(o => o.Owner)
                    .Include(o => o.Supplier_Order_Lines)
                    .ThenInclude(sol => sol.Product)
                    .ToListAsync();

            var supplierOrderViewModels = orders.Select(order => new SupplierOrderViewModel
            {
                Supplier_Order_ID = order.Supplier_Order_ID,
                Date = order.Date,
                Supplier_ID = order.Supplier_ID,
                Supplier_Name = order.Supplier.Name,
                Owner_ID = order.Owner_ID,
                Status = order.Status,
                Supplier_Order_Details = order.Supplier_Order_Details,
                OrderLines = order.Supplier_Order_Lines.Select(sol => new SupplierOrderLineViewModel
                {
                    Supplier_Order_Line_ID = sol.Supplier_Order_Line_ID,
                    Product_ID = sol.Product_ID,
                    Product_Name = sol.Product.Product_Name,
                    Supplier_Quantity = sol.Supplier_Quantity,
                    Purchase_Price = sol.Purchase_Price
                }).ToList(),
                Total_Price = (decimal)order.Supplier_Order_Lines.Sum(sol => sol.Supplier_Quantity * sol.Purchase_Price)
            }).ToList();

            return Ok(supplierOrderViewModels);
        }

        // GET: api/supplier/GetSupplierOrderById/{id}
        [HttpGet]
        [Route("GetSupplierOrderById/{id}")]
        //[Authorize(Roles = "Administrator")]
        public async Task<IActionResult> GetSupplierOrderById(int id)
        {
            try
            {
                var order = await _appContext.Supplier_Orders
                    .Include(o => o.Supplier)
                    .Include(o => o.Owner)
                    .Include(o => o.Supplier_Order_Lines)
                    .ThenInclude(sol => sol.Product)
                    .FirstOrDefaultAsync(o => o.Supplier_Order_ID == id);

                if (order == null)
                {
                    return NotFound("Supplier order not found.");
                }

                return Ok(order);
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "Error fetching supplier order by ID.");
                return StatusCode(StatusCodes.Status500InternalServerError, "An error occurred while processing your request.");
            }
        }

        // GET: api/supplier/GetSupplierOrderDetails/{orderId}
        [HttpGet]
        [Route("GetSupplierOrderDetails/{orderId}")]
        public async Task<IActionResult> GetSupplierOrderDetails(int orderId)
        {
            try
            {
                var orderDetails = await (from sol in _appContext.Supplier_Order_Lines
                                          join p in _appContext.Products on sol.Product_ID equals p.Product_ID
                                          where sol.Supplier_Order_ID == orderId
                                          select new SupplierOrderDetailsViewModel
                                          {
                                              Supplier_Order_Line_ID = sol.Supplier_Order_Line_ID,
                                              Supplier_Order_ID = sol.Supplier_Order_ID,
                                              Product_ID = sol.Product_ID,
                                              Supplier_Quantity = sol.Supplier_Quantity,
                                              Purchase_Price = p.Purchase_Price ?? 0, // Handle nullable Purchase_Price
                                              Total_Price = (sol.Supplier_Quantity * (p.Purchase_Price ?? 0)), // Calculate Total_Price
                                              Product_Name = p.Product_Name
                                          }).ToListAsync();

                if (orderDetails == null || orderDetails.Count == 0)
                {
                    return NotFound("No order details found for the given order ID.");
                }

                return Ok(orderDetails);
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "Error retrieving supplier order details.");
                return StatusCode(StatusCodes.Status500InternalServerError, "An error occurred while processing your request.");
            }
        }

        [HttpGet]
        [Route("GetProductCategories")]
        public async Task<IActionResult> GetProductCategories()
        {
            var categories = await _appContext.Product_Categories.ToListAsync();
            return Ok(categories);
        }

        // Controller to fetch products by category ID
        [HttpGet]
        [Route("GetProductsByCategory/{categoryId}")]
        public async Task<IActionResult> GetProductsByCategory(int categoryId)
        {
            var products = await _appContext.Products.Where(p => p.Product_Category_ID == categoryId).ToListAsync();
            return Ok(products);
        }
        
        [HttpPost]
        [Route("PlaceSupplierOrder")]
        public async Task<IActionResult> PlaceSupplierOrder([FromBody] SupplierOrderViewModel orderVm)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            // Create a new supplier order
            var supplierOrder = new Supplier_Order
            {
                Date = DateTime.UtcNow,
                Supplier_Order_Details = orderVm.Supplier_Order_Details,
                Supplier_ID = orderVm.Supplier_ID,
                Owner_ID = orderVm.Owner_ID,
                Status = orderVm.Status,
                Supplier_Order_Lines = new List<Supplier_Order_Line>()
            };

            decimal totalOrderPrice = 0;

            Console.WriteLine($"Creating Supplier_Order with ID {supplierOrder.Supplier_Order_ID}");
            Console.WriteLine($"OrderLines count: {orderVm.OrderLines?.Count ?? 0}");

            // Process each order line
            foreach (var orderLine in orderVm.OrderLines)
            {

                // Fetch the product details
                var product = await _appContext.Products.FindAsync(orderLine.Product_ID);
                if (product == null)
                {
                    return BadRequest($"Product with ID {orderLine.Product_ID} not found.");
                }

                if (product != null)
                {
                    var purchasePrice = product.Purchase_Price;
                    if (purchasePrice == null)
                    {
                        return BadRequest($"Purchase price for product ID {orderLine.Product_ID} is not set.");
                    }

                    // Create a new supplier order line
                    var supplierOrderLine = new Supplier_Order_Line
                    {
                        Product_ID = orderLine.Product_ID,
                        Supplier_Quantity = orderLine.Supplier_Quantity,
                        Purchase_Price = purchasePrice // Set the purchase price from product
                    };

                    // Add the order line to the supplier order
                    supplierOrder.Supplier_Order_Lines.Add(supplierOrderLine);

                    // Calculate total price
                    totalOrderPrice += orderLine.Supplier_Quantity * (decimal)purchasePrice;
                }

                Console.WriteLine($"Processing OrderLine: Product_ID = {orderLine.Product_ID}, Quantity = {orderLine.Supplier_Quantity}");
            }

            // Set total price on supplier order
            supplierOrder.Total_Price = totalOrderPrice;

            // Save the supplier order to the database
            _appContext.Supplier_Orders.Add(supplierOrder);
            await _appContext.SaveChangesAsync();

            return Ok(supplierOrder);
        }

        // PUT: api/supplier/updateinventory
        [HttpPut]
        [Route("updateinventory")]
        //[Authorize(Roles = "Administrator")]
        public async Task<IActionResult> UpdateInventory([FromBody] UpdateInventoryViewModel updateInventoryVm)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            try
            {
                var receivedSupplierOrder = new Received_Supplier_Order
                {
                    Supplies_Received_Date = updateInventoryVm.Supplies_Received_Date
                };

                _appContext.Received_Supplier_Orders.Add(receivedSupplierOrder);
                await _appContext.SaveChangesAsync();

                foreach (var line in updateInventoryVm.ReceivedOrderLines)
                {
                    var receivedOrderLine = new Received_Supplier_Order_Line
                    {
                        Received_Supplier_Order_ID = receivedSupplierOrder.Received_Supplier_Order_ID,
                        Received_Supplies_Quantity = line.Received_Supplies_Quantity,
                        Supplier_Order_Line_ID = line.Supplier_Order_Line_ID,
                    };

                    var product = await _appContext.Products.FindAsync(line.Product_ID);
                    if (product != null)
                    {
                        product.Quantity += line.Received_Supplies_Quantity;
                        _appContext.Products.Update(product);
                    }

                    _appContext.Received_Supplier_Order_Lines.Add(receivedOrderLine);
                }

                await _appContext.SaveChangesAsync();

                return Ok("Inventory updated successfully.");
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "Error updating inventory.");
                return StatusCode(StatusCodes.Status500InternalServerError, "An error occurred while processing your request.");
            }
        }

        // POST: api/supplier/receivesupplierorder
        [HttpPost]
        [Route("receivesupplierorder")]

        public async Task<IActionResult> ReceiveSupplierOrder([FromBody] ReceivedSupplierOrderViewModel receiveOrderVm)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            var receivedSupplierOrder = new Received_Supplier_Order
            {
                Supplies_Received_Date = receiveOrderVm.Supplies_Received_Date,
                Discrepancies = receiveOrderVm.Discrepancies,
                Accepted = receiveOrderVm.Accepted ?? false,
                Received_Supplier_Order_Lines = new List<Received_Supplier_Order_Line>()
            };

            _appContext.Received_Supplier_Orders.Add(receivedSupplierOrder);
            await _appContext.SaveChangesAsync();

            if (receivedSupplierOrder.Accepted)
            {
                foreach (var line in receiveOrderVm.Received_Supplier_Order_Lines)
                {
                    var product = await _appContext.Products.FindAsync(line.Product_ID);

                    // Debugging and Logging
                    Console.WriteLine($"Processing Product ID: {line.Product_ID}");

                    if (product == null)
                    {
                        Console.WriteLine($"Product ID {line.Product_ID} not found.");
                        return BadRequest($"Product ID {line.Product_ID} not found.");
                    }

                    product.Quantity += line.Received_Supplies_Quantity;
                    _appContext.Products.Update(product);

                    var receivedOrderLine = new Received_Supplier_Order_Line
                    {
                        Received_Supplier_Order_ID = receivedSupplierOrder.Received_Supplier_Order_ID,
                        Received_Supplies_Quantity = line.Received_Supplies_Quantity,
                        Supplier_Order_Line_ID = line.Supplier_Order_Line_ID,
                        Product_ID = line.Product_ID // Ensure this is set
                    };

                    _appContext.Received_Supplier_Order_Lines.Add(receivedOrderLine);
                }

                await _appContext.SaveChangesAsync();
            }

            return Ok(receivedSupplierOrder);
        }

        [HttpPost]
        [Route("UpdateSupplierOrderStatus")]
        public async Task<IActionResult> UpdateSupplierOrderStatus([FromBody] UpdateSupplierOrderStatusViewModel statusUpdateVm)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            // Fetch the specific supplier order entry
            var supplierOrder = await _appContext.Supplier_Orders
                .FirstOrDefaultAsync(o => o.Supplier_Order_ID == statusUpdateVm.Supplier_Order_ID);

            if (supplierOrder == null)
            {
                return BadRequest($"Supplier order with ID {statusUpdateVm.Supplier_Order_ID} not found.");
            }

            // Update the status based on the Accepted boolean
            supplierOrder.Status = statusUpdateVm.Status; // Ensure this is directly assigned

            // Save changes to the database
            await _appContext.SaveChangesAsync();

            return Ok(supplierOrder);
        }
    }
}
//models
public class Supplier_Order
{
    [Key]
    public int Supplier_Order_ID { get; set; }

    //[Required]
    public DateTime Date { get; set; }

    //[Required]
    public string? Supplier_Order_Details { get; set; }

    //[Required]
    public decimal Total_Price { get; set; }

    public int Status { get; set; }

    public int Supplier_ID { get; set; }

    [ForeignKey(nameof(Supplier_ID))]
    public Supplier Supplier { get; set; }

    public int Owner_ID { get; set; }

    [ForeignKey(nameof(Owner_ID))]
    public Owner Owner { get; set; }

    public ICollection<Supplier_Order_Line> Supplier_Order_Lines { get; set; }
}
public class Supplier_Order_Line
{
    [Key]
    public int Supplier_Order_Line_ID { get; set; }

    public int Supplier_Quantity { get; set; }


    public int Product_ID { get; set; }

    [ForeignKey(nameof(Product_ID))]

    public Product Product { get; set; }

    public decimal? Purchase_Price { get; set; } 

    public decimal? Unit_Price { get; set; } 

    public int Supplier_Order_ID { get; set; }

    [ForeignKey(nameof(Supplier_Order_ID))]
    public Supplier_Order Supplier_Order { get; set; } 
}
public class Received_Supplier_Order
{
    [Key]
    public int Received_Supplier_Order_ID { get; set; }

    [Required]
    public DateTime Supplies_Received_Date { get; set; }

    public bool Accepted { get; set; } // Indicates if the order was accepted

    public string? Discrepancies { get; set; }  // Nullable attribute for discrepancies

    public ICollection<Received_Supplier_Order_Line> Received_Supplier_Order_Lines { get; set; }
}
public class Received_Supplier_Order_Line
{
    [Key]
    public int Received_Supplier_Order_Line_ID { get; set; }

    public int Received_Supplier_Order_ID { get; set; }

    [ForeignKey(nameof(Received_Supplier_Order_ID))]

    public Received_Supplier_Order Received_Supplier_Order { get; set; }


    public int Supplier_Order_Line_ID { get; set; }

    [ForeignKey(nameof(Supplier_Order_Line_ID))]

    public Supplier_Order_Line Supplier_Order_Line { get; set; }
  

    public int Product_ID { get; set; }

    [ForeignKey(nameof(Product_ID))]

    public Product Product { get; set; }

    public int Received_Supplies_Quantity { get; set; }
}

//viewmodels
public class SupplierOrderViewModel
{
    public int Supplier_Order_ID { get; set; }
    public DateTime Date { get; set; }
    public string Supplier_Order_Details { get; set; }
    public decimal Total_Price { get; set; }
    public int Supplier_ID { get; set; }
    public string Supplier_Name { get; set; }
    public int Owner_ID { get; set; }
    public int Status { get; set; }
    public ICollection<SupplierOrderLineViewModel> OrderLines { get; set; }
}
public class SupplierOrderLineViewModel
{
    public int Supplier_Order_Line_ID { get; set; }
    public int Product_ID { get; set; }
    public string Product_Name { get; set; }
    public int Supplier_Quantity { get; set; }

    public decimal? Purchase_Price { get; set; }
}
public class UpdateSupplierOrderStatusViewModel
{
    public int Supplier_Order_ID { get; set; }
    public int Status { get; set; } // Boolean to indicate acceptance/rejection
}
public class ReceivedSupplierOrderViewModel
{
    public DateTime Supplies_Received_Date { get; set; }

    public bool? Accepted { get; set; } // Nullable bool to indicate acceptance/rejection

    public string? Discrepancies { get; set; }  // Nullable attribute for discrepancies

    public List<ReceivedSupplierOrderLineViewModel> Received_Supplier_Order_Lines { get; set; }
}

public class ReceivedSupplierOrderLineViewModel
{
    public int Product_ID { get; set; }
    public int Received_Supplies_Quantity { get; set; }
    public int Supplier_Order_Line_ID { get; set; }
}
from typing import List
from sqlalchemy import Column, Integer, String
from sqlalchemy.dialects.postgresql import ARRAY
from sqlalchemy.ext.declarative import declarative_base
from pydantic import BaseModel, constr

Base = declarative_base()


class CompanyOrm(Base):
    __tablename__ = 'companies'
    id = Column(Integer, primary_key=True, nullable=False)
    public_key = Column(String(20), index=True, nullable=False, unique=True)
    name = Column(String(63), unique=True)
    domains = Column(ARRAY(String(255)))


class CompanyModel(BaseModel):
    id: int
    public_key: constr(max_length=20)
    name: constr(max_length=63)
    domains: List[constr(max_length=255)]

    class Config:
        orm_mode = True


co_orm = CompanyOrm(
    id=123,
    public_key='foobar',
    name='Testing',
    domains=['example.com', 'foobar.com'],
)
print(co_orm)
#> <models_orm_mode.CompanyOrm object at 0x7f23ee50a650>
co_model = CompanyModel.from_orm(co_orm)
print(co_model)
#> id=123 public_key='foobar' name='Testing' domains=['example.com',
#> 'foobar.com']
https://developer.android.com/courses/android-development-with-kotlin/course?utm_source=dac&utm_medium=website&utm_campaign=edu
Solana is a secured blockchain that allows the creation of decentralized applications(DApps). These services can benefit a business and help it grow in its respective fields. Some of the following services of Solana Dapp Development are:
*Wallet development solutions allow the user to send, receive, store, and manage digital assets like tokens and cryptocurrencies.
*NFT Marketplace Development creates a decentralized marketplace on the blockchain wherNFTs are bought, sold, and traded.
*Solana Exchange Development Services designs a custom Solana-based exchange platform that assists the business in extracting the potential of the Solana blockchain to provide a smooth trading experience.
*Minting platform development services provide custom token creation, smart contract development, and the launch of a new token. 

INSERT INTO tbl_users (user_id, username, crm_id, email, table_type, card_name) VALUES (1553,'Abhay Kumar', 'ak_531328', 'abhay.kumar1@tatamotors.com', 1, '1,2,4,5,6,13,14,15,19,16,17,21,18,29,32');
------------------------------------------
INSERT INTO tbl_users (user_id, username, crm_id, email, table_type, card_name, created_on) VALUES
(1555, 'RAMAN GUPTA', NULL, 'raman.gupta@tatamotors.com', 1, '1,2,4,5,6,13,14,15,19,16,17,21,18,29,32', CURRENT_TIMESTAMP),
----------------------------------------------
UPDATE tbl_users
SET username = 'Gaurav Yadav',
    crm_id = NULL,
    email = 'gaurav.yadav@tatamotors.com',
    table_type = 1,
    card_name = '1,2,4,5,6,13,14,15,19,16,17,21,18,29,32',
    created_on = CURRENT_TIMESTAMP
WHERE user_id = 1554;
--------------------------------------------
//controller
namespace av_motion_api.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class InventoriesController : ControllerBase
    {
        private readonly AppDbContext _appContext;
        public readonly IRepository _repository;

        public InventoriesController(AppDbContext _context, IRepository repository)
        {

            _appContext = _context;
            _repository = repository;
        }
        // GET: api/<InventoriesController>
        [HttpGet]
        public async Task<ActionResult<IEnumerable<InventoryViewModel>>> GetInventories()
        {
            var inventories = await _repository.GetInventoryDetails();

            return Ok(inventories);
        }


        // GET api/<InventoriesController>/5
        [HttpGet("{id}")]
        public async Task<ActionResult<InventoryViewModel>> GetInventoryItem(int id)
        {
            if (_appContext.Inventory == null)
            {
                return NotFound();
            }
            var inventoryItem = await _repository.GetInventoryItem(id);
            if (inventoryItem == null)
            {
                return NotFound();
            }

            return Ok(inventoryItem);
        }

        // POST api/<InventoriesController>
        [HttpPost]
        public async Task<ActionResult<Inventory>> PostInventoryItem([FromBody] InventoryViewModel inventoryItem)
        {

            var item = new Inventory
            {

                Inventory_Item_Category = inventoryItem.category,
                Inventory_Item_Name = inventoryItem.itemName,
                Inventory_Item_Quantity = inventoryItem.quantity,
                Inventory_Item_Photo = inventoryItem.photo,
                Supplier_ID = inventoryItem.supplierID,
                Received_Supplier_Order_ID = inventoryItem.received_supplier_order_id
            };




            if (_appContext.Inventory == null)
            {
                return Problem("Entity set 'AppDbContext.Inventory'  is null.");
            }
            _appContext.Inventory.Add(item);
            await _appContext.SaveChangesAsync();


            return Ok(item);
        }

        // PUT api/<InventoriesController>/5
        [HttpPut("{id}")]
        public async Task<IActionResult> PutInventoryItem(int id, [FromBody] InventoryViewModel inventoryItem)
        {
            if (id != inventoryItem.inventoryID)
            {
                return BadRequest();
            }
            var existingitem = await _appContext.Inventory.FindAsync(id);

            if (existingitem == null)
            {
                return NotFound();
            }

            existingitem.Inventory_Item_Name = inventoryItem.itemName;
            existingitem.Inventory_Item_Category = inventoryItem.category;
            existingitem.Inventory_Item_Quantity = inventoryItem.quantity;
            existingitem.Supplier_ID = inventoryItem.supplierID;
            existingitem.Inventory_Item_Photo = inventoryItem.photo;

          //  _appContext.Entry(inventoryItem).State = EntityState.Modified;

            try
            {
                _appContext.Inventory.Update(existingitem);    
                await _appContext.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!InventoryStatusExists(id))
                {
                    return NotFound();
                }
                else
                {
                    throw;
                }
            }

            return NoContent();
        }


        // DELETE api/<InventoriesController>/5
        //[HttpDelete("{id}")]
        //public void Delete(int id)
        //{
        //}

        private bool InventoryStatusExists(int id)
        {
            return (_appContext.Inventory?.Any(e => e.Inventory_ID == id)).GetValueOrDefault();
        }
    }
}

//model
namespace av_motion_api.Models
{
    public class Inventory
    {
        [Key]
        public int Inventory_ID { get; set; }

        [Required]
        [StringLength(50)]
        public string Inventory_Item_Category { get; set;}

        [Required]
        [StringLength(50)]

        public string Inventory_Item_Name { get; set; }

        [Required]

        public int Inventory_Item_Quantity { get; set; }

        [Required]
        public string Inventory_Item_Photo { get; set; }

        public int Supplier_ID { get; set; }

        [ForeignKey(nameof(Supplier_ID))]
        public Supplier Supplier { get; set; }

        public int Received_Supplier_Order_ID { get; set; }

        [ForeignKey(nameof(Received_Supplier_Order_ID))]
        public Received_Supplier_Order Received_Supplier_Order { get; set; }


    }
}

//viewmodel
namespace av_motion_api.ViewModels
{
    public class InventoryViewModel
    {
        public int inventoryID { get; set; }
        public string category { get; set; }
        public string itemName { get; set; }
        public int quantity { get; set; }
        public string photo { get; set; }
        public int supplierID { get; set; }
        public string supplierName { get; set; }
        public int received_supplier_order_id { get; set; }
    }
}
//controller
namespace av_motion_api.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class InventoriesController : ControllerBase
    {
        private readonly AppDbContext _appContext;
        public readonly IRepository _repository;

        public InventoriesController(AppDbContext _context, IRepository repository)
        {

            _appContext = _context;
            _repository = repository;
        }
        // GET: api/<InventoriesController>
        [HttpGet]
        public async Task<ActionResult<IEnumerable<InventoryViewModel>>> GetInventories()
        {
            var inventories = await _repository.GetInventoryDetails();

            return Ok(inventories);
        }


        // GET api/<InventoriesController>/5
        [HttpGet("{id}")]
        public async Task<ActionResult<InventoryViewModel>> GetInventoryItem(int id)
        {
            if (_appContext.Inventory == null)
            {
                return NotFound();
            }
            var inventoryItem = await _repository.GetInventoryItem(id);
            if (inventoryItem == null)
            {
                return NotFound();
            }

            return Ok(inventoryItem);
        }

        // POST api/<InventoriesController>
        [HttpPost]
        public async Task<ActionResult<Inventory>> PostInventoryItem([FromBody] InventoryViewModel inventoryItem)
        {

            var item = new Inventory
            {

                Inventory_Item_Category = inventoryItem.category,
                Inventory_Item_Name = inventoryItem.itemName,
                Inventory_Item_Quantity = inventoryItem.quantity,
                Inventory_Item_Photo = inventoryItem.photo,
                Supplier_ID = inventoryItem.supplierID,
                Received_Supplier_Order_ID = inventoryItem.received_supplier_order_id
            };




            if (_appContext.Inventory == null)
            {
                return Problem("Entity set 'AppDbContext.Inventory'  is null.");
            }
            _appContext.Inventory.Add(item);
            await _appContext.SaveChangesAsync();


            return Ok(item);
        }

        // PUT api/<InventoriesController>/5
        [HttpPut("{id}")]
        public async Task<IActionResult> PutInventoryItem(int id, [FromBody] InventoryViewModel inventoryItem)
        {
            if (id != inventoryItem.inventoryID)
            {
                return BadRequest();
            }
            var existingitem = await _appContext.Inventory.FindAsync(id);

            if (existingitem == null)
            {
                return NotFound();
            }

            existingitem.Inventory_Item_Name = inventoryItem.itemName;
            existingitem.Inventory_Item_Category = inventoryItem.category;
            existingitem.Inventory_Item_Quantity = inventoryItem.quantity;
            existingitem.Supplier_ID = inventoryItem.supplierID;
            existingitem.Inventory_Item_Photo = inventoryItem.photo;

          //  _appContext.Entry(inventoryItem).State = EntityState.Modified;

            try
            {
                _appContext.Inventory.Update(existingitem);    
                await _appContext.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!InventoryStatusExists(id))
                {
                    return NotFound();
                }
                else
                {
                    throw;
                }
            }

            return NoContent();
        }


        // DELETE api/<InventoriesController>/5
        //[HttpDelete("{id}")]
        //public void Delete(int id)
        //{
        //}

        private bool InventoryStatusExists(int id)
        {
            return (_appContext.Inventory?.Any(e => e.Inventory_ID == id)).GetValueOrDefault();
        }
    }
}

//model
namespace av_motion_api.Models
{
    public class Inventory
    {
        [Key]
        public int Inventory_ID { get; set; }

        [Required]
        [StringLength(50)]
        public string Inventory_Item_Category { get; set;}

        [Required]
        [StringLength(50)]

        public string Inventory_Item_Name { get; set; }

        [Required]

        public int Inventory_Item_Quantity { get; set; }

        [Required]
        public string Inventory_Item_Photo { get; set; }

        public int Supplier_ID { get; set; }

        [ForeignKey(nameof(Supplier_ID))]
        public Supplier Supplier { get; set; }

        public int Received_Supplier_Order_ID { get; set; }

        [ForeignKey(nameof(Received_Supplier_Order_ID))]
        public Received_Supplier_Order Received_Supplier_Order { get; set; }


    }
}

//viewmodel
namespace av_motion_api.ViewModels
{
    public class InventoryViewModel
    {
        public int inventoryID { get; set; }
        public string category { get; set; }
        public string itemName { get; set; }
        public int quantity { get; set; }
        public string photo { get; set; }
        public int supplierID { get; set; }
        public string supplierName { get; set; }
        public int received_supplier_order_id { get; set; }
    }
}
//controller
namespace av_motion_api.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class ProductController : ControllerBase
    {
        private readonly AppDbContext _appContext;
        public readonly IRepository _repository;
        public ProductController(AppDbContext _context, IRepository repository)
        {

            _appContext = _context;
            _repository = repository;
        }
        // GET: api/<ProductController>
        [HttpGet]
        [Route("GetAllProducts")]
        public async Task<IActionResult> GetAllProducts()
        {
            try
            {
                var products = await _appContext.Products.ToListAsync();

                return Ok(products);
            }
            catch (Exception)
            {
                return BadRequest();
            }
        }

        // GET api/<ProductController>/5
        [HttpGet]
        [Route("GetProductById/{id}")]
        public async Task<IActionResult> GetProductById(int id)
        {
            try
            {
                var product = await _appContext.Products.FindAsync(id);
                if (product == null)
                {
                    return NotFound();
                }

                return Ok(product);
            }
            catch (Exception)
            {
                return BadRequest();
            }
        }

        //POST api/<ProductController>
        [HttpPost]
        [DisableRequestSizeLimit]
        [Route("PostProduct")]
        public async Task<IActionResult> PostProduct([FromForm] ProductViewModel product)
        {
            var formCollection = await Request.ReadFormAsync();
            var product_Img = formCollection.Files.FirstOrDefault();

            using (var memoryStream = new MemoryStream())
            {
                await product_Img.CopyToAsync(memoryStream);
                var fileBytes = memoryStream.ToArray();
                string base64Image = Convert.ToBase64String(fileBytes);

                var newProduct = new Product()
                {
                    Product_Name = product.Product_Name,
                    Product_Description = product.Product_Description,
                    Product_Img = base64Image,
                    Quantity = product.Quantity,
                    Unit_Price = product.Unit_Price,
                    Purchase_Price = product.Purchase_Price,
                    Size = product.Size,
                    Product_Category_ID = product.Product_Category_ID,
                };

                if (_appContext.Products == null)
                {
                    return Problem("Entity set 'AppDbContext.Products' is null.");
                }
                _appContext.Products.Add(newProduct);
                await _appContext.SaveChangesAsync();

                return Ok(newProduct);
            }
        }


        // PUT api/<ProductController>/5
        [HttpPut]
        [Route("PutProduct/{id}")]
        public async Task<IActionResult> PutProduct(int id, [FromForm] ProductViewModel updatedProduct)
        {
            var existingProduct = await _appContext.Products.FindAsync(id);
            if (existingProduct == null)
            {
                return NotFound();
            }

            // Read the form data to get the photo file
            var formCollection = await Request.ReadFormAsync();
            var product_Img = formCollection.Files.FirstOrDefault();

            existingProduct.Product_Name = updatedProduct.Product_Name;
            existingProduct.Product_Description = updatedProduct.Product_Description;
            existingProduct.Quantity = updatedProduct.Quantity;
            existingProduct.Unit_Price = updatedProduct.Unit_Price;
            existingProduct.Purchase_Price = updatedProduct.Purchase_Price;
            existingProduct.Size = updatedProduct.Size;
            existingProduct.Product_Category_ID = updatedProduct.Product_Category_ID;

            if (product_Img != null && product_Img.Length > 0)
            {
                using (var memoryStream = new MemoryStream())
                {
                    await product_Img.CopyToAsync(memoryStream);
                    var fileBytes = memoryStream.ToArray();
                    string base64Image = Convert.ToBase64String(fileBytes);

                    existingProduct.Product_Img = base64Image; // Store the base64 string of the photo
                }
            }

            _appContext.Products.Update(existingProduct);
            await _appContext.SaveChangesAsync();

            return Ok(existingProduct);
        }

        // DELETE api/<ProductController>/5
        [HttpDelete]
        [Route("DeleteProduct/{id}")]

        public async Task<IActionResult> DeleteProduct(int id)
        {
            if (_appContext.Products == null)
            {
                return NotFound();
            }
            var product = await _appContext.Products.FindAsync(id);
            if (product == null)
            {
                return NotFound();
            }
            
            _appContext.Products.Remove(product);
            await _appContext.SaveChangesAsync();

            return NoContent();
        }

    }
}

//model
  namespace av_motion_api.Models
{
    public class Product
    {
        [Key]
        public int Product_ID { get; set; }

        [Required, StringLength(100)]
        public string Product_Name { get; set; }

        [Required, StringLength(100)]
        public string Product_Description { get; set; }

        [Required]
        public string Product_Img { get; set; }

        public decimal? Purchase_Price { get; set; }

        [Required]
        public int Quantity { get; set; }

        [Required]
        public decimal Unit_Price { get; set; }

        [Required]
        public string Size { get; set; }

        public int Product_Category_ID { get; set; }

        [ForeignKey(nameof(Product_Category_ID))]
        public Product_Category Product_Category { get; set; }

    }
}

//viewmodel
namespace av_motion_api.ViewModels
{
    public class ProductViewModel
    { 
        public string Product_Name { get; set; }
        public string Product_Description { get; set; }
        public IFormFile Product_Img { get; set; }
        public int Quantity { get; set; }
        public decimal Unit_Price { get; set; }
        public decimal? Purchase_Price { get; set; }
        public string Size { get; set; }
        public int Product_Category_ID { get; set; }
    }
}
<!-- Example split danger button -->
<div class="btn-group">
  <button type="button" class="btn btn-danger">Action</button>
  <button type="button" class="btn btn-danger dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false">
    <span class="visually-hidden">Toggle Dropdown</span>
  </button>
  <ul class="dropdown-menu">
    <li><a class="dropdown-item" href="#">Action</a></li>
    <li><a class="dropdown-item" href="#">Another action</a></li>
    <li><a class="dropdown-item" href="#">Something else here</a></li>
    <li><hr class="dropdown-divider"></li>
    <li><a class="dropdown-item" href="#">Separated link</a></li>
  </ul>
</div>
b=int(input())
a=int(input())
for i in range(1,a+1):
    i=a+1-i
    s=""
    ls=" "*(a-i)
    for j in range(1,i+1):
        if i==a:
            s=s+str(b)+" "
        else:
            if j==1:
                s=s+str(b)+" "
            elif 1<j<i:
                s=s+"  "
            else:
                s=s+str(b)
        b+=1
    print(ls+s)
b=int(input())
a=int(input())
for i in range(1,a+1):
    b=b+i
sn=b-1
for i in range(1,a+1):
    i=a+1-i
    s=""
    ls="  "*(a-i)
    for j in range(1,i+1):
        if i==a or i==1:
            s=s+str(sn)+" "
        else:
            if j==1:
                s=s+str(sn)+" "
            elif 1<j<i:
                s=s+"  "
            else:
                s=s+str(sn)
        sn-=1
    print(ls+s)
a=input()
b=int(input())
b=int(b%7)
if a=="Monday":
    b=b
    if b>7:
        b=int(b%7)
elif a=="Tuesday":
    b=b+1
    if b>7:
        b=int(b%7)
elif a=="Wednesday":
    b=b+2
    if b>7:
        b=int(b%7)
elif a=="Thursday":
    b=b+3
    if b>7:
        b=int(b%7)
elif a=="Friday":
    b=b+4
    if b>7:
        b=int(b%7)
elif a=="Saturday":
    b=b+5
    if b>7:
        b=int(b%7)
elif a=="Sunday":
    b=b+6
    if b>7:
        b=int(b%7)
if b==1:
    print("Monday")
elif b==2:
    print("Tuesday")
elif b==3:
    print("Wednesday")
elif b==4:
    print("Thursday")
elif b==5:
    print("Friday")
elif b==6:
    print("Saturday")
elif b==7:
    print("Sunday")
using av_motion_api.Models;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using System.Net.NetworkInformation;
using System.Reflection.Emit;
using System.Security.Claims;
using System.Xml.Linq;

namespace av_motion_api.Data
{
    public class AppDbContext : IdentityDbContext<User, Role, int>

    {
        public AppDbContext(DbContextOptions<AppDbContext> options) : base(options) { }

        //set tables


        public DbSet<Attendance_List> Attendance_Lists { get; set; }
        public DbSet<Audit_Trail> Audit_Trails { get; set; }
        public DbSet<Booking> Bookings { get; set; }
        public DbSet<Booking_Time_Slot> Booking_Time_Slots { get; set; }
        public DbSet<Cart> Carts { get; set; }
        public DbSet<Cart_Item> Cart_Items { get; set; }
        public DbSet<Contract> Contracts { get; set; }
        public DbSet<Contract_History> Contract_History { get; set; }
        public DbSet<Contract_Type> Contract_Types { get; set; }
        public DbSet<DeletionSettings> DeletionSettings { get; set; }
        public DbSet<Discount> Discounts { get; set; }
        public DbSet<Employee> Employees { get; set; }
        public DbSet<Employee_Type> Employee_Types { get; set; }
        public DbSet<Equipment> Equipment { get; set; }
        public DbSet<Inspection> Inspection { get; set; }
        public DbSet<Inspection_Status> Inspection_Status { get; set; }
        public DbSet<Inspection_Type> Inspection_Type { get; set; }
        public DbSet<Inventory> Inventory { get; set; }
        public DbSet<Lesson_Plan> Lesson_Plans { get; set; }

        public DbSet<Lesson_Plan_Workout> lesson_Plan_Workout { get; set; }

        public DbSet<Member> Members { get; set; }
        public DbSet<Order> Orders { get; set; }
        public DbSet<Order_Line> Order_Lines { get; set; }
        public DbSet<Order_Status> Order_Status { get; set; }
        public DbSet<Outstanding_Payment> Outstanding_Payments { get; set; }
        public DbSet<Owner> Owners { get; set; }
        public DbSet<Payment> Payments { get; set; }
        public DbSet<Payment_Method> Payment_Methods { get; set; }
        public DbSet<Payment_Type> Payment_Types { get; set; }
        public DbSet<Price> Prices { get; set; }
        public DbSet<Product> Products { get; set; }
        public DbSet<Product_Category> Product_Categories { get; set; }
        public DbSet<Received_Supplier_Order> Received_Supplier_Orders { get; set; }
        public DbSet<Received_Supplier_Order_Line> Received_Supplier_Order_Lines { get; set; }
        public DbSet<Report> Reports { get; set; }
        public DbSet<Reward> Rewards { get; set; }

        public DbSet<Role> Roles { get; set; }
        public DbSet<Reward_Member> Reward_Members { get; set; }
        public DbSet<Reward_Type> Reward_Types { get; set; }
        public DbSet<Shift> Shifts { get; set; }
        public DbSet<Supplier> Suppliers { get; set; }
        public DbSet<Supplier_Order> Supplier_Orders { get; set; }
        public DbSet<Supplier_Order_Line> Supplier_Order_Lines { get; set; }
        public DbSet<Time_Slot> Time_Slots { get; set; }

        public DbSet<User> Users { get; set; }
        public DbSet<User_Status> Users_Status{ get; set; }

        public DbSet<User_Type> User_Types { get; set; }
        public DbSet<VAT> VAT { get; set; }

        public DbSet<Wishlist> Wishlists { get; set; }
        public DbSet<Wishlist_Item> Wishlist_Items { get; set; }

        public DbSet<Workout_Category> Workout_Category { get; set; }
        public DbSet<Workout> Workout { get; set; }
  
        public DbSet<Write_Off> Write_Offs { get; set; }



        protected override void OnModelCreating(ModelBuilder builder)
        {
            //Renaming of Default asp Tables
            builder.Entity<User>().ToTable("Users");
            builder.Entity<IdentityUserRole<int>>().ToTable("User_Roles");
            builder.Entity<IdentityUserLogin<int>>().ToTable("User_Logins");
            builder.Entity<Role>().ToTable("Roles");
            builder.Entity<IdentityRoleClaim<int>>().ToTable("Role_Claims");
            builder.Entity<IdentityUserClaim<int>>().ToTable("User_Claims");
            builder.Entity<IdentityUserToken<int>>().ToTable("Tokens");

            //Validation fix for database, specifying coulm types to be type decimal
            // builder.Entity<Contract>()
            //.Property(c => c.Initial_Fee)
            //.HasColumnType("decimal(18, 2)");

            builder.Entity<DeletionSettings>()
            .HasKey(ds => new { ds.DeletionTimeValue, ds.DeletionTimeUnit });

            builder.Entity<DeletionSettings>()
            .Property(ds => ds.DeletionTimeValue)
            .IsRequired();

            builder.Entity<DeletionSettings>()
            .Property(ds => ds.DeletionTimeUnit)
            .IsRequired()
            .HasMaxLength(50);

            builder.Entity<VAT>()
            .Property(v => v.VAT_Percentage)
            .HasColumnType("decimal(18, 2)");

            builder.Entity<Order>()
           .Property(o => o.Total_Price)
           .HasColumnType("decimal(18, 2)");

            builder.Entity<Outstanding_Payment>()
           .Property(op => op.Amount_Due)
           .HasColumnType("decimal(18, 2)");

            builder.Entity<Outstanding_Payment>()
           .Property(op => op.Late_Fee)
           .HasColumnType("decimal(18, 2)");

            builder.Entity<Payment>()
           .Property(pay => pay.Amount)
           .HasColumnType("decimal(18, 2)");

            builder.Entity<Price>()
           .Property(pr => pr.Unit_Price)
           .HasColumnType("decimal(18, 2)");

            builder.Entity<Product>()
            .Property(p => p.Unit_Price)
            .HasColumnType("decimal(18, 2)"); // Add this line for Unit_Price

            builder.Entity<Product>()
            .Property(p => p.Purchase_Price)
            .HasColumnType("decimal(18, 2)");

            builder.Entity<Supplier_Order>()
           .Property(so => so.Total_Price)
           .HasColumnType("decimal(18, 2)");

            builder.Entity<Supplier_Order_Line>()
            .Property(sol => sol.Purchase_Price)
            .HasColumnType("decimal(18, 2)");

            builder.Entity<Supplier_Order_Line>()
            .Property(sol => sol.Unit_Price)
            .HasColumnType("decimal(18, 2)");

            builder.Entity<Discount>()
           .Property(d => d.Discount_Percentage)
           .HasColumnType("decimal(18, 2)");

            builder.Entity<Supplier_Order_Line>()
             .HasOne(s => s.Product)
             .WithMany()
             .HasForeignKey(s => s.Product_ID)
             .OnDelete(DeleteBehavior.NoAction);

            builder.Entity<Order_Line>()
           .Property(ol => ol.Unit_Price)
           .HasColumnType("decimal(18,2)");

            //Delete cascade error fix
            //builder.Entity<Payment>()
            //.HasOne(p => p.Payment_Type)
            //.WithMany()
            //.HasForeignKey(p => p.Payment_Type_ID)
            //.OnDelete(DeleteBehavior.NoAction);

            //builder.Entity<Supplier_Order_Line>()
            //.HasOne(s => s.Supplier)
            //.WithMany()
            //.HasForeignKey(s => s.Supplier_ID)
            //.OnDelete(DeleteBehavior.NoAction);

            builder.Entity<Received_Supplier_Order_Line>()
                .HasOne(r => r.Received_Supplier_Order)
                .WithMany(r => r.Received_Supplier_Order_Lines)  // Assuming Received_Supplier_Order has a collection of Received_Supplier_Order_Lines
                .HasForeignKey(r => r.Received_Supplier_Order_ID)
                .OnDelete(DeleteBehavior.NoAction);

            builder.Entity<Received_Supplier_Order_Line>()
                .HasOne(r => r.Supplier_Order_Line)
                .WithMany()  // Assuming Supplier_Order_Line does not need a navigation property for Received_Supplier_Order_Lines
                .HasForeignKey(r => r.Supplier_Order_Line_ID)
                .OnDelete(DeleteBehavior.NoAction);

            builder.Entity<Received_Supplier_Order_Line>()
                .HasOne(r => r.Product)
                .WithMany()  // Assuming Product does not need a navigation property for Received_Supplier_Order_Lines
                .HasForeignKey(r => r.Product_ID)
                .OnDelete(DeleteBehavior.NoAction);


            //builder.Entity<Received_Supplier_Order_Line>()
            //.HasOne(r => r.Product)
            //.WithMany()
            //.HasForeignKey(r => r.Product_ID)
            //.OnDelete(DeleteBehavior.NoAction);

            builder.Entity<Outstanding_Payment>()
            .HasOne(op => op.Member)
            .WithMany()
            .HasForeignKey(op => op.Member_ID)
            .OnDelete(DeleteBehavior.NoAction); 

            builder.Entity<Outstanding_Payment>()
            .HasOne(op => op.Payment)
            .WithMany()
            .HasForeignKey(op => op.Payment_ID)
            .OnDelete(DeleteBehavior.NoAction);


            builder.Entity<Booking>()
            .HasOne(b => b.Member)
            .WithMany()
            .HasForeignKey(b => b.Member_ID)
            .OnDelete(DeleteBehavior.NoAction);

            builder.Entity<Reward_Member>()
            .HasOne(rm => rm.Member)
            .WithMany()
            .HasForeignKey(rm => rm.Member_ID)
            .OnDelete(DeleteBehavior.NoAction);

            builder.Entity<Reward_Member>()
            .HasOne(rm => rm.Reward)
            .WithMany()
            .HasForeignKey(rm => rm.Reward_ID)
            .OnDelete(DeleteBehavior.NoAction);

           builder.Entity<Booking_Time_Slot>()
            .HasOne(bts => bts.Booking)
            .WithMany()
            .HasForeignKey(bts => bts.Booking_ID)
            .OnDelete(DeleteBehavior.NoAction);

           builder.Entity<Booking_Time_Slot>()
            .HasOne(bts => bts.Time_Slot)
            .WithMany()
            .HasForeignKey(bts => bts.Time_Slot_ID)
            .OnDelete(DeleteBehavior.NoAction);

            builder.Entity<Attendance_List>()
            .HasOne(b => b.Time_Slot)
            .WithMany()
            .HasForeignKey(b => b.Time_Slot_ID)
            .OnDelete(DeleteBehavior.NoAction);

            builder.Entity<Lesson_Plan_Workout>()
            .HasOne(lpw => lpw.Workout)
            .WithMany()
            .HasForeignKey(lpw => lpw.Workout_ID)
            .OnDelete(DeleteBehavior.NoAction);

            builder.Entity<Lesson_Plan_Workout>()
            .HasOne(lpw => lpw.Lesson_Plan)
            .WithMany()
            .HasForeignKey(lpw => lpw.Lesson_Plan_ID)
            .OnDelete(DeleteBehavior.NoAction);

            builder.Entity<Workout>()
           .HasOne(w => w.Workout_Category)
           .WithMany()
           .HasForeignKey(w => w.Workout_Category_ID)
           .IsRequired()
           .OnDelete(DeleteBehavior.Restrict);

            base.OnModelCreating(builder);



            //var Contract_Types = new Contract_Type[]
            //{
            //    new Contract_Type { Contract_Type_ID = 1, Contract_Type_Name = "3-Month Membership", Contract_Description = "Three-month gym membership contract" },              
            //};
            //builder.Entity<Contract_Type>().HasData(Contract_Types);



            var Discounts = new Discount[]
            {
                new Discount
                {
                    Discount_ID = 1,
                    Discount_Code = "SPR-123",
                    Discount_Percentage = 10.00m,
                    Discount_Date = new DateTime(2024, 4, 10),
                    End_Date = new DateTime(2024, 4, 10).AddDays(30)
                }
            };
            builder.Entity<Discount>().HasData(Discounts);


            //var Employee_Types = new Employee_Type[]
            //{
            //    new Employee_Type { Employee_Type_ID = 1, Job_Title = "Administrator", Job_Description = "Responsible for managing administrative tasks and operations" }
            //};
            //builder.Entity<Employee_Type>().HasData(Employee_Types);

            var Inspection_Statuses = new Inspection_Status[]
            {
                new Inspection_Status { Inspection_Status_ID = 1, Inspection_Status_Description= "Pending" }


            };
            builder.Entity<Inspection_Status>().HasData(Inspection_Statuses);

            var Inspection_Types = new Inspection_Type[]
            {
                new Inspection_Type { Inspection_Type_ID = 1, Inspection_Type_Name = "Safety Inspection", Inspection_Type_Criteria = "Ensure compliance with safety standards" }
    
            };
            builder.Entity<Inspection_Type>().HasData(Inspection_Types);

            var Membership_Statuses = new Membership_Status[]
            {
                new Membership_Status { Membership_Status_ID = 1, Membership_Status_Description = "Active" }

            };
            builder.Entity<Membership_Status>().HasData(Membership_Statuses);

            var Newsletters = new Newsletter[]
            {
                new Newsletter { Newsletter_ID = 1, Newsletter_Title = "Fitness Tips", Newsletter_Photo = "fitness_tips.jpg", Newsletter_Description = "Stay updated with our latest fitness tips!" }

            };
            builder.Entity<Newsletter>().HasData(Newsletters);

            //var Payment_Methods = new Payment_Method[]
            //{
            //    new Payment_Method { Payment_Method_ID = 1, Payment_Method_Name = "Payfast" }  
            //};
            //builder.Entity<Payment_Method>().HasData(Payment_Methods);

            var Payment_Types = new Payment_Type[]
            {
                new Payment_Type { Payment_Type_ID = 1, Payment_Type_Name = "Payfast" },
                new Payment_Type { Payment_Type_ID = 2, Payment_Type_Name = "EFT" },
                new Payment_Type { Payment_Type_ID = 3, Payment_Type_Name = "Debit Order" }

            };
            builder.Entity<Payment_Type>().HasData(Payment_Types);

            var ProductCategories = new Product_Category[]
            {
                new Product_Category { Product_Category_ID = 1, Category_Name = "Tops", Category_Description = "Gym Tops" },
                new Product_Category { Product_Category_ID = 2, Category_Name = "Bottoms", Category_Description = "Gym Bottoms" }
            };

            builder.Entity<Product_Category>().HasData(ProductCategories);

            var Reports = new Report[]
            {
                new Report { Report_ID = 1, Report_Name = "Monthly Sales Report", Report_Description = "Report summarizing monthly sales data", Generated_Date = new DateTime(2024, 4, 10) }
            };
            builder.Entity<Report>().HasData(Reports);

            var Reward_Types = new Reward_Type[]
            {
                new Reward_Type { Reward_Type_ID = 1, Reward_Type_Name = "Membership Renewal Discount", Reward_Criteria = "Receive a discount on membership renewal after completing a certain number of workouts" }

            };
            builder.Entity<Reward_Type>().HasData(Reward_Types);

            var Suppliers = new Supplier[]
            {
                new Supplier { Supplier_ID = 1, Name = "FitnessGear", Contact_Number = "1234567890", Email_Address = "info@fitnessgear.com", Physical_Address = "123 Fitness Street, Cityville, South Africa" }
            };
            builder.Entity<Supplier>().HasData(Suppliers);


            var userStatus = new User_Status[]
            {
                new User_Status { User_Status_ID = 1, User_Status_Description = "Actived" },
                new User_Status { User_Status_ID = 2, User_Status_Description = "Deactivated" }
            };
            builder.Entity<User_Status>().HasData(userStatus);

            var userTypes = new User_Type[]
    {
                new User_Type { User_Type_ID = 1, User_Type_Name = "Owner" },
                new User_Type { User_Type_ID = 2, User_Type_Name = "Employee" },
                new User_Type { User_Type_ID = 3, User_Type_Name = "Member" }
    };
            builder.Entity<User_Type>().HasData(userTypes);



        //    var Users = new User[]                
        //    {
        //        new User 
        //        {
        //            User_ID = 1,
        //            Id = 1,
        //            Name = "Don",
        //            Surname = "Percival",
        //            ID_Number = "0203057644931",
        //            Email = "DonPercival@gmail.com",
        //            Physical_Address = "456 Oak Avenue",
        //            PhoneNumber = "0734457681",
        //            Photo = "DonProfilePic.jpg",
        //            PasswordHash = "AEWR54Q35H5T4HRGRGQ",
        //            Date_of_Birth = new DateTime(1994,10,11),
        //            User_Type_ID =1,
        //            User_Status_ID =1
        //        },
        //        new User
        //        {
        //            User_ID = 2,
        //            Id = 2,
        //            Name = "Barbra",
        //            Surname = "Gordon",
        //            ID_Number = "1220231231312",
        //            Email = "barbragordon@gmail.com",
        //            Physical_Address = "456 Oak Avenue",
        //            PhoneNumber = "9876543210",
        //            Photo = "barbra_photo.jpg",
        //            PasswordHash = "HJDKL3948SJDF3JSHFD",
        //            Date_of_Birth = new DateTime(1985, 5, 15),
        //            User_Type_ID =2,
        //            User_Status_ID =1
        //        },

        //        new User

        //        {
        //        User_ID = 3,
        //        Id = 3,
        //        Name = "Jane",
        //        Surname = "Smith",
        //        ID_Number = "1220231231312",
        //        Email = "JaneSmith@gmail.com",
        //        Physical_Address = "456 Oak Avenue",
        //        PhoneNumber = "9876543210",
        //        Photo = "jane_smith_photo.jpg",    
        //        PasswordHash = "JKLFSF34JKLRE983JFSD",
        //        Date_of_Birth = new DateTime(1985, 5, 15),
        //        User_Type_ID =3,
        //        User_Status_ID =1
        //        }


        //    };
        //builder.Entity<User>().HasData(Users);








            //var Contracts = new Contract[]
            //{
            //   new Contract { Contract_ID = 1, Subscription_Date = new DateTime(2023, 1, 1), Expiry_Date = new DateTime(2023, 4, 1), Terms_Of_Agreement = "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", Approval_Status = true, Approval_Date = new DateTime(2023, 1, 1), Initial_Fee = 100.00m, Contract_Type_ID = 1, Payment_Type_ID = 1 }
            //};
            //builder.Entity<Contract>().HasData(Contracts);


            //var ContractHistories = new Contract_History[]
            //{
            //    new Contract_History { Contract_History_ID = 1, Modification_Date = new DateTime(2023, 5, 15), Previous_Terms = "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", Updated_Terms = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut enim ad minim veniam.", Reasons_For_Changes = "To include additional benefits for members.", Contract_ID = 1 },

            //};
            //builder.Entity<Contract_History>().HasData(ContractHistories);



            var VAT = new VAT[]
            {
               new VAT { VAT_ID = 1, VAT_Percentage = 15.00m, VAT_Date = new DateTime(2024, 1, 1) }
            };
            builder.Entity<VAT>().HasData(VAT);


            var Audit_Trails = new Audit_Trail[]
            {
                new Audit_Trail { Audit_Trail_ID = 1, Action = "Action description", Timestamp = DateTime.Now }

            };
            builder.Entity<Audit_Trail>().HasData(Audit_Trails);

            var shifts = new List<Shift>();

            // Default shift (placeholder)
            int defaultShiftId = 1;
            shifts.Add(new Shift
            {
                Shift_ID = defaultShiftId,
                Shift_Number = defaultShiftId,
                Start_Time = new TimeSpan(0, 0, 0),
                End_Time = new TimeSpan(0, 0, 0)
            });

            // Weekdays (Monday - Friday) shifts
            var startTime = new TimeSpan(6, 0, 0);
            var endTime = new TimeSpan(22, 0, 0);
            int shiftId = defaultShiftId + 1; // Start after the default shift ID

            while (startTime < endTime)
            {
                shifts.Add(new Shift
                {
                    Shift_ID = shiftId,
                    Shift_Number = shiftId,
                    Start_Time = startTime,
                    End_Time = startTime.Add(new TimeSpan(2, 0, 0))
                });
                startTime = startTime.Add(new TimeSpan(2, 0, 0));
                shiftId++;
            }

            // Saturday shifts
            startTime = new TimeSpan(6, 0, 0);
            endTime = new TimeSpan(20, 0, 0);

            while (startTime < endTime)
            {
                shifts.Add(new Shift
                {
                    Shift_ID = shiftId,
                    Shift_Number = shiftId,
                    Start_Time = startTime,
                    End_Time = startTime.Add(new TimeSpan(2, 0, 0))
                });
                startTime = startTime.Add(new TimeSpan(2, 0, 0));
                shiftId++;
            }

            // Sunday shifts
            startTime = new TimeSpan(6, 0, 0);
            endTime = new TimeSpan(14, 0, 0);

            while (startTime < endTime)
            {
                shifts.Add(new Shift
                {
                    Shift_ID = shiftId,
                    Shift_Number = shiftId,
                    Start_Time = startTime,
                    End_Time = startTime.Add(new TimeSpan(2, 0, 0))
                });
                startTime = startTime.Add(new TimeSpan(2, 0, 0));
                shiftId++;
            }

            builder.Entity<Shift>().HasData(shifts);


            //var Employees = new Employee[]
            //{
            //   new Employee { Employee_ID = 1, Employment_Date = new DateTime(2024, 4, 12), Employee_Type_ID = 1 , Shift_ID =1, User_ID = 2 }
            //};
            //builder.Entity<Employee>().HasData(Employees);


            //var Members = new Member[]
            //{
            //   new Member { Member_ID = 1, Contract_ID = 1,User_ID = 3 }
               
            //};
            //builder.Entity<Member>().HasData(Members);


            //var AttendanceLists = new Attendance_List[]
            //{

            //    new Attendance_List { Attendance_ID = 1, Number_Of_Bookings = 1, Members_Present = 10, Members_Absent = 5, Time_Slot_ID = 1}
            //};
            //builder.Entity<Attendance_List>().HasData(AttendanceLists);


            //var Bookings = new Booking[]
            //{
            //    new Booking { Booking_ID = 1,  Member_ID = 1}
            //};
            //builder.Entity<Booking>().HasData(Bookings);

            var employeeTypes = new Employee_Type[]
            {
                new Employee_Type
                {
                    Employee_Type_ID = 1,
                    Job_Title = "Admin",
                    Job_Description = "Manages administrative tasks and oversees operations."
                },
                new Employee_Type
                {
                    Employee_Type_ID = 2,
                    Job_Title = "Trainer",
                    Job_Description = "Provides training and fitness guidance to members."
                }
            };
            builder.Entity<Employee_Type>().HasData(employeeTypes);

            var workoutcategories = new Workout_Category[]
            {
                new Workout_Category { Workout_Category_ID = 1, Workout_Category_Name = "Cardio", Workout_Category_Description = "Cardio workouts to improve endurance and burn calories." },
                new Workout_Category { Workout_Category_ID = 2, Workout_Category_Name = "Strength", Workout_Category_Description = "Strength training workouts to build muscle and increase strength." },
                new Workout_Category { Workout_Category_ID = 3, Workout_Category_Name = "Flexibility", Workout_Category_Description = "Flexibility workouts to improve range of motion and reduce injury risk." }
            };
            builder.Entity<Workout_Category>().HasData(workoutcategories);


            var workouts = new Workout[]
            {
                    new Workout
                    {
                        Workout_ID = 1,
                        Workout_Name = "Cardio Blast",
                        Workout_Description = "High-intensity cardio workout to burn calories and improve endurance.",
                        Sets = 4,
                        Reps = 10,
                        Workout_Category_ID = 1
                    },
                    new Workout
                    {
                        Workout_ID = 2,
                        Workout_Name = "Strength Training",
                        Workout_Description = "Build muscle strength and endurance.",
                        Sets = 3,
                        Reps = 12,
                        Workout_Category_ID = 2
                    },
                    new Workout
                    {
                        Workout_ID = 3,
                        Workout_Name = "Flexibility Routine",
                        Workout_Description = "Improve your flexibility with this stretching routine.",
                        Sets = 2,
                        Reps = 15,
                        Workout_Category_ID = 3
                    }
            };
            builder.Entity<Workout>().HasData(workouts);


            var Lesson_Plans = new Lesson_Plan[]
            {
                new Lesson_Plan { Lesson_Plan_ID = 1, Program_Name = "Base", Program_Description = "Base program description", }

            };
            builder.Entity<Lesson_Plan>().HasData(Lesson_Plans);


            var orderStatuses = new Order_Status[]
            {
                new Order_Status { Order_Status_ID = 1, Order_Status_Description = "Ready for Collection" },
                new Order_Status { Order_Status_ID = 2, Order_Status_Description = "Overdue for Collection" },
                new Order_Status { Order_Status_ID = 3, Order_Status_Description = "Collected" },
                new Order_Status { Order_Status_ID = 4, Order_Status_Description = "Late Collection" }
            };
            builder.Entity<Order_Status>().HasData(orderStatuses);


            //var Orders = new Order[]
            //{
            //   new Order { Order_ID = 1, Order_Date = new DateTime(2024, 4, 12), Order_Details = "Example order details", Total_Price = 100.00m, Member_ID = 1, Order_Status_ID = 1 }
            //};
            //builder.Entity<Order>().HasData(Orders);


            //var Outstanding_Payments = new Outstanding_Payment[]
            //{
            //   new Outstanding_Payment { Outstanding_Payment_ID = 1, Due_Date = new DateTime(2024, 4, 12), Amount_Due = 50.00m, Late_Fee = 0.00m, Member_ID = 1, Payment_ID = 1 }
            //};
            //builder.Entity<Outstanding_Payment>().HasData(Outstanding_Payments);


            //var Owners = new Owner[]
            //{
            //   new Owner { Owner_ID = 1, User_ID = 1 }
            //};
            //builder.Entity<Owner>().HasData(Owners);



            //var Payments = new Payment[]
            //{
            //  new Payment { Payment_ID = 1, Amount = 50.00m, Payment_Date = new DateTime(2024, 4, 12) }
            //};
            //builder.Entity<Payment>().HasData(Payments);



            //var Products = new Product[]
            //{
            //    new Product { Product_ID = 1, Product_Name = "Gym T-Shirt", Product_Description = "Breathable cotton gym shirt", Product_Img = "gym_tshirt.jpg", Quantity = 50, Unit_Price = 19.99M, Size = "XS", Product_Category_ID = 1, Supplier_ID = 1 },
            //    new Product { Product_ID = 2, Product_Name = "Running Shorts", Product_Description = "Lightweight running shorts", Product_Img = "running_shorts.jpg", Quantity = 40, Unit_Price = 24.99M, Size = "M", Product_Category_ID = 2, Supplier_ID = 1 },
            //    new Product { Product_ID = 3, Product_Name = "Hoodie", Product_Description = "Fleece-lined gym hoodie", Product_Img = "hoodie.jpg", Quantity = 30, Unit_Price = 39.99M, Size = "L", Product_Category_ID = 2, Supplier_ID = 1 },
            //    new Product { Product_ID = 4, Product_Name = "Compression Tights", Product_Description = "High-performance compression tights", Product_Img = "compression_tights.jpg", Quantity = 60, Unit_Price = 29.99M, Size = "S", Product_Category_ID = 2, Supplier_ID = 1 },
            //    new Product { Product_ID = 5, Product_Name = "Gym Tank Top", Product_Description = "Sleeveless tank for workouts", Product_Img = "tank_top.jpg", Quantity = 70, Unit_Price = 15.99M, Size = "M", Product_Category_ID = 1, Supplier_ID = 1 },
            //    new Product { Product_ID = 6, Product_Name = "Sweatpants", Product_Description = "Comfortable gym sweatpants", Product_Img = "sweatpants.jpg", Quantity = 50, Unit_Price = 25.99M, Size = "L", Product_Category_ID = 2, Supplier_ID = 1 },
            //    new Product { Product_ID = 7, Product_Name = "Sports Bra", Product_Description = "Supportive sports bra", Product_Img = "sports_bra.jpg", Quantity = 40, Unit_Price = 19.99M, Size = "S", Product_Category_ID = 1, Supplier_ID = 1 },
            //    new Product { Product_ID = 8, Product_Name = "Gym Leggings", Product_Description = "High-waisted gym leggings", Product_Img = "gym_leggings.jpg", Quantity = 60, Unit_Price = 34.99M, Size = "M", Product_Category_ID = 2, Supplier_ID = 1 }
            //};

            //builder.Entity<Product>().HasData(Products);


            //var prices = new Price[]
            //{
            //    new Price { Price_ID = 1, Unit_Price = 50.00m, Product_ID = 1 }
            //};
            //builder.Entity<Price>().HasData(prices);


            //var OrderLines = new Order_Line[]
            //{
            //    new Order_Line { Order_Line_ID = 1, Order_ID = 1, Product_ID = 1 }

            //};
            //builder.Entity<Order_Line>().HasData(OrderLines);


            //var Received_Supplier_Orders = new Received_Supplier_Order[]
            //{
            //    new Received_Supplier_Order { Received_Supplier_Order_ID = 1, Supplies_Received_Date = new DateTime(20, 04, 10) }
            //};

            //builder.Entity<Received_Supplier_Order>().HasData(Received_Supplier_Orders);



            //var Received_Supplier_Order_Lines = new Received_Supplier_Order_Line[]
            //{
            //    new Received_Supplier_Order_Line { Received_Supplier_Order_Line_ID = 1,Received_Supplier_Order_ID = 1,Supplier_Order_ID = 1,Product_ID = 1,Received_Supplies_Quantity = 10 }
            //};

            //builder.Entity<Received_Supplier_Order_Line>().HasData(Received_Supplier_Order_Lines);

            var Rewards = new Reward[]
            {
                new Reward { Reward_ID = 1, IsPosted = false, Reward_Issue_Date = new DateTime(2024, 4, 10), Reward_Type_ID = 1 }

            };
            builder.Entity<Reward>().HasData(Rewards);

            //var Reward_Members = new Reward_Member[]
            //{
            //    new Reward_Member{ Reward_Member_ID = 1, IsRedeemed = false, Member_ID = 1, Reward_ID = 1}
            //};
            //builder.Entity<Reward_Member>().HasData(Reward_Members);

            var Roles = new Role[]
            {
                new Role{ Id = 1, Name = "Owner", NormalizedName= "OWNER", isEditable = false},
                new Role{ Id = 2, Name = "Employee", NormalizedName= "EMPLOYEE", isEditable =true},
                new Role{ Id = 3, Name = "Member", NormalizedName= "MEMBER", isEditable =true}
            };
            builder.Entity<Role>().HasData(Roles);


            int claimId = 1;
            //Owner Claims
            //for each admin claim
            var ownerClaims = new Claim[]

            {
                new Claim("Booking Manager", "Create"),
                new Claim("Booking Manager", "Read"),
                new Claim("Booking Manager", "Update"),
                new Claim("Booking Manager", "Delete"),

                new Claim("Equipment Manager", "Create"),
                new Claim("Equipment Manager", "Read"),
                new Claim("Equipment Manager", "Update"),
                new Claim("Equipment Manager", "Delete"),

                new Claim("Employee Manager", "Create"),
                new Claim("Employee Manager", "Read"),
                new Claim("Employee Manager", "Update"),
                new Claim("Employee Manager", "Delete"),

                new Claim("Inventory Manager", "Create"),
                new Claim("Inventory Manager", "Read"),
                new Claim("Inventory  Manager", "Update"),
                new Claim("Inventory Manager", "Delete"),

                new Claim("Gym Manager", "Create"),
                new Claim("Gym Manager", "Read"),
                new Claim("Gym  Manager", "Update"),
                new Claim("Gym Manager", "Delete"),
            };
            //create a refrence of it in the Role Claims table
            foreach (var claim in ownerClaims) 
            {
                builder.Entity<IdentityRoleClaim<int>>().HasData(new IdentityRoleClaim<int>
                { 
                   Id = claimId++,
                   RoleId = Roles[0].Id,
                   ClaimType = claim.Type,
                   ClaimValue = claim.Value
                });
            }

            //Employee Claims , they are admin too but just for separation        
            //for each employee claim
            var employeeClaims = new Claim[]
            {
                new Claim("Booking Manager", "Create"),
                new Claim("Booking Manager", "Read"),
                new Claim("Booking Manager", "Update"),
                new Claim("Booking Manager", "Delete"),

                new Claim("Equipment Manager", "Create"),
                new Claim("Equipment Manager", "Read"),
                new Claim("Equipment Manager", "Update"),
                new Claim("Equipment Manager", "Delete"),

                new Claim("Employee Manager", "Read"),
                new Claim("Employee Manager", "Update"),

                new Claim("Inventory Manager", "Create"),
                new Claim("Inventory Manager", "Read"),
                new Claim("Inventory Manager", "Update"),
                new Claim("Inventory Manager", "Delete"),
            };
            //create a refrence of it in the Role Claims table
            foreach (var claim in employeeClaims)
            {
                builder.Entity<IdentityRoleClaim<int>>().HasData(new IdentityRoleClaim<int>
                {
                    Id = claimId++,
                    RoleId = Roles[1].Id,
                    ClaimType = claim.Type,
                    ClaimValue = claim.Value
                });
            }

            var memberClaims = new Claim[]
            {
                new Claim("Booking Interface", "Create"),
                new Claim("Booking Interface", "Read"),
                new Claim("Booking Interface", "Update"),
                new Claim("Booking Interface", "Delete"),

                new Claim("Profile", "Create"),
                new Claim("Profile", "Read"),
                new Claim("Profile", "Update"),

            };
            //create a refrence of it in the Role Claims table
            foreach (var claim in memberClaims)
            {
                builder.Entity<IdentityRoleClaim<int>>().HasData(new IdentityRoleClaim<int>
                {
                    Id = claimId++,
                    RoleId = Roles[2].Id,
                    ClaimType = claim.Type,
                    ClaimValue = claim.Value
                });
            }

            //var Supplier_Orders = new Supplier_Order[]
            //{
            //    new Supplier_Order { Supplier_Order_ID = 1, Date = new DateTime(2024, 4, 10), Supplier_Order_Details = "Ordered 50 units of dumbbells and 20 yoga mats", Total_Price = 1500.00m, Supplier_ID = 1, Owner_ID = 1 }

            //};
            //builder.Entity<Supplier_Order>().HasData(Supplier_Orders);

            //var Supplier_Order_Lines = new Supplier_Order_Line[]
            //{
            //    new Supplier_Order_Line { Supplier_Order_Line_ID = 1, Supplier_Qauntity = 12, Supplier_ID = 1, Product_ID = 1 }

            //};
            //builder.Entity<Supplier_Order_Line>().HasData(Supplier_Order_Lines);

            //var Inventory = new Inventory[]
            //{
            //    new Inventory { Inventory_ID = 1, Inventory_Item_Category = "Clothes", Inventory_Item_Name = "Men's Dry-fit Tops", Inventory_Item_Quantity = 20, Inventory_Item_Photo = "dry_fit_tops.jpg", Received_Supplier_Order_ID = 1, Supplier_ID = 1 }

            //};
            //builder.Entity<Inventory>().HasData(Inventory);

            var Equipments = new Equipment[]
            {
                
                 new Equipment{ Equipment_ID = 1, Equipment_Name = "Treadmill", Equipment_Description = "A motorized device used for running or walking while staying in one place." }
                
            };
            builder.Entity<Equipment>().HasData(Equipments);

            var Inspections = new Inspection[]
            {
                new Inspection { Inspection_ID = 1, Inspection_Date = new DateTime(2024, 4, 12),Inspection_Notes = "Holes in AVS pants" , Equipment_ID = 1,  Inspection_Type_ID = 1, Inspection_Status_ID = 1 }

            };
            builder.Entity<Inspection>().HasData(Inspections);

            var Booking_Time_Slots = new Booking_Time_Slot[]
            {
                new Booking_Time_Slot{Booking_Time_Slot_ID = 1, Booking_ID = 1,Time_Slot_ID = 1}
            };
            builder.Entity<Booking_Time_Slot>();


            //var Time_Slots = new Time_Slot[]
            //{

            //    new Time_Slot{Time_Slot_ID = 1,Slot_Date =  new DateTime(2024, 4, 12)  , Slot_Time = DateTime.Parse("11:00:00"), Availability = true, Lesson_Plan_ID= 1, Employee_ID=1}

            //};
            //builder.Entity<Time_Slot>().HasData(Time_Slots);


            //var Write_Offs = new Write_Off[]
            //{
            //    new Write_Off { Write_Off_ID = 1, Date = new DateTime(2024, 4, 12), Write_Off_Reason = "Expired items", Inventory_ID = 1 }

            //};
            //builder.Entity<Write_Off>().HasData(Write_Offs);


            var lessonPlanWorkOuts = new Lesson_Plan_Workout[]
            {
                new Lesson_Plan_Workout {Lesson_Plan_Workout_ID =1, Lesson_Plan_ID = 1, Workout_ID = 1}
            };
            builder.Entity<Lesson_Plan_Workout>().HasData(lessonPlanWorkOuts);

        }

    }
}

$("[data-lenis-start]").on("click", function () {
  lenis.start();
});
$("[data-lenis-stop]").on("click", function () {
  lenis.stop();
});
$("[data-lenis-toggle]").on("click", function () {
  $(this).toggleClass("stop-scroll");
  if ($(this).hasClass("stop-scroll")) {
    lenis.stop();
  } else {
    lenis.start();
  }
});
<script src="https://cdn.jsdelivr.net/gh/studio-freight/lenis@1.0.23/bundled/lenis.min.js"></script> 
<script>
// LENIS SMOOTH SCROLL
let lenis;
if (Webflow.env("editor") === undefined) {
  lenis = new Lenis({
    lerp: 0.1,
    wheelMultiplier: 0.7,
    gestureOrientation: "vertical",
    normalizeWheel: false,
    smoothTouch: false
  });
  function raf(time) {
    lenis.raf(time);
    requestAnimationFrame(raf);
  }
  requestAnimationFrame(raf);
}
</script>
<script src="https://cdn.jsdelivr.net/gh/studio-freight/lenis@1.0.23/bundled/lenis.min.js"></script> 
<script>
// LENIS SMOOTH SCROLL
let lenis;
if (Webflow.env("editor") === undefined) {
  lenis = new Lenis({
    lerp: 0.1,
    wheelMultiplier: 0.7,
    gestureOrientation: "vertical",
    normalizeWheel: false,
    smoothTouch: false
  });
  function raf(time) {
    lenis.raf(time);
    requestAnimationFrame(raf);
  }
  requestAnimationFrame(raf);
}
</script>
<style>
html.lenis {
  height: auto;
}
.lenis.lenis-smooth {
  scroll-behavior: auto;
}
.lenis.lenis-smooth [data-lenis-prevent] {
  overscroll-behavior: contain;
}
.lenis.lenis-stopped {
  overflow: hidden;
}
</style>
@extends('new_layouts.app')
@section('styles')
    <style>
        .modal-icon {
            font-size: 3rem;
            color: #dc3545;
        }

        .modal-body {
            padding: 2rem;
        }

        .modal-title {
            font-size: 1.25rem;
            margin-top: 1rem;
        }

        .modal-body p {
            font-size: 1rem;
            margin-top: 0.5rem;
        }

        .custom-table {
            border-collapse: collapse;
            border-radius: 1rem;
            border-style: hidden;
            box-shadow: 0 0 0 1px #e6ebef;
            overflow: hidden;
            text-align: left;
            width: 100%;
        }

        .badge-file-extension {
            background-color: #f25961;
            color: white;
            padding: 0.25rem 0.5rem;
            font-size: 0.875rem;
            border-radius: 0.375rem;
            margin-left: 0.5rem;
        }

        .bookmark-active svg {
            fill: #FF9800;
        }

        .description-text {
            font-size: 1.1rem;
            color: #555;
            margin-top: 0.5rem;
        }

        .comment {
            margin-top: 1rem;
            margin-bottom: 1rem;
        }

        .comment-section {
            border: 1px solid #e9ebee;
            border-radius: 1rem;
            padding: 1.5rem;
            background-color: #ffffff;
            /* box-shadow: 0 0 1rem rgba(0, 0, 0, 0.1); */
        }

        .comment-header {
            border-bottom: 1px solid #e9ebee;
            padding-bottom: 0.75rem;
            margin-bottom: 1rem;
        }

        .comment-avatar {
            height: 48px;
            width: 48px;
            border-radius: 50%;
            margin-right: 1rem;
        }

        .comment-author {
            font-size: 1rem;
            font-weight: 600;
        }

        .comment-time {
            font-size: 0.875rem;
            color: #90949c;
        }

        .comment-body {
            margin: 0.75rem 0;
            font-size: 1rem;
        }

        .comment-actions a {
            font-size: 0.875rem;
            color: #4267b2;
            text-decoration: none;
            margin-right: 1rem;
        }

        .comment-actions i {
            margin-right: 0.5rem;
        }

        .reply-list {
            margin-top: 1rem;
            padding-left: 2rem;
        }

        .reply-list .comment {
            border-left: 1px dotted #d3d6db;
            padding-left: 1rem;
            margin-top: 1rem;
        }

        .reply-toggle {
            cursor: pointer;
            font-size: 0.875rem;
            color: #4267b2;
            text-decoration: none;
            margin-top: 1rem;
            display: block;
        }

        .reply-form {
            display: none;
            position: relative;
            z-index: 10;
        }

        .comment-input {
            border-radius: 0.5rem;
        }

        .like-button.active i {
            color: #4caf50;
        }

        .dislike-button.active i {
            color: #dc3545;
        }


        /* Dropdown Styles */
        .dropdown-toggle::after {
            display: none;
            /* Remove the default arrow */
        }

        .dropdown-menu {
            right: 0;
            left: auto;
        }
    </style>
@endsection
@section('content')
    <div class="container">

        <div>
            <div class="d-flex flex-column">
                <h1>Title: {{ $material->title }}</h1>
                @if ($material->description)
                    <p class="description-text"><strong>Description:</strong> {{ $material->description }}</p>
                @endif
            </div>

            <div class="d-flex justify-content-end mb-4">
                <a class="btn rounded-3" style="background-color: #4CAF50; color: white"
                    href="{{ route('materials.downloadAll', $material) }}">
                    <i class="fas fa-download me-1"></i> Download All
                </a>
            </div>

            <div class="table-responsive">
                <table class="table table-striped custom-table">
                    <thead>
                        <tr>
                            <th scope="col">Bookmarks</th>
                            <th scope="col">Document</th>
                            <th scope="col">Action</th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach ($files as $file)
                            <tr>
                                <td>
                                    @php
                                        $isBookmarked = $file->bookmarks()->where('user_id', Auth::id())->exists();
                                    @endphp
                                    <button type="button"
                                        class="btn btn-outline-dark bookmark-toggle {{ $isBookmarked ? 'bookmark-active' : '' }}"
                                        data-file-id="{{ $file->id }}">
                                        @if ($isBookmarked)
                                            <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"
                                                fill="currentColor" class="bi bi-bookmarks-fill" viewBox="0 0 16 16">
                                                <path
                                                    d="M2 4a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v11.5a.5.5 0 0 1-.777.416L7 13.101l-4.223 2.815A.5.5 0 0 1 2 15.5z" />
                                                <path
                                                    d="M4.268 1A2 2 0 0 1 6 0h6a2 2 0 0 1 2 2v11.5a.5.5 0 0 1-.777.416L13 13.768V2a1 1 0 0 0-1-1z" />
                                            </svg>
                                        @else
                                            <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"
                                                fill="currentColor" class="bi bi-bookmarks" viewBox="0 0 16 16">
                                                <path
                                                    d="M2 4a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v11.5a.5.5 0 0 1-.777.416L7 13.101l-4.223 2.815A.5.5 0 0 1 2 15.5zm2-1a1 1 0 0 0-1 1v10.566l3.723-2.482a.5.5 0 0 1 .554 0L11 14.566V4a1 1 0 0 0-1-1z" />
                                                <path
                                                    d="M4.268 1H12a1 1 0 0 1 1 1v11.768l.223.148A.5.5 0 0 0 14 13.5V2a2 2 0 0 0-2-2H6a2 2 0 0 0-1.732 1" />
                                            </svg>
                                        @endif
                                        <span class="visually-hidden">Button</span>
                                    </button>
                                </td>
                                <td>
                                    <div>
                                        @php
                                            $extension = pathinfo($file->name, PATHINFO_EXTENSION);
                                        @endphp
                                        <i class="fa-solid fa-file-lines" style="color: #0068b8; margin-right: 5px;"></i>
                                        <a href="{{ Storage::url($file->path) }}" target="_blank">
                                            {{ pathinfo($file->name, PATHINFO_FILENAME) }}
                                        </a>
                                        <span>
                                            <span class="badge badge-file-extension">
                                                {{ strtoupper($extension) }} File
                                            </span>
                                        </span>
                                    </div>
                                </td>
                                <td>
                                    <a class="btn btn-primary rounded-pill" href="{{ Storage::url($file->path) }}" download>
                                        <i class="fas fa-download me-1"></i> Download
                                    </a>
                                </td>
                            </tr>
                        @endforeach
                    </tbody>
                </table>
            </div>
        </div>


        <div class="mt-4 comment-section">
            <h3>Comments ( {{ $comments->count() }} )</h3>
            <div class="comment-header d-flex justify-content-between align-items-center">
            </div>
            <div class="comment-body">
                <div class="d-flex mb-3">
                    <img src="https://static.xx.fbcdn.net/rsrc.php/v1/yi/r/odA9sNLrE86.jpg" alt="avatar"
                        class="comment-avatar">
                    <div class="w-100">
                        <form id="comment-form" action="{{ route('comments.store', $material) }}" method="POST">
                            @csrf
                            <div class="d-flex flex-column">
                                <textarea name="content" class="form-control comment-input" placeholder="Write a comment..." rows="3"></textarea>
                                <div class="d-flex justify-content-between mt-2">
                                    <div id="comment-form-error" class="text-danger"></div>
                                    <button type="submit" class="btn btn-primary">Post Comment</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
                <div id="comment-list" class="comment-list">
                    @foreach ($comments as $comment)
                        <div class="comment" data-comment-id="{{ $comment->id }}">
                            <div class="d-flex">
                                <img src="https://static.xx.fbcdn.net/rsrc.php/v1/yi/r/odA9sNLrE86.jpg" alt="avatar"
                                    class="comment-avatar">
                                <div class="w-100">
                                    <div class="d-flex justify-content-between align-items-start">
                                        <div>
                                            <div class="comment-author">{{ $comment->user->name }}</div>
                                            <div class="comment-time">{{ $comment->created_at->diffForHumans() }}</div>
                                        </div>
                                        @if ($comment->user_id === auth()->id())
                                            <div class="dropdown">
                                                <button class="btn btn-link dropdown-toggle" type="button"
                                                    id="dropdownMenuButton{{ $comment->id }}" data-bs-toggle="dropdown"
                                                    aria-expanded="false">
                                                    <i class="fa-solid fa-ellipsis-vertical"></i>
                                                </button>
                                                <ul class="dropdown-menu"
                                                    aria-labelledby="dropdownMenuButton{{ $comment->id }}">
                                                    <li><a class="dropdown-item" href="#" data-action="edit"
                                                            data-comment-id="{{ $comment->id }}">Edit</a></li>
                                                    <li><a class="dropdown-item text-danger" href="#"
                                                            data-action="delete"
                                                            data-comment-id="{{ $comment->id }}">Delete</a></li>
                                                </ul>
                                            </div>
                                        @endif
                                    </div>
                                    <div class="comment-body">{{ $comment->content }}</div>
                                    <div class="comment-actions">
                                        <a href="#"
                                            class="like-button {{ $comment->likes()->where('user_id', auth()->id())->exists() ? 'active' : '' }}"
                                            data-action="like" data-comment-id="{{ $comment->id }}">
                                            <i class="fa-solid fa-thumbs-up"></i>
                                            <span class="like-dislike-count">{{ $comment->likes }}</span>
                                        </a>
                                        <a href="#"
                                            class="dislike-button {{ $comment->dislikes()->where('user_id', auth()->id())->exists() ? 'active' : '' }}"
                                            data-action="dislike" data-comment-id="{{ $comment->id }}">
                                            <i class="fa-solid fa-thumbs-down"></i>
                                            <span class="like-dislike-count">{{ $comment->dislikes }}</span>
                                        </a>
                                        <a href="#" class="reply-link" data-comment-id="{{ $comment->id }}"
                                            data-author="{{ $comment->user->name }}">
                                            <i class="fa-solid fa-reply"></i> Reply
                                        </a>
                                    </div>
                                    <div class="reply-toggle" onclick="toggleReplies(this)">View replies</div>

                                    <form class="reply-form" action="{{ route('replies.store', $comment) }}"
                                        method="POST">
                                        @csrf
                                        <div class="d-flex flex-column">
                                            <textarea name="content" class="form-control comment-input" placeholder="Write a reply..." rows="2"></textarea>
                                            <div class="d-flex justify-content-between mt-2">
                                                <div id="reply-form-error" class="text-danger"></div>
                                                <button type="submit" class="btn btn-primary ms-auto">Post Reply</button>
                                            </div>
                                        </div>

                                    </form>
                                    <div class="reply-list" style="display: none;">
                                        @foreach ($comment->replies as $reply)
                                            <div class="comment reply" data-comment-id="{{ $reply->id }}">
                                                <div class="d-flex">
                                                    <img src="https://static.xx.fbcdn.net/rsrc.php/v1/yi/r/odA9sNLrE86.jpg"
                                                        alt="avatar" class="comment-avatar">
                                                    <div class="w-100">
                                                        <div class="d-flex justify-content-between align-items-start">
                                                            <div>
                                                                <div class="comment-author">{{ $reply->user->name }}</div>
                                                                <div class="comment-time">
                                                                    {{ $reply->created_at->diffForHumans() }}</div>
                                                            </div>
                                                            @if ($reply->user_id === auth()->id())
                                                                <div class="dropdown">
                                                                    <button class="btn btn-link dropdown-toggle"
                                                                        type="button"
                                                                        id="dropdownMenuButton{{ $reply->id }}"
                                                                        data-bs-toggle="dropdown" aria-expanded="false">
                                                                        <i class="fa-solid fa-ellipsis-vertical"></i>
                                                                    </button>
                                                                    <ul class="dropdown-menu"
                                                                        aria-labelledby="dropdownMenuButton{{ $reply->id }}">
                                                                        <li><a class="dropdown-item" href="#"
                                                                                data-action="edit"
                                                                                data-comment-id="{{ $reply->id }}">Edit</a>
                                                                        </li>
                                                                        <li><a class="dropdown-item text-danger"
                                                                                href="#" data-action="delete"
                                                                                data-comment-id="{{ $reply->id }}">Delete</a>
                                                                        </li>
                                                                    </ul>
                                                                </div>
                                                            @endif
                                                        </div>
                                                        <div class="comment-body">
                                                            @if ($reply->parent)
                                                                <a href="#"
                                                                    class="reply-mention">{{ '@' . $reply->parent->user->name }}</a>
                                                            @endif
                                                            <span class="reply-content">{{ $reply->content }}</span>
                                                        </div>
                                                        <div class="comment-actions">
                                                            <a href="#"
                                                                class="like-button {{ $reply->likes()->where('user_id', auth()->id())->exists() ? 'active' : '' }}"
                                                                data-action="like" data-comment-id="{{ $reply->id }}">
                                                                <i class="fa-solid fa-thumbs-up"></i>
                                                                <span
                                                                    class="like-dislike-count">{{ $reply->likes }}</span>
                                                            </a>
                                                            <a href="#"
                                                                class="dislike-button {{ $reply->dislikes()->where('user_id', auth()->id())->exists() ? 'active' : '' }}"
                                                                data-action="dislike"
                                                                data-comment-id="{{ $reply->id }}">
                                                                <i class="fa-solid fa-thumbs-down"></i>
                                                                <span
                                                                    class="like-dislike-count">{{ $reply->dislikes }}</span>
                                                            </a>
                                                            <a href="#" class="reply-link"
                                                                data-comment-id="{{ $reply->id }}"
                                                                data-author="{{ $reply->user->name }}">
                                                                <i class="fa-solid fa-reply"></i> Reply
                                                            </a>
                                                        </div>
                                                        <form class="reply-form"
                                                            action="{{ route('replies.store', $reply) }}" method="POST">
                                                            @csrf
                                                            <div class="d-flex flex-column">
                                                                <textarea name="content" class="form-control comment-input" placeholder="Write a reply..." rows="2"></textarea>
                                                                <div class="d-flex justify-content-between mt-2">
                                                                    <div id="reply-form-error" class="text-danger"></div>
                                                                    <button type="submit"
                                                                        class="btn btn-primary ms-auto">Post Reply</button>
                                                                </div>
                                                            </div>

                                                        </form>
                                                    </div>
                                                </div>
                                            </div>
                                            @include('materials.comment', ['replies' => $reply->replies])
                                        @endforeach
                                    </div>
                                </div>
                            </div>
                        </div>
                    @endforeach
                </div>
            </div>
        </div>
    </div>
    <!-- delete model -->
    <div class="modal fade" id="deleteModal" tabindex="-1" aria-labelledby="deleteModalLabel" aria-hidden="true">
        <div class="modal-dialog modal-dialog-centered">
            <div class="modal-content">
                <div class="modal-body text-center">
                    <div class="mb-3">
                        <i class="fa-solid fa-triangle-exclamation modal-icon"></i>
                    </div>
                    <h5 class="modal-title" id="deleteModalLabel">Delete Comment</h5>
                    <p>Are you sure you want to delete this comment?</p>
                </div>
                <div class="modal-footer d-flex justify-content-center">
                    <button type="button" class="btn btn-danger ms-2" id="confirmDelete">Delete</button>
                    <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
                </div>
            </div>
        </div>
    </div>
@endsection


@section('scripts')
    <script>
        document.addEventListener('DOMContentLoaded', function() {
            const commentForm = document.getElementById('comment-form');
            const replyForms = document.querySelectorAll('.reply-form');

            commentForm.addEventListener('submit', function(e) {
                const content = this.querySelector('textarea[name="content"]').value.trim();
                if (content === '') {
                    e.preventDefault();
                    document.getElementById('comment-form-error').innerText =
                        'Error: Comment cannot be empty';
                }
            });

            replyForms.forEach(function(replyForm) {
                replyForm.addEventListener('submit', function(e) {
                    const content = this.querySelector('textarea[name="content"]').value.trim();
                    if (content === '') {
                        e.preventDefault();
                        this.querySelector('#reply-form-error').innerText =
                            'Error: Reply cannot be empty';
                    }
                });
            });

            const commentList = document.getElementById('comment-list');

            // Handle edit button click
            commentList.addEventListener('click', function(event) {
                const button = event.target.closest('a[data-action="edit"]');
                if (button) {
                    event.preventDefault();
                    const commentId = button.getAttribute('data-comment-id');
                    const commentElement = document.querySelector(
                        `.comment[data-comment-id="${commentId}"]`);
                    const commentBodyElement = commentElement.querySelector('.comment-body');

                    // Extract mention and content
                    const mentionElement = commentBodyElement.querySelector('.reply-mention');
                    const mention = mentionElement ? mentionElement.innerText.trim() : '';
                    const contentElement = mentionElement ? mentionElement.nextElementSibling :
                        commentBodyElement;
                    const content = contentElement.innerText.trim();

                    // Store original content for cancel action
                    commentBodyElement.dataset.originalContent = commentBodyElement.innerHTML;

                    const editForm = `
                        <form class="edit-comment-form" data-comment-id="${commentId}">
                            ${mention ? `<span class="reply-mention">${mention}</span>` : ''}
                            <textarea class="form-control">${content}</textarea>
                            <div class="d-flex justify-content-between mt-2">
                                <div id="edit-comment-form-error" class="text-danger"></div>
                                <div>
                                    <button type="submit" class="btn btn-primary">Save</button>
                                    <button type="button" class="btn btn-secondary cancel-edit">Cancel</button>
                                </div>
                            </div>
                        </form>
                    `;

                    commentBodyElement.innerHTML = editForm;
                    attachEditFormListeners(commentId);
                }
            });

            function attachEditFormListeners(commentId) {
                const editForm = document.querySelector(`.edit-comment-form[data-comment-id="${commentId}"]`);

                editForm.addEventListener('submit', function(e) {
                    e.preventDefault();
                    const textarea = this.querySelector('textarea');
                    const content = textarea.value.trim();
                    const mention = this.querySelector('.reply-mention') ? this.querySelector(
                        '.reply-mention').innerText.trim() : '';

                    if (content === '') {
                        this.querySelector('#edit-comment-form-error').innerText =
                            'Error: Comment cannot be empty';
                        return;
                    }

                    fetch(`/comments/${commentId}`, {
                            method: 'PUT',
                            headers: {
                                'Content-Type': 'application/json',
                                'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]')
                                    .getAttribute('content')
                            },
                            body: JSON.stringify({
                                content
                            })
                        })
                        .then(response => response.json())
                        .then(data => {
                            if (data.success) {
                                const commentBodyElement = document.querySelector(
                                    `.comment[data-comment-id="${commentId}"] .comment-body`);
                                const mentionElement = mention ?
                                    `<a href="#" class="reply-mention">${mention}</a>` : '';
                                commentBodyElement.innerHTML =
                                    `${mentionElement} <span class="reply-content">${data.content}</span>`;
                            } else {
                                alert('Error updating comment.');
                            }
                        })
                        .catch(error => {
                            console.error('Error:', error);
                        });
                });

                editForm.querySelector('.cancel-edit').addEventListener('click', function() {
                    const originalContent = document.querySelector(
                            `.comment[data-comment-id="${commentId}"] .comment-body`).dataset
                        .originalContent;
                    document.querySelector(`.comment[data-comment-id="${commentId}"] .comment-body`)
                        .innerHTML = originalContent;
                });
            }
        });
    </script>

    <script>
        document.addEventListener('DOMContentLoaded', function() {

            // for delete 
            document.getElementById('comment-list').addEventListener('click', function(event) {
                const button = event.target.closest('a[data-action="delete"]');
                if (button) {
                    event.preventDefault();

                    const commentId = button.getAttribute('data-comment-id');
                    const deleteModal = new bootstrap.Modal(document.getElementById('deleteModal'));

                    document.getElementById('confirmDelete').onclick = function() {
                        fetch(`/comments/${commentId}`, {
                                method: 'DELETE',
                                headers: {
                                    'X-Requested-With': 'XMLHttpRequest',
                                    'X-CSRF-TOKEN': document.querySelector(
                                        'meta[name="csrf-token"]').getAttribute('content'),
                                    'Content-Type': 'application/json',
                                }
                            })
                            .then(response => response.json())
                            .then(data => {
                                if (data.success) {
                                    const commentElement = document.querySelector(
                                        `.comment[data-comment-id="${commentId}"]`);
                                    if (commentElement) {
                                        commentElement.remove();
                                    }
                                    deleteModal.hide();
                                } else {
                                    alert(data.message || 'Error deleting comment');
                                }
                            })
                            .catch(error => {
                                console.error('Error:', error);
                                alert('Something went wrong');
                            });
                    };

                    deleteModal.show();
                }
            });


            // for like and dislike
            document.getElementById('comment-list').addEventListener('click', function(event) {
                const button = event.target.closest('a');
                if (button && (button.classList.contains('like-button') || button.classList.contains(
                        'dislike-button'))) {
                    event.preventDefault();

                    const commentId = button.getAttribute('data-comment-id');
                    const action = button.getAttribute('data-action');

                    fetch(`/comments/${commentId}/${action}`, {
                            method: 'POST',
                            headers: {
                                'X-Requested-With': 'XMLHttpRequest',
                                'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]')
                                    .getAttribute('content'),
                                'Content-Type': 'application/json',
                            },
                            body: JSON.stringify({
                                _method: 'POST'
                            })
                        })
                        .then(response => response.json())
                        .then(data => {
                            if (data.success) {
                                const commentElement = document.querySelector(
                                    `.comment[data-comment-id="${commentId}"]`);
                                const likeCount = commentElement.querySelector(
                                    '.like-button .like-dislike-count');
                                const dislikeCount = commentElement.querySelector(
                                    '.dislike-button .like-dislike-count');

                                likeCount.textContent = data.comment.likes;
                                dislikeCount.textContent = data.comment.dislikes;

                                if (action === 'like') {
                                    button.classList.toggle('active');
                                    commentElement.querySelector('.dislike-button').classList.remove(
                                        'active');
                                } else {
                                    button.classList.toggle('active');
                                    commentElement.querySelector('.like-button').classList.remove(
                                        'active');
                                }
                            } else {
                                alert(data.message || 'Error updating like/dislike');
                            }
                        })
                        .catch(error => {
                            console.error('Error:', error);
                            alert('Something went wrong');
                        });
                }
            });

            // For submission of the main comment form
            document.getElementById('comment-form')?.addEventListener('submit', function(event) {
                event.preventDefault();
                const formData = new FormData(this);
                const errorDiv = document.getElementById('comment-form-error');
                errorDiv.textContent = ''; // Clear previous errors

                fetch(this.action, {
                        method: 'POST',
                        body: formData,
                        headers: {
                            'X-Requested-With': 'XMLHttpRequest',
                            'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]')
                                .getAttribute('content')
                        }
                    })
                    .then(response => response.json())
                    .then(data => {
                        if (data.success) {
                            const commentList = document.getElementById('comment-list');
                            if (commentList) {
                                const newCommentHtml = `
                            <div class="comment" data-comment-id="${data.comment.id}">
                                <div class="d-flex">
                                    <img src="https://static.xx.fbcdn.net/rsrc.php/v1/yi/r/odA9sNLrE86.jpg" alt="avatar" class="comment-avatar">
                                    <div class="w-100">
                                        <div class="d-flex justify-content-between align-items-start">
                                            <div>
                                                <div class="comment-author">${data.comment.user_name}</div>
                                                <div class="comment-time">${data.comment.created_at}</div>
                                            </div>
                                            <div class="dropdown">
                                                <button class="btn btn-link dropdown-toggle" type="button"
                                                    id="dropdownMenuButton${data.comment.id}" data-bs-toggle="dropdown"
                                                    aria-expanded="false">
                                                    <i class="fa-solid fa-ellipsis-vertical"></i>
                                                </button>
                                                <ul class="dropdown-menu" aria-labelledby="dropdownMenuButton${data.comment.id}">
                                                    <li><a class="dropdown-item" href="#" data-action="edit" data-comment-id="${data.comment.id}">Edit</a></li>
                                                    <li><a class="dropdown-item text-danger" href="#" data-action="delete" data-comment-id="${data.comment.id}">Delete</a></li>
                                                </ul>
                                            </div>
                                        </div>
                                        <div class="comment-body">${data.comment.content}</div>
                                        <div class="comment-actions">
                                            <a href="#" class="like-button" data-action="like" data-comment-id="${data.comment.id}">
                                                <i class="fa-solid fa-thumbs-up"></i>
                                                <span class="like-dislike-count">0</span>
                                            </a>
                                            <a href="#" class="dislike-button" data-action="dislike" data-comment-id="${data.comment.id}">
                                                <i class="fa-solid fa-thumbs-down"></i>
                                                <span class="like-dislike-count">0</span>
                                            </a>
                                            <a href="#" class="reply-link" data-comment-id="${data.comment.id}" data-author="${data.comment.user_name}">
                                                <i class="fa-solid fa-reply"></i> Reply
                                            </a>
                                        </div>
                                        <div class="reply-toggle" onclick="toggleReplies(this)">View replies</div>
                                        <form class="reply-form" action="{{ route('replies.store', ':commentId') }}" method="POST" style="display: none;">
                                            @csrf
                                            <div class="d-flex flex-column">
                                                <textarea name="content" class="form-control comment-input" placeholder="Write a reply..." rows="2"></textarea>
                                                <div class="d-flex justify-content-between  mt-2">
                                                    <div id="comment-form-error" class="text-danger" style="display: none;">
                                                        Error: Reply cannot be empty
                                                    </div>
                                                    <button type="submit" class="btn btn-primary ms-auto">Post Reply</button>
                                                </div>
                                            </div>
                                        </form>
                                        <div class="reply-list" style="display: none;"></div>
                                    </div>
                                </div>
                            </div>
                        `.replace(':commentId', data.comment.id);

                                commentList.insertAdjacentHTML('afterbegin', newCommentHtml);
                                this.reset();
                                initializeDropdowns();
                            }
                        } else {
                            // Display error messages
                            errorDiv.textContent = data.error || 'Your comment is empty';
                        }
                    })
                    .catch(error => {
                        console.error('Error:', error);
                        errorDiv.textContent = 'Something went wrong';
                    });
            });

            // For submission of reply forms
            document.getElementById('comment-list')?.addEventListener('submit', function(event) {
                if (event.target.closest('.reply-form')) {
                    event.preventDefault();
                    const form = event.target;
                    const formData = new FormData(form);
                    const parentId = form.closest('.comment').dataset.commentId;
                    const errorDiv = form.querySelector('#comment-form-error');

                    // Reset error display
                    errorDiv.style.display = 'none';
                    errorDiv.textContent = '';

                    fetch(form.action.replace(':commentId', parentId), {
                            method: 'POST',
                            body: formData,
                            headers: {
                                'X-Requested-With': 'XMLHttpRequest',
                                'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]')
                                    .getAttribute('content')
                            }
                        })
                        .then(response => response.json())
                        .then(data => {
                            if (data.success) {
                                const replyList = form.closest('.reply-list') || form.closest(
                                    '.comment').querySelector('.reply-list');
                                if (replyList) {
                                    const newReplyHtml = `
                                <div class="comment reply" data-comment-id="${data.reply.id}">
                                    <div class="d-flex">
                                        <img src="https://static.xx.fbcdn.net/rsrc.php/v1/yi/r/odA9sNLrE86.jpg" alt="avatar" class="comment-avatar">
                                        <div class="w-100">
                                            <div class="d-flex justify-content-between align-items-start">
                                                <div>
                                                    <div class="comment-author">${data.reply.user_name}</div>
                                                    <div class="comment-time">${data.reply.created_at}</div>
                                                </div>
                                                <div class="dropdown">
                                                    <button class="btn btn-link dropdown-toggle" type="button" id="dropdownMenuButton${data.reply.id}" data-bs-toggle="dropdown" aria-expanded="false">
                                                        <i class="fa-solid fa-ellipsis-vertical"></i>
                                                    </button>
                                                    <ul class="dropdown-menu" aria-labelledby="dropdownMenuButton${data.reply.id}">
                                                        <li><a class="dropdown-item" href="#" data-action="edit" data-comment-id="${data.reply.id}">Edit</a></li>
                                                        <li><a class="dropdown-item text-danger" href="#" data-action="delete" data-comment-id="${data.reply.id}">Delete</a></li>
                                                    </ul>
                                                </div>
                                            </div>
                                            <div class="comment-body">
                                                ${data.reply.parent_name ? `<a href="#" class="reply-mention">@${data.reply.parent_name}</a> ` : ''}
                                                <span class="reply-content">${data.reply.content}</span>
                                            </div>
                                            <div class="comment-actions">
                                                <a href="#" class="like-button" data-action="like" data-comment-id="${data.reply.id}">
                                                    <i class="fa-solid fa-thumbs-up"></i>
                                                    <span class="like-dislike-count">0</span>
                                                </a>
                                                <a href="#" class="dislike-button" data-action="dislike" data-comment-id="${data.reply.id}">
                                                    <i class="fa-solid fa-thumbs-down"></i>
                                                    <span class="like-dislike-count">0</span>
                                                </a>
                                                <a href="#" class="reply-link" data-comment-id="${data.reply.id}" data-author="${data.reply.user_name}">
                                                    <i class="fa-solid fa-reply"></i> Reply
                                                </a>
                                            </div>
                                            <form class="reply-form" action="{{ route('replies.store', ':commentId') }}" method="POST" style="display: none;">
                                                @csrf
                                                    <div class="d-flex flex-column">
                                                        <textarea name="content" class="form-control comment-input" placeholder="Write a reply..." rows="2"></textarea>
                                                        <div class="d-flex justify-content-between  mt-2">
                                                            <div id="comment-form-error" class="text-danger" style="display: none;">
                                                                Error: Reply cannot be empty
                                                            </div>
                                                            <button type="submit" class="btn btn-primary ms-auto">Post Reply</button>
                                                        </div>
                                                    </div>
                                            </form>
                                            <div class="reply-list" style="display: none;"></div>
                                        </div>
                                    </div>
                                </div>
                                `.replace(':commentId', data.reply.id);

                                    replyList.insertAdjacentHTML('beforeend', newReplyHtml);
                                    form.reset();
                                    form.style.display =
                                        'none'; 

                                    // Ensure the replies are displayed
                                    const replyToggle = form.closest('.comment').querySelector(
                                        '.reply-toggle');
                                    if (replyToggle) {
                                        const replyList = replyToggle.nextElementSibling
                                            .nextElementSibling;
                                        replyList.style.display = 'block';
                                        replyToggle.textContent = 'Hide replies';
                                    }

                                    initializeDropdowns();
                                }
                            } else {
                                // Display error message
                                errorDiv.textContent = data.message || 'Error posting reply';
                                errorDiv.style.display = 'block';
                            }
                        })
                        .catch(error => {
                            console.error('Error:', error);
                            // Display error message
                            errorDiv.textContent = 'Something went wrong';
                            errorDiv.style.display = 'block';
                        });
                }
            });

            // For reply link click to show reply form
            document.getElementById('comment-list')?.addEventListener('click', function(event) {
                if (event.target.closest('.reply-link')) {
                    event.preventDefault();
                    const replyForm = event.target.closest('.comment').querySelector('.reply-form');
                    if (replyForm) {
                        replyForm.style.display = replyForm.style.display === 'block' ? 'none' : 'block';
                    }
                }
            });
        });

        function initializeDropdowns() {
            const dropdowns = document.querySelectorAll('.dropdown-toggle:not(.initialized)');
            dropdowns.forEach(dropdown => {
                new bootstrap.Dropdown(dropdown);
                dropdown.classList.add('initialized');
            });
        }

        function toggleReplies(element) {
            const replyList = element.nextElementSibling.nextElementSibling;
            const isVisible = replyList.style.display === 'block';
            replyList.style.display = isVisible ? 'none' : 'block';
            element.textContent = isVisible ? 'View replies' : 'Hide replies';
        }
    </script>

    <script>
        document.addEventListener('DOMContentLoaded', function() {
            document.querySelectorAll('.bookmark-toggle').forEach(function(button) {
                button.addEventListener('click', function() {
                    const fileId = this.getAttribute('data-file-id');
                    const button = this;

                    fetch("{{ route('bookmark.toggle') }}", {
                            method: 'POST',
                            headers: {
                                'Content-Type': 'application/json',
                                'X-CSRF-TOKEN': '{{ csrf_token() }}'
                            },
                            body: JSON.stringify({
                                file_id: fileId
                            })
                        })
                        .then(response => response.json())
                        .then(data => {
                            if (data.status === 'added') {
                                button.classList.add('bookmark-active');
                                button.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor"
                                        class="bi bi-bookmarks-fill" viewBox="0 0 16 16">
                                        <path d="M2 4a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v11.5a.5.5 0 0 1-.777.416L7 13.101l-4.223 2.815A.5.5 0 0 1 2 15.5z"/>
                                        <path d="M4.268 1A2 2 0 0 1 6 0h6a2 2 0 0 1 2 2v11.5a.5.5 0 0 1-.777.416L13 13.768V2a1 1 0 0 0-1-1z"/>
                                    </svg>`;
                            } else if (data.status === 'removed') {
                                button.classList.remove('bookmark-active');
                                button.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor"
                                        class="bi bi-bookmarks" viewBox="0 0 16 16">
                                        <path d="M2 4a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v11.5a.5.5 0 0 1-.777.416L7 13.101l-4.223 2.815A.5.5 0 0 1 2 15.5zm2-1a1 1 0 0 0-1 1v10.566l3.723-2.482a.5.5 0 0 1 .554 0L11 14.566V4a1 1 0 0 0-1-1z"/>
                                        <path d="M4.268 1H12a1 1 0 0 1 1 1v11.768l.223.148A.5.5 0 0 0 14 13.5V2a2 2 0 0 0-2-2H6a2 2 0 0 0-1.732 1"/>
                                    </svg>`;
                            }
                        })
                        .catch(error => console.error('Error:', error));
                });
            });
        });
    </script>
@endsection
Embark on a lucrative journey with our turnkey vacation rental business – your golden ticket to making money while providing unforgettable travel experiences! Just like Airbnb, We at Appticz develop a vacation rental business that empowers you to transform your property into a revenue-generating oasis. Imagine waking up to a stream of bookings and delighted guests, all while enjoying the financial rewards of the booming vacation rental market. Get a free airbnb clone business quotation.
https://appticz.com/airbnb-clone
app.get('/auth/google',
  passport.authenticate('google', { scope: [ 'email', 'profile' ]
}));
app.get('/auth/google/callback', passport.authenticate( 'google', {
   successRedirect: '/dashboard',
   failureRedirect: '/login'
}));
1: Using Control Panel
control panel - programs - turn windows features on or off

2: Using the Command Prompt (admin)
bcdedit /set hypervisorlaunchtype off

The DISM Command
cmd (admin)
dism /online /disable-feature /featurename:Microsoft-hyper-v-all

3: Using PowerShell (admin)
Disable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-All

4: Using BIOS
Configuration tab (or such - check)
select the Virtualization Technology - disable






echo var_export(something) die();
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.preprocessing import MinMaxScaler,StandardScaler,OneHotEncoder
from sklearn.preprocessing import LabelEncoder
from sklearn.pipeline import Pipeline
from sklearn.compose import ColumnTransformer
from sklearn.impute import SimpleImputer

#Set Seed for reproducability
np.random.seed(42)
#Create synthetic dataset 
data={
    'Age':np.random.randint(29,77,size=200),
    'Sex':np.random.choice(['Male','Female'],size=200),
    'ChestPainType':np.random.choice(['ATA','NAP','ASY','TA'],size=200),
    'RestingBP':np.random.randint(94,200,size=200),
    'Cholesterol':np.random.randint(126,564,size=200),
    'FastingBS':np.random.choice([0,1],size=200),
    'RestingECG':np.random.choice(['Normal','ST','LVH'],size=200),
    'MaxHR':np.random.randint(71,202,size=200),
    'ExerciseAngina':np.random.choice(['N','Y'],size=200),
    'Oldpeak':np.random.uniform(0,6.2,size=200),
    'ST_Slope':np.random.choice(['Up','Flat','Down'],size=200),
    'HeartAttack':np.random.choice([0,1],size=200)
}

#Convert to DataFrame
df=pd.DataFrame(data)
df.head()
from sklearn.preprocessing import MinMaxScaler
scaler=MinMaxScaler()
columns_to_scale=['Age','Salary','Experience','Dependents','Rating']
df[columns_to_scale]=scaler.fit_transform(df[columns_to_scale])
df.head()
*******************************
  from sklearn.preprocessing import LabelEncoder,OneHotEncoder
from sklearn.compose import ColumnTransformer
l=LabelEncoder()
df['Purchased']=l.fit_transform(df['Purchased'])
ed_mapping={'Bachelor':1,'Master':2,'PhD':3}
df['Education']=df['Education'].map(ed_mapping)
df=pd.get_dummies(df,columns=['City','Product_Category'],drop_first=True)
df.head()
********************************
  from sklearn.decomposition import PCA
pca=PCA(n_components=2)
pca_f=pca.fit_transform(df[columns_to_scale])
pca_df=pd.DataFrame(pca_f,columns=['PCA1','PCA2'])
df=pd.concat([df,pca_df],axis=1)
df.head()
***********************
  df.drop('Name',axis=1,inplace=True)
df.head()
***************************
  import seaborn as sns
import matplotlib.pyplot as plt
corr_mat=df.corr()
plt.figure(figsize=(10,8))
sns.heatmap(corr_mat,annot=True,cmap="coolwarm")
plt.title("Correlation Matrix")
plt.show()
**********************************
  df.hist(bins=20,figsize=(20,15))
plt.show()
skewness=df.skew()
print(skewness)
**********************
  # prompt: plt.figure(figsize=(15,10))

plt.figure(figsize=(15,10))
sns.boxplot(data=df[['Age','Salary','Experience','Dependents','Rating']])
plt.title("Box Plots for Numerical Features")
plt.show()
*********************************
star

Sun Aug 11 2024 04:48:56 GMT+0000 (Coordinated Universal Time) https://www.thewindowsclub.com/how-to-remove-leftover-files-after-uninstall-in-windows

@acassell

star

Sat Aug 10 2024 20:29:04 GMT+0000 (Coordinated Universal Time)

@iamkatmakhafola

star

Sat Aug 10 2024 20:29:04 GMT+0000 (Coordinated Universal Time)

@iamkatmakhafola

star

Sat Aug 10 2024 15:01:55 GMT+0000 (Coordinated Universal Time) https://thisisnotawebsitedotcom.com/

@DomenicEXP111

star

Sat Aug 10 2024 15:00:46 GMT+0000 (Coordinated Universal Time) https://thisisnotawebsitedotcom.com/

@DomenicEXP111

star

Sat Aug 10 2024 14:42:57 GMT+0000 (Coordinated Universal Time) https://helldivers-hub.com/

@Dhoover17

star

Sat Aug 10 2024 13:09:20 GMT+0000 (Coordinated Universal Time)

@Wittinunt

star

Sat Aug 10 2024 12:33:01 GMT+0000 (Coordinated Universal Time)

@iamkatmakhafola

star

Sat Aug 10 2024 11:56:36 GMT+0000 (Coordinated Universal Time)

@gohilghanu

star

Sat Aug 10 2024 10:36:28 GMT+0000 (Coordinated Universal Time)

@Wittinunt

star

Sat Aug 10 2024 10:02:38 GMT+0000 (Coordinated Universal Time) https://beleaftechnologies.com/meme-coin-development-company

@sivaprasadm203 #blockchain #cryptocurrency #defi #web3

star

Sat Aug 10 2024 09:44:31 GMT+0000 (Coordinated Universal Time) https://www.appsheet.com/template/AppDef?appName

@Wittinunt

star

Sat Aug 10 2024 06:42:55 GMT+0000 (Coordinated Universal Time) https://expressjs.com/en/guide/routing.html

@piyushkashyap #javascript

star

Sat Aug 10 2024 06:42:54 GMT+0000 (Coordinated Universal Time) https://expressjs.com/en/guide/routing.html

@piyushkashyap #javascript

star

Sat Aug 10 2024 06:42:53 GMT+0000 (Coordinated Universal Time) https://expressjs.com/en/guide/routing.html

@piyushkashyap #javascript

star

Sat Aug 10 2024 06:42:51 GMT+0000 (Coordinated Universal Time) https://expressjs.com/en/guide/routing.html

@piyushkashyap #javascript

star

Sat Aug 10 2024 06:42:48 GMT+0000 (Coordinated Universal Time) https://expressjs.com/en/guide/routing.html

@piyushkashyap #javascript

star

Sat Aug 10 2024 06:36:53 GMT+0000 (Coordinated Universal Time) https://expressjs.com/en/guide/routing.html

@piyushkashyap

star

Sat Aug 10 2024 06:35:17 GMT+0000 (Coordinated Universal Time) https://expressjs.com/en/guide/routing.html

@piyushkashyap #javascript

star

Sat Aug 10 2024 06:17:35 GMT+0000 (Coordinated Universal Time) https://www.appsheet.com/template/AppDef?appName

@Wittinunt

star

Sat Aug 10 2024 06:14:08 GMT+0000 (Coordinated Universal Time)

@Wittinunt

star

Sat Aug 10 2024 05:12:30 GMT+0000 (Coordinated Universal Time)

@poojitha #typescriptreact

star

Sat Aug 10 2024 04:26:44 GMT+0000 (Coordinated Universal Time) https://www.prothomalo.com/bangladesh/01jf3e36k2

@golam

star

Sat Aug 10 2024 03:42:54 GMT+0000 (Coordinated Universal Time) https://docs.pydantic.dev/1.10/usage/models/#recursive-orm-models

@theshyxin

star

Sat Aug 10 2024 03:40:30 GMT+0000 (Coordinated Universal Time)

@signup

star

Fri Aug 09 2024 13:25:53 GMT+0000 (Coordinated Universal Time) https://maticz.com/solana-dapp-development

@carolinemax ##maticz ##usa

star

Fri Aug 09 2024 13:09:10 GMT+0000 (Coordinated Universal Time)

@StephenThevar

star

Fri Aug 09 2024 12:16:37 GMT+0000 (Coordinated Universal Time)

@iamkatmakhafola

star

Fri Aug 09 2024 12:16:37 GMT+0000 (Coordinated Universal Time)

@iamkatmakhafola

star

Fri Aug 09 2024 12:13:33 GMT+0000 (Coordinated Universal Time)

@iamkatmakhafola

star

Thu Aug 08 2024 23:18:08 GMT+0000 (Coordinated Universal Time) https://getbootstrap.com/docs/5.3/components/dropdowns/

@poramet128

star

Thu Aug 08 2024 22:53:05 GMT+0000 (Coordinated Universal Time)

@k_m_s_avinash6

star

Thu Aug 08 2024 22:50:01 GMT+0000 (Coordinated Universal Time)

@k_m_s_avinash6

star

Thu Aug 08 2024 22:36:46 GMT+0000 (Coordinated Universal Time)

@k_m_s_avinash6

star

Thu Aug 08 2024 19:10:16 GMT+0000 (Coordinated Universal Time) https://cyberleninka.ru/search?q

@Pavlo190

star

Thu Aug 08 2024 16:02:12 GMT+0000 (Coordinated Universal Time)

@iamkatmakhafola

star

Thu Aug 08 2024 15:54:40 GMT+0000 (Coordinated Universal Time)

@zily

star

Thu Aug 08 2024 15:54:06 GMT+0000 (Coordinated Universal Time)

@zily

star

Thu Aug 08 2024 15:54:06 GMT+0000 (Coordinated Universal Time)

@zily

star

Thu Aug 08 2024 15:52:03 GMT+0000 (Coordinated Universal Time)

@zily

star

Thu Aug 08 2024 15:14:30 GMT+0000 (Coordinated Universal Time)

@Sayed

star

Thu Aug 08 2024 13:06:35 GMT+0000 (Coordinated Universal Time) https://medium.com/@prashantramnyc/how-to-implement-google-authentication-in-node-js-using-passport-js-9873f244b55e

@abhi_550

star

Thu Aug 08 2024 11:37:34 GMT+0000 (Coordinated Universal Time) https://www.rginfotech.com/games/poker-game-development/

@kishanrg ##poker ##pokergame ##pokergamedevelopment ##gameapp

star

Thu Aug 08 2024 11:12:41 GMT+0000 (Coordinated Universal Time) https://www.guidingtech.com/how-to-disable-hyper-v-windows/

@Curable1600 #windows

star

Thu Aug 08 2024 10:38:45 GMT+0000 (Coordinated Universal Time) https://www.beleaftechnologies.com/crypto-casino-game-development

@smithtaylor ##crypto #casino ##game

star

Thu Aug 08 2024 08:09:55 GMT+0000 (Coordinated Universal Time)

@Merel1988 #php

star

Thu Aug 08 2024 05:28:45 GMT+0000 (Coordinated Universal Time)

@signup

star

Thu Aug 08 2024 04:21:05 GMT+0000 (Coordinated Universal Time)

@signup

Save snippets that work with our extensions

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