import "../modules/questions/filters/filters";
import Vue from "vue";
import {
  LEVEL_TYPE_SELECT,
  AUDIT_AUTHORITY,
  PAPER_AUDIT_STATUS,
  PAPER_TEMPLATE_TYPE,
  QUESTION_MAIN_TYPE,
  QUESTION_TYPES,
} from "@/constants/constants";

// 课程层次过滤器
Vue.filter("levelTypeFilter", function (val) {
  for (let examType of LEVEL_TYPE_SELECT) {
    if (examType.code === val) {
      return examType.name;
    }
  }
});

Vue.filter("auditAuthorityFilter", function (val) {
  for (let e of AUDIT_AUTHORITY) {
    if (e.code === val) {
      return e.name;
    }
  }
});

Vue.filter("paperAuditStatusFilter", function (val) {
  for (let e of PAPER_AUDIT_STATUS) {
    if (e.code === val) {
      return e.name;
    }
  }
});
Vue.filter("paperTempalteTypeFilter", function (val) {
  return PAPER_TEMPLATE_TYPE[val] || "";
});
Vue.filter("questionMainTypeFilter", function (val) {
  for (let examType of QUESTION_MAIN_TYPE) {
    if (examType.code === val) {
      return examType.name;
    }
  }
});
Vue.filter("questionTypeFilter", function (val) {
  for (let examType of QUESTION_TYPES) {
    if (examType.code === val) {
      return examType.name;
    }
  }
});
