Florian Mihalits ada8b7a200 Add payment types for walks and update related models
This commit introduces new payment types, including "MangoPay" and "Cash", to the localization resource files for both German and English. A new enum `WalkPaymentType` is created to represent these payment types, and the `Walk` class is updated to include a required `PaymentType` property of this enum type.

The database context is modified to add a `PaymentType` column to the `Walks` table, accompanied by a migration to implement this change and set a default value. The `WalkController` is updated to support filtering by the new `PaymentType` field, and the mapping profile is enhanced to include mappings for `WalkPaymentType` and its view model counterpart.

View models are also updated to incorporate the new `PaymentType` and its display name. Front-end TypeScript files are adjusted to utilize the new `WalkPaymentType` enum and related properties, while the UI is enhanced to display the payment type in the details view of walks. Version numbers in various configuration files are incremented to reflect these changes.
2025-06-30 11:06:30 +02:00

223 lines
8.8 KiB
Plaintext

@*
For more information on enabling MVC for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860
*@
@using Microsoft.AspNetCore.Mvc.Localization
@using gehGassi.Web.Models
@using Microsoft.Extensions.Localization
@using gehGassi.Web.Helper
@using gehGassi.Core.Services
@using gehGassi.Web.Services
@model gehGassi.Web.Models.WalkWithNamesVm
@inject IViewLocalizer Localizer
@inject ICountryService CountryService
@inject ICurrentTimeZoneService CurrentTimeZoneService
@{
IStringLocalizer annotationsLocalizer = ViewBag.AnnotationsLocalizer;
TimeSpan userOffset = await CurrentTimeZoneService.GetOffsetAsync();
}
<section id="walkDetailsContainer">
<div class="form">
<div id="pageTitleAdd" style="display: none;">@ViewData["Title"]</div>
<div class="row mb-3">
<div class="col-sm-6">
<div class="text-center"><h5>@Localizer["Common_DogOwner"]</h5></div>
<div class="text-center">
@if (!string.IsNullOrWhiteSpace(Model.DogOwnerPhoto))
{
<img src="/file/documents/@Model.DogOwnerPhoto" class="img-user-big" alt="" />
}
else
{
<img src="/images/icon_user.png" class="img-user-big" alt="" />
}
</div>
<h3 class="text-center">@Model.DogOwnerName</h3>
</div>
<div class="col-sm-6">
<div class="text-center"><h5>@Localizer["Common_DogWalker"]</h5></div>
<div class="text-center">
@if (!string.IsNullOrWhiteSpace(Model.DogWalkerPhoto))
{
<img src="/file/documents/@Model.DogWalkerPhoto" class="img-user-big" alt="" />
}
else
{
<img src="/images/icon_user.png" class="img-user-big" alt="" />
}
</div>
<h3 class="text-center">@Model.DogWalkerName</h3>
</div>
</div>
<div class="row mb-3">
<div class="col-sm-3">
<div class="h5 mb-1">@annotationsLocalizer["Walk_Type"]</div>
@Model.Type.GetDisplayName(annotationsLocalizer)
</div>
<div class="col-sm-3">
<div class="h5 mb-1">@annotationsLocalizer["Walk_ServiceType"]</div>
@Model.ServiceType.GetDisplayName(annotationsLocalizer)
</div>
<div class="col-sm-3">
<div class="h5 mb-1">@annotationsLocalizer["Walk_Status"]</div>
@Model.Status.GetDisplayName(annotationsLocalizer)
</div>
</div>
<div class="row mb-3">
<div class="col-sm-3">
<div class="h5 mb-1">@annotationsLocalizer["Walk_PaymentType"]</div>
@Model.PaymentType.GetDisplayName(annotationsLocalizer)
</div>
<div class="col-sm-3">
<div class="h5 mb-1">@annotationsLocalizer["Walk_PaymentStatus"]</div>
@Model.PaymentStatus.GetDisplayName(annotationsLocalizer)
</div>
</div>
<div class="row mb-3">
<div class="col-sm-3">
<div class="h5 mb-1">@annotationsLocalizer["Common_Created"]</div>
@Model.Created.ToOffset(userOffset).ToString("g")<br />(@Model.UpdatedAt.ToOffset(userOffset).ToString("g"))
</div>
<div class="col-sm-3">
<div class="h5 mb-1">@annotationsLocalizer["Walk_Start"]</div>
@Model.Start.ToOffset(userOffset).ToString("g")
</div>
<div class="col-sm-3">
<div class="h5 mb-1">@annotationsLocalizer["Walk_End"]</div>
@Model.End.ToOffset(userOffset).ToString("g")
</div>
<div class="col-sm-3">
<div class="h5 mb-1">@annotationsLocalizer["Walk_Price"]</div>
@Model.Price.ToString("n2")
</div>
</div>
<div class="row mb-3">
<div class="col-sm-6">
<div class="h5 mb-1">@Localizer["Common_Address"] 1</div>
<div>
@Model.PickupAddress_AddressLine1, @Model.PickupAddress_AddressLine2, @Model.PickupAddress_Zip, @Model.PickupAddress_City, @CountryService.GetState(Model.PickupAddress_CountryCode, Model.PickupAddress_State).Name, @CountryService.GetCountry(Model.PickupAddress_CountryCode).Name
</div>
</div>
<div class="col-sm-6">
<div class="h5 mb-1">@Localizer["Common_Address"] 2</div>
<div>
@Model.ReturnAddress_AddressLine1, @Model.ReturnAddress_AddressLine2, @Model.ReturnAddress_Zip, @Model.ReturnAddress_City, @CountryService.GetState(Model.ReturnAddress_CountryCode, Model.ReturnAddress_State).Name, @CountryService.GetCountry(Model.ReturnAddress_CountryCode).Name
</div>
</div>
</div>
<div class="row mb-3">
<div class="col-sm-3">
<div class="h5 mb-1">@annotationsLocalizer["Walk_Started"]</div>
@(Model.Started != null ? Model.Started.Value.ToOffset(userOffset).ToString("g") : "-")
</div>
<div class="col-sm-3">
<div class="h5 mb-1">@annotationsLocalizer["Walk_Completed"]</div>
@(Model.Completed != null ? Model.Completed.Value.ToOffset(userOffset).ToString("g") : "-")
</div>
<div class="col-sm-3">
<div class="h5 mb-1">@annotationsLocalizer["Walk_Confirmed"]</div>
@(Model.Confirmed != null ? Model.Confirmed.Value.ToOffset(userOffset).ToString("g") : "-")
</div>
<div class="col-sm-3">
<div class="h5 mb-1">@annotationsLocalizer["Walk_Complained"]</div>
@(Model.Complained != null ? Model.Complained.Value.ToOffset(userOffset).ToString("g") : "-")
</div>
</div>
<div class="row mb-3">
<div class="col-sm-12">
<div class="h5 mb-1">@Localizer["Common_Dogs"] - @Model.DogCount</div>
<div>
@string.Join(", ", Model.Dogs.Select(x => x.Name))
</div>
</div>
</div>
<div class="row mb-3">
<div class="col-sm-12">
<div class="h5 mb-1">@annotationsLocalizer["Walk_Info"]</div>
<div>
@if (!string.IsNullOrWhiteSpace(Model.Info))
{
<span>@Model.Info</span>
}
else
{
<span>-</span>
}
</div>
</div>
</div>
<div class="row mb-3">
<div class="col-sm-12">
<div class="h5 mb-1">@annotationsLocalizer["Walk_CompletedInfo"]</div>
<div>
@if (!string.IsNullOrWhiteSpace(Model.CompletedInfo))
{
<span>@Model.CompletedInfo</span>
}
else
{
<span>-</span>
}
</div>
</div>
</div>
@if (!string.IsNullOrWhiteSpace(Model.DeclinedReason))
{
<div class="row mb-3">
<div class="col-sm-12">
<div class="h5 mb-1">@annotationsLocalizer["Walk_DeclinedReason"]</div>
<div>
@Model.DeclinedReason
</div>
</div>
</div>
}
@if(Model.Status == WalkStatusVm.Cancelled)
{
<div class="row mb-3">
<div class="col-sm-12">
<div class="h5 mb-1">@annotationsLocalizer["Walk_CancelledBy"]</div>
<div>
@Model.CancelledBy.GetDisplayName(annotationsLocalizer)
</div>
</div>
</div>
}
@if (!string.IsNullOrWhiteSpace(Model.CancelledReason))
{
<div class="row mb-3">
<div class="col-sm-12">
<div class="h5 mb-1">@annotationsLocalizer["Walk_CancelledReason"]</div>
<div>
@Model.CancelledReason
</div>
</div>
</div>
}
<div class="row button-row">
<div class="col-12">
<div class="">
<button type="button" id="btnClose" class="btn btn-primary">@Localizer["Button_Close"]</button>
</div>
</div>
</div>
</div>
<system-js url="~/scripts/Views/Walks/details.js" fresh-import="true"></system-js>
</section>