|
|
|
@ -1422,6 +1422,31 @@ exports.getbatchnumbers = async (req, reply) => {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
exports.getbatquotationsforparticularstore = async (req, reply) => {
|
|
|
|
|
try {
|
|
|
|
|
const storeId = req.params.storeId;
|
|
|
|
|
let type = req.params.type ? req.params.type.toLowerCase() : null; // Convert type to uppercase
|
|
|
|
|
|
|
|
|
|
let query = { storeId: storeId };
|
|
|
|
|
|
|
|
|
|
if (type !== "ALL") {
|
|
|
|
|
query.type = type;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Fetch data based on the query
|
|
|
|
|
const result = await Insensors.find(query);
|
|
|
|
|
|
|
|
|
|
if (!result ) {
|
|
|
|
|
return reply.send({ status_code: 404, error: "not found" });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
reply.send({ status_code: 200, data: result });
|
|
|
|
|
} catch (err) {
|
|
|
|
|
throw boom.boomify(err);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
exports.getiots = async (req, reply) => {
|
|
|
|
|
try {
|
|
|
|
|
const storeId = req.params.storeId;
|
|
|
|
@ -1475,7 +1500,7 @@ exports.createquotationforSensor = async (req, reply) => {
|
|
|
|
|
try {
|
|
|
|
|
const i_id = await generatequatationId();
|
|
|
|
|
const quatationId = `AWQU${i_id}`;
|
|
|
|
|
const { installationId } = req.params;
|
|
|
|
|
const { surveyId } = req.params;
|
|
|
|
|
const { customerId, masters, slaves, sensors, motor_switches, electricals } = req.body;
|
|
|
|
|
|
|
|
|
|
// Format electricals field
|
|
|
|
@ -1518,7 +1543,7 @@ exports.createquotationforSensor = async (req, reply) => {
|
|
|
|
|
const newQuotation = new SensorQuotation({
|
|
|
|
|
quatationId,
|
|
|
|
|
customerId,
|
|
|
|
|
installationId,
|
|
|
|
|
surveyId,
|
|
|
|
|
quote_status: "sentfrominstaller",
|
|
|
|
|
masters,
|
|
|
|
|
slaves,
|
|
|
|
|