Skip to content

Commit

Permalink
Merge pull request #1 from carleii/main
Browse files Browse the repository at this point in the history
wanted to merge
  • Loading branch information
carleii authored Dec 12, 2024
2 parents 0a1b925 + 6b732ca commit c285ee4
Show file tree
Hide file tree
Showing 6 changed files with 335 additions and 90 deletions.
1 change: 1 addition & 0 deletions async/php/add_sell.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
require '../../ressources/entities/class.php';
require '../../protocoles/cookie/$_cookie.php';
require '../../ressources/configuration/session.php';
// print_r($entreprise);
if ($utilisateur->niveau_acces >=2 ) {
$vente = new Vente;
$vente->date_vente = date('Y-m-d');
Expand Down
81 changes: 8 additions & 73 deletions center_right.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="center">
<div id="webapp-navbar-menu" class="centered-links">
<a id="dashboards-navbar-menu" class="centered-link centered-link-toggle" data-menu-id="dashboards-webapp-menu">
<a href="./personnal-home.php" id="dashboards-navbar-menu" class="centered-link centered-link-toggle">
<i data-feather="activity"></i>
<span>Dashboards</span>
</a>
Expand All @@ -25,7 +25,7 @@
<span>Employers</span>
</a>

<a href="webapp-messaging-chat.html" class="centered-link">
<a href="#" class="centered-link">
<i data-feather="message-circle"></i>
<span>Chat</span>
</a>
Expand Down Expand Up @@ -67,7 +67,7 @@
</div>

<a class="toolbar-link right-panel-trigger" data-panel="languages-panel">
<img src="assets/img/icons/flags/united-states-of-america.svg" alt="" />
<img src="assets/img/icons/flags/france.svg" alt="" />
</a>

<div class="toolbar-notifications is-hidden-mobile">
Expand All @@ -76,72 +76,7 @@
<i data-feather="bell"></i>
<span class="new-indicator pulsate"></span>
</div>
<div class="dropdown-menu" role="menu">
<div class="dropdown-content">
<div class="heading">
<div class="heading-left">
<h6 class="heading-title">Notifications</h6>
</div>
<div class="heading-right">
<a class="notification-link" href="admin-profile-notifications.html">See all</a>
</div>
</div>
<ul class="notification-list">
<li>
<a class="notification-item">
<div class="img-left">
<img class="user-photo" alt="" src="https://via.placeholder.com/150x150" data-demo-src="assets/img/avatars/photos/7.jpg" />
</div>
<div class="user-content">
<p class="user-info">
<span class="name">Alice C.</span> left a comment.
</p>
<p class="time">1 hour ago</p>
</div>
</a>
</li>
<li>
<a class="notification-item">
<div class="img-left">
<img class="user-photo" alt="" src="https://via.placeholder.com/150x150" data-demo-src="assets/img/avatars/photos/12.jpg" />
</div>
<div class="user-content">
<p class="user-info">
<span class="name">Joshua S.</span> uploaded a file.
</p>
<p class="time">2 hours ago</p>
</div>
</a>
</li>
<li>
<a class="notification-item">
<div class="img-left">
<img class="user-photo" alt="" src="https://via.placeholder.com/150x150" data-demo-src="assets/img/avatars/photos/13.jpg" />
</div>
<div class="user-content">
<p class="user-info">
<span class="name">Tara S.</span> sent you a message.
</p>
<p class="time">2 hours ago</p>
</div>
</a>
</li>
<li>
<a class="notification-item">
<div class="img-left">
<img class="user-photo" alt="" src="https://via.placeholder.com/150x150" data-demo-src="assets/img/avatars/photos/25.jpg" />
</div>
<div class="user-content">
<p class="user-info">
<span class="name">Melany W.</span> left a comment.
</p>
<p class="time">3 hours ago</p>
</div>
</a>
</li>
</ul>
</div>
</div>

</div>
</div>

Expand All @@ -160,11 +95,11 @@
<img class="avatar" src="https://via.placeholder.com/150x150" data-demo-src="assets/img/avatars/photos/8.jpg" alt="" />
</div>
<div class="meta">
<span>Erik Kovalsky</span>
<span>Product Manager</span>
<span><?php echo $utilisateur->nom ?></span>
<span><?php echo $utilisateur->telephone ?></span>
</div>
</div>
<a href="admin-profile-view.html" class="dropdown-item is-media">
<a href="#" class="dropdown-item is-media">
<div class="icon">
<i class="lnil lnil-user-alt"></i>
</div>
Expand All @@ -173,7 +108,7 @@
<span>View your profile</span>
</div>
</a>
<a class="dropdown-item is-media layout-switcher">
<a href="#" class="dropdown-item is-media layout-switcher">
<div class="icon">
<i class="lnil lnil-layout"></i>
</div>
Expand Down
29 changes: 18 additions & 11 deletions personnal-home.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@
<?php
$tst = 0;
$tic = 0;
$no = 0;
$loss = 0;
$revenuecemois = 0;
$revenuemoisdernier = 0;
Expand All @@ -124,7 +123,6 @@
$tst += $go * $quantite;

if ($status == "complete") {
$no++;
$tic += $go * $quantite;
# code...
} else {
Expand Down Expand Up @@ -188,7 +186,18 @@
</div>
<div class="dashboard-tile-inner">
<div class="left">
<span class="dark-inverted"><?php echo $no ?></span>
<span class="dark-inverted">
<?php
$query = mysqli_query($HURO, "SELECT COUNT(DISTINCT(id_vente)) as sells FROM vente
where id_utilisateur = '$admin->telephone' and id_entreprise = '$entreprise->id_entreprise'
and
MONTH(date_vente) = MONTH(CURDATE()) and YEAR(vente.date_vente) = YEAR(CURDATE())
");
$result = mysqli_fetch_assoc($query);
echo $result['sells'];

?>
</span>
</div>
<div class="right">
<div id="spark3"></div>
Expand Down Expand Up @@ -569,11 +578,10 @@
$idvente = $result['idvente'];
$date_vente = $result['date_vente'];
$id_client = $result['id_client'];
$q = "SELECT produit.id_produit, vente.qte, vente.prix_vente FROM produit, vente WHERE vente.date_vente = '$date_vente' and vente.id_utilisateur = '$utilisateur->telephone' and vente.id_vente = '$idvente' and vente.id_produit = produit.id_produit ";
$q = "SELECT produit.id_produit, vente.qte, vente.prix_vente FROM produit, vente WHERE vente.id_utilisateur = '$utilisateur->telephone' and vente.id_vente = '$idvente' and vente.id_produit = produit.id_produit ";
$q = mysqli_query($HURO, $q);
$facture = 0;
while ($r = mysqli_fetch_assoc($q)) {
if (1) {
$produit = new Produit($id_produit);
if ($r['prix_vente'] == -1) {
$go = $produit->prix_standard;
Expand All @@ -582,10 +590,9 @@
$go = $produit->prix_minimum;
# code...
} else {
$go = ($r['prix_vente']);
$go = $r['prix_vente'];
}
$facture += $go * $r['qte'];
}
# code...
}
echo '
Expand All @@ -595,23 +602,23 @@
<div>
<span
class="item-name dark-inverted is-font-alt is-weight-600"><a href="tel:'.$id_client.'">'.$id_client.'</a></span>
class="item-name dark-inverted is-font-alt is-weight-600"><a href="tel:' . $id_client . '">' . $id_client . '</a></span>
<span class="item-meta">
<span>#158456</span>
</span>
</div>
</div>
<div class="flex-table-cell" data-th="Date">
<span class="light-text">'.$date_vente.'</span>
<span class="light-text">' . $date_vente . '</span>
</div>
<div class="flex-table-cell" data-th="Amount">
<span class="dark-inverted is-weight-500">'.$facture.'</span>
<span class="dark-inverted is-weight-500">' . $facture . '</span>
</div>
<div class="flex-table-cell" data-th="Status">
<span class="tag is-green is-rounded">Paid</span>
</div>
<div class="flex-table-cell" data-th="Tracking">
<a class="action-link is-pushed-mobile">'.$idvente.'</a>
<a class="action-link is-pushed-mobile">' . $idvente . '</a>
</div>
<div class="flex-table-cell cell-end" data-th="Actions">
<button class="button h-button is-dark-outlined is-pushed-mobile">
Expand Down
4 changes: 2 additions & 2 deletions protocoles/post/$_post.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@
};
// login
if (isset($_POST['login'])) {
$utilisateur = new Utilisateur(null, $_POST['tel'], $_POST['password']);
$utilisateur = new Utilisateur(null, $_POST['tel'], md5($_POST['password']));
if ($utilisateur->authenticate()) {
if (setcookie('andhisnameisjhoncena', $utilisateur->telephone . '$$$' . $_POST['password'], time() + 24 * 60 * 60 * 30)) {
if (setcookie('andhisnameisjhoncena', $utilisateur->telephone . '$$$' . $utilisateur->mot_de_passe, time() + 24 * 60 * 60 * 30)) {
header("Location: ./personnal-home.php?f");
exit();
# code...
Expand Down
9 changes: 5 additions & 4 deletions ressources/entities/class.php
Original file line number Diff line number Diff line change
Expand Up @@ -275,12 +275,12 @@ class Entreprise
public $telephone_utilisateur;
public $logo;

public function __construct($id_entreprise, $telephone_utilisateur ="", $nom = "", $adresse = "", $logo = "")
public function __construct($id_entreprise = "", $telephone_utilisateur ="", $nom = "", $adresse = "", $logo = "")
{
$this->HURO = connectDb();
$this->telephone_utilisateur = $id_entreprise;
if (!empty($id_entreprise)) {
$query = "SELECT telephone_utilisateur, nom_entreprise, logo, adresse_entreprise FROM " . $this->table . " WHERE id_entreprise = $id_entreprise ";
$this->id_entreprise = $id_entreprise;
$query = "SELECT telephone_utilisateur, nom_entreprise, logo, adresse_entreprise FROM " . $this->table . " WHERE id_entreprise = '$id_entreprise' ";
$stmt = $this->HURO->prepare($query);
$stmt->execute();
$stmt->store_result();
Expand Down Expand Up @@ -514,14 +514,15 @@ public function create()
{
$query = "INSERT INTO " . $this->table . " SET qte = ?, id_produit = ?, id_vente = ?, id_utilisateur = ?, id_client = ?, date_vente = ?, prix_vente = ?, status_vente = 'complete', id_entreprise = ?";
$produit = new Produit($this->id_produit);
if ($produit->quantite_dispo > -1 and ($produit->quantite_dispo - $this->quantite >= 0)) {
if ($produit->quantite_dispo > -1 and (($produit->quantite_dispo - $this->quantite) >= 0)) {
$stmt = $this->HURO->prepare($query);
$stmt->bind_param("iississi", $this->quantite, $this->id_produit, $this->id_vente, $this->id_utilisateur, $this->id_client, $this->date_vente, $this->prix, $this->id_entreprise);
$produit->quantite_dispo = $produit->quantite_dispo - $this->quantite;
if ($stmt->execute()) {
return ($produit->update()) ? 1: -2;
# code...
}
print_r($this->HURO);
return -1; //Probleme de vente
# code...
}elseif ($produit->quantite_dispo == -1) {
Expand Down
Loading

0 comments on commit c285ee4

Please sign in to comment.