Sicherung vor Bootstrap Aktualsisierung
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
using FSI.Prj.Mgt.Models;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Storage;
|
||||
using Newtonsoft.Json;
|
||||
using X.PagedList;
|
||||
|
||||
namespace FSI.Prj.Mgt.Controllers
|
||||
@@ -18,25 +20,47 @@ namespace FSI.Prj.Mgt.Controllers
|
||||
public IActionResult Index()
|
||||
{
|
||||
|
||||
var organizations = _context.Organizations.ToList();
|
||||
List<TreeViewNode> nodes = new();
|
||||
|
||||
var org = organizations.Where(x => x.ParentId == 0 || x.ParentId == null).FirstOrDefault();
|
||||
|
||||
SetChildren(org, organizations);
|
||||
|
||||
return View(org);
|
||||
}
|
||||
|
||||
private void SetChildren(Organization model, List<Organization> organizations)
|
||||
// Loop and add the Parent Nodes
|
||||
foreach (Organization organization in _context.Organizations)
|
||||
{
|
||||
var childs = organizations.Where(x => x.ParentId == model.Id).ToList();
|
||||
|
||||
foreach (var item in childs)
|
||||
if (organization.ParentId == null)
|
||||
{
|
||||
SetChildren(item, organizations);
|
||||
model.Childs.Add(item);
|
||||
nodes.Add(new TreeViewNode
|
||||
{
|
||||
id = organization.Id.ToString(),
|
||||
parent = "#",
|
||||
text = organization.Name,
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
nodes.Add(new TreeViewNode
|
||||
{
|
||||
id = organization.Id.ToString(),
|
||||
parent = organization.ParentId.ToString(),
|
||||
text = organization.Name,
|
||||
});
|
||||
}
|
||||
}
|
||||
ViewBag.Json = JsonConvert.SerializeObject(nodes);
|
||||
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public IActionResult Index (string selectedItems)
|
||||
{
|
||||
if (selectedItems != null)
|
||||
{
|
||||
List<TreeViewNode> items = JsonConvert.DeserializeObject<List<TreeViewNode>>(selectedItems);
|
||||
}
|
||||
|
||||
return RedirectToAction("Index", "Organization");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -117,5 +117,74 @@ namespace FSI.Prj.Mgt.Controllers
|
||||
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
|
||||
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult Create()
|
||||
{
|
||||
//ViewBag.Plants = _context.Plants;
|
||||
|
||||
//if (id == 0)
|
||||
//{
|
||||
Project prj = new Project();
|
||||
|
||||
return PartialView("_CreateEditPartial", prj);
|
||||
//}
|
||||
|
||||
//var project = _context.Projects.Find(id);
|
||||
|
||||
//if (project == null)
|
||||
//{
|
||||
// return NotFound();
|
||||
//}
|
||||
|
||||
//return PartialView("_CreateEditPartial", project);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public IActionResult Create(Project project)
|
||||
{
|
||||
if (project.Id == 0)
|
||||
{
|
||||
var highestPrjNo = 0;
|
||||
int prjYear = 0;
|
||||
int prjNo = 0;
|
||||
|
||||
if (_context.Projects.Count() > 0)
|
||||
{
|
||||
highestPrjNo = _context.Projects.Max(x => x.No);
|
||||
prjYear = highestPrjNo;
|
||||
|
||||
// Projekt Jahr freistellen
|
||||
while (prjYear >= 100)
|
||||
prjYear /= 10;
|
||||
|
||||
// Laufende Nr. des Jahres freistellen
|
||||
prjNo = highestPrjNo >= 1000 ? highestPrjNo % 1000 : highestPrjNo;
|
||||
}
|
||||
|
||||
// Neue Projekt Nummer berechnen
|
||||
if (prjYear == int.Parse(DateTime.Now.ToString("yy")))
|
||||
{
|
||||
project.No = prjYear * 1000 + prjNo + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
project.No = int.Parse(DateTime.Now.ToString("yy")) * 1000 + 1;
|
||||
}
|
||||
|
||||
_context.Projects.Add(project);
|
||||
}
|
||||
else
|
||||
{
|
||||
_context.Projects.Update(project);
|
||||
|
||||
}
|
||||
|
||||
_context.SaveChanges();
|
||||
|
||||
return PartialView("_CreateEditPartial", project);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,16 +7,16 @@ namespace FSI.Prj.Mgt.Data
|
||||
public class ApplicationDbContext : IdentityDbContext
|
||||
{
|
||||
|
||||
public DbSet<Project> Projects { get; set; }
|
||||
|
||||
public DbSet<Plant> Plants { get; set; }
|
||||
|
||||
public DbSet<Organization> Organizations { get; set; }
|
||||
|
||||
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
|
||||
: base(options)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public DbSet<Project> Projects { get; set; }
|
||||
|
||||
public DbSet<Plant> Plants { get; set; }
|
||||
|
||||
public DbSet<Organization> Organizations { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -12,8 +12,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
namespace FSI.Prj.Mgt.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(ApplicationDbContext))]
|
||||
[Migration("20230919114347_addedOrganizationSet")]
|
||||
partial class addedOrganizationSet
|
||||
[Migration("20230920052441_addedOrganizationDbSet")]
|
||||
partial class addedOrganizationDbSet
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
@@ -41,6 +41,9 @@ namespace FSI.Prj.Mgt.Data.Migrations
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("OrganizationId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("ParentId")
|
||||
.HasColumnType("int");
|
||||
|
||||
@@ -50,7 +53,7 @@ namespace FSI.Prj.Mgt.Data.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ParentId");
|
||||
b.HasIndex("OrganizationId");
|
||||
|
||||
b.ToTable("Organizations");
|
||||
});
|
||||
@@ -320,11 +323,9 @@ namespace FSI.Prj.Mgt.Data.Migrations
|
||||
|
||||
modelBuilder.Entity("FSI.Prj.Mgt.Models.Organization", b =>
|
||||
{
|
||||
b.HasOne("FSI.Prj.Mgt.Models.Organization", "Parent")
|
||||
.WithMany("Childs")
|
||||
.HasForeignKey("ParentId");
|
||||
|
||||
b.Navigation("Parent");
|
||||
b.HasOne("FSI.Prj.Mgt.Models.Organization", null)
|
||||
.WithMany("Organizations")
|
||||
.HasForeignKey("OrganizationId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FSI.Prj.Mgt.Models.Project", b =>
|
||||
@@ -391,7 +392,7 @@ namespace FSI.Prj.Mgt.Data.Migrations
|
||||
|
||||
modelBuilder.Entity("FSI.Prj.Mgt.Models.Organization", b =>
|
||||
{
|
||||
b.Navigation("Childs");
|
||||
b.Navigation("Organizations");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
@@ -5,7 +5,7 @@
|
||||
namespace FSI.Prj.Mgt.Data.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class addedOrganizationSet : Migration
|
||||
public partial class addedOrganizationDbSet : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
@@ -19,22 +19,23 @@ namespace FSI.Prj.Mgt.Data.Migrations
|
||||
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
ShortName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Description = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
ParentId = table.Column<int>(type: "int", nullable: true)
|
||||
ParentId = table.Column<int>(type: "int", nullable: true),
|
||||
OrganizationId = table.Column<int>(type: "int", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Organizations", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Organizations_Organizations_ParentId",
|
||||
column: x => x.ParentId,
|
||||
name: "FK_Organizations_Organizations_OrganizationId",
|
||||
column: x => x.OrganizationId,
|
||||
principalTable: "Organizations",
|
||||
principalColumn: "Id");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Organizations_ParentId",
|
||||
name: "IX_Organizations_OrganizationId",
|
||||
table: "Organizations",
|
||||
column: "ParentId");
|
||||
column: "OrganizationId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -38,6 +38,9 @@ namespace FSI.Prj.Mgt.Data.Migrations
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("OrganizationId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("ParentId")
|
||||
.HasColumnType("int");
|
||||
|
||||
@@ -47,7 +50,7 @@ namespace FSI.Prj.Mgt.Data.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ParentId");
|
||||
b.HasIndex("OrganizationId");
|
||||
|
||||
b.ToTable("Organizations");
|
||||
});
|
||||
@@ -317,11 +320,9 @@ namespace FSI.Prj.Mgt.Data.Migrations
|
||||
|
||||
modelBuilder.Entity("FSI.Prj.Mgt.Models.Organization", b =>
|
||||
{
|
||||
b.HasOne("FSI.Prj.Mgt.Models.Organization", "Parent")
|
||||
.WithMany("Childs")
|
||||
.HasForeignKey("ParentId");
|
||||
|
||||
b.Navigation("Parent");
|
||||
b.HasOne("FSI.Prj.Mgt.Models.Organization", null)
|
||||
.WithMany("Organizations")
|
||||
.HasForeignKey("OrganizationId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FSI.Prj.Mgt.Models.Project", b =>
|
||||
@@ -388,7 +389,7 @@ namespace FSI.Prj.Mgt.Data.Migrations
|
||||
|
||||
modelBuilder.Entity("FSI.Prj.Mgt.Models.Organization", b =>
|
||||
{
|
||||
b.Navigation("Childs");
|
||||
b.Navigation("Organizations");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
@@ -14,6 +14,7 @@
|
||||
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="7.0.11" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.11" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.11" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="X.PagedList.Mvc.Core" Version="8.4.7" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -13,8 +13,6 @@ namespace FSI.Prj.Mgt.Models
|
||||
public string Description { get; set; }
|
||||
|
||||
public int? ParentId { get; set; }
|
||||
[ForeignKey("ParentId")]
|
||||
public virtual Organization Parent { get; set; }
|
||||
public virtual ICollection<Organization> Childs { get; set; }
|
||||
public virtual List<Organization> Organizations{ get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
9
FSI.Prj.Mgt/FSI.Prj.Mgt/Models/TreeViewNode.cs
Normal file
9
FSI.Prj.Mgt/FSI.Prj.Mgt/Models/TreeViewNode.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
namespace FSI.Prj.Mgt.Models
|
||||
{
|
||||
public class TreeViewNode
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string parent{ get; set; }
|
||||
public string text { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -3,4 +3,34 @@
|
||||
}
|
||||
<h1>@ViewData["Title"]</h1>
|
||||
|
||||
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.12.9/dist/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
|
||||
|
||||
<p>Use this page to detail your site's privacy policy.</p>
|
||||
|
||||
<!-- Button trigger modal -->
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal">
|
||||
Launch demo modal
|
||||
</button>
|
||||
|
||||
<!-- Modal -->
|
||||
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="exampleModalLabel">Modal title</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
...
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||
<button type="button" class="btn btn-primary">Save changes</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,17 +1,60 @@
|
||||
@model FSI.Prj.Mgt.Models.Organization
|
||||
|
||||
|
||||
@using (Html.BeginForm("Index", "Organization", FormMethod.Post))
|
||||
{
|
||||
<input type="hidden" name="selectedItems" id="selectedItems" />
|
||||
<input type="submit" value="submit" />
|
||||
<input type="text" value="" style="box-shadow:inset 0 0 4px #eee; width:120px; margin:0; padding:6px 12px; border-radius:4px; border:1px solid silver; font-size:1.1em;" id="search" placeholder="Search" />
|
||||
}
|
||||
|
||||
<div id="divtree">
|
||||
<ul id="tree">
|
||||
<li>
|
||||
<a href="#" class="usr">@Model.Name</a>
|
||||
@Html.Partial("Childrens", Model)
|
||||
</li>
|
||||
</ul>
|
||||
<div id="jstree">
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(funciton(){
|
||||
$("#divtree").jstree();
|
||||
@section scripts{
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.2.1/themes/default/style.min.css" />
|
||||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.1/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.2.1/jstree.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
$(function () {
|
||||
var to = false;
|
||||
$('#search').keyup(function () {
|
||||
if (to) { clearTimeout(to); }
|
||||
to = setTimeout(function () {
|
||||
var v = $('#search').val();
|
||||
$('#jstree').jstree(true).search(v);
|
||||
}, 250);
|
||||
});
|
||||
</script>
|
||||
$('#jstree').on('changed.jstree', function (e, data) {
|
||||
var i, j,
|
||||
postedItems = [];
|
||||
for (i = 0, j = data.selected.length; i < j; i++) {
|
||||
|
||||
|
||||
postedItems.push({
|
||||
text: data.instance.get_node(data.selected[i]).text,
|
||||
id: data.selected [i],
|
||||
parent: data.node.parents[0]
|
||||
});
|
||||
}
|
||||
|
||||
// Serialize the JSON Array an save in HiddenField
|
||||
$('#selectedItems').val(JSON.stringify(postedItems));
|
||||
|
||||
}).jstree({
|
||||
"core": {
|
||||
"multiple" : false,
|
||||
"themes": {
|
||||
"variant": "large"
|
||||
},
|
||||
"data": @Html.Raw(ViewBag.Json)
|
||||
},
|
||||
"checkbox": {
|
||||
"keep_selected_style": false
|
||||
},
|
||||
"plugins": ["wholerow", "checkbox", "search"],
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
}
|
||||
|
||||
@@ -51,6 +51,12 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col mb-3">
|
||||
<select asp-for="PlantId" class="form-control" asp-items="@(new SelectList(@ViewBag.Plants, "Id", "OutSh"))"></select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-footer">
|
||||
<button type="submit" class="btn btn-primary">Speichern</button>
|
||||
</div>
|
||||
|
||||
@@ -11,15 +11,13 @@
|
||||
|
||||
<h1> Projekt-Übersicht</h1>
|
||||
|
||||
<form asp-action="CreateEdit">
|
||||
<button type="submit" class="btn btn-primary"><i class="bi bi-plus-square"></i> neues Projekt</button>
|
||||
@* <form asp-action="CreateEdit">
|
||||
<button type="submit" class="btn btn-primary"><i class="bi bi-plus-square"></i> neues Projekt erstellen</button>
|
||||
</form>
|
||||
|
||||
<hr />
|
||||
|
||||
*@
|
||||
<form asp-action="Index" method="get">
|
||||
<p>
|
||||
Suchen nach: <input type="text" name="SearchString" value=""/>
|
||||
Suchen nach: <input type="text" name="SearchString" value="" />
|
||||
<input type="submit" value="suchen" />
|
||||
</p>
|
||||
</form>
|
||||
@@ -75,6 +73,7 @@
|
||||
|
||||
</table>
|
||||
|
||||
|
||||
<nav>
|
||||
@Html.PagedListPager(Model, page => Url.Action("index", new { page = page }), new PagedListRenderOptions()
|
||||
{
|
||||
@@ -89,4 +88,39 @@
|
||||
})
|
||||
</nav>
|
||||
|
||||
<div id="PlaceHolderHere"></div>
|
||||
|
||||
<button type="button" class="btn btn-primary" data-toggle="ajax-modal" data-target="#addProject" data-url="@Url.Action("Create")">Create</button>
|
||||
|
||||
|
||||
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.12.9/dist/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
|
||||
|
||||
|
||||
<!-- Button trigger modal -->
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal">
|
||||
Launch demo modal
|
||||
</button>
|
||||
|
||||
<!-- Modal -->
|
||||
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="exampleModalLabel">Modal title</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
...
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||
<button type="button" class="btn btn-primary">Save changes</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
@model FSI.Prj.Mgt.Models.Project
|
||||
|
||||
|
||||
|
||||
@* <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.12.9/dist/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
|
||||
*@
|
||||
|
||||
<div class="modal fade" id="addProject">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="addProjectLabel">neues Project anlegen</h4>
|
||||
<button type="button" class="btn-close" data-dismiss="modal">
|
||||
<span>X</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Modal -->
|
||||
@* <div class="modal fade" id="addProject" >
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="addProjectLabel">neues Projekt anlegen</h5>
|
||||
<button type="button" class="close" data-dismiss="modal">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form action="Create">
|
||||
|
||||
<div class="row">
|
||||
<div class="col mb-3">
|
||||
<input asp-for="Id" placeholder="ID" class="form-control" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col mb-3">
|
||||
<input asp-for="No" placeholder="Projekt-Nr." class="form-control" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col mb-3">
|
||||
<select asp-for="PlantId" class="form-control" asp-items="@(new SelectList(@ViewBag.Plants, "Id", "OutSh"))"></select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col mb-3">
|
||||
<input asp-for="Name" placeholder="Name" class="form-control" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col mb-3">
|
||||
<input asp-for="Description" placeholder="Beschreibung" class="form-control" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col mb-3">
|
||||
<select asp-for="Status" asp-items="Html.GetEnumSelectList<FSI.Prj.Mgt.Models.ProjectStatus>()" class="form-control"></select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class=" btn btn-primary" data-dismiss="modal">Close</button>
|
||||
<button type="button" class=" btn btn-primary" data-save="modal">erstellen</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> *@
|
||||
|
||||
@* <script src="https://code.jquery.com/ui/1.11.3/jquery-ui.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
$('.modal-content').resizable({
|
||||
alsoResize: ".modal-dialog",
|
||||
minHeight: 300,
|
||||
minWidth: 300
|
||||
});
|
||||
$('.modal-dialog').draggable();
|
||||
|
||||
$('#myModal').on('show.bs.modal', function () {
|
||||
$(this).find('.modal-body').css({
|
||||
'max-height': '100%'
|
||||
});
|
||||
});
|
||||
</script> *@
|
||||
@@ -27,6 +27,9 @@
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Organization" asp-action="Index">Organization</a>
|
||||
</li>
|
||||
</ul>
|
||||
<partial name="_LoginPartial" />
|
||||
</div>
|
||||
|
||||
@@ -2,3 +2,29 @@
|
||||
// for details on configuring this project to bundle and minify static web assets.
|
||||
|
||||
// Write your JavaScript code.
|
||||
|
||||
|
||||
$(function () {
|
||||
|
||||
var PlaceHolderElement = $('#PlaceHolderHere');
|
||||
|
||||
$('button[data-toggle="ajax-modal"]').click(function (event) {
|
||||
|
||||
var url = $(this).data('url');
|
||||
var decodeUrl = decodeURIComponent(url);
|
||||
$.get(decodeUrl).done(function (data) {
|
||||
PlaceHolderElement.html(data);
|
||||
PlaceHolderElement.find('.modal').modal('show');
|
||||
})
|
||||
})
|
||||
|
||||
PlaceHolderElement.on('click', '[data-save="modal"]', function (event) {
|
||||
var form = $(this).parents('.modal').find('form');
|
||||
var actionUrl = form.attr('action');
|
||||
var url = "/project/" + actionUrl;
|
||||
var sendData = from.serialize();
|
||||
$.post(url, sendData).done(function (data) {
|
||||
PlaceHolderElement.find('.modal').modal('hide');
|
||||
})
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user