Manufacture Rate Table - Copy this React, Tailwind Component to your project
Const updatedRowPayload = { // quantity: originalRow?.quantity, manufactureBuyRate: updateRows?.manufactureBuyRate?.toString().toLowerCase() === "cnc" || updateRows?.manufactureBuyRate?.toString() === "0" ? 0 : Number(updateRows?.manufactureBuyRate) || originalRow?.manufactureBuyRate, manufactureSaleRate: updateRows?.manufactureSaleRate?.toString().toLowerCase() === "cnc" || updateRows?.manufactureSaleRate?.toString() === "0" ? 0 : Number(updateRows?.manufactureSaleRate) || originalRow?.manufactureSaleRate, // manufacturerCarryingCost: originalRow?.manufacturerCarryingCost, description: "", companyName: originalRow?.companyName || "Invest Value Fintech Pvt Ltd", scriptName: originalRow?.scriptName, productTypeCode: 11, productName: originalRow?.scriptName, unlistedMasterCode: originalRow?.unlistedMasterCode, companyMasterCode: originalRow?.companyMasterCode, // validTillDate: formattedValidTillDate, // adding new fields to the payload // newQuantity: Number(updateRows?.newQuantity) || originalRow?.quantity, // newManufactureBuyRate: // Number(updateRows?.newManufactureBuyRate) || // originalRow?.manufactureBuyRate, // newManufactureSaleRate: // updateRows?.newManufactureSaleRate?.toLowerCase() === "cnc" // ? 0 // : Number(updateRows?.newManufactureSaleRate) || // originalRow?.manufactureSaleRate, // newManufacturerCarryingCost: // Number(updateRows?.newManufacturerCarryingCost) || // originalRow?.manufacturerCarryingCost, // newValidTillDate: newFormattedValidTillDate, productMasterCode: originalRow?.productMasterCode, }; This is my payload in which for manufactureBuyRate and manufactureSaleRate I have defined condition so if user enters cnc or 0 then it would set the 0 but I also want if user enters 0.0 or 0.00 then how would I set the value in manufactureBuyRate and manufactureSaleRate so how to modified payload accordingly instead of giving hard code conditions with || operator?
