<div class="livewire-component-wrapper">
	<!-- Add Modal -->
          <div wire:ignore.self class="modal fade" id="addModal" tabindex="-1" aria-hidden="true">
            <div class="modal-dialog" role="document">
              <div class="modal-content">
                <form class="needs-validation" novalidate>
				<?php echo csrf_field(); ?>
                <div class="modal-header">
                  <h5 class="modal-title" id="addModalLabel1">Add Finance Bill</h5>
                  <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                  <div class="row">
				  
				  <div class="col-md-12 mb-3">
                      <label for="addName" class="form-label">Finance Bill Name</label>
                      <textarea name="Name" rows="2" wire:model="Name" class="form-control" placeholder="Finance Bill Name" required><?php echo e(old('Name')); ?></textarea>
					  <!--[if BLOCK]><![endif]--><?php $__errorArgs = ['Name'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> <span class="text-danger alert-sm"><?php echo e($message); ?></span> <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?><!--[if ENDBLOCK]><![endif]-->
					      <div class="invalid-feedback">Name is required</div>
                    </div>
				  
                    <div class="col-md-12 mb-3">
                      <label for="addStartPeriod" class="form-label">Start Period</label>
						<div class="input-group flatpickr ">
						  <input type="text"  id="PeriodStart" class="form-control PeriodStart" name="PeriodStart" wire:model="PeriodStart" placeholder="Start Period" aria-label="Start Period" aria-describedby="start-period" data-input readonly>
						  <span class="input-group-text start-period" id="start-period" data-toggle><i class="bx bx-calendar bx-sm me-sm-2"></i></span>
						</div>
					  <!--[if BLOCK]><![endif]--><?php $__errorArgs = ['PeriodStart'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> <span class="text-danger alert-sm"><?php echo e($message); ?></span> <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?><!--[if ENDBLOCK]><![endif]-->
					      <div class="invalid-feedback">Start period is required</div>
                    </div>
					
					<div class="col-md-12 mb-3">
                      <label for="addEndPeriod" class="form-label">End Period</label>
						<div class="input-group flatpickr ">
						  <input type="text"  id="PeriodEnd" class="form-control PeriodEnd" name="PeriodEnd" wire:model="PeriodEnd" placeholder="End Period" aria-label="End Period" aria-describedby="end-period" data-input readonly>
						  <span class="input-group-text end-period" id="end-period" data-toggle><i class="bx bx-calendar bx-sm me-sm-2"></i></span>
						</div>
					  <!--[if BLOCK]><![endif]--><?php $__errorArgs = ['PeriodEnd'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> <span class="text-danger alert-sm"><?php echo e($message); ?></span> <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?><!--[if ENDBLOCK]><![endif]-->
					      <div class="invalid-feedback">End period is required</div>
                    </div>
					
					<div class="col-md-12 mb-3">
					  <label for="addStream" class="form-label">Stream</label>
					  <select class="form-select" name="StreamID" wire:model="StreamID">
						<option value="" selected hidden>Select Revenue Stream</option>
						<!--[if BLOCK]><![endif]--><?php $__currentLoopData = $revenuestreams; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
						<option value="<?php echo e($item->StreamID); ?>"><?php echo e($item->StreamName); ?></option>
						<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><!--[if ENDBLOCK]><![endif]-->
					  </select>
					  <!--[if BLOCK]><![endif]--><?php $__errorArgs = ['StreamID'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> <span class="text-danger alert-sm"><?php echo e($message); ?></span> <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?><!--[if ENDBLOCK]><![endif]-->
					      <div class="invalid-feedback">Stream is required</div>
                    </div>
					
					<div class="col-md-12 mb-3">
					  <label for="addZone" class="form-label">Zone</label>
					  <select class="form-select" name="ZoneID" wire:model="ZoneID">
						<option value="" selected hidden>Select Zone</option>
						<!--[if BLOCK]><![endif]--><?php $__currentLoopData = $zones; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
						<option value="<?php echo e($item->ZoneID); ?>"><?php echo e($item->ZoneName); ?></option>
						<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><!--[if ENDBLOCK]><![endif]-->
					  </select>
					  <!--[if BLOCK]><![endif]--><?php $__errorArgs = ['ZoneID'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> <span class="text-danger alert-sm"><?php echo e($message); ?></span> <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?><!--[if ENDBLOCK]><![endif]-->
					      <div class="invalid-feedback">Zone is required</div>
                    </div>
					
					<div class="col-md-12 mb-3">
                      <label for="addAmount" class="form-label">Amount</label>
						  <input type="text"   class="form-control" name="Amount" wire:model.live.debounce.500ms="Amount" placeholder="Enter Amount" aria-label="Amount" aria-describedby="Amount">
					  <!--[if BLOCK]><![endif]--><?php $__errorArgs = ['Amount'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> <span class="text-danger alert-sm"><?php echo e($message); ?></span> <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?><!--[if ENDBLOCK]><![endif]-->
					      <div class="invalid-feedback">Amount is required</div>
                    </div>
			
                  </div>	
                </div>
                <div class="modal-footer">
				  <button type="button" class="btn btn-kco-green" wire:click="saveFinanceBill">Save</button>
                  <button type="button" class="btn btn-outline-kco" data-bs-dismiss="modal">Close</button>
                </div>
			  </form>
              </div>
            </div>
          </div>
		  
		  <!-- view Modal -->
          <div wire:ignore.self class="modal fade" id="viewModal" tabindex="-1" aria-hidden="true">
            <div class="modal-dialog" role="document">
              <div class="modal-content">
                <form class="needs-validation" novalidate>
				<?php echo csrf_field(); ?>
				<div id="printable">
                <div class="modal-header">
                  <h5 class="modal-title" id="editModalLabel1">Finance Bill : <?php echo e($this->Identifier); ?></h5>
                  <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                  <div class="row">
				  
				  <div class="col-md-12 mb-3">
                      <label for="addName" class="form-label">Finance Bill</label>
                      <textarea name="Name" rows="4" wire:model="Name" class="form-control readonly" placeholder="Finance Bill Name" disabled></textarea>
                    </div>
				  
				  <div class="col-md-12 mb-3">
                      <label for="DraftedBy" class="form-label">Drafted By</label>
						  <input type="text"  id="DrafterID" class="form-control readonly" name="DrafterID" value="<?php echo e($this->DrafterID); ?>"  aria-label="DrafterID" aria-describedby="DrafterID" data-input disabled>
                    </div>
					
					<div class="col-md-12 mb-3">
                      <label for="DraftedAt" class="form-label">Drafted On</label>
						  <input type="text"  id="DraftedAt" class="form-control readonly" name="DraftedOn" wire:model="DraftedOn"  aria-label="DraftedOn" aria-describedby="DraftedOn" data-input disabled>
                    </div>
				  
                    <div class="col-md-12 mb-3">
                      <label for="addStartPeriod" class="form-label">Start Period</label>
						  <input type="text"  id="PeriodStart2" class="form-control readonly" name="PeriodStart" wire:model="PeriodStart"  aria-label="Start Period" aria-describedby="start-period" data-input disabled>
                    </div>
					
					<div class="col-md-12 mb-3">
                      <label for="addEndPeriod" class="form-label">End Period</label>
						  <input type="text"  id="PeriodEnd2" class="form-control readonly" name="PeriodEnd" wire:model="PeriodEnd" aria-label="End Period" aria-describedby="end-period" data-input disabled>
                    </div>

					<div class="col-md-12 mb-3">
					  <label for="addStream" class="form-label">Stream</label>
					  <input type="text"  id="StreamName" class="form-control readonly" name="StreamName" wire:model="StreamName" aria-label="StreamName" aria-describedby="StreamName" data-input disabled>
                    </div>
					
					<div class="col-md-12 mb-3">
					  <label for="addZone" class="form-label">Zone</label>
					  <input type="text"  id="ZoneName" class="form-control readonly" name="ZoneName" wire:model="ZoneName" aria-label="ZoneName" aria-describedby="ZoneName" data-input disabled>
                    </div>
					
					<div class="col-md-12 mb-3">
                      <label for="addAmount" class="form-label">Amount</label>
						  <input type="text"   class="form-control readonly" name="Amount" wire:model.live.debounce.500ms="Amount" aria-label="Amount" aria-describedby="Amount" disabled>
                    </div>
						
                  </div>	
                </div>
				</div><!--./printable-->
				
                <div class="modal-footer">
							<!--[if BLOCK]><![endif]--><?php if($this->Response==1): ?>
								<button type="button" class="btn btn-success" disabled><i class='bx bxs-check-circle'></i>&nbsp;You Approved Bill</button>
							<?php endif; ?><!--[if ENDBLOCK]><![endif]-->
							<!--[if BLOCK]><![endif]--><?php if($this->Response==2): ?>
								<button type="button" class="btn btn-danger" disabled><i class='bx bxs-x-circle'></i>&nbsp;You Rejected Bill</button>
							<?php endif; ?><!--[if ENDBLOCK]><![endif]-->		
				
						<!--[if BLOCK]><![endif]--><?php if($this->has_responded==1): ?>
						<!--[if BLOCK]><![endif]--><?php if($this->has_been_actioned==0): ?>
						<button type="button"  class="btn btn-outline-warning" wire:click="$dispatch('confirmRetract',{ FinanceBillID:<?php echo e($this->FinanceBillID); ?>, LoggedInUser:<?php echo e($this->LoggedInUser); ?>, targetComponent: 'financebills', targetEvent: 'retractDecision' })">Retract</button>
						<?php endif; ?><!--[if ENDBLOCK]><![endif]-->
						<?php endif; ?><!--[if ENDBLOCK]><![endif]-->
						
					<!--[if BLOCK]><![endif]--><?php if($this->canUpdate==1): ?>
					<!--[if BLOCK]><![endif]--><?php if($this->has_been_actioned==0): ?>
				  <button type="button" class="btn btn-kco-green" id="updateBtn" wire:click="updateDraftFinanceBill">Update</button>
					<?php endif; ?><!--[if ENDBLOCK]><![endif]-->
					<?php endif; ?><!--[if ENDBLOCK]><![endif]-->
					
					<!--[if BLOCK]><![endif]--><?php if($this->has_responded==0): ?>
					<!--[if BLOCK]><![endif]--><?php if($this->has_been_actioned==0): ?>
					<button type="button" class="btn btn-success" wire:click="$dispatch('ConfirmApproveBill',{ FinanceBillID:<?php echo e($this->FinanceBillID); ?>, LoggedInUser:<?php echo e($this->LoggedInUser); ?>, targetComponent: 'financebills', targetEvent: 'approveBill' })">Approve</button>
					<button type="button" class="btn btn-danger" wire:click="$dispatch('ConfirmRejectBill',{ FinanceBillID:<?php echo e($this->FinanceBillID); ?>, LoggedInUser:<?php echo e($this->LoggedInUser); ?>, targetComponent: 'financebills', targetEvent: 'rejectBill' })">Reject</button>
					<?php endif; ?><!--[if ENDBLOCK]><![endif]-->
					<?php endif; ?><!--[if ENDBLOCK]><![endif]-->
					
					<button type="button" class="btn btn-outline-kco" id="printBtn">Print</button>
                    <button type="button" class="btn btn-outline-kco close-edit-modal" data-bs-dismiss="modal">Close</button>
					
					<div style="margin-top:20px;">
					<!--[if BLOCK]><![endif]--><?php if(auth()->user()->can('pass-financebills')): ?>
					<!--[if BLOCK]><![endif]--><?php if($this->has_been_actioned==0): ?>
					<button type="button" class="btn btn-success" wire:click="$dispatch('ConfirmPassBill',{ FinanceBillID:<?php echo e($this->FinanceBillID); ?>, LoggedInUser:<?php echo e($this->LoggedInUser); ?>, targetComponent: 'financebills', targetEvent: 'passBill' })">Pass</button>
					<button type="button" class="btn btn-danger" wire:click="$dispatch('ConfirmAnnulBill',{ FinanceBillID:<?php echo e($this->FinanceBillID); ?>, LoggedInUser:<?php echo e($this->LoggedInUser); ?>, targetComponent: 'financebills', targetEvent: 'annulBill' })">Annul</button>
					<?php endif; ?><!--[if ENDBLOCK]><![endif]-->
					<?php endif; ?><!--[if ENDBLOCK]><![endif]-->
					</div>
                </div>
				
			  </form>
              </div>
            </div>
          </div>

		<!-- edit Modal -->
          <div wire:ignore.self class="modal fade" id="editModal" tabindex="-1" aria-hidden="true">
            <div class="modal-dialog" role="document">
              <div class="modal-content">
                <form class="needs-validation" novalidate>
				<?php echo csrf_field(); ?>
                <div class="modal-header">
                  <h5 class="modal-title" id="editModalLabel1">Edit Finance Bill</h5>
                  <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                  <div class="row">
				  
                    <div class="col-md-12 mb-3">
                      <label for="addStartPeriod" class="form-label">Start Period</label>
						<div class="input-group flatpickr">
						  <input type="text"  id="PeriodStart2" class="form-control dtpicker PeriodStart" name="PeriodStart" wire:model="PeriodStart" placeholder="Start Period" aria-label="Start Period" aria-describedby="start-period" data-input readonly>
						  <span class="input-group-text" id="start-period2" data-toggle><i class="bx bx-calendar bx-sm me-sm-2"></i></span>
						</div>
					  <!--[if BLOCK]><![endif]--><?php $__errorArgs = ['PeriodStart'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> <span class="text-danger alert-sm"><?php echo e($message); ?></span> <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?><!--[if ENDBLOCK]><![endif]-->
					      <div class="invalid-feedback">Start period is required</div>
                    </div>
					
					<div class="col-md-12 mb-3">
                      <label for="addEndPeriod" class="form-label">End Period</label>
						<div class="input-group flatpickr">
						  <input type="text"  id="PeriodEnd2" class="form-control dtpicker PeriodEnd" name="PeriodEnd" wire:model="PeriodEnd" placeholder="End Period" aria-label="End Period" aria-describedby="end-period" data-input readonly>
						  <span class="input-group-text end-period" id="end-period2" data-toggle><i class="bx bx-calendar bx-sm me-sm-2"></i></span>
						</div>
					  <!--[if BLOCK]><![endif]--><?php $__errorArgs = ['PeriodEnd'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> <span class="text-danger alert-sm"><?php echo e($message); ?></span> <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?><!--[if ENDBLOCK]><![endif]-->
					      <div class="invalid-feedback">End period is required</div>
                    </div>

					<div class="col-md-12 mb-3">
					  <label for="addSubCounty" class="form-label">Stream</label>
					  <select class="form-select" name="StreamID" wire:model="StreamID">
						<option value="" selected hidden>Select Revenue Stream</option>
						<!--[if BLOCK]><![endif]--><?php $__currentLoopData = $revenuestreams; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
						<option value="<?php echo e($item->StreamID); ?>"><?php echo e($item->StreamName); ?></option>
						<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><!--[if ENDBLOCK]><![endif]-->
					  </select>
					  <!--[if BLOCK]><![endif]--><?php $__errorArgs = ['StreamID'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> <span class="text-danger alert-sm"><?php echo e($message); ?></span> <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?><!--[if ENDBLOCK]><![endif]-->
					      <div class="invalid-feedback">Stream is required</div>
                    </div>
					
					<div class="col-md-12 mb-3">
					  <label for="addZone" class="form-label">Zone</label>
					  <select class="form-select" name="ZoneID" wire:model="ZoneID">
						<option value="" selected hidden>Select Zone</option>
						<!--[if BLOCK]><![endif]--><?php $__currentLoopData = $zones; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
						<option value="<?php echo e($item->ZoneID); ?>"><?php echo e($item->ZoneName); ?></option>
						<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><!--[if ENDBLOCK]><![endif]-->
					  </select>
					  <!--[if BLOCK]><![endif]--><?php $__errorArgs = ['ZoneID'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> <span class="text-danger alert-sm"><?php echo e($message); ?></span> <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?><!--[if ENDBLOCK]><![endif]-->
					      <div class="invalid-feedback">Zone is required</div>
                    </div>
					
					<div class="col-md-12 mb-3">
                      <label for="addName" class="form-label">Finance Bill</label>
                      <textarea name="Name" rows="4" wire:model="Name" class="form-control" placeholder="Finance Bill Name" required><?php echo e(old('Name')); ?></textarea>
					  <!--[if BLOCK]><![endif]--><?php $__errorArgs = ['Name'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> <span class="text-danger alert-sm"><?php echo e($message); ?></span> <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?><!--[if ENDBLOCK]><![endif]-->
					      <div class="invalid-feedback">Name is required</div>
                    </div>
					
					<div class="col-md-12 mb-3">
                      <label for="addAmount" class="form-label">Amount</label>
						  <input type="text"   class="form-control" name="Amount" wire:model.live.debounce.500ms="Amount" placeholder="Enter Amount" aria-label="Amount" aria-describedby="Amount">
					  <!--[if BLOCK]><![endif]--><?php $__errorArgs = ['Amount'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> <span class="text-danger alert-sm"><?php echo e($message); ?></span> <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?><!--[if ENDBLOCK]><![endif]-->
					      <div class="invalid-feedback">Amount is required</div>
                    </div>
						
                  </div>	
                </div>
                <div class="modal-footer">
				  <button type="button" class="btn btn-kco-green" id="submit_btn" wire:click="updateFinanceBill">Update</button>
                  <button type="button" class="btn btn-outline-kco" data-bs-dismiss="modal">Close</button>
                </div>
			  </form>
              </div>
            </div>
          </div>
		  
		  <!-- Open Modal -->
          <div wire:ignore.self class="modal fade"  id="openModal" tabindex="-1" aria-hidden="true">
            <div class="modal-dialog modal-fullscreen"  role="document">
              <div class="modal-content">
			  
                <div class="modal-header">
				<div style="width:95%;display:block;">
                  <div class="card p-2 col-md-8 float-start"><h6 class="modal-title" id="openModalLabel1">Finance Bill ID: <?php echo e($this->Identifier); ?>&emsp;&emsp;By: <?php echo e($this->DrafterID); ?>&emsp;&emsp;Starting: <?php echo e($this->PeriodStart); ?>&emsp;&emsp;Ending: <?php echo e($this->PeriodEnd); ?></h6></div>
					
				  </div>
                  <button type="button" class="btn-close close-edit-modal" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
				
				<div class="modal-body"><!--body-->
				<div wire:ignore> <!--wire:ignore-->
				  <textarea id="Draft" wire:model="Draft"></textarea>
				</div>
                </div><!--/body-->
				
                <div class="modal-footer">
							<!--[if BLOCK]><![endif]--><?php if($this->Response==1): ?>
								<button type="button" class="btn btn-success" disabled><i class='bx bxs-check-circle'></i>&nbsp;You Approved Bill</button>
							<?php endif; ?><!--[if ENDBLOCK]><![endif]-->
							<!--[if BLOCK]><![endif]--><?php if($this->Response==2): ?>
								<button type="button" class="btn btn-danger" disabled><i class='bx bxs-x-circle'></i>&nbsp;You Rejected Bill</button>
							<?php endif; ?><!--[if ENDBLOCK]><![endif]-->		
				
						<!--[if BLOCK]><![endif]--><?php if($this->has_responded==1): ?>
						<button type="button"  class="btn btn-outline-warning" wire:click="$dispatch('confirmRetract',{ FinanceBillID:<?php echo e($this->FinanceBillID); ?>, LoggedInUser:<?php echo e($this->LoggedInUser); ?>, targetComponent: 'financebills', targetEvent: 'retractDecision' })">Retract</button>
						<?php endif; ?><!--[if ENDBLOCK]><![endif]-->
						
				<!--[if BLOCK]><![endif]--><?php if($this->canUpdate==1): ?>
				  <button type="button" class="btn btn-kco-green" id="updateBtn" wire:click="updateDraftFinanceBill">Update</button>
					<?php endif; ?><!--[if ENDBLOCK]><![endif]-->
					
					<!--[if BLOCK]><![endif]--><?php if($this->has_responded==0): ?>
					<button type="button" class="btn btn-success" wire:click="$dispatch('ConfirmApproveBill',{ FinanceBillID:<?php echo e($this->FinanceBillID); ?>, LoggedInUser:<?php echo e($this->LoggedInUser); ?>, targetComponent: 'financebills', targetEvent: 'approveBill' })">Pass</button>
					<button type="button" class="btn btn-danger" wire:click="$dispatch('ConfirmRejectBill',{ FinanceBillID:<?php echo e($this->FinanceBillID); ?>, LoggedInUser:<?php echo e($this->LoggedInUser); ?>, targetComponent: 'financebills', targetEvent: 'rejectBill' })">Annul</button>
					<?php endif; ?><!--[if ENDBLOCK]><![endif]-->
					
					<!--[if BLOCK]><![endif]--><?php if($this->has_responded==0): ?>
					<button type="button" class="btn btn-success" wire:click="$dispatch('ConfirmApproveBill',{ FinanceBillID:<?php echo e($this->FinanceBillID); ?>, LoggedInUser:<?php echo e($this->LoggedInUser); ?>, targetComponent: 'financebills', targetEvent: 'approveBill' })">Approve</button>
					<button type="button" class="btn btn-danger" wire:click="$dispatch('ConfirmRejectBill',{ FinanceBillID:<?php echo e($this->FinanceBillID); ?>, LoggedInUser:<?php echo e($this->LoggedInUser); ?>, targetComponent: 'financebills', targetEvent: 'rejectBill' })">Reject</button>
					<?php endif; ?><!--[if ENDBLOCK]><![endif]-->
					
					<!--<button type="button" class="btn btn-outline-kco" id="printBtn">Print</button>-->
                  <button type="button" class="btn btn-outline-kco close-edit-modal" data-bs-dismiss="modal">Close</button>
                </div>
			  
              </div>
            </div>
          </div>
		  
		  <!-- Amendment Modal -->
          <div wire:ignore.self class="modal fade"  id="amendmentModal" tabindex="-1" aria-hidden="true">
            <div class="modal-dialog modal-fullscreen"  role="document">
              <div class="modal-content">
			  
                <div class="modal-header">
				<div style="width:95%;display:block;">
                  <div class="card p-2 col-md-8 float-start"><h6 class="modal-title" id="amendmentModalLabel1">Finance Bill ID: <?php echo e($this->Identifier); ?>&emsp;&emsp;By: <?php echo e($this->DrafterID); ?>&emsp;&emsp;Starting: <?php echo e($this->PeriodStart); ?>&emsp;&emsp;Ending: <?php echo e($this->PeriodEnd); ?></h6></div>	
				  <div class="col-md-2 text-center mt-2 float-start">
				  <h6 class="modal-title">Suggest Amendment(s)</h6></div>
				  </div>
                  <button type="button" class="btn-close close-edit-modal" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
				
				<div class="modal-body"><!--body-->
				<div wire:ignore> <!--wire:ignore-->
				  <textarea id="Amendment" wire:model="Amendment"></textarea>
				</div>
                </div><!--/body-->
				
                <div class="modal-footer">
				  <button type="button" class="btn btn-kco-green" id="updateBtn" wire:click="saveAmendmentDraft">Save</button>
                  <button type="button" class="btn btn-outline-kco close-edit-modal" data-bs-dismiss="modal">Close</button>
                </div>
			  
              </div>
            </div>
          </div>
		  
</div>

<script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/dompurify/3.2.3/purify.min.js"></script>

<script>

addEventListener("livewire:navigated", () => {
	
	if(tinymce.activeEditor){
		tinymce.activeEditor.remove()
	}
			
tinymce.init({
            selector: '#Amendment', // Replace this CSS selector to match the placeholder element for TinyMCE
			plugins: 'table lists link fullscreen',
			license_key: 'gpl',
			toolbar: 'undo redo | blocks | bold italic | alignleft aligncenter alignright | indent outdent | bullist numlist | table | link | fullscreen',
            forced_root_block: false,
			branding:false,
			promotion:false,
            setup: function (editor) {
				editor.on('init', function (e) {
					  });
                editor.on('init change', function () {
                    editor.save();
                });
                editor.on('blur', function (e) {
                    window.Livewire.find('<?php echo e($_instance->getId()); ?>').set('Amendment', editor.getContent());
                });
            }
        });
  
	document.addEventListener('focusin', function (e) { 
	  if (e.target.closest('.tox-tinymce-aux, .moxman-window, .tam-assetmanager-root') !== null) { 
		e.stopImmediatePropagation();
	  } 
	});
	
})

	$(document).ready( function () {
		
		var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'))
		var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
		  return new bootstrap.Tooltip(tooltipTriggerEl)
		});
		
		
		$('.close-edit-modal').click(function(){
		});
		
	});
	 
		$('#printBtn').click(function() {
		window.jsPDF = window.jspdf.jsPDF;
        var doc = new jsPDF('p', 'pt', 'a4');
		doc.setFont("Helvetica");
		doc.setFontSize(1);
        var elementHTML = document.getElementById('printable').innerHTML
		//console.log(elementHTML);

        doc.html(elementHTML, {
		callback: function(doc) {
			// Save the PDF
			doc.save('finance_bill'+'.pdf');
		},
		x: 15,
		y: 15,
		width: 550, //target width in the PDF document
		windowWidth: 600 //window width in CSS pixels
	});

    });
</script><?php /**PATH C:\xampp\htdocs\kcofbms\resources\views/livewire/financebills.blade.php ENDPATH**/ ?>