FIX: promotions id
This commit is contained in:
@ -533,13 +533,35 @@
|
||||
'<th>Precio</th>',
|
||||
'</thead>'
|
||||
]
|
||||
const rowAlters = [
|
||||
'',
|
||||
" align='right'",
|
||||
" align='right'",
|
||||
" align='right'"
|
||||
]
|
||||
reservation.units.forEach(unit => {
|
||||
let type = unit.unit.proyecto_tipo_unidad.tipo_unidad.descripcion
|
||||
type = type.charAt(0).toUpperCase() + type.slice(1)
|
||||
const base = unit.base ?? (unit.value ?? 0);
|
||||
const price = unit.unit.current_precio?.valor ?? 0
|
||||
const diff = (base - price) / price * 100
|
||||
table.push(`<tr><td>${type} ${unit.unit.descripcion}:</td><td align='right'> ${formatter.format(base)} UF</td><td align='right'>${formatter.format(price)} UF</td><td align='right'>(${formatter.format(diff)} %)</td></tr>`)
|
||||
const rowsData = [
|
||||
[
|
||||
`${type} ${unit.unit.descripcion}`,
|
||||
`${formatter.format(base)} UF`,
|
||||
`${formatter.format(price)} UF`,
|
||||
`(${formatter.format(diff)} %)`
|
||||
]
|
||||
]
|
||||
const rowContent = []
|
||||
rowsData.forEach(row => {
|
||||
const content = []
|
||||
row.forEach((cell, idx) => {
|
||||
content.push(`<td${rowAlters[idx]}>${cell}</td>`)
|
||||
})
|
||||
rowContent.push(`<tr>${content.join('')}</tr>`)
|
||||
})
|
||||
table.push(rowContent.join(''))
|
||||
})
|
||||
if (reservation.broker !== null) {
|
||||
table.push('<tr><td>-----</td></tr>')
|
||||
|
||||
@ -222,7 +222,7 @@
|
||||
draw = {
|
||||
promotion: idx => {
|
||||
const promotions = this.data.promotions.map(promotion => {
|
||||
return `<div class="item" data-value="${promotion.id}">${promotion.name}</div>`
|
||||
return `<div class="item" data-value="${promotion.value}">${promotion.name}</div>`
|
||||
})
|
||||
return [
|
||||
`<div class="fields promotion" data-id="${idx}">`,
|
||||
|
||||
Reference in New Issue
Block a user