|
|
@ -699,6 +699,12 @@ exports.respondToRecurringRequestedBooking = async (req, reply) => {
|
|
|
|
|
|
|
|
|
|
|
|
supplierEntry.status = action === "accept" ? "accepted" : "rejected";
|
|
|
|
supplierEntry.status = action === "accept" ? "accepted" : "rejected";
|
|
|
|
await booking.save();
|
|
|
|
await booking.save();
|
|
|
|
|
|
|
|
// 🔽 ADD THIS
|
|
|
|
|
|
|
|
const allAccepted = booking.requested_suppliers.every(s => s.status === "accepted");
|
|
|
|
|
|
|
|
if (allAccepted) {
|
|
|
|
|
|
|
|
booking.status = "processed";
|
|
|
|
|
|
|
|
await booking.save();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (action === "reject") {
|
|
|
|
if (action === "reject") {
|
|
|
|
return reply.code(200).send({
|
|
|
|
return reply.code(200).send({
|
|
|
|