Esempio n. 1
0
        #pragma warning disable 1998
        public async override global::System.Threading.Tasks.Task ExecuteAsync()
        {
            BeginContext(24, 1917, true);
            WriteLiteral(@"<div>
    <ol class=""breadcrumb"">
        <li class=""breadcrumb-item"">Список заявок</li>
    </ol>
</div>
<div class=""row"">
    <div class=""p-2"" style=""width:300px"">
        <div class=""text-center"">
            <h4 >Фильтры:</h4>
        </div>
        <div class=""row"">
            <div class=""col-md-12""><h5>Статусы заявки:</h5></div>
            <div class=""col-md-12"">
                <div class=""row"">
                    <div class=""col-md-2 text-right pr-1"">
                        <input type=""checkbox"" id=""status_0"" value=""0"" checked />
                    </div>
                    <div class=""col-md-10  pl-0"">
                        Открыта
                    </div>
                </div>
                <div class=""row"">
                    <div class=""col-md-2 text-right pr-1"">
                        <input type=""checkbox"" id=""status_1"" value=""1"" checked />
                    </div>
                    <div class=""col-md-10  pl-0"">
                        Решена
      ");
            WriteLiteral(@"              </div>
                </div>
                <div class=""row"">
                    <div class=""col-md-2 text-right pr-1"">
                        <input type=""checkbox"" id=""status_2"" value=""2"" checked />
                    </div>
                    <div class=""col-md-10  pl-0"">
                        Возврат
                    </div>
                </div>
                <div class=""row"">
                    <div class=""col-md-2 text-right pr-1"">
                        <input type=""checkbox"" id=""status_3"" value=""3"" checked />
                    </div>
                    <div class=""col-md-10  pl-0"">
                        Закрыта
                    </div>
                </div>
            </div>  
            

        </div>
        <div  class=""row"">
            <div class=""col-md-12""><h5>Период времени:</h5></div>
            
");
            EndContext();
#line 54 "C:\Users\RTS_NB\source\repos\MUP_test\MUP_test\Views\Home\Index.cshtml"

            DateTime finish = DateTime.Now;
            DateTime start  = finish.AddDays(-30.0);


#line default
#line hidden
            BeginContext(2094, 152, true);
            WriteLiteral("               <div class=\"col-md-2 text-right pr-1 my-1\">С</div>\r\n               <div class=\"col-md-10 pl-0 my-1\"><input type=\"date\"  id=\"start-period\"");
            EndContext();
            BeginWriteAttribute("value", " value=\"", 2246, "\"", 2283, 1);
#line 59 "C:\Users\RTS_NB\source\repos\MUP_test\MUP_test\Views\Home\Index.cshtml"
            WriteAttributeValue("", 2254, start.ToString("yyyy-MM-dd"), 2254, 29, false);

#line default
#line hidden
            EndWriteAttribute();
            BeginContext(2284, 163, true);
            WriteLiteral("/></div>\r\n               <div class=\"col-md-2 text-right pr-1 my-1\">по</div>\r\n               <div class=\"col-md-10 pl-0 my-1\"><input type=\"date\" id=\"finish-period\"");
            EndContext();
            BeginWriteAttribute("value", " value=\"", 2447, "\"", 2485, 1);
#line 61 "C:\Users\RTS_NB\source\repos\MUP_test\MUP_test\Views\Home\Index.cshtml"
            WriteAttributeValue("", 2455, finish.ToString("yyyy-MM-dd"), 2455, 30, false);

#line default
#line hidden
            EndWriteAttribute();
            BeginContext(2486, 300, true);
            WriteLiteral(@" /></div>
               
               <div class=""col-md-12 text-center py-1"">
                   <button id=""btn_filter"" class=""btn btn-primary"">Обновить</button>
               </div>
        </div>
        
    </div>

    <div class=""w-auto"">
        <div class=""py-1"">
            ");
            EndContext();
            BeginContext(2787, 96, false);
#line 72 "C:\Users\RTS_NB\source\repos\MUP_test\MUP_test\Views\Home\Index.cshtml"
            Write(Html.ActionLink("Открыть заявку", "Create", "Request", null, new { @class = "btn btn-primary" }));

#line default
#line hidden
            EndContext();
            BeginContext(2883, 692, true);
            WriteLiteral(@"
        </div>
        <div>
            <table class=""table table-striped table-bordered"" id=""request_list"">
                <thead class=""thead-dark"">
                    <tr>
                        <th scope=""col"">№ Заявки</th>
                        <th scope=""col"">Текст заявки</th>
                        <th scope=""col"">Дата открытия</th>
                        <th scope=""col"">Текущее состояние</th>
                    </tr>
                </thead>
                <tbody id=""filter_test""></tbody>
            </table>

        </div>
    </div>

</div>

<script type=""text/javascript"">

        function getStatusName(status) {
            const sts = [");
            EndContext();
            BeginContext(3576, 34, false);
#line 95 "C:\Users\RTS_NB\source\repos\MUP_test\MUP_test\Views\Home\Index.cshtml"
            Write(Html.Raw(StatusUtils.getJSArray()));

#line default
#line hidden
            EndContext();
            BeginContext(3610, 127, true);
            WriteLiteral(" ];\r\n\r\n                return sts[status];\r\n        }\r\n\r\n        function getActionRequest(id) {\r\n            return `<a href=\"");
            EndContext();
            BeginContext(3738, 30, false);
#line 101 "C:\Users\RTS_NB\source\repos\MUP_test\MUP_test\Views\Home\Index.cshtml"
            Write(Url.Action("Update", "Request"));

#line default
#line hidden
            EndContext();
            BeginContext(3768, 467, true);
            WriteLiteral(@"\\${id}"">${new Intl.NumberFormat('ru-RU', { minimumIntegerDigits: 6 }).format(id)}</a>`;
        }


        const sorting = [[2, 0]];

        $(document).ready(function () {

            //настройка сортировки по статусу
            $.tablesorter.addParser({
                id: ""status"",
                is: function () {
                    return false;
                },
                format: function (str) {
                    const sts = [");
            EndContext();
            BeginContext(4236, 34, false);
#line 116 "C:\Users\RTS_NB\source\repos\MUP_test\MUP_test\Views\Home\Index.cshtml"
            Write(Html.Raw(StatusUtils.getJSArray()));

#line default
#line hidden
            EndContext();
            BeginContext(4270, 1121, true);
            WriteLiteral(@" ];

                    return sts.indexOf(str);
                },
                type:""numeric""
            });


            $(""#request_list"").tablesorter({
                headers: {
                    0: { sorter: false },
                    1: { sorter: false },
                    3: {sorter:""status""}
                },
                sortList:sorting
            });

            $(""#btn_filter"").click(function () {
                const $filter_body = $(""#filter_test"");
                const $btn = $(this);

                $filter_body.empty();
                $btn.prop(""disabled"", true);

                const filt = [];

                if ($(""#status_0"").prop(""checked""))
                    filt.push(0);

                if ($(""#status_1"").prop(""checked""))
                    filt.push(1);

                if ($(""#status_2"").prop(""checked""))
                    filt.push(2);

                if ($(""#status_3"").prop(""checked""))
                    filt.push");
            WriteLiteral("(3);\r\n\r\n\r\n                $.ajax({\r\n                    type: \"POST\",\r\n                    url: \"");
            EndContext();
            BeginContext(5392, 25, false);
#line 157 "C:\Users\RTS_NB\source\repos\MUP_test\MUP_test\Views\Home\Index.cshtml"
            Write(Url.Action("RequestList"));

#line default
#line hidden
            EndContext();
            BeginContext(5417, 1211, true);
            WriteLiteral(@""",
                    data: {
                        statuses: filt,
                        start: $(""#start-period"").val(),
                        finish: $(""#finish-period"").val()
                    },
                    dataType: ""json"",
                    cache: false,
                    traditional: true,
                    success: function (data) {
                        data.requests.forEach(r => {
                            const dt = new Date(r.reqCreateTime);

                            $filter_body.append(`<tr><td>${getActionRequest(r.reqID)}</td >
                                                    <td>${r.reqText}</td><td>${dt.toLocaleDateString(""ru"")}</td>
                                                    <td>${getStatusName(r.curStatus)}</td></tr>`)
                        });

                        $(""#request_list"").trigger(""update"");

                        $(""#request_list"").trigger(""sorton"", sorting);

                    },
                    comp");
            WriteLiteral("lete: function () {\r\n                        $btn.prop(\"disabled\", false);\r\n                    }\r\n                });\r\n\r\n            })\r\n            .click();\r\n\r\n\r\n        });\r\n</script>");
            EndContext();
        }