This commit is contained in:
David Štaleker
2024-03-11 18:22:37 +01:00
parent 172626c8ee
commit dda4b613f8
32 changed files with 442 additions and 76 deletions

View File

@@ -3,7 +3,7 @@
@{
ViewData["Title"] = "Edit board";
Layout = "~/Pages/Shared/_Layout.cshtml";
Layout = "~/Pages/Layouts/_Layout.cshtml";
}
<!-- Editor -->

View File

@@ -3,20 +3,11 @@
@{
ViewData["Title"] = "Oglasne deske - Pregled";
Layout = "~/Pages/Shared/_Layout.cshtml";
Layout = "~/Pages/Layouts/_Layout.cshtml";
}
@section Styles {
<link rel="stylesheet" href="~/vendor/libs/bootstrap-material-datetimepicker/bootstrap-material-datetimepicker.css">
<style type="text/css">
.table > tbody > tr > td:nth-child(2),
.table > thead > tr > th:nth-child(2),
.table > tbody > tr > td:nth-child(3),
.table > thead > tr > th:nth-child(3) {
width: 100px
}
</style>
<link rel="stylesheet" href="~/css/boards/index.css" asp-append-version="true" />
}
<h4 class="d-flex justify-content-between align-items-center w-100 font-weight-bold py-1 mb-4">
@@ -27,43 +18,59 @@
</span>
</h4>
<div class="row">
<div class="col-12 mb-2 text-right">
<div class="btn-group">
<input id="inpSearchBoard" class="form-control" type="text" value="" placeholder="Iskanje..." autocomplete="off">
<button id="btnRefresh" type="submit" class="btn btn-secondary" aria-label="Osveži" title="Osveži">
<i class="opacity-75 ion ion-md-refresh"></i>
</button>
</div>
</div>
</div>
<div class="card">
<h6 class="card-header">
Seznam oglasnih desk
</h6>
<table class="table card-table">
<thead>
<tr>
<th>
@Html.DisplayNameFor(model => model.Boards[0].Name)
</th>
<th>
@Html.DisplayNameFor(model => model.Boards[0].Ratio)
</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach (var item in Model.Boards)
{
<div class="div-boards">
<table class="table card-table table-hover">
<thead>
<tr>
<td>
@Html.DisplayFor(modelItem => item.Name)
</td>
<td>
@Html.DisplayFor(modelItem => item.Ratio)
</td>
<td>
<a class="btn btn-xs icon-btn btn-outline-secondary borderless" asp-page="AddEdit" asp-route-guid="@item.Guid" data-toggle="tooltip" data-placement="top" title="Urejanje" data-state="secondary"><i class="fas fa-pencil-alt"></i></a>
</td>
<th>
@Html.DisplayNameFor(model => model.Boards[0].Name)
</th>
<th>
@Html.DisplayNameFor(model => model.Boards[0].Ratio)
</th>
<th></th>
</tr>
}
</tbody>
</table>
</thead>
<tbody>
@foreach (var item in Model.Boards)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.Name)
</td>
<td>
@Html.DisplayFor(modelItem => item.Ratio)
</td>
<td>
<a class="btn btn-xs icon-btn btn-outline-success borderless" asp-page="View" asp-route-guid="@item.Guid" data-toggle="tooltip" data-placement="top" title="Urejanje" data-state="secondary"><i class="fas fa-external-link"></i></a>
<a class="btn btn-xs icon-btn btn-outline-secondary borderless" asp-page="AddEdit" asp-route-guid="@item.Guid" data-toggle="tooltip" data-placement="top" title="Urejanje" data-state="secondary"><i class="fas fa-pencil-alt"></i></a>
</td>
</tr>
}
</tbody>
</table>
</div>
<div class="card-footer py-3 text-right">
<a asp-page="AddEdit" class="btn btn-primary">Dodaj novo</a>
</div>
</div>
@section Scripts {
<script src="~/js/boards/index.js" asp-append-version="true"></script>
}

View File

@@ -0,0 +1,26 @@
@page "{handler?}"
@model ZpcBulletinBoard.Pages.Boards.ViewModel
@{
ViewData["Title"] = "Board view";
Layout = "~/Pages/Layouts/_LayoutBlank.cshtml";
}
@section Styles {
<link rel="stylesheet" href="~/css/boards/view.css" asp-append-version="true" />
}
<input id="inpGuidBoard" type="hidden" asp-for="Guid"/>
<div class="div-placeholder">
</div>
<div class="div-no-pages">
<i class="fal fa-exclamation-triangle fa-10x text-danger"></i>
<h2>Ni prosojnic za @Model.Guid</h2>
</div>
@section Scripts {
<script src="~/js/boards/view.js" asp-append-version="true"></script>
}

View File

@@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.EntityFrameworkCore;
using ZpcBulletinBoard.Data;
using ZpcBulletinBoard.Models;
using ZpcBulletinBoard.Models.Editor;
namespace ZpcBulletinBoard.Pages.Boards
{
[AllowAnonymous]
public class ViewModel(ApplicationDbContext context)
: PageModel
{
[BindProperty] public string Guid { get; set; } = "";
public IActionResult OnGet(string? guid)
{
if (string.IsNullOrEmpty(guid))
{
return NotFound();
}
Guid = guid;
return Page();
}
}
}

View File

@@ -3,7 +3,7 @@
@{
ViewData["Title"] = "Oglasne deske - Povezave";
Layout = "~/Pages/Shared/_Layout.cshtml";
Layout = "~/Pages/Layouts/_Layout.cshtml";
}
@section Styles
@@ -20,13 +20,13 @@
</h4>
<div class="card">
<div class="card-header">
<div class="header">
<div class="div-content">
<div class="div-content-boards">
<h6>Oglasne deske</h6>
<input id="inpSearchBoard" class="form-control form-control-sm" placeholder="Iskanje oglasnik desk..." />
</div>
<div class="div-content-pages">
<h6>Strani</h6>
<input id="inpSearchPage" class="form-control form-control-sm" placeholder="Iskanje strani..." />
</div>
</div>
</div>
@@ -48,7 +48,15 @@
@foreach (var tmpPage in Model.Pages)
{
<div class="div-page available-page" draggable="true" ondragstart="dragPage(event, this)" data-id="@tmpPage.IdBulletinBoardPage">
<img class="img-thumbnail rounded" src="/bulletin-board-images/pages/@tmpPage.Image" alt="page image" />
@if ((int)tmpPage.Type == 3)
{
<div class='img-link'><i class="fas fa-link fa-5x"></i></div>
}
else
{
<img class="img-thumbnail rounded" src="/bulletin-board-images/pages/@tmpPage.Image" onerror="this.src='/img/imgNotExists.jpg'" alt="page image" />
}
<small>@tmpPage.Name</small>
<div class="tools">
@* <a href="javascript:;" class="btn btn-xs icon-btn btn-outline-primary borderless"><i class="fas fa-reply"></i></a> *@

View File

@@ -4,12 +4,9 @@
<div class="app-brand demo">
<span class="app-brand-logo demo bg-secondary">
<i class="fas fa-draw-circle text-white"></i>
<i class="fas fa-thumbtack text-white"></i>
</span>
<a href="/" class="app-brand-text demo sidenav-text font-weight-normal ml-2">Bulletin board</a>
<a href="javascript:void(0)" class="layout-sidenav-toggle sidenav-link text-large ml-auto">
<i class="ion ion-md-menu align-middle"></i>
</a>
<a href="/" class="app-brand-text demo sidenav-text font-weight-normal ml-2">ZPC Bulletin board</a>
</div>
<div class="sidenav-divider mt-0"></div>
@@ -24,5 +21,14 @@
<li class="sidenav-item@(currentPage.StartsWith("/BoardsLinks/") ? " active" : "")">
<a asp-page="/BoardsLinks/Index" class="sidenav-link"><i class="sidenav-icon fas fa-link"></i><div>Povezave</div></a>
</li>
@if (User.IsInRole("Administrator") || User.IsInRole("TransportThingUser"))
{
<li class="sidenav-divider mb-1"></li>
<li class="sidenav-header small font-weight-semibold">ADMINISTRACIJA</li>
<li class="sidenav-item@(currentPage.StartsWith("/TransportLoadingOrder/") ? " active" : "")">
<a asp-page="/TransportLoadingOrder/Index" class="sidenav-link"><i class="sidenav-icon far fa-u"></i><div>Uporabniki</div></a>
</li>
}
</ul>
</div>

View File

@@ -7,7 +7,8 @@
<meta name="description" content="" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0" />
<title>ZPC-BB - @ViewData["Title"]</title>
<title>ZPC BB - @ViewData["Title"]</title>
<link rel="icon" type="image/x-icon" href="/pin.ico">
<!-- Fonts -->
<link href="https://fonts.googleapis.com/css?family=Roboto:300,300i,400,400i,500,500i,700,700i,900" rel="stylesheet" crossorigin="anonymous" />

View File

@@ -1,5 +1,5 @@
@{
Layout = "Shared/_Application";
Layout = "Layouts/_Application";
}
@section Styles {

View File

@@ -1,5 +1,5 @@
@{
Layout = "Shared/_Application";
Layout = "Layouts/_Application";
}
@section Styles {

View File

@@ -3,7 +3,7 @@
@{
ViewData["Title"] = "Strani - Pregled";
Layout = "~/Pages/Shared/_Layout.cshtml";
Layout = "~/Pages/Layouts/_Layout.cshtml";
}
@section Styles {
@@ -19,6 +19,17 @@
</span>
</h4>
<div class="row">
<div class="col-12 mb-2 text-right">
<div class="btn-group">
<input id="inpSearchPage" class="form-control" type="text" value="" placeholder="Iskanje..." autocomplete="off">
<button id="btnRefresh" type="submit" class="btn btn-secondary" aria-label="Osveži" title="Osveži">
<i class="opacity-75 ion ion-md-refresh"></i>
</button>
</div>
</div>
</div>
<div class="card">
<h6 class="card-header">
Strani

View File

@@ -99,7 +99,25 @@ namespace ZpcBulletinBoard.Pages.Pages
tmpPage.Image = imageName;
context.SaveChanges();
return new JsonResult(new { successful = true, error = $"" });
return new JsonResult(new { successful = true, error = $"", page = tmpPage });
}
//Delete
public IActionResult OnDeleteBoardPage(int idPage)
{
var tmpPage = context.BulletinBoardPage
.Include(x => x.Links)
.FirstOrDefault(x => x.IdBulletinBoardPage == idPage);
if (tmpPage == null)
return new JsonResult(new { successful = false, error = $"Page with ID {idPage} not exists!"});
if (tmpPage.Links.Any())
return new JsonResult(new { successful = false, error = $"Stran je v uporabi!\nBrisanje ni možno!" });
context.BulletinBoardPage.Remove(tmpPage);
context.SaveChanges();
return new JsonResult(new { successful = true, error = "" });
}
}
}

View File

@@ -2,5 +2,5 @@
@model ZpcBulletinBoard.Pages.SetupNew.SetupModel
@{
ViewData["Title"] = "SetupNew";
Layout = "~/Pages/Shared/_LayoutBlank.cshtml";
Layout = "~/Pages/Layouts/_LayoutBlank.cshtml";
}

View File

@@ -4,7 +4,7 @@
@model ZpcBulletinBoard.Pages.User.LoginModel
@{
ViewData["Title"] = "Prijava";
Layout = "~/Pages/Shared/_LayoutBlank.cshtml";
Layout = "~/Pages/Layouts/_LayoutBlank.cshtml";
}
@section Styles {

View File

@@ -2,5 +2,5 @@
@model ZpcBulletinBoard.Pages.User.LogoutModel
@{
ViewData["Title"] = "Odjava";
Layout = "~/Pages/Shared/_Layout.cshtml";
Layout = "~/Pages/Layouts/_Layout.cshtml";
}

View File

@@ -1,3 +1,3 @@
@{
Layout = "_Layout";
Layout = "~/Pages/Layouts/_Layout.cshtml";
}