dev
This commit is contained in:
@@ -124,6 +124,7 @@ namespace EveryThing.Data
|
|||||||
modelBuilder.Entity<CodeTableItem>().HasMany(t => t.ItemProjectPartItem).WithOne(t => t.Item).OnDelete(DeleteBehavior.Restrict);
|
modelBuilder.Entity<CodeTableItem>().HasMany(t => t.ItemProjectPartItem).WithOne(t => t.Item).OnDelete(DeleteBehavior.Restrict);
|
||||||
modelBuilder.Entity<CodeTableItem>().HasMany(t => t.ItemProjectPartItemMaterial).WithOne(t => t.Material).OnDelete(DeleteBehavior.Restrict);
|
modelBuilder.Entity<CodeTableItem>().HasMany(t => t.ItemProjectPartItemMaterial).WithOne(t => t.Material).OnDelete(DeleteBehavior.Restrict);
|
||||||
modelBuilder.Entity<Invoice>().HasMany(t => t.InvoiceInvoiceItem).WithOne(t => t.Invoice).OnDelete(DeleteBehavior.Restrict);
|
modelBuilder.Entity<Invoice>().HasMany(t => t.InvoiceInvoiceItem).WithOne(t => t.Invoice).OnDelete(DeleteBehavior.Restrict);
|
||||||
|
modelBuilder.Entity<Project>().HasMany(t => t.Invoices).WithOne(t => t.Project).OnDelete(DeleteBehavior.Restrict);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
16
EveryThing/Keys/key-28c82385-e3fb-4bf5-8766-a65a4b53144e.xml
Normal file
16
EveryThing/Keys/key-28c82385-e3fb-4bf5-8766-a65a4b53144e.xml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<key id="28c82385-e3fb-4bf5-8766-a65a4b53144e" version="1">
|
||||||
|
<creationDate>2026-01-18T08:17:33.3724528Z</creationDate>
|
||||||
|
<activationDate>2026-01-18T08:17:33.3012191Z</activationDate>
|
||||||
|
<expirationDate>2026-04-18T08:17:33.3012191Z</expirationDate>
|
||||||
|
<descriptor deserializerType="Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.AuthenticatedEncryptorDescriptorDeserializer, Microsoft.AspNetCore.DataProtection, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60">
|
||||||
|
<descriptor>
|
||||||
|
<encryption algorithm="AES_256_CBC" />
|
||||||
|
<validation algorithm="HMACSHA256" />
|
||||||
|
<masterKey p4:requiresEncryption="true" xmlns:p4="http://schemas.asp.net/2015/03/dataProtection">
|
||||||
|
<!-- Warning: the key below is in an unencrypted form. -->
|
||||||
|
<value>WP+gZd5AUHUD8ugsMeP7EyB+VcsXYXij8TlutwS00Gj2Ts90aZCwhR3w1jtp2MGDslVjz3nMv2q3Sch7sq8v/w==</value>
|
||||||
|
</masterKey>
|
||||||
|
</descriptor>
|
||||||
|
</descriptor>
|
||||||
|
</key>
|
||||||
2454
EveryThing/Migrations/20260119165503_16.Designer.cs
generated
Normal file
2454
EveryThing/Migrations/20260119165503_16.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
56
EveryThing/Migrations/20260119165503_16.cs
Normal file
56
EveryThing/Migrations/20260119165503_16.cs
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace EveryThing.Migrations
|
||||||
|
{
|
||||||
|
public partial class _16 : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<int>(
|
||||||
|
name: "IdProjectFk",
|
||||||
|
table: "Invoices",
|
||||||
|
type: "int",
|
||||||
|
nullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<int>(
|
||||||
|
name: "ProjectIdProject",
|
||||||
|
table: "Invoices",
|
||||||
|
type: "int",
|
||||||
|
nullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Invoices_ProjectIdProject",
|
||||||
|
table: "Invoices",
|
||||||
|
column: "ProjectIdProject");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_Invoices_Projects_ProjectIdProject",
|
||||||
|
table: "Invoices",
|
||||||
|
column: "ProjectIdProject",
|
||||||
|
principalTable: "Projects",
|
||||||
|
principalColumn: "IdProject",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_Invoices_Projects_ProjectIdProject",
|
||||||
|
table: "Invoices");
|
||||||
|
|
||||||
|
migrationBuilder.DropIndex(
|
||||||
|
name: "IX_Invoices_ProjectIdProject",
|
||||||
|
table: "Invoices");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "IdProjectFk",
|
||||||
|
table: "Invoices");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "ProjectIdProject",
|
||||||
|
table: "Invoices");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -695,6 +695,9 @@ namespace EveryThing.Migrations
|
|||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("int");
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int?>("IdProjectFk")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.Property<int>("InvoiceNumber")
|
b.Property<int>("InvoiceNumber")
|
||||||
.HasColumnType("int");
|
.HasColumnType("int");
|
||||||
|
|
||||||
@@ -710,6 +713,9 @@ namespace EveryThing.Migrations
|
|||||||
b.Property<string>("PreText")
|
b.Property<string>("PreText")
|
||||||
.HasColumnType("longtext");
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<int?>("ProjectIdProject")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.Property<int>("State")
|
b.Property<int>("State")
|
||||||
.HasColumnType("int");
|
.HasColumnType("int");
|
||||||
|
|
||||||
@@ -722,6 +728,8 @@ namespace EveryThing.Migrations
|
|||||||
|
|
||||||
b.HasIndex("IdPartnerFk");
|
b.HasIndex("IdPartnerFk");
|
||||||
|
|
||||||
|
b.HasIndex("ProjectIdProject");
|
||||||
|
|
||||||
b.ToTable("Invoices");
|
b.ToTable("Invoices");
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -1813,9 +1821,16 @@ namespace EveryThing.Migrations
|
|||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("EveryThing.Models.Project.Project", "Project")
|
||||||
|
.WithMany("Invoices")
|
||||||
|
.HasForeignKey("ProjectIdProject")
|
||||||
|
.OnDelete(DeleteBehavior.Restrict);
|
||||||
|
|
||||||
b.Navigation("Company");
|
b.Navigation("Company");
|
||||||
|
|
||||||
b.Navigation("Partner");
|
b.Navigation("Partner");
|
||||||
|
|
||||||
|
b.Navigation("Project");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("EveryThing.Models.Invoice.InvoiceItem", b =>
|
modelBuilder.Entity("EveryThing.Models.Invoice.InvoiceItem", b =>
|
||||||
@@ -2366,6 +2381,8 @@ namespace EveryThing.Migrations
|
|||||||
|
|
||||||
modelBuilder.Entity("EveryThing.Models.Project.Project", b =>
|
modelBuilder.Entity("EveryThing.Models.Project.Project", b =>
|
||||||
{
|
{
|
||||||
|
b.Navigation("Invoices");
|
||||||
|
|
||||||
b.Navigation("ProjectProjectPart");
|
b.Navigation("ProjectProjectPart");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -77,6 +77,10 @@ namespace EveryThing.Models.Invoice
|
|||||||
[Display(Name = "Partner")]
|
[Display(Name = "Partner")]
|
||||||
public int? IdPartnerFk { get; set; }
|
public int? IdPartnerFk { get; set; }
|
||||||
|
|
||||||
|
[ForeignKey("Projekt")]
|
||||||
|
[Display(Name = "Projekt")]
|
||||||
|
public int? IdProjectFk { get; set; }
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
public int InvoiceNumber { get; set; }
|
public int InvoiceNumber { get; set; }
|
||||||
|
|
||||||
@@ -133,13 +137,29 @@ namespace EveryThing.Models.Invoice
|
|||||||
[NotMapped]
|
[NotMapped]
|
||||||
public string InvoiceNumberFull => $"{InvoiceTypeString}-{InvoiceNumberFormatted}";
|
public string InvoiceNumberFull => $"{InvoiceTypeString}-{InvoiceNumberFormatted}";
|
||||||
|
|
||||||
|
[NotMapped] public string InvoiceTypeHeaderString => GetInvoiceTypeHeaderString(Type);
|
||||||
|
|
||||||
// ForeignKey
|
// ForeignKey
|
||||||
public CodeTableCompany Company { get; set; }
|
public CodeTableCompany Company { get; set; }
|
||||||
|
|
||||||
public CodeTablePartner Partner { get; set; }
|
public CodeTablePartner Partner { get; set; }
|
||||||
|
public Project.Project Project{ get; set; }
|
||||||
|
|
||||||
// InvoicePart
|
// InvoicePart
|
||||||
[InverseProperty("Invoice")]
|
[InverseProperty("Invoice")]
|
||||||
public virtual ICollection<InvoiceItem> InvoiceInvoiceItem { get; set; }
|
public virtual ICollection<InvoiceItem> InvoiceInvoiceItem { get; set; }
|
||||||
|
|
||||||
|
public static string GetInvoiceTypeHeaderString(InvoiceType iType)
|
||||||
|
{
|
||||||
|
return iType switch
|
||||||
|
{
|
||||||
|
InvoiceType.Order => "Naročila dobaviteljem",
|
||||||
|
0 => "Računi",
|
||||||
|
InvoiceType.DeliveryNote => "Dobavnice",
|
||||||
|
InvoiceType.BuyersOrder => "Naročila kupcev",
|
||||||
|
InvoiceType.Cooperation => "Kooperacije",
|
||||||
|
_ => "Fakture"
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,5 +81,8 @@ namespace EveryThing.Models.Project
|
|||||||
[InverseProperty("Project")]
|
[InverseProperty("Project")]
|
||||||
public virtual ICollection<ProjectPart> ProjectProjectPart { get; set; }
|
public virtual ICollection<ProjectPart> ProjectProjectPart { get; set; }
|
||||||
|
|
||||||
|
[InverseProperty("Project")]
|
||||||
|
public virtual ICollection<Invoice.Invoice> Invoices { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,54 +1,126 @@
|
|||||||
@page
|
@page
|
||||||
@model EveryThing.Pages.Invoices.CreateItemModel
|
@model EveryThing.Pages.Invoices.CreateItemModel
|
||||||
|
|
||||||
<h4>Faktura</h4>
|
@section Styles
|
||||||
<hr />
|
{
|
||||||
<div class="row">
|
<link rel="stylesheet" href="~/vendor/libs/select2/select2.css" asp-append-version="true" />
|
||||||
<div class="col-md-4">
|
<style type="text/css">
|
||||||
|
textarea{
|
||||||
|
resize:none;
|
||||||
|
overflow-y:auto;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
}
|
||||||
|
|
||||||
<form method="post">
|
<form method="post">
|
||||||
|
<input type="hidden" asp-for="InvoiceItem.IdInvoiceFk" />
|
||||||
|
<input type="hidden" asp-for="InvoiceItem.IdInvoiceItem" />
|
||||||
|
|
||||||
|
<h4 class="d-flex justify-content-between align-items-center w-100 font-weight-bold py-1 mb-4">
|
||||||
|
<span>
|
||||||
|
<span class="text-muted font-weight-light">
|
||||||
|
@Model.Invoice.InvoiceTypeHeaderString
|
||||||
|
/
|
||||||
|
@Model.Invoice.InvoiceNumberFormatted
|
||||||
|
/
|
||||||
|
</span>
|
||||||
|
@if ((bool)ViewData["Edit"])
|
||||||
|
{
|
||||||
|
<span>Urejanje pozicije</span>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<span> Nova pozicija</span>
|
||||||
|
}
|
||||||
|
|
||||||
|
</span>
|
||||||
|
</h4>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-6">
|
||||||
|
<div class="card">
|
||||||
|
<h6 class="card-header">
|
||||||
|
Podatki pozicije
|
||||||
|
</h6>
|
||||||
|
<div class="card-body">
|
||||||
|
|
||||||
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
|
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
|
||||||
<input type="hidden" asp-for="@ViewData["IdInvoice"]" name="idInvoice"/>
|
<input type="hidden" asp-for="@ViewData["IdInvoice"]" name="idInvoice"/>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label asp-for="InvoiceItem.IdItemFk" class="control-label"></label>
|
<label asp-for="InvoiceItem.IdItemFk" class="control-label"></label>
|
||||||
<select asp-for="InvoiceItem.IdItemFk" class="form-control" asp-items="ViewBag.Items"></select>
|
<select asp-for="InvoiceItem.IdItemFk" class="form-control select2" asp-items="ViewBag.Items">
|
||||||
|
<option value=""></option>
|
||||||
|
</select>
|
||||||
<span asp-validation-for="InvoiceItem.IdItemFk" class="text-danger"></span>
|
<span asp-validation-for="InvoiceItem.IdItemFk" class="text-danger"></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label asp-for="InvoiceItem.ItemDescription" class="control-label"></label>
|
<label asp-for="InvoiceItem.ItemDescription" class="control-label"></label>
|
||||||
<textarea asp-for="InvoiceItem.ItemDescription" class="form-control"></textarea>
|
<textarea asp-for="InvoiceItem.ItemDescription" class="form-control" rows="6"></textarea>
|
||||||
<span asp-validation-for="InvoiceItem.ItemDescription" class="text-danger"></span>
|
<span asp-validation-for="InvoiceItem.ItemDescription" class="text-danger"></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-4">
|
||||||
<label asp-for="InvoiceItem.Quantity" class="control-label"></label>
|
<label asp-for="InvoiceItem.Quantity" class="control-label"></label>
|
||||||
<input asp-for="InvoiceItem.Quantity" class="form-control"/>
|
<input asp-for="InvoiceItem.Quantity" class="form-control"/>
|
||||||
<span asp-validation-for="InvoiceItem.Quantity" class="text-danger"></span>
|
<span asp-validation-for="InvoiceItem.Quantity" class="text-danger"></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="col-4">
|
||||||
<label asp-for="InvoiceItem.Price" class="control-label"></label>
|
<label asp-for="InvoiceItem.Price" class="control-label"></label>
|
||||||
<input asp-for="InvoiceItem.Price" class="form-control"/>
|
<input asp-for="InvoiceItem.Price" class="form-control"/>
|
||||||
<span asp-validation-for="InvoiceItem.Price" class="text-danger"></span>
|
<span asp-validation-for="InvoiceItem.Price" class="text-danger"></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="col-4">
|
||||||
<label asp-for="InvoiceItem.Discount" class="control-label"></label>
|
<label asp-for="InvoiceItem.Discount" class="control-label"></label>
|
||||||
<input asp-for="InvoiceItem.Discount" class="form-control"/>
|
<input asp-for="InvoiceItem.Discount" class="form-control"/>
|
||||||
<span asp-validation-for="InvoiceItem.Discount" class="text-danger"></span>
|
<span asp-validation-for="InvoiceItem.Discount" class="text-danger"></span>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label asp-for="InvoiceItem.Note" class="control-label"></label>
|
<label asp-for="InvoiceItem.Note" class="control-label"></label>
|
||||||
<textarea asp-for="InvoiceItem.Note" class="form-control" ></textarea>
|
<textarea asp-for="InvoiceItem.Note" class="form-control" rows="6"></textarea>
|
||||||
<span asp-validation-for="InvoiceItem.Note" class="text-danger"></span>
|
<span asp-validation-for="InvoiceItem.Note" class="text-danger"></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
|
||||||
<input type="submit" value="Shrani" class="btn btn-primary" />
|
|
||||||
</div>
|
</div>
|
||||||
</form>
|
<div class="card-footer py-3 text-right">
|
||||||
|
@if (ViewData["Edit"] != null && (bool)ViewData["Edit"])
|
||||||
|
{
|
||||||
|
<button type="submit" class="btn btn-primary">Shrani</button>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<button type="submit" class="btn btn-primary">Dodaj pozicijo</button>
|
||||||
|
}
|
||||||
|
|
||||||
|
<a class="btn btn-default" asp-page="./Edit" asp-route-id="@ViewData["IdInvoice"]">Prekliči</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
</form>
|
||||||
<div>
|
<div>
|
||||||
<a class="btn btn-default" asp-page="./Edit" asp-route-id="@ViewData["IdInvoice"]">Nazaj</a>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@section Scripts {
|
@section Scripts {
|
||||||
|
<script src="~/vendor/libs/select2/select2.js" asp-append-version="true"></script>
|
||||||
@{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
|
@{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(document).ready(function() {
|
||||||
|
$('.select2').select2({
|
||||||
|
placeholder: 'Artikel ni izbran',
|
||||||
|
allowClear: true
|
||||||
|
});
|
||||||
|
// Forced check on load: if the value is null/empty, reset the dropdown
|
||||||
|
if (!$('#InvoiceItem_IdItemFk').val()) {
|
||||||
|
$('#InvoiceItem_IdItemFk').val(null).trigger('change');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,18 @@
|
|||||||
using System;
|
using EveryThing.Data;
|
||||||
using System.Collections.Generic;
|
using EveryThing.Models;
|
||||||
using System.Linq;
|
using EveryThing.Models.Invoice;
|
||||||
using System.Threading.Tasks;
|
using EveryThing.Models.Project;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using Microsoft.AspNetCore.Identity;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||||
using EveryThing.Data;
|
using Microsoft.CodeAnalysis.Differencing;
|
||||||
using EveryThing.Models;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.AspNetCore.Identity;
|
using System;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace EveryThing.Pages.Invoices
|
namespace EveryThing.Pages.Invoices
|
||||||
{
|
{
|
||||||
@@ -28,20 +32,41 @@ namespace EveryThing.Pages.Invoices
|
|||||||
_roleManager = roleManager;
|
_roleManager = roleManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IActionResult OnGet(int idInvoice)
|
[BindProperty]
|
||||||
|
public Models.Invoice.InvoiceItem InvoiceItem { get; set; }
|
||||||
|
public Models.Invoice.Invoice Invoice { get; set; }
|
||||||
|
|
||||||
|
public IActionResult OnGet(int idInvoice, bool? edit = null, int? idInvoiceItem = null)
|
||||||
{
|
{
|
||||||
var user = _userManager.GetUserAsync(User).Result;
|
var user = _userManager.GetUserAsync(User).Result;
|
||||||
|
|
||||||
ViewData["IdInvoice"] = idInvoice;
|
ViewData["IdInvoice"] = idInvoice;
|
||||||
|
Invoice = _context.Invoices.FirstOrDefault(x => x.IdInvoice == idInvoice);
|
||||||
|
if (Invoice == null)
|
||||||
|
return NotFound();
|
||||||
|
|
||||||
ViewData["Items"] = new SelectList(_context.CodeTableItems.Where(x => x.IdCompanyFk == user.IdCompanyFk && x.Active), "IdItem", "Title");
|
ViewData["Items"] = new SelectList(_context.CodeTableItems.Where(x => x.IdCompanyFk == user.IdCompanyFk && x.Active), "IdItem", "Title");
|
||||||
|
ViewData["Edit"] = edit ?? false;
|
||||||
|
|
||||||
|
if (edit ?? false)
|
||||||
|
{
|
||||||
|
InvoiceItem = _context.InvoiceItems.FirstOrDefault(x => x.IdInvoiceItem == idInvoiceItem);
|
||||||
|
if (InvoiceItem == null)
|
||||||
|
return NotFound();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
InvoiceItem = new InvoiceItem
|
||||||
|
{
|
||||||
|
IdInvoiceFk = idInvoice
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
return Page();
|
return Page();
|
||||||
}
|
}
|
||||||
|
|
||||||
[BindProperty]
|
|
||||||
public Models.Invoice.InvoiceItem InvoiceItem { get; set; }
|
|
||||||
|
|
||||||
public async Task<IActionResult> OnPostAsync(int idInvoice)
|
public async Task<IActionResult> OnPostAsync(bool edit)
|
||||||
{
|
{
|
||||||
if (!ModelState.IsValid)
|
if (!ModelState.IsValid)
|
||||||
{
|
{
|
||||||
@@ -50,12 +75,36 @@ namespace EveryThing.Pages.Invoices
|
|||||||
|
|
||||||
var user = _userManager.GetUserAsync(User).Result;
|
var user = _userManager.GetUserAsync(User).Result;
|
||||||
|
|
||||||
InvoiceItem.IdInvoiceFk = idInvoice;
|
if (!edit)
|
||||||
|
{
|
||||||
_context.InvoiceItems.Add(InvoiceItem);
|
_context.InvoiceItems.Add(InvoiceItem);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_context.Attach(InvoiceItem).State = EntityState.Modified;
|
||||||
|
|
||||||
return RedirectToPage("./Edit", new { id = idInvoice });
|
try
|
||||||
|
{
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
catch (DbUpdateConcurrencyException)
|
||||||
|
{
|
||||||
|
if (!InvoiceItemExists(InvoiceItem.IdInvoiceItem))
|
||||||
|
{
|
||||||
|
return NotFound();
|
||||||
|
}
|
||||||
|
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return RedirectToPage("./Edit", new { id = InvoiceItem.IdInvoiceFk });
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool InvoiceItemExists(int id)
|
||||||
|
{
|
||||||
|
return _context.InvoiceItems.Any(e => e.IdProjectPartItem == id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,28 +42,9 @@
|
|||||||
<h4 class="d-flex justify-content-between align-items-center w-100 font-weight-bold py-1 mb-4">
|
<h4 class="d-flex justify-content-between align-items-center w-100 font-weight-bold py-1 mb-4">
|
||||||
<span>
|
<span>
|
||||||
<span class="text-muted font-weight-light">
|
<span class="text-muted font-weight-light">
|
||||||
@switch (ViewData["Type"])
|
@Model.Invoice.InvoiceTypeHeaderString
|
||||||
{
|
/
|
||||||
case 1:
|
</span> Urejanje
|
||||||
<i>Naročila dobaviteljem</i>
|
|
||||||
break;
|
|
||||||
case 0:
|
|
||||||
<i>Računi</i>
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
<i>Dobavnice</i>
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
<i>Naročila kupcev</i>
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
<i>Kooperacije</i>
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
<i>Fakture</i>
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
/</span> Urejanje
|
|
||||||
</span>
|
</span>
|
||||||
</h4>
|
</h4>
|
||||||
<hr />
|
<hr />
|
||||||
|
|||||||
@@ -84,6 +84,7 @@ namespace EveryThing.Pages.Invoices
|
|||||||
var user = _userManager.GetUserAsync(User).Result;
|
var user = _userManager.GetUserAsync(User).Result;
|
||||||
|
|
||||||
ViewData["Type"] = (int)Invoice.Type;
|
ViewData["Type"] = (int)Invoice.Type;
|
||||||
|
|
||||||
ViewData["IdPartnerFk"] = new SelectList(_context.CodeTablePartners.Where(x => x.IdCompanyFk == user.IdCompanyFk && x.Active), "IdPartner", "Title");
|
ViewData["IdPartnerFk"] = new SelectList(_context.CodeTablePartners.Where(x => x.IdCompanyFk == user.IdCompanyFk && x.Active), "IdPartner", "Title");
|
||||||
|
|
||||||
ViewData["States"] = new SelectList(Enum.GetValues(typeof(Models.Invoice.Invoice.InvoiceState))
|
ViewData["States"] = new SelectList(Enum.GetValues(typeof(Models.Invoice.Invoice.InvoiceState))
|
||||||
|
|||||||
@@ -12,7 +12,8 @@
|
|||||||
<td class="table-number">@Html.DisplayFor(x => Model.TotalValue)</td>
|
<td class="table-number">@Html.DisplayFor(x => Model.TotalValue)</td>
|
||||||
<td class="table-status">@Html.DisplayFor(modelItem => Model.State)</td>
|
<td class="table-status">@Html.DisplayFor(modelItem => Model.State)</td>
|
||||||
<td class="text-right" style="width: 70px;">
|
<td class="text-right" style="width: 70px;">
|
||||||
<a class="btn btn-xs icon-btn btn-outline-secondary borderless" data-state="secondary" href='javascript:;'><i class="fas fa-pencil-alt" hx-get="@Url.Page("Edit", "InvoiceItemEdit", new {id = Model.IdInvoiceItem})" hx-swap="outerHTML" hx-target="closest tr"></i></a>
|
|
||||||
|
<a class="btn btn-xs icon-btn btn-outline-secondary borderless" data-state="secondary" asp-page="CreateItem" asp-route-idInvoice="@Model.Invoice.IdInvoice" asp-route-edit="true" asp-route-idInvoiceItem="@Model.IdInvoiceItem"><i class="fas fa-pencil-alt"></i></a>
|
||||||
<a class="btn btn-xs icon-btn btn-outline-danger borderless" data-state="danger" href='javascript:;' onclick="deleteInvoiceItem(this)"><i class="fas fa-times"></i></a>
|
<a class="btn btn-xs icon-btn btn-outline-danger borderless" data-state="danger" href='javascript:;' onclick="deleteInvoiceItem(this)"><i class="fas fa-times"></i></a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -170,6 +170,8 @@
|
|||||||
@(Model.InvoiceItems.IndexOf(item) + 1)
|
@(Model.InvoiceItems.IndexOf(item) + 1)
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
@if (!string.IsNullOrEmpty(item.Item?.Title))
|
||||||
|
{
|
||||||
@Html.DisplayFor(x => item.Item.Title)
|
@Html.DisplayFor(x => item.Item.Title)
|
||||||
@if (Model.Invoice.Type != Models.Invoice.Invoice.InvoiceType.Order && !string.IsNullOrEmpty(item.ItemDescription))
|
@if (Model.Invoice.Type != Models.Invoice.Invoice.InvoiceType.Order && !string.IsNullOrEmpty(item.ItemDescription))
|
||||||
{
|
{
|
||||||
@@ -186,6 +188,11 @@
|
|||||||
<b>@Html.DisplayFor(x => item.InvoiceItemJoin.Invoice.InvoiceNumberFormatted)</b>
|
<b>@Html.DisplayFor(x => item.InvoiceItemJoin.Invoice.InvoiceNumberFormatted)</b>
|
||||||
</small>
|
</small>
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
@Html.DisplayFor(x => item.ItemDescription)
|
||||||
|
}
|
||||||
</td>
|
</td>
|
||||||
<td class="text-right">@Html.DisplayFor(x => item.Quantity)</td>
|
<td class="text-right">@Html.DisplayFor(x => item.Quantity)</td>
|
||||||
@if (Model.Invoice.Type == Models.Invoice.Invoice.InvoiceType.Invoice
|
@if (Model.Invoice.Type == Models.Invoice.Invoice.InvoiceType.Invoice
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -21,20 +21,20 @@ namespace EveryThing.Pages.Invoices
|
|||||||
{
|
{
|
||||||
public class PrintTranslation
|
public class PrintTranslation
|
||||||
{
|
{
|
||||||
public string Email { get; set; } = "E-pošta";
|
public string Email { get; set; } = "E-pošta";
|
||||||
public string Telephone { get; set; } = "Tel.";
|
public string Telephone { get; set; } = "Tel.";
|
||||||
public string IdTax { get; set; } = "ID za DDV";
|
public string IdTax { get; set; } = "ID za DDV";
|
||||||
public string Iban { get; set; } = "IBAN";
|
public string Iban { get; set; } = "IBAN";
|
||||||
public string SwiftBic { get; set; } = "SWIFT/BIC";
|
public string SwiftBic { get; set; } = "SWIFT/BIC";
|
||||||
public string InvoiceType { get; set; } = "Faktura";
|
public string InvoiceType { get; set; } = "Faktura";
|
||||||
public string Number { get; set; } = "št.";
|
public string Number { get; set; } = "št.";
|
||||||
public string Date { get; set; } = "Datum";
|
public string Date { get; set; } = "Datum";
|
||||||
public string OrderNumber { get; set; } = "Številka naroèila";
|
public string OrderNumber { get; set; } = "Številka naročila";
|
||||||
public string DeliveryNote { get; set; } = "Številka dobavnice:";
|
public string DeliveryNote { get; set; } = "Številka dobavnice:";
|
||||||
public string DeliveryTime { get; set; } = "Dobavni rok";
|
public string DeliveryTime { get; set; } = "Dobavni rok";
|
||||||
public string DateOfDispatch { get; set; } = "Datum odpreme";
|
public string DateOfDispatch { get; set; } = "Datum odpreme";
|
||||||
public string Article { get; set; } = "Artikel";
|
public string Article { get; set; } = "Artikel";
|
||||||
public string Quantity { get; set; } = "Kolièina";
|
public string Quantity { get; set; } = "Količina";
|
||||||
public string Price { get; set; } = "Cena";
|
public string Price { get; set; } = "Cena";
|
||||||
public string Amount { get; set; } = "Znesek";
|
public string Amount { get; set; } = "Znesek";
|
||||||
public string Dimensions { get; set; } = "Dimenzije";
|
public string Dimensions { get; set; } = "Dimenzije";
|
||||||
@@ -49,7 +49,7 @@ namespace EveryThing.Pages.Invoices
|
|||||||
{
|
{
|
||||||
[Display(Name = "Slovensko")]
|
[Display(Name = "Slovensko")]
|
||||||
Slovenian = 1,
|
Slovenian = 1,
|
||||||
[Display(Name = "Nemško")]
|
[Display(Name = "Nemško")]
|
||||||
German = 2
|
German = 2
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155,19 +155,19 @@ namespace EveryThing.Pages.Invoices
|
|||||||
}
|
}
|
||||||
else if (Invoice.State == Invoice.InvoiceState.Inquiry)
|
else if (Invoice.State == Invoice.InvoiceState.Inquiry)
|
||||||
{
|
{
|
||||||
Translation.InvoiceType = "Povpraševanje";
|
Translation.InvoiceType = "Povpraševanje";
|
||||||
}
|
}
|
||||||
else if (Invoice.State == Invoice.InvoiceState.OfferConfirmation)
|
else if (Invoice.State == Invoice.InvoiceState.OfferConfirmation)
|
||||||
{
|
{
|
||||||
Translation.InvoiceType = "Potrditev naroèila";
|
Translation.InvoiceType = "Potrditev naročila";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Translation.InvoiceType = "Naroèilo";
|
Translation.InvoiceType = "Naročilo";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Invoice.InvoiceType.Invoice:
|
case Invoice.InvoiceType.Invoice:
|
||||||
Translation.InvoiceType = "Raèun";
|
Translation.InvoiceType = "Račun";
|
||||||
break;
|
break;
|
||||||
case Invoice.InvoiceType.DeliveryNote:
|
case Invoice.InvoiceType.DeliveryNote:
|
||||||
Translation.InvoiceType = "Dobavnica";
|
Translation.InvoiceType = "Dobavnica";
|
||||||
@@ -181,7 +181,7 @@ namespace EveryThing.Pages.Invoices
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (invoiceState == Invoice.InvoiceState.Offer)
|
if (invoiceState == Invoice.InvoiceState.Offer)
|
||||||
Translation.OrderNumber = "Št. povpraševanja.";
|
Translation.OrderNumber = "Št. povpraševanja.";
|
||||||
break;
|
break;
|
||||||
case PrintTranslationLanguage.German:
|
case PrintTranslationLanguage.German:
|
||||||
Translation = new PrintTranslation
|
Translation = new PrintTranslation
|
||||||
@@ -191,20 +191,20 @@ namespace EveryThing.Pages.Invoices
|
|||||||
Date = "Datum",
|
Date = "Datum",
|
||||||
DateOfDispatch = "Lieferdatum",
|
DateOfDispatch = "Lieferdatum",
|
||||||
DeliveryTime = "Lieferdatum",
|
DeliveryTime = "Lieferdatum",
|
||||||
Dimensions = "Maße",
|
Dimensions = "Maße",
|
||||||
Director = "Direktor",
|
Director = "Direktor",
|
||||||
Email = "Email",
|
Email = "Email",
|
||||||
Iban = "IBAN",
|
Iban = "IBAN",
|
||||||
IdTax = "Ihre UID Nr.",
|
IdTax = "Ihre UID Nr.",
|
||||||
Number = "Num.",
|
Number = "Num.",
|
||||||
OrderNumber = invoiceState == Invoice.InvoiceState.Offer ? "Anfrage No." : "Bestellnummer",
|
OrderNumber = invoiceState == Invoice.InvoiceState.Offer ? "Anfrage No." : "Bestellnummer",
|
||||||
Price = "Preis(€)",
|
Price = "Preis(€)",
|
||||||
Quantity = "Menge(Stk)",
|
Quantity = "Menge(Stk)",
|
||||||
SwiftBic = "SWIFT/BIC",
|
SwiftBic = "SWIFT/BIC",
|
||||||
Total = "Gesamtsumme",
|
Total = "Gesamtsumme",
|
||||||
Project = "Projekt",
|
Project = "Projekt",
|
||||||
Issued = "Bearbeiter:",
|
Issued = "Bearbeiter:",
|
||||||
Received = "Empfänger:",
|
Received = "Empfänger:",
|
||||||
DeliveryNote = "Lieferschein:"
|
DeliveryNote = "Lieferschein:"
|
||||||
};
|
};
|
||||||
switch (Invoice.Type)
|
switch (Invoice.Type)
|
||||||
@@ -221,7 +221,7 @@ namespace EveryThing.Pages.Invoices
|
|||||||
}
|
}
|
||||||
else if (Invoice.State == Invoice.InvoiceState.OfferConfirmation)
|
else if (Invoice.State == Invoice.InvoiceState.OfferConfirmation)
|
||||||
{
|
{
|
||||||
Translation.InvoiceType = "Auftragsbestätigung";
|
Translation.InvoiceType = "Auftragsbestätigung";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"ConnectionStrings": {
|
"ConnectionStrings": {
|
||||||
"DataConnection": "server=192.168.111.85;user=everything;password=EveryThing2022!;database=EveryThingDev"
|
"DataConnection": "server=192.168.1.12;user=everything;password=EveryThing2022!;database=EveryThingDev"
|
||||||
},
|
},
|
||||||
"Logging": {
|
"Logging": {
|
||||||
"LogLevel": {
|
"LogLevel": {
|
||||||
|
|||||||
10899
EveryThing/package-lock.json
generated
10899
EveryThing/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -12,12 +12,9 @@
|
|||||||
"watch": "npx gulp watch"
|
"watch": "npx gulp watch"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"jquery": "~3.4.1",
|
|
||||||
"jquery-validation-unobtrusive": "~3.2.11",
|
|
||||||
"@claviska/jquery-minicolors": "~2.3.2",
|
"@claviska/jquery-minicolors": "~2.3.2",
|
||||||
"animate.css": "~3.7.0",
|
"animate.css": "~3.7.0",
|
||||||
"blueimp-gallery": "~2.33.0",
|
"blueimp-gallery": "~2.33.0",
|
||||||
"popper.js": "~1.16.0",
|
|
||||||
"bootstrap": "~4.3.1",
|
"bootstrap": "~4.3.1",
|
||||||
"bootstrap-duallistbox": "~3.0.6",
|
"bootstrap-duallistbox": "~3.0.6",
|
||||||
"bootstrap-markdown": "~2.10.0",
|
"bootstrap-markdown": "~2.10.0",
|
||||||
@@ -26,28 +23,31 @@
|
|||||||
"bootstrap-slider": "~10.6.1",
|
"bootstrap-slider": "~10.6.1",
|
||||||
"bootstrap-table": "~1.14.2",
|
"bootstrap-table": "~1.14.2",
|
||||||
"chartist": "~0.11.0",
|
"chartist": "~0.11.0",
|
||||||
|
"cldr-data": "~36.0.0",
|
||||||
|
"cldr-numbers-modern": "~39.0.0",
|
||||||
|
"cldrjs": "~0.5.5",
|
||||||
"cropper": "~4.0.0-beta",
|
"cropper": "~4.0.0-beta",
|
||||||
"datatables.net-bs4": "~1.10.16",
|
"datatables.net-bs4": "~1.10.16",
|
||||||
"dragula": "~3.7.2",
|
"dragula": "~3.7.2",
|
||||||
|
"globalize": "~1.7.0",
|
||||||
|
"html2pdf.js": "~0.10.1",
|
||||||
|
"htmx.org": "~1.6.1",
|
||||||
|
"jquery": "~3.4.1",
|
||||||
|
"jquery-ajax-unobtrusive": "~3.2.6",
|
||||||
|
"jquery-validation-unobtrusive": "~3.2.11",
|
||||||
"jquery.growl": "~1.3.5",
|
"jquery.growl": "~1.3.5",
|
||||||
"jstree": "~3.3.5",
|
"jstree": "~3.3.5",
|
||||||
"ladda": "~2.0.0",
|
"ladda": "~2.0.0",
|
||||||
"perfect-scrollbar": "~1.4.0",
|
"perfect-scrollbar": "~1.4.0",
|
||||||
"photoswipe": "~4.1.2",
|
"photoswipe": "~4.1.2",
|
||||||
"plyr": "~2.0.18",
|
"plyr": "~2.0.18",
|
||||||
|
"popper.js": "~1.16.0",
|
||||||
"select2": "4.0.13",
|
"select2": "4.0.13",
|
||||||
"spinkit": "~1.2.5",
|
"spinkit": "~1.2.5",
|
||||||
"sweetalert2": "~11.4.33",
|
"sweetalert2": "~11.4.33",
|
||||||
"swiper": "~4.5.0",
|
"swiper": "~4.5.0",
|
||||||
"toastr": "~2.1.4",
|
"toastr": "~2.1.4",
|
||||||
"vegas": "~2.4.0",
|
"vegas": "~2.4.0"
|
||||||
"jquery-ajax-unobtrusive": "~3.2.6",
|
|
||||||
"globalize": "~1.7.0",
|
|
||||||
"cldrjs": "~0.5.5",
|
|
||||||
"cldr-data": "~36.0.0",
|
|
||||||
"cldr-numbers-modern": "~39.0.0",
|
|
||||||
"html2pdf.js": "~0.10.1",
|
|
||||||
"htmx.org": "~1.6.1"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "~7.4.0",
|
"@babel/core": "~7.4.0",
|
||||||
@@ -62,7 +62,8 @@
|
|||||||
"gulp-rename": "~1.4.0",
|
"gulp-rename": "~1.4.0",
|
||||||
"gulp-sass": "~4.0.1",
|
"gulp-sass": "~4.0.1",
|
||||||
"gulp-sourcemaps": "~2.6.4",
|
"gulp-sourcemaps": "~2.6.4",
|
||||||
"gulp-uglify": "~3.0.1"
|
"gulp-uglify": "~3.0.1",
|
||||||
|
"sass": "^1.97.2"
|
||||||
},
|
},
|
||||||
"resolutions": {
|
"resolutions": {
|
||||||
"gulp-sass/node-sass": "4.12.0"
|
"gulp-sass/node-sass": "4.12.0"
|
||||||
|
|||||||
2
package-lock.json
generated
2
package-lock.json
generated
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "EveryThing",
|
"name": "EverythingTomato",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
|
|||||||
12
prenosBaze.txt
Normal file
12
prenosBaze.txt
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
#dump
|
||||||
|
mysqldump -P [port] -h [host] -u [username] -p [database] > dump.sql
|
||||||
|
|
||||||
|
CREATE USER 'everything'@'%' IDENTIFIED BY 'EveryThing2022!';
|
||||||
|
GRANT ALL PRIVILEGES ON EveryThingDev.* TO 'everything'@'%';
|
||||||
|
FLUSH PRIVILEGES;
|
||||||
|
|
||||||
|
|
||||||
|
mysql -h 127.0.0.1 -P 3306 -u david -p EveryThingDev < evedump.sql
|
||||||
|
# ce negre
|
||||||
|
sed -i 's/utf8mb4_0900_ai_ci/utf8mb4_unicode_ci/g' evedump.sql
|
||||||
|
sed -i 's/utf8mb4_0900_bin/utf8mb4_unicode_ci/g' evedump.sql
|
||||||
Reference in New Issue
Block a user