Skip to content

Commit

Permalink
Othmane (#29) : working version 1.0
Browse files Browse the repository at this point in the history
* login finished + basic index.php for admin

* V0.1 of commandes

* adding modal view

* finishing commandes_hist

* finishing the commandes section

* adding logout features

* creation de utilisateur

* initial version user

* fixing caroussel

* modificatgion dans l'utilisateur

* categories read

* test for imgs processing

* finishing index.php import products

* afa

* fixing navbar and modifiying nav page

* hhhhh mafya mayktb chnu drt

* filters working

* .gitignore is now working

* adding pagination

* fixing prices ranges

* finishing all filters

* integration of smail + adding links between clients and orders

* users page intergration

* Squashed commit of all amal branch

* fixing categories page

* adding brands page

* add and deleting producst workign

* finishing products page

* picture in the products page

* finishing imgs managing

* product page

* connection working

* cart integration

* making cart functionnal

* cart updating

* small fix for producté

* merging smail  profile pages

* Squashed commit of the following:

commit a38e986
Author: Amal Kalim <[email protected]>
Date:   Sat Jan 30 22:48:21 2021 +0100

    entrain de regler qlq prob

commit b7d185b
Author: Amal Kalim <[email protected]>
Date:   Sat Jan 30 02:09:13 2021 +0100

    entrain de regler qlq prob

commit 73db959
Author: Amal Kalim <[email protected]>
Date:   Fri Jan 29 19:11:52 2021 +0100

    lister les favoris du client

* finishing inscription

* fixing cart

* delivery page

* adding order funcs

* adding recap

* fixing caroussel

* Squashed commit of the following:

commit 6afc20b
Author: simo0077 <[email protected]>
Date:   Wed Feb 3 02:32:09 2021 +0100

    ajout de l'option de suppression a client

commit b35216f
Author: simo0077 <[email protected]>
Date:   Wed Feb 3 01:24:19 2021 +0100

    modification d'adresse

commit f74c97c
Author: simo0077 <[email protected]>
Date:   Tue Feb 2 23:32:15 2021 +0100

    had stora li zdt rah diali flkher guli smail 😂

commit a23f07e
Author: simo0077 <[email protected]>
Date:   Tue Feb 2 23:31:20 2021 +0100

    ajout d'adresse avec php

commit 1713fb9
Author: simo0077 <[email protected]>
Date:   Tue Feb 2 15:03:50 2021 +0100

    implementation du php dans profil

commit 5126d3b
Author: simo0077 <[email protected]>
Date:   Tue Feb 2 12:25:49 2021 +0100

    implementation du php dans profile

commit 3d4be48
Merge: 19092ea 411495a
Author: simo0077 <[email protected]>
Date:   Tue Feb 2 10:22:13 2021 +0100

    Merge branch 'smail' of github.com:x7lib/ecommerce into smail

commit 411495a
Merge: 69ec64a b7a1d62
Author: Othmane Mdarhri <[email protected]>
Date:   Tue Feb 2 01:58:33 2021 +0100

    merging master

commit 19092ea
Author: simo0077 <[email protected]>
Date:   Mon Feb 1 16:19:44 2021 +0100

    changement dans navbar

commit 69ec64a
Author: simo0077 <[email protected]>
Date:   Mon Feb 1 05:12:48 2021 +0100

    navbar mkhwra a othmanr

commit 4ec1c0a
Author: simo0077 <[email protected]>
Date:   Mon Feb 1 03:51:28 2021 +0100

    haha

commit 0852ba2
Author: simo0077 <[email protected]>
Date:   Sun Jan 31 13:43:24 2021 +0100

    ajout du modal de l'adresse

commit 6f2b57c
Author: simo0077 <[email protected]>
Date:   Sun Jan 31 04:23:55 2021 +0100

    ajout de la page d'adresse(sansphp hitmafhmtakhra

commit 76e5d35
Author: Othmane Mdarhri <[email protected]>
Date:   Sat Jan 30 11:54:29 2021 +0100

    fixing links

commit c1b8a0b
Author: Subatomail <[email protected]>
Date:   Fri Jan 29 22:35:27 2021 +0100

    signup + profile page  with info,statistics,commandes,wishlit

commit ab8f762
Author: Subatomail <[email protected]>
Date:   Thu Jan 28 15:57:22 2021 +0100

    show cart content with id_client without price show

* adding todos

* Squashed commit of the following:

commit 437daf8
Author: Othmane Mdarhri <[email protected]>
Date:   Thu Feb 4 20:39:42 2021 +0100

    adding verification

commit 11b172c
Author: Othmane Mdarhri <[email protected]>
Date:   Thu Feb 4 20:15:15 2021 +0100

    adding verifications to pages

commit 0e35de1
Author: Othmane Mdarhri <[email protected]>
Date:   Thu Feb 4 20:04:36 2021 +0100

    fixin wishlist

commit ebea8f5
Author: simo0077 <[email protected]>
Date:   Thu Feb 4 04:54:23 2021 +0100

    tweaks w sf

commit 3d9e217
Author: simo0077 <[email protected]>
Date:   Thu Feb 4 04:19:17 2021 +0100

    fixing errors

commit 30ccf49
Merge: 9884382 5b0c1ee
Author: simo0077 <[email protected]>
Date:   Thu Feb 4 04:17:49 2021 +0100

    Merge branch 'othmane' into smail

commit 9884382
Author: simo0077 <[email protected]>
Date:   Thu Feb 4 04:15:20 2021 +0100

    ajout du recap et de voir details

commit 6afc20b
Author: simo0077 <[email protected]>
Date:   Wed Feb 3 02:32:09 2021 +0100

    ajout de l'option de suppression a client

commit b35216f
Author: simo0077 <[email protected]>
Date:   Wed Feb 3 01:24:19 2021 +0100

    modification d'adresse

commit f74c97c
Author: simo0077 <[email protected]>
Date:   Tue Feb 2 23:32:15 2021 +0100

    had stora li zdt rah diali flkher guli smail 😂

commit a23f07e
Author: simo0077 <[email protected]>
Date:   Tue Feb 2 23:31:20 2021 +0100

    ajout d'adresse avec php

commit 1713fb9
Author: simo0077 <[email protected]>
Date:   Tue Feb 2 15:03:50 2021 +0100

    implementation du php dans profil

commit 5126d3b
Author: simo0077 <[email protected]>
Date:   Tue Feb 2 12:25:49 2021 +0100

    implementation du php dans profile

commit 3d4be48
Merge: 19092ea 411495a
Author: simo0077 <[email protected]>
Date:   Tue Feb 2 10:22:13 2021 +0100

    Merge branch 'smail' of github.com:x7lib/ecommerce into smail

commit 411495a
Merge: 69ec64a b7a1d62
Author: Othmane Mdarhri <[email protected]>
Date:   Tue Feb 2 01:58:33 2021 +0100

    merging master

commit 19092ea
Author: simo0077 <[email protected]>
Date:   Mon Feb 1 16:19:44 2021 +0100

    changement dans navbar

commit 69ec64a
Author: simo0077 <[email protected]>
Date:   Mon Feb 1 05:12:48 2021 +0100

    navbar mkhwra a othmanr

commit 4ec1c0a
Author: simo0077 <[email protected]>
Date:   Mon Feb 1 03:51:28 2021 +0100

    haha

commit 0852ba2
Author: simo0077 <[email protected]>
Date:   Sun Jan 31 13:43:24 2021 +0100

    ajout du modal de l'adresse

commit 6f2b57c
Author: simo0077 <[email protected]>
Date:   Sun Jan 31 04:23:55 2021 +0100

    ajout de la page d'adresse(sansphp hitmafhmtakhra

commit 76e5d35
Author: Othmane Mdarhri <[email protected]>
Date:   Sat Jan 30 11:54:29 2021 +0100

    fixing links

commit c1b8a0b
Author: Subatomail <[email protected]>
Date:   Fri Jan 29 22:35:27 2021 +0100

    signup + profile page  with info,statistics,commandes,wishlit

commit ab8f762
Author: Subatomail <[email protected]>
Date:   Thu Jan 28 15:57:22 2021 +0100

    show cart content with id_client without price show

* fixing wishlist

Co-authored-by: simo0077 <[email protected]>
  • Loading branch information
outcast292 and simo0077 authored Feb 4, 2021
1 parent 18225e3 commit 8e389e5
Show file tree
Hide file tree
Showing 33 changed files with 1,290 additions and 256 deletions.
3 changes: 3 additions & 0 deletions Favoris.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<!DOCTYPE html>
<html lang="en">
<?php
require_once "./req/verify.php";

?>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
Expand Down
47 changes: 47 additions & 0 deletions admin/clients.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,21 @@
<div class="container-fluid">
<div class="row">
<?php require "req/sidebar.php" ?>

<div class="col pt-4 ">
<!-- Modal -->
<div class="modal fade" id="modal_details_delete" tabindex="-1" aria-labelledby="modal_details" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered modal-md">
<div class="modal-content" id="modal_content_delete">
</div>
</div>
</div>
<div class="container.fluid">
<h1><a href="" data-target="#sidebar" data-toggle="collapse" class="d-md-none"><i class="fa fa-bars"></i></a>Clients</h1>
<h6 class="hidden-sm-down">Page pour visualiser les détails des clients</h6>
<hr>
<div id="alert">
</div>

<p>
<button class="btn btn-secondary btn-block" type="button" data-toggle="collapse" data-target="#collapseExample" aria-expanded="false" aria-controls="collapseExample">
Expand Down Expand Up @@ -289,6 +299,42 @@ function show_details(id_client, nom_client, nbr_commande, email, tel_client, da
search();
});

function delete_confirmation(id_user, nom_client) {
$('#modal_content_delete').html(`
<div class="modal-header">
<h5 class="modal-title" id="exampleModalsup">Suppression </h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
Etes-vous sures de supprimer le client ${nom_client} ?
</div>
<div class="modal-footer mt-2">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Annuler</button>
<button type="button" class="btn btn-danger" data-dismiss="modal" onclick="delete_client(${id_user},'${nom_client}')">Supprimer</button>
</div>
`);
$('#modal_details_delete').modal('show')
}



function delete_client(id_client, nom_client) {
fetch("../php/clients/client_delete?id_client=" + id_client).then(resp => resp.json()).then(json => {
if (json.code == 200) {
search();
$("#alert").text('');
$("#alert").append(`
<div class="alert alert-danger" >
<i class="bi bi-check-all"></i></i> client ${nom_client} supprimé
</div>`)
}
}).catch(err => console.log(err));
}



function search() {
var dataform = $("#form_search :input[value!='']").serialize();
fetch("../php/clients/clients_read?" + dataform).then(resp => resp.json()).then(json => {
Expand All @@ -309,6 +355,7 @@ function search() {

<a class="dropdown-item" href="mailto:${element.email}">ENVOYER E-MAIL</a>
<a class="dropdown-item" href="tel:${element.tel_client}">APPELER</a>
<a class="dropdown-item" href="#" onclick="delete_confirmation(${index+1},'${element.nom_client}');">SUPPRIMER</a>
</div>
</td>
</tr>
Expand Down
221 changes: 77 additions & 144 deletions cart.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>panier</title>

<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/navbar.css" rel="stylesheet">
<script src="js/jquery-3.5.1.slim.min.js"></script>

<script src="js/bootstrap.bundle.min.js"></script>
<link rel="stylesheet" href="css/bootstrap-icons.css">
<link rel="stylesheet" href="css/index.css">
<link href="css/navbar.css" rel="stylesheet">
<link href="css/cart.css" rel="stylesheet">
<script src="js/bootstrap.bundle.min.js"></script>

<link rel="stylesheet" href="css/bootstrap-icons.css">
<style>


Expand All @@ -32,10 +34,10 @@

<div class="container-fluid ">
<div class="jumbotron d-flex justify-content-center ">
<div class="card">
<div class="card col-12">
<div class="card-top border-bottom text-center"> <a href="index.php" class="link"> Retour a la boutique</a> <span id="logo">Amoil.com</span> </div>
<div class="card-body">
<div class="row upper"> <span class="panier"> Adresse</span> </div>
<div class="row upper"> <span class="panier"> Panier</span> <a href="dilevery" class="btn btn-success payment">Payment <i class="bi bi-arrow-right-square"></i></a> </div>

<div class="row">
<div class="col-lg-12">
Expand All @@ -48,13 +50,10 @@

<div class="d-flex justify-content-end h3">

<span id="total"></span>

</div>
</div>
<div class="p-3 d-flex justify-content-center">
<a href="dilevery" class="payment col-4 btn btn-primary">Confirmer Commande <i class="bi bi-arrow-right-square-fill"></i></a >

</div>


</div>
Expand Down Expand Up @@ -93,149 +92,83 @@
</div>
</div>

</div>
</div>
</div>

<div>

<?php
require_once "req/footbar.php";

?>
</div>

<div>

<?php
require_once "req/footbar.php";

<script>
<?php
if (!isset($_SESSION["id_client"]))
header("location: index.php");
else
echo "const id_client=" . $_SESSION["id_client"] . ";";
?>
var products = [];

function fill_cart_div() {
$("#cart_content").text('');
products.forEach((element, index) => {
$('#cart_content').append(`
<script>
<?php
if (!isset($_SESSION["id_client"]))
header("location: index.php");
else
echo "const id_client=" . $_SESSION["id_client"] . ";";
?>
var products = [];
//TODO ADD DETAILS

function fill_cart_div() {
$("#cart_content").text('');
products.forEach((element, index) => {
$('#cart_content').append(`
<div class="card mb-3 p-0 h-25">
<div class="row no-gutters">
<div class="col-md-2">
<img src="img/products/${element.id_produit}.jpg" class="card-img w-75" alt="image_produit">
</div>
<div class="col-md-10">
<div class="card-body p-3 col-12 " style="width: 100%;">
<span class="card-title p-0 h5 d-flex justify-content-between" style="color: black;"><span style="color: black;">${element.label}</span>
<span>
<span class="mr-1" id="price" style="color: black;">${element.prix_produit.toFixed(2)}</span>
<span style="color: black;">DH</span>
</span>
<span>
<span class="border pt-2 pl-3 pr-3 pb-1" id="qty">${element.qtt_panier}</span>
<button id="minus" onclick="change_qtt(${index},'-')" style="padding: 2px 5px; border-radius: 10px; background-color: rgb(230,230,230) ;border-color:(230,230,230); border-width: 1px;">-</button>
<button id="plus" onclick="change_qtt(${index},'+')" style="padding: 2px 3px; border-radius: 10px; background-color: rgb(230,230,230) ;border-color:(230,230,230); border-width: 1px;">+</button>
</span>
<span>
<span class="mr-1" id="price" style="color: black;">${(element.prix_produit*element.qtt_panier).toFixed(2)}</span>
<span style="color: black;">DH</span>
</span>
<div class="card-body p-3 col-12 " style="width: 100%;">
<span class="card-title mr-5 h5 " style="color: black;"><span style="color: black;">${element.label}</span>

</span>
<span>
<div class="d-flex justify-content-end px-3">
<a href="produit?id_produit=${element.id_produit}" style="border-radius: 5px;" class="h-50 w-25 btn btn-info">VOIR</a>
<button style="border-radius: 5px;" class="h-50 w-25 ml-1 btn-danger" onclick="retirer_du_panier(${index})"><i class="bi bi-trash"></i> RETIRER</button>
</div>
</span>
</div>
</div>
</div>
</div>
`);
});
$("#total").text(products.reduce((a, b) => a + b.qtt_panier * b.prix_produit, 0).toFixed(2) + " DH");


}


<script>
<?php
if (!isset($_SESSION["id_client"]))
header("location: index.php");
else
echo "const id_client=" . $_SESSION["id_client"] . ";";
?>
var products = [];
//TODO ADD DETAILS

function fill_cart_div() {
$("#cart_content").text('');
products.forEach((element, index) => {
$('#cart_content').append(`
<div class="card mb-3 p-0 h-25">
<div class="row no-gutters">
<div class="col-md-2">
<img src="img/products/${element.id_produit}.jpg" class="card-img w-75" alt="image_produit">
</div>
<div class="col-md-10">
<div class="card-body p-3 col-12 " style="width: 100%;">
<span class="card-title p-0 h5 d-flex justify-content-between" style="color: black;"><span style="color: black;">${element.label}</span>
<span>
<span class="mr-1" id="price" style="color: black;">${element.prix_produit.toFixed(2)}</span>
<span style="color: black;">DH</span>
</span>
<span>
<span class="border pt-2 pl-3 pr-3 pb-1" id="qty">${element.qtt_panier}</span>
<button id="minus" onclick="change_qtt(${index},'-')" style="padding: 2px 5px; border-radius: 10px; background-color: rgb(230,230,230) ;border-color:(230,230,230); border-width: 1px;">-</button>
<button id="plus" onclick="change_qtt(${index},'+')" style="padding: 2px 3px; border-radius: 10px; background-color: rgb(230,230,230) ;border-color:(230,230,230); border-width: 1px;">+</button>
</span>
<span>
<span >
<span class="mr-1" id="price" style="color: black;">${(element.prix_produit*element.qtt_panier).toFixed(2)}</span>
<span style="color: black;">DH</span>
</span>

</span>
<span>
<div class="mt-1">
<div class="d-flex justify-content-end px-3">
<a href="produit?id_produit=${element.id_produit}" style="border-radius: 5px;" class="h-50 w-25 btn btn-info">VOIR</a>
<button style="border-radius: 5px;" class="h-50 w-25 ml-1 btn-danger" onclick="retirer_du_panier(${index})"><i class="bi bi-trash"></i> RETIRER</button>
<button style="border-radius: 5px;" class="h-50 w-25 ml-1 p-1 btn-danger" onclick="retirer_du_panier(${index})"><i class="bi bi-trash"></i> RETIRER</button>
</div>
</span>
</div>
</div>
</div>
</div>
</div>
`);
});
$("#total").text(products.reduce((a, b) => a + b.qtt_panier * b.prix_produit, 0).toFixed(2) + " DH");
});
$("#total").text(products.reduce((a, b) => a + b.qtt_panier * b.prix_produit, 0).toFixed(2) + " DH");


}
}


function search() {
fetch("../php/cart/cart_read").then(resp => resp.json()).then(json => {
var data = json.data;
products = data;
fill_cart_div()
function search() {
fetch("../php/cart/cart_read").then(resp => resp.json()).then(json => {
var data = json.data;
products = data;
fill_cart_div()



}).catch(err => {
console.log(err);
});
}
}).catch(err => {
console.log(err);
});
}

function retirer_du_panier(index) {
var element = products[index];
console.log(element);
$('#modal_content').html(`
function retirer_du_panier(index) {
var element = products[index];
console.log(element);
$('#modal_content').html(`
<div class="modal-header">
<h5 class="modal-title" >RETIRER DU PANIER</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
Expand Down Expand Up @@ -268,44 +201,44 @@ function retirer_du_panier(index) {
<button type="button" class="btn btn-secondary" data-dismiss="modal">Anuller</button>
<button type="button" onclick="delete_produit(${index})" class="btn btn-danger"><i class="bi bi-trash"></i> Suprrimer</button>
</div>`);
$('#modal_details').modal('show');
}

function delete_produit(index) {
var element = products[index];

fetch("../php/cart/delete_from_cart?id_produit=" + element.id_produit + "&options_produit=" + element.options_produit).then(resp => resp.json()).then(json => {
$("#modal_details").modal("hide");
$('#toast_delete').toast({
delay: 1500
})
$('#toast_delete').toast('show')

search();

}).catch(err => {
console.log(err);
});
}

function change_qtt(index, char) {
var element = products[index];
var qtt_panier = (char == '+') ? element.qtt_panier + 1 : (element.qtt_panier > 0) ? element.qtt_panier - 1 : 0;
if (qtt_panier != element.qtt_panier) {
console.log("updating");
element.qtt_panier = qtt_panier;
fetch("php/cart/update_cart.php?id_produit=" + element.id_produit + "&qtt_panier=" + element.qtt_panier + "&options_produit=" + element.options_produit).then(resp => resp.json()).then(json => {
console.log(json);
fill_cart_div();
}).catch(err => console.log(err));
$('#modal_details').modal('show');
}

function delete_produit(index) {
var element = products[index];

fetch("../php/cart/delete_from_cart?id_produit=" + element.id_produit + "&options_produit=" + element.options_produit).then(resp => resp.json()).then(json => {
$("#modal_details").modal("hide");
$('#toast_delete').toast({
delay: 1500
})
$('#toast_delete').toast('show')

search();

}).catch(err => {
console.log(err);
});
}

}
function change_qtt(index, char) {
var element = products[index];
var qtt_panier = (char == '+') ? element.qtt_panier + 1 : (element.qtt_panier > 0) ? element.qtt_panier - 1 : 0;
if (qtt_panier != element.qtt_panier) {
console.log("updating");
element.qtt_panier = qtt_panier;
fetch("php/cart/update_cart.php?id_produit=" + element.id_produit + "&qtt_panier=" + element.qtt_panier + "&options_produit=" + element.options_produit).then(resp => resp.json()).then(json => {
console.log(json);
fill_cart_div();
}).catch(err => console.log(err));
}

}


//id_client de la session
search();
</script>
//id_client de la session
search();
</script>

</body>

Expand Down
Loading

0 comments on commit 8e389e5

Please sign in to comment.