<!-- Amendment Modal -->
          <div wire:ignore.self class="modal fade"  id="viewModal" 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(\Carbon\Carbon::parse($this->PeriodStart)->format('d/m/Y')); ?>&emsp;&emsp;Ending: <?php echo e(\Carbon\Carbon::parse($this->PeriodEnd)->format('d/m/Y')); ?>&emsp;&emsp;<?php echo e($this->DraftID); ?></h6></div>	
				  <div class="col-md-2 text-center mt-2 float-start">
				  <h6 class="modal-title">Suggested Amendment</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-->
				<input type="hidden" class="form-control" id="FinanceBillID" value="<?php echo e($this->FinanceBillID); ?>">
				  <input type="hidden" class="form-control" id="LoggedInUser" value="<?php echo e($this->LoggedInUser); ?>">
				  <input type="hidden" class="form-control" id="SuggestedAmendmentID" value="<?php echo e($this->SuggestedAmendmentID); ?>">
				  <input type="hidden" class="form-control" id="DraftID" value="<?php echo e($this->DraftID); ?>">
				<div wire:ignore> <!--wire:ignore-->
				  <textarea id="Amendment" wire:model="Amendment"></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 Amendment</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 Disapproved Amendment</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); ?>,SuggestedAmendmentID:<?php echo e($this->SuggestedAmendmentID); ?>, LoggedInUser:<?php echo e($this->LoggedInUser); ?>, DraftID:<?php echo e("'$this->DraftID'"); ?>, targetComponent: 'suggestedamendments', targetEvent: 'retractDecision' })">Retract</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('ConfirmApproveAmendment',{ FinanceBillID:<?php echo e($this->FinanceBillID); ?>,SuggestedAmendmentID:<?php echo e($this->SuggestedAmendmentID); ?>, LoggedInUser:<?php echo e($this->LoggedInUser); ?>, DraftID:<?php echo e("'$this->DraftID'"); ?>, targetComponent: 'suggestedamendments', targetEvent: 'approveAmendment' })">Approve</button>
					<button type="button" class="btn btn-danger" wire:click="$dispatch('ConfirmdisApproveAmendment',{ FinanceBillID:<?php echo e($this->FinanceBillID); ?>,SuggestedAmendmentID:<?php echo e($this->SuggestedAmendmentID); ?>, LoggedInUser:<?php echo e($this->LoggedInUser); ?>, DraftID:<?php echo e("'$this->DraftID'"); ?>, targetComponent: 'suggestedamendments', targetEvent: 'disapproveAmendment' })">Disapprove</button>
					<?php endif; ?><!--[if ENDBLOCK]><![endif]-->
                  <button type="button" class="btn btn-outline-kco close-edit-modal" data-bs-dismiss="modal">Close</button>
                </div>
			  
              </div>
            </div>
          </div>
		  
<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
			license_key: 'gpl',
			plugins: 'table lists link fullscreen',
			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 () {
		window.addEventListener('AmendmentContent', (event) => {
			 //tinymce.activeEditor.setContent(event.detail.content);
			 if(event.detail.content){
			 tinymce.get("Amendment").setContent(event.detail.content);
			 }
		})	
	});
</script><?php /**PATH C:\xampp\htdocs\kcofbms\resources\views/livewire/suggestedamendments.blade.php ENDPATH**/ ?>