Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @model List<bITup.Areas.HQ.Models.ProjectsMPKnodeVM>
- @using bITup.Common;
- @{
- /**/
- ViewBag.Title = "ProjectData Page";
- var noedit = "";
- var moveLeafToKnot = "";
- if ((ViewBag.Code == (Int16)Enums_HQ.BudgetType.BudgetZero || ViewBag.Code == (Int16)Enums_HQ.BudgetType.BudgetZeroRevisory)
- || ViewBag.Code == (Int16)Enums_HQ.BudgetType.BudgetAnother)
- {
- moveLeafToKnot = "TAK";
- }
- bITup.CustomAuthentication.CustomPrincipal identity = ((bITup.CustomAuthentication.CustomPrincipal)HttpContext.Current.User);
- }
- <link rel="stylesheet" href="~/Content/jquery.treetable.css" />
- <link rel="stylesheet" href="~/Content/jquery.treetable.theme.default.css" />
- <link rel="stylesheet" href="~/Content/select2.min.css" />
- <link rel="stylesheet" href="~/Content/select2-bootstrap.min.css" />
- <script src="~/Scripts/jquery-ui-1.12.1.min.js"></script>
- <script src="~/Scripts/jquery.treetable.js"></script>
- <script src="~/Scripts/tableHeadFixer.js"></script>
- <script src="~/Scripts/select2.full.min.js"></script>
- <style>
- #parent {
- height: 80vh;
- width: 100%;
- overflow: auto;
- background: linear-gradient(#dae6f1, #ffffff, #dae6f1);
- }
- #fixTable {
- width: 1800px !important;
- margin-top: -2px;
- }
- /* dotyczy listy rozwijalnej z mozliwoscia wyszukiwania */
- table.treetable td.withoutPadding span:not(.select2-selection) {
- padding: 0;
- }
- </style>
- @Html.Hidden("projectId", (int)ViewBag.projectId)
- @Html.Hidden("projectCode", (Int16)ViewBag.Code)
- @Html.Hidden("AddEditAssignUserUrl", Url.Action("AddEditAssignUser", "Projects", new { area = "HQ", projectID = ViewBag.ProjectId }))
- @Html.Hidden("RealisationUrl", Url.Action("Realistation", "Projects", new { area = "HQ", projectId = ViewBag.ProjectId }))
- @Html.Hidden("AddEditReserveUrl", Url.Action("AddEditReserve", "Projects", new { area = "HQ" }))
- @Html.Hidden("PatternCTUrl", @Url.Action("AddPatternCT", "Projects", new { area = "HQ" }))
- @Html.Hidden("AddEditReserveUrl", Url.Action("AddEditReserve", "Projects", new { area = "HQ" }))
- @Html.Hidden("AddEditScheduleForAmountUrl", Url.Action("AddEditScheduleForAmount", "Projects", new { area = "HQ", projectId = ViewBag.ProjectId }))
- <div class="container-kz-f background-kz" style="margin-top:0;">
- @using (Html.BeginForm("ProjectMPKData", "Projects", FormMethod.Post, new { id = "ProjectMPKDataForm" }))
- {
- <div class="col-md-12">
- <div class="col-md-3">
- <h4>@ViewBag.Header</h4>
- </div>
- <div class="col-md-2" style="text-align:right;color:firebrick;">
- @{
- var code = Enums.GetEnumDescription<Enums_HQ.BudgetType>(ViewBag.Code);
- }
- <h4>@code</h4>
- </div>
- <div class="col-md-7" style="text-align:right">
- @if (ViewBag.Code != (Int16)Enums_HQ.BudgetType.ComparativeTable && ViewBag.Code != (Int16)Enums_HQ.BudgetType.PositionsWSW
- && ViewBag.Code != (Int16)Enums_HQ.BudgetType.ComparativeTablePattern)
- {
- if (ViewBag.Status == (Int16)Enums_HQ.ProjectStatusType.New && ViewBag.Code == (Int16)Enums_HQ.BudgetType.BudgetZero &&
- DBL.IdUser_VIPProject(identity.id_user, ViewBag.ProjectId, ViewBag.Status, "vocation_person"))
- {
- <input href="#" type="button" value="Skieruj do akceptacji" class="btnAccept btn btn-warning" data-vw="appointing_projects" />
- <input href="#" type="button" value="Uwagi akceptujących" class="btn btn-default btnAcceptDescription" data-vw="appointing_projects" />
- }
- if (ViewBag.Status == (Int16)Enums_HQ.ProjectStatusType.InApproval && DBL.IdUser_VIPProject(identity.id_user, ViewBag.ProjectId, ViewBag.Status, "approval_kpp"))
- {
- <input href="#" type="button" value="Akceptuj" class="btnAccept btn btn-warning" data-vw="approval_budget_zero" />
- <input href="#" type="button" value="Uwagi akceptujących" class="btn btn-default btnAcceptDescription" data-vw="approval_budget_zero" />
- }
- <input href="#" type="button" value="Zablokuj tytuły" class="btn btn-default btnFreze" />
- <input href="#" type="button" value="Zmień położenie liścia" class="btn btn-default btnChangeStruct" />
- <input href="#" type="button" value="Rozwiń wszystko" class="btnExpandAll btn btn-default" />
- <input href="#" type="button" value="Zwiń wszystko" class="btnCollapseAll btn btn-default" />
- }
- <input href="#" type="button" value="Zmień położenie liścia" class="btn btn-default btnChangeStruct hidden" />
- </div>
- </div>
- <div class="col-md-12" style="padding-bottom:6px;">
- <div class="col-md-7">
- @{
- if (ViewBag.Code != (Int16)Enums_HQ.BudgetType.ComparativeTable && ViewBag.Code != (Int16)Enums_HQ.BudgetType.BudgetAnother
- && ViewBag.Code != (Int16)Enums_HQ.BudgetType.PositionsWSW && ViewBag.Code != (Int16)Enums_HQ.BudgetType.ComparativeTablePattern)
- {
- switch (ViewBag.Code)
- {
- case Enums_HQ.BudgetType.TopSheet:
- <input type="button" value="Załączniki" id="btnAttachmentsList" class="btn btn-link" />
- <input href="#" type="button" value="Kreacja B0" class="btnCreateT0 btn btn-link"
- data-link="@Url.Action("CreateBudgetT0", "Projects", new { area = "HQ", projIdd = ViewBag.ProjectId })" />
- break;
- case (Int16)Enums_HQ.BudgetType.BudgetZero:
- @*@<input href="#" type="button" value="Rewizja B0" class="btnTR btn btn-link" data-sb="Kreacja rewizji budżetu zero" />*@
- if (ViewBag.Status == (Int16)Enums_HQ.ProjectStatusType.InRealization)
- {
- <input type="button" value="Stwórz szablon" id="btnAddPatternCT" class="btn btn-link" />
- <input href="#" type="button" value="Tabele porównawcze" name="submitButton" class="btnMPKFile btn btn-link"
- data-link="@Url.Action("ProjectMPKFile", "Projects", new { area = "HQ", projId = ViewBag.ProjectId, file = (Int16)Enums_HQ.BudgetType.ComparativeTable })" />
- }
- break;
- case (Int16)Enums_HQ.BudgetType.BudgetRealization:
- <input href="#" type="button" value="Kreacja pozycji ofertowych" class="btnTP btn btn-link"
- data-typeId="@((Int16)(Int16)Enums_HQ.BudgetType.ComparativeTable)" data-id="@ViewBag.ProjId" />
- break;
- }
- }
- if (ViewBag.Code != (Int16)Enums_HQ.BudgetType.ComparativeTable && ViewBag.Code != (Int16)Enums_HQ.BudgetType.PositionsWSW
- && ViewBag.Code != (Int16)Enums_HQ.BudgetType.ComparativeTablePattern)
- {
- <input href="#" type="button" value="Powrót do listy budżetów" class="btnReturn btn btn-link"
- data-link="@Url.Action("ProjectMPKFile", "Projects", new { area = "HQ", projId = ViewBag.ProjectId, file = ViewBag.Code })" style="color:firebrick" />
- }
- else
- {
- var actionLinkText = "";
- switch ((int)ViewBag.Code)
- {
- case (int)Enums_HQ.BudgetType.PositionsWSW:
- actionLinkText = "Powrót do listy pozycji WSW";
- break;
- case (int)Enums_HQ.BudgetType.ComparativeTablePattern:
- <div class="dropdown dropdownInline">
- <button class="btn btn-link dropdown-toggle" id="createComparativeTablesMenu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
- Kreacja pozycji
- </button>
- <div class="dropdown-menu drodownmenu-text-center-kz" aria-labelledby="createComparativeTablesMenu">
- <input href="#" type="button" value="Ofertowych" name="submitButton" class="btnTP btn btn-link" data-sb="Kreacja pozycji ofertowych"
- data-id="@ViewBag.ProjId" data-idtype="@((Int16)Enums_HQ.BudgetType.ComparativeTable)" />
- <input href="#" type="button" value="Ofertowych - aneks" name="submitButton" class="btnTP btn btn-link" data-sb="Kreacja pozycji ofertowych"
- data-id="@ViewBag.ProjId" data-idtype="@((Int16)Enums_HQ.BudgetType.ComapartiveTableAnnex)" />
- <input href="#" type="button" value="Aprobaty" name="submitButton" class="btnTP btn btn-link" data-sb="Kreacja pozycji ofertowych"
- data-id="@ViewBag.ProjId" data-idtype="@((Int16)Enums_HQ.BudgetType.CostApproval)" id="approvalBtn" style="display:none;" />
- </div>
- </div>
- actionLinkText = "Powrót do listy szablonów";
- break;
- case (int)Enums_HQ.BudgetType.ComparativeTable:
- actionLinkText = "Powrót do listy tabel";
- break;
- }
- @Html.ActionLink(actionLinkText, "ProjectMPKFile", new {controller = "Projects" ,area = "HQ", projId = ViewBag.ProjectId,
- file = (int)ViewBag.Code }, new { @style = "color:firebrick" })
- }
- }
- </div>
- <div class="col-md-5" style="text-align:right;">
- @{
- if (ViewBag.Code != (Int16)Enums_HQ.BudgetType.ComparativeTable && noedit != "TAK")
- {
- <input href="#" type="button" value="Zapisz zmiany danych" class="btn btn-info btnSaveNodes btnEnabled" data-id="@ViewBag.ProjId" />
- if (ViewBag.Code == (Int16)Enums_HQ.BudgetType.BudgetZero)
- {
- <input href="#" type="button" value="Rozpisz harmonogram" class="btnSchedule btnEnabled btn btn-default" />
- }
- <input href="#" type="button" value="Agregacja" class="btnCalcAggre btn btn-default btnEnabled" data-id="@ViewBag.ProjId" data-sb="2" />
- @Html.TextBox("UrlCalculateOrAndAggregateFieldsNodes", @Url.Action("CalculateOrAndAggregateFieldsNodes", "Projects", new { area = "HQ" }), new { style = "display: none;" })
- }
- if (ViewBag.Code == (Int16)Enums_HQ.BudgetType.BudgetZeroFromTS && ViewBag.Contracting != "TAK")
- {
- <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" />
- }
- <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" />
- if ((ViewBag.Code != (Int16)Enums_HQ.BudgetType.ComparativeTable && ViewBag.Code != (Int16)Enums_HQ.BudgetType.ComparativeTablePattern) && noedit != "TAK")
- {
- <input href="#" type="button" value="Import z .xlsx" name="submitButton" class="btn btn-default btnAddBudgetFromExcel dropdown-item" data-id="@ViewBag.ProjId" />
- <input type="file" name="attach" id="importExcel" multiple="" data-link="@Url.Action("AddBudgetFromExcel", "Projects", new { area = "HQ" })" data-id="@ViewBag.ProjId" style="display:none" />
- <input href="#" type="button" value="Wylicz" class="btnCalcAggre btn btn-default btnEnabled" data-id="@ViewBag.ProjId" data-sb="1" />
- @*<input href="#" type="button" value="Agregacja" class="btnCalcAggre btn btn-default btnEnabled" data-id="@ViewBag.ProjId" data-sb="2" />*@
- @Html.TextBox("UrlSaveChangeStructureNodes", @Url.Action("SaveChangeStructureNodes", "Projects", new { area = "HQ" }), new { style = "display: none;" })
- @Html.TextBox("UrlStyleLeafOfKnotNodes", @Url.Action("StyleLeafOfKnotNodes", "Projects", new { area = "HQ" }), new { style = "display: none;" })
- }
- @Html.TextBox("UrlSaveNodes", @Url.Action("SaveNodes", "Projects", new { area = "HQ" }), new { style = "display: none;" })
- @Html.TextBox("UrlDelKnotOrLeaf", @Url.Action("DelKnotOrLeaf", "Projects", new { area = "HQ" }), new { style = "display: none;" })
- }
- </div>
- </div>
- @Html.AntiForgeryToken()
- if (Model.Count > 0)
- {
- <div id="parent">
- <table class="tabAdvanced fixTable">
- <thead>
- <tr class="tr-kz-header-un" style="height:2.55em;">
- <th style="text-align:center;"> </th>
- <th style="text-align:center;"> </th>
- <th style="text-align:center;"> </th>
- @foreach (var item in ViewBag.Conf)
- {
- if (item.active && item.colspan_no > 0)
- {
- var stth = "border: 1px solid #dae6f1;text-align:center;";
- string[] stx = item.style_html.Split(';');
- for (int i = 0; i < stx.Count(); i++)
- {
- if (stx[i].Contains("background-color"))
- {
- stth = stth + stx[i] + ";";
- };
- };
- <th colspan=@item.colspan_no style="@stth">
- @item.colspan_title
- </th>
- }
- }
- </tr>
- <tr class="tr-kz-header" style="height:2.55em;">
- <th style="text-align:center">
- @Html.DisplayName("Określenie")
- </th>
- <th style="text-align:center">
- @Html.DisplayName("Kod kosztu")
- </th>
- @{
- var st = "";
- if (noedit != "")
- {
- st = "display: none;";
- }
- }
- <th style="@st">
- </th>
- @foreach (var item in ViewBag.Conf)
- {
- if (item.active)
- {
- <th style="text-align:center" class="th_item" data-id="@item.id_conf" title="Kliknij w celu wyświetlenia detali konfiguracji">
- @item.name
- </th>
- }
- }
- </tr>
- </thead>
- <tbody>
- @for (int i = 0; i < Model.Count(); i++)
- {
- var clas = "";
- if (Model[i].through_magazine)
- {
- clas = "text-warning-kz";
- }
- if (Model[i].magazine_id > 0)
- {
- clas = "text-info-kz";
- }
- var tit = Model[i].name + " " + Model[i].tt_id;
- var trhidden = "hidden";
- if (i == 0)
- {
- trhidden = "";
- }
- <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"
- 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">
- @Html.ValidationSummary(true, "", new { @class = "text-danger" })
- @Html.HiddenFor(model => Model[i].id_node)
- @Html.HiddenFor(model => Model[i].proj_id)
- @Html.HiddenFor(model => Model[i].leaf)
- @Html.HiddenFor(model => Model[i].parent_id_node)
- @Html.HiddenFor(model => Model[i].name)
- @Html.HiddenFor(model => Model[i].span_class)
- @Html.HiddenFor(model => Model[i].tt_id)
- @Html.HiddenFor(model => Model[i].tt_parent_id)
- @Html.HiddenFor(model => Model[i].new_tt_parent_id)
- @Html.HiddenFor(model => Model[i].uniq)
- @Html.HiddenFor(model => Model[i].code_cost)
- <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">
- <span id="item_span" class="@Model[i].span_class">@Model[i].name</span>
- </td>
- <td style="text-align:center;" class="td_cc" data-code="@Model[i].code_cost" title="">
- @Html.CheckBoxFor(model => Model[i].through_magazine, new { @class = "through_magazine hidden" })
- @Html.EditorFor(model => Model[i].magazine_id, new { htmlAttributes = new { @class = "magazine_id hidden" } })
- @*@Html.EditorFor(model => Model[i].tt_id, new { htmlAttributes = new { @class = "tt_id hidden" } })*@
- @Html.CheckBoxFor(model => Model[i].rolling_up, new { @class = "rolling_up hidden" })
- @Model[i].code_cost
- </td>
- <td style="@st">
- <div id="dropdown" class="dropdown">
- <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>
- <ul class="dropdown-menu btn btn-link" style="background-color:#fff;border:2px solid firebrick;">
- @{
- if (tit != "")
- {
- var style_unsr = "";
- var style_sr = "display: none;";
- if (Model[i].rolling_up)
- {
- style_unsr = "display:none;";
- style_sr = "";
- }
- <li id="set_rolling" style="@style_sr"><input href="#" type="button" value="Zawiń tekst" class="btnRollingText btnEnabled btn-link" /></li>
- <li id="unset_rolling" style="@style_unsr"><input href="#" type="button" value="Rozwiń tekst" class="btnRollingText btnEnabled btn-link" /></li>
- }
- if (Model[i].leaf)
- {
- if (!Model[i].through_magazine)
- {
- <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>
- <li><input href="#" type="button" value="Wykonanie" class="btnRealisation btnEnabled btn-link" data-id="@Model[i].id_node" /></li>
- }
- }
- else
- {
- <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>
- <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>
- }
- if (!Model[i].leaf)
- {
- <li><input href="#" type="button" value="Dodaj węzeł" class="btnAddKnot btnEnabled btn-link" data-id="@Model[i].id_node" data-refreshtype="3" /></li>
- }
- @*if (!string.IsNullOrEmpty(Model[i].tt_parent_id) && !Model[i].through_magazine)*@
- if (!Model[i].through_magazine)
- {
- <li><input href="#" type="button" value="Dodaj liść" class="btnAddLeaf bbtnEnabled btn-link" data-id="@Model[i].id_node" data-refreshtype="3" /></li>
- }
- if (!Model[i].leaf && Model[i].has_leaf > 0 && Model[i].has_knot == 0 && moveLeafToKnot != "")
- {
- <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>
- }
- if (!string.IsNullOrEmpty(Model[i].tt_parent_id) && (Model[i].leaf || (!Model[i].leaf && Model[i].has_knot == 0 && Model[i].has_leaf == 0)))
- {
- if (Model[i].is_available == 0 && !Model[i].through_magazine)
- {
- <li><input href="#" type="button" value="Usuń element" class="submitDelete btnEnabled btn-link" data-id="@Model[i].id_node" data-modelname="3" /></li>
- }
- }
- if (Model[i].leaf && (Model[i].magazine_id == null || Model[i].magazine_id <= 0))
- {
- var style_tm = "";
- var style_utm = "display: none;";
- if (Model[i].through_magazine)
- {
- style_tm = "display:none;";
- style_utm = "";
- }
- <li id="set_trough" style="@style_tm"><input href="#" type="button" value="Integruj z magazynem" class="btnVM btnEnabled btn-link" /></li>
- <li id="unset_trough" style="@style_utm"><input href="#" type="button" value="Usuń integrację z magazynem" class="btnVMRemove btnEnabled btn-link" /></li>
- <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>
- }
- if (Model[i].through_magazine)
- {
- if (Model[i].magazine_id > 0)
- {
- <li><input href="#" type="button" value="Podgląd jednostki magazynowej" class="btnViewVM btnEnabled btn-link" data-id="@Model[i].magazine_id" /></li>
- }
- }
- if (ViewBag.Code == (Int16)Enums_HQ.BudgetType.BudgetZero)
- {
- <li><input href="#" type="button" value="Właściciel pozycji" class="btnOwnerNode btnEnabled btn-link" data-id="@Model[i].id_node" /></li>
- }
- if (ViewBag.Code == (Int16)Enums_HQ.BudgetType.BudgetZeroFromTS)
- {
- <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>
- }
- }
- </ul>
- </div>
- </td>
- @{
- for (int j = 0; j < Model[i].v_values.Count(); j++)
- {
- @Html.HiddenFor(model => Model[i].v_values[j].node_id)
- @Html.HiddenFor(model => Model[i].v_values[j].conf_id)
- @Html.HiddenFor(model => Model[i].v_values[j].id_value)
- if (ViewBag.Conf[j].active)
- {
- var styl = ViewBag.Conf[j].style_html;
- if (ViewBag.Code == (Int16)Enums_HQ.BudgetType.ComparativeTablePattern && j == 0)
- {
- styl += "; background-color: khaki !important";
- }
- if (ViewBag.Conf[j].type_field == "Wyliczalne")
- {
- styl = styl + ";" + "background-color:#dae6f1;";
- }
- <td>
- @if (Model[i].leaf)
- {
- if (ViewBag.Conf[j].type_field == "Słownik")
- {
- if (ViewBag.Conf[j].available && noedit == "")
- {
- styl = styl + ";background-color: #ffffff;";
- @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 })
- }
- else
- {
- @*@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" })*@
- @Html.TextBoxFor(model => Model[i].v_values[j].value,
- 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" })
- }
- }
- else
- {
- if (ViewBag.Conf[j].type_field == "Pole tekstowe")
- {
- if (ViewBag.Conf[j].available && noedit == "")
- {
- styl = styl + ";background-color: #ffffff;";
- @Html.TextBoxFor(model => Model[i].v_values[j].value,
- 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 })
- }
- else
- {
- @Html.TextBoxFor(model => Model[i].v_values[j].value,
- 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" })
- }
- }
- else
- if (ViewBag.Conf[j].type_field == "Liczba")
- {
- if (ViewBag.Conf[j].available && noedit == "")
- {
- styl = styl + ";background-color: #ffffff;";
- @Html.EditorFor(model => Model[i].v_values[j].value,
- 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 } })
- }
- else
- {
- @Html.EditorFor(model => Model[i].v_values[j].value,
- 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" } })
- }
- }
- else
- if (ViewBag.Conf[j].type_field == "Wyliczalne")
- {
- @Html.TextBoxFor(model => Model[i].v_values[j].value,
- new
- {
- @class = "form-control width-150-24 decValue calculateMPK",
- @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_mask = @ViewBag.Conf[j].mask,
- @readonly = "readonly",
- @title = "Kliknij dwukrotnie w celu aktywacji kalkulatora"
- })
- }
- }
- }
- else
- {
- if (ViewBag.Conf[j].type_field == "Liczba" || ViewBag.Conf[j].type_field == "Wyliczalne")
- {
- @Html.TextBoxFor(model => Model[i].v_values[j].value,
- 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" })
- }
- else
- {
- @Html.TextBoxFor(model => Model[i].v_values[j].value,
- 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" })
- }
- }
- </td>
- }
- }
- }
- </tr>
- }
- </tbody>
- <thead id="th-bottom" style="display:none">
- <tr class="tr-kz-header" style="height:36px;">
- <th width="350px" style="text-align:center">
- @Html.DisplayName("Określenie")
- </th>
- <th width="75px;">
- Aktywny
- </th>
- <th width="160px;">
- </th>
- @foreach (var item in ViewBag.Conf)
- {
- if (item.active)
- {
- <th width="160px;" style="text-align:center" class="th_item" data-id="@item.id_conf" title="Kliknij w celu wyświetlenia detali konfiguracji">
- @item.name
- </th>
- }
- }
- </tr>
- </thead>
- </table>
- </div>
- <div>
- <h5 style="text-align:center;">
- <strong>
- <a1 class="text-info-kz" style="margin-left:12px;">
- Pozycja przypisana do magazynu
- </a1>
- </strong>
- <strong>
- <a1 class="text-warning-kz" style="margin-left:12px;">
- Pozycja rozliczana poprzez magazyn - brak integracji
- </a1>
- </strong>
- <strong>
- <a1 class="text-danger-kz" style="margin-left:12px;">
- Pozycja przypisana do magazynu - brak zapisu w bazie
- </a1>
- </strong>
- </h5>
- </div>
- }
- }
- <div class="modal" id="editModal">
- @Html.TextBox("UrlCreateTP", @Url.Action("CreateTP", "Projects", new { area = "HQ" }), new { style = "display: none;" })
- @Html.Hidden("SelectAgreementForAnnexeUrl", @Url.Action("SelectAgreementForAnnexe", "Agreements", new { area = "HQ" }))
- <div class="modal-dialog" style="width:90%;">
- <div class="modal-content">
- <div class="modal-body" id="editModalBodyDiv">
- </div>
- </div>
- </div>
- </div>
- <div class="modal" id="editDetailsModal">
- @Html.TextBox("UrlAddEditKnotOrLeaf", @Url.Action("AddEditKnotOrLeaf", "Projects", new { area = "HQ" }), new { style = "display: none;" })
- @Html.TextBox("UrlMoveLeafToKnot", @Url.Action("MoveLeafToKnot", "Projects", new { area = "HQ" }), new { style = "display: none;" })
- @Html.TextBox("UrlProjectMPKData", @Url.Action("ProjectMPKData", "Projects", new { area = "HQ" }), new { style = "display: none;" })
- @Html.TextBox("UrlUserAcceptStep", @Url.Action("UserAcceptStep", "Projects", new { area = "HQ" }), new { style = "display: none;" })
- <div class="modal-dialog">
- <div class="modal-content">
- <div class="modal-body" id="editDetailsModalBodyDiv">
- </div>
- </div>
- </div>
- </div>
- <div class="modal" id="virtualStoreModal">
- @Html.TextBox("UrlShowStoreItemsToSelectOne", @Url.Action("ShowStoreItemsToSelectOne", "VirtualStore", new { area = "HQ" }), new { style = "display: none;" })
- @Html.TextBox("UrlShowStoreForBudgetPreview", @Url.Action("ShowStoreForBudgetPreview", "VirtualStore", new { area = "HQ" }), new { style = "display: none;" })
- <div class="modal-dialog" style="width:70%">
- <div class="modal-content">
- <div class="modal-body" id="virtualStoreBodyModal">
- </div>
- </div>
- </div>
- </div>
- <div class="modal" id="configViewModal">
- @Html.TextBox("UrlDetailsNetConfig", @Url.Action("DetailsNetConfig", "Projects", new { area = "HQ" }), new { style = "display: none;" })
- <div class="modal-dialog" style="width:15%">
- <div class="modal-content">
- <div class="modal-body" id="configViewModalBodyDiv">
- </div>
- </div>
- </div>
- </div>
- <div class="modal" id="calculateModal">
- @Html.TextBox("UrlCalculateMPK", @Url.Action("CalculateMPK", "Projects", new { area = "HQ" }), new { style = "display: none;" })
- <div class="modal-dialog">
- <div class="modal-content">
- <div class="modal-body" id="calculateModalBodyDiv">
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="modal" id="attachmentsListModal">
- <div class="modal-dialog" style="width:40%">
- <div class="modal-content">
- <div class="modal-body" id="attachmentsListModalBody"></div>
- </div>
- </div>
- </div>
- <div class="modal" id="attachmentModal">
- <div class="modal-dialog">
- <div class="modal-content">
- <div class="modal-body" id="attachmentModalBodyDiv"></div>
- </div>
- </div>
- </div>
- <div class="modal" id="editModalAcceptDescription">
- <div class="modal-dialog" style="width:70%">
- <div class="modal-content">
- <div class="modal-body" id="editModalAcceptDescriptionBodyDiv"></div>
- </div>
- </div>
- </div>
- <script src="~/Scripts/autoNumeric/autoNumeric.js"></script>
- <script src="~/Scripts/jquery-kz-val-load.js"></script>
- <script src="~/Scripts/jquery-projectmpkdata.js"></script>
- @Html.Hidden("hiddenFldUrlAttachmentsList", @Url.Action("AttachmentsList", "Attachment", new { area = string.Empty }))
- <script>
- var tAdv = $(".tabAdvanced").treetable({ expandable: true, initialState: "collapsed" });
- $(".tabAdvanced tbody tr").each(function () {
- $(this).removeClass("hidden");
- });
- $(".fixTable").tableFixer();
- $(".decValue").autoNumeric("init", { lZero: "deny", aSep: " ", mDec: 2, aDec: ","});
- function setTreetable() {
- tAdv.sortable();
- tAdv.sortable("disable");
- tAdv.treetable("expandAll");
- }
- $(document).ready(function () {
- setTreetable();
- $("#editModal").on('hidden.bs.modal', function () {
- $("#editModalBodyDiv").html("");
- })
- tAdv.on("mouseover", ".td_cc", function (evt) {
- var val = $(this).attr("data-code");
- if (val !== undefined && val !== null && val !== "") {
- var sel = JSON.parse('@Html.Raw(Json.Encode(ViewBag.CostsCodes))');
- var name = "";
- $.each(sel, function (index, item) {
- name = item.description;
- var code = item.code;
- return (code != val);
- });
- $(this).attr("title", name);
- };
- });
- $(".btnFreze").click(function (evt) {
- if ($(this).hasClass("btn-default")) {
- $(this).removeClass("btn-default").addClass("btn-warning");
- $(".fixTable").tableFixer({ head: true, "left": 1 });
- }
- else {
- $(this).removeClass("btn-warning").addClass("btn-default");
- $(".fixTable").tableFixer({ head: true, "left": -1 });
- }
- });
- tAdv.sortable({
- items: 'tr:not(tr:first-child)',
- cursor: 'crosshair',
- axis: 'y',
- dropOnEmpty: false,
- distance: 30,
- opacity: 0.6,
- start: function (e, ui) {
- ui.item.addClass("selected");
- },
- stop: function (e, ui) {
- var src_parent = ui.item.attr("data-tt-parent-id");
- var trg_parent = ui.item.prev().attr("data-tt-parent-id");
- var src = ui.item.attr("data-tt-id");
- var trg = ui.item.prev().attr("data-tt-id");
- var leaf = ui.item.attr("data-leaf");
- if (leaf === "True") {
- if (typeof trg !== "undefined" && typeof trg_parent !== "undefined") {
- if (src_parent === trg_parent || src_parent === trg) {
- var projId = ui.item.attr("data-id_proj");
- $.ajax({
- type: 'POST',
- url: '@Url.Action("ChangePositionOfLeafs", new { area = "HQ", controller = "Projects" })',
- data: { src: src, after: trg, parent: src_parent, proj: projId },
- success: function (data) {
- var nodes = data;
- nodes.forEach(function (node, i) {
- var row = tAdv.find("[data-id_node=" + node.id_node + "]");
- row.attr("data-tt-id", node.tt_id);
- row.attr("data-tt-id", node.tt_id);
- });
- $(".btnChangeStruct").click();
- alert("Dokonano zmiany struktury!");
- },
- error: function () {
- tAdv.sortable("cancel");
- $(".btnChangeStruct").click();
- alert('Error in leafs page');
- }
- });
- ui.item.removeClass("selected");
- }
- else {
- tAdv.sortable("cancel");
- alert("Brak zgodności węzła!");
- }
- }
- else {
- tAdv.sortable("cancel");
- }
- }
- else {
- tAdv.sortable("cancel");
- alert("Przesuwanie tylko dla liści!");
- }
- /*
- $(this).find("tr").each(function (index) {
- if (index > 0) {
- var trg = $(this).attr("data-tt-id");
- var trg_parent = $(this).attr("data-tt-parent-id");
- $(this).find("td").eq(1).html(index);
- }
- });
- */
- }
- });
- tAdv.on("mousedown", ".td_item > span.indenter a", function (evt) {
- evt.stopPropagation();
- });
- tAdv.on("mousedown", ".td_item", function (evt) {
- if (event.which === 1) {
- $(".btnNone").hide();
- if ($(".btnChangeStruct").hasClass("btn-default")) {
- $(this).parent().toggleClass("selected");
- var selectedItems = $(".tabAdvanced tr.selected");
- var areAllLeafs = true;
- selectedItems.each(function () {
- if (!$(this).hasClass("leaf")) {
- areAllLeafs = false;
- }
- });
- if (selectedItems.length === 1 && areAllLeafs) {
- $("#approvalBtn").show();
- }
- else {
- $("#approvalBtn").hide();
- }
- }
- else {
- $(this).parent().toggleClass("selected").siblings().removeClass("selected");
- var src = $(this).parent().attr("data-tt-parent-id");
- $(".tabAdvanced tbody tr").each(function () {
- if ($(this).attr("data-tt-parent-id") === src) {
- tAdv.treetable("collapseNode", $(this).attr("data-tt-id"));
- }
- });
- tAdv.addClass("table-bordered");
- }
- }
- });
- $(".btnCreateT0").click(function (evt) {
- var url = $(this).data("link");
- window.location.href = url;
- });
- $(".btnMPKFile").click(function (evt) {
- var url = $(this).data("link");
- window.location.href = url;
- });
- $(".btnThBottom").click(function (evt) {
- if ($(this).hasClass("btn-default")) {
- var row = $('.tabAdvanced > tbody').find('.selected');
- if (row.length > 0) {
- $(this).removeClass("btn-default").addClass("btn-success");
- var index = row.data("id");
- var rr = $(".tabAdvanced tr:eq(1)").clone(true);
- rr.find('th').each(function () {
- $(this).removeAttr("title");
- });
- rr.addClass("header-show");
- $('.tabAdvanced > tbody > tr').eq(index).before(rr);
- }
- }
- else {
- var row = $('.tabAdvanced > tbody').find('.header-show');
- if (row.length > 0) {
- row.remove();
- }
- $(this).removeClass("btn-success").addClass("btn-default");
- }
- });
- $(document).on("click", ".btnOwnerNode", function () {
- var nodeID = $(this).data("id");
- var url = $("#AddEditAssignUserUrl").val() + "&nodeID=" + nodeID;
- $("#editDetailsModalBodyDiv").load(url, function () {
- $("#editDetailsModal").modal("show");
- });
- });
- $(".btnRealisation").click(function () {
- var id = $(this).data('id');
- var url = $("#RealisationUrl").val() + "&id=" + id;
- $("#editModalBodyDiv").load(url, function () {
- $("#editModal").modal("show");
- });
- })
- $("#btnAddPatternCT").click(function () {
- var selectedRows = $('tr.selected');
- var data = new FormData();
- var i = 0;
- selectedRows.each(function () {
- var idNode = $(this).data('id_node');
- var ttId = $(this).data('tt-id')
- data.append("[" + i + "].id_node", idNode );
- data.append("[" + i + "].tt_id", ttId );
- i++;
- });
- data.append('projectId', '@ViewBag.projId');
- var url = $("#PatternCTUrl").val()
- $.post({
- url: url,
- data: data,
- processData: false,
- contentType: false,
- statusCode: {
- 200: function (data) {
- $("#editModalBodyDiv").html(data);
- $("#editModal").modal("show");
- },
- 303: function (data) {
- var id = data.responseJSON;
- var redirectUrl = window.location.pathname + "?projId=" + id;
- window.location.href = redirectUrl;
- },
- 400: function (data) {
- if (typeof data.responseJSON == 'undefined') {
- alert("Error on PatternComparsionTable page")
- }
- else {
- alert(data.responseJSON)
- }
- },
- }
- });
- })
- $(document).on("click", ".btnAddEditReserve", function () {
- var nodeId = $(this).data("id");
- var projId = $(this).data("id_proj");
- var url = $("#AddEditReserveUrl").val();
- url += "/?projectMpkId=" + projId + "&nodeId=" + nodeId;
- $("#editDetailsModalBodyDiv").load(url, function () {
- $("#editDetailsModal").modal("show");
- });
- });
- $("#btnAttachmentsList").click(function () {
- var projectId = $("#projectId").val();
- var url = $("#hiddenFldUrlAttachmentsList").val() + "?projectId=" + projectId;
- $("#attachmentsListModalBody").load(url, function () {
- $("#attachmentsListModal").modal("show");
- });
- });
- $(".btnAcceptDescription").click(function (evt) {
- var projId = '@ViewBag.ProjectId';
- var url = '@Url.Action("EditProjectDescription", "Projects", new { area = "HQ" })' + "?projId=" + projId;
- $("#editModalAcceptDescriptionBodyDiv").load(url, function () {
- $("#editModalAcceptDescription").modal("show");
- });
- });
- $(".btnAccept").click(function (evt) {
- var projId = '@ViewBag.ProjectId';
- var work = $(this).data("vw");
- var urlname = '@Url.Action("ProjectMPKFile", "Projects", new { area = "HQ" })' + "/?projId=" + projId;
- var url = '@Url.Action("AcceptPathProject", "Projects", new { area = "HQ" })' + "/?projId=" + projId + "&work=" + work;
- alert(url);
- $.ajax({
- type: "POST",
- url: url,
- success: function () {
- window.location.href = urlname;
- },
- error: function (result) {
- alert('Error in edit project page');
- }
- });
- });
- $(".btnSchedule").click(function () {
- $('table > tbody').find('.selected').each(function () {
- var leaf = $(this).data("leaf");
- if (leaf === "True") {
- var length = $('td', this).length;
- var val_cj = $('td:eq(4) input', this).val();
- var val_il = $('td:eq(5) input', this).val();
- var i = 11;
- length = length - i;
- var f_val_il = parseFloat(val_il) / parseFloat(length);
- f_val_il = f_val_il.toFixed(2);
- while (i < length) {
- $('td:eq(' + i + ') input', this).val(val_cj);
- var j = i + 1;
- $('td:eq(' + j + ') input', this).val(f_val_il);
- var val = parseFloat(val_cj) * f_val_il;
- val = val.toFixed(2);
- j = j + 1;
- $('td:eq(' + j + ') input', this).val(val);
- i = i + 3;
- }
- }
- });
- });
- });
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement