<?php
use App\Models\Package;

$packages = Package::where('status', 'active')->get();
?>
<html>
 <head> 
  <meta charset="utf-8"> 
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> 
  <title>Home_CARGILL</title> 
  <link rel="stylesheet" href="/public/site/layui/css/layui.css"> 
  <link rel="stylesheet" href="/public/site/csss/common.css?t=1.2"> 
  <link rel="stylesheet" href="/public/site/csss/swiper-bundle.min.css">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/layui/2.5.7/css/layui.min.css">
  <style>
        .reward_card .title{
            font-weight: 700px;
        }
    </style> 
 </head> 
 <body>  
  <div class="index_header"> 
   <div class="index_logo"> 
    <div> 
     <p class="welcome">Welcome</p> 
     <p class="welcome_desc">Make money easier!</p> 
    </div> 
    <div href="/mail" class="notice" style="line-height: 50px;">
     <img src="/mbtech/IMG-20250601-WA0037.jpg" style="height: 50px;width: auto;border-radius: 8px">
    </div> 
   </div> 
   <div class="common_card" style="padding: 10px;margin-top: 20px;"> 
    <div class="flex_space balance"> 
     <div class="flex_left"> 
      <img src="/public/site/img/index/balance.png" style="height: 30px;width: 30px;"> 
      <div style="padding-left: 10px"> 
       <p class="label"></p> 
       <p class="value">{{price(auth()->user()->balance)}}</p> 
      </div> 
     </div> 
     <a href="/withdraw" class="wallet_btn">Go Withdraw</a> 
    </div> 
   </div> 
   <div class="index_menu common_card" style="margin-top: 20px;"> 
    <div class="" style="text-align: center;width: 25%;"> 
     <a href="/user/recharge"> <img src="/public/site/img/index/recharge.png" style="width: 50px;height: 50px;"> <p class="menu-title">Recharge</p> </a> 
    </div> 
    <div class="" style="text-align: center;width: 30%"> 
     <a href="/withdraw"> <img src="/public/site/img/index/withdrawal.png" style="width: 50px;height: 50px;"> <p class="menu-title">Withdrawal</p> </a> 
    </div> 
    <div class="" style="text-align: center;width: 30%"> 
     <a href="/my-team"> <img src="/public/site/img/index/team.png" style="width: 50px;height: 50px;"> <p class="menu-title">Team</p> </a> 
    </div> 
    <div class="" style="text-align: center;width: 30%"> 
     <a href="#"> <img src="/public/site/img/index/message.png" style="width: 50px;height: 50px;"> <p class="menu-title">Sign In</p> </a> 
    </div> 
   </div> 
   <!--<div class="common_card reward_card">--> 
   <!--    <div class="title">--> 
   <!--        <p style="font-weight:700px">Quest Rewards</p>--> 
   <!--        <a href="/tasks" style="font-family: Arial, Arial;font-weight: 400;font-size: 14px;color: #A4A4A4;line-height: 20px">--> 
   <!--            See More <i class="layui-icon layui-icon-right layui-font-13" ></i>--> 
   <!--        </a>--> 
   <!--    </div>--> 
   <!--    <div class="content flex_left">--> 
   <!--        <div style="background: #F3F8FE;border-radius: 12px;padding: 5px;margin-right: 10px;width: 120px;padding-bottom: 0px;">--> 
   <!--            <p class="title">Invitation</p>--> 
   <!--            <p class="desc">Inviting friends to earn commissions</p>--> 
   <!--            <img src="/public/site/img/index/reward.png" style="width: 132px;height: 78px;margin-top: 10px">--> 
   <!--        </div>--> 
   <!--        <div>--> 
   <!--            <div class="reward_right_card">--> 
   <!--                <p class="title">Inviting activation of </p>--> 
   <!--                <div  class="flex_space">--> 
   <!--                    <div>--> 
   <!--                        <div class="value"><span style="color: #0F7A5A">0</span> / </div>--> 
   <!--                        <div class="label">Schedule</div>--> 
   <!--                    </div>--> 
   <!--                    <div >--> 
   <!--                        <div class="value position">--> 
   <!--                            <span class="unit">R</span>--> 
   <!--                        </div>--> 
   <!--                        <div class="label">Reward amount</div>--> 
   <!--                    </div>--> 
   <!--                </div>--> 
   <!--            </div>--> 
   <!--            <div class="reward_right_card" style="margin-bottom: 0px">--> 
   <!--                <p class="title">Inviting activation of </p>--> 
   <!--                <div  class="flex_space">--> 
   <!--                    <div>--> 
   <!--                        <div class="value"><span style="color: #0F7A5A">0</span> / </div>--> 
   <!--                        <div class="label">Schedule</div>--> 
   <!--                    </div>--> 
   <!--                    <div >--> 
   <!--                        <div class="value position">--> 
   <!--                            <span class="unit">R</span>--> 
   <!--                        </div>--> 
   <!--                        <div class="label">Reward amount</div>--> 
   <!--                    </div>--> 
   <!--                </div>--> 
   <!--            </div>--> 
   <!--        </div>--> 
   <!--    </div>--> 
   <!--</div>--> 
   <div class="common_card reward_card"> 
    <div class="title" style="font-weight:700px">
     Sign in to receive rewards
    </div> 
    <div class="content" style="margin: 10px 0;">
     Daily check-in can receive R{{setting('checkin')}}.
    </div> 
    <div class="go_lottery layui-btn layui-btn-normal layui-btn-radius" id="sign_in" style="text-align:center" onclick="checkin()">
      Sign in now 
    </div> 
    <a href="#" class="go_lottery layui-btn layui-btn-primary layui-btn-radius" style="text-align:center"> Sign In Record </a> 
    <!--<div class="layui-btn layui-btn-primary layui-btn-radius" id="sign_rules" style="text-align:center">
      Rules-->
    </div> 
   </div> 
  </div> 
  <div class="index_main" style="margin-bottom: 80px"> 
   <div class="flex_space product_title"> 
    <p>Recommend products</p> 
    <a href="/vip" style="font-size: 13px;color: #A4A4A4;line-height: 25px;"> See More <i class="layui-icon layui-icon-right layui-font-13"></i> </a> 
   </div> 
   <div class="product_type_1 product_list"> 
   @foreach ($packages as $package)
      @if ($package->category == 'fixed')
    <a onclick="window.location.href='{{route('vip.details', $package->id)}}'" class="product_card position"> 
     <div class="level">
      <img src="/public/site/img/vip/lv0.png">
     </div> 
     <div class="product_content position"> 
      <div class="product_title flex_left"> 
       <div class="product_image" style="background-image: url('{{ asset($package->photo) }}')">
        <img src="/mbtech/product.png">
       </div> 
       <div class="product_info"> 
        <div class="product_name flex_space"> 
         <p style="width:140px; overflow: hidden;white-space: nowrap; text-overflow: ellipsis;text-align:left">{{$package->name}}</p> 
         <div class="buy">
          Buy
         </div> 
        </div> 
        <div class="product_item flex_space"> 
         <p class="label">Each Price</p> 
         <p class="value position" style="font-weight: 700"> <span class="unit">R</span> <span class="price"> {{($package->price)}}</span> </p> 
        </div> 
        <div class="product_item flex_space"> 
         <p class="label">Revenue</p> 
         <p class="value position"> {{ $package->validity }} Days </p> 
        </div> 
        <div class="product_item flex_space"> 
         <p class="label"> Daily Earnings </p> 
         <p class="value"> <span class="position"> <span class="unit">R</span> {{($package->commission_with_avg_amount / $package->validity)}} </span> </p> 
        </div> 
        <div class="product_item flex_space"> 
         <p class="label">Total Revenue</p> 
         <p class="value"> <span class="position"> <span class="unit">R</span> {{($package->commission_with_avg_amount)}} </span> </p> 
        </div> 
       </div>
      </div>
     </div> </a>
     @endif
    @endforeach
    <!--<a href="/product_details/383" class="product_card position"> 
     <div class="level">
      <img src="/public/site/img/vip/lv1.png">
     </div> 
     <div class="product_content position"> 
      <div class="product_title flex_left"> 
       <div class="product_image" style="background-image: url(/public/uploads/product/20250520200304411215.jpg)"> 
        <img src="/public/site/img/product/product.png"> 
       </div> 
       <div class="product_info"> 
        <div class="product_name flex_space"> 
         <p style="width:140px; overflow: hidden;white-space: nowrap; text-overflow: ellipsis;text-align:left">LAN Cable 1</p> 
         <div class="buy">
          Buy
         </div> 
        </div> 
        <div class="product_item flex_space"> 
         <p class="label">Each Price</p> 
         <p class="value position" style="font-weight: 700"> <span class="unit">R</span> <span class="price"> 100.00</span> </p> 
        </div> 
        <div class="product_item flex_space"> 
         <p class="label">Revenue</p> 
         <p class="value position"> 5 Days </p> 
        </div> 
        <div class="product_item flex_space"> 
         <p class="label"> Daily Earnings </p> 
         <p class="value"> <span class="position"> <span class="unit">R</span> 40 </span> </p> 
        </div> 
        <div class="product_item flex_space"> 
         <p class="label">Total Revenue</p> 
         <p class="value"> <span class="position"> <span class="unit">R</span> 200 </span> </p> 
        </div> 
       </div> 
      </div> 
     </div> </a>-->
    <div class="none_data  hide"> 
     <img class="none_image" src="/public/site/img/order/none_order.png"> 
     <p class="none_text"> No items available for invest </p> 
    </div> 
   </div> 
  </div> 
  <div id="sign_rules_dialog" style="padding:15px; display:none;background:#ffffff;line-height:25px;border-radius:8px;text-align:center"> 
   <h2 style="margin-bottom:10px;">Sign In Rules</h2> 
   <p>VIP0: Daily sign-in rewards R0.00</p> 
   <p>VIP1: Daily sign-in rewards R5.00</p> 
   <p>VIP2: Daily sign-in rewards R10.00</p> 
   <p>VIP3: Daily sign-in rewards R15.00</p> 
   <p>VIP4: Daily sign-in rewards R25.00</p> 
   <p>VIP5: Daily sign-in rewards R40.00</p> 
   <p>VIP6: Daily sign-in rewards R60.00</p> 
   <p>VIP7: Daily sign-in rewards R90.00</p> 
   <p>VIP8: Daily sign-in rewards R150.00</p> 
  </div> 
  <textarea id="notice_content" style="display: none"></textarea> 
  
  <a href="/help" target="_blank" id="service"> <img src="/public/site/img/common/service.png" style="width: 40px;height: 40px"> </a> 
  @include('app.layout.menu')
  <!--<div class="footer_menu"> 
   <div class="content"> 
    <a href="/" class="item active"> <img src="/public/site/img/footer/home_active.png"> <p>Home</p> </a> 
    <a href="/product" class="item "> <img src="/public/site/img/footer/invest.png"> <p>Invest</p> </a> 
    <a href="/tasks" class="item position" style=""> <p style="position:absolute;top: -12px;left: 0px;width: 100%"> <img src="/public/site/img/footer/Tasks.png" style="display:inline-block;height: 45px;width: 45px;"> </p> </a> 
    <a href="/blog" class="item "> <img src="/public/site/img/footer/mboard.png"> <p>Blog</p> </a> 
    <a href="/my" class="item "> <img src="/public/site/img/footer/account.png"> <p>Account</p> </a> 
   </div> 
  </div>-->
  
  
  <div class="layui-layer-shade" id="layui-layer-shade1" times="1" style="z-index: 19891014; background-color: rgb(0, 0, 0); opacity: 0.3;"></div>
  <div class="layui-layer layui-layer-page  layer-anim layer-anim-00" id="layui-layer1" type="page" times="1" showtime="0" contype="string" style="z-index: 19891015; width: 90%; height: auto; position: fixed; top: 191px; left: 18.5px;">
   <div class="layui-layer-content" style="height: 268px;">
    <div class="dialog">
     <div class="dialog_contents">
      <div class="logo">
       <img src="/public/site/img/index/telegram.png" style="">
      </div>
      <div class="title" style="margin:15px 0;text-align: center;font-weight: 700;font-size: 20px;">
       Telegeram
      </div>
      <div class="text" style="text-align: center;font-weight:400;font-size: 14px;color: #818393;line-height: 24px;">
       Follow our official telegram channel for the latest news and discounts.
      </div>
     </div>
     <div class="btn_group">
      <a href="https://t.me/+AxzjFD0FlchiNzI0" class="confirm telegram_confirm" style="width: 100%">Follow Now</a>
     </div>
    </div>
   </div>
   <div class="layui-layer-setwin">
    <span class="layui-icon layui-icon-close layui-layer-close layui-layer-close2"></span>
   </div>
   <span class="layui-layer-resize"></span>
  </div>
  <div class="layui-layer-move" id="layui-layer-move"></div>
 </body>
</html>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    @include('alert-message')
<img style="position: fixed;
    display: none;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;" src="{{asset('public/loading.gif')}}" class="loading" alt="">
<script>
    function checkin(){
        //document.querySelector('.loading').style.display = 'block';
        window.location.href='{{route('user.checkin')}}'
    }
  document.addEventListener("DOMContentLoaded", function () {
    // Show the popup (uncomment if you want to show on load)
    // document.getElementById("layui-layer1").style.display = "block";
    // document.getElementById("layui-layer-shade1").style.display = "block";

    // Hide the popup by default
    document.getElementById("layui-layer1").style.display = "none";
    document.getElementById("layui-layer-shade1").style.display = "none";

    // Optionally, show popup after a delay (like 2 seconds)
    setTimeout(() => {
      document.getElementById("layui-layer1").style.display = "block";
      document.getElementById("layui-layer-shade1").style.display = "block";
    }, 2000);

    // Handle close button
    const closeBtn = document.querySelector(".layui-layer-close2");
    if (closeBtn) {
      closeBtn.addEventListener("click", () => {
        document.getElementById("layui-layer1").style.display = "none";
        document.getElementById("layui-layer-shade1").style.display = "none";
      });
    }
  });
</script>
