<?php use Helpers\Url; ?>
<script>
    window.idU = '<?= $data['usuaris']['idU'] ?>';
</script>

    <div data-ng-if="loading" class="loading">
        Carregant...
    </div>    

<!-- Detall del contingut -->
<div class="content" style="margin-top:30px;" ng-controller="LoginController as login" id="usuaris">
    <div class="row" ng-show="login.showLogin">
        <div class="col-xs-0 col-lg-4"></div>
        <div class="col-xs-12 col-lg-4">
            <div class="panel panel-info">
                <div class="panel-heading">Autentificació</div>
                <div class="panel-body">
                    <div class="form-group" ng-show="login.error.length > 0">
                        <div class="alert alert-danger" role="alert">{{login.error}}</div>
                    </div>
                    <div class="form-group" ng-show="login.missatge.length > 0">
                        <div class="alert alert-success" role="alert">{{login.missatge}}</div>
                    </div>
                    <div class="form-group">                    
                        <input type="text" class="form-control" ng-model="login.TelefonUsuari" placeholder="Telèfon...(Ex: 651098567)">
                    </div>
                    <div class="form-group">                    
                        <input type="password" class="form-control" ng-model="login.Contrasenya" placeholder="Contrasenya...">
                    </div>
                    <div class="form-group">                    
                        <a ng-click="login.goRecordaContrasenya()" href="#">Recorda'm la contrasenya...</a>
                    </div>
                    <div vc-recaptcha 
                            ng-model="login.captcha" 
                            size="normal"
                            type="image"
                            key="'<?php echo $data['RECAPTCHA_PUBLIC_KEY'] ?>'">

                    </div>
                    <div style="margin-top:10px;">                         
                        <button class="btn btn-default" ng-click="login.doLogin()">Identifica't</button> o 
                        <button class="btn btn-success" ng-click="login.doNewUser()">Crea nou usuari</button>
                    </div>
                </div>
            </div>
        </div>
        <div class="col-xs-0 col-lg-4"></div>
    </div>
    
    <!-- ********************************** -->
    <!-- Informació que mostrem de l'usuari -->
    <!-- ********************************** -->

    <div class="row" ng-show="! login.showLogin">
        <div class="col-xs-12 col-lg-6">
            <div class="panel panel-primary">
                <div class="panel-heading">Dades Personals</div>
                <div class="panel-body">
                    <div class="form-group" ng-show="login.error.length > 0">
                        <div class="alert alert-danger" role="alert">{{login.error}}</div>
                    </div>
                    <div class="form-group" ng-show="login.missatge.length > 0">
                        <div class="alert alert-success" role="alert">{{login.missatge}}</div>
                    </div>
                    <div class="form-group">
                        <label>Telèfon mòbil</label>
                        <input type="text" class="form-control" ng-model="login.OClient.client.c_Telefon" placeholder="Ex: 651319826">
                        <p class="help-block">Per poder accedir al compte usarà el telèfon</p>
                    </div>
                    <div class="form-group">                    
                        <label>Nom</label>
                        <input type="text" class="form-control" ng-model="login.OClient.client.c_Nom" placeholder="Ex: Albert">
                        <input type="hidden" class="form-control" ng-model="login.OClient.client.c_id" placeholder="">
                        
                    </div>
                    <div class="form-group">                    
                        <label>Cognoms</label>
                        <input type="text" class="form-control" ng-model="login.OClient.client.c_Cognoms" placeholder="Ex: Johan Brahms">
                    </div>
                    <div class="form-group">                    
                        <label>Email</label>
                        <input type="text" class="form-control" ng-model="login.OClient.client.c_Email" placeholder="Ex: johan.brahms@gmail.com">
                    </div>
                    <div class="form-group">                    
                        <label>Contrassenya</label>
                        <input type="password" class="form-control" ng-model="login.OClient.client.c_Password" placeholder="Ex: Contrasenya">
                    </div>
                    <div class="form-group">                    
                        <label>Adreca</label>
                        <input type="text" class="form-control" ng-model="login.OClient.client.c_Adreca" placeholder="Ex: Plaça Catalunya 28">
                    </div>
                    <div class="form-group">                    
                        <label>Codi postal</label>
                        <input type="text" class="form-control" ng-model="login.OClient.client.c_CodiPostal" placeholder="Ex: 17230">
                            </div>
                    <div class="form-group">                    
                        <label>Poblacio</label>
                        <input type="text" class="form-control" ng-model="login.OClient.client.c_Ciutat" placeholder="Ex: Palamós">
                    </div>
                    
                    <button class="btn btn-default" ng-click="login.setClient()">Guarda dades</button>
                </div>
            </div>
        </div>
        <div class="col-xs-12 col-lg-6">
            <div class="panel panel-primary">
                <div class="panel-heading">Espectacles comprats</div>
                <div class="panel-body">
                    <table class="table">
                        <tr>
                            <th>Comanda</th>
                            <th>Espectacle</th>
                            <th>Sessió</th>
                            <th>Seients</th>                            
                            <th>Acció</th>                            
                        </tr>
                        <tr ng-repeat="(k,r) in login.sessions">
                            <td>{{k}}</td>
                            <td>{{r.Espectacle}}</td>    
                            <td>{{r.Sessio}}</td>
                            <td><div ng-repeat="l in r.Seient">{{l}}</div></td>
                            <td><a href="{{r.URL_ENTRADES}}">Imprimir entrades</a></td>
                        </tr>
                    </table>
                    <button class="btn btn-default" ng-click="login.doLogout()">Tancar sessió</button>
                </div>
            </div>
        </div>        
    </div>
</div>
<!-- Fi detall del contingut -->