Klavzule
This commit is contained in:
@@ -51,22 +51,37 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
<h4>Vezave</h4>
|
<h4>Vezave</h4>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-6">
|
||||||
|
<h5>Uvodno</h5>
|
||||||
<table class="table card-table">
|
<table class="table card-table">
|
||||||
<thead>
|
<tbody id="tableBodyLinksPreText">
|
||||||
<tr>
|
|
||||||
<th style="width: 30px;"></th>
|
|
||||||
<th>Veza</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody id="tableBodyLinks">
|
|
||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</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>
|
</div>
|
||||||
<div class="card-footer py-3 text-right">
|
<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>
|
<a asp-page="Index" class="btn btn-default">Prekliči</a>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
@@ -124,7 +139,8 @@
|
|||||||
success: function (data) {
|
success: function (data) {
|
||||||
$.unblockUI();
|
$.unblockUI();
|
||||||
if (data.successful) {
|
if (data.successful) {
|
||||||
$('#tableBodyLinks').html(data.tableLinks);
|
$('#tableBodyLinksPreText').html(data.tableLinksPreText);
|
||||||
|
$('#tableBodyLinksPostText').html(data.tableLinksPostText);
|
||||||
$('.chb-link').on('change',
|
$('.chb-link').on('change',
|
||||||
function() {
|
function() {
|
||||||
toggleLink(this);
|
toggleLink(this);
|
||||||
@@ -152,6 +168,7 @@
|
|||||||
}
|
}
|
||||||
let row = $(checkbox).parent().parent();
|
let row = $(checkbox).parent().parent();
|
||||||
let link = $(row).attr('data-link');
|
let link = $(row).attr('data-link');
|
||||||
|
let type = $(row).attr('data-type');
|
||||||
let idPrePostTextLink = $(row).attr('data-idlink');
|
let idPrePostTextLink = $(row).attr('data-idlink');
|
||||||
let idPrePostText = parseInt($('#inputIdPrePostText').val());
|
let idPrePostText = parseInt($('#inputIdPrePostText').val());
|
||||||
|
|
||||||
@@ -163,7 +180,7 @@
|
|||||||
$('input:hidden[name="__RequestVerificationToken"]').val());
|
$('input:hidden[name="__RequestVerificationToken"]').val());
|
||||||
},
|
},
|
||||||
url: "AddEdit/?handler=LinkToggle",
|
url: "AddEdit/?handler=LinkToggle",
|
||||||
data: { idPrePostText, link, idPrePostTextLink },
|
data: { idPrePostText, link, type, idPrePostTextLink },
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
$.unblockUI();
|
$.unblockUI();
|
||||||
if (data.successful) {
|
if (data.successful) {
|
||||||
|
|||||||
@@ -123,21 +123,32 @@ namespace EveryThing.Pages.CodeTablePrePostText
|
|||||||
var insertedLinks = _context.CodeTablePrePostTextLink
|
var insertedLinks = _context.CodeTablePrePostTextLink
|
||||||
.Where(x => x.IdPrePostTextFk == idPrePostText);
|
.Where(x => x.IdPrePostTextFk == idPrePostText);
|
||||||
|
|
||||||
var tableLinks = new StringBuilder();
|
var tableLinksPreText = new StringBuilder();
|
||||||
|
|
||||||
typeof(CodeTablePrePostTextLink.LinkEnum).GetEnumListClass<DisplayAttribute>().ForEach(link =>
|
typeof(CodeTablePrePostTextLink.LinkEnum).GetEnumListClass<DisplayAttribute>().ForEach(link =>
|
||||||
{
|
{
|
||||||
var insertedLink = insertedLinks.FirstOrDefault(x => (int)x.Link == link.EnumValue);
|
var insertedLink = insertedLinks.FirstOrDefault(x => (int)x.Link == link.EnumValue && x.Type == CodeTablePrePostTextLink.TypeEnum.PreText);
|
||||||
tableLinks.Append($"<tr data-link='{link.EnumValue}' data-idlink='{insertedLink?.IdPrePostTextLink ?? 0}'>");
|
tableLinksPreText.Append($"<tr data-link='{link.EnumValue}' data-type='{(int)CodeTablePrePostTextLink.TypeEnum.PreText}' data-idlink='{insertedLink?.IdPrePostTextLink ?? 0}'>");
|
||||||
tableLinks.Append($"<td><input type='checkbox' class='chb-link' {((insertedLink?.IdPrePostTextLink ?? 0) > 0 ? "checked='checked'" : "")}/></td>");
|
tableLinksPreText.Append($"<td><input type='checkbox' class='chb-link' {((insertedLink?.IdPrePostTextLink ?? 0) > 0 ? "checked='checked'" : "")}/></td>");
|
||||||
tableLinks.Append($"<td>{link.EnumAttribute.Name}</td>");
|
tableLinksPreText.Append($"<td>{link.EnumAttribute.Name}</td>");
|
||||||
tableLinks.Append("</tr>");
|
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 user = _userManager.GetUserAsync(User).Result;
|
||||||
var idLink = 0;
|
var idLink = 0;
|
||||||
@@ -155,7 +166,8 @@ namespace EveryThing.Pages.CodeTablePrePostText
|
|||||||
var newLink = new CodeTablePrePostTextLink
|
var newLink = new CodeTablePrePostTextLink
|
||||||
{
|
{
|
||||||
IdPrePostTextFk = idPrePostText,
|
IdPrePostTextFk = idPrePostText,
|
||||||
Link = (CodeTablePrePostTextLink.LinkEnum)link
|
Link = (CodeTablePrePostTextLink.LinkEnum)link,
|
||||||
|
Type = (CodeTablePrePostTextLink.TypeEnum)type
|
||||||
};
|
};
|
||||||
|
|
||||||
_context.CodeTablePrePostTextLink.Add(newLink);
|
_context.CodeTablePrePostTextLink.Add(newLink);
|
||||||
|
|||||||
@@ -129,7 +129,7 @@
|
|||||||
@if (User.IsInRole("Administrator") || User.IsInRole("TransportThingUser") || User.IsInRole("InvoicingUser"))
|
@if (User.IsInRole("Administrator") || User.IsInRole("TransportThingUser") || User.IsInRole("InvoicingUser"))
|
||||||
{
|
{
|
||||||
<li class="sidenav-item@(currentPage.StartsWith("/CodeTableVehicle/") ? " active" : "")">
|
<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>
|
</li>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,7 @@
|
|||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label asp-for="TransportLoadingOrder.IdPartnerFk" class="form-label"></label>
|
<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>
|
</div>
|
||||||
<div class="col-6 text-right">
|
<div class="col-6 text-right">
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ using EveryThing.Data;
|
|||||||
using EveryThing.Models;
|
using EveryThing.Models;
|
||||||
using EveryThing.Models.Transport;
|
using EveryThing.Models.Transport;
|
||||||
using DocumentFormat.OpenXml.Spreadsheet;
|
using DocumentFormat.OpenXml.Spreadsheet;
|
||||||
|
using EveryThing.Models.CodeTable;
|
||||||
|
|
||||||
namespace EveryThing.Pages.TransportLoadingOrder
|
namespace EveryThing.Pages.TransportLoadingOrder
|
||||||
{
|
{
|
||||||
@@ -45,18 +46,17 @@ namespace EveryThing.Pages.TransportLoadingOrder
|
|||||||
|
|
||||||
if (id == null)
|
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
|
TransportLoadingOrder = new Models.Transport.TransportLoadingOrder
|
||||||
{
|
{
|
||||||
OrderCity = _context.CodeTableCompanies.Single(x => x.IdCompany == user.IdCompanyFk).City,
|
OrderCity = _context.CodeTableCompanies.Single(x => x.IdCompany == user.IdCompanyFk).City,
|
||||||
OrderDate = DateTime.Now,
|
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. " +
|
PreText = string.Join("<br/>", prePostTexts.Where(x => x.Type == CodeTablePrePostTextLink.TypeEnum.PreText).Select(x => x.CodeTablePrePostText.Content)),
|
||||||
"Prevoznik zagotavlja zavarovano prevozniško odgovornost. V primeru, da naročenega prevoza ne opravite po navodilih, Vas bomo bremenili za " +
|
PostText = string.Join("<br/>", prePostTexts.Where(x => x.Type == CodeTablePrePostTextLink.TypeEnum.PostText).Select(x => x.CodeTablePrePostText.Content))
|
||||||
"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>"
|
|
||||||
};
|
};
|
||||||
TransportLoadingOrderLoadUnload = new TransportLoadingOrderLoadUnload();
|
TransportLoadingOrderLoadUnload = new TransportLoadingOrderLoadUnload();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user