diff --git a/EveryThing/Pages/CodeTablePrePostText/AddEdit.cshtml b/EveryThing/Pages/CodeTablePrePostText/AddEdit.cshtml index 5a5aa12..13e1cda 100644 --- a/EveryThing/Pages/CodeTablePrePostText/AddEdit.cshtml +++ b/EveryThing/Pages/CodeTablePrePostText/AddEdit.cshtml @@ -51,22 +51,37 @@

Vezave

- - - - - - - - +
+
+
Uvodno
+
Veza
+ + + +
+
+
+
Zaključno
+ + + +
+
+ - - @@ -124,7 +139,8 @@ success: function (data) { $.unblockUI(); if (data.successful) { - $('#tableBodyLinks').html(data.tableLinks); + $('#tableBodyLinksPreText').html(data.tableLinksPreText); + $('#tableBodyLinksPostText').html(data.tableLinksPostText); $('.chb-link').on('change', function() { toggleLink(this); @@ -152,6 +168,7 @@ } let row = $(checkbox).parent().parent(); let link = $(row).attr('data-link'); + let type = $(row).attr('data-type'); let idPrePostTextLink = $(row).attr('data-idlink'); let idPrePostText = parseInt($('#inputIdPrePostText').val()); @@ -163,7 +180,7 @@ $('input:hidden[name="__RequestVerificationToken"]').val()); }, url: "AddEdit/?handler=LinkToggle", - data: { idPrePostText, link, idPrePostTextLink }, + data: { idPrePostText, link, type, idPrePostTextLink }, success: function(data) { $.unblockUI(); if (data.successful) { diff --git a/EveryThing/Pages/CodeTablePrePostText/AddEdit.cshtml.cs b/EveryThing/Pages/CodeTablePrePostText/AddEdit.cshtml.cs index 0bc7f7f..02b347f 100644 --- a/EveryThing/Pages/CodeTablePrePostText/AddEdit.cshtml.cs +++ b/EveryThing/Pages/CodeTablePrePostText/AddEdit.cshtml.cs @@ -123,21 +123,32 @@ namespace EveryThing.Pages.CodeTablePrePostText var insertedLinks = _context.CodeTablePrePostTextLink .Where(x => x.IdPrePostTextFk == idPrePostText); - var tableLinks = new StringBuilder(); + var tableLinksPreText = new StringBuilder(); typeof(CodeTablePrePostTextLink.LinkEnum).GetEnumListClass().ForEach(link => { - var insertedLink = insertedLinks.FirstOrDefault(x => (int)x.Link == link.EnumValue); - tableLinks.Append($""); - tableLinks.Append($" 0 ? "checked='checked'" : "")}/>"); - tableLinks.Append($"{link.EnumAttribute.Name}"); - tableLinks.Append(""); + var insertedLink = insertedLinks.FirstOrDefault(x => (int)x.Link == link.EnumValue && x.Type == CodeTablePrePostTextLink.TypeEnum.PreText); + tableLinksPreText.Append($""); + tableLinksPreText.Append($" 0 ? "checked='checked'" : "")}/>"); + tableLinksPreText.Append($"{link.EnumAttribute.Name}"); + tableLinksPreText.Append(""); }); - return new JsonResult(new { tableLinks = tableLinks.ToString(), successful = true }); + var tableLinksPostText = new StringBuilder(); + + typeof(CodeTablePrePostTextLink.LinkEnum).GetEnumListClass().ForEach(link => + { + var insertedLink = insertedLinks.FirstOrDefault(x => (int)x.Link == link.EnumValue && x.Type == CodeTablePrePostTextLink.TypeEnum.PostText); + tableLinksPostText.Append($""); + tableLinksPostText.Append($" 0 ? "checked='checked'" : "")}/>"); + tableLinksPostText.Append($"{link.EnumAttribute.Name}"); + tableLinksPostText.Append(""); + }); + + return new JsonResult(new { tableLinksPreText = tableLinksPreText.ToString(), tableLinksPostText = tableLinksPostText.ToString(), successful = true }); } - public IActionResult OnPostLinkToggle(int idPrePostText, int link, int idPrePostTextLink) + public IActionResult OnPostLinkToggle(int idPrePostText, int link, int type, int idPrePostTextLink) { var user = _userManager.GetUserAsync(User).Result; var idLink = 0; @@ -155,7 +166,8 @@ namespace EveryThing.Pages.CodeTablePrePostText var newLink = new CodeTablePrePostTextLink { IdPrePostTextFk = idPrePostText, - Link = (CodeTablePrePostTextLink.LinkEnum)link + Link = (CodeTablePrePostTextLink.LinkEnum)link, + Type = (CodeTablePrePostTextLink.TypeEnum)type }; _context.CodeTablePrePostTextLink.Add(newLink); diff --git a/EveryThing/Pages/Layouts/Partials/_LayoutSidenav.cshtml b/EveryThing/Pages/Layouts/Partials/_LayoutSidenav.cshtml index 277aae1..42590d2 100644 --- a/EveryThing/Pages/Layouts/Partials/_LayoutSidenav.cshtml +++ b/EveryThing/Pages/Layouts/Partials/_LayoutSidenav.cshtml @@ -129,7 +129,7 @@ @if (User.IsInRole("Administrator") || User.IsInRole("TransportThingUser") || User.IsInRole("InvoicingUser")) {
  • -
    Klavzule
    +
    Klavzule
  • } } diff --git a/EveryThing/Pages/TransportLoadingOrder/AddEdit.cshtml b/EveryThing/Pages/TransportLoadingOrder/AddEdit.cshtml index 029b274..63ddc2e 100644 --- a/EveryThing/Pages/TransportLoadingOrder/AddEdit.cshtml +++ b/EveryThing/Pages/TransportLoadingOrder/AddEdit.cshtml @@ -51,7 +51,7 @@
    - +
    diff --git a/EveryThing/Pages/TransportLoadingOrder/AddEdit.cshtml.cs b/EveryThing/Pages/TransportLoadingOrder/AddEdit.cshtml.cs index f0d4d59..b3a2d2f 100644 --- a/EveryThing/Pages/TransportLoadingOrder/AddEdit.cshtml.cs +++ b/EveryThing/Pages/TransportLoadingOrder/AddEdit.cshtml.cs @@ -13,6 +13,7 @@ using EveryThing.Data; using EveryThing.Models; using EveryThing.Models.Transport; using DocumentFormat.OpenXml.Spreadsheet; +using EveryThing.Models.CodeTable; namespace EveryThing.Pages.TransportLoadingOrder { @@ -45,18 +46,17 @@ namespace EveryThing.Pages.TransportLoadingOrder if (id == null) { + var prePostTexts = _context.CodeTablePrePostTextLink + .Include(x => x.CodeTablePrePostText) + .Where(x => x.CodeTablePrePostText.IdCompanyFk == user.IdCompanyFk + && x.Link == CodeTablePrePostTextLink.LinkEnum.TransportLoadingOrder); + TransportLoadingOrder = new Models.Transport.TransportLoadingOrder { OrderCity = _context.CodeTableCompanies.Single(x => x.IdCompany == user.IdCompanyFk).City, OrderDate = DateTime.Now, - PostText = "
    Prejemnik se obvezuje izvršiti prevoz po navodilih iz naročila. Prevoz se mora izvršiti v skladu z določili CRM konvencije. " + - "Prevoznik zagotavlja zavarovano prevozniško odgovornost. V primeru, da naročenega prevoza ne opravite po navodilih, Vas bomo bremenili za " + - "vse nastale stroške. Vse morebitne spore v zvezi s tem naročilom rešuje Okrožno sodišče v Slovenj Gradcu.

    " + - "Plačilo: 60 dni po prejemu računana e-mail: eracuni@trans-fer.si
    " + - "Original račun pošljite po pošti, poleg računa priložite 2 (dva) izvoda ožigosanega CMR " + - "z datumom in podpisom prejemnika.
    " + - "Direkten kontakt s stranko brez našega soglasja je PREPOVEDAN!
    " + - "
    Račun
    " + PreText = string.Join("
    ", prePostTexts.Where(x => x.Type == CodeTablePrePostTextLink.TypeEnum.PreText).Select(x => x.CodeTablePrePostText.Content)), + PostText = string.Join("
    ", prePostTexts.Where(x => x.Type == CodeTablePrePostTextLink.TypeEnum.PostText).Select(x => x.CodeTablePrePostText.Content)) }; TransportLoadingOrderLoadUnload = new TransportLoadingOrderLoadUnload();