import i18n from "../lang"; import moment from "moment"; // this file contains all the list that can be use across all the modules export const env = () => { return "DEV"; }; export const errorUsername = "nsc_cms"; export const http = "https://"; export const ecomURL = () => { return `https://nsc-devqa.flex-solver.app/${env().toLowerCase()}/ecom/product`; }; export const dateRangeOptions = (todayOnly = false) => { const today = { text: i18n.t("general.today"), onClick(picker: any) { const start = moment().format("YYYY-MM-DD"); const end = moment().format("YYYY-MM-DD"); picker.$emit("pick", [start, end]); }, }; if (todayOnly) { return [today]; } return { shortcuts: [ today, { text: i18n.t("general.yesterday"), onClick(picker: any) { const start = moment().subtract(1, "days").format("YYYY-MM-DD"); const end = moment().subtract(1, "days").format("YYYY-MM-DD"); picker.$emit("pick", [start, end]); }, }, { text: i18n.t("general.lastWeek"), onClick(picker: any) { const start = moment() .subtract(1, "weeks") .startOf("isoWeek") .format("YYYY-MM-DD"); const end = moment() .subtract(1, "weeks") .endOf("isoWeek") .format("YYYY-MM-DD"); picker.$emit("pick", [start, end]); }, }, { text: i18n.t("general.thisWeek"), onClick(picker: any) { const start = moment().startOf("week").format("YYYY-MM-DD"); const end = moment().format("YYYY-MM-DD"); picker.$emit("pick", [start, end]); }, }, { text: i18n.t("general.lastMonth"), onClick(picker: any) { const start = moment() .startOf("month") .subtract(1, "months") .format("YYYY-MM-DD"); const end = moment() .endOf("month") .subtract(1, "months") .format("YYYY-MM-DD"); picker.$emit("pick", [start, end]); }, }, { text: i18n.t("general.thisMonth"), onClick(picker: any) { const start = moment().startOf("month").format("YYYY-MM-DD"); const end = moment().format("YYYY-MM-DD"); picker.$emit("pick", [start, end]); }, }, { text: i18n.t("general.last3Months"), onClick(picker: any) { const start = moment() .startOf("month") .subtract(3, "months") .format("YYYY-MM-DD"); const end = moment() .endOf("month") .subtract(1, "months") .format("YYYY-MM-DD"); picker.$emit("pick", [start, end]); }, }, { text: i18n.t("general.lastYear"), onClick(picker: any) { const start = moment() .startOf("year") .subtract(1, "year") .format("YYYY-MM-DD"); const end = moment() .endOf("year") .subtract(1, "year") .format("YYYY-MM-DD"); picker.$emit("pick", [start, end]); }, }, { text: i18n.t("general.thisYear"), onClick(picker: any) { const start = moment().startOf("year").format("YYYY-MM-DD"); const end = moment().format("YYYY-MM-DD"); picker.$emit("pick", [start, end]); }, }, ], }; }; export const statusList = (value: "STRING" | "NUMBER" = "STRING") => { return [ { name: i18n.t("general.active"), value: value === "STRING" ? "ACTIVE" : 1, }, { name: i18n.t("general.inactive"), value: value === "STRING" ? "INACTIVE" : 0, }, ]; }; export const userStatusList = () => { return [ { name: i18n.t("user.invited"), value: "INVITED" }, { name: i18n.t("general.active"), value: "ACTIVE" }, { name: i18n.t("general.inactive"), value: "INACTIVE" }, { name: i18n.t("general.unverified"), value: "UNVERIFIED" }, ]; }; export const productPromotionList = () => { return [ { name: i18n.t("product.newArrivals"), value: "NEW" }, { name: i18n.t("product.bestSeller"), value: "BEST_SELLER" }, { name: i18n.t("product.promotions"), value: "OFFER" }, { name: i18n.t("product.valueSets"), value: "VALUE" }, { name: i18n.t("product.none"), value: "" }, ]; }; export const MMList = () => { return [ { name: i18n.t("mixAndMatch.buyXForDolY"), value: "BUY_X_FOR_Y" }, { name: i18n.t("mixAndMatch.buyXForPctY"), value: "BUY_X_FOR_Y_PCT" }, ]; }; export const deliveryStatus = () => { return [ { name: i18n.t("order.processing"), value: "PROCESSING" }, { name: i18n.t("order.pendingCancellation"), value: "PENDING CANCELLATION", }, { name: i18n.t("order.shipped"), value: "SHIPPED" }, { name: i18n.t("order.delivered"), value: "DELIVERED" }, { name: i18n.t("order.cancelled"), value: "CANCELLED" }, ]; }; export const deliveryChangeStatus = () => { return [ { name: i18n.t("order.shipped"), value: "SHIPPED" }, { name: i18n.t("order.delivered"), value: "DELIVERED" }, ]; }; export const refundPaymentMethod = () => { return [ // { name: i18n.t('order.cheque'), value: 'CHEQUE' }, { name: i18n.t("order.manual"), value: "MANUAL" }, { name: i18n.t("order.stripe"), value: "STRIPE" }, ]; }; export const reportType = () => { return [ { name: i18n.t("report.salesSummary"), value: "salesSummary" }, { name: i18n.t("report.orderReport"), value: "orderReport" }, { name: i18n.t("report.deliveryReport"), value: "deliveryReport" }, { name: i18n.t("report.productSold"), value: "productSold" }, { name: i18n.t("report.promotionListing"), value: "promotionListing" }, { name: i18n.t("report.discountCodeUsage"), value: "discountCodeUsage" }, { name: i18n.t("report.mailingList"), value: "mailingList" }, { name: i18n.t("report.homeDeliverySummary"), value: "homeDeliverySummary", }, ]; }; export const reportStatus = () => { return [ { name: i18n.t("order.all"), value: "ALL" }, { name: i18n.t("order.processing"), value: "PROCESSING" }, { name: i18n.t("order.pendingCancellation"), value: "PENDING CANCELLATION", }, { name: i18n.t("order.shipped"), value: "SHIPPED" }, { name: i18n.t("order.delivered"), value: "DELIVERED" }, { name: i18n.t("order.cancelled"), value: "CANCELLED" }, ]; };