I am building a feature to add different services to the checkout in my Django template, but I don't know how to add the total price when selecting checkboxes.
I put a change event on each checkbox and to this and when I check one it is supposed to add the service and its price in the card.
The card :
<div class="col-4">
<h4 class="d-flex justify-content-between align-items-center mb-3">
<span class="text-muted">Votre commande</span>
</h4>
<ul class="list-group mb-3" id="panier">
<li class="list-group-item d-flex justify-content-between lh-condensed">
<div>
<h6 class="my-0"></h6>
<small class="text-muted"></small>
</div>
<span class="text-muted"> €</span>
</li>
</ul>
<li class="list-group-item d-flex justify-content-between">
<span>Total (€)</span>
<strong><span id="total"></span> €</strong>
</li>
</div>
The checkboxes and the script :
and here is my view if needed :
def detail_annonce(request, pk):
myObject = Annonce.objects.get(id=pk)
image = ImageLogement.objects.all()
categorie_service = myObject.categorie_service.all()
services = Services.objects.all()
context = {'annonce': myObject, 'myImages': image, 'categorie_service': categorie_service, 'services':services}
return render(request, 'annonce/search/annonce_result.html', context)
Aucun commentaire:
Enregistrer un commentaire