8711 sujets

Développement web côté serveur, CMS

Bonjour j'aimerais recuperer des produits pour les ramener dans la facture qui se trouvent au dessus de la recherche sans pour autant les ajouter dans une quelconque base de donnees

Desole si c'est long mais vraiment je suis dos au mur

Ainsi j'ai fait des recherches sur AJAX pour recuperer des valeurs qui varient grace a button et les afficher dans le tableau.

L

LE VRAI PROBLEME EST DE RECUPERER LE NOM DU PRODUIT APRES LA RECHERCHE ET L'INSERER DANS LA FACTURE MAIS VU JAI ESSAYE UNE FONCTION QUI AFFICHE LE RESULTAT EN JAVASCRIPT MAIS VU QUE CEST UNE VARIABLE ELLE NE RECUPERE QUE LE PREMIER RESULTAT


VOIC LA RECHERCHE EN QUESTION

Toute Ma page de la facture:

Merci D'avance
@extends('agence_A.agence_A')
@section('content')
<scriptsrc="{{asset('js/jquery.min.js')}}"></script>

<sectionclass="content ecommerce-page">
<divclass="block-header">
<divclass="row">
<divclass="col-lg-7 col-md-6 col-sm-12">
<h2>La Commande
<small>Bienvenue sur Unity Construction</small>
</h2>
</div>
<divclass="col-lg-5 col-md-6 col-sm-12">
<ulclass="breadcrumb float-md-right">
<liclass="breadcrumb-item"><ahref=""><iclass="zmdi zmdi-home"></i> Unity Construction</a></li>
<liclass="breadcrumb-item active">La Commande</li>
</ul>
</div>
</div>
</div>
<divclass="container-fluid">
<divclass="row clearfix">
<divclass="col-lg-12">
<divclass="card product_item">
<divclass="body">
<tableclass="table-responsive table">
<thead>
<tr>
<td>Unity Construction</td>
<td></td>
<td></td>
</tr>
<tr>
<tdclass="td_command">Nom client : <spanclass="span_command">{{$client_agence_A->name_client}}</span></td>
<td>Fait le: <spanclass="span_command">{{date('Y-m-d H:i:s') }}</span></td>
</tr>
<tr>
<td>Entreprise client : <spanclass="span_command">{{$client_agence_A->entreprise_client}}</span></td>
<tdclass="td_command">A :</td>
</tr>
</thead>
</table>
<tableid="DataTable"class="table table-hover m-b-0">
<thead>
<tr>
<thclass="xs-small"data-breakpoints=" xs">N.</th>
<th>Designation</th>
<th>Prix Unitaire</th>
<thclass="quantity-small-td"data-breakpoints="quantity-small-td">Command&eacute;</th>
<thclass="quantity-small-td"data-breakpoints="quantity-small-td">Livr&eacute;</th>
<thclass="quantity-small-td"data-breakpoints="quantity-small-td">Reste a Livrer</th>
<thdata-breakpoints="cs">Total</th>
</tr>
</thead>
<tbodyid="shopping_cart">
<td>1</td>
<tdid="name_product"></td>
<td><inputtype="number"name="prix_product_bill"placeholder="PRIX de vente du Produit"id="prix_product_bill"></td>
<td><inputtype="number"name="quantity_product_bill"placeholder="Quantite commande"id="quantity_product_bill"></td>
<td></td>
<td></td>
<td></td>
</tbody>
<tfoot>
<tr>
<tdstyle="border: 1px solid dimgrey"colspan="5"align="right">Remise</td>
<tdcolspan="2"></td>
</tr>
<tr>
<tdcolspan="5"align="right"> Total</td>
<tdid="total_facture"colspan="2"></td>
</tr>
</tfoot>
</table>
<divclass="form-group">
<br/>
<br/>
<buttontype="submit"class="btn btn-width btn-success">
<iclass="fa fa-btn fa-sign-in"></i>Envoyer la commande au magazinier
</button>
<ahref="/agence_A">
<buttonclass="btn btn-danger">
<iclass="fa fa-btn fa-sign-in"></i>Cancel
</button>
</a>
</div>
<br/>
<br/>
<h2>Selectionner les articles</h2>
<br/>
<divclass="form-group">
<inputtype="text"class="form-control lonf"id="search"name="search"value=""placeholder="Search.."/>
</div>
<br/>
<br/>
<br/>
<br/>
<divclass="container-fluid">
<divclass="row clearfix"id="tbody">
</div>
</div>
<!--<script>
function insert_commande0() {
document.getElementById("name_product0").value = document.getElementById("title_product0").value;
}
function insert_commande1() {
document.getElementById("name_product1").value = document.getElementById("title_product1").value;
}
</script>-->
<scripttype="text/javascript">
constsearch = document.getElementById('search');
consttableBody = document.getElementById('tbody');
functiongetContent(){
constsearchValue = search.value;
constxhr = newXMLHttpRequest();
xhr.open('GET','{{route('search_client')}}/?search=' + searchValue ,true);
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
xhr.onreadystatechange = function() {
if(xhr.readyState == 4 && xhr.status == 200)
{
tableBody.innerHTML = xhr.responseText;
}
}
xhr.send()
}
search.addEventListener('input',getContent);
</script>
</div>
</div>
</div>
</div>
</div>
</section>
@endsection




les stocks seront retires seulement part la magasinier apres confirmation de la facture que vous voyez la

/////le nom des fonctions importe peu s'il vous plaits sauver moi

J'aimerais stocker tous ceci dans un tableau de sorte a ressembler a celui ci
1


$product_bill = array('id', 'name_product', 'new_quantity', 'prix_de_vente');


Voici mon code de recherche dans la base de donnees
1
[/code]

/////le nom des fonctions importe peu s'il vous plaits sauver moi
publicfunctionsearch_client(Request$request){

//$client_agence_A = client_agence_A::findOrfail($id);
if($request->ajax()){
$output="";
$products = add_product::where('referent','LIKE','%'.$request->search."%")
->Orwhere('title','LIKE','%'.$request->search."%")
->Orwhere('description','LIKE','%'.$request->search."%")
->Orwhere('product_type','LIKE','%'.$request->search."%")
->Orwhere('category','LIKE','%'.$request->search."%")
->get();
if($products){
foreach ($products as $row) {

$i = 0;
$output.='<div class="col-lg-3 col-md-4 col-sm-12">'.
'<div class="card product_item">'.
'<div class="body">'.
'<div class="cp_img">'.
'<img class="img-fluid2 img-fluid" src="../uploads/stock_agence_A/'.$row->image.'">'.
'<div class="hover">'.
'<button class="btn btn-primary btn-sm waves-effect" name="add_to_cart_name" onclick="cart_add()" id="add_to_cart">'.
'<i class="zmdi zmdi-plus"></i>'.
'</button>'.
'<a href="javascript:void(0);" class="btn btn-danger btn-sm waves-effect"><i class="zmdi zmdi-shopping-cart"></i></a>'.
'</div>'.
'</div>'.
'<div class="product_details">'.
'<h5>'.'<input readonly class="input_commande" type="text" data-id="'.$row->id.'" value="'.$row->title.'"/></h5>'.
'<ul class="product_price list-unstyled">'.
'<li class="old_price">'.$row->price_min.' Fcfa</li>'.
'</ul>'.
'</div>'.
'</div>'.
'</div>'.
'</div>';
$i++;
}
return$output;
}
}

}