<template>
  <div class="field">
    <div class="control">
      <textarea v-model="record.note" class="textarea" name="note" placeholder="" rows="8"></textarea>
    </div>
  </div>
  <div class="mt-4">
    <button class="button is-primary has-text-white" @click="save()">
      {{ $store.lang==='vi'? 'Lưu lại' : 'Save' }}
    </button>
  </div>
</template>
<script setup>
  const emit = defineEmits(["close"])
  const { $store, $getdata, $updateapi, $updatepage } = useNuxtApp();
  const props = defineProps({
    row: Object,
    pagename: String
  })
  var record = await $getdata('application', {id: props.row.id}, undefined, true)
  async function save()  {
    await $updateapi('application', record)
    record = await $getdata('application', {id: props.row.id}, undefined, true)
    $updatepage(props.pagename, record)
    emit('close')
  }
</script>