import {getStatusTag} from "utils/statusUtils/Base"; import * as DateUtils from "utils/DateUtils"; const confirm = {color:"#22a13f", eng:"Confirmed", cht:"可以付印"} const unable = {color:"#d9372b", eng:"Re-proofing", cht:"未能付印"} const timeOut = {color:"#8a8784", eng:"No Reply", cht:"回覆逾時"} const pendingReply = {color:"#f5a83d", eng:"Pending Reply", cht:"未回覆"} const cancel = {color:"#000", textColor:"#fff", eng:"Cancelled", cht:"已取消"} export function getStatus_Cht(params) { let status = getStatus(params); return getStatusTag({color: status.color, textColor:status.textColor, text:status.cht }) } export function getStatus_Eng(params) { let status = getStatus(params); return getStatusTag({color: status.color, textColor:status.textColor, text:status.eng }) } export function getStatusText_Cht(params) { let status = getStatus(params); return {text:status.cht,status:status.eng} } export function getStatusText_Eng(params) { let status = getStatus(params); return {text:status.eng,status:status.eng} } function getStatus(params) { // console.log(params) let replyDate = params.row?params.row.replyDate:params.replyDate; let action = params.row?params.row.action:params.action; let proofPaymentDeadline = params.row?params.row.proofPaymentDeadline:params.proofPaymentDeadline; let isCancelled = params.row?params.row.cancelled:params.cancelled; if(isCancelled) return cancel; console.log(replyDate) if(replyDate){ return action?confirm:unable; }else{ return isOverTime(proofPaymentDeadline)? timeOut: pendingReply; } } const isOverTime = (proofPaymentDeadline) => { if (!proofPaymentDeadline) return true; proofPaymentDeadline = DateUtils.convertToDate(proofPaymentDeadline); let current = new Date(); return current.getTime() > proofPaymentDeadline.getTime(); }