{"version":3,"file":"storeFinder.js","mappings":";AAAA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;;AAEA;;AAEA;AACA;;AAEA,oBAAoB,yBAAyB;AAC7C;AACA;;AAEA;AACA,GAAG;AACH;AACA;AACA;;AAEA,oBAAoB,4BAA4B;AAChD;AACA;AACA;AACA;AACA;;AAEA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA,oBAAoB,qBAAqB;AACzC;AACA;;AAEA;AACA,uBAAuB,yBAAyB;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;;AAEA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;;AAEA;AACA,uEAAuE;AACvE;;AAEA,oBAAoB,sBAAsB;AAC1C;;AAEA;;AAEA;AACA;AACA;AACA,gCAAgC,mCAAmC;AACnE;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;AACL,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,GAAG;AACH;;AAEA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;AACA","sources":["webpack://build/../vincishoes2/assets/javascripts/storeFinder.js"],"sourcesContent":["window.mapPlaces;\n\nwindow.statesInfo = {\n AC: {\n name: \"Acre\",\n metropolis: 'Rio Branco'\n },\n AL: {\n name: \"Alagoas\",\n metropolis: 'Maceió'\n },\n AM: {\n name: \"Amazonas\",\n metropolis: 'Manaus'\n },\n AP: {\n name: \"Amapá\",\n metropolis: 'Macapá'\n },\n BA: {\n name: \"Bahia\",\n metropolis: 'Salvador'\n },\n CE: {\n name: \"Ceará\",\n metropolis: 'Fortaleza'\n },\n DF: {\n name: \"Distrito Federal\",\n metropolis: 'Brasília'\n },\n ES: {\n name: \"Espírito Santo\",\n metropolis: 'Vitória'\n },\n GO: {\n name: \"Goiás\",\n metropolis: 'Goiânia'\n },\n MA: {\n name: \"Maranhão\",\n metropolis: 'São Luís'\n },\n MG: {\n name: \"Minas Gerais\",\n metropolis: 'Belo Horizonte'\n },\n MS: {\n name: \"Mato Grosso do Sul\",\n metropolis: 'Campo Grande'\n },\n MT: {\n name: \"Mato Grosso\",\n metropolis: 'Cuiabá'\n },\n PA: {\n name: \"Pará\",\n metropolis: 'Belém'\n },\n PB: {\n name: \"Paraíba\",\n metropolis: 'João Pessoa'\n },\n PE: {\n name: \"Pernambuco\",\n metropolis: 'Recife'\n },\n PI: {\n name: \"Piauí\",\n metropolis: 'Teresina'\n },\n PR: {\n name: \"Paraná\",\n metropolis: 'Curitiba'\n },\n RJ: {\n name: \"Rio de Janeiro\",\n metropolis: 'Rio de Janeiro',\n order: 0\n },\n RN: {\n name: \"Rio Grande do Norte\",\n metropolis: 'Natal'\n },\n RO: {\n name: \"Rondônia\",\n metropolis: 'Porto Velho'\n },\n RR: {\n name: \"Roraima\",\n metropolis: 'Boa Vista'\n },\n RS: {\n name: \"Rio Grande do Sul\",\n metropolis: 'Porto Alegre',\n order: 2\n },\n SC: {\n name: \"Santa Catarina\",\n metropolis: 'Florianopolis'\n },\n SE: {\n name: \"Sergipe\",\n metropolis: 'Aracaju'\n },\n SP: {\n name: \"São Paulo\",\n metropolis: 'São Paulo',\n order: 1\n },\n TO: {\n name: \"Tocantins\",\n metropolis: 'Palmas'\n }\n}\n\nwindow.week_day = {\n '0': 'Dom',\n '1': 'Seg',\n '2': 'Ter',\n '3': 'Qua',\n '4': 'Qui',\n '5': 'Sex',\n '6': 'Sáb',\n}\n\nwindow.storeFinder = {\n places: [],\n quantityPlaces: 0,\n ownStores: [],\n multimarcasStores: [],\n states: {},\n getOwnStores: function () {\n var _this = this;\n\n var ownStores = [];\n\n //console.log('oiii')\n console.log('places', _this.places)\n\n for (var i = 0; i < _this.places.length; i++) {\n ownStores.push(_this.places[i]);\n }\n\n _this.ownStores = ownStores;\n },\n getOwnStoreById: function (id) {\n var _this = this;\n var place;\n\n for (var i = 0; i < _this.ownStores.length; i++) {\n if (_this.ownStores[i].id == id) {\n place = _this.ownStores[i]\n break;\n }\n }\n\n return place;\n },\n getDiasAbertos: function (_horarios) {\n var htmlHorarios = '';\n var arrHorarios = [];\n var horarios = _horarios;\n\n // itera o array original dos horários\n for (var i = 0; i < horarios.length; i++) {\n \n var alreadyHave = false;\n\n // itera o novo array de horários\n for (var ii = 0; ii < arrHorarios.length; ii++) {\n \n // verifica se o horário de funcionamento do [i] já existe no novo array\n if (arrHorarios[ii].open == horarios[i].open\n && arrHorarios[ii].close == horarios[i].close) {\n alreadyHave = true;\n \n // caso exista, adiciona o dia para aquele horário de funcionamento\n arrHorarios[ii].week_day.push(week_day[horarios[i].week_day]);\n }\n }\n\n if (!alreadyHave) {\n // caso ainda não exista, cria o objeto do horário e já inclui o dia da semana no objeto\n arrHorarios.push({\n week_day: [],\n open: horarios[i].open,\n close: horarios[i].close,\n });\n\n // Adiciona o dia da semana atual no array do horário\n arrHorarios[arrHorarios.length -1].week_day.push(week_day[horarios[i].week_day]); \n }\n }\n\n return arrHorarios;\n },\n renderOwnStores: function () {\n var _this = this;\n var ownStores = _this.ownStores;\n var $boxListOwnStores = $('[data-list-stores]');\n\n var htmlListStores = '';\n\n var htmlDropdownStores = '' +\n '
  • Selecione uma loja
  • ' +\n '';\n\n for (var i = 0; i < ownStores.length; i++) {\n //console.log('ownStores', ownStores[i])\n\n var arrDiasAbertos = ownStores[i].opening_hours ? _this.getDiasAbertos(ownStores[i].opening_hours) : 0;\n\n // monta o html dos horários\n var htmlHorarios = '';\n if (arrDiasAbertos.length > 0) {\n for (var ihorarios = 0; ihorarios < arrDiasAbertos.length; ihorarios++) {\n // verifica se o horário é o mesmo para vários dias\n if (arrDiasAbertos[ihorarios].week_day.length > 1) {\n // monta o a linha de horário\n htmlHorarios += '

    ' + arrDiasAbertos[ihorarios].week_day[0] + ' - ' + arrDiasAbertos[ihorarios].week_day[arrDiasAbertos[ihorarios].week_day.length - 1] + ': ' + arrDiasAbertos[ihorarios].open + ' às ' + arrDiasAbertos[ihorarios].close + '

    ';\n } else {\n // se for somente domingo, vale para feriados também\n if (arrDiasAbertos[ihorarios].week_day[0] == 'Dom') {\n htmlHorarios += '

    Dom: ' + arrDiasAbertos[ihorarios].open + ' às ' + arrDiasAbertos[ihorarios].close + '

    ';\n } else {\n // somente um dia da semana que não seja domingo\n htmlHorarios +='

    ' + arrDiasAbertos[ihorarios].week_day[0] + ': ' + arrDiasAbertos[ihorarios].open + ' às ' + arrDiasAbertos[ihorarios].close + '

    ';\n } \n }\n }\n } else {\n htmlHorarios +='

    Fechado

    ';\n }\n\n htmlWhats = '';\n if (ownStores[i].second_phone != '') {\n htmlWhats += '

    ' + 'COMPRE PELO WHATSAPP ▸' + '' + ownStores[i].name + '' +\n '';\n\n htmlListStores += '' +\n '

    ' +\n '
    ' +\n '\"'' +\n '
    ' +\n '
    ' +\n '

    ' + ownStores[i].name + '

    ' +\n '

    ' + ownStores[i].address_line_2 + '

    ' +\n '

    ' + ownStores[i].address_line_1 + '

    ' +\n '

    ' + ownStores[i].first_phone + '

    ' +\n '
    ' + \n 'Horário de funcionamento' +\n htmlHorarios +\n '
    ' + \n '

    ' + ownStores[i].description + '

    ' +\n htmlWhats +\n '
    ' +\n '
    ' +\n '';\n }\n\n $boxListOwnStores.html(htmlListStores);\n $('[data-dropdown-stores]').html(htmlDropdownStores);\n },\n sortStates: function () {\n var _this = this;\n _this.places.sort(function (a, b) {\n var stateA = a.state.toLowerCase();\n var stateB = b.state.toLowerCase();\n\n if (stateA < stateB) {\n return -1;\n }\n if (stateA > stateB) {\n return 1;\n }\n\n return 0;\n });\n },\n filterByState: function (_places, _state) {\n var placesFiltered = _places.filter(function (curr, i) {\n if ( curr.state == _state) {\n return curr\n }\n });\n\n return placesFiltered;\n },\n listStoresByState: function (_state) {\n\n },\n init: function (_places) {\n var _this = this;\n _this.places = JSON.parse(JSON.stringify(_places));\n \n //console.log('init')\n\n _this.sortStates();\n _this.getOwnStores();\n\n _this.ownStores.sort(function (a, b) {\n return statesInfo[a.state].order - statesInfo[b.state].order;\n });\n\n _this.renderOwnStores();\n }\n}\n\nwindow.loadShops = function (places) {\n // console.info('places', places);\n storeFinder.init(places);\n}\n"],"names":[],"sourceRoot":""}