%PDF- %PDF-
Direktori : /var/www/html/resources/views/commandes/ |
Current File : //var/www/html/resources/views/commandes/Encours.blade.php |
@extends('template') @section('title') Liste des commandes @endsection @section('content') <div class="container"> @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 <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-warning" data-toggle="modal" data-target="#addCommandeModal"> <i class="fas fa-plus"></i>Ajouter Commande</button> </li> <li class="d-flex"> <input class="form-control me-2" type="search" id="searchInput" placeholder="Search" aria-label="Search"> </li> </ul> </div> <div class="card-body"> <h5 class="card-title text-primary">Liste des Commandes</h5> <div class="table-responsive"> <table class="table table-hover table-sm"> <thead> <tr> <th scope="col">#</th> <th scope="col">Livreur</th> @can('edit employers') <th scope="col">Commercial</th> @endcan <th scope="col">Client</th> <th scope="col">Etat</th> <th scope="col">Actions</th> </tr> </thead> <tbody> @foreach ($commandes as $commande) <tr id="commande"> <td>{{ $commande->id }}</td> <td>{{ ( $commande->livreur == 'Autres') ? $commande->autre_livraison : $commande->livreur }}</td> @can('edit employers') <td><span class="badge badge-pill badge-warning">{{ $commande->commercial->name }}</span></td> @endcan <td>{{ $commande->facture->user?$commande->facture->user->name:'' }}</td> <td> <x-commande-status :commande="$commande" /> </td> <td><button class="btn btn-info btn-sm" data-toggle="collapse" data-target="#commande_products-{{ $commande->id }}">voir</button> @if ($commande->status == 'pending' || $commande->status == 'unstocked' || $commande->status == 'validated') <button type="button" class="btn btn-secondary btn-sm" data-commande-object="{{@json_encode($commande->toArray())}}">Modifier</button> <button type="button" class="btn btn-danger btn-sm" data-toggle="modal" data-target="#confirmModal" data-delete-id="{{ $commande->id }}">Annuler</button> @endif @if ($commande->status == 'pending') <a type="button" href="{{ route('valider_commande', ['id' => $commande->id]) }}" class="btn btn-success btn-sm">Valider</a> @endif @if ($commande->status == 'delivered') <button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#confirm" data-delete-id="{{ $commande->id }}">retourné</button> @endif </td> </tr> <tr id="commande_products-{{ $commande->id }}" class="collapse collapsed"> <td colspan="4"> <ul> @foreach ($commande->commande_products as $com_prod) <li><span>{{ $com_prod->product->parent ? $com_prod->product->parent->name_prod : $com_prod->product->name_prod }}</span> - <span>{{ $com_prod->product->ref_prod }}</span> - <span>{{ $com_prod->product->prixvente - $com_prod->remise }}DH</span> </li> @endforeach </ul> </td> </tr> @endforeach </tbody> </table> <div class="d-flex flex-row justify-content-center">{{ $commandes->links() }}</div> </div> </div> </div> </div> @endsection @section('scripts') <x-add-commande-modal /> <x-edit-commande-modal /> {{-- Annuler Confirmation --}} <x-annuler-commande/> {{-- End Annuler confirmation --}} {{-- Annuler Confirmation --}} <div class="modal fade" id="confirm" tabindex="-1" role="dialog" aria-labelledby="DeleteCommModalLabel" aria-hidden="true"> <div class="modal-dialog" role="document"> <form class="modal-content" action="{{ route('Returned')}}" 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 retourné la commande ?</p> </div> <div class="modal-footer"> <input type="hidden" name="id"> @csrf <button type="submit" id="returned" 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 Annuler confirmation --}} {{-- End Modal Add --}} <script> $(document).ready(function() { $("#confirmModal").on('show.bs.modal', function(e) { var id = parseInt($(e.relatedTarget).attr('data-delete-id')); $(this).find('input[name="id"]').val(id); }); $("#confirm").on('show.bs.modal', function(e) { var id = parseInt($(e.relatedTarget).attr('data-delete-id')); $(this).find('input[name="id"]').val(id); }); $('#livreur').on('change', function() { var type = $(this).val(); $('[data-livr-type]').addClass('d-none'); $('[data-livr-type=' + type + ']').removeClass('d-none'); }).trigger('change'); }); </script> @endsection