<?php $__env->startSection("body"); ?>

        <!-- Main Section ------------------------------------------------------------------------------->

        <div class="main-cont">
            <div class="new-pur">
                <h6>قائمة الفروع</h6>
                <hr>
                <div class="links">
                    <a   data-toggle="collapse" href="#collapseadd"  aria-expanded="false" aria-controls="collapseExample"><i class="far fa-plus-square"></i> إضافة فرع</a>
                    <table class="table collapse" id="collapseadd">
                        <thead >

                        </thead>
                        <tbody>
                        <form action="<?php echo e(route('addbranch')); ?>" method="POST">
                            <?php echo csrf_field(); ?>
                            <tr>
                                <th>
                                    <div class="input-group mb-3">
                                        <input type="text" name="title" class="form-control" placeholder="الاسم" aria-label="Username" aria-describedby="basic-addon1">
                                    </div>
                                </th>






                                <th>
                                    <div class="input-group mb-3">
                                        <input type="text" name="phone" class="form-control" placeholder="رقم الهاتف" aria-label="Username" aria-describedby="basic-addon1">
                                    </div>

                                </th>
                                <th>
                                    <div class="input-group mb-3">
                                        <input type="text" name="address" class="form-control" placeholder="العنوان" aria-label="Username" aria-describedby="basic-addon1">
                                    </div>

                                </th>
                                <th>
                                    <select class="form-control" name="govern_id" id="exampleFormControlSelect1">
                                        <option value="0">Govern</option>
                                        <?php $__currentLoopData = $governs; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $govern): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>

                                            <option value="<?php echo e($govern->id); ?>"><?php echo e($govern->name_ar); ?></option>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </select>

                                </th>
                                <th>
                                    <div class="input-group mb-3">
                                        <button type="submit" class="btn btn-success">اضف</button>
                                    </div>

                                </th>

                            </tr>
                        </form>

                        </tbody>
                    </table>
                </div>
                <hr>
                <table class="tab1-tab">
                    <tr>
                        <th><i class="fas fa-cog fa-lg"></i> اسم الفرع</th>
                        <th>المخزون</th>
                        <th>رقم الهاتف</th>
                        <th>العنوان</th>
                        <th> </th>

                    </tr>
                    <tbody>
                    <?php $__currentLoopData = @$AllBranches; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $branch): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>

                        <tr>
                            
                            <th><?php echo e(@$branch->title); ?></th>
                            <?php
                                $total=0;
                                    foreach ($branch->stock as $stock){
                                        $total=$total+$stock->quntity;
                                    }
                            ?>
                            <th>
                                <!-- Button trigger modal -->
                                <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#example<?php echo e(@$branch->id); ?>">
                                    <?php echo e(@$total); ?>

                                </button>

                                <!-- Modal -->
                                <div class="modal fade" id="example<?php echo e(@$branch->id); ?>" tabindex="-1" role="dialog" aria-labelledby="exampleModalLongTitle" aria-hidden="true">
                                    <div class="modal-dialog" role="document">
                                        <div class="modal-content">
                                            <div class="modal-header">
                                                <h5 class="modal-title" id="exampleModalLongTitle">تفاصيل المخزون</h5>
                                                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                                    <span aria-hidden="true">&times;</span>
                                                </button>
                                            </div>
                                            <div class="modal-body">
                                                <table>
                                                    <thead>
                                                    <tr>
                                                        <td>اسم المنتج</td>
                                                        <td>الكمية</td>
                                                        <td>عدد الطلبات</td>
                                                    </tr>
                                                    </thead>
                                                    <tbody>
                                                    <form action="<?php echo e(url('/transfer')); ?>" method="POST">
                                                    <?php echo csrf_field(); ?>
                                                    <?php $__currentLoopData = $branch->stock; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $stock): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                        <tr>
                                                            <td><?php echo e($stock->products['name']); ?></td>
                                                            <td><?php echo e($stock->quntity); ?></td>
                                                            <td>
                                                                <div class="input-group mb-3">
                                                                    <input type="number" name="title[<?php echo e($stock->products['id']); ?>]" class="form-control" placeholder="number of product" aria-label="Username" aria-describedby="basic-addon1">
                                                                </div>
                                                            </td>
                                                        </tr>
                                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                        <div class="input-group mb-3 modal-footer">
                                                            <button type="submit" class="btn btn-success">طلب</button>
                                                        </div>
                                                    </form>
                                                    </tbody>

                                                </table>
                                            </div>

                                            <div class="modal-footer">
                                                <button type="button" class="btn btn-secondary" data-dismiss="modal">اغلاق</button>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                
                                
                                
                                
                                
                                

                            </th>
                            <th><?php echo e(@$branch->phone); ?></th>
                            <th><?php echo e(@$branch->sub_title); ?></th>
                            <th>
                            <p>
                                <a class="btn btn-primary" data-toggle="collapse" href="#collapse<?php echo e(@$branch->id); ?>"  aria-expanded="false" aria-controls="collapseExample">
                                        تعديل
                                    </a>
                                </p>    
                                <a class="btn btn-danger" href="<?php echo e(url('deletebranch'.'/'.@$branch->id)); ?>">مسح</a>
                                

                                
                                
                                
                                
                            </th>
                        </tr>
                        <form action="<?php echo e(route('updatebranch')); ?>" method="POST">
                            <?php echo csrf_field(); ?>
                            <tr class="collapse" id="collapse<?php echo e(@$branch->id); ?>">

                                <th>
                                    <div class="input-group mb-3">
                                        <input type="text" name="id" class="form-control" placeholder="<?php echo e(@$branch->id); ?>" value="<?php echo e(@$branch->id); ?>" aria-label="Username" aria-describedby="basic-addon1"  readonly>
                                    </div>
                                </th>
                                <th>
                                    <div class="input-group mb-3">
                                        <input type="text" name="title" class="form-control" placeholder="<?php echo e(@$branch->title); ?>" value="<?php echo e(@$branch->title); ?>" aria-label="Username" aria-describedby="basic-addon1">
                                    </div>
                                </th>
                                <th>
                                    <div class="input-group mb-3">
                                        <input type="text" name="stock" class="form-control" placeholder="<?php echo e(@$total); ?>" value="<?php echo e(@$total); ?>" aria-label="Username" aria-describedby="basic-addon1" readonly>
                                    </div>

                                </th>
                                <th>
                                    <div class="input-group mb-3">
                                        <input type="text" name="phone" class="form-control" placeholder="<?php echo e(@$branch->phone); ?>" value="<?php echo e(@$branch->phone); ?>" aria-label="Username" aria-describedby="basic-addon1">
                                    </div>

                                </th>
                                <th>
                                    <div class="input-group mb-3">
                                        <input type="text" name="address" class="form-control" placeholder="<?php echo e(@$branch->sub_title); ?>" value="<?php echo e(@$branch->sub_title); ?>" aria-label="Username" aria-describedby="basic-addon1">
                                    </div>

                                </th>
                                <th>
                                    <div class="input-group mb-3">
                                        <button type="submit" class="btn btn-primary">تعديل</button>
                                    </div>

                                </th>

                            </tr>
                        </form>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </tbody>
                    <tfoot>
                    <tr>
                        <th><i class="fas fa-cog fa-lg"></i> اسم الفرع</th>
                        <th>المخزون</th>
                        <th>رقم الهاتف</th>
                        <th>العنوان</th>
                        <th> </th>
                    </tr>
                    </tfoot>
                </table>


            </div>
        </div>

      
          
            
                
                
                
                



                
                    
                        
                    
                
                
                    

                    
                    
                        
                            
                            
                                
                                    
                                        
                                    
                                
                                
                                    
                                        
                                    

                                
                                
                                    
                                        
                                    

                                
                                
                                    
                                        
                                    

                                
                                
                                    
                                        
                                        

                                            
                                        
                                    

                                
                                
                                    
                                        
                                    

                                

                            
                        

                    
                
                
                     
                        
                            
                            

                            
                            
                            
                            
                        
                     
                        
                            

                            
                                
                                
                                
                                
                                    
                                    
                                        
                                    

                                    
                                    
                                        
                                            
                                                
                                                    
                                                    
                                                        
                                                    
                                                
                                                
                                                   
                                                       
                                                       
                                                           
                                                           
                                                       
                                                       
                                                       
                                                       
                                                               
                                                                   
                                                                   
                                                               
                                                       

                                                       

                                                   
                                                
                                                
                                                    
                                                
                                            
                                        
                                    







                                
                                
                                
                                
                                    
                                    
                                        
                                            
                                        
                                    





                                
                            
                            
                                
                            

                                
                                    
                                        
                                    
                                
                                
                                    
                                        
                                    
                                
                                
                                    
                                        
                                    

                                
                                
                                    
                                        
                                    

                                
                                
                                    
                                        
                                    

                                
                                
                                    
                                        
                                    

                                

                            
                            
                            
                        
                 


            
              
                  
                  
                  
              
            


            
                
                    
                        
                        
                        
                        
                    
                    
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                    
                


                
                    
                        
                        
                        
                        
                        
                        
                    
                    
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                    
                


                
                    
                        
                        
                        
                        
                        
                    
                    
                        
                        
                        
                            
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                    
                
                
                
            

            
        
        
            
            
                
                  
                  
                  
                  
                  
                  
                  
                
                
                
                  
                    
                    
                    
                    
                    
                        
                            
                            
                            
                            
                            
                            
                            
                            
                            
                        
                      
                        
                            
                            
                            
                        
                      
                    
                    
                        
                        
                        
                    


                    
                        
                            
                            
                        
                        
                            
                                
                                    
                                    
                                    
                                
                                
                                    
                                    
                                    
                                    
                                    
                                    
                                
                                
                                    
                                    
                                    
                                    
                                    
                                    
                                
                                
                                    
                                        
                                        
                                        
                                        
                                        
                                        
                                    
                                
                            
                        
                    
                    
                    
                        
                            
                            
                            
                            
                        
                        
                            
                        
                        
                            
                            
                        
                    
                    
                    

                  
                  
                    
                  
                  
                    
                  
                  
                    
                  
                  
                    
                  
                  
                    
                  
                  
                    
                  
                
              
        

    


<?php $__env->stopSection(); ?>

<?php echo $__env->make("include", \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\Users\khaled nabawy\Desktop\macpos\resources\views/branches.blade.php ENDPATH**/ ?>