<commit_before>﻿@using WebMatrix.Data;
@{
    var p = LcData.UserInfo.GetRequestedUserRow();
    var pos = PageData["position"];
    
    var dataCats = LcData.GetServiceCatsAndItsAttributes(pos.PositionID, "only-special-cats", pos.UserID);
    
    // TODO: Get Customer Type Id   
    var clienttypeid = PageData["ClientTypeID"] = 1;
        
    var providerPrice = LcData.GetProviderPrice(p.UserID, pos.PositionID, clienttypeid);
    
    var minimumBookingTime = 0M;
    using (var db = Database.Open("sqlloco")){       
        minimumBookingTime = db.QueryValue(@"
            SELECT  MinTime
            FROM    CalendarProviderAttributes
            WHERE   UserID = @0
        ", p.UserID) ?? 0;
    }
}
@helper printAttList(dynamic cat){
    <ul class="attributes-list">
        @foreach (var att in cat["ServiceAttributes"]) {
            if (att["UserChecked"]) {
            <li title="@att["ServiceAttribute"]" data-description="@att["ServiceAttributeDescription"]">@att["ServiceAttribute"]</li>
            }
        }
    </ul>
}
@helper printAttListLangs(dynamic cat, dynamic levelsCat){
    var selected = levelsCat["UserSelectedLevels"];
    var levelsIndex = levelsCat["LevelsIndex"];
    <ul class="attributes-list">
        @foreach (var att in cat["ServiceAttributes"]) {
            if (att["UserChecked"]) {
                string levelStr = null;
                if (selected.ContainsKey(att["ServiceAttributeID"])) {
                    var levelId = selected[att["ServiceAttributeID"]];
                    levelStr = levelsCat["ServiceAttributes"][levelsIndex[levelId]]["ServiceAttribute"];
                }
                <li title="@att["ServiceAttribute"]" data-description="@att["ServiceAttributeDescription"]">@att["ServiceAttribute"] @(levelStr == null ? "" : "(" + levelStr + ")")</li>
            }
        }
    </ul>
}
@helper printCatTitle(dynamic cat){
    <h5 title="@cat["ServiceAttributeCategoryName"]" data-description="@cat["ServiceAttributeCategoryDescription"]">
        @cat["ServiceAttributeCategoryName"]
    </h5>
}
            <div class="position-summary">
                <div class="actions book">
                    <a class="button book" href="@Href(UrlUtil.LangPath + "Booking/?providerid=" + p.UserID + "&positionid=" + pos.PositionID)">Book now</a>
                </div>
                <span class="hour-price">
                        @if (providerPrice.IsHourly)
                        {
                            <span class="price">@String.Format("{0:C}", providerPrice.Price)</span> <text>/h</text>
                        }
                        else
                        {
                            <span class="price-since">from:</span> <span class="price">@String.Format("{0:C}", providerPrice.Price)</span>
                        }
                </span>
                <a class="calculate-price" href="@Href(UrlUtil.LangPath + "Booking/?providerid=" + p.UserID + "&positionid=" + pos.PositionID)">Calculate for your needs</a>
                
                <div class="provider-features-lists">
                    @if (minimumBookingTime > 0)
                    {
                        <div class="min-booing-time">
                            <h5>Minimum booking time:</h5>
                            <!--<a class="button view-more" href="#">More</a>-->
                            <ul class="attributes-list"><li>
                                @(minimumBookingTime) @(minimumBookingTime == 1 ? "hour" : "hours")
                                </li></ul>
                        </div>
                    }
                    
                    @* Experience Level special treatment: just like in Dashboard/Services, is on the top, because "doesn't understand DisplayRank" *@
                    @if (dataCats.ContainsKey(LcData.ServiceAttCatIDExperienceLevel) && dataCats[LcData.ServiceAttCatIDExperienceLevel]["ServiceAttributes"].Count > 0)
                    {
                        var cat = dataCats[LcData.ServiceAttCatIDExperienceLevel];
                        <div class="experience-level">
                            @printCatTitle(cat)
                            <!--<a class="button view-more" href="#">More</a>-->
                            @printAttList(cat)
                        </div>
                    }
                    
                    @foreach (var cat in dataCats)
                    {
                        // Select:
                        // - Special cats or cats selected for sidebar
                        // - Cats with content (checked by user attributes)
                        // - Real cats, with ID greater than zero (zero is not valid, negative is for virtual cats, as LanguageLevels)
                        if ((LcData.SpecialServicesAttCats.Contains(cat.Key) || cat.Value["SideBarCategory"] == true) &&
                            cat.Value["ServiceAttributes"].Count > 0 &&
                            cat.Key > 0)
                        {
                            <div>
                                @printCatTitle(cat.Value)
                                <!--<a class="button view-more" href="#">More</a>-->
                                @switch ((int)cat.Key)
                                {
                                    case LcData.ServiceAttCatIDLanguages:
                                        @printAttListLangs(cat.Value, dataCats[LcData.ServiceAttCatIDLanguageLevel])
                                        break;
                                    case LcData.ServiceAttCatIDExperienceLevel:
                                        // Do nothing, experience level was printed first already, not duplicate!
                                        break;
                                    default:
                                        @printAttList(cat.Value)
                                        break;
                                }
                            </div>
                        }
                    }

                    @*if (dataCats.ContainsKey(LcData.ServiceAttCatIDExperienceLevel) && dataCats[LcData.ServiceAttCatIDExperienceLevel]["ServiceAttributes"].Count > 0)
                    {<commit_msg>Fixed a duplication of 'Experience Level' title on Profile #113<commit_after>﻿@using WebMatrix.Data;
@{
    var p = LcData.UserInfo.GetRequestedUserRow();
    var pos = PageData["position"];
    
    var dataCats = LcData.GetServiceCatsAndItsAttributes(pos.PositionID, "only-special-cats", pos.UserID);
    
    // TODO: Get Customer Type Id   
    var clienttypeid = PageData["ClientTypeID"] = 1;
        
    var providerPrice = LcData.GetProviderPrice(p.UserID, pos.PositionID, clienttypeid);
    
    var minimumBookingTime = 0M;
    using (var db = Database.Open("sqlloco")){       
        minimumBookingTime = db.QueryValue(@"
            SELECT  MinTime
            FROM    CalendarProviderAttributes
            WHERE   UserID = @0
        ", p.UserID) ?? 0;
    }
}
@helper printAttList(dynamic cat){
    <ul class="attributes-list">
        @foreach (var att in cat["ServiceAttributes"]) {
            if (att["UserChecked"]) {
            <li title="@att["ServiceAttribute"]" data-description="@att["ServiceAttributeDescription"]">@att["ServiceAttribute"]</li>
            }
        }
    </ul>
}
@helper printAttListLangs(dynamic cat, dynamic levelsCat){
    var selected = levelsCat["UserSelectedLevels"];
    var levelsIndex = levelsCat["LevelsIndex"];
    <ul class="attributes-list">
        @foreach (var att in cat["ServiceAttributes"]) {
            if (att["UserChecked"]) {
                string levelStr = null;
                if (selected.ContainsKey(att["ServiceAttributeID"])) {
                    var levelId = selected[att["ServiceAttributeID"]];
                    levelStr = levelsCat["ServiceAttributes"][levelsIndex[levelId]]["ServiceAttribute"];
                }
                <li title="@att["ServiceAttribute"]" data-description="@att["ServiceAttributeDescription"]">@att["ServiceAttribute"] @(levelStr == null ? "" : "(" + levelStr + ")")</li>
            }
        }
    </ul>
}
@helper printCatTitle(dynamic cat){
    <h5 title="@cat["ServiceAttributeCategoryName"]" data-description="@cat["ServiceAttributeCategoryDescription"]">
        @cat["ServiceAttributeCategoryName"]
    </h5>
}
            <div class="position-summary">
                <div class="actions book">
                    <a class="button book" href="@Href(UrlUtil.LangPath + "Booking/?providerid=" + p.UserID + "&positionid=" + pos.PositionID)">Book now</a>
                </div>
                <span class="hour-price">
                        @if (providerPrice.IsHourly)
                        {
                            <span class="price">@String.Format("{0:C}", providerPrice.Price)</span> <text>/h</text>
                        }
                        else
                        {
                            <span class="price-since">from:</span> <span class="price">@String.Format("{0:C}", providerPrice.Price)</span>
                        }
                </span>
                <a class="calculate-price" href="@Href(UrlUtil.LangPath + "Booking/?providerid=" + p.UserID + "&positionid=" + pos.PositionID)">Calculate for your needs</a>
                
                <div class="provider-features-lists">
                    @if (minimumBookingTime > 0)
                    {
                        <div class="min-booing-time">
                            <h5>Minimum booking time:</h5>
                            <!--<a class="button view-more" href="#">More</a>-->
                            <ul class="attributes-list"><li>
                                @(minimumBookingTime) @(minimumBookingTime == 1 ? "hour" : "hours")
                                </li></ul>
                        </div>
                    }
                    
                    @* Experience Level special treatment: just like in Dashboard/Services, is on the top, because "doesn't understand DisplayRank" *@
                    @if (dataCats.ContainsKey(LcData.ServiceAttCatIDExperienceLevel) && dataCats[LcData.ServiceAttCatIDExperienceLevel]["ServiceAttributes"].Count > 0)
                    {
                        var cat = dataCats[LcData.ServiceAttCatIDExperienceLevel];
                        <div class="experience-level">
                            @printCatTitle(cat)
                            <!--<a class="button view-more" href="#">More</a>-->
                            @printAttList(cat)
                        </div>
                    }
                    
                    @foreach (var cat in dataCats)
                    {
                        // Select:
                        // - Special cats or cats selected for sidebar
                        // - Cats with content (checked by user attributes)
                        // - Real cats, with ID greater than zero (zero is not valid, negative is for virtual cats, as LanguageLevels)
                        // - On Experience Level category, do nothing, experience level was printed previous this iteration already, not duplicate!
                        if ((LcData.SpecialServicesAttCats.Contains(cat.Key) || cat.Value["SideBarCategory"] == true) &&
                            cat.Value["ServiceAttributes"].Count > 0 &&
                            cat.Key > 0 &&
                            cat.Key != LcData.ServiceAttCatIDExperienceLevel)
                        {
                            <div>
                                @printCatTitle(cat.Value)
                                <!--<a class="button view-more" href="#">More</a>-->
                                @switch ((int)cat.Key)
                                {
                                    case LcData.ServiceAttCatIDLanguages:
                                        @printAttListLangs(cat.Value, dataCats[LcData.ServiceAttCatIDLanguageLevel])
                                        break;
                                    default:
                                        @printAttList(cat.Value)
                                        break;
                                }
                            </div>
                        }
                    }

                    @*if (dataCats.ContainsKey(LcData.ServiceAttCatIDExperienceLevel) && dataCats[LcData.ServiceAttCatIDExperienceLevel]["ServiceAttributes"].Count > 0)
                    {
{'fraction_non_alphanumeric': 0.1167906567474602, 'fraction_numerical': 0.0027997760179185667, 'mean_word_length': 1.4042307692307692, 'pattern_counts': {'":': 0, '<': 101, '<?xml version=': 0, '>': 111, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 19, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4653210', 'n_tokens_mistral': 3148, 'n_tokens_neox': 2948, 'n_words': 578}