index.html 15.3 KB
<!DOCTYPE html>
<html lang="fr">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0" />
    <title>10⁵</title>

    <!-- CSS  -->
    <link href="css/style.css" type="text/css" rel="stylesheet" media="screen,projection" />
</head>

<body>
    <!-- Réutilisable -->
    <div id="modalErreur" class="modal">
        <div class="modal-content">
            <h4>{{ erreurTitre }}</h4>
            <p v-if="modalGeneriqueContenu">{{ erreurMessage }}</p>
        </div>
        <div class="modal-footer">
            <a class="modal-action modal-close waves-effect btn-flat">Ça marche</a>
        </div>
    </div>
    <ul id="menuUtilisateur" class="dropdown-content">
        <li><a>Se déconnecter</a></li>
        <li><a>Changer de mot de passe</a></li>
        <li><a>Changer de carte</a></li>
        <li class="prezSeul"><a>Gestion des utilisateurs</a></li>
    </ul>
    <div id="passerCarte" class="modal">
        <div class="modal-content">
            <h4>Passez la carte du client</h4>
            <p>Veuillez passer la carte du client concerné pour finaliser l'action suivante : <strong>recharger 10 €</strong>.</p>
        </div>
        <div class="modal-footer">
            <a class="modal-action modal-close waves-effect waves-red btn-flat">Annuler</a>
        </div>
    </div>
    <div id="soldeInsuffisant" class="modal">
        <div class="modal-content">
            <h4>Solde insuffisant</h4>
            <p>
                Le solde de la carte <strong>QUAELUY1RO</strong> n'est pas suffisant pour effectuer un paiement de 3,50 €.<br/> Solde actuel : 2,70 €<br/> Manquant : 0,80 €<br/>
            </p>
        </div>
        <div class="modal-footer">
            <a href="#rechargement" class="modal-action modal-close waves-effect waves-green btn-flat">Recharger</a>
            <a class="modal-action modal-close waves-effect waves-red btn-flat">Annuler</a>
        </div>
    </div>

    <!-- Page -->
    <nav role="navigation">
        <div>
            <div>
                <a class="brand-logo" v-if="page == 'connexion'">10⁵</a>
                <div class="left" v-else>
                    <a class="breadcrumb">10⁵</a>
                    <a class="breadcrumb" v-if="page == 'operations'">Opérations</a>
                    <a class="breadcrumb" v-if="page == 'gestion'">Gestion</a>
                </div>
                <ul class="right hide-on-med-and-down">
                    <li v-if="connecte">
                        <a class="dropdown-button" data-activates="menuUtilisateur">
                            <i class="material-icons">perm_identity</i> {{ login }} (<i class="material-icons">timer</i> {{ timer }})
                        </a>
                    </li>
                    <li v-if="connecte && page == 'operations'">
                        <a @click="page = 'gestion'">
                            <i class="material-icons">settings</i> Gestion
                        </a>
                    </li>
                    <li v-if="connecte && page == 'gestion'">
                        <a @click="page = 'operations'">
                            <i class="material-icons">play_arrow</i> Opérations
                        </a>
                    </li>
                </ul>
            </div>
            <div>
                <ul class="tabs" v-show="page == 'operations'">
                    <li class="tab col s3"><a href="#creation">Création</a></li>
                    <li class="tab col s3"><a href="#rechargement">Rechargement</a></li>
                    <li class="tab col s3"><a class="active" href="#paiement">Paiement</a></li>
                    <li class="tab col s3"><a href="#vidange">Vidange</a></li>
                </ul>
                <ul class="tabs" v-show="page == 'gestion'">
                    <li class="tab col s3"><a href="#clients">Clients</a></li>
                    <li class="tab col s3"><a href="#transactions">Transactions</a></li>
                    <li class="tab col s3"><a href="#utilisateurs">Utilisateurs</a></li>
                    <li class="tab col s3"><a href="#statistiques">Statistiques</a></li>
                </ul>
            </div>
            <ul class="side-nav">
                <li><a>TODO</a></li>
            </ul>
        </div>
    </nav>

    <div id="main">
        <div class="container" v-show="page == 'connexion'">
            <h4>Se connecter</h4>
            <div>
                <h5>Avec votre identifiant et votre mot de passe</h5>
                <form @submit="connecter">
                    <div class="input-field">
                        <i class="material-icons prefix">account_circle</i>
                        <input type="text" name="login" v-model="login">
                        <label for="login">Identifiant</label>
                    </div>
                    <div class="input-field">
                        <i class="material-icons prefix">vpn_key</i>
                        <input type="password" name="mdp" v-model="mdp">
                        <label for="mdp">Mot de passe</label>
                    </div>
                    <button :disabled="!login || !mdp">Se connecter</button>
                </form>
            </div>
        </div>
        <div v-if="PEUT_NFC">
            <h5>Avec votre carte étudiant</h5>
            <p>Passez-la simplement devant le lecteur.</p>
        </div>

        <div class="container" v-show="page == 'operations'">
            <div class="row">
                <div id="creation">
                    <h4>Créer un nouveau client</h4>
                    <form @submit="creer">
                        <div class="input-field" v-if="!PEUT_NFC">
                            <i class="material-icons prefix">credit_card</i>
                            <input type="text" name="idCarte" length="8" v-model="idCarte">
                            <label for="idCarte">Identifiant de la carte</label>
                        </div>
                        <div class="input-field">
                            <i class="material-icons prefix">trending_flat</i>
                            <input type="number" name="solde" v-model="solde">
                            <label for="solde">Solde initial (€)</label>
                        </div>
                        <div class="row" v-if="droit >= 3">
                            <strong>Découvert autorisé</strong>
                            <div class="switch">
                                <label>
                                    Non
                                    <input v-model="decouvert" type="checkbox">
                                    <span class="lever"></span>
                                    Oui
                                </label>
                            </div>
                        </div>
                        <button type="submit" :disabled="!solde || (!PEUT_NFC && !idCarte)">Créer</button>
                    </form>
                </div>
                <div id="rechargement">
                    <h4>Recharger un client</h4>
                    <form @submit="recharger">
                        <div class="input-field" v-if="!PEUT_NFC">
                            <i class="material-icons prefix">credit_card</i>
                            <input type="text" name="idCarte" length="8" v-model="idCarte">
                            <label for="idCarte">Identifiant de la carte</label>
                        </div>
                        <div class="input-field">
                            <i class="material-icons prefix">trending_up</i>
                            <input type="number" name="credit" v-model="credit">
                            <label for="credit">Crédit (€)</label>
                        </div>
                        <button type="submit" :disabled="!credit || (!PEUT_NFC && !idCarte)">Recharger</button>
                    </form>
                </div>
                <div id="paiement">
                    <h4>Vendre à un client</h4>
                    <form>
                        <div class="input-field" v-if="!PEUT_NFC">
                            <i class="material-icons prefix">credit_card</i>
                            <input type="text" name="idCarte" length="8" v-model="idCarte">
                            <label for="idCarte">Identifiant de la carte</label>
                        </div>
                        <div class="row">
                            <h5>En spécifiant le nombre de consommations</h5>
                        </div>
                        <div id="grilleBieres">
                            <div>
                                <div v-for="i in [1, 2, 3, 4, 5, 6]"><button type="button" @click="payer(i)" :disabled="prix || (!PEUT_NFC && !idCarte)">{{ i }}</button></div>
                            </div>
                        </div>
                        <div class="row">
                            <h5>En spécifiant un montant</h5>
                        </div>
                        <div class="input-field">
                            <i class="material-icons prefix">trending_down</i>
                            <input type="number" name="prix" v-model="prix">
                            <label for="prix">Prix (€)</label>
                        </div>
                        <button type="submit" @click="payer" :disabled="!prix || (!PEUT_NFC && !idCarte)">Payer</button>
                    </form>
                </div>
                <div id="vidange">
                    <h4>Vider le contenu de la carte d'un client</h4>
                    <form @submit="vidanger">
                        <div class="input-field" v-if="!PEUT_NFC">
                            <i class="material-icons prefix">credit_card</i>
                            <input type="text" name="idCarte" length="8" v-model="idCarte">
                            <label for="idCarte">Identifiant de la carte</label>
                        </div>
                        <button type="submit" :disabled="!PEUT_NFC && !idCarte">Vider</button>
                    </form>
                </div>
            </div>
        </div>

        <div class="container" v-show="page == 'gestion'">
            <div class="row">
                <div id="clients">
                    <h4>Liste des clients</h4>
                    <button @click="actuClients">Rafraîchir</button>
                    <ul class="collapsible popout" data-collapsible="accordion">
                        <li v-for="client in clients">
                            <div class="collapsible-header">
                                <i class="material-icons">perm_identity</i> {{ client.idCarte }} : {{ client.solde }} €
                            </div>
                            <div class="collapsible-body">
                                <ul>
                                    <li v-if="droit >= 3">
                                        <strong>Découvert autorisé</strong>
                                        <div class="switch">
                                            <label>
                                                Non
                                                <input v-model="client.decouvert" type="checkbox" @click="decouvert(client.idCarte, client.decouvert, $event)">
                                                <span class="lever"></span>
                                                Oui
                                            </label>
                                        </div>
                                    </li>
                                </ul>
                                <h5>Transactions</h5>
                                <p>TODO</p>
                            </div>
                        </li>
                    </ul>
                </div>
                <div id="transactions">
                    <h4>Liste des transactions</h4>
                    <button @click="actuTransactions">Rafraîchir</button>
                    <ul class="collapsible popout" data-collapsible="accordion">
                        <li v-for="transaction in transactions | orderBy 'date' -1">
                            <div class="collapsible-header" :class="{'red': !transaction.valide}">
                                <span v-if="transaction.type == 1">
                                    <i class="material-icons">trending_flat</i> {{ transaction.client }} : {{ transaction.montant }} €
                                </span>
                                <span v-if="transaction.type == 2">
                                    <i class="material-icons">trending_up</i> {{ transaction.client }} : + {{ transaction.montant }} €
                                </span>
                                <span v-if="transaction.type == 3">
                                    <i class="material-icons">trending_down</i> {{ transaction.client }} : - {{ transaction.montant }} €
                                    <span v-if="transaction.quantite != 0">({{ transaction.quantite }} consommation<span v-if="transaction.quantite >= 2">s</span>)</span>
                                </span>
                                <span v-if="transaction.type == 4">
                                    <i class="material-icons">delete</i> {{ transaction.client }} : - {{ transaction.montant }} €
                                </span>
                            </div>
                            <div class="collapsible-body">
                                <ul>
                                    <li>
                                        <strong>Type :</strong>
                                        <span v-if="transaction.type == 1">Création</span>
                                        <span v-if="transaction.type == 2">Rechargement</span>
                                        <span v-if="transaction.type == 3">Date</span>
                                        <span v-if="transaction.type == 4">Vidange</span>
                                    </li>
                                    <li>
                                        <strong>Date :</strong> <span v-text="transaction.date | date"></span>
                                    </li>
                                    <li>
                                        <strong>Utilisateur :</strong> {{ transaction.utilisateur }}
                                    </li>
                                </ul>
                                <button @click="annuler(transaction.id)" :disabled="!transaction.valide">Annuler</button>
                            </div>
                        </li>
                    </ul>
                </div>
                <div id="utilisateurs">
                    <h4>Liste des utilisateurs</h4>
                </div>
                <div id="statistiques">
                    <h4>Statistiques</h4>
                </div>
            </div>
        </div>


    </div>

    <footer class="page-footer">
        <div class="footer-copyright">
            <div class="container">
                10p5 v0.0.0 - © Copyright 2016, <a href="http://clubinfo.plil.net">Le Club Info Polytech Lille</a>
            </div>
        </div>
    </footer>


    <!--  Scripts-->
    <script src="lib/jquery/dist/jquery.min.js"></script>
    <script src="lib/Materialize/dist/js/materialize.min.js"></script>
    <script src="lib/vue/dist/vue.min.js"></script>
    <script src="js/init.js"></script>

</body>

</html>