Advertisement
ricksantiago

Untitled

Feb 24th, 2019
110
0
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.         agendasOriginal: [],
  7.         classObject: {
  8.             'red': true,
  9.             'white-text': true,
  10.         },
  11.  
  12.     },
  13.     created: async function() {
  14.         const response = await fetch(urlListaHorario);
  15.         const { agendas } = await response.json();
  16.         const { agendasOriginal } = this.agendas;
  17.  
  18.  
  19.         const all = [
  20.             '06:00', '07:00', '08:00', '09:00',
  21.             '10:00', '11:00', '12:00', '13:00',
  22.             '14:00', '15:00', '16:00', '17:00',
  23.             '18:00', '19:00', '20:00', '21:00'
  24.         ];
  25.  
  26.         const allSalas = [
  27.             'Sala 01',  'Sala 02',
  28.             'Sala 03', 'Sala 04',
  29.             'Sala 05', 'Sala 06'
  30.         ];
  31.  
  32.         agendas.map(idSala => {
  33.  
  34.             idSala.horarioSala = all.filter(t => !idSala.horarioSala.includes(t)).concat(idSala.horarioSala);
  35.             idSala.horarioSala.sort();
  36.  
  37.         });
  38.  
  39.         this.agendas = agendas
  40.     }
  41.  
  42. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement