text: //to handle state
  const state = {
      output_detail: [],
  }
  
  //to handle state
  const getters = {}
  
  //to handle actions
  const actions = {
  
      mLoadAddOutputDetail(context,product) {
          let validate = true;
          let detail = context.state.output_detail;
          for (let index = 0; index < detail.length; index++) {
              if (detail[index].id_product == product.id_product) {
                  detail[index].quantity = parseFloat(detail[index].quantity) + parseFloat(product.quantity);
                  validate = false;
                  break;
              }
          }
          if (validate) {
              context.commit('mAddOutputDetail',product);
          }
          
      },
  
      mLoadEditOutputDetail(context,id_product){
          let detail = context.state.output_detail;
          for (let index = 0; index < detail.length; index++) {
              if (detail[index].id_product == id_product) {
                  detail[index].quantity = detail[index].quantity.length == 0 ? 0 : parseFloat(detail[index].quantity) ;
                  break;
              }
          }
      },
  
      mLoadDeleteOutputDetail(context,id_product){
          let detail = context.state.output_detail;
  
          for (let index = 0; index < detail.length; index++) {
              if (detail[index].id_product == id_product) {
                  context.commit('mDeleteOutputDetail',index);
                  break;
              }
          }
      },
  
      mLoadResetOutputDetail(context){
          context.commit('mResertOutputDetail');
      },
  
  
  }
  
  //to handle mutations
  const mutations = {
  
      mAddOutputDetail(state, detail) {
          state.output_detail.push(detail);
      },
  
      mDeleteOutputDetail(state, index) {
          state.output_detail.splice(index,1);
      },
      mResertOutputDetail(state) {
          state.output_detail = [];
      },
  
  }
  
  
  export default {
      namespaced: true,
      state,
      getters,
      actions,
      mutations
  }