(
SELECT hp.id
FROM prod_line.pens_product_param_pl p_i
JOIN prod_line.param_pl def_i
ON def_i.id = p_i.param_pl_id
JOIN prod_line.table_param_pl_invest_profile ip
ON ip.pens_product_param_pl_id = p_i.id
JOIN prod_line.hb_invest_profile hp
ON hp.id = ip.hb_invest_profile_id
WHERE p_i.pens_product_id = pp.id
AND def_i.brief = 'ИнвестПрофиль'
AND (
ip.validity_period_from IS NULL
OR CURRENT_DATE >= ip.validity_period_from
)
AND (
ip.validity_period_to IS NULL
OR CURRENT_DATE <= ip.validity_period_to
)
ORDER BY ip.validity_period_from DESC NULLS LAST
LIMIT 1
) AS invest_profile_id,
investProfileId: '$s.invest_profile_id',
<div
class="form-control link-container"
id="investProfileName">
</div>
if ($("#investProfileName")[0]) {
if (data.investProfileId && data.investProfileName) {
$("#investProfileName").html(
'<a class="btn btn-outline-secondary btn-sm" role="button" ' +
'href="view?viewCode=IGC2znsC&id=' +
data.investProfileId +
'">' +
data.investProfileName +
'</a>'
);
} else {
$("#investProfileName").html(data.investProfileName || '');
}
}