From 4b8c54d38d2ffce47f44713ec4a817b82193e7aa Mon Sep 17 00:00:00 2001 From: Elias Jansson Date: Thu, 24 Jul 2025 10:59:33 +0200 Subject: [PATCH 1/2] Category fix and movie 0.1 --- Aberwyn/Aberwyn.csproj | 7 ----- Aberwyn/Controllers/MovieController.cs | 13 ++++++++ Aberwyn/Models/MediaModels.cs | 33 ++++++++++++++++++++ Aberwyn/Views/Movie/Search.cshtml | 43 ++++++++++++++++++++++++++ Aberwyn/wwwroot/js/budget.js | 9 +++--- 5 files changed, 94 insertions(+), 11 deletions(-) create mode 100644 Aberwyn/Controllers/MovieController.cs create mode 100644 Aberwyn/Models/MediaModels.cs create mode 100644 Aberwyn/Views/Movie/Search.cshtml diff --git a/Aberwyn/Aberwyn.csproj b/Aberwyn/Aberwyn.csproj index 96925a8..ba378a5 100644 --- a/Aberwyn/Aberwyn.csproj +++ b/Aberwyn/Aberwyn.csproj @@ -9,13 +9,6 @@ Linux - - - - - - - diff --git a/Aberwyn/Controllers/MovieController.cs b/Aberwyn/Controllers/MovieController.cs new file mode 100644 index 0000000..a41400a --- /dev/null +++ b/Aberwyn/Controllers/MovieController.cs @@ -0,0 +1,13 @@ +using Microsoft.AspNetCore.Mvc; + +namespace Aberwyn.Controllers +{ + public class MovieController : Controller + { + [HttpGet("/movie/search")] + public IActionResult Search() + { + return View(); + } + } +} diff --git a/Aberwyn/Models/MediaModels.cs b/Aberwyn/Models/MediaModels.cs new file mode 100644 index 0000000..909fb51 --- /dev/null +++ b/Aberwyn/Models/MediaModels.cs @@ -0,0 +1,33 @@ +namespace Aberwyn.Models +{ + public class StreamingService + { + public int Id { get; set; } + public string Name { get; set; } // T.ex. "Netflix", "Plex" + } + + public class MediaItem + { + public int Id { get; set; } + public string TmdbId { get; set; } // TMDb ID + public string Title { get; set; } + public string Overview { get; set; } + public string PosterPath { get; set; } + public string MediaType { get; set; } // "movie" eller "tv" + public double Rating { get; set; } + public DateTime? ReleaseDate { get; set; } + + public List MediaItemStreamingServices { get; set; } = new(); + } + + public class MediaItemStreamingService + { + public int MediaItemId { get; set; } + public MediaItem MediaItem { get; set; } + + public int StreamingServiceId { get; set; } + public StreamingService StreamingService { get; set; } + } + + +} diff --git a/Aberwyn/Views/Movie/Search.cshtml b/Aberwyn/Views/Movie/Search.cshtml new file mode 100644 index 0000000..b74f97e --- /dev/null +++ b/Aberwyn/Views/Movie/Search.cshtml @@ -0,0 +1,43 @@ +@{ + ViewData["Title"] = "Filmsök"; +} +
+

🎬 Filmsök

+ + +
+
+ +@section Scripts { + +} diff --git a/Aberwyn/wwwroot/js/budget.js b/Aberwyn/wwwroot/js/budget.js index 7e2d706..9a7a060 100644 --- a/Aberwyn/wwwroot/js/budget.js +++ b/Aberwyn/wwwroot/js/budget.js @@ -557,14 +557,13 @@ app.controller('BudgetController', function ($scope, $http) { }; $scope.createNewCategory = function () { const defaultName = "Ny kategori"; - const newOrder = $scope.budget.categories.length; // sist i listan + const newOrder = $scope.budget.categories.length; const newCategory = { name: defaultName, color: "#666666", - year: $scope.selectedYear, - month: $scope.selectedMonth, - order: newOrder + order: newOrder, + budgetPeriodId: $scope.budget.id // <- 💡 den viktiga raden }; $http.post("/api/budget/category", newCategory) @@ -589,6 +588,8 @@ app.controller('BudgetController', function ($scope, $http) { $scope.showToast("Fel vid skapande av kategori", true); }); }; + + $scope.addItem = function (category) { if (!category.newItemName || !category.newItemAmount) return; From 5b0a8386add23535296bfb8e6ed3ed1bdcbbc9ce Mon Sep 17 00:00:00 2001 From: Elias Jansson Date: Thu, 24 Jul 2025 11:18:51 +0200 Subject: [PATCH 2/2] Fixed leftover --- Aberwyn/wwwroot/js/budget.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Aberwyn/wwwroot/js/budget.js b/Aberwyn/wwwroot/js/budget.js index 9a7a060..6caa2e2 100644 --- a/Aberwyn/wwwroot/js/budget.js +++ b/Aberwyn/wwwroot/js/budget.js @@ -362,7 +362,7 @@ app.controller('BudgetController', function ($scope, $http) { }; $scope.getLeftover = function () { - return $scope.getTotalIncome() - $scope.getTotalExpense(); + return $scope.getTotalIncome() - $scope.getTotalExpense() - $scope.getTotalSaving(); }; function positionAddItemPopup(popup, triggerButton) {