let GeneradorEncuestasController = {
	url: null,
	token: sessionStorage['STCMBackEnd:token'],
	tutorial: null,
	dictionary: null,
	tutorialOn: false,

	resetData() {
		let self = this;

		self.tutorial = null;
		self.url = null;
		self.dictionary = null;
		self.token = sessionStorage['STCMBackEnd:token'];
		self.tutorialOn = false;
	},

	setEvents() {
		let self = this;

		self.resetData();

		// Reducción de Header
		headerSectionHeight(0);

		// Valores de configuración
		let config = JSON.parse(atob(sessionStorage.getItem('STCMBackEnd:config')));
		if(config.URLEncuestasSession != '') {
			self.url = config.URLEncuestasSession;
		} else {
			if(config.URLEncuestas == '' || config.URLEncuestas == undefined || config.URLEncuestas == null) {
				let warningTitle = pf.const.language.RSC61;
				let warningContent = pf.const.language.RSC993;
				pf.utils.showInfoDialog(warningTitle, warningContent);
				return;
			}
			self.url = config.URLEncuestas + 'index.php/admin';
		}

		self.printIframe();
	},

	createDictionary() {
		let self = this;

		self.dictionary = {
			RSC1: pf.const.language.RSC1559,
			RSC2: pf.const.language.RSC1560,
			RSC3: pf.const.language.RSC1561,
			RSC4: pf.const.language.RSC1562,
			RSC5: pf.const.language.RSC1563,
			RSC6: pf.const.language.RSC1564,
			RSC7: pf.const.language.RSC1565,
			RSC8: pf.const.language.RSC1566,
			RSC9: pf.const.language.RSC1567,
			RSC10: pf.const.language.RSC1568,
			RSC11: pf.const.language.RSC1569,
			RSC12: pf.const.language.RSC1570,
			RSC13: pf.const.language.RSC1571,
			RSC14: pf.const.language.RSC1572,
			RSC15: pf.const.language.RSC1573,
			RSC16: pf.const.language.RSC1574,
			RSC17: pf.const.language.RSC1575,
			RSC18: pf.const.language.RSC1576,
			RSC19: pf.const.language.RSC1577,
			RSC20: pf.const.language.RSC1578,
			RSC21: pf.const.language.RSC1579,
			RSC22: pf.const.language.RSC1580,
			RSC23: pf.const.language.RSC1581,
			RSC24: pf.const.language.RSC1582,
			RSC25: pf.const.language.RSC1583,
			RSC26: pf.const.language.RSC1584,
			RSC27: pf.const.language.RSC1585,
			RSC28: pf.const.language.RSC1586,
			RSC29: pf.const.language.RSC1587,
			RSC30: pf.const.language.RSC1588,
			RSC31: pf.const.language.RSC1589,
			RSC32: pf.const.language.RSC1590,
			RSC33: pf.const.language.RSC1591,
			RSC34: pf.const.language.RSC1592,
			RSC35: pf.const.language.RSC1593,
			RSC36: pf.const.language.RSC1594,
			RSC37: pf.const.language.RSC1595,
			RSC38: pf.const.language.RSC1596,
			RSC39: pf.const.language.RSC1597,
			RSC40: pf.const.language.RSC1598,
			RSC41: pf.const.language.RSC1599,
			RSC42: pf.const.language.RSC1600,
			RSC43: pf.const.language.RSC1601,
			RSC44: pf.const.language.RSC1602,
			RSC45: pf.const.language.RSC1603,
			RSC46: pf.const.language.RSC1604,
			RSC47: pf.const.language.RSC1605,
			RSC48: pf.const.language.RSC1606,
			RSC49: pf.const.language.RSC1607,
			RSC50: pf.const.language.RSC1608,
		}
	},

	printIframe() {
		let self = this;

		self.createDictionary();
		let iframe = `
			<div class="">
				<iframe id="sIframe" src="${self.url}" class="w-100 he-cal-100vh-n66 border-0" allowfullscreen></iframe>
			</div>
		`;
		$('#iframeSurveys').html(iframe);
	}
};