<template>
    <form @submit.prevent="update">
        
        <div class="form-group row">
     
          <div class="col-md-12">
            <label for="name">Department Name</label>
            <input type="hidden" class="form-control" name="id" id="id" v-model="fields.id"/>
            <input type="text" class="form-control" name="name" id="name" v-model="fields.name"/>
            <div v-if="errors && errors.name" class="text-danger">{{ errors.name[0] }}</div>
          </div>
	
         </div>
     
        <div class="form-group">
            <button type="submit" class="btn btn-success btn-round">Save</button>
            <button type="reset" class="btn btn-danger btn-round">Clear</button>
        </div>       
     
    </form>
</template>

<script>
import FormMixin from '../shared/FormMixin';

export default {
  mixins: [ FormMixin ],
   props: [
            'departmentdata',
        ],
        
  data() {
    return {
      'text': 'Department Updated succesfully',
      'redirect': '',
      action2: '/fc/departments/editDepartment',
      fields:{
        id:this.departmentdata.department_id,
        name:this.departmentdata.name
 
      }

    }
    
    
  },
  mounted() {
              this.fields.id=this.departmentdata.department_id;        
            this.fields.name=this.departmentdata.name;          
     
            console.log(this.departmentdata);
        }
}
</script>