<template>
  <footer class="basefooter">
    <source-footer :lang="toggleLang" :source="source" :summary="summary" :summaryContent="summaryContent" :faq="faq"></source-footer>
  </footer>
</template>

<script>
import Vue from "vue";
import VueI18n from "vue-i18n";
import SourceFooter from "./SourceFooter.vue";

Vue.use(VueI18n);
// Create VueI18n instance with options
export const i18n = new VueI18n({
  locale: 'en',
})
	
export default {
  i18n: {
    locale: "en",
    messages: {
      en: {
        source: {
          sgc_source: 'Source:&nbsp;<a href="http://www23.statcan.gc.ca/imdb/p3VD.pl?Function=getVD&TVD=314300">Standard Geographical Classification (SGC) 2016, Statistics Canada</a>',
          sgc_summary_content: '',
          naics_source: 'Source:&nbsp;<a href="http://www23.statcan.gc.ca/imdb/p3VD.pl?Function=getVD&TVD=380372">North American Industry Classification System (NAICS) Canada 2017, Statistics Canada</a>',
          naics_summary_content: '',
          fp_source: 'Source:&nbsp;<a href="http://open.canada.ca/data/en/dataset/f559526c-40f9-4c5d-bced-0f7a41f278b9" target="_blank">Financial Performance Data, ISED, 2015</a>',
          fp_summary_content: 'No calculations have been made. See our FAQ page for more information on the original dataset.',
          pop_source: 'Source:&nbsp;<a href="http://www12.statcan.gc.ca/census-recensement/2016/dp-pd/dt-td/Rp-eng.cfm?TABID=2&amp;LANG=E&amp;A=R&amp;APATH=3&amp;DETAIL=0&amp;DIM=0&amp;FL=A&amp;FREE=0&amp;GC=01&amp;GL=-1&amp;GID=1159582&amp;GK=1&amp;GRP=1&amp;O=D&amp;PID=109526&amp;PRID=10&amp;PTYPE=109445&amp;S=0&amp;SHOWALL=0&amp;SUB=0&amp;Temporal=2016&amp;THEME=115&amp;VID=0&amp;VNAMEE=&amp;VNAMEF=&amp;D1=0&amp;D2=0&amp;D3=0&amp;D4=0&amp;D5=0&amp;D6=0" target="_blank">Census, Statistics Canada, 2016</a>',
          pop_summary_content: '',
          wage_source: 'Source:&nbsp;<a href="https://open.canada.ca/data/en/dataset/adad580f-76b0-4502-bd05-20c125de9116" target="_blank">Wages Dataset, Employment and Social Development Canada (ESDC), 2019</a>',
          wage_summary_content: 'Some combinations of industry and location may not have data due to data limitations. No calculations have been made. See our FAQ page for more information on the original dataset.',
          tenders_source: 'Source:&nbsp;<a href="http://buyandsell.gc.ca" target="_blank">Buyandsell.gc.ca, Public Works and Government Services Canada, 2018</a>',
          tenders_summary_content: 'Have questions about Government Tenders? Let us help! Call the BuyandSell InfoLine at 1-800-811-1148. We are here to help you do business with the Government of Canada.',
          permit_source: 'Source:&nbsp;<a href="https://www.bizpal.ca/" target="_blank">BizPaL, ISED, 2018</a>',
          permit_summary_content: 'Information comes from many different federal departments and agencies, as well as external sources and other levels of government. Every effort is made to ensure the accuracy, currency and reliability of the content.'
        }
      },
      fr: {
        source: {
          sgc_source: 'Source&nbsp;:&nbsp;<a href="http://www23.statcan.gc.ca/imdb/p3VD_f.pl?Function=getVD&TVD=314300">Classification géographique type (CGT) 2016, Statistique Canada</a>',
          sgc_summary_content: '',
          naics_source: 'Source&nbsp;:&nbsp;<a href="http://www23.statcan.gc.ca/imdb/p3VD_f.pl?Function=getVD&TVD=380372">Système de classification des industries de l\'Amérique du Nord (SCIAN) Canada 2017, Statistique Canada</a>',
          naics_summary_content: '',
          fp_source: 'Source :&nbsp;<a href="https://ouvert.canada.ca/data/fr/dataset/f559526c-40f9-4c5d-bced-0f7a41f278b9" target="_blank">Données sur la performance financière, ISDE, 2015</a>',
          fp_summary_content: 'Aucune calculation n\'a été effectué. Voir notre page FAQ pour plus d\'information sur l\'ensemble de donnée original.',
          pop_source: 'Source&nbsp;:&nbsp;<a href="https://www12.statcan.gc.ca/census-recensement/2016/dp-pd/dt-td/Rp-fra.cfm?TABID=2&LANG=F&A=R&APATH=3&DETAIL=0&DIM=0&FL=A&FREE=0&GC=01&GL=-1&GID=1159582&GK=1&GRP=1&O=D&PID=109526&PRID=10&PTYPE=109445&S=0&SHOWALL=0&SUB=0&Temporal=2016&THEME=115&VID=0&VNAMEE=&VNAMEF=&D1=0&D2=0&D3=0&D4=0&D5=0&D6=0" target="_blank">Recensement, Statistique Canada, 2016</a>',
          pop_summary_content: '',
          wage_source: 'Source&nbsp;:&nbsp;<a href="https://ouvert.canada.ca/data/fr/dataset/adad580f-76b0-4502-bd05-20c125de9116" target="_blank">Jeu de données sur les salaires, Emploi et Développement social Canada (EDSC), 2019</a>',
          wage_summary_content: 'Certaines combinaisons de secteur d’activité et d’emplacement peuvent ne pas avoir de données en raison de limites des données. Aucune calculation n\'a été effectué. Voir notre page FAQ pour plus d\'information sur l\'ensemble de donnée original.',
          tenders_source: 'Source&nbsp;:&nbsp;<a href="https://achatsetventes.gc.ca/" target="_blank">Achatsetventes.gc.ca, Travaux publics et Services gouvernementaux Canada, 2018</a>',
          tenders_summary_content: 'Vous avez des questions? Laissez-nous vous aider! Appelez la LigneInfo au 1-800-811-1148. Nous sommes là pour vous aider à faire affaire avec le gouvernement du Canada.',
          permit_source: 'Source&nbsp;:&nbsp;<a href="https://www.perle-bizpal.ca/fr/" target="_blank">PerLE, ISDE, 2018</a>',
          permit_summary_content: 'L\'information provient de plusieurs ministères et agences du gouvernement fédéral, ainsi que des sources externes et autres niveaux de gouvernement. Tous les efforts sont fait pour assurer l\'exactitude, l\'actualité et la fiabilité du contenu.'
        }
      }
    }
  },
  props:{
    lang:{
      type: String,
      default: "en"
    },
    widget:{
      type: String
    }
  },
  data: function() {
    return {
      faq: "",
      //sources
      source: "",
      summary: false, //set to true to show if there is a summary entered in summaryContent
      summaryContent: ""
    }
  }, // end data
  mounted: function() {
    this.$i18n.locale = this.toggleLang;
    if(this.widget == "sgc"){
      this.source = this.$t('source.sgc_source');
      this.summaryContent = this.$t('source.sgc_summary_content');
      this.summary = false;
      this.faq = null; //no FAQ
    } else if(this.widget == "naics"){
      this.source = this.$t('source.naics_source');
      this.summaryContent = this.$t('source.naics_summary_content');
      this.summary = false;
      this.faq = "general";
    } else if(this.widget == "pop"){
      this.source = this.$t('source.pop_source');
      this.summaryContent = this.$t('source.pop_summary_content');
      this.summary = false;
      this.faq = "pop";
    } else if(this.widget == "fp"){
      this.source = this.$t('source.fp_source');
      this.summaryContent = this.$t('source.fp_summary_content');
      this.summary = true;
      this.faq = "fp";
    } else if(this.widget == "wage"){
      this.source = this.$t('source.wage_source');
      this.summaryContent = this.$t('source.wage_summary_content');
      this.summary = true;
      this.faq = "wage";
    } else if(this.widget == "permit"){
      this.source = this.$t('source.permit_source');
      this.summaryContent = this.$t('source.permit_summary_content');
      this.summary = true;
      this.faq = "general";
    } else if(this.widget == "tenders"){
      this.source = this.$t('source.tenders_source');
      this.summaryContent = this.$t('source.tenders_summary_content');
      this.summary = true;
      this.faq = "general";
    }
  }, // end mounted
  components: {
    "source-footer": SourceFooter
  }, // end component
  computed: {
    toggleLang: function() {
      return this.lang;
    }
  } // end computed
} // end export
</script>

<style>
  .basefooter .card-footer-header {
    background: rgb(250, 250, 250);
  }
  .basefooter .card-footer-header .columns {
    margin: 0;
  }
  .basefooter .card-footer-header .column {
    border:none!important;
  }
  .basefooter .card-footer-item {
    background: #f8f8f8;
    justify-content:left !important;
    padding-left: 1.5em;
    padding-right: 0.75em;
    border: none !important;
    opacity: 0.8;
  }
  .basefooter .card-footer-item span.flink {
    display: inline-block;
    margin-right: 1.6em;
  }
  .basefooter .card-footer-item a {
    text-decoration: underline;
  }
  .basefooter .card-footer-content{
    background: rgb(250, 250, 250) !important;
    padding-left: 1.5em !important;
    padding-right: 1.5em !important;
    padding-top: 0 !important;
    padding-bottom: 1.5em !important;
  }
  /* For Source Footer to display correctly */
  .basefooter .collapse {
    display: block !important;
  }
  .basefooter .footer {
    display: block !important;
  }
</style>
