Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Data/Database.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public async Task CreateTablesAsync()
await _database.CreateTableAsync<Models.OperationalTeam>();
await _database.CreateTableAsync<Models.BuildingType>();
await _database.CreateTableAsync<Models.Continent>();
await _database.CreateTableAsync<Models.Equipment>();
await _database.CreateTableAsync<Models.AnEquipment>();
await _database.CreateTableAsync<Models.OrderStatus>();
await _database.CreateTableAsync<Models.Organisation>();
await _database.CreateTableAsync<Models.PositionStatuses>();
Expand Down
6 changes: 1 addition & 5 deletions MauiProgram.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
using UndacApp.Data;
using UndacApp.Services;
using Microsoft.Extensions.Logging;
using UndacApp.Services.Accommodation;

namespace UndacApp;

public static class MauiProgram
Expand Down Expand Up @@ -34,11 +32,9 @@ public static MauiApp CreateMauiApp()
builder.Services.AddSingleton<IResourceTypeService, ResourceTypeService>();
builder.Services.AddSingleton<IResourceService, ResourceService>();
builder.Services.AddSingleton<IVolunteerService, VolunteerService>();

builder.Services.AddSingleton<IMethodologicalDocumentationService, MethodologicalDocumentationService>();

builder.Services.AddSingleton<ICalendarEventService, CalendarEventService>();

builder.Services.AddSingleton<IEquipmentService, EquipmentService>();

#if DEBUG
builder.Logging.AddDebug();
Expand Down
38 changes: 38 additions & 0 deletions Models/AnEquipment.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
namespace UndacApp.Models
{
/*! <summary>
A model structure for Equipment data
</summary>
<details>Data is stored in SQLite database.</details> */
public class AnEquipment : AModel
{
private string? _type = String.Empty;
public string? Type
{
get => _type;
set => SetField(ref _type, value);
}

private string? _location = String.Empty;
public string? Location
{
get => _location;
set => SetField(ref _location, value);
}

private string? _currentOperation = String.Empty;
public string? CurrentOperation
{
get => _currentOperation;
set => SetField(ref _currentOperation, value);
}

private int _quantity = 0;
public int Quantity
{
get => _quantity;
set => SetField(ref _quantity, value);
}

}
}
20 changes: 0 additions & 20 deletions Models/Equipment.cs

This file was deleted.

2 changes: 1 addition & 1 deletion Services/Accommodation/BuildingTypeService.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using UndacApp.Models;

namespace UndacApp.Services.Accommodation
namespace UndacApp.Services
{
public class BuildingTypeService : AService<BuildingType>, IBuildingTypeService
{
Expand Down
2 changes: 1 addition & 1 deletion Services/Accommodation/IBuildingTypeService.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using UndacApp.Models;

namespace UndacApp.Services.Accommodation
namespace UndacApp.Services
{
/// <summary>
/// A service for handling building types.
Expand Down
2 changes: 1 addition & 1 deletion Services/Accommodation/IRoomTypeService.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using UndacApp.Models;

namespace UndacApp.Services.Accommodation
namespace UndacApp.Services
{
/// <summary>
/// Interface used for managing rooms
Expand Down
2 changes: 1 addition & 1 deletion Services/Accommodation/RoomTypeService.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using UndacApp.Models;

namespace UndacApp.Services.Accommodation
namespace UndacApp.Services
{
/// <summary>
/// service class for managing room types in a SQLite database
Expand Down
2 changes: 1 addition & 1 deletion Services/EquipmentService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace UndacApp.Services
/*! <summary>
EquipmentService extending IEQuipmentService Interface
</summary> */
public class EquipmentService : AService<Equipment>, IEquipmentService
public class EquipmentService : AService<AnEquipment>, IEquipmentService
{

}
Expand Down
2 changes: 1 addition & 1 deletion Services/IEquipmentService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace UndacApp.Services
/*! <summary>
Interface that exposes methods of EquipmentService
</summary> */
public interface IEquipmentService : IService<Equipment>
public interface IEquipmentService : IService<AnEquipment>
{

}
Expand Down
10 changes: 8 additions & 2 deletions UndacApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@
<MauiXaml Update="Views\AcceptSpecialistRequests.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="Views\EquipmentPage.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="Views\DisasterManagementCoordination.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
Expand Down Expand Up @@ -141,6 +144,9 @@
</ItemGroup>

<ItemGroup>
<Compile Update="Views\EquipmentPage.xaml.cs">
<DependentUpon>EquipmentPage.xaml</DependentUpon>
</Compile>
<Compile Update="Views\LogisticOperationPage.xaml.cs">
<DependentUpon>LogisticOperationPage.xaml</DependentUpon>
</Compile>
Expand Down Expand Up @@ -189,8 +195,8 @@
<Compile Update="Views\RotaPage.xaml.cs">
<DependentUpon>RotaPage.xaml</DependentUpon>
</Compile>
<Compile Update="Views\EquipmentPage.xaml.cs">
<DependentUpon>EquipmentPage.xaml</DependentUpon>
<Compile Update="Views\EquipmentPage_Old.xaml.cs">
<DependentUpon>EquipmentPage_Old.xaml</DependentUpon>
</Compile>
<Compile Update="Views\WelcomePage.xaml.cs">
<DependentUpon>%(Filename)</DependentUpon>
Expand Down
1 change: 0 additions & 1 deletion Views/AddResourcePage.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System.Collections.ObjectModel;
using UndacApp.Models;
using UndacApp.Services;
using UndacApp.Services.Accommodation;

namespace UndacApp.Views;
public partial class AddResourcePage : ContentPage
Expand Down
2 changes: 1 addition & 1 deletion Views/BuildingTypePage.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

using UndacApp.Models;
using System.Collections.ObjectModel;
using UndacApp.Services.Accommodation;
using UndacApp.Services;

namespace UndacApp.Views;

Expand Down
99 changes: 78 additions & 21 deletions Views/EquipmentPage.xaml
Original file line number Diff line number Diff line change
@@ -1,29 +1,86 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:sys="clr-namespace:System;assembly=netstandard"
x:Class="UndacApp.Views.EquipmentPage"
Title="EquipmentPage"
xmlns:local="clr-namespace:Undac.Models">
<VerticalStackLayout Spacing="10" Margin="5">
<Editor x:Name="txe_equipment"
Placeholder="Add "
HeightRequest="100" />
Title="AddEquipments">

<Grid ColumnDefinitions="*,*" ColumnSpacing="4">
<Button Text="Save"
Clicked="SaveButton_Clicked" />
<ScrollView>
<VerticalStackLayout Spacing="30" Padding="30,20" VerticalOptions="Center">
<!-- Title -->

<Button Grid.Column="1"
Text="Delete"
Clicked="DeleteButton_Clicked" />
</Grid>
<Label Text="Add Equipments" FontSize="26" FontAttributes="Bold" HorizontalOptions="CenterAndExpand"/>

<ListView x:Name="ltv_equipment" Background="white" ItemSelected="ltv_equipment_ItemSelected">
<ListView.ItemTemplate>
<DataTemplate>
<TextCell TextColor="Black" Text="{Binding Name}"/>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</VerticalStackLayout>
<Frame CornerRadius="10" Padding="20">
<VerticalStackLayout Spacing="5">
<Label Text="Select equipment type:" FontSize="20" FontAttributes="Bold"/>
<Picker x:Name="EquipmentTypePicker" BackgroundColor="White" TextColor="Black" TitleColor="Black">
<Picker.ItemsSource>
<x:Array Type="{x:Type x:String}">
<x:String>Vehicles</x:String>
<x:String>Communication</x:String>
<x:String>Shelter and Bedding</x:String>
<x:String>Power Generation</x:String>
</x:Array>
</Picker.ItemsSource>
</Picker>
<Label Text="Select Location:" FontSize="20" FontAttributes="Bold"/>
<Picker x:Name="BuildingTypePicker" ItemDisplayBinding="{Binding Name}" BackgroundColor="White" TextColor="Black" TitleColor="Black"/>

<Label Text="Equipment Name and Quantity:" FontSize="20" FontAttributes="Bold"/>
<Entry Placeholder="Equipment Name:" x:Name="EquipmentName" />
<Entry Placeholder="Quantity" x:Name="NumberRequiredEntry" Keyboard="Numeric"/>

<Label Text="Assign Operation" FontSize="20" FontAttributes="Bold"/>
<Picker x:Name="OperationListPicker" ItemDisplayBinding="{Binding Name}" BackgroundColor="White" TextColor="Black" TitleColor="Black"/>

<Grid ColumnDefinitions="*,*,*" ColumnSpacing="3">
<Button Text="Add Record" Grid.Column="0" Clicked="OnAddRecordClicked" BackgroundColor="#4CAF50" CornerRadius="8" />
<Button Text="Update Record" Grid.Column="1" Clicked="OnUpdateClicked" BackgroundColor="blue" CornerRadius="8" />
<Button Text="Remove Record" Grid.Column="2" Clicked="OnRemoveClicked" BackgroundColor="MediumVioletRed" CornerRadius="8" />
</Grid>
</VerticalStackLayout>

</Frame>
<Label Text="Equipment List" FontSize="26" FontAttributes="Bold" HorizontalOptions="CenterAndExpand"/>

<StackLayout Orientation="Horizontal">
<Entry x:Name="searchEntry" Placeholder="Search" HorizontalOptions="FillAndExpand" TextChanged="OnEntryTextChanged" />
<Picker x:Name="filterPicker" TextColor="White">
<Picker.Title>Filter Equipment Status</Picker.Title>
<Picker.ItemsSource>
<x:Array Type="{x:Type x:String}">
<x:String>Name</x:String>
<x:String>Type</x:String>
<x:String>Location</x:String>
</x:Array>
</Picker.ItemsSource>
<Picker.SelectedItem>Name</Picker.SelectedItem>
</Picker>
</StackLayout>
<Button Text="Filter" Clicked="Button_Clicked" CornerRadius="8" />
<ListView x:Name="ltv_equipments" Background="white" ItemSelected="ltv_equipments_ItemSelected">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Grid Padding="10">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Label Grid.Row="0" Text="{Binding CurrentOperation}" TextColor="Black" FontAttributes="Bold"/>
<Label Grid.Row="1" Text="{Binding Type}" TextColor="Black"/>
<Label Grid.Row="2" Text="{Binding Name}" TextColor="Black"/>
<Label Grid.Row="3" Text="{Binding Location}" TextColor="Black"/>
<Label Grid.Row="4" Text="{Binding Quantity}" TextColor="Black"/>
</Grid>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</VerticalStackLayout>
</ScrollView>
</ContentPage>
Loading