@using Shared.DTOs
@inject HttpClient _hc
<div class="tp-rank__area pb-200">
    <div class="container">
        <div class="row">
            <div class="col-xl-5 col-lg-5 order-1 order-lg-1">
                <div class="tp-rank__section-box pb-25 wow tpfadeUp" data-wow-duration=".9s" data-wow-delay=".3s" style="visibility: visible; animation-duration: 0.9s; animation-delay: 0.3s; animation-name: tpfadeUp;">
                    <h4 class="tp-section-subtitle">پایه قیمت</h4>
                    <h3 class="tp-section-title">
                        سیاست
                        <br />قیمت گذاری
                        <br />خدمات
                    </h3>
                </div>

            </div>
            <div class="col-xl-7 col-lg-7 order-0 order-lg-2">
                <div class="tp-rank__wrapper p-relative">
                    <div class="tp-rank__circle-shape-1 d-none d-sm-block wow tpfadeUp" data-wow-duration=".9s" data-wow-delay=".3s" style="visibility: visible; animation-duration: 0.9s; animation-delay: 0.3s; animation-name: tpfadeUp;">
                        <img src="img/rank/sky-circle.png" alt="">
                    </div>
                    <div class="tp-rank__circle-shape-2 d-none d-sm-block wow tpfadeLeft" data-wow-duration=".9s" data-wow-delay=".5s" style="visibility: visible; animation-duration: 0.9s; animation-delay: 0.5s; animation-name: tpfadeLeft;">
                        <img src="img/rank/yellow-circle.png" alt="">
                    </div>
                    <div class="tp-rank__circle-shape-3 d-none d-sm-block wow tpfadeRight" data-wow-duration=".9s" data-wow-delay=".4s" style="visibility: visible; animation-duration: 0.9s; animation-delay: 0.4s; animation-name: tpfadeRight;">
                        <img src="img/rank/black-circle.png" alt="">
                    </div>
                    <div class="tp-rank__circle-shape-4 d-none d-sm-block wow tpfadeIn" data-wow-duration=".9s" data-wow-delay=".7s" style="visibility: visible; animation-duration: 0.9s; animation-delay: 0.7s; animation-name: tpfadeIn;">
                        <img src="img/rank/black-sm-circle.png" alt="">
                    </div>
                    <div class="tp-rank__circle-shape-5 d-none d-sm-block wow tpfadeUp" data-wow-duration=".9s" data-wow-delay=".9s" style="visibility: visible; animation-duration: 0.9s; animation-delay: 0.9s; animation-name: tpfadeUp;">
                        <img src="img/rank/black-sm-circle.png" alt="">
                    </div>
                    <div class="tp-rank__circle-shape-6 d-none d-sm-block wow tpfadeUp" data-wow-duration=".9s" data-wow-delay=".2s" style="visibility: visible; animation-duration: 0.9s; animation-delay: 0.2s; animation-name: tpfadeUp;">
                        <img src="img/rank/black-sm-circle.png" alt="">
                    </div>
                    <div class="tp-rank__circle-shape-7 d-none d-sm-block wow tpfadeIn" data-wow-duration=".9s" data-wow-delay="1s" style="visibility: visible; animation-duration: 0.9s; animation-delay: 1s; animation-name: tpfadeIn;">
                        <img src="img/rank/black-sm-circle.png" alt="">
                    </div>
                    <div class="tp-rank__bg-shape">
                        <img class="wow tpfadeRight" data-wow-duration=".9s" data-wow-delay="1.2s" src="img/rank/rank-bg-shape.png" alt="" style="visibility: visible; animation-duration: 0.9s; animation-delay: 1.2s; animation-name: tpfadeRight;">
                    </div>
                    <div class="tp-rank__rank-card wow tpfadeRight" data-wow-duration=".9s" data-wow-delay=".7s" style="visibility: visible; animation-duration: 0.9s; animation-delay: 0.7s; animation-name: tpfadeRight;">
                        <div class="tp-rank__item p-relative z-index">
                            <div class="tp-rank__company">
                                <span><img src="img/rank/invoice.png" alt=""></span>
                            </div>
                            <div class="tp-rank__company-info">
                                <a>صدور انواع فاکتور</a><br />
                                <span>@GetTypeService(3)</span> <span>@GetPriceService(3).ToString("N0") ريال</span>
                            </div>
                        </div>
                        <div class="tp-rank__item p-relative">
                            <div class="tp-rank__company">
                                <span><img src="img/rank/Customer.png" alt=""></span>
                            </div>
                            <div class="tp-rank__company-info">
                                <a>مشتری جدید</a><br />
                                <span>@GetTypeService(5)</span> <span>@GetPriceService(5).ToString("N0") ريال</span>
                            </div>

                        </div>
                        <div class="tp-rank__item p-relative z-index">
                            <div class="tp-rank__company">
                                <span><img src="img/rank/item.png" alt=""></span>
                            </div>
                            <div class="tp-rank__company-info">
                                <a>کالای جدید</a><br />
                                <span>@GetTypeService(4)</span> <span>@GetPriceService(4).ToString("N0") ريال</span>
                            </div>
                        </div>
                        <div class="tp-rank__item p-relative">
                            <div class="tp-rank__company">
                                <span><img src="img/rank/Tax.png" alt=""></span>
                            </div>
                            <div class="tp-rank__company-info">
                                <a>سامانه مودیان</a><br />
                                <span>@GetTypeService(16)</span> <span>@GetPriceService(16).ToString("N0") ريال</span>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
@functions{
    private string GetTypeService(int permissionID){
        var type = Models.Where(w => w.PermissionID == permissionID).Select(s => s.CalculationType).FirstOrDefault() ;
        if (type==null)
            type = "";

        return type;
    }
    private decimal GetPriceService(int permissionID)
    => Models.Where(w => w.PermissionID == permissionID).Select(s => s.Price).FirstOrDefault();   
}
@code {
    List<BasePriceDto> Models = new List<BasePriceDto>();
    protected override async Task OnParametersSetAsync()
    {
        Models = await _hc.GetFromJsonAsync<List<BasePriceDto>>("Base/Pricing");
        await base.OnParametersSetAsync();
    }

 
}

