SHARE
TWEET

Untitled

a guest Jan 24th, 2020 98 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <template>
  2. <div>
  3.     <h2 style="background-color: #343a40; color:white; " class="container">Vaše prijave: </h2>
  4.     <div  v-for="podaci in stanjepodaci">
  5.     <div v-if="stanje==podaci.email">
  6.         <div class="card text-center container" style="margin-bottom: 30px; padding-top:10px; margin-top:2px;">
  7.   <div v-if="podaci.status=='odobreno'" class="card-header" style="background-color: green;">
  8.     {{podaci.email}}
  9.   </div>
  10.   <div v-else-if="podaci.status=='odbijeno'" class="card-header" style="background-color: red;">
  11.     {{podaci.email}}
  12.   </div>
  13.   <div v-else-if="podaci.status=='promjenatermina'" class="card-header" style="background-color: yellow;">
  14.     {{podaci.email}}
  15.   </div>
  16.   <div v-else-if="podaci.status=='rijeseno'" class="card-header" style="background-color: lightblue;">
  17.     {{podaci.email}}
  18.   </div>
  19.   <div v-else class="card-header">
  20.     {{podaci.email}}
  21.   </div>
  22.   <div class="card-body ">
  23.     <h5 class="card-title"></h5>
  24.    
  25.     <div v-if="podaci.status=='rijeseno'" class="row">
  26.     <p class="card-text col-6 col-sm-6">
  27.               Ime:{{podaci.ime}} <br>
  28.               Prezime:{{podaci.prezime}}<br>
  29.               tel:{{podaci.brtel}} <br>
  30.               tel2:{{podaci.brtel2}}<br>
  31.               email:{{podaci.email}}<br>
  32.               Grad: {{podaci.grad}}, {{podaci.zip}}<br>
  33.               Adresa: {{podaci.adresa}}<br>
  34.              
  35.               Radiona:{{podaci.radiona}}<br>
  36.               Vozilo:{{podaci.auto}}<br>
  37.               Godište: {{podaci.year}}<br>
  38.               Prijeđeni km:{{podaci.number}}<br>
  39.               Željeni termin: {{podaci.datum}} - {{podaci.vrijeme}}<br>
  40.               Opis kvara: {{podaci.tekst}}<br>
  41.               </p>
  42.               <div v-if="podaci.status=='rijeseno'" class="alert alert-info col-6 col-sm-6 content-justify-center" role="alert" style="display: inline-block" >
  43.       <h3>Prijava je riješena !</h3><h4> Zahvaljujemo na Vašem povjerenju.</h4>
  44.       <h5>Kako biste ocijenili vaše iskustvo?</h5><br>
  45.       <label for="imereview" class="h5">Ime i prezime:</label>
  46.       <input v-model="ime" type="email" class="form-control" required id="imereview" aria-describedby="imereveiew" :placeholder="podaci.ime+' '+podaci.prezime" >
  47.       <br><h5>Ocjena: </h5>
  48.       <form @submit.prevent="review">
  49.       <div class="rate" style="margin-left: 170px; ">
  50.    <fieldset class="rating">
  51.     <input v-model="star" type="radio" id="star5" name="rating" value="5" /><label class = "full" for="star5" title="5"></label>
  52.     <input v-model="star" type="radio" id="star4half" name="rating" value="4.5" /><label class="half" for="star4half" title="4.5"></label>
  53.     <input v-model="star" type="radio" id="star4" name="rating" value="4" /><label class = "full" for="star4" title="4"></label>
  54.     <input v-model="star" type="radio" id="star3half" name="rating" value="3.5" /><label class="half" for="star3half" title="3.5"></label>
  55.     <input v-model="star" type="radio" id="star3" name="rating" value="3" /><label class = "full" for="star3" title="3"></label>
  56.     <input v-model="star" type="radio" id="star2half" name="rating" value="2.5" /><label class="half" for="star2half" title="2.5"></label>
  57.     <input v-model="star" type="radio" id="star2" name="rating" value="2" /><label class = "full" for="star2" title="2"></label>
  58.     <input v-model="star" type="radio" id="star1half" name="rating" value="1.5" /><label class="half" for="star1half" title="1.5"></label>
  59.     <input v-model="star" type="radio" id="star1" name="rating" value="1" /><label class = "full" for="star1" title="1"></label>
  60.     <input v-model="star" type="radio" id="starhalf" name="rating" value="0.5" /><label class="half" for="starhalf" title="0.5"></label>
  61. </fieldset>
  62.   </div>
  63.       <textarea v-model="text" class="form-control rounded-0" id="exampleFormControlTextarea1" rows="4"></textarea>
  64.       <br><button type="submit" class="btn btn-outline-primary">Pošalji</button>
  65.   </form>
  66.     </div>
  67.   </div>
  68.   <div v-else-if="podaci.status=='promjenatermina'" class="row">
  69.     <p class="card-text col-6 col-sm-6" style="border: 1px solid black;">
  70.               Ime: {{podaci.ime}} <br>
  71.               Prezime: {{podaci.prezime}}<br>
  72.               tel: {{podaci.brtel}} <br>
  73.               tel2: {{podaci.brtel2}}<br>
  74.               email:{{podaci.email}}<br>
  75.               Grad: {{podaci.grad}}, {{podaci.zip}}<br>
  76.               Adresa: {{podaci.adresa}}<br>
  77.               Opis kvara: {{podaci.tekst}}<br>
  78.               </p>
  79.     <p class="card-text col-6 col-sm-6" style="border: 1px solid black; margin-bottom: 16px;">
  80.               <span class="badge badge-warning">Zahtjev je izmjenjen</span><br>
  81.               {{podaci.comment}}<br>
  82.               Vozilo: {{podaci.auto}} -  {{podaci.year}} god.<br>
  83.               Prijeđeni km: {{podaci.number}} km<br>
  84.               Radiona: {{podaci.radiona}}<br>
  85.               Termin: {{podaci.datum}} - {{podaci.vrijeme}}h<br>
  86.               <br>
  87. <button v-if="podaci.prihvacennovitermin != '0'" @click="prihvacentermin(podaci);" type="button" class="btn btn-outline-success">Prihvati</button>
  88. <button @click="odbijentermin(podaci);" type="button" class="btn btn-outline-danger">Odbij</button>
  89.               </p>
  90.   </div>
  91.   <div v-else class="row">
  92.     <p class="card-text col-6 col-sm-6">
  93.               Ime:{{podaci.ime}} <br>
  94.               Prezime:{{podaci.prezime}}<br>
  95.               tel:{{podaci.brtel}} <br>
  96.               tel2:{{podaci.brtel2}}<br>
  97.               email:{{podaci.email}}<br>
  98.               Grad: {{podaci.grad}}, {{podaci.zip}}<br>
  99.               Adresa: {{podaci.adresa}}<br>
  100.               </p>
  101.     <p class="card-text col-6 col-sm-6">
  102.               Radiona:{{podaci.radiona}}<br>
  103.               Vozilo:{{podaci.auto}}<br>
  104.               Godište: {{podaci.year}}<br>
  105.               Prijeđeni km:{{podaci.number}}<br>
  106.               Željeni termin: {{podaci.datum}} - {{podaci.vrijeme}}<br>
  107.               Opis kvara: {{podaci.tekst}}<br>
  108.               </p>
  109.   </div>
  110.   </div><!-- card -->  
  111.   <div class="card-footer text-muted">
  112.     {{ podaci.posted_at | formatTime }}
  113.     <span v-if="podaci.status=='odobreno'" class="badge badge-success">Odobreno</span>
  114.     <span v-if="podaci.status=='odbijeno'" class="badge badge-danger">Odbijeno</span>
  115.     <div v-if="podaci.comment>='1' && podaci.status!='promjenatermina'"><!-- ako je mehanicar odgovorio prikazat ce se njegov odgovor -->
  116.       <hr>
  117.     <p style="color: blue;">Odgovor Mehaničara: </p>
  118.   <p>{{podaci.comment}}</p></div>
  119.   </div>
  120.   <center style="background-color: rgba(0,0,0,.03);"><img :src="podaci.url" width="500px" ></center>
  121. </div>
  122.    
  123.     </div>
  124.     </div>
  125.     <!-- Modal -->
  126. <div class="modal fade" id="ratingmodal" tabindex="-1" role="dialog" aria-labelledby="ratingmodalLabel" aria-hidden="true">
  127.   <div class="modal-dialog" role="document">
  128.     <div class="modal-content">
  129.       <div class="modal-header">
  130.         <h5 class="modal-title" id="ratingmodalLabel">Recenzija zaprimljena !</h5>
  131.         <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  132.           <span aria-hidden="true">&times;</span>
  133.         </button>
  134.       </div>
  135.       <div class="modal-body">
  136.         Hvala na recenziji :)
  137.       </div>
  138.       <div class="modal-footer">
  139.         <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
  140.       </div>
  141.     </div>
  142.   </div>
  143. </div>
  144.     </div>
  145. </template>
  146. <script>
  147. import store from '@/store.js'
  148. import moment from 'moment'
  149. export default {
  150.     data(){
  151.         return store
  152.     },
  153.     methods:{
  154.     review(){
  155.       db.collection("recenzije2").add({
  156.         email:this.userEmail,
  157.         ime:this.ime,
  158.         star:this.star,
  159.         text:this.text,
  160.         posted_at: Date.now()
  161.     }).then(function() {
  162.             $('#ratingmodal').modal('show');
  163.           console.log("Recenzija zaprimljena!");
  164.         })
  165.         .catch(function(error) {
  166.           console.error("Desila se greska: ", error);
  167.         });
  168.   },
  169.   prihvacentermin(podaci) {
  170.     this.aktivnikorisnik = podaci.id
  171.       db.collection("noviobrazac2")
  172.         .doc(this.aktivnikorisnik)
  173.         .update({
  174.           prihvacennovitermin: '1'
  175.         })
  176.         .then(function() {
  177.           console.log("Uspjesno prihvacen termin !");
  178.         })
  179.         .catch(function(error) {
  180.           console.error("Oopsie: ", error);
  181.         });
  182.     },
  183.     odbijentermin(podaci) {
  184.     this.aktivnikorisnik = podaci.id
  185.       db.collection("noviobrazac2")
  186.         .doc(this.aktivnikorisnik)
  187.         .update({
  188.           prihvacennovitermin: '0'
  189.         })
  190.         .then(function() {
  191.           console.log("Uspjesno odbijen termin !");
  192.         })
  193.         .catch(function(error) {
  194.           console.error("Oopsie: ", error);
  195.         });
  196.     }
  197.  
  198. },
  199.  
  200.     mounted(){
  201.         firebase.auth().onAuthStateChanged(user => {
  202.       if(user){
  203.         this.stanje=user.email;
  204.       }
  205.     });
  206.     },
  207.     filters: {
  208.     formatTime: function(value) {
  209.       return moment(value).format('MMMM Do YYYY, h:mm:ss a')
  210.     }
  211.   }
  212. }
  213. </script>
  214. <style scoped>
  215.  
  216. </style>
  217.  
  218. /*firebase.auth().onAuthStateChanged(user => {
  219.       if(user){
  220.         this.myEmail=user.email;
  221.         db.collection("korisnici")
  222.           .doc(this.myEmail)
  223.           .get()
  224.           .then(doc => {
  225.             if (doc.exists) {
  226.               this.myUserType = doc.data().tipKorisnika;
  227.             } else {
  228.               console.log("Nema podataka");
  229.             }
  230.           });
  231.       }
  232.      
  233.       console.log(this.stanje)
  234.         db.collection("korisnici")
  235.           .doc(this.stanje)
  236.           .get()
  237.           .then(doc => {
  238.             if (doc.exists) {
  239.               this.myUserType = doc.data().tipKorisnika;
  240.             } else {
  241.               console.log("Nema podataka");
  242.             }
  243.       }
  244.       */
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top