<template>
  <div v-if="record">
    <div class="field">
      <label class="label">Tên<span class="has-text-danger"> * </span> </label>
      <p class="control">
        <input
          class="input"
          type="text"
          placeholder="Nhập số"
          v-model="record.name"
        />
      </p>
    </div>
    <div class="field mt-5">
      <label class="label">Ghi chú<span class="has-text-danger"> * </span> </label>
      <p class="control">
        <textarea
          class="textarea"
          placeholder=""
          rows="3"
          v-model="record.caption"
        ></textarea>
      </p>
    </div>
    <div class="mt-5">
      <button
        class="button is-primary"
        @click="save()"
      >
        Lưu lại
      </button>
    </div>
  </div>
</template>
<script>
export default {
  props: ["row", "pagename"],
  data() {
    return {
      record: undefined,
    };
  },
  async created() {
    this.record = await this.$getdata("file", { id: this.row.file || this.row.id }, undefined, true);
  },
  methods: {
    async save() {
      let rs = await this.$updateapi("file", this.record);
    },
  },
};
</script>
