%PDF- %PDF-
Direktori : /proc/self/root/var/www/html/resources/views/Clients/ |
Current File : //proc/self/root/var/www/html/resources/views/Clients/index.blade.php |
@extends('template') @section('title') Liste des Clients @endsection @section('content') <div class="container"> <!-- Button trigger modal --> @if (session()->has('status')) <div class="alert alert-success" role="alert"> {{ session()->get('status') }} </div> @elseif (session()->has('error')) <div class="alert alert-danger" role="alert"> {{ session()->get('error') }} </div> @endif @if (session()->has('message')) <div class="alert alert-success"> {{ session()->get('message') }} </div> @endif @foreach ($errors->all() as $message) <div class="alert alert-danger"> {{ $message }} </div> @endforeach <div class="card"> <div class="card-header"> <h5 class="card-title font-weight-bold text-primary">Importer ou Exporter la liste des Clients</h5> </div> <div class="card-body"> <form action="{{ route('Import') }}" method="POST" class="row col-12" enctype="multipart/form-data"> <div class="col-6"> <div class="custom-file"> @csrf <input type="file" name="file" class="custom-file-input" id="customFile" required> <label class="custom-file-label" for="customFile">choisir un fichier</label> </div> </div> <div class="col-3"> <button type="submit" class="btn btn-success"><i class="fas fa-file-excel"></i> Importer</button> </div> <div class="col-3"> <a class="btn btn-success" href="{{ route('export') }}"><i class="fas fa-download"></i> Exporter</a> </div> </form> </div> </div> <br> <div class="card"> <div class="card-header"> <ul class="nav nav-pills card-header-pills"> <li class="nav-item"> <button type="button" class="btn btn-info" data-toggle="modal" data-target="#addClientModal"> <i class="fas fa-plus"></i> Ajouter Client </button> </li> <li class="d-flex"> <input class="form-control me-2" type="search" id="searchInput" placeholder="Search" aria-label="Search"> </li> <li class="nav-item"> <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#DeleteClientModal" id="DeleteAll"> <i class="fas fa-trash-alt"></i> Supprimer Tout </button> </li> </ul> </div> <div class="card-body"> <h5 class="card-title font-weight-bold text-primary">Liste des Clients</h5> <div class="table-responsive"> <table class="table table-hover"> <thead> <tr> <th scope="col">N° Dossier</th> <th scope="col">Date</th> <th scope="col">Entreprise</th> <th scope="col">Gérant</th> <th scope="col">Contact</th> <th scope="col">Adresse</th> <th scope="col">Site web</th> <th scope="col">N° d'agrément</th> <th scope="col">N° RC</th> <th scope="col">N° ICE</th> <th scope="col">Actions</th> <th scope="col"> <input type="checkbox" id="checkAll"></th> </tr> </thead> <tbody> @foreach ($clients as $client) <tr id="clients"> <td> {{ $client->meta->nbdossier }}</td> <td> {{ $client->date_j }}</td> <td> {{ $client->name }} </td> <td> {{ $client->meta->manager }} </td> <td> <ul> <li>{{ $client->phone }}</li> <li>{{ $client->email }} </li> </ul> </td> <td> <ul> <li>{{ $client->meta->adress }}</li> <li>{{ $client->meta->ville }}</li> </ul> </td> <td> {{ $client->meta->website }} </td> <td> {{ $client->meta->agrement_number }} </td> <td> {{ $client->meta->rc }} </td> <td> {{ $client->meta->ice }} </td> <td> <div class="row"> <div class="col-4 px-2"> <a class="badge badge-info btn" type="button" href={{ route('edit_client', ['id' => $client->id]) }}><i class="fas fa-edit"></i> </a> </div> <div class="col-4 px-2"> <button class="badge badge-danger btn" type="button" data-toggle="modal" data-target="#deleteModal" data-delete-id="{{ $client->id }}"> <i class="fas fa-trash-alt"></i> </button> </div> <div class="col-4 px-2"> <button class="badge badge-success btn" type="button" data-toggle="modal" data-target="#editRemarqueModal" data-object="{{ @json_encode(['id' => $client->id, 'remarques' => $client->meta->remarques]) }}"> <i class="fas fa-eye"></i> </button> </div> </div> </td> <td> <input type="checkbox" value="{{ $client->id }}" name="ids" class="checkAllids"> </td> </tr> @endforeach </tbody> </table> </div> <div class="d-flex flex-row justify-content-center">{{ $clients->links() }}</div> </div> </div> </div> @endsection @section('scripts') <!-- Modal add --> @if ($errors->all()) <script> $(document).ready(function() { $('#addClientModal').modal('show'); }); </script> @endif <div class="modal fade" id="addClientModal" tabindex="-1" role="dialog" aria-labelledby="addClientModalLabel" aria-hidden="true"> <div class="modal-dialog modal-lg" role="document"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="addClientModalLabel"> J2HB | Ajouter Clients </h5> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <form method="POST" action="{{ route('store_client') }}" enctype="multipart/form-data"> @csrf <div class="modal-body"> <div class="container-fluid"> @foreach ($errors->all() as $error) <div class="alert alert-danger">{{ $error }}</div> @endforeach <div class="row col-12"> <div class="col-12"> <div class="form-group mb-3"> <input type="number" class="form-control form-control-user" name="nbdossier" id="nbdossier" placeholder="Numéro du dossier" value="{{ @old('nbdossier') }}" required> </div> </div> </div> <div class="row col-12"> <div class="col-6"> <div class="form-group mb-3"> <input type="text" class="form-control form-control-user" name="name" id="name" placeholder="Client" value="{{ @old('name') }}" required> </div> </div> <div class="col-6"> <div class="form-group mb-3"> <input type="text" class="form-control form-control-user" name="manager" id="manager" placeholder="Gérant" value="{{ @old('manager') }}" required> </div> </div> </div> <div class="row col-12"> <div class="col-6"> <div class="form-group mb-3"> <input type="tel" class="form-control form-control-user" name="phone" id="phone" placeholder="Téléphone" value="{{ @old('phone') }}" required> </div> </div> <div class="col-6"> <div class="form-group mb-3"> <input type="email" class="form-control form-control-user" name="email" id="email" placeholder="E-mail" value="{{ @old('email') }}" required> </div> </div> </div> <div class="row col-12"> <div class="col-6"> <div class="form-group mb-3"> <input type="text" class="form-control form-control-user" name="adress" id="adress" placeholder="Adresse" value="{{ @old('adress') }}" required> </div> </div> <div class="col-6"> <div class="form-group mb-3"> <input type="text" class="form-control form-control-user" name="ville" id="ville" placeholder="Ville" value="{{ @old('ville') }}" required> </div> </div> </div> <div class="row col-12"> <div class="col-6"> <div class="form-group mb-3"> <input type="date" class="form-control form-control-user" name="date_j" id="date_j" value="{{ @old('date_j') }}" required> </div> </div> <div class="col-6"> <div class="form-group mb-3"> <input type="url" class="form-control form-control-user" name="website" id="website" value="{{ @old('website') }}" placeholder="Siteweb"> </div> </div> </div> <div class="row col-12"> <div class="col-6"> <div class="form-group mb-3"> <input type="text" class="form-control form-control-user" name="cin" id="cin" placeholder="CIN" value="{{ @old('cin') }}" required> </div> </div> <div class="col-6"> <div class="form-group mb-3"> <input type="text" class="form-control form-control-user" name="agrement_number" id="agrement_number" placeholder="Nombre d'agrément" value="{{ @old('agrement_number') }}" required> </div> </div> </div> <div class="row col-12"> <div class="col-6"> <div class="form-group mb-3"> <input type="text" class="form-control form-control-user" name="ice" id="ice" placeholder="ICE" value="{{ @old('ice') }}" required> </div> </div> <div class="col-6"> <div class="form-group mb-3"><input type="text" class="form-control form-control-user" name="rc" id="rc" placeholder="RC" value="{{ @old('rc') }}" required></div> </div> </div> <div class="row col-12"> <div class="col-12"> <div class="input-group mb-3"> <div class="custom-file"> <input type="file" class="custom-file-input" name="upload" id="upload" aria-describedby="inputGroupFileAddon01" required> <label class="custom-file-label" for="inputGroupFile01"> Scanner CIN, Nb_agrement, RC, ICE...</label> </div> </div> </div> </div> <div class="row col-12"> <div class="col-12"> <div class="form-group mb-3"> <textarea name="remarques" class="form-control form-control-user" placeholder="Remarques" id="remarques" cols="75" rows="10"></textarea> </div> </div> </div> </div> <button type="submit" class="btn btn-primary btn-user">Ajouter</button> </div> </form> </div> </div> </div> <!-- Delete --> <div class="modal fade" id="deleteModal" tabindex="-1" role="dialog" aria-labelledby="deleteClientModalLabel" aria-hidden="true"> <div class="modal-dialog" role="document"> <form class="modal-content" method="post" action="{{ route('destroy_client') }}"> <div class="modal-header"> <h5 class="modal-title">Confirmation :</h5> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <div class="modal-body"> <p>Etes-vous sûr que vous voulez supprimer ?</p> </div> <div class="modal-footer"> <input type="hidden" name="id"> @csrf <button type="submit" id="OK_button" name="OK_button" class="btn btn-primary">OK</button> <button type="button" class="btn btn-secondary" data-dismiss="modal">Annuler</button> </div> </form> </div> </div> <!-- End Delete--> <!-- Delete ALL --> <div class="modal fade" id="DeleteClientModal" tabindex="-1" role="dialog" aria-labelledby="DeleteClientModalLabel" aria-hidden="true"> <div class="modal-dialog" role="document"> <form class="modal-content" action="{{ route('deleteAllclients') }}" method="post"> <div class="modal-header"> <h5 class="modal-title">Confirmation :</h5> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <div class="modal-body"> <p>Etes-vous sûr que vous voulez supprimer ?</p> </div> <div class="modal-footer"> <input type="hidden" name="allids"> @csrf <button type="submit" id="OK_button" name="OK_button" class="btn btn-primary">OK</button> <button type="button" class="btn btn-secondary" data-dismiss="modal">Annuler</button> </div> </form> </div> </div> <!-- Delete ALL --> <!-- update Remarque --> <div class="modal fade" id="editRemarqueModal" tabindex="-1" role="dialog" aria-labelledby="editRemarqueModalLabel" aria-hidden="true"> <div class="modal-dialog" role="document"> <form action="{{ route('store_client') }}" method="post"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="editRemarqueModalLabel"> J2HB | Modifier Remarque </h5> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <div class="modal-body"> @csrf <input type="hidden" name="id"> <textarea name="remarques" id="remarques" cols="75" class="form-control form-control-user" rows="10"></textarea> </div> <div class="modal-footer"> <button type="submit" id="update" name="update" class="btn btn-primary">Modifier</button> <button type="button" class="btn btn-secondary" data-dismiss="modal">Annuler</button> </div> </div> </form> </div> </div> <!-- End Update --> <script language="javascript"> $(document).ready(function() { $("#deleteModal").on('show.bs.modal', function(e) { var id = parseInt($(e.relatedTarget).attr('data-delete-id')); $(this).find('input[name="id"]').val(id); }); $("#editRemarqueModal").on('show.bs.modal', function(e) { var data = JSON.parse($(e.relatedTarget).attr('data-object')); $(this).find('input[name="id"]').val(data.id); $(this).find('input[name="remarques"]').val(data.remarques); }); $("#DeleteClientModal").on('show.bs.modal', function(e) { var allids = []; $("input:checkbox[name=ids]:checked").each(function() { allids.push($(this).val()); }); $(this).find('input[name="allids"]').val(allids.join(',')); }); $("#searchInput").on("keyup", function() { var value = $(this).val().toLowerCase(); $("#clients").filter(function() { $(this).toggle($(this).text().toLowerCase().indexOf(value) > -1) }); }); $(function(e) { $("#checkAll").click(function() { $(".checkAllids").prop('checked', $(this).prop('checked')); }); }); }); // Add the following code if you want the name of the file appear on select $(".custom-file-input").on("change", function() { var fileName = $(this).val().split("\\").pop(); $(this).siblings(".custom-file-label").addClass("selected").html(fileName); }); </script> @endsection