<template>
  <div>
    <b-modal :id="'contract-template-obligation-contract-template-dependency-delete-modal'" size="lg" scrollable @shown="getExistDataList" @hidden="resetData">
      <template v-slot:modal-title>
        <h4 class="modal-title">Contract Template Obligation Contract Template Dependency Delete</h4>
      </template>
      <p class="text-center">Are you sure want to delete?</p>
      <template v-slot:modal-footer>
        <form  @submit.prevent="onSubmit">
          <v-btn
          :loading="loading"
          :disabled="loading"
          type="submit"
          color="primary"
          class="white--text"
          @click="loader = 'loading'"
          >
            Submit
          </v-btn>
        </form>     
      </template>
    </b-modal>
  </div>
</template>
<script type="text/javascript">

  export default {
    props: {
      this_contract_template_obligation_contract_template_dependency : Object,
    },
    data() {
        let vm = this;
        return {
          form: new Form({}),
          loader: null,
          loading: false
        }
    },
    methods: {
      getExistDataList() {
        let vm = this;
      },
      resetData() {
        let vm = this;
        vm.loader = null;
        vm.loading = false;
      },
      onSubmit() {
        let vm = this;
        const l = vm.loader
        vm[l] = !vm[l];
        let method = 'delete';
        let url = 'contract-template-obligation-contract-template-dependency/delete/' + vm.this_contract_template_obligation_contract_template_dependency .hash_id;
        General.onComplete(url, vm.form, method, true)
        .then(data => {
          vm[l] = false
          vm.loader = null;
          vm.$bvModal.hide('contract-template-obligation-contract-template-dependency-delete-modal');
          vm.$emit('refresh');
          General.toastedMessage('delete', 'Contract Template Obligation Contract Template Dependency', data.data.hash_id);
        })
        .catch(function (error) {
          vm[l] = false
          vm.loader = null;
        });
      },
    }
  }
</script>