bug fixed in varience
This commit is contained in:
parent
0c49b1ed51
commit
d57d37c55a
@ -6,7 +6,6 @@ import apiClient from '@/services/api/apiClient';
|
||||
import { getBeforePreviousData, getQuarterPeriods } from '@/services/submissions/submissionService';
|
||||
import { getProductSubmissionHistory } from '@/services/submissions/submissionService';
|
||||
import { Line } from 'react-chartjs-2';
|
||||
import { putRequest } from '@/services/api/CommonService';
|
||||
|
||||
|
||||
// Helper function to get months for quarter
|
||||
@ -705,7 +704,7 @@ setAdditionalForecastMonths([
|
||||
|
||||
setActionLoading(true);
|
||||
try {
|
||||
const response = await putRequest(`/approveOrRejectSubmission/${id}`, {
|
||||
const response = await apiClient.put(`/approveOrRejectSubmission/${id}`, {
|
||||
approve_reject_status: 1,
|
||||
remarks: ''
|
||||
});
|
||||
@ -743,7 +742,7 @@ setAdditionalForecastMonths([
|
||||
|
||||
setActionLoading(true);
|
||||
try {
|
||||
const response = await putRequest(`/approveOrRejectSubmission/${id}`, {
|
||||
const response = await apiClient.put(`/approveOrRejectSubmission/${id}`, {
|
||||
approve_reject_status: 0,
|
||||
remarks: rejectReason.trim()
|
||||
});
|
||||
@ -830,18 +829,23 @@ setAdditionalForecastMonths([
|
||||
const getCellClass = (previousValue, currentValue, isFirstMonth = false) => {
|
||||
if (isFirstMonth || !varianceHighlighting) return '';
|
||||
|
||||
// 🔴 Above 100 selected → disable ALL highlighting
|
||||
if (threshold > 100) return '';
|
||||
|
||||
const variance = calculateVariance(previousValue, currentValue);
|
||||
const absVariance = Math.abs(variance);
|
||||
|
||||
// 🟡 Above 100 selected → ONLY > 100% highlight
|
||||
if (threshold > 100) {
|
||||
if (absVariance <= 100) return '';
|
||||
return variance > 0 ? 'bg-[#F0FDF4]' : 'bg-[#FEF2F2]';
|
||||
}
|
||||
|
||||
// 🟢 Normal case (≤ threshold)
|
||||
if (absVariance > threshold) return '';
|
||||
|
||||
return variance > 0 ? 'bg-[#F0FDF4]' : 'bg-[#FEF2F2]';
|
||||
};
|
||||
|
||||
|
||||
|
||||
const getBorderClass = (previousValue, currentValue, isFirstMonth = false) => {
|
||||
if (isFirstMonth || !varianceHighlighting) return '';
|
||||
|
||||
@ -1174,10 +1178,10 @@ console.log("label",additionalForecastLabel)
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
{varianceHighlighting && (
|
||||
{varianceHighlighting && (
|
||||
<div className="text-xs text-[#6B7280]">
|
||||
{threshold > 100
|
||||
? "Cells with variance > 100% are not highlighted"
|
||||
? "Cells with variance > 100% will be highlighted"
|
||||
: `Cells with variance ≤ ${threshold}% will be highlighted`}
|
||||
</div>
|
||||
)}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user