|  | @@ -37,6 +37,49 @@
 | 
	
		
			
				|  |  |      <!-- Footer -->
 | 
	
		
			
				|  |  |      <tag:footer />
 | 
	
		
			
				|  |  |      
 | 
	
		
			
				|  |  | +    <!-- Confirmation -->
 | 
	
		
			
				|  |  | +  	<div id="confirmation" class="modal conf">
 | 
	
		
			
				|  |  | +    	<div class="modal-content">
 | 
	
		
			
				|  |  | +    		<div class="row">
 | 
	
		
			
				|  |  | +    			<div class="col offset-m1 m3 mtop-4">
 | 
	
		
			
				|  |  | +                    <i class="material-icons red-text" style="font-size: 8em;">warning</i>
 | 
	
		
			
				|  |  | +                </div>
 | 
	
		
			
				|  |  | +                <div class="col m7 s12 mtop-3">
 | 
	
		
			
				|  |  | +                    <h4>Confirmer la suppression de <span id="conf-user"></span> ?</h4>
 | 
	
		
			
				|  |  | +      				<p style="font-size:1.2em">La suppression est définitive et aucun retour en arrière n'est possible</p>
 | 
	
		
			
				|  |  | +                </div>
 | 
	
		
			
				|  |  | +    		</div>
 | 
	
		
			
				|  |  | +    	</div>
 | 
	
		
			
				|  |  | +    	<div class="modal-footer">
 | 
	
		
			
				|  |  | +      		<a href="#!" class="modal-close waves-effect waves-red btn-flat">Annuler</a>
 | 
	
		
			
				|  |  | +      		<a href="#!" id="conf-delete" class="modal-close waves-effect waves-light btn">Confirmer</a>
 | 
	
		
			
				|  |  | +    	</div>
 | 
	
		
			
				|  |  | +  	</div>
 | 
	
		
			
				|  |  | +    <!-- Popup -->
 | 
	
		
			
				|  |  | +    <div id="ok-popup" class="modal popup">
 | 
	
		
			
				|  |  | +        <div class="modal-content" style="overflow: hidden;">
 | 
	
		
			
				|  |  | +            <div class="row">
 | 
	
		
			
				|  |  | +                <div class="col offset-m1 m3 s12">
 | 
	
		
			
				|  |  | +                    <i class="material-icons green-text" style="font-size: 8em;">check_circle</i>
 | 
	
		
			
				|  |  | +                </div>
 | 
	
		
			
				|  |  | +                <div class="col m7 s12 mtop-3">
 | 
	
		
			
				|  |  | +                    <h4 id="ok-text">Success message</h4>
 | 
	
		
			
				|  |  | +                </div>
 | 
	
		
			
				|  |  | +            </div>    
 | 
	
		
			
				|  |  | +        </div>
 | 
	
		
			
				|  |  | +    </div>
 | 
	
		
			
				|  |  | +    <div id="err-popup" class="modal popup">
 | 
	
		
			
				|  |  | +        <div class="modal-content" style="overflow: hidden;">
 | 
	
		
			
				|  |  | +            <div class="row">
 | 
	
		
			
				|  |  | +                <div class="col offset-m1 m3 s12">
 | 
	
		
			
				|  |  | +                    <i class="material-icons red-text" style="font-size: 8em;">error</i>
 | 
	
		
			
				|  |  | +                </div>
 | 
	
		
			
				|  |  | +                <div class="col m7 s12 mtop-3">
 | 
	
		
			
				|  |  | +                    <h4 id="error-text">Error message</h4>
 | 
	
		
			
				|  |  | +                </div>
 | 
	
		
			
				|  |  | +            </div>    
 | 
	
		
			
				|  |  | +        </div>
 | 
	
		
			
				|  |  | +    </div>
 | 
	
		
			
				|  |  |      <!--  Loader  -->
 | 
	
		
			
				|  |  |      <tag:loader name="loader" />
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -45,8 +88,12 @@
 | 
	
		
			
				|  |  |      <script type="text/javascript">
 | 
	
		
			
				|  |  |          $(document).ready(() => {
 | 
	
		
			
				|  |  |          	const loader = M.Modal.getInstance($('#loader'));
 | 
	
		
			
				|  |  | +        	const okPopup = M.Modal.getInstance($('#ok-popup'));
 | 
	
		
			
				|  |  | +        	const errPopup = M.Modal.getInstance($('#err-popup'));
 | 
	
		
			
				|  |  | +        	const conf = M.Modal.getInstance($('#confirmation'));
 | 
	
		
			
				|  |  |          	const idPagination = 'usager';
 | 
	
		
			
				|  |  |          	const perPage = 5;
 | 
	
		
			
				|  |  | +        	let usagerToDelete = null;
 | 
	
		
			
				|  |  |          	
 | 
	
		
			
				|  |  |          	function pagine(numPage) {
 | 
	
		
			
				|  |  |          		loader.open();
 | 
	
	
		
			
				|  | @@ -93,6 +140,38 @@
 | 
	
		
			
				|  |  |                  console.log('abo', 'num', $(this).attr('data-page'));
 | 
	
		
			
				|  |  |                  pagine($(this).attr('data-page'));
 | 
	
		
			
				|  |  |              });
 | 
	
		
			
				|  |  | +            
 | 
	
		
			
				|  |  | +            // Suppr abonne
 | 
	
		
			
				|  |  | +            $('#abo').on('click', '.delete-usager', function () {
 | 
	
		
			
				|  |  | +            	$("#conf-user").html($(this).attr('data-usager'));
 | 
	
		
			
				|  |  | +            	$("#conf-delete").attr('data-code', $(this).attr('data-code'));
 | 
	
		
			
				|  |  | +            	usagerToDelete = $(this).parent().parent();
 | 
	
		
			
				|  |  | +            	conf.open();
 | 
	
		
			
				|  |  | +            });
 | 
	
		
			
				|  |  | +            $('#conf-delete').on('click', function () {
 | 
	
		
			
				|  |  | +            	loader.open();
 | 
	
		
			
				|  |  | +            	$.ajax({
 | 
	
		
			
				|  |  | +                    type: "DELETE",
 | 
	
		
			
				|  |  | +                    url: "${base}api/usager/" + $(this).attr('data-code'),
 | 
	
		
			
				|  |  | +                    error: () => {
 | 
	
		
			
				|  |  | +                    	loader.close();
 | 
	
		
			
				|  |  | +                    	$('#error-text').html('Une erreur est survenue');
 | 
	
		
			
				|  |  | +                    	errPopup.open();
 | 
	
		
			
				|  |  | +                    },
 | 
	
		
			
				|  |  | +                    success: (result) => {
 | 
	
		
			
				|  |  | +                    	loader.close();
 | 
	
		
			
				|  |  | +                    	if (result.success) {
 | 
	
		
			
				|  |  | +                    		$('#ok-text').html(result.data.msg);
 | 
	
		
			
				|  |  | +                    		okPopup.open();
 | 
	
		
			
				|  |  | +                    		usagerToDelete.remove();
 | 
	
		
			
				|  |  | +                    		usagerToDelete = null;
 | 
	
		
			
				|  |  | +                    	} else {
 | 
	
		
			
				|  |  | +                    		$('#error-text').html(result.data);
 | 
	
		
			
				|  |  | +                        	errPopup.open();
 | 
	
		
			
				|  |  | +                    	}
 | 
	
		
			
				|  |  | +                    },
 | 
	
		
			
				|  |  | +                });
 | 
	
		
			
				|  |  | +            })
 | 
	
		
			
				|  |  |          });
 | 
	
		
			
				|  |  |      </script>
 | 
	
		
			
				|  |  |  </body>
 |