SHARE
TWEET

js

ricksantiago Feb 21st, 2019 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const urlListaHorario = $('#listaHorario').val() + '.json';
  2. new Vue({
  3.     el: '#app',
  4.     data: {
  5.         agendas: [],
  6.         classObject: {
  7.             'red': true,
  8.             'white-text': true,
  9.         },
  10.         disabled: true
  11.     },
  12.     created: async function() {
  13.         const response = await fetch(urlListaHorario);
  14.         const { agendas } = await response.json();
  15.  
  16.         const all = [
  17.             '06:00', '07:00', '08:00', '09:00',
  18.             '10:00', '11:00', '12:00', '13:00',
  19.             '14:00', '15:00', '16:00', '17:00',
  20.             '18:00', '19:00', '20:00', '21:00'
  21.         ]
  22.  
  23.         agendas.map(numeroSala => {
  24.  
  25.             if(numeroSala.horarioSala.length === 0){
  26.                 console.log(numeroSala.horarioSala);
  27.             }
  28.  
  29.             numeroSala.horarioSala = all.filter(t => !numeroSala.horarioSala.includes(t)).concat(numeroSala.horarioSala);
  30.             numeroSala.horarioSala.sort();
  31.  
  32.         });
  33.  
  34.         this.agendas = agendas
  35.     }
  36.  
  37. });
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