diff --git a/.gitignore b/.gitignore index d725c9c..666205f 100644 --- a/.gitignore +++ b/.gitignore @@ -435,4 +435,4 @@ FodyWeavers.xsd ### VisualStudio Patch ### # Additional files built by Visual Studio -# End of https://www.toptal.com/developers/gitignore/api/dotnetcore,visualstudio,visualstudiocode \ No newline at end of file +# End of https://www.toptal.com/developers/gitignore/api/dotnetcore,visualstudio,visualstudiocode diff --git a/README.md b/README.md index b0549bd..14cb0fd 100755 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@
-

HeartTrack

+

HeartTrack - Admin

@@ -9,17 +9,15 @@ --- -  ![PHP](https://img.shields.io/badge/Blazor-56478C?style=for-the-badge&logo=Blazor&logoColor=FFFFFF&labelColor=56478C) +  ![Blazor](https://img.shields.io/badge/Blazor-56478C?style=for-the-badge&logo=Blazor&logoColor=FFFFFF&labelColor=56478C)   ![CSS](https://img.shields.io/badge/CSS-000?style=for-the-badge&logo=css3&logoColor=white&color=darkblue) -  ![DOCKER](https://img.shields.io/badge/.NET-56478C?style=for-the-badge&logo=.NET&logoColor=FFFFFF&labelColor=56478C) -  ![PostgreSQL](https://img.shields.io/badge/Postgresql-000?style=for-the-badge&logo=postgresql&logoColor=white&color=blue) -  ![JAVASCRIPT](https://img.shields.io/badge/JavaScript-000?style=for-the-badge&logo=javascript&logoColor=white&color=yellow) +  ![.NET](https://img.shields.io/badge/.NET-56478C?style=for-the-badge&logo=.NET&logoColor=FFFFFF&labelColor=56478C)
# Table des matières -[Présentation](#présentation) | [Répartition du Git](#répartition-du-git) | [Documentation](#documentation) | [Prerequisites](#prerequisites) | [Getting Started](#getting-started) | [Features](#features) | [Ce que nous avons fait](#ce-que-nous-avons-fait) | [Fabriqué avec](#fabriqué-avec) | [Contributeurs](#contributeurs) | [Comment contribuer](#comment-contribuer) | [License](#license) | [Remerciements](#remerciements) +[Présentation](#présentation) | [Fonctionnalités principales](#fonctionnalités-principales) | [Répartition du Git](#répartition-du-git) | [Prerequis](#prérequis) | [Fabriqué avec](#fabriqué-avec) | [Contributeurs](#contributeurs) | [Comment contribuer](#comment-contribuer) | [License](#license) | [Remerciements](#remerciements) @@ -33,37 +31,88 @@ HeartTrack est une application web PHP et mobile Android destinée aux sportifs ### Récapitulatif du Projet -Le projet HeartTrack, avec son application HeartTrack, vise à offrir une solution Open Source d'analyse des données de fréquence cardiaque, en mettant l'accent sur les besoins des sportifs et des coachs. L'application sera capable de traiter et d'interpréter les données de manière intelligente, fournissant ainsi des informations précieuses pour optimiser les performances sportives et la santé. - +Ce dépôt contient une application Blazor conçue pour faciliter l'administration des utilisateurs au sein de votre application. L'application utilise le framework Blazor, qui permet le développement d'applications web interactives avec .NET. + +## Fonctionnalités principales + +1. **Gestion des Utilisateurs**: Ajoutez, modifiez et supprimez des utilisateurs de manière simple et efficace. + +2. **Rôles Utilisateurs**: Attribuez des rôles à chaque utilisateur pour définir leurs permissions et accès. + +3. **Tableau de Bord Convivial**: Interface utilisateur intuitive pour une expérience d'administration agréable. + +4. **Sécurité Intégrée**: Utilisation des fonctionnalités de sécurité de Blazor pour protéger les données sensibles. + +## Les attendus du projet +* [x] Implementation of a data visualization page with pagination (2 points) +* [x] Page for adding an element with validation (2 point) +* [x] Edit page of an element without validation (2 point) +* [x] Deletion of an element with a confirmation (2 point) +* [ ] Complex component (5 point) +* [x] Use API (Get / Insert / Update / Delete) (3 point) +* [x] IOC & DI use (4 point) +* [x] Localization & Globalization (at least two languages) (1 point) +* [ ] Use of the configuration (1 point) +* [ ] Logs (2 points) +* [x] Code cleanliness (2 point) +* [x] GUI (Global design, placement of buttons, ...) (2 point) +* [x] Code location (No code in views) (2 point) +* [x] The Readme (2 points) +* [x] Description of how the client solution works (code-level illustration) (6 points) +* [x] Merge request (2 points) + +## Ce que nous avons fait +* [x] Les listing dans la page de tickets et d'Activités +* [x] La modification dans la page de tickets +* [x] La suppression dans la page de tickets +* [x] Le get by id dans la page de tickets +* [x] L'implementation de la partie API et du data service dans la pages d'Activités +* [x] L'authentification dans la branch `issue_auth` mais des problèmes persistent (les actions des services ne sont pas gerer par l'authentification) +* [ ] Le data service dans toutes les pages +* [ ] La répartitions des fonctionnalités de la page de tickets sur les autres pages ## Répartition du Git -[**Sources**](Sources/) : **Code de l'application** - -[**Documents**](Documents/README_DOCUMENTS.md) : **Documentation de l'application et diagrammes** - - +[**Sources**](Sources/HeartTrack) : **Code de l'application** --- Le projet HeartTrack utilise un modèle de flux de travail Git (Gitflow) pour organiser le développement. Voici une brève explication des principales branches : -- **branche prod** : Cette branche contient la version de production stable de l'application. Les modifications sur cette branche sont généralement destinées à des mises en production. +- **branche WORK-NAME** : Cette branche contient la version de travail des différents membres de l'équipe. Les modifications sur cette branche sont bien souvent réalisé par le nom du membre en question. -- **branche master** : La branche master est similaire à la branche de production, mais elle peut contenir des fonctionnalités en cours de développement qui sont presque prêtes pour une mise en production. +- **branche master** : La branche master est similaire à la branche de production, mais elle contient la version stable et final de notre application. -- **branche test** : Cette branche est utilisée pour permettre différents tests sur l'application. +### API PHP -- **branche issue** : Pour chaque problème (issue) que vous résolvez, vous devez créer une branche portant le nom de l'issue, par exemple, "issue_#32_nom" où 32 est le numéro de l'issue et nom est une description courte de l'issue. Une fois l'issue résolue, assurez-vous de mettre à jour le changelog et de créer une merge request. -- **branche démo** : Cette branche est utilisée pour déployer une version démo de l'application. Elle est mise à jour avec les dernières fonctionnalités en développement. +L'application Blazor utilise une API en PHP pour récupérer les données depuis la base de données. +Pour l'utiliser, vous devez faire tourner notre projet PHP disponible [ici](https://codefirst.iut.uca.fr/git/HeartDev/Web/src/branch/API_tests) sur votre machine locale. Pour ensuite changer le type de skockage `ActivityDataServiceFactice` par `ActivityDataServiceAPI` et vice versa dans le fichier `Program.cs` de l'application Blazor en ligne 24 `Add Data Services`. -## Documentation -Documentation et informations à propos de `HearthTrack` disponible [ici]() ### Prérequis -* [Visual Studio Code](https://code.visualstudio.com/) - Exemple d'IDE gratuit +* [Visual Studio](https://visualstudio.microsoft.com/fr/vs/) - IDE * [Git](https://git-scm.com/) - Gestion de version -* [PostgreSQL](https://www.postgresql.org/) - Base de Données +* [.NET SDK](https://dotnet.microsoft.com/download) - Platform open-source pour le développement d'applications + +## Installation et Exécution + +1. Clonez ce dépôt sur votre machine locale : + + ```bash + git clone https://codefirst.iut.uca.fr/git/HeartDev/Admin.git + ``` + +2. Lacer Visual Studio et ouvrez le projet `HeartTrack.sln` dans le dossier `Sources/HeartTrack`. + +Pour des raison de manque de la partie php, vous ne pourrez utiliser l'application qu'en localStorage. Il est cependant possible de tester l'aaplication avec la partie API en PHP en faisant tourner en local le projet php disponible [ici](https://codefirst.iut.uca.fr/git/HeartDev/Web/src/branch/API_tests) et en changant le type de skockage `ActivityDataServiceFactice` par `ActivityDataServiceAPI` dans le fichier `Program.cs` de l'application Blazor en ligne 24 `Add Data Services` et importer les dépendances en conséquence. + + +Comme ceci : +```csharp +// Add Data Services +builder.Services.AddScoped(); +builder.Services.AddScoped(); +``` ### Fabriqué avec * [Visual Studio](https://visualstudio.microsoft.com/fr/vs/) - IDE @@ -73,7 +122,6 @@ Documentation et informations à propos de `HearthTrack` disponible [ici]() * [Blazor](https://dotnet.microsoft.com/apps/aspnet/web-apps/blazor) - Framework Web * [C#](https://docs.microsoft.com/fr-fr/dotnet/csharp/) - Langage * [HTML 5, CSS 3](https://developer.mozilla.org/fr/docs/Web/HTML) - Langages -* [Doxygen](https://codefirst.iut.uca.fr/sonar/) - Documentation ## Contributeurs * [Antoine PEREDERII](https://codefirst.iut.uca.fr/git/antoine.perederii) @@ -83,7 +131,7 @@ Documentation et informations à propos de `HearthTrack` disponible [ici]() * [David D'HALMEIDA](https://codefirst.iut.uca.fr/git/david.d_almeida) ## Comment contribuer -1. Forkez le projet () +1. Forkez le projet () 2. Créez votre branche (`git checkout -b feature/featureName`) 3. commit vos changements (`git commit -am 'Add some feature'`) 4. Push sur la branche (`git push origin feature/featureName`) diff --git a/Sources/HeartTrack/App.razor b/Sources/HeartTrack/App.razor index 60f5744..5212a2b 100644 --- a/Sources/HeartTrack/App.razor +++ b/Sources/HeartTrack/App.razor @@ -9,5 +9,4 @@

Sorry, there's nothing at this address.

- - + \ No newline at end of file diff --git a/Sources/HeartTrack/Controllers/CultureController.cs b/Sources/HeartTrack/Controllers/CultureController.cs new file mode 100644 index 0000000..89568dd --- /dev/null +++ b/Sources/HeartTrack/Controllers/CultureController.cs @@ -0,0 +1,22 @@ +namespace HeartTrack.Controllers +{ + using Microsoft.AspNetCore.Localization; + using Microsoft.AspNetCore.Mvc; + + [Route("[controller]/[action]")] + public class CultureController : Controller + { + public IActionResult SetCulture(string culture, string redirectUri) + { + if (culture != null) + { + this.HttpContext.Response.Cookies.Append( + CookieRequestCultureProvider.DefaultCookieName, + CookieRequestCultureProvider.MakeCookieValue( + new RequestCulture(culture))); + } + + return this.LocalRedirect(redirectUri); + } + } +} diff --git a/Sources/HeartTrack/Data/WeatherForecast.cs b/Sources/HeartTrack/Data/WeatherForecast.cs deleted file mode 100644 index d04ae21..0000000 --- a/Sources/HeartTrack/Data/WeatherForecast.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace HeartTrack.Data; - -public class WeatherForecast -{ - public DateTime Date { get; set; } - - public int TemperatureC { get; set; } - - public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); - - public string? Summary { get; set; } -} - diff --git a/Sources/HeartTrack/Data/WeatherForecastService.cs b/Sources/HeartTrack/Data/WeatherForecastService.cs deleted file mode 100644 index 2c00dc4..0000000 --- a/Sources/HeartTrack/Data/WeatherForecastService.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace HeartTrack.Data; - -public class WeatherForecastService -{ - private static readonly string[] Summaries = new[] - { - "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" - }; - - public Task GetForecastAsync(DateTime startDate) - { - return Task.FromResult(Enumerable.Range(1, 5).Select(index => new WeatherForecast - { - Date = startDate.AddDays(index), - TemperatureC = Random.Shared.Next(-20, 55), - Summary = Summaries[Random.Shared.Next(Summaries.Length)] - }).ToArray()); - } -} - diff --git a/Sources/HeartTrack/HeartTrack.csproj b/Sources/HeartTrack/HeartTrack.csproj index b775b09..d3e5f77 100644 --- a/Sources/HeartTrack/HeartTrack.csproj +++ b/Sources/HeartTrack/HeartTrack.csproj @@ -1,4 +1,4 @@ - + net6.0 @@ -6,4 +6,33 @@ enable + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Sources/HeartTrack/HeartTrack.sln b/Sources/HeartTrack/HeartTrack.sln index 932e021..0cc61e1 100644 --- a/Sources/HeartTrack/HeartTrack.sln +++ b/Sources/HeartTrack/HeartTrack.sln @@ -1,25 +1,25 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 25.0.1706.7 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeartTrack", "HeartTrack.csproj", "{17956D4F-7446-434C-8987-6B10A1FC66E8}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {17956D4F-7446-434C-8987-6B10A1FC66E8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {17956D4F-7446-434C-8987-6B10A1FC66E8}.Debug|Any CPU.Build.0 = Debug|Any CPU - {17956D4F-7446-434C-8987-6B10A1FC66E8}.Release|Any CPU.ActiveCfg = Release|Any CPU - {17956D4F-7446-434C-8987-6B10A1FC66E8}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {2F984935-D2F4-4E45-A861-034CC5F7147B} - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.8.34330.188 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HeartTrack", "HeartTrack.csproj", "{17956D4F-7446-434C-8987-6B10A1FC66E8}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {17956D4F-7446-434C-8987-6B10A1FC66E8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {17956D4F-7446-434C-8987-6B10A1FC66E8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {17956D4F-7446-434C-8987-6B10A1FC66E8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {17956D4F-7446-434C-8987-6B10A1FC66E8}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {2F984935-D2F4-4E45-A861-034CC5F7147B} + EndGlobalSection +EndGlobal diff --git a/Sources/HeartTrack/Models/Activity/Activity.cs b/Sources/HeartTrack/Models/Activity/Activity.cs new file mode 100644 index 0000000..8595940 --- /dev/null +++ b/Sources/HeartTrack/Models/Activity/Activity.cs @@ -0,0 +1,20 @@ +namespace HeartTrack.Models +{ + public class Activity + { + public int IdActivity { get; set; } + public string Type { get; set; } + public DateOnly Date { get; set; } + public DateOnly StartTime { get; set; } + public DateOnly EndTime { get; set; } + public int EffortRessenti { get; set; } + public float Variability { get; set; } + public float Variance { get; set; } + public float StandardDeviation { get; set; } + public float Average { get; set; } + public int Maximum { get; set; } + public int Minimum { get; set; } + public float AvrTemperature { get; set; } + public bool HasAutoPause { get; set; } + } +} \ No newline at end of file diff --git a/Sources/HeartTrack/Models/Report/Report.cs b/Sources/HeartTrack/Models/Report/Report.cs new file mode 100644 index 0000000..eda8a0d --- /dev/null +++ b/Sources/HeartTrack/Models/Report/Report.cs @@ -0,0 +1,14 @@ +using Blazorise; + +namespace HeartTrack.Models +{ + public class Report + { + public int Id { get; set; } + public string Username { get; set; } + public string ReportedUser { get; set; } + public string Raison { get; set; } + public string Description { get; set; } + public Image Image { get; set; } + } +} diff --git a/Sources/HeartTrack/Models/Report/ReportModel.cs b/Sources/HeartTrack/Models/Report/ReportModel.cs new file mode 100644 index 0000000..fb11c79 --- /dev/null +++ b/Sources/HeartTrack/Models/Report/ReportModel.cs @@ -0,0 +1,25 @@ +using Blazorise; +using System.ComponentModel.DataAnnotations; + +namespace HeartTrack.Models +{ + public class ReportModel + { + [Required] + [Range(0, 121425711425541)] + public int Id { get; set; } + [Required] + [StringLength(50)] + public string Username { get; set; } + [Required] + [StringLength(50)] + public string ReportedUser { get; set; } + [Required] + [StringLength(150)] + public string Raison { get; set; } + [Required] + [StringLength(500)] + public string Description { get; set; } + public Image Image { get; set; } + } +} diff --git a/Sources/HeartTrack/Models/Ticket/Ticket.cs b/Sources/HeartTrack/Models/Ticket/Ticket.cs new file mode 100644 index 0000000..e21b3c5 --- /dev/null +++ b/Sources/HeartTrack/Models/Ticket/Ticket.cs @@ -0,0 +1,12 @@ +namespace HeartTrack.Models +{ + public class Ticket + { + public int Id { get; set; } + public string Username { get; set; } + public string Contexte { get; set; } + public string Description { get; set; } + public string Urgence { get; set; } + public Boolean isCheck { get; set; } + } +} diff --git a/Sources/HeartTrack/Models/Ticket/TicketModel.cs b/Sources/HeartTrack/Models/Ticket/TicketModel.cs new file mode 100644 index 0000000..e9bdc40 --- /dev/null +++ b/Sources/HeartTrack/Models/Ticket/TicketModel.cs @@ -0,0 +1,26 @@ +using Blazorise; +using System.ComponentModel.DataAnnotations; +using System.Diagnostics.CodeAnalysis; + +namespace HeartTrack.Models +{ + public class TicketModel + { + [Required] + [Range(0, 121425711425541)] + public int Id { get; set; } + + [Required] + [StringLength(50, ErrorMessage = "The username must not exceed 50 characters.")] + public string Username { get; set; } + [Required] + [StringLength(25, ErrorMessage = "The subject must not exceed 25 characters.")] + public string Contexte { get; set; } + + [Required] + [StringLength(500, ErrorMessage = "Description must not exceed 500 characters.")] + public string Description { get; set; } + public Boolean Urgence { get; set; } + public Boolean isCheck { get; set; } = false; + } +} diff --git a/Sources/HeartTrack/Models/User/User.cs b/Sources/HeartTrack/Models/User/User.cs new file mode 100644 index 0000000..d18a6aa --- /dev/null +++ b/Sources/HeartTrack/Models/User/User.cs @@ -0,0 +1,17 @@ +namespace HeartTrack.Models +{ + public class User + { + public int Id { get; set; } + public string Username { get; set; } + public string Nom { get; set; } + public string Prenom { get; set; } + public string Email { get; set; } + public string Password { get; set; } + public string Sexe { get; set; } + public float Taille { get; set; } + public float Poids { get; set; } + public DateTime BirthDate { get; set; } + public Boolean isBan { get; set; } + } +} diff --git a/Sources/HeartTrack/Models/User/UserModel.cs b/Sources/HeartTrack/Models/User/UserModel.cs new file mode 100644 index 0000000..276f786 --- /dev/null +++ b/Sources/HeartTrack/Models/User/UserModel.cs @@ -0,0 +1,39 @@ +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; + +namespace HeartTrack.Models +{ + public class UserModel + { + [Required] + [Range(0,121425711425541)] + public int Id { get; set; } + + [Required] + [StringLength(50, ErrorMessage = "The username must not exceed 50 characters.")] + public string Username { get; set; } + + [Required] + [StringLength(50, ErrorMessage = "The name must not exceed 50 characters.")] + [RegularExpression(@"^[A-Za-z]$", ErrorMessage = "Numbers are not accepted.")] + public string FirstName { get; set; } + + [Required] + [StringLength(25, ErrorMessage = "The last name must not exceed 25 characters.")] + [RegularExpression(@"^[A-Za-z]*$", ErrorMessage = "Numbers are not accepted.")] + public string LastName { get; set; } + [Required] + public string Email { get; set; } + [Required] + public string Password { get; set; } + [Required] + public string Sexe { get; set; } + [Required] + public float Taille { get; set; } + [Required] + public float Poids { get; set; } + [Required] + public DateTime BirthDate { get; set; } + public Boolean isBan { get; set; } + } +} diff --git a/Sources/HeartTrack/Pages/Activities.razor b/Sources/HeartTrack/Pages/Activities.razor new file mode 100644 index 0000000..7e93508 --- /dev/null +++ b/Sources/HeartTrack/Pages/Activities.razor @@ -0,0 +1,33 @@ +@page "/activities" +@using HeartTrack.Models + +Activities + +

@Localizer["Title"]

+ +

+ @Localizer["Description"] +

+ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Sources/HeartTrack/Pages/Activities.razor.cs b/Sources/HeartTrack/Pages/Activities.razor.cs new file mode 100644 index 0000000..60f955a --- /dev/null +++ b/Sources/HeartTrack/Pages/Activities.razor.cs @@ -0,0 +1,28 @@ +using System; +using System.Net.Http; +using Blazorise.DataGrid; +using HeartTrack.Models; +using Microsoft.AspNetCore.Components; +using Microsoft.Extensions.Localization; +using HeartTrack.Services.ActivityDataService; + +namespace HeartTrack.Pages +{ + public partial class Activities + { + private List activities; + + private int totalActivity; + + [Inject] + private IActivityDataService ActivitiesDataService { get; set; } + [Inject] + public IStringLocalizer Localizer { get; set; } + private async Task OnReadData() + { + this.activities = await this.ActivitiesDataService.getAllActivities(); + this.totalActivity = activities.Count(); + } + } +} + diff --git a/Sources/HeartTrack/Pages/AddTicket.razor b/Sources/HeartTrack/Pages/AddTicket.razor new file mode 100644 index 0000000..e1a4bed --- /dev/null +++ b/Sources/HeartTrack/Pages/AddTicket.razor @@ -0,0 +1,37 @@ +@page "/tickets/add" + +

Add Ticket

+ + + + + +

+ +

+

+ +

+

+ +

+ +

+ +

+ + +
+ diff --git a/Sources/HeartTrack/Pages/AddTicket.razor.cs b/Sources/HeartTrack/Pages/AddTicket.razor.cs new file mode 100644 index 0000000..8c16ab2 --- /dev/null +++ b/Sources/HeartTrack/Pages/AddTicket.razor.cs @@ -0,0 +1,43 @@ +using Blazored.LocalStorage; +using Microsoft.AspNetCore.Components.Forms; +using Microsoft.AspNetCore.Components; +using HeartTrack.Models; +using HeartTrack.Services; +using HeartTrack.Services.TicketDataService; + +namespace HeartTrack.Pages +{ + public partial class AddTicket + { + + [Inject] + public ITicketDataService TicketStorage { get; set; } + + [Inject] + public NavigationManager NavigationManager { get; set; } + + [Inject] + public IWebHostEnvironment WebHostEnvironment { get; set; } + + public TicketModel ticketModel = new(){}; + + private async void HandleValidSubmit() + { + var currentData = await TicketStorage.getAllTickets(); + ticketModel.Id = currentData.Max(s => s.Id) + 1; + + currentData.Add(new Ticket + { + Id = ticketModel.Id, + Username = ticketModel.Username, + Contexte = ticketModel.Contexte, + Description = ticketModel.Description/*, + Urgence = ticketModel.Urgence*/ + }); + + await TicketStorage.SaveAllTickets(currentData); + NavigationManager.NavigateTo("tickets"); + } + + } +} diff --git a/Sources/HeartTrack/Pages/Counter.razor b/Sources/HeartTrack/Pages/Counter.razor deleted file mode 100644 index c22d6a4..0000000 --- a/Sources/HeartTrack/Pages/Counter.razor +++ /dev/null @@ -1,19 +0,0 @@ -@page "/counter" - -Counter - -

Counter

- -

Current count: @currentCount

- - - -@code { - private int currentCount = 0; - - private void IncrementCount() - { - currentCount++; - } -} - diff --git a/Sources/HeartTrack/Pages/FetchData.razor b/Sources/HeartTrack/Pages/FetchData.razor deleted file mode 100644 index 54db2b0..0000000 --- a/Sources/HeartTrack/Pages/FetchData.razor +++ /dev/null @@ -1,49 +0,0 @@ -@page "/fetchdata" - -Weather forecast - -@using HeartTrack.Data -@inject WeatherForecastService ForecastService - -

Weather forecast

- -

This component demonstrates fetching data from a service.

- -@if (forecasts == null) -{ -

Loading...

-} -else -{ - - - - - - - - - - - @foreach (var forecast in forecasts) - { - - - - - - - } - -
DateTemp. (C)Temp. (F)Summary
@forecast.Date.ToShortDateString()@forecast.TemperatureC@forecast.TemperatureF@forecast.Summary
-} - -@code { - private WeatherForecast[]? forecasts; - - protected override async Task OnInitializedAsync() - { - forecasts = await ForecastService.GetForecastAsync(DateTime.Now); - } -} - diff --git a/Sources/HeartTrack/Pages/Index.razor b/Sources/HeartTrack/Pages/Index.razor index cd39618..6120c47 100644 --- a/Sources/HeartTrack/Pages/Index.razor +++ b/Sources/HeartTrack/Pages/Index.razor @@ -1,10 +1,16 @@ @page "/" +@using System.Globalization -Index +Global View -

Hello, world!

+

Global View

-Welcome to your new app. - - +This is the global statistics of our website. +
+
+

Number of views of the website

+ +
+
+ \ No newline at end of file diff --git a/Sources/HeartTrack/Pages/Index.razor.cs b/Sources/HeartTrack/Pages/Index.razor.cs new file mode 100644 index 0000000..0941ebc --- /dev/null +++ b/Sources/HeartTrack/Pages/Index.razor.cs @@ -0,0 +1,18 @@ +using MudBlazor; + +namespace HeartTrack.Pages +{ + public partial class Index + { + private int IndexChart = -1; + + public ChartOptions Options = new ChartOptions(); + + public List Series = new List() + { + new ChartSeries() { Name = "Views", Data = new double[] { 90, 79, 72, 69, 62, 62, 55, 65, 70 } } + }; + + public string[] XAxisLabels = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep" }; + } +} diff --git a/Sources/HeartTrack/Pages/Tickets.razor b/Sources/HeartTrack/Pages/Tickets.razor new file mode 100644 index 0000000..9f72370 --- /dev/null +++ b/Sources/HeartTrack/Pages/Tickets.razor @@ -0,0 +1,60 @@ +@page "/tickets" +@using HeartTrack.Models + + +Tickets + +

Tickets list

+ +This is the ticket list of users. + +
+ + + Add + +
+ + + + + + + + + @if (context.isCheck) + { + Closed + + } else + { + Open + + } + + + + + @if (context.isCheck) + { + + + } + else + { + + + + } + + + \ No newline at end of file diff --git a/Sources/HeartTrack/Pages/Tickets.razor.cs b/Sources/HeartTrack/Pages/Tickets.razor.cs new file mode 100644 index 0000000..e5dde1c --- /dev/null +++ b/Sources/HeartTrack/Pages/Tickets.razor.cs @@ -0,0 +1,98 @@ +using Blazored.LocalStorage; +using Blazorise; +using Blazorise.DataGrid; +using HeartTrack.Models; +using HeartTrack.Services; +using HeartTrack.Services.TicketDataService; +using Microsoft.AspNetCore.Components; +using MudBlazor; +using System; +using static MudBlazor.CategoryTypes; + +namespace HeartTrack.Pages +{ + public partial class Tickets + { + private List tickets; + + private int totalTicket; + + private DataGrid dataGrid; + + [Inject] + public HttpClient Http { get; set; } + + [Inject] + public ILocalStorageService LocalStorage { get; set; } + + [Inject] + public ITicketDataService TicketService { get; set; } + + [Inject] + public NavigationManager NavigationManager { get; set; } + + protected override async Task OnAfterRenderAsync(bool firstRender) + { + // Do not treat this action if is not the first render + if (!firstRender) + { + return; + } + + var currentData = await LocalStorage.GetItemAsync("data"); + + // Check if data exist in the local storage + if (currentData == null) + { + // this code add in the local storage the fake data (we load the data sync for initialize the data before load the OnReadData method) + var originalData = Http.GetFromJsonAsync($"{NavigationManager.BaseUri}data/fake-tickets.json").Result; + await LocalStorage.SetItemAsync("data", originalData); + } + + } + + private async Task OnReadData(DataGridReadDataEventArgs e) + { + if (e.CancellationToken.IsCancellationRequested) + { + return; + } + + // When you use a real API, we use this follow code + //var response = await Http.GetJsonAsync( $"http://my-api/api/data?page={e.Page}&pageSize={e.PageSize}" ); + var response = (await LocalStorage.GetItemAsync("data")).Skip((e.Page - 1) * e.PageSize).Take(e.PageSize).ToList(); + + if (!e.CancellationToken.IsCancellationRequested) + { + totalTicket = (await LocalStorage.GetItemAsync>("data")).Count; + tickets = new List(response); // an actual data for the current page + } + } + + private async void OnClose(int id) + { + + await TicketService.Close(id); + + // Reload the page + NavigationManager.NavigateTo("tickets", true); + } + + private void OnView(int id) + { + NavigationManager.NavigateTo("tickets/view/"+id); + } + + private void OnNavigateOnAddClicked() + { + NavigationManager.NavigateTo("tickets/add"); + } + + private async void OnDelete(Ticket t) + { + await TicketService.RemoveTicket(t); + + NavigationManager.NavigateTo("tickets", true); + } + } +} diff --git a/Sources/HeartTrack/Pages/ViewTicket.razor b/Sources/HeartTrack/Pages/ViewTicket.razor new file mode 100644 index 0000000..09081ff --- /dev/null +++ b/Sources/HeartTrack/Pages/ViewTicket.razor @@ -0,0 +1,21 @@ +@page "/tickets/view/{Id:int}" + + + +

Ticket number @Id

+ +

+ Username: @ticket.Username +

+

+ Contexte: @ticket.Contexte +

+

+ Description: @ticket.Description +

+

+ Urgence: @ticket.Urgence +

+

+ Status: @ticket.isCheck +

\ No newline at end of file diff --git a/Sources/HeartTrack/Pages/ViewTicket.razor.cs b/Sources/HeartTrack/Pages/ViewTicket.razor.cs new file mode 100644 index 0000000..576aa4d --- /dev/null +++ b/Sources/HeartTrack/Pages/ViewTicket.razor.cs @@ -0,0 +1,39 @@ +using HeartTrack.Models; +using HeartTrack.Services; +using HeartTrack.Services.TicketDataService; +using Microsoft.AspNetCore.Components; + +namespace HeartTrack.Pages +{ + public partial class ViewTicket + { + [Parameter] + public int Id { get; set; } + + private Ticket ticket { get; set; } = new(); + + [Inject] + public ITicketDataService TicketService { get; set; } + + [Inject] + public NavigationManager NavigationManager { get; set; } + + [Inject] + public IWebHostEnvironment WebHostEnvironment { get; set; } + + protected async Task OnInitializedAsync() + { + var item = await TicketService.getTicketById(Id); + + ticket = new Ticket + { + Id = item.Id, + Username = item.Username, + Contexte = item.Contexte, + Description = item.Description, + Urgence = item.Urgence, + isCheck = item.isCheck + }; + } + } +} \ No newline at end of file diff --git a/Sources/HeartTrack/Pages/_Layout.cshtml b/Sources/HeartTrack/Pages/_Layout.cshtml index 117c8f2..09632ba 100644 --- a/Sources/HeartTrack/Pages/_Layout.cshtml +++ b/Sources/HeartTrack/Pages/_Layout.cshtml @@ -28,6 +28,16 @@ + + + @* Blazorised *@ + + + + @* MudBlazor *@ + + + diff --git a/Sources/HeartTrack/Program.cs b/Sources/HeartTrack/Program.cs index 30c5f97..893584d 100644 --- a/Sources/HeartTrack/Program.cs +++ b/Sources/HeartTrack/Program.cs @@ -1,13 +1,78 @@ -using Microsoft.AspNetCore.Components; -using Microsoft.AspNetCore.Components.Web; -using HeartTrack.Data; +using Blazorise; +using Blazorise.Bootstrap; +using Blazorise.Icons.FontAwesome; +using Microsoft.AspNetCore.Localization; +using System.Globalization; +using Microsoft.Extensions.Options; +using Blazored.LocalStorage; +using HeartTrack.Services.ActivityDataService; +using HeartTrack.Services.TicketDataService; +using MudBlazor.Services; +using HeartTrack.Services.ActivityDataServiceFactice; +using HeartTrack.Services.TicketDataServiceFactice; var builder = WebApplication.CreateBuilder(args); +// Add Badge Component services +builder.Services.AddMudServices(); + // Add services to the container. builder.Services.AddRazorPages(); builder.Services.AddServerSideBlazor(); -builder.Services.AddSingleton(); +builder.Services.AddHttpClient(); + +// Add Data Services +builder.Services.AddScoped(); +builder.Services.AddScoped(); + + +builder.Services.AddBlazorise() + .AddBootstrapProviders() + .AddFontAwesomeIcons(); + +// Add the controller of the app +builder.Services.AddControllers(); + +// Add the localization to the app and specify the resources path +builder.Services.AddLocalization(opts => { opts.ResourcesPath = "Resources"; }); + +// Configure the localtization +builder.Services.Configure(options => +{ + // Set the default culture of the web site + options.DefaultRequestCulture = new RequestCulture(new CultureInfo("en-US")); + + // Declare the supported culture + options.SupportedCultures = new List { new CultureInfo("en-US"), new CultureInfo("fr-FR") }; + options.SupportedUICultures = new List { new CultureInfo("en-US"), new CultureInfo("fr-FR") }; +}); + +builder.Services.AddBlazoredLocalStorage(); + +builder.Services.AddHttpClient(); + +builder.Services.AddBlazorise() + .AddBootstrapProviders() + .AddFontAwesomeIcons(); + +// Add the controller of the app +builder.Services.AddControllers(); + +// Add the localization to the app and specify the resources path +builder.Services.AddLocalization(opts => { opts.ResourcesPath = "Resources"; }); + +// Configure the localtization +builder.Services.Configure(options => +{ + // Set the default culture of the web site + options.DefaultRequestCulture = new RequestCulture(new CultureInfo("en-US")); + + // Declare the supported culture + options.SupportedCultures = new List { new CultureInfo("en-US"), new CultureInfo("fr-FR") }; + options.SupportedUICultures = new List { new CultureInfo("en-US"), new CultureInfo("fr-FR") }; +}); + +builder.Services.AddBlazoredLocalStorage(); var app = builder.Build(); @@ -25,8 +90,22 @@ app.UseStaticFiles(); app.UseRouting(); +// Get the current localization options +var options = ((IApplicationBuilder)app).ApplicationServices.GetService>(); + +if (options?.Value != null) +{ + // use the default localization + app.UseRequestLocalization(options.Value); +} + +// Add the controller to the endpoint +app.UseEndpoints(endpoints => +{ + endpoints.MapControllers(); +}); + app.MapBlazorHub(); app.MapFallbackToPage("/_Host"); -app.Run(); - +app.Run(); \ No newline at end of file diff --git a/Sources/HeartTrack/Resources/Pages.Activities.fr-FR.resx b/Sources/HeartTrack/Resources/Pages.Activities.fr-FR.resx new file mode 100644 index 0000000..258d1bb --- /dev/null +++ b/Sources/HeartTrack/Resources/Pages.Activities.fr-FR.resx @@ -0,0 +1,150 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + List d'activités + + + This is t. + + + helle + + + Last e + + + Efforressenti + + + Variablity + + + Standard deviation + + + Average + + + Average temperature + + + Has auto pause + + \ No newline at end of file diff --git a/Sources/HeartTrack/Resources/Pages.Activities.resx b/Sources/HeartTrack/Resources/Pages.Activities.resx new file mode 100644 index 0000000..7a52ac5 --- /dev/null +++ b/Sources/HeartTrack/Resources/Pages.Activities.resx @@ -0,0 +1,150 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Activities List + + + This is the activity list of users. + + + First name + + + Last name + + + Effort ressenti + + + Variability + + + Standard deviation + + + Average + + + Average temperature + + + Has auto pause + + \ No newline at end of file diff --git a/Sources/HeartTrack/Resources/Pages.Tokens.fr-FR.resx b/Sources/HeartTrack/Resources/Pages.Tokens.fr-FR.resx new file mode 100644 index 0000000..8e7fad5 --- /dev/null +++ b/Sources/HeartTrack/Resources/Pages.Tokens.fr-FR.resx @@ -0,0 +1,138 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Cette page regroupe la liste des jetons (nom utilisateur et le mot de passe) du site. + + + Nom de famille + + + Prénom + + + Mot de passe + + + Jetons utilisateurs + + + Nom d'utilisateur + + \ No newline at end of file diff --git a/Sources/HeartTrack/Resources/Pages.Tokens.resx b/Sources/HeartTrack/Resources/Pages.Tokens.resx new file mode 100644 index 0000000..7850fee --- /dev/null +++ b/Sources/HeartTrack/Resources/Pages.Tokens.resx @@ -0,0 +1,138 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + This is the token list of users. + + + First name + + + Last name + + + Password + + + User token + + + Username + + \ No newline at end of file diff --git a/Sources/HeartTrack/Resources/Shared.NavMenu.fr-FR.resx b/Sources/HeartTrack/Resources/Shared.NavMenu.fr-FR.resx new file mode 100644 index 0000000..2a468b1 --- /dev/null +++ b/Sources/HeartTrack/Resources/Shared.NavMenu.fr-FR.resx @@ -0,0 +1,141 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Activité + + + Gérer les admins + + + Utilisateurs bannis + + + Vue d'ensemble + + + Signalement + + + Ticket utilisateur + + + Jetons d'utilisateurs + + \ No newline at end of file diff --git a/Sources/HeartTrack/Resources/Shared.NavMenu.resx b/Sources/HeartTrack/Resources/Shared.NavMenu.resx new file mode 100644 index 0000000..9e1bd1a --- /dev/null +++ b/Sources/HeartTrack/Resources/Shared.NavMenu.resx @@ -0,0 +1,141 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Activities + + + Admin managment + + + Ban users + + + Global view + + + Reports + + + Tickets + + + Tokens + + \ No newline at end of file diff --git a/Sources/HeartTrack/Services/ActivityDataService/ActivityDataServiceAPI.cs b/Sources/HeartTrack/Services/ActivityDataService/ActivityDataServiceAPI.cs new file mode 100644 index 0000000..384eda9 --- /dev/null +++ b/Sources/HeartTrack/Services/ActivityDataService/ActivityDataServiceAPI.cs @@ -0,0 +1,87 @@ +using System; +using HeartTrack.Models; +using Microsoft.AspNetCore.Components; + +namespace HeartTrack.Services.ActivityDataService +{ + public class ActivityDataServiceAPI : IActivityDataService + { + [Inject] + private HttpClient _clientHttp { get; set; } + + + public ActivityDataServiceAPI(HttpClient clientHttp) + { + this._clientHttp = clientHttp; + } + + public async Task AddActivity(Activity a) + { + HttpResponseMessage response = await _clientHttp.PostAsJsonAsync("http://localhost:8080/api/activities", a); + + if (response.IsSuccessStatusCode) + { + Console.WriteLine("API - Activité avec l'id " + a.IdActivity + " ajouté avec succès"); + } + else + { + Console.WriteLine("API - Problème ajout Activité"); + } + } + + public async Task getActivityById(int id) + { + Activity activity = await _clientHttp.GetFromJsonAsync("http://localhost:8080/api/activities/{id}"); + return activity; + } + + public async Task> getAllActivities() + { + List lActivities = await _clientHttp.GetFromJsonAsync>("http://localhost:8080/api/activities"); + return lActivities; + } + + public async Task RemoveActivity(Activity a) + { + HttpResponseMessage response = await _clientHttp.DeleteAsync($"http://localhost:8080/api/activities/{a.IdActivity}"); + + if (response.IsSuccessStatusCode) + { + Console.WriteLine("API - Activité avec l'id " + a.IdActivity + " supprimé avec succès"); + } + else + { + Console.WriteLine("API - Problème suppression Activité"); + } + } + + public async Task SaveAllActivities(List list) + { + HttpResponseMessage response = await _clientHttp.PutAsJsonAsync("http://localhost:8080/api/activities", list); + + if (response.IsSuccessStatusCode) + { + Console.WriteLine("API - List d'activités sauvegardé avec succès"); + } + else + { + Console.WriteLine("API - Problème sauvegarde List d'activités"); + } + } + + public async Task UpdateActivity(Activity a) + { + HttpResponseMessage response = await _clientHttp.PutAsJsonAsync($"http://localhost:8080/api/activities/{a.IdActivity}", a); + + if (response.IsSuccessStatusCode) + { + Console.WriteLine("API - Activité avec l'id " + a.IdActivity + " mis à jour avec succès"); + } + else + { + Console.WriteLine("API - Problème mise à jour Activité"); + } + } + } +} + diff --git a/Sources/HeartTrack/Services/ActivityDataService/ActivityDataServiceFactice.cs b/Sources/HeartTrack/Services/ActivityDataService/ActivityDataServiceFactice.cs new file mode 100644 index 0000000..6c27f93 --- /dev/null +++ b/Sources/HeartTrack/Services/ActivityDataService/ActivityDataServiceFactice.cs @@ -0,0 +1,140 @@ +using System; +using Blazored.LocalStorage; +using HeartTrack.Models; +using HeartTrack.Services.ActivityDataService; +using Microsoft.AspNetCore.Components; + +namespace HeartTrack.Services.ActivityDataServiceFactice +{ + public class ActivityDataServiceFactice : IActivityDataService + { + [Inject] + private HttpClient _clientHttp { get; set; } + + [Inject] + public ILocalStorageService _localStorage { get; set; } + + [Inject] + public NavigationManager _navigationManager { get; set; } + + private String EmplacementLocalStorage { get; set; } + private String EmplacementJson { get; set; } + + + public ActivityDataServiceFactice(HttpClient clientHttp, ILocalStorageService localStorage, NavigationManager navigationManager) + { + this._clientHttp = clientHttp; + this._localStorage = localStorage; + this._navigationManager = navigationManager; + + this.EmplacementLocalStorage = "activitiesData"; + this.EmplacementJson = $"{_navigationManager.BaseUri}data/fake-activities.json"; + } + + public async Task AddActivity(Activity a) + { + List data = await getAllActivities(); + data.Add(a); + await this.SaveAllActivities(data); + } + + public async Task getActivityById(int id) + { + Console.WriteLine("Passage dans le getFromPseudo..."); + List activities = await getAllActivities(); + Activity? temp = null; + + foreach (Activity a in activities) + { + if (a.IdActivity == id) + { + temp = a; + } + } + + return temp; + } + + public async Task> getAllActivities() + { + List lActivities = new List(); + + lActivities = await this.getActivitiesFromLocalStorage(); + if(lActivities.Count == 0) + { + lActivities = await this.getActivitiesFromJson(this.EmplacementJson); + await this.saveActivitiesLocalStorage(lActivities); + } + + return lActivities; + } + + private async Task> getActivitiesFromJson(String cheminVersJson) + { + List activitiesDeserialiser = new List(); + + var data = await _clientHttp.GetFromJsonAsync(cheminVersJson); + activitiesDeserialiser = data.ToList(); + + return activitiesDeserialiser; + } + + private async Task> getActivitiesFromLocalStorage() + { + List activitiesFromLocalStorage = null; + + var data = await _localStorage.GetItemAsync(EmplacementLocalStorage); + + if (data == null) + { + activitiesFromLocalStorage = new List(); + } + else + { + activitiesFromLocalStorage = data.ToList(); + } + + return activitiesFromLocalStorage; + } + + public async Task RemoveActivity(Activity a) + { + List data = await getAllActivities(); + + int index = -1; + + foreach (Activity temp in data) + { + if (temp.IdActivity == a.IdActivity) + { + index = data.IndexOf(temp); + } + } + + if (index != -1) + { + data.RemoveAt(index); + } + + await this.SaveAllActivities(data); + + data = await this.getAllActivities(); + } + + public async Task SaveAllActivities(List list) + { + await this.saveActivitiesLocalStorage(list); + } + + private async Task saveActivitiesLocalStorage(List lActivities) + { + await _localStorage.SetItemAsync(this.EmplacementLocalStorage, lActivities); + } + + public async Task UpdateActivity(Activity a) + { + await this.RemoveActivity(a); + await this.AddActivity(a); + } + } +} \ No newline at end of file diff --git a/Sources/HeartTrack/Services/ActivityDataService/IActivityDataService.cs b/Sources/HeartTrack/Services/ActivityDataService/IActivityDataService.cs new file mode 100644 index 0000000..be4884a --- /dev/null +++ b/Sources/HeartTrack/Services/ActivityDataService/IActivityDataService.cs @@ -0,0 +1,21 @@ +using System; +using HeartTrack.Models; + +namespace HeartTrack.Services.ActivityDataService +{ + public interface IActivityDataService + { + public Task> getAllActivities(); + + public Task SaveAllActivities(List list); + + public Task AddActivity(Activity u); + + public Task RemoveActivity(Activity u); + + public Task UpdateActivity(Activity u); + + public Task getActivityById(int id); + } +} + diff --git a/Sources/HeartTrack/Services/TicketDataService/ITicketDataService.cs b/Sources/HeartTrack/Services/TicketDataService/ITicketDataService.cs new file mode 100644 index 0000000..bf9c334 --- /dev/null +++ b/Sources/HeartTrack/Services/TicketDataService/ITicketDataService.cs @@ -0,0 +1,22 @@ +using System; +using HeartTrack.Models; + +namespace HeartTrack.Services.TicketDataService +{ + public interface ITicketDataService + { + public Task> getAllTickets(); + + public Task SaveAllTickets(List list); + + public Task AddTicket(Ticket t); + + public Task RemoveTicket(Ticket t); + + public Task UpdateTicket(Ticket t); + + public Task getTicketById(int id); + public Task Close(int Id); + } +} + diff --git a/Sources/HeartTrack/Services/TicketDataService/TicketDataServiceAPI.cs b/Sources/HeartTrack/Services/TicketDataService/TicketDataServiceAPI.cs new file mode 100644 index 0000000..d38e31e --- /dev/null +++ b/Sources/HeartTrack/Services/TicketDataService/TicketDataServiceAPI.cs @@ -0,0 +1,91 @@ +using System; +using HeartTrack.Models; +using Microsoft.AspNetCore.Components; + +namespace HeartTrack.Services.TicketDataService +{ + public class TicketDataServiceAPI : ITicketDataService + { + [Inject] + private HttpClient _clientHttp { get; set; } + + + public TicketDataServiceAPI(HttpClient clientHttp) + { + this._clientHttp = clientHttp; + } + + public async Task AddTicket(Ticket t) + { + HttpResponseMessage response = await _clientHttp.PostAsJsonAsync("http://localhost:8080/api/tickets", t); + + if (response.IsSuccessStatusCode) + { + Console.WriteLine("API - Ticket avec l'id " + t.Id + " ajouté avec succès"); + } + else + { + Console.WriteLine("API - Problème ajout Ticket"); + } + } + + public async Task getTicketById(int id) + { + Ticket Ticket = await _clientHttp.GetFromJsonAsync("http://localhost:8080/api/tickets/{id}"); + return Ticket; + } + + public async Task> getAllTickets() + { + List lTickets = await _clientHttp.GetFromJsonAsync>("http://localhost:8080/api/tickets"); + return lTickets; + } + + public async Task RemoveTicket(Ticket t) + { + HttpResponseMessage response = await _clientHttp.DeleteAsync($"http://localhost:8080/api/tickets/{t.Id}"); + + if (response.IsSuccessStatusCode) + { + Console.WriteLine("API - Ticket avec l'id " + t.Id + " supprimé avec succès"); + } + else + { + Console.WriteLine("API - Problème suppression Ticket"); + } + } + + public async Task SaveAllTickets(List list) + { + HttpResponseMessage response = await _clientHttp.PutAsJsonAsync("http://localhost:8080/api/tickets", list); + + if (response.IsSuccessStatusCode) + { + Console.WriteLine("API - List de tickets sauvegardé avec succès"); + } + else + { + Console.WriteLine("API - Problème sauvegarde List de tickets"); + } + } + + public async Task UpdateTicket(Ticket t) + { + HttpResponseMessage response = await _clientHttp.PutAsJsonAsync($"http://localhost:8080/api/tickets/{t.Id}", t); + + if (response.IsSuccessStatusCode) + { + Console.WriteLine("API - Ticket avec l'id " + t.Id + " mis à jour avec succès"); + } + else + { + Console.WriteLine("API - Problème mise à jour Ticket"); + } + } + + public async Task Close(int id) + { + + } + } +} \ No newline at end of file diff --git a/Sources/HeartTrack/Services/TicketDataService/TicketDataServiceFactice.cs b/Sources/HeartTrack/Services/TicketDataService/TicketDataServiceFactice.cs new file mode 100644 index 0000000..0bda818 --- /dev/null +++ b/Sources/HeartTrack/Services/TicketDataService/TicketDataServiceFactice.cs @@ -0,0 +1,144 @@ +using System; +using Blazored.LocalStorage; +using HeartTrack.Models; +using HeartTrack.Services.TicketDataService; +using Microsoft.AspNetCore.Components; + +namespace HeartTrack.Services.TicketDataServiceFactice +{ + public class TicketDataServiceFactice : ITicketDataService + { + [Inject] + private HttpClient _clientHttp { get; set; } + + [Inject] + public ILocalStorageService _localStorage { get; set; } + + [Inject] + public NavigationManager _navigationManager { get; set; } + + private String EmplacementLocalStorage { get; set; } + private String EmplacementJson { get; set; } + + + public TicketDataServiceFactice(HttpClient clientHttp, ILocalStorageService localStorage, NavigationManager navigationManager) + { + this._clientHttp = clientHttp; + this._localStorage = localStorage; + this._navigationManager = navigationManager; + this.EmplacementLocalStorage = "ticketsData"; + this.EmplacementJson = $"{_navigationManager.BaseUri}data/fake-tickets.json"; + } + + public async Task AddTicket(Ticket t) + { + List data = await getAllTickets(); + data.Add(t); + await this.SaveAllTickets(data); + } + + public async Task getTicketById(int id) + { + List tickets = await getAllTickets(); + Ticket? temp = null; + + foreach (Ticket t in tickets) + { + if (t.Id == id) + { + temp = t; + } + } + + return temp; + } + + public async Task> getAllTickets() + { + List lTickets = new List(); + + lTickets = await this.getTicketsFromLocalStorage(); + if (lTickets.Count == 0) + { + lTickets = await this.getTicketsFromJson(this.EmplacementJson); + await this.saveTicketsLocalStorage(lTickets); + } + + return lTickets; + } + + private async Task> getTicketsFromJson(String cheminVersJson) + { + List TicketsDeserialiser = new List(); + + var data = await _clientHttp.GetFromJsonAsync(cheminVersJson); + TicketsDeserialiser = data.ToList(); + + return TicketsDeserialiser; + } + + private async Task> getTicketsFromLocalStorage() + { + List TicketsFromLocalStorage = null; + + var data = await _localStorage.GetItemAsync(EmplacementLocalStorage); + + if (data == null) + { + TicketsFromLocalStorage = new List(); + } + else + { + TicketsFromLocalStorage = data.ToList(); + } + + return TicketsFromLocalStorage; + } + + public async Task RemoveTicket(Ticket t) + { + // Get the current data + var currentData = await _localStorage.GetItemAsync>("data"); + + // Get the item int the list + var item = currentData.FirstOrDefault(w => w.Id == t.Id); + + // Delete item in + currentData.Remove(item); + + // Save the data + await _localStorage.SetItemAsync("data", currentData); + } + + public async Task SaveAllTickets(List list) + { + await this.saveTicketsLocalStorage(list); + } + + private async Task saveTicketsLocalStorage(List lTickets) + { + await _localStorage.SetItemAsync(this.EmplacementLocalStorage, lTickets); + } + + public async Task UpdateTicket(Ticket t) + { + await this.RemoveTicket(t); + await this.AddTicket(t); + } + + public async Task Close(int Id) + { + // Get the current data + var currentData = await _localStorage.GetItemAsync>("data"); + + // Get the item int the list + var item = currentData.FirstOrDefault(w => w.Id == Id); + + // Update item status + item.isCheck = true; + + // Save the data + await _localStorage.SetItemAsync("data", currentData); + } + } +} \ No newline at end of file diff --git a/Sources/HeartTrack/Shared/CultureSelector.razor b/Sources/HeartTrack/Shared/CultureSelector.razor new file mode 100644 index 0000000..0b42bdc --- /dev/null +++ b/Sources/HeartTrack/Shared/CultureSelector.razor @@ -0,0 +1,12 @@ +@using System.Globalization + +

+ +

diff --git a/Sources/HeartTrack/Shared/CultureSelector.razor.cs b/Sources/HeartTrack/Shared/CultureSelector.razor.cs new file mode 100644 index 0000000..ad3ae21 --- /dev/null +++ b/Sources/HeartTrack/Shared/CultureSelector.razor.cs @@ -0,0 +1,37 @@ +using Microsoft.AspNetCore.Components; +using System.Globalization; + +namespace HeartTrack.Shared +{ + public partial class CultureSelector + { + [Inject] + private NavigationManager NavigationManager { get; set; } + + private CultureInfo[] supportedCultures = new[] + { + new CultureInfo("en-US"), + new CultureInfo("fr-FR") + }; + + private CultureInfo Culture + { + get => CultureInfo.CurrentCulture; + set + { + if (CultureInfo.CurrentUICulture == value) + { + return; + } + + var culture = value.Name.ToLower(CultureInfo.InvariantCulture); + + var uri = new Uri(this.NavigationManager.Uri).GetComponents(UriComponents.PathAndQuery, UriFormat.Unescaped); + var query = $"?culture={Uri.EscapeDataString(culture)}&" + $"redirectUri={Uri.EscapeDataString(uri)}"; + + // Redirect the user to the culture controller to set the cookie + this.NavigationManager.NavigateTo("/Culture/SetCulture" + query, forceLoad: true); + } + } + } +} diff --git a/Sources/HeartTrack/Shared/MainLayout.razor b/Sources/HeartTrack/Shared/MainLayout.razor index f1be7ec..4b6d1ba 100644 --- a/Sources/HeartTrack/Shared/MainLayout.razor +++ b/Sources/HeartTrack/Shared/MainLayout.razor @@ -1,20 +1,39 @@ @inherits LayoutComponentBase + + + HeartTrack
- - +
\ No newline at end of file diff --git a/Sources/HeartTrack/Shared/MainLayout.razor.cs b/Sources/HeartTrack/Shared/MainLayout.razor.cs new file mode 100644 index 0000000..7dcd483 --- /dev/null +++ b/Sources/HeartTrack/Shared/MainLayout.razor.cs @@ -0,0 +1,25 @@ +using HeartTrack.Services; +using Microsoft.AspNetCore.Components.Authorization; +using Microsoft.AspNetCore.Components; + +namespace HeartTrack.Shared +{ + public partial class MainLayout + { + [Inject] + public NavigationManager NavigationManager { get; set; } + + private bool collapseNavMenu = true; + + private string? NavMenuCssClass => collapseNavMenu ? "collapse" : null; + + private void ToggleNavMenu() + { + collapseNavMenu = !collapseNavMenu; + } + private void ToggleProfilMenu() + { + + } + } +} diff --git a/Sources/HeartTrack/Shared/NavMenu.razor b/Sources/HeartTrack/Shared/NavMenu.razor index 3652642..8ccf253 100644 --- a/Sources/HeartTrack/Shared/NavMenu.razor +++ b/Sources/HeartTrack/Shared/NavMenu.razor @@ -1,40 +1,26 @@  -
+
- -@code { - private bool collapseNavMenu = true; - - private string? NavMenuCssClass => collapseNavMenu ? "collapse" : null; - - private void ToggleNavMenu() - { - collapseNavMenu = !collapseNavMenu; - } -} - diff --git a/Sources/HeartTrack/Shared/NavMenu.razor.cs b/Sources/HeartTrack/Shared/NavMenu.razor.cs new file mode 100644 index 0000000..85470e2 --- /dev/null +++ b/Sources/HeartTrack/Shared/NavMenu.razor.cs @@ -0,0 +1,12 @@ +using HeartTrack.Pages; +using Microsoft.AspNetCore.Components; +using Microsoft.Extensions.Localization; + +namespace HeartTrack.Shared +{ + public partial class NavMenu + { + [Inject] + public IStringLocalizer Localizer { get; set; } + } +} diff --git a/Sources/HeartTrack/Shared/NavMenu.razor.css b/Sources/HeartTrack/Shared/NavMenu.razor.css index db47d63..130174c 100644 --- a/Sources/HeartTrack/Shared/NavMenu.razor.css +++ b/Sources/HeartTrack/Shared/NavMenu.razor.css @@ -1,16 +1,19 @@ -.navbar-toggler { - background-color: rgba(255, 255, 255, 0.1); +/* Bouton rétrécicement de menu */ +.navbar-toggler { + background-color: black; } +/* En-tête */ .top-row { height: 3.5rem; - background-color: rgba(0,0,0,0.4); + background-color: darkblue; } .navbar-brand { font-size: 1.1rem; } +/* Icons */ .oi { width: 2rem; font-size: 1.1rem; @@ -40,19 +43,22 @@ line-height: 3rem; } +/* Rectangle items*/ .nav-item ::deep a.active { - background-color: rgba(255,255,255,0.25); + background-color: black; color: white; } +/* Hover des items */ .nav-item ::deep a:hover { background-color: rgba(255,255,255,0.1); color: white; } @media (min-width: 641px) { +/* Activer ou non le bouton défilement menu*/ .navbar-toggler { - display: none; + display: block; } .collapse { diff --git a/Sources/HeartTrack/Shared/SurveyPrompt.razor b/Sources/HeartTrack/Shared/SurveyPrompt.razor deleted file mode 100644 index a1d6739..0000000 --- a/Sources/HeartTrack/Shared/SurveyPrompt.razor +++ /dev/null @@ -1,17 +0,0 @@ -
- - @Title - - - Please take our - brief survey - - and tell us what you think. -
- -@code { - // Demonstrates how a parent component can supply parameters - [Parameter] - public string? Title { get; set; } -} - diff --git a/Sources/HeartTrack/_Imports.razor b/Sources/HeartTrack/_Imports.razor index 5a37c1a..9246157 100644 --- a/Sources/HeartTrack/_Imports.razor +++ b/Sources/HeartTrack/_Imports.razor @@ -8,4 +8,5 @@ @using Microsoft.JSInterop @using HeartTrack @using HeartTrack.Shared - +@using Blazorise.DataGrid +@using MudBlazor \ No newline at end of file diff --git a/Sources/HeartTrack/wwwroot/css/site.css b/Sources/HeartTrack/wwwroot/css/site.css index 1cbb1a0..de0a471 100644 --- a/Sources/HeartTrack/wwwroot/css/site.css +++ b/Sources/HeartTrack/wwwroot/css/site.css @@ -63,3 +63,17 @@ a, .btn-link { content: "An error has occurred." } +.custom-toggler .navbar-toggler-icon { + background-image: url("https://icons8.com/icon/JTddWDKbAzgl/menu"); +} + +.custom-toggler.navbar-toggler { + border-color: rgb(255,102,203); +} + +.navbar-toggler:focus, +.navbar-toggler:active, +.navbar-toggler-icon:focus { + outline: none; + box-shadow: none; +} diff --git a/Sources/HeartTrack/wwwroot/data/fake-activities.json b/Sources/HeartTrack/wwwroot/data/fake-activities.json new file mode 100644 index 0000000..9432f19 --- /dev/null +++ b/Sources/HeartTrack/wwwroot/data/fake-activities.json @@ -0,0 +1,418 @@ +[ + { + "idActivity": 1, + "type": "Type2", + "date": "2014-01-16", + "startTime": "2022-01-18", + "endTime": "1990-12-23", + "effortRessenti": 5, + "variability": 31.9135, + "variance": 47.9027, + "standardDeviation": 51.4366, + "average": 77.616, + "maximum": 156, + "minimum": 99, + "avrTemperature": 47.9859, + "hasAutoPause": false + }, + { + "idActivity": 2, + "type": "Type1", + "date": "2018-11-27", + "startTime": "2008-09-06", + "endTime": "1971-04-16", + "effortRessenti": 2, + "variability": 63.2869, + "variance": 4.3233, + "standardDeviation": 36.6456, + "average": 14.0372, + "maximum": 182, + "minimum": 57, + "avrTemperature": 47.8921, + "hasAutoPause": true + }, + { + "idActivity": 3, + "type": "Type2", + "date": "2018-01-24", + "startTime": "2009-03-24", + "endTime": "1941-05-20", + "effortRessenti": 4, + "variability": 66.0437, + "variance": 40.1499, + "standardDeviation": 85.1707, + "average": 52.538, + "maximum": 114, + "minimum": 41, + "avrTemperature": 48.6091, + "hasAutoPause": true + }, + { + "idActivity": 4, + "type": "Type3", + "date": "2014-07-05", + "startTime": "1954-10-02", + "endTime": "2019-11-13", + "effortRessenti": 3, + "variability": 72.5219, + "variance": 88.7179, + "standardDeviation": 56.3285, + "average": 99.2423, + "maximum": 101, + "minimum": 35, + "avrTemperature": 99.5707, + "hasAutoPause": false + }, + { + "idActivity": 5, + "type": "Type1", + "date": "2020-07-27", + "startTime": "1970-07-09", + "endTime": "2014-01-07", + "effortRessenti": 1, + "variability": 91.2868, + "variance": 35.2977, + "standardDeviation": 89.1283, + "average": 24.5516, + "maximum": 185, + "minimum": 55, + "avrTemperature": 61.2443, + "hasAutoPause": false + }, + { + "idActivity": 6, + "type": "Type3", + "date": "2022-01-21", + "startTime": "1988-07-11", + "endTime": "1947-10-08", + "effortRessenti": 2, + "variability": 39.2403, + "variance": 68.3035, + "standardDeviation": 48.4541, + "average": 15.0519, + "maximum": 87, + "minimum": 61, + "avrTemperature": 24.96, + "hasAutoPause": true + }, + { + "idActivity": 7, + "type": "Type2", + "date": "2020-07-04", + "startTime": "1966-07-04", + "endTime": "1953-11-28", + "effortRessenti": 3, + "variability": 77.9106, + "variance": 50.2753, + "standardDeviation": 27.6544, + "average": 73.1399, + "maximum": 178, + "minimum": 80, + "avrTemperature": 70.0154, + "hasAutoPause": true + }, + { + "idActivity": 8, + "type": "Type3", + "date": "2021-11-01", + "startTime": "1966-06-30", + "endTime": "1966-10-08", + "effortRessenti": 5, + "variability": 12.8896, + "variance": 91.5997, + "standardDeviation": 28.1367, + "average": 63.2516, + "maximum": 99, + "minimum": 64, + "avrTemperature": 47.2724, + "hasAutoPause": false + }, + { + "idActivity": 9, + "type": "Type1", + "date": "2020-10-18", + "startTime": "1993-02-09", + "endTime": "1922-01-12", + "effortRessenti": 2, + "variability": 75.0622, + "variance": 28.5926, + "standardDeviation": 84.1056, + "average": 82.6735, + "maximum": 184, + "minimum": 58, + "avrTemperature": 2.5165, + "hasAutoPause": true + }, + { + "idActivity": 10, + "type": "Type3", + "date": "2019-07-21", + "startTime": "1978-01-14", + "endTime": "1921-10-28", + "effortRessenti": 2, + "variability": 38.4167, + "variance": 8.9565, + "standardDeviation": 79.1064, + "average": 71.7045, + "maximum": 189, + "minimum": 41, + "avrTemperature": 11.3153, + "hasAutoPause": false + }, + { + "idActivity": 11, + "type": "Type2", + "date": "2015-01-10", + "startTime": "1982-05-10", + "endTime": "2000-06-20", + "effortRessenti": 2, + "variability": 7.298, + "variance": 84.2038, + "standardDeviation": 59.7613, + "average": 24.1556, + "maximum": 84, + "minimum": 40, + "avrTemperature": 79.2884, + "hasAutoPause": true + }, + { + "idActivity": 12, + "type": "Type1", + "date": "2014-12-15", + "startTime": "2003-07-20", + "endTime": "1957-10-10", + "effortRessenti": 4, + "variability": 6.1594, + "variance": 39.0998, + "standardDeviation": 87.1683, + "average": 99.7483, + "maximum": 84, + "minimum": 36, + "avrTemperature": 90.0641, + "hasAutoPause": true + }, + { + "idActivity": 13, + "type": "Type3", + "date": "2019-07-09", + "startTime": "1977-03-04", + "endTime": "1960-01-01", + "effortRessenti": 4, + "variability": 44.0535, + "variance": 12.5373, + "standardDeviation": 58.7271, + "average": 19.4843, + "maximum": 193, + "minimum": 76, + "avrTemperature": 22.6955, + "hasAutoPause": true + }, + { + "idActivity": 14, + "type": "Type2", + "date": "2023-12-11", + "startTime": "1954-06-28", + "endTime": "1993-06-24", + "effortRessenti": 2, + "variability": 10.3723, + "variance": 54.257, + "standardDeviation": 69.0052, + "average": 97.0453, + "maximum": 181, + "minimum": 72, + "avrTemperature": 81.2482, + "hasAutoPause": false + }, + { + "idActivity": 15, + "type": "Type1", + "date": "2018-07-02", + "startTime": "2024-01-03", + "endTime": "1964-08-30", + "effortRessenti": 2, + "variability": 48.2932, + "variance": 67.7662, + "standardDeviation": 94.5576, + "average": 98.3297, + "maximum": 177, + "minimum": 38, + "avrTemperature": 91.9669, + "hasAutoPause": true + }, + { + "idActivity": 16, + "type": "Type1", + "date": "2018-07-06", + "startTime": "2012-12-28", + "endTime": "2014-04-26", + "effortRessenti": 1, + "variability": 26.7247, + "variance": 8.6121, + "standardDeviation": 32.8475, + "average": 36.0507, + "maximum": 135, + "minimum": 95, + "avrTemperature": 64.4691, + "hasAutoPause": true + }, + { + "idActivity": 17, + "type": "Type2", + "date": "2022-07-08", + "startTime": "1934-08-04", + "endTime": "1948-01-16", + "effortRessenti": 3, + "variability": 24.5678, + "variance": 89.474, + "standardDeviation": 6.4851, + "average": 80.388, + "maximum": 198, + "minimum": 65, + "avrTemperature": 73.0159, + "hasAutoPause": false + }, + { + "idActivity": 18, + "type": "Type3", + "date": "2020-08-08", + "startTime": "1943-01-04", + "endTime": "1984-11-01", + "effortRessenti": 4, + "variability": 15.8206, + "variance": 10.1982, + "standardDeviation": 89.2815, + "average": 60.1575, + "maximum": 177, + "minimum": 55, + "avrTemperature": 95.3616, + "hasAutoPause": false + }, + { + "idActivity": 19, + "type": "Type1", + "date": "2017-01-31", + "startTime": "1995-01-14", + "endTime": "1967-07-28", + "effortRessenti": 2, + "variability": 10.3217, + "variance": 25.3434, + "standardDeviation": 64.5326, + "average": 6.7419, + "maximum": 83, + "minimum": 72, + "avrTemperature": 19.6569, + "hasAutoPause": false + }, + { + "idActivity": 20, + "type": "Type3", + "date": "2017-05-29", + "startTime": "1959-03-03", + "endTime": "1943-08-27", + "effortRessenti": 2, + "variability": 12.9503, + "variance": 90.5546, + "standardDeviation": 57.812, + "average": 44.4189, + "maximum": 144, + "minimum": 79, + "avrTemperature": 95.1186, + "hasAutoPause": false + }, + { + "idActivity": 21, + "type": "Type1", + "date": "2015-10-03", + "startTime": "1946-05-27", + "endTime": "1934-06-04", + "effortRessenti": 3, + "variability": 59.5777, + "variance": 61.9804, + "standardDeviation": 46.6558, + "average": 11.234, + "maximum": 144, + "minimum": 73, + "avrTemperature": 72.5805, + "hasAutoPause": false + }, + { + "idActivity": 22, + "type": "Type1", + "date": "2015-04-05", + "startTime": "1948-02-07", + "endTime": "1925-04-24", + "effortRessenti": 3, + "variability": 4.6783, + "variance": 66.7362, + "standardDeviation": 79.8471, + "average": 52.3693, + "maximum": 141, + "minimum": 85, + "avrTemperature": 48.7024, + "hasAutoPause": false + }, + { + "idActivity": 23, + "type": "Type1", + "date": "2023-06-05", + "startTime": "1920-11-12", + "endTime": "1926-06-26", + "effortRessenti": 5, + "variability": 67.8302, + "variance": 33.2865, + "standardDeviation": 4.516, + "average": 17.2584, + "maximum": 150, + "minimum": 47, + "avrTemperature": 52.2994, + "hasAutoPause": true + }, + { + "idActivity": 24, + "type": "Type2", + "date": "2014-03-03", + "startTime": "1988-05-05", + "endTime": "1944-06-29", + "effortRessenti": 1, + "variability": 12.7751, + "variance": 92.9296, + "standardDeviation": 76.843, + "average": 32.2267, + "maximum": 114, + "minimum": 77, + "avrTemperature": 80.627, + "hasAutoPause": true + }, + { + "idActivity": 25, + "type": "Type3", + "date": "2016-07-01", + "startTime": "1927-11-09", + "endTime": "2011-12-16", + "effortRessenti": 3, + "variability": 45.0597, + "variance": 37.5072, + "standardDeviation": 6.6945, + "average": 70.5156, + "maximum": 81, + "minimum": 32, + "avrTemperature": 57.5543, + "hasAutoPause": false + }, + { + "idActivity": 26, + "type": "Type3", + "date": "2020-06-25", + "startTime": "1940-12-10", + "endTime": "1944-05-02", + "effortRessenti": 2, + "variability": 20.6298, + "variance": 54.2174, + "standardDeviation": 56.4106, + "average": 4.487, + "maximum": 112, + "minimum": 98, + "avrTemperature": 80.8548, + "hasAutoPause": false + } +] \ No newline at end of file diff --git a/Sources/HeartTrack/wwwroot/data/fake-tickets.json b/Sources/HeartTrack/wwwroot/data/fake-tickets.json new file mode 100644 index 0000000..802f171 --- /dev/null +++ b/Sources/HeartTrack/wwwroot/data/fake-tickets.json @@ -0,0 +1,209 @@ +[ + { + "id": 1, + "username": "johndoe", + "nom": "Doe", + "prenom": "John", + "contexte": "Jvais dire wallah", + "description": "Wallah c`est la description", + "urgence": true + }, + { + "id": 2, + "username": "johndoe", + "nom": "Doe", + "prenom": "John", + "contexte": "Jvais dire wallah", + "description": "Wallah c`est la description", + "urgence": true + }, + { + "id": 3, + "username": "johndoe", + "nom": "Doe", + "prenom": "John", + "contexte": "Jvais dire wallah", + "description": "Wallah c`est la description", + "urgence": false + }, + { + "id": 4, + "username": "johndoe", + "nom": "Doe", + "prenom": "John", + "contexte": "Jvais dire wallah", + "description": "Wallah c`est la description", + "urgence": false + }, + { + "id": 5, + "username": "johndoe", + "nom": "Doe", + "prenom": "John", + "contexte": "Jvais dire wallah", + "description": "Wallah c`est la description", + "urgence": true + }, + { + "id": 6, + "username": "johndoe", + "nom": "Doe", + "prenom": "John", + "contexte": "Jvais dire wallah", + "description": "Wallah c`est la description", + "urgence": false + }, + { + "id": 7, + "username": "johndoe", + "nom": "Doe", + "prenom": "John", + "contexte": "Jvais dire wallah", + "description": "Wallah c`est la description", + "urgence": true + }, + { + "id": 8, + "username": "johndoe", + "nom": "Doe", + "prenom": "John", + "contexte": "Jvais dire wallah", + "description": "Wallah c`est la description", + "urgence": true + }, + { + "id": 9, + "username": "johndoe", + "nom": "Doe", + "prenom": "John", + "contexte": "Jvais dire wallah", + "description": "Wallah c`est la description", + "urgence": false + }, + { + "id": 10, + "username": "johndoe", + "nom": "Doe", + "prenom": "John", + "contexte": "Jvais dire wallah", + "description": "Wallah c`est la description", + "urgence": true + }, + { + "id": 11, + "username": "johndoe", + "nom": "Doe", + "prenom": "John", + "contexte": "Jvais dire wallah", + "description": "Wallah c`est la description", + "urgence": false + }, + { + "id": 12, + "username": "johndoe", + "nom": "Doe", + "prenom": "John", + "contexte": "Jvais dire wallah", + "description": "Wallah c`est la description", + "urgence": true + }, + { + "id": 13, + "username": "johndoe", + "nom": "Doe", + "prenom": "John", + "contexte": "Jvais dire wallah", + "description": "Wallah c`est la description", + "urgence": true + }, + { + "id": 14, + "username": "johndoe", + "nom": "Doe", + "prenom": "John", + "contexte": "Jvais dire wallah", + "description": "Wallah c`est la description", + "urgence": true + }, + { + "id": 15, + "username": "johndoe", + "nom": "Doe", + "prenom": "John", + "contexte": "Jvais dire wallah", + "description": "Wallah c`est la description", + "urgence": false + }, + { + "id": 16, + "username": "johndoe", + "nom": "Doe", + "prenom": "John", + "contexte": "Jvais dire wallah", + "description": "Wallah c`est la description", + "urgence": true + }, + { + "id": 17, + "username": "johndoe", + "nom": "Doe", + "prenom": "John", + "contexte": "Jvais dire wallah", + "description": "Wallah c`est la description", + "urgence": false + }, + { + "id": 18, + "username": "johndoe", + "nom": "Doe", + "prenom": "John", + "contexte": "Jvais dire wallah", + "description": "Wallah c`est la description", + "urgence": true + }, + { + "id": 19, + "username": "johndoe", + "nom": "Doe", + "prenom": "John", + "contexte": "Jvais dire wallah", + "description": "Wallah c`est la description", + "urgence": true + }, + { + "id": 20, + "username": "johndoe", + "nom": "Doe", + "prenom": "John", + "contexte": "Jvais dire wallah", + "description": "Wallah c`est la description", + "urgence": true + }, + { + "id": 21, + "username": "johndoe", + "nom": "Doe", + "prenom": "John", + "contexte": "Jvais dire wallah", + "description": "Wallah c`est la description", + "urgence": true + }, + { + "id": 22, + "username": "johndoe", + "nom": "Doe", + "prenom": "John", + "contexte": "Jvais dire wallah", + "description": "Wallah c`est la description", + "urgence": false + }, + { + "id": 23, + "username": "johndoe", + "nom": "Doe", + "prenom": "John", + "contexte": "Jvais dire wallah", + "description": "Wallah c`est la description", + "urgence": true + } +] \ No newline at end of file