Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
1.6 kB
2
Indexable
Never
globalThis.host.getTariffs(
            function(data){

                var html = '';

                for (var i in data.items) {

                    var tariff = data.items[i];

                    html += '<div class="col-md-4" style="' + (tariff.is_allowed ? '' : 'opacity: 0.6;') +'">\n' +
                        '<div class="card card-pricing">' +
                            '<div class="card-body text-center">' +
                                '<p class="card-pricing-plan-name fw-bold text-uppercase">' + tariff.name +'</p>' + '                                               ' +
                                ' <h2 class="card-pricing-price">' + tariff.cost + ' руб. ' + (tariff.is_per_hour ? ' / час' : '') +'</h2>' +
                                '<button class="btn ' + (tariff.is_allowed && tariff.is_allowed_balance ? "btn-success" : "btn-info") +' mt-4 mb-2 rounded-pill ' + (tariff.is_allowed && tariff.is_allowed_balance ? "" : "disabled") +'" data-id="' + tariff.id + '" onclick="tariffBuy(this)">Купить</button>' +
                                 (tariff.is_allowed && !tariff.is_allowed_balance ? '<div class="invalid-feedback" style="display:block;">' +
                                     'Недостаточно средств' +
                                     '</div>' : '<div>&nbsp;</div>') +
                            '</div>' +
                            '</div>' +
                        '</div>' +
                        '';
                }

                $('#tariff-list').html(html);
            }
        );