Advertisement
Guest User

Untitled

a guest
Apr 10th, 2020
418
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 56.73 KB | None | 0 0
  1. @model List<bITup.Areas.HQ.Models.ProjectsMPKnodeVM>
  2. @using bITup.Common;
  3.  
  4. @{
  5.     /**/
  6.  
  7.     ViewBag.Title = "ProjectData Page";
  8.     var noedit = "";
  9.  
  10.     var moveLeafToKnot = "";
  11.     if ((ViewBag.Code == (Int16)Enums_HQ.BudgetType.BudgetZero || ViewBag.Code == (Int16)Enums_HQ.BudgetType.BudgetZeroRevisory)
  12.          || ViewBag.Code == (Int16)Enums_HQ.BudgetType.BudgetAnother)
  13.     {
  14.         moveLeafToKnot = "TAK";
  15.     }
  16.  
  17.     bITup.CustomAuthentication.CustomPrincipal identity = ((bITup.CustomAuthentication.CustomPrincipal)HttpContext.Current.User);
  18. }
  19.  
  20. <link rel="stylesheet" href="~/Content/jquery.treetable.css" />
  21. <link rel="stylesheet" href="~/Content/jquery.treetable.theme.default.css" />
  22. <link rel="stylesheet" href="~/Content/select2.min.css" />
  23. <link rel="stylesheet" href="~/Content/select2-bootstrap.min.css" />
  24. <script src="~/Scripts/jquery-ui-1.12.1.min.js"></script>
  25. <script src="~/Scripts/jquery.treetable.js"></script>
  26. <script src="~/Scripts/tableHeadFixer.js"></script>
  27. <script src="~/Scripts/select2.full.min.js"></script>
  28.  
  29. <style>
  30.  
  31.     #parent {
  32.         height: 80vh;
  33.         width: 100%;
  34.         overflow: auto;
  35.         background: linear-gradient(#dae6f1, #ffffff, #dae6f1);
  36.     }
  37.  
  38.     #fixTable {
  39.         width: 1800px !important;
  40.         margin-top: -2px;
  41.     }
  42.  
  43.     /* dotyczy listy rozwijalnej z mozliwoscia wyszukiwania */
  44.     table.treetable td.withoutPadding span:not(.select2-selection) {
  45.         padding: 0;
  46.     }
  47. </style>
  48.  
  49. @Html.Hidden("projectId", (int)ViewBag.projectId)
  50. @Html.Hidden("projectCode", (Int16)ViewBag.Code)
  51. @Html.Hidden("AddEditAssignUserUrl", Url.Action("AddEditAssignUser", "Projects", new { area = "HQ", projectID = ViewBag.ProjectId }))
  52. @Html.Hidden("RealisationUrl", Url.Action("Realistation", "Projects", new { area = "HQ", projectId = ViewBag.ProjectId }))
  53. @Html.Hidden("AddEditReserveUrl", Url.Action("AddEditReserve", "Projects", new { area = "HQ" }))
  54. @Html.Hidden("PatternCTUrl", @Url.Action("AddPatternCT", "Projects", new { area = "HQ" }))
  55. @Html.Hidden("AddEditReserveUrl", Url.Action("AddEditReserve", "Projects", new { area = "HQ" }))
  56. @Html.Hidden("AddEditScheduleForAmountUrl", Url.Action("AddEditScheduleForAmount", "Projects", new { area = "HQ", projectId = ViewBag.ProjectId }))
  57.  
  58. <div class="container-kz-f background-kz" style="margin-top:0;">
  59.  
  60.     @using (Html.BeginForm("ProjectMPKData", "Projects", FormMethod.Post, new { id = "ProjectMPKDataForm" }))
  61.     {
  62.         <div class="col-md-12">
  63.             <div class="col-md-3">
  64.                 <h4>@ViewBag.Header</h4>
  65.             </div>
  66.             <div class="col-md-2" style="text-align:right;color:firebrick;">
  67.                 @{
  68.                     var code = Enums.GetEnumDescription<Enums_HQ.BudgetType>(ViewBag.Code);
  69.                 }
  70.                 <h4>@code</h4>
  71.             </div>
  72.             <div class="col-md-7" style="text-align:right">
  73.                 @if (ViewBag.Code != (Int16)Enums_HQ.BudgetType.ComparativeTable && ViewBag.Code != (Int16)Enums_HQ.BudgetType.PositionsWSW
  74.                     && ViewBag.Code != (Int16)Enums_HQ.BudgetType.ComparativeTablePattern)
  75.                 {
  76.                     if (ViewBag.Status == (Int16)Enums_HQ.ProjectStatusType.New && ViewBag.Code == (Int16)Enums_HQ.BudgetType.BudgetZero &&
  77.                          DBL.IdUser_VIPProject(identity.id_user, ViewBag.ProjectId, ViewBag.Status, "vocation_person"))
  78.                     {
  79.                         <input href="#" type="button" value="Skieruj do akceptacji" class="btnAccept btn btn-warning" data-vw="appointing_projects" />
  80.                         <input href="#" type="button" value="Uwagi akceptujących" class="btn btn-default btnAcceptDescription" data-vw="appointing_projects" />
  81.                     }
  82.  
  83.                     if (ViewBag.Status == (Int16)Enums_HQ.ProjectStatusType.InApproval && DBL.IdUser_VIPProject(identity.id_user, ViewBag.ProjectId, ViewBag.Status, "approval_kpp"))
  84.                     {
  85.                         <input href="#" type="button" value="Akceptuj" class="btnAccept btn btn-warning" data-vw="approval_budget_zero" />
  86.                         <input href="#" type="button" value="Uwagi akceptujących" class="btn btn-default btnAcceptDescription" data-vw="approval_budget_zero" />
  87.                     }
  88.                     <input href="#" type="button" value="Zablokuj tytuły" class="btn btn-default btnFreze" />
  89.                     <input href="#" type="button" value="Zmień położenie liścia" class="btn btn-default btnChangeStruct" />
  90.                     <input href="#" type="button" value="Rozwiń wszystko" class="btnExpandAll btn btn-default" />
  91.                     <input href="#" type="button" value="Zwiń wszystko" class="btnCollapseAll btn btn-default" />
  92.                 }
  93.                 <input href="#" type="button" value="Zmień położenie liścia" class="btn btn-default btnChangeStruct hidden" />
  94.             </div>
  95.         </div>
  96.         <div class="col-md-12" style="padding-bottom:6px;">
  97.             <div class="col-md-7">
  98.                 @{
  99.                     if (ViewBag.Code != (Int16)Enums_HQ.BudgetType.ComparativeTable && ViewBag.Code != (Int16)Enums_HQ.BudgetType.BudgetAnother
  100.                         && ViewBag.Code != (Int16)Enums_HQ.BudgetType.PositionsWSW && ViewBag.Code != (Int16)Enums_HQ.BudgetType.ComparativeTablePattern)
  101.                     {
  102.                         switch (ViewBag.Code)
  103.                         {
  104.                             case Enums_HQ.BudgetType.TopSheet:
  105.                                 <input type="button" value="Załączniki" id="btnAttachmentsList" class="btn btn-link" />
  106.                                 <input href="#" type="button" value="Kreacja B0" class="btnCreateT0 btn btn-link"
  107.                                        data-link="@Url.Action("CreateBudgetT0", "Projects", new { area = "HQ", projIdd = ViewBag.ProjectId })" />
  108.                                 break;
  109.  
  110.                             case (Int16)Enums_HQ.BudgetType.BudgetZero:
  111.                                 @*@<input href="#" type="button" value="Rewizja B0" class="btnTR btn btn-link" data-sb="Kreacja rewizji budżetu zero" />*@
  112.                                 if (ViewBag.Status == (Int16)Enums_HQ.ProjectStatusType.InRealization)
  113.                                 {
  114.                                     <input type="button" value="Stwórz szablon" id="btnAddPatternCT" class="btn btn-link" />
  115.                                     <input href="#" type="button" value="Tabele porównawcze" name="submitButton" class="btnMPKFile btn btn-link"
  116.                                            data-link="@Url.Action("ProjectMPKFile", "Projects", new { area = "HQ", projId = ViewBag.ProjectId, file = (Int16)Enums_HQ.BudgetType.ComparativeTable })" />
  117.                                 }
  118.  
  119.                                 break;
  120.  
  121.                             case (Int16)Enums_HQ.BudgetType.BudgetRealization:
  122.                                 <input href="#" type="button" value="Kreacja pozycji ofertowych" class="btnTP btn btn-link"
  123.                                        data-typeId="@((Int16)(Int16)Enums_HQ.BudgetType.ComparativeTable)" data-id="@ViewBag.ProjId" />
  124.                                 break;
  125.                         }
  126.                     }
  127.  
  128.                     if (ViewBag.Code != (Int16)Enums_HQ.BudgetType.ComparativeTable && ViewBag.Code != (Int16)Enums_HQ.BudgetType.PositionsWSW
  129.                         && ViewBag.Code != (Int16)Enums_HQ.BudgetType.ComparativeTablePattern)
  130.                     {
  131.                         <input href="#" type="button" value="Powrót do listy budżetów" class="btnReturn btn btn-link"
  132.                                data-link="@Url.Action("ProjectMPKFile", "Projects", new { area = "HQ", projId = ViewBag.ProjectId, file = ViewBag.Code })" style="color:firebrick" />
  133.                     }
  134.                     else
  135.                     {
  136.                         var actionLinkText = "";
  137.                         switch ((int)ViewBag.Code)
  138.                         {
  139.                             case (int)Enums_HQ.BudgetType.PositionsWSW:
  140.                                 actionLinkText = "Powrót do listy pozycji WSW";
  141.                                 break;
  142.                             case (int)Enums_HQ.BudgetType.ComparativeTablePattern:
  143.                                 <div class="dropdown dropdownInline">
  144.                                     <button class="btn btn-link dropdown-toggle" id="createComparativeTablesMenu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
  145.                                         Kreacja pozycji
  146.                                     </button>
  147.                                     <div class="dropdown-menu drodownmenu-text-center-kz" aria-labelledby="createComparativeTablesMenu">
  148.                                         <input href="#" type="button" value="Ofertowych" name="submitButton" class="btnTP btn btn-link" data-sb="Kreacja pozycji ofertowych"
  149.                                                data-id="@ViewBag.ProjId" data-idtype="@((Int16)Enums_HQ.BudgetType.ComparativeTable)" />
  150.                                         <input href="#" type="button" value="Ofertowych - aneks" name="submitButton" class="btnTP btn btn-link" data-sb="Kreacja pozycji ofertowych"
  151.                                                data-id="@ViewBag.ProjId" data-idtype="@((Int16)Enums_HQ.BudgetType.ComapartiveTableAnnex)" />
  152.  
  153.                                         <input href="#" type="button" value="Aprobaty" name="submitButton" class="btnTP btn btn-link" data-sb="Kreacja pozycji ofertowych"
  154.                                                data-id="@ViewBag.ProjId" data-idtype="@((Int16)Enums_HQ.BudgetType.CostApproval)" id="approvalBtn" style="display:none;" />
  155.                                     </div>
  156.                                 </div>
  157.                                 actionLinkText = "Powrót do listy szablonów";
  158.                                 break;
  159.                             case (int)Enums_HQ.BudgetType.ComparativeTable:
  160.                                 actionLinkText = "Powrót do listy tabel";
  161.                                 break;
  162.                         }
  163.  
  164.                         @Html.ActionLink(actionLinkText, "ProjectMPKFile", new {controller = "Projects" ,area = "HQ", projId = ViewBag.ProjectId,
  165.                             file = (int)ViewBag.Code }, new { @style = "color:firebrick" })
  166.  
  167.                     }
  168.                 }
  169.             </div>
  170.             <div class="col-md-5" style="text-align:right;">
  171.                 @{
  172.                     if (ViewBag.Code != (Int16)Enums_HQ.BudgetType.ComparativeTable && noedit != "TAK")
  173.                     {
  174.                         <input href="#" type="button" value="Zapisz zmiany danych" class="btn btn-info btnSaveNodes btnEnabled" data-id="@ViewBag.ProjId" />
  175.                         if (ViewBag.Code == (Int16)Enums_HQ.BudgetType.BudgetZero)
  176.                         {
  177.                             <input href="#" type="button" value="Rozpisz harmonogram" class="btnSchedule btnEnabled btn btn-default" />
  178.                         }
  179.  
  180.                         <input href="#" type="button" value="Agregacja" class="btnCalcAggre btn btn-default btnEnabled" data-id="@ViewBag.ProjId" data-sb="2" />
  181.                         @Html.TextBox("UrlCalculateOrAndAggregateFieldsNodes", @Url.Action("CalculateOrAndAggregateFieldsNodes", "Projects", new { area = "HQ" }), new { style = "display: none;" })
  182.  
  183.                     }
  184.  
  185.                     if (ViewBag.Code == (Int16)Enums_HQ.BudgetType.BudgetZeroFromTS && ViewBag.Contracting != "TAK")
  186.                     {
  187.                         <input href="#" type="button" value="Dodaj kontraktowanie" class="btn btn-default btnAddContractingAndScheduling" data-link="@Url.Action("AddContractingAndScheduling", "Projects", new { area = "HQ" })" data-id="@ViewBag.ProjId" />
  188.                     }
  189.  
  190.                     <input href="#" type="button" value="Export do .xlsx" class="btn btn-default btnGenerateExcelFromBudget" data-link="@Url.Action("GenerateExcelFromBudget", "Projects", new { area = "HQ" })" data-id="@ViewBag.ProjId" />
  191.  
  192.                     if ((ViewBag.Code != (Int16)Enums_HQ.BudgetType.ComparativeTable && ViewBag.Code != (Int16)Enums_HQ.BudgetType.ComparativeTablePattern) && noedit != "TAK")
  193.                     {
  194.                         <input href="#" type="button" value="Import z .xlsx" name="submitButton" class="btn btn-default btnAddBudgetFromExcel dropdown-item" data-id="@ViewBag.ProjId" />
  195.                         <input type="file" name="attach" id="importExcel" multiple="" data-link="@Url.Action("AddBudgetFromExcel", "Projects", new { area = "HQ" })" data-id="@ViewBag.ProjId" style="display:none" />
  196.  
  197.                         <input href="#" type="button" value="Wylicz" class="btnCalcAggre btn btn-default btnEnabled" data-id="@ViewBag.ProjId" data-sb="1" />
  198.                         @*<input href="#" type="button" value="Agregacja" class="btnCalcAggre btn btn-default btnEnabled" data-id="@ViewBag.ProjId" data-sb="2" />*@
  199.  
  200.                         @Html.TextBox("UrlSaveChangeStructureNodes", @Url.Action("SaveChangeStructureNodes", "Projects", new { area = "HQ" }), new { style = "display: none;" })
  201.                         @Html.TextBox("UrlStyleLeafOfKnotNodes", @Url.Action("StyleLeafOfKnotNodes", "Projects", new { area = "HQ" }), new { style = "display: none;" })
  202.                     }
  203.                     @Html.TextBox("UrlSaveNodes", @Url.Action("SaveNodes", "Projects", new { area = "HQ" }), new { style = "display: none;" })
  204.                     @Html.TextBox("UrlDelKnotOrLeaf", @Url.Action("DelKnotOrLeaf", "Projects", new { area = "HQ" }), new { style = "display: none;" })
  205.                 }
  206.             </div>
  207.         </div>
  208.  
  209.         @Html.AntiForgeryToken()
  210.  
  211.         if (Model.Count > 0)
  212.         {
  213.             <div id="parent">
  214.                 <table class="tabAdvanced fixTable">
  215.                     <thead>
  216.                         <tr class="tr-kz-header-un" style="height:2.55em;">
  217.  
  218.                             <th style="text-align:center;"> </th>
  219.                             <th style="text-align:center;"> </th>
  220.                             <th style="text-align:center;"> </th>
  221.  
  222.                             @foreach (var item in ViewBag.Conf)
  223.                             {
  224.                                 if (item.active && item.colspan_no > 0)
  225.                                 {
  226.                                     var stth = "border: 1px solid #dae6f1;text-align:center;";
  227.                                     string[] stx = item.style_html.Split(';');
  228.                                     for (int i = 0; i < stx.Count(); i++)
  229.                                     {
  230.                                         if (stx[i].Contains("background-color"))
  231.                                         {
  232.                                             stth = stth + stx[i] + ";";
  233.                                         };
  234.                                     };
  235.  
  236.                                     <th colspan=@item.colspan_no style="@stth">
  237.                                         @item.colspan_title
  238.                                     </th>
  239.                                 }
  240.                             }
  241.                         </tr>
  242.  
  243.                         <tr class="tr-kz-header" style="height:2.55em;">
  244.  
  245.                             <th style="text-align:center">
  246.                                 @Html.DisplayName("Określenie")
  247.                             </th>
  248.  
  249.                             <th style="text-align:center">
  250.                                 @Html.DisplayName("Kod kosztu")
  251.                             </th>
  252.  
  253.                             @{
  254.                                 var st = "";
  255.                                 if (noedit != "")
  256.                                 {
  257.                                     st = "display: none;";
  258.                                 }
  259.                             }
  260.  
  261.                             <th style="@st">
  262.                             </th>
  263.  
  264.  
  265.                             @foreach (var item in ViewBag.Conf)
  266.                             {
  267.                                 if (item.active)
  268.                                 {
  269.                                     <th style="text-align:center" class="th_item" data-id="@item.id_conf" title="Kliknij w celu wyświetlenia detali konfiguracji">
  270.                                         @item.name
  271.                                     </th>
  272.                                 }
  273.                             }
  274.  
  275.                         </tr>
  276.                     </thead>
  277.  
  278.                     <tbody>
  279.  
  280.  
  281.                         @for (int i = 0; i < Model.Count(); i++)
  282.                         {
  283.  
  284.  
  285.                             var clas = "";
  286.                             if (Model[i].through_magazine)
  287.                             {
  288.                                 clas = "text-warning-kz";
  289.                             }
  290.                             if (Model[i].magazine_id > 0)
  291.                             {
  292.                                 clas = "text-info-kz";
  293.                             }
  294.  
  295.                             var tit = Model[i].name + "  " + Model[i].tt_id;
  296.  
  297.                             var trhidden = "hidden";
  298.                             if (i == 0)
  299.                             {
  300.                                 trhidden = "";
  301.                             }
  302.  
  303.                             <tr style="height:2.55em;" data-tt-id="@Model[i].tt_id" data-tt-parent-id="@Model[i].tt_parent_id" data-leaf="@Model[i].leaf" data-id_proj="@Model[i].proj_id" data-id_node="@Model[i].id_node" data-has_leaf="@Model[i].has_leaf"
  304.                                 data-tt_parent_id="@Model[i].tt_parent_id" data-has_knot="@Model[i].has_knot" data-id="@i" class="@clas @Model[i].style_html @trhidden">
  305.  
  306.                                 @Html.ValidationSummary(true, "", new { @class = "text-danger" })
  307.                                 @Html.HiddenFor(model => Model[i].id_node)
  308.                                 @Html.HiddenFor(model => Model[i].proj_id)
  309.                                 @Html.HiddenFor(model => Model[i].leaf)
  310.                                 @Html.HiddenFor(model => Model[i].parent_id_node)
  311.                                 @Html.HiddenFor(model => Model[i].name)
  312.                                 @Html.HiddenFor(model => Model[i].span_class)
  313.                                 @Html.HiddenFor(model => Model[i].tt_id)
  314.                                 @Html.HiddenFor(model => Model[i].tt_parent_id)
  315.                                 @Html.HiddenFor(model => Model[i].new_tt_parent_id)
  316.                                 @Html.HiddenFor(model => Model[i].uniq)
  317.                                 @Html.HiddenFor(model => Model[i].code_cost)
  318.  
  319.                                 <td style="width:480px;margin-right:6px;padding-top:6px;float:left;white-space:nowrap; text-overflow:ellipsis; overflow:hidden;" class="td_item" title="@tit" data-txt="@Model[i].name">
  320.                                     <span id="item_span" class="@Model[i].span_class">@Model[i].name</span>
  321.                                 </td>
  322.  
  323.                                 <td style="text-align:center;" class="td_cc" data-code="@Model[i].code_cost" title="">
  324.  
  325.                                     @Html.CheckBoxFor(model => Model[i].through_magazine, new { @class = "through_magazine hidden" })
  326.                                     @Html.EditorFor(model => Model[i].magazine_id, new { htmlAttributes = new { @class = "magazine_id hidden" } })
  327.                                     @*@Html.EditorFor(model => Model[i].tt_id, new { htmlAttributes = new { @class = "tt_id hidden" } })*@
  328.                                     @Html.CheckBoxFor(model => Model[i].rolling_up, new { @class = "rolling_up hidden" })
  329.  
  330.                                     @Model[i].code_cost
  331.                                 </td>
  332.  
  333.                                 <td style="@st">
  334.  
  335.                                     <div id="dropdown" class="dropdown">
  336.                                         <a href="#" class="dropdown-toggle btn btn-link btn-group-justified" data-toggle="dropdown" style="width:100px;margin-right:16px;">Akcje <b class="caret"></b></a>
  337.                                         <ul class="dropdown-menu btn btn-link" style="background-color:#fff;border:2px solid firebrick;">
  338.                                             @{
  339.                                                 if (tit != "")
  340.                                                 {
  341.                                                     var style_unsr = "";
  342.                                                     var style_sr = "display: none;";
  343.                                                     if (Model[i].rolling_up)
  344.                                                     {
  345.                                                         style_unsr = "display:none;";
  346.                                                         style_sr = "";
  347.                                                     }
  348.  
  349.                                                     <li id="set_rolling" style="@style_sr"><input href="#" type="button" value="Zawiń tekst" class="btnRollingText btnEnabled btn-link" /></li>
  350.                                                     <li id="unset_rolling" style="@style_unsr"><input href="#" type="button" value="Rozwiń tekst" class="btnRollingText btnEnabled btn-link" /></li>
  351.                                                 }
  352.  
  353.                                                 if (Model[i].leaf)
  354.                                                 {
  355.                                                     if (!Model[i].through_magazine)
  356.                                                     {
  357.                                                         <li><input href="#" type="button" value="Edycja pozycji => opis, styl" class="btnEdit btnEnabled btn-link" data-id="@Model[i].id_node" data-leaf="true" /></li>
  358.                                                         <li><input href="#" type="button" value="Wykonanie" class="btnRealisation btnEnabled btn-link" data-id="@Model[i].id_node" /></li>
  359.                                                     }
  360.                                                 }
  361.                                                 else
  362.                                                 {
  363.                                                     <li><input href="#" type="button" value="Edycja pozycji => opis, typ, styl" class="btnEdit btnEnabled btn-link" data-id="@Model[i].id_node" data-leaf="false" /></li>
  364.                                                     <li><input href="#" type="button" value="Styl liści wewnętrznych wg węzła" class="btnStyleLeafOfKnot btnEnabled btn-link" data-tt_id="@Model[i].tt_id" data-id="@Model[i].proj_id" data-st="@Model[i].style_html" /></li>
  365.  
  366.                                                 }
  367.  
  368.  
  369.  
  370.                                                 if (!Model[i].leaf)
  371.                                                 {
  372.                                                     <li><input href="#" type="button" value="Dodaj węzeł" class="btnAddKnot btnEnabled btn-link" data-id="@Model[i].id_node" data-refreshtype="3" /></li>
  373.                                                 }
  374.  
  375.                                                 @*if (!string.IsNullOrEmpty(Model[i].tt_parent_id) && !Model[i].through_magazine)*@
  376.                                                 if (!Model[i].through_magazine)
  377.                                                 {
  378.                                                     <li><input href="#" type="button" value="Dodaj liść" class="btnAddLeaf bbtnEnabled btn-link" data-id="@Model[i].id_node" data-refreshtype="3" /></li>
  379.                                                 }
  380.  
  381.                                                 if (!Model[i].leaf && Model[i].has_leaf > 0 && Model[i].has_knot == 0 && moveLeafToKnot != "")
  382.                                                 {
  383.                                                     <li><input href="#" type="button" value="Zamień liście wewnętrzne na węzły" class="btnMoveLeafToKnot btnEnabled btn-link" data-id="@Model[i].id_node" /></li>
  384.                                                 }
  385.  
  386.                                                 if (!string.IsNullOrEmpty(Model[i].tt_parent_id) && (Model[i].leaf || (!Model[i].leaf && Model[i].has_knot == 0 && Model[i].has_leaf == 0)))
  387.                                                 {
  388.                                                     if (Model[i].is_available == 0 && !Model[i].through_magazine)
  389.                                                     {
  390.                                                         <li><input href="#" type="button" value="Usuń element" class="submitDelete btnEnabled btn-link" data-id="@Model[i].id_node" data-modelname="3" /></li>
  391.                                                     }
  392.                                                 }
  393.  
  394.                                                 if (Model[i].leaf && (Model[i].magazine_id == null || Model[i].magazine_id <= 0))
  395.                                                 {
  396.                                                     var style_tm = "";
  397.                                                     var style_utm = "display: none;";
  398.                                                     if (Model[i].through_magazine)
  399.                                                     {
  400.                                                         style_tm = "display:none;";
  401.                                                         style_utm = "";
  402.                                                     }
  403.  
  404.                                                     <li id="set_trough" style="@style_tm"><input href="#" type="button" value="Integruj z magazynem" class="btnVM btnEnabled btn-link" /></li>
  405.                                                     <li id="unset_trough" style="@style_utm"><input href="#" type="button" value="Usuń integrację z magazynem" class="btnVMRemove btnEnabled btn-link" /></li>
  406.                                                     <li id="set_id_mag" style="@style_utm"><input href="#" type="button" value="Przypisz jednostkę mag." class="btnVMJM btnEnabled btn-link" data-id="@ViewBag.ProjectId" /></li>
  407.                                                 }
  408.  
  409.                                                 if (Model[i].through_magazine)
  410.                                                 {
  411.                                                     if (Model[i].magazine_id > 0)
  412.                                                     {
  413.                                                         <li><input href="#" type="button" value="Podgląd jednostki magazynowej" class="btnViewVM btnEnabled btn-link" data-id="@Model[i].magazine_id" /></li>
  414.                                                     }
  415.                                                 }
  416.  
  417.                                                 if (ViewBag.Code == (Int16)Enums_HQ.BudgetType.BudgetZero)
  418.                                                 {
  419.                                                     <li><input href="#" type="button" value="Właściciel pozycji" class="btnOwnerNode btnEnabled btn-link" data-id="@Model[i].id_node" /></li>
  420.                                                 }
  421.                                                 if (ViewBag.Code == (Int16)Enums_HQ.BudgetType.BudgetZeroFromTS)
  422.                                                 {
  423.                                                     <li><input href="#" type="button" value="Dodaj/Edytuj rezerwę" class="btnAddEditReserve btnEnabled btn-link" data-id="@Model[i].id_node" data-id_proj="@Model[i].proj_id" /></li>
  424.                                                 }
  425.                                             }
  426.                                         </ul>
  427.                                     </div>
  428.  
  429.                                 </td>
  430.  
  431.                                 @{
  432.                                     for (int j = 0; j < Model[i].v_values.Count(); j++)
  433.                                     {
  434.                                         @Html.HiddenFor(model => Model[i].v_values[j].node_id)
  435.                                         @Html.HiddenFor(model => Model[i].v_values[j].conf_id)
  436.                                         @Html.HiddenFor(model => Model[i].v_values[j].id_value)
  437.  
  438.                                         if (ViewBag.Conf[j].active)
  439.                                         {
  440.                                             var styl = ViewBag.Conf[j].style_html;
  441.                                             if (ViewBag.Code == (Int16)Enums_HQ.BudgetType.ComparativeTablePattern && j == 0)
  442.                                             {
  443.                                                 styl += "; background-color: khaki !important";
  444.                                             }
  445.  
  446.                                             if (ViewBag.Conf[j].type_field == "Wyliczalne")
  447.                                             {
  448.                                                 styl = styl + ";" + "background-color:#dae6f1;";
  449.                                             }
  450.                                             <td>
  451.  
  452.                                                 @if (Model[i].leaf)
  453.                                                 {
  454.                                                     if (ViewBag.Conf[j].type_field == "Słownik")
  455.                                                     {
  456.                                                         if (ViewBag.Conf[j].available && noedit == "")
  457.                                                         {
  458.                                                             styl = styl + ";background-color: #ffffff;";
  459.                                                             @Html.DropDownListFor(model => Model[i].v_values[j].value, new SelectList(@ViewData[@ViewBag.Conf[j].mask], "description", "description",
  460.                                                             @Model[i].v_values[j].value), new { @class = "form-control width-150-24", @style = @styl })
  461.                                                         }
  462.                                                         else
  463.                                                         {
  464.                                                             @*@Html.DropDownListFor(model => Model[i].v_values[j].value, new SelectList(@ViewData[@ViewBag.Conf[j].mask], "description", "description", @Model[i].v_values[j].value), new { @class = "form-control width-150-24", @style = @styl, @disabled = "disabled" })*@
  465.                                                             @Html.TextBoxFor(model => Model[i].v_values[j].value,
  466.                                                                                   new { @class = "form-control width-150-24", @style = @styl, @data_IdConf = @Model[i].v_values[j].conf_id, @data_aggregate = @ViewBag.Conf[j].aggregate_field, @data_idx = @j, @readonly = "readonly" })
  467.                                                         }
  468.                                                     }
  469.                                                     else
  470.                                                     {
  471.                                                         if (ViewBag.Conf[j].type_field == "Pole tekstowe")
  472.                                                         {
  473.                                                             if (ViewBag.Conf[j].available && noedit == "")
  474.                                                             {
  475.                                                                 styl = styl + ";background-color: #ffffff;";
  476.                                                                 @Html.TextBoxFor(model => Model[i].v_values[j].value,
  477.                                                                                   new { @class = "form-control width-150-24",
  478.                                                                                       @style = @styl, @data_IdConf = @Model[i].v_values[j].conf_id, @data_aggregate = @ViewBag.Conf[j].aggregate_field,
  479.                                                                                       @data_idx = @j })
  480.  
  481.                                                             }
  482.                                                             else
  483.                                                             {
  484.                                                                 @Html.TextBoxFor(model => Model[i].v_values[j].value,
  485.                                                                                   new { @class = "form-control width-150-24", @style = @styl,
  486.                                                                                       @data_IdConf = @Model[i].v_values[j].conf_id, @data_aggregate = @ViewBag.Conf[j].aggregate_field,
  487.                                                                                       @data_idx = @j, @readonly = "readonly" })
  488.                                                             }
  489.                                                         }
  490.                                                         else
  491.                                                             if (ViewBag.Conf[j].type_field == "Liczba")
  492.                                                         {
  493.                                                             if (ViewBag.Conf[j].available && noedit == "")
  494.                                                             {
  495.                                                                 styl = styl + ";background-color: #ffffff;";
  496.                                                                 @Html.EditorFor(model => Model[i].v_values[j].value,
  497.                                                                                  new { htmlAttributes = new { @class = "form-control width-150-24 decValue cell_value", @style = @styl, @data_IdConf = @Model[i].v_values[j].conf_id, @data_aggregate = @ViewBag.Conf[j].aggregate_field, @data_idx = @j, @data_idValue = @Model[i].v_values[j].id_value, @data_idProj = @Model[i].proj_id } })
  498.                                                             }
  499.                                                             else
  500.                                                             {
  501.                                                                 @Html.EditorFor(model => Model[i].v_values[j].value,
  502.                                                                                  new { htmlAttributes = new { @class = "form-control width-150-24 decValue cell_value", @style = @styl, @data_IdConf = @Model[i].v_values[j].conf_id, @data_aggregate = @ViewBag.Conf[j].aggregate_field, @data_idx = @j, @data_idValue = @Model[i].v_values[j].id_value, @data_idProj = @Model[i].proj_id, @readonly = "readonly" } })
  503.                                                             }
  504.                                                         }
  505.                                                         else
  506.                                                             if (ViewBag.Conf[j].type_field == "Wyliczalne")
  507.                                                         {
  508.                                                             @Html.TextBoxFor(model => Model[i].v_values[j].value,
  509.                                                                                       new
  510.                                                                                       {
  511.                                                                                           @class = "form-control width-150-24 decValue calculateMPK",
  512.                                                                                           @style = @styl,
  513.                                                                                           @data_IdConf = @Model[i].v_values[j].conf_id,
  514.                                                                                           @data_aggregate = @ViewBag.Conf[j].aggregate_field,
  515.                                                                                           @data_idx = @j,
  516.                                                                                           @data_idValue = @Model[i].v_values[j].id_value,
  517.                                                                                           @data_mask = @ViewBag.Conf[j].mask,
  518.                                                                                           @readonly = "readonly",
  519.                                                                                           @title = "Kliknij dwukrotnie w celu aktywacji kalkulatora"
  520.                                                                                       })
  521.                                                         }
  522.                                                     }
  523.                                                 }
  524.                                                 else
  525.                                                 {
  526.                                                     if (ViewBag.Conf[j].type_field == "Liczba" || ViewBag.Conf[j].type_field == "Wyliczalne")
  527.                                                     {
  528.                                                         @Html.TextBoxFor(model => Model[i].v_values[j].value,
  529.                                                                                       new { @class = "form-control width-150-24 decValue", @style = @styl, @data_IdConf = @Model[i].v_values[j].conf_id, @data_aggregate = @ViewBag.Conf[j].aggregate_field, @data_idx = @j, @data_idValue = @Model[i].v_values[j].id_value, @readonly = "readonly" })
  530.                                                     }
  531.                                                     else
  532.                                                     {
  533.                                                         @Html.TextBoxFor(model => Model[i].v_values[j].value,
  534.                                                                           new { @class = "form-control width-150-24 decValue", @style = @styl, @data_IdConf = @Model[i].v_values[j].conf_id, @data_aggregate = @ViewBag.Conf[j].aggregate_field, @data_idx = @j, @data_idValue = @Model[i].v_values[j].id_value, @readonly = "readonly" })
  535.                                                     }
  536.  
  537.                                                 }
  538.                                             </td>
  539.                                         }
  540.                                     }
  541.                                 }
  542.                             </tr>
  543.                         }
  544.                     </tbody>
  545.                     <thead id="th-bottom" style="display:none">
  546.                         <tr class="tr-kz-header" style="height:36px;">
  547.                             <th width="350px" style="text-align:center">
  548.                                 @Html.DisplayName("Określenie")
  549.                             </th>
  550.                             <th width="75px;">
  551.                                 Aktywny
  552.                             </th>
  553.                             <th width="160px;">
  554.                             </th>
  555.                             @foreach (var item in ViewBag.Conf)
  556.                             {
  557.                                 if (item.active)
  558.                                 {
  559.                                     <th width="160px;" style="text-align:center" class="th_item" data-id="@item.id_conf" title="Kliknij w celu wyświetlenia detali konfiguracji">
  560.                                         @item.name
  561.                                     </th>
  562.                                 }
  563.                             }
  564.                         </tr>
  565.                     </thead>
  566.                 </table>
  567.             </div>
  568.  
  569.             <div>
  570.                 <h5 style="text-align:center;">
  571.                     <strong>
  572.                         <a1 class="text-info-kz" style="margin-left:12px;">
  573.                             Pozycja przypisana do magazynu
  574.                         </a1>
  575.                     </strong>
  576.                     <strong>
  577.                         <a1 class="text-warning-kz" style="margin-left:12px;">
  578.                             Pozycja rozliczana poprzez magazyn - brak integracji
  579.                         </a1>
  580.                     </strong>
  581.                     <strong>
  582.                         <a1 class="text-danger-kz" style="margin-left:12px;">
  583.                             Pozycja przypisana do magazynu - brak zapisu w bazie
  584.                         </a1>
  585.                     </strong>
  586.                 </h5>
  587.             </div>
  588.         }
  589.     }
  590.  
  591.     <div class="modal" id="editModal">
  592.         @Html.TextBox("UrlCreateTP", @Url.Action("CreateTP", "Projects", new { area = "HQ" }), new { style = "display: none;" })
  593.         @Html.Hidden("SelectAgreementForAnnexeUrl", @Url.Action("SelectAgreementForAnnexe", "Agreements", new { area = "HQ" }))
  594.         <div class="modal-dialog" style="width:90%;">
  595.             <div class="modal-content">
  596.                 <div class="modal-body" id="editModalBodyDiv">
  597.                 </div>
  598.             </div>
  599.         </div>
  600.     </div>
  601.  
  602.     <div class="modal" id="editDetailsModal">
  603.         @Html.TextBox("UrlAddEditKnotOrLeaf", @Url.Action("AddEditKnotOrLeaf", "Projects", new { area = "HQ" }), new { style = "display: none;" })
  604.         @Html.TextBox("UrlMoveLeafToKnot", @Url.Action("MoveLeafToKnot", "Projects", new { area = "HQ" }), new { style = "display: none;" })
  605.         @Html.TextBox("UrlProjectMPKData", @Url.Action("ProjectMPKData", "Projects", new { area = "HQ" }), new { style = "display: none;" })
  606.         @Html.TextBox("UrlUserAcceptStep", @Url.Action("UserAcceptStep", "Projects", new { area = "HQ" }), new { style = "display: none;" })
  607.         <div class="modal-dialog">
  608.             <div class="modal-content">
  609.                 <div class="modal-body" id="editDetailsModalBodyDiv">
  610.                 </div>
  611.             </div>
  612.         </div>
  613.     </div>
  614.  
  615.     <div class="modal" id="virtualStoreModal">
  616.         @Html.TextBox("UrlShowStoreItemsToSelectOne", @Url.Action("ShowStoreItemsToSelectOne", "VirtualStore", new { area = "HQ" }), new { style = "display: none;" })
  617.         @Html.TextBox("UrlShowStoreForBudgetPreview", @Url.Action("ShowStoreForBudgetPreview", "VirtualStore", new { area = "HQ" }), new { style = "display: none;" })
  618.         <div class="modal-dialog" style="width:70%">
  619.             <div class="modal-content">
  620.                 <div class="modal-body" id="virtualStoreBodyModal">
  621.                 </div>
  622.             </div>
  623.         </div>
  624.     </div>
  625.  
  626.     <div class="modal" id="configViewModal">
  627.         @Html.TextBox("UrlDetailsNetConfig", @Url.Action("DetailsNetConfig", "Projects", new { area = "HQ" }), new { style = "display: none;" })
  628.         <div class="modal-dialog" style="width:15%">
  629.             <div class="modal-content">
  630.                 <div class="modal-body" id="configViewModalBodyDiv">
  631.                 </div>
  632.             </div>
  633.         </div>
  634.     </div>
  635.  
  636.     <div class="modal" id="calculateModal">
  637.         @Html.TextBox("UrlCalculateMPK", @Url.Action("CalculateMPK", "Projects", new { area = "HQ" }), new { style = "display: none;" })
  638.         <div class="modal-dialog">
  639.             <div class="modal-content">
  640.                 <div class="modal-body" id="calculateModalBodyDiv">
  641.                 </div>
  642.             </div>
  643.         </div>
  644.     </div>
  645. </div>
  646. <div class="modal" id="attachmentsListModal">
  647.     <div class="modal-dialog" style="width:40%">
  648.         <div class="modal-content">
  649.             <div class="modal-body" id="attachmentsListModalBody"></div>
  650.         </div>
  651.     </div>
  652. </div>
  653. <div class="modal" id="attachmentModal">
  654.     <div class="modal-dialog">
  655.         <div class="modal-content">
  656.             <div class="modal-body" id="attachmentModalBodyDiv"></div>
  657.         </div>
  658.     </div>
  659. </div>
  660. <div class="modal" id="editModalAcceptDescription">
  661.     <div class="modal-dialog" style="width:70%">
  662.         <div class="modal-content">
  663.             <div class="modal-body" id="editModalAcceptDescriptionBodyDiv"></div>
  664.         </div>
  665.     </div>
  666. </div>
  667.  
  668. <script src="~/Scripts/autoNumeric/autoNumeric.js"></script>
  669. <script src="~/Scripts/jquery-kz-val-load.js"></script>
  670. <script src="~/Scripts/jquery-projectmpkdata.js"></script>
  671.  
  672. @Html.Hidden("hiddenFldUrlAttachmentsList", @Url.Action("AttachmentsList", "Attachment", new { area = string.Empty }))
  673. <script>
  674.     var tAdv = $(".tabAdvanced").treetable({ expandable: true, initialState: "collapsed" });
  675.  
  676.     $(".tabAdvanced tbody tr").each(function () {
  677.         $(this).removeClass("hidden");
  678.                     });
  679.  
  680.     $(".fixTable").tableFixer();
  681.  
  682.     $(".decValue").autoNumeric("init", { lZero: "deny", aSep: " ", mDec: 2, aDec: ","});
  683.  
  684.     function setTreetable() {
  685.         tAdv.sortable();
  686.         tAdv.sortable("disable");
  687.  
  688.         tAdv.treetable("expandAll");
  689.     }
  690.  
  691.     $(document).ready(function () {
  692.         setTreetable();
  693.  
  694.         $("#editModal").on('hidden.bs.modal', function () {
  695.             $("#editModalBodyDiv").html("");
  696.         })
  697.  
  698.         tAdv.on("mouseover", ".td_cc", function (evt) {
  699.                             var val = $(this).attr("data-code");
  700.                             if (val !== undefined && val !== null && val !== "") {
  701.                                 var sel = JSON.parse('@Html.Raw(Json.Encode(ViewBag.CostsCodes))');
  702.                                 var name = "";
  703.                                 $.each(sel, function (index, item) {
  704.                                     name = item.description;
  705.                                     var code = item.code;
  706.                                     return (code != val);
  707.                                 });
  708.                                 $(this).attr("title", name);
  709.                             };
  710.         });
  711.  
  712.         $(".btnFreze").click(function (evt) {
  713.             if ($(this).hasClass("btn-default")) {
  714.                 $(this).removeClass("btn-default").addClass("btn-warning");
  715.                 $(".fixTable").tableFixer({ head: true, "left": 1 });
  716.             }
  717.             else {
  718.                 $(this).removeClass("btn-warning").addClass("btn-default");
  719.                 $(".fixTable").tableFixer({ head: true, "left": -1 });
  720.  
  721.             }
  722.         });
  723.  
  724.         tAdv.sortable({
  725.             items: 'tr:not(tr:first-child)',
  726.             cursor: 'crosshair',
  727.             axis: 'y',
  728.             dropOnEmpty: false,
  729.             distance: 30,
  730.             opacity: 0.6,
  731.             start: function (e, ui) {
  732.                                 ui.item.addClass("selected");
  733.             },
  734.             stop: function (e, ui) {
  735.                 var src_parent = ui.item.attr("data-tt-parent-id");
  736.                 var trg_parent = ui.item.prev().attr("data-tt-parent-id");
  737.                 var src = ui.item.attr("data-tt-id");
  738.                 var trg = ui.item.prev().attr("data-tt-id");
  739.                 var leaf = ui.item.attr("data-leaf");
  740.                 if (leaf === "True") {
  741.                     if (typeof trg !== "undefined" && typeof trg_parent !== "undefined") {
  742.                         if (src_parent === trg_parent || src_parent === trg) {
  743.                             var projId = ui.item.attr("data-id_proj");
  744.                             $.ajax({
  745.                                 type: 'POST',
  746.                                 url: '@Url.Action("ChangePositionOfLeafs", new { area = "HQ", controller = "Projects" })',
  747.                                 data: { src: src, after: trg, parent: src_parent, proj: projId },
  748.                                 success: function (data) {
  749.                                             var nodes = data;
  750.                                             nodes.forEach(function (node, i) {
  751.                                                 var row = tAdv.find("[data-id_node=" + node.id_node + "]");
  752.                                                 row.attr("data-tt-id", node.tt_id);
  753.                                                 row.attr("data-tt-id", node.tt_id);
  754.                                             });
  755.                                             $(".btnChangeStruct").click();
  756.                                             alert("Dokonano zmiany struktury!");
  757.                                         },
  758.                                 error: function () {
  759.                                             tAdv.sortable("cancel");
  760.                                             $(".btnChangeStruct").click();
  761.                                             alert('Error in leafs page');
  762.                                         }
  763.                             });
  764.                             ui.item.removeClass("selected");
  765.                         }
  766.                         else {
  767.                             tAdv.sortable("cancel");
  768.                             alert("Brak zgodności węzła!");
  769.                         }
  770.                     }
  771.                     else {
  772.                         tAdv.sortable("cancel");
  773.                     }
  774.                 }
  775.                 else {
  776.                     tAdv.sortable("cancel");
  777.                     alert("Przesuwanie tylko dla liści!");
  778.                 }
  779.                 /*
  780.                 $(this).find("tr").each(function (index) {
  781.                     if (index > 0) {
  782.                         var trg = $(this).attr("data-tt-id");
  783.                         var trg_parent = $(this).attr("data-tt-parent-id");
  784.                         $(this).find("td").eq(1).html(index);
  785.                     }
  786.                 });
  787.                 */
  788.             }
  789.         });
  790.  
  791.         tAdv.on("mousedown", ".td_item > span.indenter a", function (evt) {
  792.             evt.stopPropagation();
  793.         });
  794.  
  795.         tAdv.on("mousedown", ".td_item", function (evt) {
  796.             if (event.which === 1) {
  797.                 $(".btnNone").hide();
  798.                 if ($(".btnChangeStruct").hasClass("btn-default")) {
  799.                     $(this).parent().toggleClass("selected");
  800.                     var selectedItems = $(".tabAdvanced tr.selected");
  801.                     var areAllLeafs = true;
  802.                     selectedItems.each(function () {
  803.                         if (!$(this).hasClass("leaf")) {
  804.                             areAllLeafs = false;
  805.                         }
  806.                     });
  807.  
  808.                     if (selectedItems.length === 1 && areAllLeafs) {
  809.                         $("#approvalBtn").show();
  810.                     }
  811.                     else {
  812.                         $("#approvalBtn").hide();
  813.                     }
  814.                 }
  815.                 else {
  816.                     $(this).parent().toggleClass("selected").siblings().removeClass("selected");
  817.                     var src = $(this).parent().attr("data-tt-parent-id");
  818.                     $(".tabAdvanced tbody tr").each(function () {
  819.                                         if ($(this).attr("data-tt-parent-id") === src) {
  820.                                             tAdv.treetable("collapseNode", $(this).attr("data-tt-id"));
  821.                                         }
  822.                                     });
  823.                     tAdv.addClass("table-bordered");
  824.                 }
  825.             }
  826.         });
  827.  
  828.         $(".btnCreateT0").click(function (evt) {
  829.             var url = $(this).data("link");
  830.             window.location.href = url;
  831.         });
  832.  
  833.         $(".btnMPKFile").click(function (evt) {
  834.                             var url = $(this).data("link");
  835.                             window.location.href = url;
  836.                         });
  837.  
  838.         $(".btnThBottom").click(function (evt) {
  839.                             if ($(this).hasClass("btn-default")) {
  840.                                 var row = $('.tabAdvanced > tbody').find('.selected');
  841.                                 if (row.length > 0) {
  842.                     $(this).removeClass("btn-default").addClass("btn-success");
  843.                                     var index = row.data("id");
  844.                                     var rr = $(".tabAdvanced tr:eq(1)").clone(true);
  845.                                     rr.find('th').each(function () {
  846.                         $(this).removeAttr("title");
  847.                                     });
  848.                                     rr.addClass("header-show");
  849.                     $('.tabAdvanced > tbody > tr').eq(index).before(rr);
  850.                                 }
  851.                             }
  852.             else {
  853.                                 var row = $('.tabAdvanced > tbody').find('.header-show');
  854.                                 if (row.length > 0) {
  855.                                     row.remove();
  856.                                 }
  857.                 $(this).removeClass("btn-success").addClass("btn-default");
  858.                             }
  859.                         });
  860.  
  861.         $(document).on("click", ".btnOwnerNode", function () {
  862.  
  863.             var nodeID = $(this).data("id");
  864.             var url = $("#AddEditAssignUserUrl").val() + "&nodeID=" + nodeID;
  865.  
  866.             $("#editDetailsModalBodyDiv").load(url, function () {
  867.                 $("#editDetailsModal").modal("show");
  868.             });
  869.         });
  870.  
  871.         $(".btnRealisation").click(function () {
  872.                             var id = $(this).data('id');
  873.                             var url = $("#RealisationUrl").val() + "&id=" + id;
  874.             $("#editModalBodyDiv").load(url, function () {
  875.                 $("#editModal").modal("show");
  876.                             });
  877.                         })
  878.  
  879.  
  880.         $("#btnAddPatternCT").click(function () {
  881.                             var selectedRows = $('tr.selected');
  882.  
  883.                             var data = new FormData();
  884.                             var i = 0;
  885.                             selectedRows.each(function () {
  886.                                 var idNode = $(this).data('id_node');
  887.                                 var ttId = $(this).data('tt-id')
  888.                                 data.append("[" + i + "].id_node", idNode );
  889.                                 data.append("[" + i + "].tt_id", ttId );
  890.                                 i++;
  891.  
  892.                             });
  893.  
  894.             data.append('projectId', '@ViewBag.projId');
  895.  
  896.             var url = $("#PatternCTUrl").val()
  897.  
  898.             $.post({
  899.                 url: url,
  900.                 data: data,
  901.                 processData: false,
  902.                 contentType: false,
  903.                 statusCode: {
  904.                     200: function (data) {
  905.                         $("#editModalBodyDiv").html(data);
  906.                         $("#editModal").modal("show");
  907.                     },
  908.                     303: function (data) {
  909.                         var id = data.responseJSON;
  910.                         var redirectUrl = window.location.pathname + "?projId=" + id;
  911.                         window.location.href = redirectUrl;
  912.                     },
  913.                     400: function (data) {
  914.                         if (typeof data.responseJSON == 'undefined') {
  915.                             alert("Error on PatternComparsionTable page")
  916.                         }
  917.                         else {
  918.                             alert(data.responseJSON)
  919.                         }
  920.                     },
  921.                 }
  922.             });
  923.         })
  924.  
  925.         $(document).on("click", ".btnAddEditReserve", function () {
  926.  
  927.             var nodeId = $(this).data("id");
  928.             var projId = $(this).data("id_proj");
  929.             var url = $("#AddEditReserveUrl").val();
  930.  
  931.             url += "/?projectMpkId=" + projId + "&nodeId=" + nodeId;
  932.  
  933.             $("#editDetailsModalBodyDiv").load(url, function () {
  934.                 $("#editDetailsModal").modal("show");
  935.             });
  936.  
  937.         });
  938.  
  939.         $("#btnAttachmentsList").click(function () {
  940.             var projectId = $("#projectId").val();
  941.             var url = $("#hiddenFldUrlAttachmentsList").val() + "?projectId=" + projectId;
  942.             $("#attachmentsListModalBody").load(url, function () {
  943.                 $("#attachmentsListModal").modal("show");
  944.             });
  945.         });
  946.  
  947.         $(".btnAcceptDescription").click(function (evt) {
  948.             var projId = '@ViewBag.ProjectId';
  949.             var url = '@Url.Action("EditProjectDescription", "Projects", new { area = "HQ" })' + "?projId=" + projId;
  950.             $("#editModalAcceptDescriptionBodyDiv").load(url, function () {
  951.                 $("#editModalAcceptDescription").modal("show");
  952.             });
  953.         });
  954.  
  955.         $(".btnAccept").click(function (evt) {
  956.             var projId = '@ViewBag.ProjectId';
  957.             var work = $(this).data("vw");
  958.             var urlname = '@Url.Action("ProjectMPKFile", "Projects", new { area = "HQ" })' + "/?projId=" + projId;
  959.             var url = '@Url.Action("AcceptPathProject", "Projects", new { area = "HQ" })' + "/?projId=" + projId + "&work=" + work;
  960.             alert(url);
  961.             $.ajax({
  962.                 type: "POST",
  963.                 url: url,
  964.                 success: function () {
  965.                     window.location.href = urlname;
  966.                 },
  967.                 error: function (result) {
  968.                         alert('Error in edit project page');
  969.                     }
  970.                 });
  971.         });
  972.  
  973.         $(".btnSchedule").click(function () {
  974.             $('table > tbody').find('.selected').each(function () {
  975.                 var leaf = $(this).data("leaf");
  976.                 if (leaf === "True") {
  977.                     var length = $('td', this).length;
  978.                     var val_cj = $('td:eq(4) input', this).val();
  979.                     var val_il = $('td:eq(5) input', this).val();
  980.                     var i = 11;
  981.                     length = length - i;
  982.                     var f_val_il = parseFloat(val_il) / parseFloat(length);
  983.                     f_val_il = f_val_il.toFixed(2);
  984.                     while (i < length) {
  985.                         $('td:eq(' + i + ') input', this).val(val_cj);
  986.                         var j = i + 1;
  987.                         $('td:eq(' + j + ') input', this).val(f_val_il);
  988.                         var val = parseFloat(val_cj) * f_val_il;
  989.                         val = val.toFixed(2);
  990.                         j = j + 1;
  991.                         $('td:eq(' + j + ') input', this).val(val);
  992.                         i = i + 3;
  993.                     }
  994.                 }
  995.             });
  996.         });
  997.     });
  998.  
  999. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement