|
|
|
|
@ -2021,7 +2021,7 @@ exports.getOrdersByCustomer = async (req, reply) => {
|
|
|
|
|
exports.acceptQuotation = async (req, reply) => {
|
|
|
|
|
try {
|
|
|
|
|
const { quotationId } = req.params;
|
|
|
|
|
let { action } = req.body;
|
|
|
|
|
let { action, storeId } = req.body;
|
|
|
|
|
|
|
|
|
|
action = action.toLowerCase(); // Convert action to lowercase
|
|
|
|
|
|
|
|
|
|
@ -2041,9 +2041,10 @@ exports.acceptQuotation = async (req, reply) => {
|
|
|
|
|
message: "Quotation rejected successfully",
|
|
|
|
|
});
|
|
|
|
|
} else if (action === "accept") {
|
|
|
|
|
// Convert quotation to an order object
|
|
|
|
|
// Convert quotation to an order object and include storeId
|
|
|
|
|
const newOrder = new Order({
|
|
|
|
|
...quotation.toObject(), // Copy all fields
|
|
|
|
|
...quotation.toObject(), // Copy all fields from quotation
|
|
|
|
|
storeId: storeId, // Ensure storeId is included
|
|
|
|
|
status: "pending", // Set status to "pending"
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|