|
|
|
@ -186,13 +186,21 @@ exports.tankerBooking = async (req, reply) => {
|
|
|
|
|
const month = (date.getMonth() + 1).toString().padStart(2, '0')
|
|
|
|
|
const day = date.getDate().toString().padStart(2, '0')
|
|
|
|
|
const bookingId = `ARM${year}${month}${day}${b_id}`
|
|
|
|
|
// const customer = await User.findOne({customerId:customerId})
|
|
|
|
|
// const customer_mobile = customer.phone
|
|
|
|
|
// const customer_name = customer.username
|
|
|
|
|
// const supplier = await Supplier.findOne({supplierId:req.body.supplierId})
|
|
|
|
|
// console.log(supplier, "11")
|
|
|
|
|
// const supplier_name = supplier.suppliername
|
|
|
|
|
// const supplier_mobile = supplier.phone
|
|
|
|
|
// console.log(supplier_mobile, "==========")
|
|
|
|
|
|
|
|
|
|
const customer = await User.findOne({customerId:customerId})
|
|
|
|
|
const customer_mobile = customer.phoneNumber
|
|
|
|
|
const customer_name = customer.username
|
|
|
|
|
const customerPhone = customer.phone
|
|
|
|
|
const customerName = customer.username
|
|
|
|
|
const supplier = await Supplier.findOne({supplierId:req.body.supplierId})
|
|
|
|
|
console.log(supplier)
|
|
|
|
|
const supplier_name = supplier.suppliername
|
|
|
|
|
const supplier_mobile = supplier.phoneNumber
|
|
|
|
|
const supplierName = supplier.suppliername
|
|
|
|
|
const supplierPhone = supplier.phone
|
|
|
|
|
var booking_id = await Tankerbooking.findOne({ bookingid: bookingId})
|
|
|
|
|
if(booking_id){
|
|
|
|
|
b_id= await generateBookingId()
|
|
|
|
@ -215,10 +223,10 @@ exports.tankerBooking = async (req, reply) => {
|
|
|
|
|
longitude: req.body.longitude,
|
|
|
|
|
//date: req.body.date,
|
|
|
|
|
// time: req.body.time,
|
|
|
|
|
customerPhone : customer_mobile,
|
|
|
|
|
supplierPhone : supplier_mobile,
|
|
|
|
|
customerName : customer_name,
|
|
|
|
|
supplierName : supplier_name,
|
|
|
|
|
customerPhone : customerPhone,
|
|
|
|
|
supplierPhone : supplierPhone,
|
|
|
|
|
customerName : customerName,
|
|
|
|
|
supplierName : supplierName,
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
@ -241,10 +249,10 @@ exports.tankerBooking = async (req, reply) => {
|
|
|
|
|
tankersBookingData.tankLocation = usertobeInserted.tankLocation;
|
|
|
|
|
//tankersBookingData.date = usertobeInserted.date;
|
|
|
|
|
//tankersBookingData.time = usertobeInserted.time;
|
|
|
|
|
tankersBookingData.customerPhone = customer_mobile;
|
|
|
|
|
tankersBookingData.supplierPhone = supplier_mobile;
|
|
|
|
|
tankersBookingData.customerName = customer_name;
|
|
|
|
|
tankersBookingData.supplierName = supplier_name;
|
|
|
|
|
tankersBookingData.customerPhone = customerPhone;
|
|
|
|
|
tankersBookingData.supplierPhone = supplierPhone;
|
|
|
|
|
tankersBookingData.customerName = customerName;
|
|
|
|
|
tankersBookingData.supplierName = supplierName;
|
|
|
|
|
tankersBookingData.latitude =usertobeInserted.latitude
|
|
|
|
|
tankersBookingData.longitude=usertobeInserted.longitude
|
|
|
|
|
|
|
|
|
|