%PDF- %PDF-
Direktori : /proc/self/root/usr/local/apache/htdocs/resources/views/commandes/ |
Current File : //proc/self/root/usr/local/apache/htdocs/resources/views/commandes/unstocked.blade.php |
@extends('template') @section('title') Valider la commande @endsection @section('content') <form class="container fluid" method="post" action="{{ URL::current() }}"> @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> @elseif (session()->has('message')) <div class="alert alert-success" role="alert"> {{ session()->get('message') }} </div> @endif @foreach ($errors->all() as $message) <div class="alert alert-danger"> {{ $message }} </div> @endforeach <div class="card mb-3"> <div class="card-header"> <h5 class="card-title font-weight-bold text-primary">Informations :</h5> </div> <div class="card-body"> <ul class="list-group"> <li class="list-group-item d-flex justify-content-between align-items-center"> <span style="font-weight: bold">Commercial(e) : </span> <span>{{ $commande->commercial->name }}</span> </li> <li class="list-group-item d-flex justify-content-between align-items-center"> <span style="font-weight: bold">Client : </span> <span data-client-name>{{$commande->facture && $commande->facture->user ? $commande->facture->user->name : ''}}</span> </li> @foreach ($commande->commande_products as $comm) <li class="list-group-item d-flex justify-content-between align-items-center"> {{ $comm->product->parent->name_prod }} | {{ $comm->product->ref_prod }} <div> <span class="badge badge-success badge-pill">{{ $comm->product->prixvente }} DH</span> <span class="badge badge-warning badge-pill">-{{ $comm->remise }} DH</span> <span class="badge badge-info badge-pill">{{ ($comm->product->prixvente - $comm->remise)?: 'Gratuit' }}</span> </div> </li> @endforeach <li class="list-group-item d-flex justify-content-between align-items-center"> <span style="font-weight: bold">Total : </span> <span class="badge badge-primary badge-pill">{{ $commande->total }} DH</span> </li> </ul> <div class="text-right"></div> </div> </div> <div class="card"> <div class="card-header"> <h5 class="card-title font-weight-bold text-primary">Valider la commande sortie du stock</h5> </div> <div class="card-body"> @csrf <div class="row"> <div class="col-6"> <div class="form-group mb-3"> <select id="facture_type" name="type_facture" class="form-control form-control-user" disabled> <option value="0">Sélectionnez le type : </option> <option value="facture" @if ($commande->facture->type == 'facture') selected @endif>Facture</option> <option value="livraison" @if ($commande->facture->type == 'livraison') selected @endif>Bon de livraison</option> <option value="commande" @if ($commande->facture->type == 'commande') selected @endif>Bon de commande</option> <option value="sortie" @if ($commande->facture->type == 'sortie') selected @endif>Bon de sortie</option> <option value="devis" @if ($commande->facture->type == 'devis') selected @endif>Devis</option> </select> </div> </div> <div class="col-6"> <div class="form-group mb-3"> <input type="text" class="form-control form-control-user" name="num_facture" placeholder="Numéro de facture" value="{{ $commande->facture->num_facture }}" disabled> </div> </div> <div data-facture-type="facture" class="col-6"> <div class="form-group mb-3"> <select name="taux_id" class="form-control form-control-user" disabled> <option value="0">Sélectionnez TVA :</option> @foreach ($taux as $tva) <option value="{{ $tva->id }}" @if ($commande->facture->taux_id == $tva->id) selected @endif>{{ $tva->taux }} %</option> @endforeach </select> </div> </div> <div class="col-6"> <div class="form-group mb-3"> <select name="client_id" class="form-control form-control-user" disabled> <option value="0">Sélectionnez client :</option> @foreach ($clients as $id => $name) <option value="{{ $id }}" data-client-option="{{$name}}" @if ($commande->facture->client_id == $id) selected @endif>{{ $name }}</option> @endforeach </select> </div> </div> <div class="col-6"> <div class="form-group mb-3"> <select name="livreur" id="livreur" class="form-control form-control-user" disabled> <option value="CTM" @if ($commande->livreur == 'CTM') selected @endif> CTM </option> <option value="Amana" @if ($commande->livreur == 'Amana') selected @endif>Amana</option> <option value="J2HB" @if ($commande->livreur == 'J2HB') selected @endif>J2HB</option> <option value="wataniya" @if ($commande->livreur == 'wataniya') selected @endif>wataniya</option> <option value="Autres" @if ($commande->livreur == 'Autres') selected @endif>Autres</option> </select> </div> </div> <div class="col-6" data-livr-type="Autres"> <div class="form-group mb-3"> <input type="text" class="form-control form-control-user" name="autre_livraison" placeholder="Autre livreur" value="{{ $commande->autre_livraison }}" disabled> </div> </div> <div class="col-6"> <div class="form-group mb-3"> <input type="text" class="form-control form-control-user" name="livraison_ref" placeholder="Référence livraison" value="{{ $commande->livraison_ref }}" disabled> </div> </div> <div class="col-6"> <div class="form-group mb-3"> <select name="frais_livraison" class="form-control form-control-user" disabled> <option value="port paye" @if ($commande->frais_livraison == 'port paye') selected @endif>port payé</option> <option value="port du" @if ($commande->frais_livraison == 'port du') selected @endif>port du</option> <option value="normal" @if ($commande->frais_livraison == 'normal') selected @endif>Normal</option> </select> </div> </div> </div> </div> </div> <br> <div class="card"> <div class="card-header"> <h5 class="card-title font-weight-bold text-primary">Paiments</h5> </div> <div class="card-body"> <div class="row col-12"> <div id="regl-array" class="col-12"> @foreach ($commande->reglements as $reglement) <div class="form-group mb-3 regl-array"> <div class="input-group"> <select name="type[]" class="form-control form-control-user hide-disabled" disabled readonly> <option value="avance" @if ($reglement->type =='avance') selected @endif>Avance</option> <option value="reste" @if ($reglement->type =='reste') selected @endif>Reste</option> </select> <input type="text" class="form-control form-control-user" name="montant[]" placeholder="montant" value="{{ $reglement->montant }}" disabled readonly> <select name="method[]" class="form-control form-control-user hide-disabled" disabled readonly> <option value="espece" @if ($reglement->method =='espece') selected @endif>Espéce</option> <option value="virement" @if ($reglement->method =='virement') selected @endif>Virement</option> <option value="versement" @if ($reglement->method =='versement') selected @endif>Versement</option> <option value="cheque" @if ($reglement->method =='cheque') selected @endif>Chéque</option> <option value="cr" @if ($reglement->method =='cr') selected @endif>Contre remboursement</option> </select> <input type="text" class="form-control form-control-user" name="num[]" placeholder="Num" value="{{ $reglement->num }}" disabled readonly> </div> <div class="input-group"> <select name="banque[]" class="form-control form-control-user" disabled readonly> <option value="watania" @if ($reglement->banque =='watania') selected @endif>Watania</option> <option value="CIH" @if ($reglement->banque =='CIH') selected @endif>CIH</option> <option value="ste" @if ($reglement->banque =='ste') selected @endif>Société générale</option> <option value="populaire" @if ($reglement->banque =='populaire') selected @endif>Banque populaire</option> <option value="Attijari" @if ($reglement->banque =='Attijari') selected @endif>Attijari WafaBanque</option> <option value="BMCE" @if ($reglement->banque =='BMCE') selected @endif>BMCE</option> <option value="BMCI" @if ($reglement->banque =='BMCI') selected @endif>BMCI</option> <option value="Barid" @if ($reglement->banque =='Barid') selected @endif>Barid Banque</option> <option value="wafacash" @if ($reglement->banque =='wafacash') selected @endif>Wafacash</option> </select> <input type="date" class="form-control form-control-user" name="date_reglement[]" value="{{ $reglement->date_reglement->format('Y-m-d') }}" disabled readonly> <select name="status[]" class="form-control form-control-user" disabled readonly> <option value="payed" @if ($reglement->status =='payed') selected @endif>Payé</option> <option value="nonpayed" @if ($reglement->status =='nonpayed') selected @endif>Non payé</option> </select> </div> </div> @endforeach </div> <div class="col-12"> <ul class="list-group w-100"> <li class="list-group-item d-flex justify-content-between align-items-center"> <span style="font-weight: bold">Le reste : </span> <span class="badge badge-success badge-pill"><span id="commande-reste-price"></span> DH</span> </li> </ul> </div> </div> </div> </div> @if ($commande->status != 'unstocked') <div class="row col-12 justify-content-center pt-3"> <button type="submit" class="btn btn-success btn-user">Sortie de stock</button> </div> @endif </form> @endsection @section('scripts') <script> $(document).ready(function() { var total = {{$commande->total}}; var total_prices = total; var prod_array = $('.regl-array:last').clone(); $(document).on('click', '.regl-array-add', function(e) { if( total_prices == 0 ) { e.preventDefault(); return false; } $(this).removeClass('regl-array-add'); $(this).addClass('regl-array-remove'); prod_array = $("#regl-array").append(prod_array).find('.regl-array'); prod_array = prod_array.eq(prod_array.length - 1).clone(); $(document).find('[name="type[]"]').trigger('change'); }); $(document).on('click', '.regl-array-remove', function() { $(this).parents('.regl-array').remove(); $(document).find('[name="type[]"]').trigger('change'); }); $(document).on('change', '[name="type[]"]', function() { $(document).find('[name="type[]"]').find('option[value="avance"]').prop('disabled', false); $(document).find('[name="type[]"]').each(function(i, elem) { if( $(elem).val() == 'avance' ) { $(document).find('[name="type[]"]').not(elem).val('reste').find('option[value="avance"]').prop('disabled', true); } }); var type = $(this).val(); if( type == 'avance' ) { $(this).parents('.regl-array').find('[name="method[]"]').find('option[value="cr"]').prop('disabled', true); } else { $(this).parents('.regl-array').find('[name="method[]"]').find('option').prop('disabled', false); } }); $(document).on('input', '[name="montant[]"]', function() { var prices = 0; $(document).find('[name="montant[]"]').each(function(i, elem) { prices += parseFloat($(elem).val() ? $(elem).val() : 0); }); total_prices = total - prices; $('#commande-reste-price').text(total_prices); }); $(document).on('change', '[name="method[]"]', function() { var method = $(this).val(); $(this).next('[name="num[]"]').addClass('d-none'); if( method == 'cheque' ) { $(this).next('[name="num[]"]').removeClass('d-none'); } if( method == 'espece' ) { $(this).parents('.regl-array').find('[name="banque[]"]').val('watania').addClass('d-none'); } else { $(this).parents('.regl-array').find('[name="banque[]"]').removeClass('d-none'); } }); $(document).find('[name="type[]"]').trigger('change'); $(document).find('[name="method[]"]').trigger('change'); $(document).find('[name="montant[]"]').trigger('input'); }); </script> @endsection