<commit_before>﻿@using Newtonsoft.Json
@using SimpleReport.Model
@model SimpleReport.ViewModel.ReportViewModel
@{
    ViewBag.Title = "View Report";
}
<script type="text/javascript">
    @{
        //NOTE: reuse model to avoid getting data again. temporary during conversion.
    }
    angular.module("report").value("reportViewModel", @Html.Raw(JsonConvert.SerializeObject(Model)));
</script>

<div ng-cloak ng-app="report" ng-controller="reportController">

    @if (!ViewData.ModelState.IsValid)
    {
        <section class="content-header">
            <h1>
                Errors in request
            </h1>
        </section>
        <section class="content">
            @Html.ValidationSummary(false)
        </section>
    }
    else
    {
        <section class="content-header">
            <h1>
                {{:: viewModel.Report.Name }}
            </h1>
        </section> 
    <section class="content">
        <p class="lead">{{:: viewModel.Report.Description}}</p>
        @using (Html.BeginForm("ExecuteReport", "Home", FormMethod.Get, new { role = "form" }))
        {
            <input type="hidden" name="reportId" value="@Model.Report.Id" class="form-control">
            <div class="box box-primary" data-ng-if="viewModel.Report.Parameters.length">
                <div class="box-header">
                    <h3 class="box-title">Parameters</h3>
                </div>
                <div class="box-body">
                    <div class="row">
                        <div data-ng-repeat="par in viewModel.Report.Parameters track by par.Key" data-ng-class="{ 'col-xs-12 col-sm-6 col-md-4 col-lg-3' : par.InputType != @((int)ParameterInputType.Period), 'col-xs-12 col-sm-12 col-md-8 col-lg-6' : par.InputType == @((int)ParameterInputType.Period)}">
                            <div class="form-group">
                                <label class="control-label" for="{{par.Key}}">{{par.Label}}</label>
                                <div>
                                    <input data-ng-if="par.InputType==@((int)ParameterInputType.Integer)" data-numeric data-ng-required="{{par.Mandatory}}" type="text" name="{{par.Key}}" data-ng-model="par.Value" placeholder="Integer" class="numeric form-control">

                                    <div data-ng-if="par.InputType==@((int)ParameterInputType.SyncedDate) || par.InputType==@((int)ParameterInputType.SyncedRunningDate)" class="input-group">
                                        <div class="input-group-addon">
                                            <i class="fa fa-calendar"></i>
                                        </div>
                                        <div>
                                            <input type="text" name="{{par.Key}}" uib-datepicker-popup="{{dateFormat}}" data-ng-change="dateChanged(par)" data-ng-model="par.DisplayValue" data-ng-required="{{par.Mandatory}}" class="form-control datepicker pull-right" is-open="par.open" ng-focus="par.open=true" data-ng-disabled="selectedAction === 'subscribe'">
                                        </div>
                                    </div>

                                    <div data-ng-if="par.InputType==@((int) ParameterInputType.Date)" class="input-group">
                                        <div class="input-group-addon">
                                            <i class="fa fa-calendar"></i>
                                        </div>
                                        <div>
                                            <input type="text" name="{{par.Key}}" uib-datepicker-popup="{{dateFormat}}" data-ng-change="dateChanged(par)" data-ng-model="par.DisplayValue" data-ng-required="{{par.Mandatory}}" class="form-control datepicker pull-right" is-open="par.open" ng-focus="par.open=true">
                                        </div>
                                    </div>

                                    <div data-ng-if="par.InputType==@((int) ParameterInputType.Period)">
                                        <input type="hidden" value="{{par.Value}}" name="{{par.Key}}" />
                                        <select data-ng-required="{{par.Mandatory}}" class="form-control" data-ng-options="c.Key as c.Value for c in par.Choices" data-ng-model="par.EnumValue" data-ng-change="periodChanged(par)">
                                            <option value="">[Please Choose...]</option>
                                        </select>
                                        <div data-ng-show="par.EnumValue === '9999'">
                                            <datepicker class="pull-left" ng-model="par.from" max-date="par.to" show-weeks="true" data-ng-change="periodChanged(par)"></datepicker>
                                            <datepicker class="pull-left" ng-model="par.to" min-date="par.from" show-weeks="true" data-ng-change="periodChanged(par)"></datepicker>
                                        </div>
                                    </div>

                                    <select data-ng-if="par.InputType==@((int) ParameterInputType.LookupMultipleChoice)" name="{{par.Key}}" class="form-control"
                                            multiselect-dropdown 
                                            data-msd-value="par.Value"
                                            data-msd-choices="par.Choices"
                                            data-msd-name="par.Key" 
                                            data-msd-required="par.Mandatory" multiple="multiple">
                                    </select>

                                    <select data-ng-if="par.InputType==@((int) ParameterInputType.Lookup)" data-ng-required="{{par.Mandatory}}" name="{{par.Key}}" class="form-control" data-ng-model="par.Value">
                                        <option value="">[Please Choose...]</option>
                                        <option data-ng-repeat="(k,v) in par.Choices" value="{{v.Key}}">{{v.Value}}</option>
                                    </select>

                                    <div data-ng-if="par.InputType==@((int) ParameterInputType.TypeAhead)">
                                        <input type="hidden" value="{{par.Value}}" name="{{par.Key}}"/>
                                        <input type="text" data-ng-model="par.selected" data-uib-typeahead="typeahead.Id as typeahead.Name for typeahead in getTypeAheadData(par.ReportId, par.TypeAheadReportId, $viewValue)" typeahead-loading="loading" typeahead-editable="true" typeahead-no-results="noResults" typeahead-min-length="3" typeahead-show-hint="true" class="form-control" 
                                               typeahead-on-select="onSelect(par,$item,$model,$label)">
                                        <i ng-show="loading" class="glyphicon glyphicon-refresh"></i>
                                        <div ng-show="noResults">
                                            <i class="glyphicon glyphicon-remove"></i> No Results Found
                                        </div>
                                        <div>Choosen: {{par.typeaheadLabel}}</div>
                                    </div>

                                    <input data-ng-if="par.InputType==@((int)ParameterInputType.String)" type="text" data-ng-required="{{par.Mandatory}}" name="{{par.Key}}" data-ng-model="par.Value" class="form-control" placeholder="String">
                                </div>
                                <span class="help-block">{{par.HelpText}}</span><commit_msg>Displayed saved parametervalue in subscriptions for typeahead-parameter.<commit_after>﻿@using Newtonsoft.Json
@using SimpleReport.Model
@model SimpleReport.ViewModel.ReportViewModel
@{
    ViewBag.Title = "View Report";
}
<script type="text/javascript">
    @{
        //NOTE: reuse model to avoid getting data again. temporary during conversion.
    }
    angular.module("report").value("reportViewModel", @Html.Raw(JsonConvert.SerializeObject(Model)));
</script>

<div ng-cloak ng-app="report" ng-controller="reportController">

    @if (!ViewData.ModelState.IsValid)
    {
        <section class="content-header">
            <h1>
                Errors in request
            </h1>
        </section>
        <section class="content">
            @Html.ValidationSummary(false)
        </section>
    }
    else
    {
        <section class="content-header">
            <h1>
                {{:: viewModel.Report.Name }}
            </h1>
        </section> 
    <section class="content">
        <p class="lead">{{:: viewModel.Report.Description}}</p>
        @using (Html.BeginForm("ExecuteReport", "Home", FormMethod.Get, new { role = "form" }))
        {
            <input type="hidden" name="reportId" value="@Model.Report.Id" class="form-control">
            <div class="box box-primary" data-ng-if="viewModel.Report.Parameters.length">
                <div class="box-header">
                    <h3 class="box-title">Parameters</h3>
                </div>
                <div class="box-body">
                    <div class="row">
                        <div data-ng-repeat="par in viewModel.Report.Parameters track by par.Key" data-ng-class="{ 'col-xs-12 col-sm-6 col-md-4 col-lg-3' : par.InputType != @((int)ParameterInputType.Period), 'col-xs-12 col-sm-12 col-md-8 col-lg-6' : par.InputType == @((int)ParameterInputType.Period)}">
                            <div class="form-group">
                                <label class="control-label" for="{{par.Key}}">{{par.Label}}</label>
                                <div>
                                    <input data-ng-if="par.InputType==@((int)ParameterInputType.Integer)" data-numeric data-ng-required="{{par.Mandatory}}" type="text" name="{{par.Key}}" data-ng-model="par.Value" placeholder="Integer" class="numeric form-control">

                                    <div data-ng-if="par.InputType==@((int)ParameterInputType.SyncedDate) || par.InputType==@((int)ParameterInputType.SyncedRunningDate)" class="input-group">
                                        <div class="input-group-addon">
                                            <i class="fa fa-calendar"></i>
                                        </div>
                                        <div>
                                            <input type="text" name="{{par.Key}}" uib-datepicker-popup="{{dateFormat}}" data-ng-change="dateChanged(par)" data-ng-model="par.DisplayValue" data-ng-required="{{par.Mandatory}}" class="form-control datepicker pull-right" is-open="par.open" ng-focus="par.open=true" data-ng-disabled="selectedAction === 'subscribe'">
                                        </div>
                                    </div>

                                    <div data-ng-if="par.InputType==@((int) ParameterInputType.Date)" class="input-group">
                                        <div class="input-group-addon">
                                            <i class="fa fa-calendar"></i>
                                        </div>
                                        <div>
                                            <input type="text" name="{{par.Key}}" uib-datepicker-popup="{{dateFormat}}" data-ng-change="dateChanged(par)" data-ng-model="par.DisplayValue" data-ng-required="{{par.Mandatory}}" class="form-control datepicker pull-right" is-open="par.open" ng-focus="par.open=true">
                                        </div>
                                    </div>

                                    <div data-ng-if="par.InputType==@((int) ParameterInputType.Period)">
                                        <input type="hidden" value="{{par.Value}}" name="{{par.Key}}" />
                                        <select data-ng-required="{{par.Mandatory}}" class="form-control" data-ng-options="c.Key as c.Value for c in par.Choices" data-ng-model="par.EnumValue" data-ng-change="periodChanged(par)">
                                            <option value="">[Please Choose...]</option>
                                        </select>
                                        <div data-ng-show="par.EnumValue === '9999'">
                                            <datepicker class="pull-left" ng-model="par.from" max-date="par.to" show-weeks="true" data-ng-change="periodChanged(par)"></datepicker>
                                            <datepicker class="pull-left" ng-model="par.to" min-date="par.from" show-weeks="true" data-ng-change="periodChanged(par)"></datepicker>
                                        </div>
                                    </div>

                                    <select data-ng-if="par.InputType==@((int) ParameterInputType.LookupMultipleChoice)" name="{{par.Key}}" class="form-control"
                                            multiselect-dropdown 
                                            data-msd-value="par.Value"
                                            data-msd-choices="par.Choices"
                                            data-msd-name="par.Key" 
                                            data-msd-required="par.Mandatory" multiple="multiple">
                                    </select>

                                    <select data-ng-if="par.InputType==@((int) ParameterInputType.Lookup)" data-ng-required="{{par.Mandatory}}" name="{{par.Key}}" class="form-control" data-ng-model="par.Value">
                                        <option value="">[Please Choose...]</option>
                                        <option data-ng-repeat="(k,v) in par.Choices" value="{{v.Key}}">{{v.Value}}</option>
                                    </select>

                                    <div data-ng-if="par.InputType==@((int) ParameterInputType.TypeAhead)">
                                        <input type="hidden" value="{{par.Value}}" name="{{par.Key}}"/>
                                        <input type="text" data-ng-model="par.Value" data-uib-typeahead="typeahead.Id as typeahead.Name for typeahead in getTypeAheadData(par.ReportId, par.TypeAheadReportId, $viewValue)" typeahead-loading="loading" typeahead-editable="true" typeahead-no-results="noResults" typeahead-min-length="3" typeahead-show-hint="true" class="form-control" 
                                               typeahead-on-select="onSelect(par,$item,$model,$label)">
                                        <i ng-show="loading" class="glyphicon glyphicon-refresh"></i>
                                        <div ng-show="noResults">
                                            <i class="glyphicon glyphicon-remove"></i> No Results Found
                                        </div>
                                        <div>Choosen: {{par.typeaheadLabel}}</div>
                                    </div>

                                    <input data-ng-if="par.InputType==@((int)ParameterInputType.String)" type="text" data-ng-required="{{par.Mandatory}}" name="{{par.Key}}" data-ng-model="par.Value" class="form-control" placeholder="String">
                                </div>
                                <span class="help-block">{{par.HelpText}}</span>
{'fraction_non_alphanumeric': 0.14892218717139852, 'fraction_numerical': 0.0028916929547844372, 'mean_word_length': 1.4579227911484414, 'pattern_counts': {'":': 0, '<': 173, '<?xml version=': 0, '>': 173, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 144, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3207467', 'n_tokens_mistral': 3829, 'n_tokens_neox': 3631, 'n_words': 583}