Klavzule
This commit is contained in:
@@ -51,22 +51,37 @@
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<h4>Vezave</h4>
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<h5>Uvodno</h5>
|
||||
<table class="table card-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 30px;"></th>
|
||||
<th>Veza</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="tableBodyLinks">
|
||||
<tbody id="tableBodyLinksPreText">
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<h5>Zaključno</h5>
|
||||
<table class="table card-table">
|
||||
<tbody id="tableBodyLinksPostText">
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer py-3 text-right">
|
||||
<button id="savePrePostText" type="submit" class="btn btn-primary">Shrani nalog</button>
|
||||
@if (Model.PrePostText.IdPrePostText > 0)
|
||||
{
|
||||
<button id="savePrePostText" type="submit" class="btn btn-primary">Shrani</button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button id="savePrePostText" type="submit" class="btn btn-primary">Dodaj</button>
|
||||
}
|
||||
|
||||
<a asp-page="Index" class="btn btn-default">Prekliči</a>
|
||||
</div>
|
||||
</form>
|
||||
@@ -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) {
|
||||
|
||||
@@ -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<DisplayAttribute>().ForEach(link =>
|
||||
{
|
||||
var insertedLink = insertedLinks.FirstOrDefault(x => (int)x.Link == link.EnumValue);
|
||||
tableLinks.Append($"<tr data-link='{link.EnumValue}' data-idlink='{insertedLink?.IdPrePostTextLink ?? 0}'>");
|
||||
tableLinks.Append($"<td><input type='checkbox' class='chb-link' {((insertedLink?.IdPrePostTextLink ?? 0) > 0 ? "checked='checked'" : "")}/></td>");
|
||||
tableLinks.Append($"<td>{link.EnumAttribute.Name}</td>");
|
||||
tableLinks.Append("</tr>");
|
||||
var insertedLink = insertedLinks.FirstOrDefault(x => (int)x.Link == link.EnumValue && x.Type == CodeTablePrePostTextLink.TypeEnum.PreText);
|
||||
tableLinksPreText.Append($"<tr data-link='{link.EnumValue}' data-type='{(int)CodeTablePrePostTextLink.TypeEnum.PreText}' data-idlink='{insertedLink?.IdPrePostTextLink ?? 0}'>");
|
||||
tableLinksPreText.Append($"<td><input type='checkbox' class='chb-link' {((insertedLink?.IdPrePostTextLink ?? 0) > 0 ? "checked='checked'" : "")}/></td>");
|
||||
tableLinksPreText.Append($"<td>{link.EnumAttribute.Name}</td>");
|
||||
tableLinksPreText.Append("</tr>");
|
||||
});
|
||||
|
||||
return new JsonResult(new { tableLinks = tableLinks.ToString(), successful = true });
|
||||
var tableLinksPostText = new StringBuilder();
|
||||
|
||||
typeof(CodeTablePrePostTextLink.LinkEnum).GetEnumListClass<DisplayAttribute>().ForEach(link =>
|
||||
{
|
||||
var insertedLink = insertedLinks.FirstOrDefault(x => (int)x.Link == link.EnumValue && x.Type == CodeTablePrePostTextLink.TypeEnum.PostText);
|
||||
tableLinksPostText.Append($"<tr data-link='{link.EnumValue}' data-type='{(int)CodeTablePrePostTextLink.TypeEnum.PostText}' data-idlink='{insertedLink?.IdPrePostTextLink ?? 0}'>");
|
||||
tableLinksPostText.Append($"<td><input type='checkbox' class='chb-link' {((insertedLink?.IdPrePostTextLink ?? 0) > 0 ? "checked='checked'" : "")}/></td>");
|
||||
tableLinksPostText.Append($"<td>{link.EnumAttribute.Name}</td>");
|
||||
tableLinksPostText.Append("</tr>");
|
||||
});
|
||||
|
||||
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);
|
||||
|
||||
@@ -129,7 +129,7 @@
|
||||
@if (User.IsInRole("Administrator") || User.IsInRole("TransportThingUser") || User.IsInRole("InvoicingUser"))
|
||||
{
|
||||
<li class="sidenav-item@(currentPage.StartsWith("/CodeTableVehicle/") ? " active" : "")">
|
||||
<a asp-page="/CodeTablePrePostText/Index" class="sidenav-link"><i class="sidenav-icon fas fa-truck"></i><div>Klavzule</div></a>
|
||||
<a asp-page="/CodeTablePrePostText/Index" class="sidenav-link"><i class="sidenav-icon fas fa-sticky-note"></i><div>Klavzule</div></a>
|
||||
</li>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
<div class="col-6">
|
||||
<div class="form-group">
|
||||
<label asp-for="TransportLoadingOrder.IdPartnerFk" class="form-label"></label>
|
||||
<select asp-for="TransportLoadingOrder.IdPartnerFk" class="form-control" asp-items="ViewBag.IdPartnerFk"></select>
|
||||
<select asp-for="TransportLoadingOrder.IdPartnerFk" class="form-control select2" asp-items="ViewBag.IdPartnerFk"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 text-right">
|
||||
|
||||
@@ -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 = "<div>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.</div><br/>" +
|
||||
"Plačilo: <b>60 dni</b> po prejemu računana e-mail: <b>eracuni@trans-fer.si</b><br/>" +
|
||||
"Original račun pošljite po pošti, poleg računa priložite 2 (dva) izvoda ožigosanega CMR " +
|
||||
"z datumom in podpisom prejemnika.<br/>" +
|
||||
"Direkten kontakt s stranko brez našega soglasja je PREPOVEDAN!<br/>" +
|
||||
"<div>Račun</div>"
|
||||
PreText = string.Join("<br/>", prePostTexts.Where(x => x.Type == CodeTablePrePostTextLink.TypeEnum.PreText).Select(x => x.CodeTablePrePostText.Content)),
|
||||
PostText = string.Join("<br/>", prePostTexts.Where(x => x.Type == CodeTablePrePostTextLink.TypeEnum.PostText).Select(x => x.CodeTablePrePostText.Content))
|
||||
};
|
||||
TransportLoadingOrderLoadUnload = new TransportLoadingOrderLoadUnload();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user