<div class="pd-20 card-box" >
    <form >
        <div class="row">
          <div class="col-md-6">
            
                 <div class="row mb-2">
                     <div class="col-md-6">
                        
                             <label for="">Date <span style="color:red;">*</span></label>
                             <input type="date"  class="form-control form-control-sm" wire:model="date_achat" tabindex="1" maxlength="50" >
                             <!-- __BLOCK__ --><?php $__errorArgs = ['date_achat'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                 <small class="form-text text-danger"><?php echo e($message); ?></small>
                             <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?> <!-- __ENDBLOCK__ -->
                         
                     </div>
                     <div class="col-md-6">
                         
                             <label for="">Référence<span style="color:red;">*</span></label>
                             <input type="text"  class="form-control form-control-sm" wire:model="reference_achat" tabindex="2" maxlength="50"   >
                             <!-- __BLOCK__ --><?php $__errorArgs = ['reference_achat'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                 <small class="form-text text-danger"><?php echo e($message); ?></small>
                             <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?> <!-- __ENDBLOCK__ -->
                         
                     </div>
                     </div>

               
                     <div class=" row mb-2">
                         <div class="col-md-12">
                            
                                 <label for="">Libellé<span style="color:red;">*</span></label>
                                 <input type="text"  class="form-control form-control-sm" wire:model="libelle_achat" tabindex="5" maxlength="150"   >
                                 <!-- __BLOCK__ --><?php $__errorArgs = ['libelle_achat'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                     <small class="form-text text-danger"><?php echo e($message); ?></small>
                                 <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?> <!-- __ENDBLOCK__ -->
                             
                         </div>
                     </div>

                     <div class="row mb-2">
                     <div class="col-md-6">
                        
                             <label for="">Fournisseur <span style="color:red;">*</span></label>
                           
                             <select 
                                 class="form-control form-control-sm"
                                 wire:model.live="idFournisseur_achat"
                                 tabindex="6"
                                         >
                                     <option value="">select</option>
                                 <!-- __BLOCK__ --><?php $__currentLoopData = get_tiers('fourn'); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $info): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                         <option value="<?php echo e($info->id); ?>"><?php echo e($info->denomination); ?> </option>
                                 <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> <!-- __ENDBLOCK__ -->
                                             
                             </select>
                             
                         
                     </div>
                     <div class="col-md-6">
                  
                             <label for="">Compte tiers</label>
                             
                             <select 
                                         class="form-control form-control-sm"
                                         wire:model.live="compte_tiers_achat" 
                                         tabindex="7"
                                                 >
                                             <option value="" disabled></option>
                                         <!-- __BLOCK__ --><?php if($ListCompte_achat): ?>
                                             <!-- __BLOCK__ --><?php $__currentLoopData = $ListCompte_achat; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $compte): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                     <option <?php if($value_tiers == $compte->num_compte): echo 'selected'; endif; ?> value="<?php echo e($compte->num_compte); ?>"><?php echo e($compte->num_compte); ?> - <?php echo e($compte->nom_compte); ?></option>
                                             <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> <!-- __ENDBLOCK__ -->
                                         <?php endif; ?> <!-- __ENDBLOCK__ -->
                                                     
                             </select>
                             <!-- __BLOCK__ --><?php $__errorArgs = [''];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                 <small class="form-text text-danger"><?php echo e($message); ?></small>
                             <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?> <!-- __ENDBLOCK__ -->
                             
                     
                        
                     </div>
                  
                 </div>
             
            
                 <div class="row mb-3">
                     <div class="col-md-4">
                         
                             <label for="">Compte Géneral</label>
                             
                             <input type="text"  class="form-control form-control-sm" wire:model="compte_achat" maxlength="8"  tabindex="9">
                             
                             <!-- __BLOCK__ --><?php $__errorArgs = ['compte_achat'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                 <small class="form-text text-danger"><?php echo e($message); ?></small>
                             <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?> <!-- __ENDBLOCK__ -->
                             
                         
                        
                     </div>
                     <div class="col-md-3">
                         
                             <label for="">Débit</label>
                             <input type="text"  class="form-control form-control-sm" wire:model="debit_achat" 
                             wire:keydown.enter="addItemby"
                             tabindex="10" maxlength="20"
                             >
                             <!-- __BLOCK__ --><?php $__errorArgs = ['debit_achat'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                 <small class="form-text text-danger"><?php echo e($message); ?></small>
                             <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?> <!-- __ENDBLOCK__ -->
                         
                     </div>
                     <div class="col-md-3">
                         
                             <label for="">Crédit</label>
                             <input type="text"  class="form-control form-control-sm" wire:model="credit_achat" 
                             wire:keydown.enter="addItemby"
                             tabindex="11" maxlength="20"
                             >
                             <!-- __BLOCK__ --><?php $__errorArgs = ['credit_achat'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                 <small class="form-text text-danger"><?php echo e($message); ?></small>
                             <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?> <!-- __ENDBLOCK__ -->
                         
                     </div>
                     <div class="col-md-2 ">
                         <div class="row " style="padding-top: 38px;">
                             
                             <span class="badge  badge-primary" wire:click="addItem_achat" style="cursor:pointer;" title="Ajouter" >
                                
                                 <i class="icon-copy fa fa-check" ></i>
                             </span> 
                             &nbsp;&nbsp;
                             <span class="badge badge-dark" wire:click="equilibrerJAchat" style="cursor:pointer;" title="Equilibrer" >
                                 <i class="icon-copy fa fa-location-arrow" ></i>
                                 
                             </span>
                         </div>
                     </div>
                 </div>

                 <div class="row">

                     <div class="col-md-8 offset-md-2">
       

                         <!-- __BLOCK__ --><?php $__errorArgs = ['MyArray_achat'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                         <table border="0" class="table-striped table-sm" style="font-size:0.8em; width:100%;">
                             <thead>
                                 <tr>
                                     <td>compte</td>
                                     <td >débit</td>
                                     <td >crédit</td>
                                    
                                 </tr>
                             </thead>    
                             <tbody>
                                 <tr>
                                     <td colspan="3" align="center"  class="text-danger" >
                                             <?php echo e($message); ?>

                                     </td>
                                 </tr>
                             </tbody>
                         </table>
                         <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?> <!-- __ENDBLOCK__ -->
                     </div>

                 </div>
            
                   
          </div>
          <div class="col-md-6">
             <div class="row mb-3">
                 <div class="col-md-6">
                     
                         <label for="">Numéro facture</label>
                         <input type="text"  class="form-control form-control-sm" wire:model="NumFacture_achat" tabindex="3"  >
                         <!-- __BLOCK__ --><?php $__errorArgs = ['NumFacture_achat'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                             <small class="form-text text-danger"><?php echo e($message); ?></small>
                         <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?> <!-- __ENDBLOCK__ -->
             
                 </div>

                 <div class="col-md-6">
                     
                         <label for="">Devise <span style="color:red;">*</span></label>
                         <select class="form-control form-control-sm" wire:model="devise_achat" tabindex="4">
                            <!-- __BLOCK__ --><?php $__currentLoopData = get_select_devise(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $devise): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <option value="<?php echo e($devise->devise); ?>"><?php echo e($devise->devise); ?> - <?php echo e($devise->intitule); ?></option>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> <!-- __ENDBLOCK__ -->
                         </select>
                         <!-- __BLOCK__ --><?php $__errorArgs = ['devise_achat'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                             <small class="form-text text-danger"><?php echo e($message); ?></small>
                         <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?> <!-- __ENDBLOCK__ -->
                     
                 </div>
             </div>

             <div class="row mx-1" style="border: 1px solid #ABB2B9; height: 220px; position:relative;">
                 <div style="width: 100%; height: 180px;overflow: auto;">
                     
                     <!-- __BLOCK__ --><?php if(empty($MyArray_achat)): ?>
                          
                     <?php else: ?>
                         <table border="0" class="table-striped table-sm" style="font-size:0.8em; width:100%;">
                         <thead>
                             <tr style="font-weight: 600;">
                                 <td>compte</td>
                                 <td>intitulé de compte</td>
                                 <td align="right">débit</td>
                                 <td align="right">crédit</td>
                                 <td></td>
                             </tr>
                         </thead>    
                         <tbody>
                             <!-- __BLOCK__ --><?php $__currentLoopData = $MyArray_achat; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $data): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                             
                                 <tr>
                                     <td><?php echo e($data['compte']); ?></td>
                                     <td><?php echo e($data['intitule']); ?></td>
                                     <td align="right"> <!-- __BLOCK__ --><?php if($data['debit'] == 0): ?> <?php echo e(''); ?>  <?php else: ?> <?php echo e(get_format_montant($data['debit'])); ?> <?php endif; ?> <!-- __ENDBLOCK__ --> </td>
                                     <td align="right"><!-- __BLOCK__ --><?php if($data['credit'] == 0): ?> <?php echo e(''); ?>  <?php else: ?> <?php echo e(get_format_montant($data['credit'])); ?> <?php endif; ?> <!-- __ENDBLOCK__ --> </td>
                                     <td align="center" ><span class="text-danger"  wire:click="removeItem_achat(<?php echo e($data['compte']); ?>)"  style="cursor:pointer;"><i class="fa fa-times"></i></span></td>
                                 </tr>
                             <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> <!-- __ENDBLOCK__ -->

                             
                         </tbody>
                         </table>
                     <?php endif; ?> <!-- __ENDBLOCK__ -->
                 </div>
                 
                 <div class="py-1" style="height:40px;border: 0px solid green; position:absolute;
                 bottom:0;width:100%; display:flex; justify-content:space-around;background-color:<?php if($isEgal_achat): ?> #1D8348 <?php else: ?> #EAECEE <?php endif; ?>">
                    <span style="font-size:0.8em;">
                     Débit : <strong style="font-size:1.3em;font-weight:700;color:<?php if($isEgal_achat): ?> white <?php else: ?> '' <?php endif; ?>;"><?php echo e(get_format_montant($total_debit)); ?></strong></span>  
                    <span class="py-1">|</span> 
                    <span style="font-size:0.8em;">
                     Crédit : <strong style="font-size:1.3em;font-weight:700;color:<?php if($isEgal_achat): ?> white <?php else: ?> '' <?php endif; ?>;"><?php echo e(get_format_montant($total_credit)); ?></strong></span> 
                 </div>
             </div>

          </div>
         
        </div>
        <div class="row zone_btn">
                 <button type="button" wire:click="resetForm_achat" class="btn btn-light btn-sm">Annuler</button>
                             
                 <button type="button" class="btn btn-primary btn-sm" wire:click="saveAchat" wire:loading.attr="disabled" style="width:15%;" <?php if(!$isEgal_achat): ?> disabled <?php endif; ?>> 
                         
                         <div class="spinner-border spinner-border-sm"  role="status" wire:loading wire:target="saveAchat">
                             <span class="visually-hidden"></span>
                         </div>
         
                         <div wire:loading.remove wire:target="saveAchat">
                             Enregistrer 
                         </div>
                     
                 </button>

                 <button type="button" wire:click="$dispatch('OpenModalFacture',['achat'])" class="btn btn-outline-success btn-sm">Facture en cours</button>
                 <button type="button" wire:click="goToJournalCompta" class="btn btn-outline-success btn-sm">Apercu Journal</button>
                 <button type="button" wire:click="$dispatch('NewTiers')" class="btn btn-outline-primary btn-sm">Ajouter Tiers</button>
        </div>
     </form>
</div><?php /**PATH D:\laravel_apps\big-manager\resources\views/livewire/saisie-journal-achat.blade.php ENDPATH**/ ?>