|
|
|
@ -1499,7 +1499,7 @@ exports.createquotationforSensor = async (req, reply) => {
|
|
|
|
|
const i_id = await generatequatationId();
|
|
|
|
|
const quatationId = `AWQU${i_id}`;
|
|
|
|
|
const { surveyId } = req.params;
|
|
|
|
|
const { customerId, masters, slaves, sensors, motor_switches, electricals,storeId } = req.body;
|
|
|
|
|
const { customerId, masters, slaves, sensors, motor_switches, electricals } = req.body;
|
|
|
|
|
|
|
|
|
|
// Format electricals field
|
|
|
|
|
const formattedElectricals = electricals.map((item) => ({
|
|
|
|
@ -1541,7 +1541,7 @@ exports.createquotationforSensor = async (req, reply) => {
|
|
|
|
|
const newQuotation = new SensorQuotation({
|
|
|
|
|
quatationId,
|
|
|
|
|
customerId,
|
|
|
|
|
storeId,
|
|
|
|
|
|
|
|
|
|
surveyId,
|
|
|
|
|
quote_status: "sentfromsurvey",
|
|
|
|
|
masters,
|
|
|
|
@ -1560,6 +1560,7 @@ exports.createquotationforSensor = async (req, reply) => {
|
|
|
|
|
message: 'Quotation for sensors created successfully.',
|
|
|
|
|
data: savedQuotation,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error('Error creating quotation:', error);
|
|
|
|
|
reply.code(500).send({
|
|
|
|
|