@@ -36,7 +36,8 @@ const ConfirmationModal: React.FC<ConfirmationModalProps> = ({
3636 if ( ! isOpen ) return null ;
3737
3838 const totalQuantity = items . reduce ( ( sum , item ) => sum + item . quantity , 0 ) ;
39- const totalAmount = items . reduce ( ( sum , item ) => sum + item . amount , 0 ) ;
39+ const totalCost = items . reduce ( ( sum , item ) => sum + item . amount , 0 ) ;
40+ const totalMrpValue = items . reduce ( ( sum , item ) => sum + ( item . mrp * item . quantity ) , 0 ) ;
4041
4142 // Group items by brand
4243 const itemsByBrand = items . reduce ( ( acc , item ) => {
@@ -91,7 +92,7 @@ const ConfirmationModal: React.FC<ConfirmationModalProps> = ({
9192
9293 { /* Summary Stats */ }
9394 < div className = "p-6 bg-gradient-to-r from-slate-50/50 to-slate-100/30 border-b border-slate-100 shrink-0" >
94- < div className = "grid grid-cols-3 gap-4" >
95+ < div className = "grid grid-cols-4 gap-4" >
9596 < div className = "bg-white rounded-xl p-4 shadow-sm border border-slate-100" >
9697 < div className = "text-xs font-bold text-slate-500 uppercase tracking-wider mb-1" > Total Items</ div >
9798 < div className = "text-2xl font-black text-slate-800" > { items . length } </ div >
@@ -101,36 +102,43 @@ const ConfirmationModal: React.FC<ConfirmationModalProps> = ({
101102 < div className = "text-2xl font-black text-slate-800" > { totalQuantity } </ div >
102103 </ div >
103104 < div className = "bg-white rounded-xl p-4 shadow-sm border border-slate-100" >
104- < div className = "text-xs font-bold text-slate-500 uppercase tracking-wider mb-1" > Total Amount</ div >
105- < div className = "text-2xl font-black text-slate-800" > ₹{ totalAmount . toFixed ( 2 ) } </ div >
105+ < div className = "text-xs font-bold text-slate-500 uppercase tracking-wider mb-1" > Total MRP Value</ div >
106+ < div className = "text-2xl font-black text-slate-800" > ₹{ totalMrpValue . toFixed ( 2 ) } </ div >
107+ </ div >
108+ < div className = "bg-white rounded-xl p-4 shadow-sm border border-slate-100" >
109+ < div className = "text-xs font-bold text-slate-500 uppercase tracking-wider mb-1" > Total Cost</ div >
110+ < div className = "text-2xl font-black text-slate-800" > ₹{ totalCost . toFixed ( 2 ) } </ div >
106111 </ div >
107112 </ div >
108113 </ div >
109114
110115 { /* Items List - Scrollable */ }
111116 < div className = "flex-1 overflow-y-auto p-6 space-y-6" >
112117 { ( Object . entries ( itemsByBrand ) as [ string , ConfirmationItem [ ] ] [ ] ) . map ( ( [ brand , brandItems ] ) => {
113- const brandTotal = brandItems . reduce ( ( sum , item ) => sum + item . amount , 0 ) ;
118+ const brandTotalCost = brandItems . reduce ( ( sum , item ) => sum + item . amount , 0 ) ;
119+ const brandTotalMrp = brandItems . reduce ( ( sum , item ) => sum + ( item . mrp * item . quantity ) , 0 ) ;
114120 return (
115121 < div key = { brand } className = "glass-panel rounded-[20px] overflow-hidden" >
116122 < div className = "bg-slate-900/5 px-6 py-4 flex items-center justify-between border-b border-white/10" >
117123 < div className = "flex items-center gap-3" >
118124 < Package size = { 16 } className = "text-slate-500" />
119125 < span className = "text-slate-800 font-bold tracking-wide" > { brand } </ span >
120126 </ div >
121- < div className = "text-sm font-bold text-slate-600" >
122- ₹{ brandTotal . toFixed ( 2 ) }
127+ < div className = "flex items-center gap-6 text-sm font-bold text-slate-600" >
128+ < span className = "text-xs text-slate-500" > Total MRP: < span className = "text-slate-700" > ₹{ brandTotalMrp . toFixed ( 2 ) } </ span > </ span >
129+ < span className = "text-xs text-slate-500" > Total Cost: < span className = "text-slate-700" > ₹{ brandTotalCost . toFixed ( 2 ) } </ span > </ span >
123130 </ div >
124131 </ div >
125132 < div className = "overflow-x-auto" >
126133 < table className = "w-full text-left border-collapse" >
127134 < thead >
128135 < tr className = "border-b border-slate-100 text-[10px] uppercase font-bold text-slate-400 tracking-wider" >
129136 < th className = "px-6 py-3 w-12" > #</ th >
130- < th className = "px-6 py-3 min-w-[200px]" > Item Name</ th >
131- < th className = "px-6 py-3 w-32 text-center" > MRP (₹)</ th >
132- < th className = "px-6 py-3 w-32 text-center" > Quantity</ th >
133- < th className = "px-6 py-3 w-40 text-right" > Amount (₹)</ th >
137+ < th className = "px-6 py-3 min-w-[180px]" > Item Name</ th >
138+ < th className = "px-6 py-3 w-28 text-center" > MRP (₹)</ th >
139+ < th className = "px-6 py-3 w-28 text-center" > Quantity</ th >
140+ < th className = "px-6 py-3 w-32 text-right" > Total MRP (₹)</ th >
141+ < th className = "px-6 py-3 w-32 text-right" > Total Cost (₹)</ th >
134142 </ tr >
135143 </ thead >
136144 < tbody className = "divide-y divide-slate-50/50" >
@@ -146,6 +154,9 @@ const ConfirmationModal: React.FC<ConfirmationModalProps> = ({
146154 { item . quantity } units
147155 </ span >
148156 </ td >
157+ < td className = "px-6 py-3 text-sm text-right font-mono text-emerald-700" >
158+ ₹{ ( item . mrp * item . quantity ) . toFixed ( 2 ) }
159+ </ td >
149160 < td className = "px-6 py-3 text-sm text-right font-bold text-slate-800" >
150161 ₹{ item . amount . toFixed ( 2 ) }
151162 </ td >
@@ -191,4 +202,4 @@ const ConfirmationModal: React.FC<ConfirmationModalProps> = ({
191202 ) ;
192203} ;
193204
194- export default ConfirmationModal ;
205+ export default ConfirmationModal ;
0 commit comments