parasails.registerPage('edit-guideline', {
  //  ╦╔╗╔╦╔╦╗╦╔═╗╦    ╔═╗╔╦╗╔═╗╔╦╗╔═╗
  //  ║║║║║ ║ ║╠═╣║    ╚═╗ ║ ╠═╣ ║ ║╣
  //  ╩╝╚╝╩ ╩ ╩╩ ╩╩═╝  ╚═╝ ╩ ╩ ╩ ╩ ╚═╝
  data: {
    message: {severity: ``, summary: ``, details: ``},
  },

  //  ╦  ╦╔═╗╔═╗╔═╗╦ ╦╔═╗╦  ╔═╗
  //  ║  ║╠╣ ║╣ ║  ╚╦╝║  ║  ║╣
  //  ╩═╝╩╚  ╚═╝╚═╝ ╩ ╚═╝╩═╝╚═╝
  beforeMount: function () {
    //…
  },
  mounted: async function () {
    //…
  },

  //  ╦╔╗╔╔╦╗╔═╗╦═╗╔═╗╔═╗╔╦╗╦╔═╗╔╗╔╔═╗
  //  ║║║║ ║ ║╣ ╠╦╝╠═╣║   ║ ║║ ║║║║╚═╗
  //  ╩╝╚╝ ╩ ╚═╝╩╚═╩ ╩╚═╝ ╩ ╩╚═╝╝╚╝╚═╝
  methods: {
    save: function () {
      Cloud
        .saveGuideline
        .with(this.guideline)
        .then(() => {
          this.message.severity = `success`
          this.message.summary = `Saved successfully`
          this.message.details = ``
        })
        .catch(
          err => {
            console.log(JSON.stringify(err))
            this.message.severity = `error`
            this.message.summary = `Error on saving`
            this.message.details = err.responseInfo.headers['x-exit-description']

          }
        )
    },

    cleanMessage: function () {
      this.message = {}
      this.goto(`/guideline/search-guideline`)
    }
  }
})
