export default {
  createContentpopup1(fields: any, data: any) {
    let htmlstring = ''
    htmlstring += '<table>'
    for (const key in fields) {
      htmlstring += '<tr>'
      htmlstring += '<td class="tdlabel">'
      htmlstring += '<span>'
      htmlstring += fields[key]
      htmlstring += ' :'
      htmlstring += '</span>'
      htmlstring += '</td>'
      htmlstring += '<td class="tdvalue">'
      htmlstring += '<span>'
      htmlstring += data[key] != null ? data[key] : ''
      htmlstring += '</span>'
      htmlstring += '</td>'
      htmlstring += '</tr>'
    }
    htmlstring += '</table>'
    return htmlstring
  },

  createContentpopup(data: any) {
    let htmlstring = ''
    htmlstring += '<table>'
    for (const key in data) {
      htmlstring += '<tr>'
      htmlstring += '<td class="tdlabel">'
      htmlstring += '<span>'
      htmlstring += key
      htmlstring += ' :'
      htmlstring += '</span>'
      htmlstring += '</td>'
      htmlstring += '<td class="tdvalue">'
      htmlstring += '<span>'
      htmlstring += data[key] != null ? data[key] : ''
      htmlstring += '</span>'
      htmlstring += '</td>'
      htmlstring += '</tr>'
    }
    htmlstring += '</table>'
    return htmlstring
  },

  createCustompopup(data: any) {
    if (data.type === 'url') {
      const iframe = document.createElement('iframe')
      iframe.classList.add('popupframe')
      iframe.src = data.url
      return iframe
    } else if (data.type === 'html') {
      const div = document.createElement('div')
      div.innerHTML = data.html
      return div
    }
  },
}
