

<?php $__env->startSection('content'); ?>

     

    <div class="row" style="margin:20px">
          <div class="col-md-3 col-sm-6 col-12">
            <div class="info-box">
 
              <div class="info-box-content" style="height: 100px;">
                <span class="info-box-text  bg-info" style="border-radius: 6px;height: 40px;display: flex;justify-content: center;align-items: center;"> <b style="font-size:22px"> العهدة الغير المربوطة بمبلغ</b> </span>
                <span class="info-box-number" style="text-align:center"><?php echo e($trust->name); ?></span>
              </div>
              <!-- /.info-box-content -->
            </div>
            <!-- /.info-box -->
          </div>

          <div class="col-md-3 col-sm-6 col-12">
            <div class="info-box">
 
              <div class="info-box-content" style="height: 100px;">
                <span class="info-box-text  bg-info" style="border-radius: 6px;height: 40px;display: flex;justify-content: center;align-items: center;"> <b style="font-size:22px"> تاريخ الانشاء</b> </span>
                <span class="info-box-number" style="text-align:center"><?php echo e($trust->created_at); ?></span>
              </div>
              <!-- /.info-box-content -->
            </div>
            <!-- /.info-box -->
          </div>

          <div class="col-md-3 col-sm-6 col-12">
            <div class="info-box">
              

              <div class="info-box-content" style="height: 100px;">
                <span class="info-box-text bg-warning" style="border-radius: 6px;height: 40px;display: flex;justify-content: center;align-items: center;"><b style="font-size:22px"> أجمالي المصروفات  </b></span>
                <span class="info-box-number" style="text-align:center"><?php echo e($total_pay); ?></span>
              </div>
              <!-- /.info-box-content -->
            </div>
            <!-- /.info-box -->
          </div>


          <div class="col-md-3 col-sm-6 col-12">
            <div class="info-box">
              

              <div class="info-box-content" style="height: 100px;">
                <span class="info-box-text bg-warning" style="border-radius: 6px;height: 40px;display: flex;justify-content: center;align-items: center;"><b style="font-size:22px">  المردود الي الخزنة  </b></span>
                <span class="info-box-number" style="text-align:center"><?php echo e($total_pay_back); ?></span>
              </div>
              <!-- /.info-box-content -->
            </div>
            <!-- /.info-box -->
          </div>


          <!-- /.col -->
          <div class="col-md-3 col-sm-6 col-12">
            <div class="info-box">
               

              <div class="info-box-content" style="height: 100px;">
                <span class="info-box-text bg-warning" style="border-radius: 6px;height: 40px;display: flex;justify-content: center;align-items: center;"><b style="font-size:22px">أجمالي الفواتير</b></span>
                <span class="info-box-number" style="text-align:center"> <?php echo e($trust->total_invoices); ?></span>
              </div>
              <!-- /.info-box-content -->
            </div>
            <!-- /.info-box -->
          </div>
          <!-- /.col -->

          <div class="col-md-3 col-sm-6 col-12">
            <div class="info-box">
              <div class="info-box-content" style="height: 100px;">
                <span class="info-box-text bg-info" style="border-radius: 6px;height: 40px;display: flex;justify-content: center;align-items: center;"><b style="font-size:22px">الفرع</b></span>
                <span class="info-box-number" style="text-align:center"><?php echo e($trust->branch->name); ?></span>
              </div>
              <!-- /.info-box-content -->
            </div>
            <!-- /.info-box -->
          </div>
          <!-- /.col -->
          
          <?php if( $trust->status == "Active"): ?>
          <div class="col-md-3 col-sm-6 col-12">
            <div class="info-box">
              <div class="info-box-content" style="">
                <span class="info-box-text bg-danger" style="border-radius: 6px;height: 40px;display: flex;justify-content: center;align-items: center;"><b style="font-size:22px">الأكشن</b></span>
                <?php if( ($total_pay - $total_pay_back)  == $trust->total_invoices): ?>
                 
                <span class="info-box-number" style="text-align:center"> يمكنك تصفية العهدة الان  
                <a href='<?php echo e(url("/trust/end/$trust->id")); ?>'   class="btn" style="background-color:#2C4E71;color:#FFF;margin-left:10px">تصفية العهدة الان </a><br/><br/>
              </span>
              <?php elseif( ($total_pay - $total_pay_back)   >  $trust->total_invoices): ?>
              <?php  
              $sub=($total_pay - $total_pay_back)  - $trust->total_invoices ;
               ?>
              <span class="info-box-number" style="text-align:center"> يجب رد المبلغ المتبقي الي الخزنة   <?php echo e($sub); ?>

              <a href='<?php echo e(url("/trust/safe_back/$trust->id")); ?>'  class="btn" style="background-color:#2C4E71;color:#FFF;margin-left:10px;width:200px">رد مبلغ الي الخزنة</a><br/><br/>
              </span>
               
              <?php elseif( ( $total_pay - $total_pay_back )   <  $trust->total_invoices): ?>
              <span class="info-box-number" style="text-align:center"> يجب صرف سند جديد عهدة  بقيمة   <?php echo e($trust->total_invoices - ($total_pay - $total_pay_back)); ?>

                <a href="<?php echo e(url('/payment_voucher/not_tie_trust_create')); ?>"  class="btn" style="background-color:#2C4E71;color:#FFF;margin-left:10px;font-size:13px">أضافة سند صرف عهدة غير مربوطة بمبلغ  </a><br/><br/>
              </span>
              <?php endif; ?>
               </div>
            </div>
          </div>

          <?php endif; ?>


        </div>
    
    <div class="card">
               
              <!-- /.card-header -->
              <div class="card-body">
                <table  class="table table-bordered table-striped">
                  <thead>
                  
                 <tr >
                  <th style="text-align:center;vertical-align: middle;background-color:#2C4E71;color:#FFF;border-color:#0000003c;border-width: 2px;"> رقم سند الصرف   </th>
                  <th style="text-align:center;vertical-align: middle;background-color:#2C4E71;color:#FFF;border-color:#0000003c;border-width: 2px;"> نوع السند    </th>

                  <th style="text-align:center;vertical-align: middle;background-color:#2C4E71;color:#FFF;border-color:#0000003c;border-width: 2px;"> المبلغ   </th>
                  

                  <th style="text-align:center;vertical-align: middle;background-color:#2C4E71;color:#FFF;border-color:#0000003c;border-width: 2px;"> يصرف الي  </th>
                  <th style="text-align:center;vertical-align: middle;background-color:#2C4E71;color:#FFF;border-color:#0000003c;border-width: 2px;"> طريقة الدفع  </th>
                  <th style="text-align:center;vertical-align: middle;background-color:#2C4E71;color:#FFF;border-color:#0000003c;border-width: 2px;"> نظير  </th>
                  <th style="text-align:center;vertical-align: middle;background-color:#2C4E71;color:#FFF;border-color:#0000003c;border-width: 2px;"> الحالة  </th>
                  <th style="text-align:center;vertical-align: middle;background-color:#2C4E71;color:#FFF;border-color:#0000003c;border-width: 2px;"> ملاحظات  </th>

                </tr>
                 </thead>
              <tbody>
                           
                <?php foreach( $sendats as $sand ): ?>   
                 
                <tr>
                 
                  <td style="text-align:center; word-break: break-word; font-weight:900;border-color:#0000003c;font-size:18px" ># <?php echo e($sand->id); ?> </td>
                  <td style="text-align:center; word-break: break-word; font-weight:900;border-color:#0000003c;font-size:18px" > سند صرف عهدة غير مربوطة بمبلغ</td>
                  <td style="text-align:center; word-break: break-word; font-weight:900;border-color:#0000003c;font-size:18px" ><?php echo e($sand->pay); ?> </td>
                  <td style="text-align:center; word-break: break-word; font-weight:900;border-color:#0000003c;font-size:18px" ><?php echo e($sand->general_name); ?> </td>
                  <td style="text-align:center; word-break: break-word; font-weight:900;border-color:#0000003c;font-size:18px" ><?php echo e($sand->safe_account->payment_method->name); ?> </td>
                  <td style="text-align:center; word-break: break-word; font-weight:900;border-color:#0000003c;font-size:18px" ><?php echo e($sand->trust->name); ?> </td>
                  
                  <?php if( $sand->approve == "Waiting" ): ?>
                  <td style="text-align:center; word-break: break-word; font-weight:900;border-color:#0000003c;font-size:18px; background-color:orange" > Waiting...</td>
                  <?php elseif( $sand->approve == "Approved" ): ?>
                  <td style="text-align:center; word-break: break-word; font-weight:900;border-color:#0000003c;font-size:18px;background-color:green;color:#FFF" >  Approved </td>
                  <?php else: ?>
                  <td style="text-align:center; word-break: break-word; font-weight:900;border-color:#0000003c;font-size:18px;background-color:red" >  Rejected </td>
                  <?php endif; ?> 

                  <td style="text-align:center; word-break: break-word; font-weight:900;border-color:#0000003c;font-size:18px" ><?php echo e($sand->note2); ?> </td>
  

                </tr>
               <?php endforeach; ?>
                </tbody>
                </table>
              </div>
              <!-- /.card-body -->
            </div>  

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

<?php echo $__env->make('layouts.masterHome2', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>