
<?php $__env->startSection('content'); ?>
<style>
  button.dt-button, div.dt-button, a.dt-button, input.dt-button {
    border-radius: 5px;
    color: white;
    background-color: rgb(197, 7, 178);
    box-shadow: rgba(50, 50, 93, 0.25) 0px 50px 100px -20px, rgba(0, 0, 0, 0.3) 0px 30px 60px -30px, rgba(10, 37, 64, 0.35) 0px -2px 6px 0px inset;
}

button.dt-button:hover:not(.disabled), div.dt-button:hover:not(.disabled), a.dt-button:hover:not(.disabled), input.dt-button:hover:not(.disabled) {
    border: 1px solid #666;
    background-color: rgb(29, 29, 29);
}

/* CSS */
.button-85 {
 
    margin: 10px;
  padding: 0.6em 2em;
  border: none;
  outline: none;
  color: rgb(255, 255, 255);
  background: #111;
  cursor: pointer;
  position: relative;
  z-index: 0;
  border-radius: 10px;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.button-85:before {
  content: "";
  background: linear-gradient(
    45deg,
    #ff0000,
    #ff7300,
    #fffb00,
    #48ff00,
    #00ffd5,
    #002bff,
    #7a00ff,
    #ff00c8,
    #ff0000
  );
  position: absolute;
  top: -2px;
  left: -2px;
  background-size: 400%;
  z-index: -1;
  filter: blur(5px);
  -webkit-filter: blur(5px);
  width: calc(100% + 4px);
  height: calc(100% + 4px);
  animation: glowing-button-85 20s linear infinite;
  transition: opacity 0.3s ease-in-out;
  border-radius: 10px;
}

@keyframes glowing-button-85 {
  0% {
    background-position: 0 0;
  }
  50% {
    background-position: 400% 0;
  }
  100% {
    background-position: 0 0;
  }
}

.button-85:after {
  z-index: -1;
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  background: #222;
 
  left: 0;
  top: 0;
  /* border-radius: 10px; */
}
</style>
      <!-- partial -->
      <div class="main-panel">
        <div class="content-wrapper">
          <div class="page-header">
            <h3 class="page-title">
              Dashboard
            </h3>
          </div>
          <?php if($purchaseType == 'Add Product'): ?>
          <div class="row grid-margin">
            <div class="col-12">
              <div class="card card-statistics">
                <div class="card-body">
                  <div class="d-flex flex-column flex-md-row align-items-center justify-content-between">
                    <div class="statistics-item">
                        <p>
                            <i class="icon-sm fa fa-user mr-2"></i>
                            Total Quantity
                        </p>
                        <h4><?php echo e(number_format($totalProdutQuantity, 2)); ?></h4>
                    </div>
                   
                    <div class="statistics-item">
                        <p>
                            <i class="icon-sm fas fa-hourglass-half mr-2"></i>
                            Total Cost
                        </p>
                        <h4><?php echo e(number_format($totalProdutCost, 2)); ?></h4>
                    </div>
                    <div class="statistics-item">
                      <p>
                          <i class="icon-sm fas fa-hourglass-half mr-2"></i>
                          Total Paid
                      </p>
                      
                  </div>
                    <div class="statistics-item">
                        <button class="button-85 return"  role="button">Return</button>
                        <button class="button-85" id="edit" role="button">Edit</button>
                        
                    </div>
                   
                    
                      
                  </div>
                </div>
              </div>
            </div>
          </div>
         <?php endif; ?>
         <?php if($purchaseType == 'Add Product By Items'): ?>
         <div class="row grid-margin">
           <div class="col-12">
             <div class="card card-statistics">
               <div class="card-body">
                <div class="d-flex flex-column flex-md-row align-items-center justify-content-between">
                  <div class="statistics-item">
                      <p>
                          <i class="icon-sm fa fa-user mr-2"></i>
                          Product Name
                      </p>
                      <?php $__currentLoopData = $purchaseProducts; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $product): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                      
                  <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                  </div>
                 
                  <div class="statistics-item">
                      <p>
                          <i class="icon-sm fas fa-user mr-2"></i>
                          Supplier
                      </p>
                    
                      <h4><?php echo e($suppliers->name); ?></h4>
                
                  </div>
                  <div class="statistics-item">
                    <p>
                      <i class="icon-sm fa fa-user mr-2"></i>
                      Total Quantity
                  </p>
                  <h4><?php echo e(number_format($totalProdutQuantity, 2)); ?></h4>
                </div>
                <div class="statistics-item">
                  <button class="button-85 return"  role="button">Return</button>
              </div>
               
                </div>
                <br>
                <hr style="border: 1px solid #dcffce;">
                 <div class="d-flex flex-column flex-md-row align-items-center justify-content-between">
                   <div class="statistics-item">
                       <p>
                           <i class="icon-sm fa fa-user mr-2"></i>
                           Total Paid
                       </p>
                       <h4><?php echo e(number_format($product->total_paid, 2)); ?></h4>
                   </div>
                  
                   <div class="statistics-item">
                       <p>
                           <i class="icon-sm fas fa-hourglass-half mr-2"></i>
                           Total Cost
                       </p>
                       <h4><?php echo e(number_format($totalProdutCost, 2)); ?></h4>
                   </div>
                   <div class="statistics-item">
                     <p>
                         <i class="icon-sm fas fa-hourglass-half mr-2"></i>
                         Balance
                     </p>
                     <h4><?php echo e(number_format($product->total_paid - $totalProdutCost, 2)); ?></h4>

                 </div>
                   <div class="statistics-item">
                      
                       <button class="button-85" id="edit" role="button">Edit</button>
                      
                   </div>
                  
                   
                     
                 </div>
               </div>
             </div>
           </div>
         </div>
        <?php endif; ?>
          <div class="content-wrapper">
            
            <div class="card">
              <div class="card-body">
                <h4 class="card-title">Data table</h4>
                <div class="row">
                  <div class="col-12">

                    <?php if($purchaseType == 'Add Product'): ?>
                    <div class="table-responsive" style="overflow-x: auto; -webkit-overflow-x: auto;">
                        <table id="example" class="table table-striped table-hover table-product  nowrap" style="width: 100%; ">
                        <thead>
                          <tr>
                              <th>Id #</th>
                              <th>Product Name</th>
                              <th>Brand</th>
                              <th>Quantity</th>
                              <th>Cost</th>
                              <th>total Cost</th>
                       
                              
                          </tr>
                        </thead>
                        <tbody>
                            <?php $__currentLoopData = $purchaseProducts; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $purchaseProduct): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <tr>
                              <td><?php echo e($purchaseProduct->id); ?></td>
                              <td><?php echo e($purchaseProduct->product_name); ?></td>
                              <td><?php echo e($purchaseProduct->product_brand_name); ?></td>
                              <td><?php echo e($purchaseProduct->quantity); ?></td>
                              <td><?php echo e($purchaseProduct->each_cost); ?></td>
                              <td><?php echo e($purchaseProduct->total_cost); ?></td>
                            </tr>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                      
                        </tbody>
                      </table>
                    </div>
                    <?php endif; ?>
                    <?php if($purchaseType == 'Add Product By Items'): ?>
                    <div class="table-responsive" style="overflow-x: auto; -webkit-overflow-x: auto;">
                      <table id="example2" class="table table-striped table-hover table-product nowrap" style="width: 100%;">
                        <thead>
                            <tr>
                                <th>Id #</th>
                                <th>Product Name</th>
                                <th>IMU Number</th>
                                <th>Quantity</th>
                                <th>Cost</th>
                            </tr>
                        </thead>
                        <tbody>

                                <?php $__currentLoopData = $purchaseProductItem; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $ProductItem): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <tr>
                                        <td><?php echo e($ProductItem->id); ?></td>
                                        <td><?php echo e($ProductItem->product_name); ?></td>
                                        <td><?php echo e($ProductItem->imu_number); ?></td>
                                        <td><?php echo e($ProductItem->quantity); ?></td>
                                        <td><?php echo e(number_format($ProductItem->each_cost, 2)); ?></td>
                                    </tr>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

                        </tbody>
                    </table>
                    
                  </div>
                    <?php endif; ?>
                  </div>
                </div>
              </div>
            </div>
          </div>
          <div class="row">
            <div class="col-12">
              <div class="card">
                <div class="card-body">
                  <div class="d-md-flex justify-content-between align-items-center">
                    <div class="d-flex align-items-center mb-3 mb-md-0">
                      <button class="btn btn-social-icon btn-facebook btn-rounded">
                        <i class="fab fa-facebook-f"></i>
                      </button>
                      <div class="ml-4">
                        <h5 class="mb-0">Facebook</h5>
                        <p class="mb-0">813 friends</p>
                      </div>
                    </div>
                    <div class="d-flex align-items-center mb-3 mb-md-0">
                      <button class="btn btn-social-icon btn-twitter btn-rounded">
                        <i class="fab fa-twitter"></i>
                      </button>
                      <div class="ml-4">
                        <h5 class="mb-0">Twitter</h5>
                        <p class="mb-0">9000 followers</p>
                      </div>
                    </div>
                    <div class="d-flex align-items-center mb-3 mb-md-0">
                      <button class="btn btn-social-icon btn-google btn-rounded">
                        <i class="fab fa-google-plus-g"></i>
                      </button>
                      <div class="ml-4">
                        <h5 class="mb-0">Google plus</h5>
                        <p class="mb-0">780 friends</p>
                      </div>
                    </div>
                    <div class="d-flex align-items-center">
                      <button class="btn btn-social-icon btn-linkedin btn-rounded">
                        <i class="fab fa-linkedin-in"></i>
                      </button>
                      <div class="ml-4">
                        <h5 class="mb-0">Linkedin</h5>
                        <p class="mb-0">1090 connections</p>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>

      
        <!-- content-wrapper ends -->
        <!-- partial:../../partials/_footer.html -->
        <footer class="footer">
          <div class="d-sm-flex justify-content-center justify-content-sm-between">
            <span class="text-muted text-center text-sm-left d-block d-sm-inline-block">Copyright © 2025  <a href="https://www.urbanui.com/" target="_blank">Urbanui</a>. All rights reserved.</span>
            <span class="float-none float-sm-right d-block mt-1 mt-sm-0 text-center">Hand-crafted & made with <i class="far fa-heart text-danger"></i></span>
          </div>
        </footer>
        <!-- partial -->
      </div>
   
     
      <script>
$( document ).ready(function() {


    $(document).on('click', '#edit', function() {
            var currentUrl = window.location.href;

// Create a URL object to parse the query parameters
var url = new URL(currentUrl);

// Get the 'id' query parameter from the URL
var id = url.searchParams.get("id");

            
            var url = '/edit-purchace-product?id=' + id;
            window.location.href = url;
        });


        $(document).on('click', '.return', function() {
            var currentUrl = window.location.href;

// Create a URL object to parse the query parameters
var url = new URL(currentUrl);

// Get the 'id' query parameter from the URL
var id = url.searchParams.get("id");

            
            var url = '/return-purchace-product?id=' + id;
            window.location.href = url;
        });
        


  var branch_id = <?php echo e(Session::get('branch_id')); ?> 

  

  // alert("hi")
  $('#example').DataTable({
            dom: "<'row'<'col-sm-12 col-md-4'l><'col-sm-12 col-md-4'B><'col-sm-12 col-md-4'f>>" +
                "<'row'<'col-sm-12'tr>>" +
                "<'row'<'col-sm-12 col-md-5'i><'col-sm-12 col-md-7'p>>",
            buttons: [
                'copy', 'csv', 'excel', 'pdf', 'print'
            ],
            processing: true,
            info: true,
            responsive: true,
            lengthMenu: [
                [10, 25, 50, 100, 200, -1],
                [10, 25, 50, 100, 200, "All"]
            ],
            columns: [
                { data: 'id' },
                { data: 'product_name' },
                { data: 'product_brand_name' },
                { data: 'quantity' },
                { data: 'each_cost' },
                { data: 'total_cost' }
            ]
        });

     
        $('#example2').DataTable({
            dom: "<'row'<'col-sm-12 col-md-4'l><'col-sm-12 col-md-4'B><'col-sm-12 col-md-4'f>>" +
                "<'row'<'col-sm-12'tr>>" +
                "<'row'<'col-sm-12 col-md-5'i><'col-sm-12 col-md-7'p>>",
            buttons: [
                'copy', 'csv', 'excel', 'pdf', 'print'
            ],
            processing: true,
            info: true,
            responsive: true,
            lengthMenu: [
                [10, 25, 50, 100, 200, -1],
                [10, 25, 50, 100, 200, "All"]
            ],
            columns: [
                { data: 'id' },
                { data: 'product_name' },
                { data: 'imu_number' },
                { data: 'quantity' },
                { data: 'each_cost' },
            ]
        });

        

      
});
      
      </script>
<?php $__env->stopSection(); ?>
      <!-- main-panel ends -->
    


      <!-- HTML !-->



<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\Users\USER\Desktop\laravel Chat\Sunsmart pety cash\susmart\resources\views/Section/Purchase/PurchaseData/purchaseProductData.blade.php ENDPATH**/ ?>