/var/www/qr4y.com/server/delivery/api/responseModels/order
Edit: /var/www/qr4y.com/server/delivery/api/responseModels/order/orderHeaderDrivers.model.js (2421B)
const { isSet } = require('../../utils/validator.util')
module.exports = class OrderHeaderDrivers {
constructor({
id,
number,
remoteNumber,
branchId,
companyId,
driverId,
userId,
status,
tax,
bag,
tips,
total,
branch,
company,
payType,
payTypeId,
rate,
deliveryPayType,
deliveryPayTypeId,
deliveryType,
deliveryTypeId,
pay_status_order,
pay_status_delivery,
user,
no_plastic,
orderCancelCauseId,
orderCancelCause,
orderAddress,
table,
orderItems
}) {
this.id = id || ''
this.number = number || ''
this.remoteNumber = remoteNumber || ''
this.driverId = driverId || 0
this.status = status || ORDER_STATUS.NEW
this.total = parseFloat(total).toFixed(2) || 0
this.tax = parseFloat(tax).toFixed(2) || 0
this.bag = parseFloat(bag).toFixed(2) || 0
this.tips = parseFloat(tips).toFixed(2) || 0
this.phone = isSet(user) && isSet(user.userPhones) ? '+'+user.userPhones[0].phone || '' : ''
this.rate = rate || 0
this.orderCancelCauseId = orderCancelCauseId || 0
this.orderCancelCause = orderCancelCause ? orderCancelCause.name : ''
this.payTypeId = payTypeId ? payTypeId : 0
this.payTypeName = payType ? payType.name : ''
this.deliveryPayTypeId = deliveryPayTypeId ? deliveryPayTypeId : 0
this.deliveryPayTypeName = deliveryPayType ? deliveryPayType.name : ''
this.deliveryPayTypeKey = deliveryPayType ? deliveryPayType.key : ''
this.deliveryTypeId = deliveryTypeId ? deliveryTypeId : 0
this.deliveryTypeName = deliveryType ? deliveryType.name : ''
this.deliveryTypeKey = deliveryType ? deliveryType.key : ''
this.pay_status_order = pay_status_order || ORDER_PAY_STATUS.NOT_PAID
this.pay_status_delivery = pay_status_delivery || ORDER_PAY_STATUS_DELIVERY.NOT_PAID
this.address = isSet(orderAddress) ? orderAddress.adres : ''
this.latitude = isSet(orderAddress) ? parseFloat(orderAddress.latitude) : 0
this.longtitude = isSet(orderAddress) ? parseFloat(orderAddress.longtitude) : 0
this.branchId = branchId || 0
this.branchName = isSet(branch) ? branch.name : ''
this.companyId = companyId || 0
this.companyName = isSet(company) ? company.name : ''
this.companyCurrency = isSet(company) ? company.currency : ''
this.no_plastic = no_plastic || false
this.userId = userId || 0
this.userName = isSet(user) ? user.name : ''
this.table = table || {}
this.orderItems = orderItems || {}
}
}