<link rel="stylesheet"
	  href="<?= base_url('<link rel="stylesheet" 
	href="https://cdn.datatables.net/1.13.6/css/dataTables.bootstrap.min.css">') ?>">
<link rel="stylesheet" href="<?= base_url('bower_components/toastr/toastr.css') ?>">
<!--<link rel="stylesheet" href="--><?//= base_url('plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.css') ?><!--">-->
<link href="https://cdn.quilljs.com/1.3.6/quill.snow.css" rel="stylesheet">
<div class="content-wrapper">
	<!-- Content Header (Page header) -->

	<section class="content-header">
		<h1>
			Exclusions
		</h1>
	</section>

	<section class="content">
		<div class="row">
			<div class="col-lg-12">
				<div class="box box-primary">
					<div class="box-header with-border">
						<!--						<h3 class="box-title">Compose New Message</h3>-->
					</div>

					<div class="box-body">
						<div class="form-group">
							<div id="editor">
								<?= $exclusion->document ?? null ?>
							</div>

							<div class="box-footer">
								<div class="pull-right">
									<button id="save" class="btn btn-primary">
										<?= $this->lang->line('save') ?>
									</button>
								</div>
								<!--						<button type="reset" class="btn btn-default"><i class="fa fa-times"></i> Discard</button>-->
							</div>

						</div>

					</div>

				</div>

	</section>
</div>

<!-- jQuery 2.2.4 -->
<script src="<?= base_url('bower_components/jquery/dist/jquery.min.js') ?>"></link>
	<!-- Bootstrap 3.3.7 -->
	<script src="<?= base_url('bower_components/bootstrap/dist/js/bootstrap.min.js') ?>"></script>
<!-- DataTables -->
<script src="https://cdn.datatables.net/1.13.6/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/1.13.6/js/dataTables.bootstrap.min.js"></script>
<!-- Slimscroll -->
<script src="<?= base_url('bower_components/jquery-slimscroll/jquery.slimscroll.min.js') ?>"></script>
<!-- FastClick -->
<script src="<?= base_url('bower_components/fastclick/lib/fastclick.js') ?>"></script>
<!-- AdminLTE App -->
<script src="<?= base_url('dist/js/adminlte.min.js') ?>"></script>
<script src="<?= base_url('bower_components/toastr/toastr.js') ?>"></script>
<script src="<?= base_url('dist/js/sweetalert2.js') ?>"></script>
<script src="https://cdn.quilljs.com/1.3.6/quill.js"></script>
<script>

	toastr.options.closeButton = true;
	toastr.options.closeMethod = 'fadeOut';
	toastr.options.closeDuration = 5000;
	toastr.options.closeEasing = 'swing';

	var quill = new Quill('#editor', {
		theme: 'snow'
	});


	$("#save").click(function () {
		$.ajax({
			url: '<?= base_url('NanoHealthController/storeExclusions')?>',
			type: 'POST',
			dataType: 'json',
			data: {
				"id": "<?= $exclusion->id ?? null ?>",
				"network_id": "<?= $network_id ?>",
				"document": quill.root.innerHTML,
			},
			success: function (data) {
				if(data.status === 200){
					Swal.fire({
						icon: 'success',
						title: "<?= $this->lang->line('wallet_update')?>",
						text:"<?= $this->lang->line('informations_updated')?>",
						timer: 3000
					}).then(()=>{
						location.reload();
					});
				}else{
					toastr.error("<?= $this->lang->line('error_message')?>" , "<?= $this->lang->line('request_error')?>");
				}
			},

			error: function (resultat, statut, error) {
				console.log(resultat + " " + error);
				toastr.error("<?= $this->lang->line('error_message')?>" , "<?= $this->lang->line('request_error')?>");
			}
		});
	});


</script>
