mirror of
https://github.com/Stefan-5422/-T5-Elektrifikatsiya.git
synced 2026-09-04 00:45:58 +02:00
Toggle Fix (for real)
This commit is contained in:
@@ -112,7 +112,7 @@
|
|||||||
<br />
|
<br />
|
||||||
<Row>
|
<Row>
|
||||||
<Column ColumnSize="ColumnSize.Is1.OnDesktop">
|
<Column ColumnSize="ColumnSize.Is1.OnDesktop">
|
||||||
<Button Position="Position.Absolute.Top.Is50.Start.Is100.Translate.Middle" Color="Color.Dark" Outline>
|
<Button @onclick="() => Toggle(context.Item)" Position="Position.Absolute.Top.Is50.Start.Is100.Translate.Middle" Color="Color.Dark" Outline>
|
||||||
<BarIcon IconName="IconName.Pen" />
|
<BarIcon IconName="IconName.Pen" />
|
||||||
</Button>
|
</Button>
|
||||||
</Column>
|
</Column>
|
||||||
@@ -124,7 +124,7 @@
|
|||||||
</ListView>
|
</ListView>
|
||||||
</Column>
|
</Column>
|
||||||
<Column ColumnSize="ColumnSize.Is6.OnDesktop.Is12.OnMobile" Margin="Margin.Is3.FromTop.OnMobile" Padding="Padding.Is4.FromStart.OnMobile">
|
<Column ColumnSize="ColumnSize.Is6.OnDesktop.Is12.OnMobile" Margin="Margin.Is3.FromTop.OnMobile" Padding="Padding.Is4.FromStart.OnMobile">
|
||||||
<Div>
|
<Div hidden="@hideButtonSettings">
|
||||||
<Field>
|
<Field>
|
||||||
<FieldLabel>
|
<FieldLabel>
|
||||||
<h2>
|
<h2>
|
||||||
@@ -179,10 +179,10 @@
|
|||||||
</DropdownMenu>
|
</DropdownMenu>
|
||||||
</Dropdown>
|
</Dropdown>
|
||||||
</Field>
|
</Field>
|
||||||
</Div>
|
|
||||||
<Column ColumnSize="ColumnSize.IsFull" TextAlignment="TextAlignment.End">
|
<Column ColumnSize="ColumnSize.IsFull" TextAlignment="TextAlignment.End">
|
||||||
<Button Color="Color.Primary">Save</Button>
|
<Button Color="Color.Primary">Save</Button>
|
||||||
</Column>
|
</Column>
|
||||||
|
</Div>
|
||||||
</Column>
|
</Column>
|
||||||
</Div>
|
</Div>
|
||||||
</Row>
|
</Row>
|
||||||
@@ -191,12 +191,35 @@
|
|||||||
@code {
|
@code {
|
||||||
List<User> users = new List<User>() { new User("Silas", "aldjlfasd", Role.Admin), new User("Joe", "qiowruioewjfopa", Role.Admin), new User("Stefan", "adfadsdf", Role.Admin), new User("Manu", "öhöfldaösldf", Role.User) };
|
List<User> users = new List<User>() { new User("Silas", "aldjlfasd", Role.Admin), new User("Joe", "qiowruioewjfopa", Role.Admin), new User("Stefan", "adfadsdf", Role.Admin), new User("Manu", "öhöfldaösldf", Role.User) };
|
||||||
|
|
||||||
|
User? SelectedUser = null;
|
||||||
|
User? UserCopy = null;
|
||||||
|
|
||||||
|
bool hideButtonSettings = true;
|
||||||
|
bool newpage = true;
|
||||||
|
|
||||||
private Modal? modalRefDelete;
|
private Modal? modalRefDelete;
|
||||||
|
|
||||||
public Admin()
|
public Admin()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void Toggle(User user)
|
||||||
|
{
|
||||||
|
if (user == SelectedUser || newpage)
|
||||||
|
{
|
||||||
|
hideButtonSettings = !hideButtonSettings;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (hideButtonSettings)
|
||||||
|
{
|
||||||
|
hideButtonSettings = !hideButtonSettings;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SelectedUser = user;
|
||||||
|
newpage = false;
|
||||||
|
}
|
||||||
|
|
||||||
private Task ShowModalDelete()
|
private Task ShowModalDelete()
|
||||||
{
|
{
|
||||||
return modalRefDelete!.Show();
|
return modalRefDelete!.Show();
|
||||||
|
|||||||
@@ -143,8 +143,7 @@
|
|||||||
List<Device> plugs = new List<Device>();
|
List<Device> plugs = new List<Device>();
|
||||||
|
|
||||||
bool hideButtonSettings = true;
|
bool hideButtonSettings = true;
|
||||||
|
bool newpage = true;
|
||||||
int clicks = 0;
|
|
||||||
|
|
||||||
double electricityPrice = 0;
|
double electricityPrice = 0;
|
||||||
|
|
||||||
@@ -165,18 +164,20 @@
|
|||||||
|
|
||||||
private void Toggle(Device device)
|
private void Toggle(Device device)
|
||||||
{
|
{
|
||||||
if (device == SelectedDevice || clicks == 0)
|
if (device == SelectedDevice || newpage)
|
||||||
{
|
{
|
||||||
hideButtonSettings = !hideButtonSettings;
|
hideButtonSettings = !hideButtonSettings;
|
||||||
SelectedDevice = device;
|
|
||||||
DeviceCopy = device.CopyDevice();
|
|
||||||
clicks++;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (hideButtonSettings)
|
||||||
|
{
|
||||||
|
hideButtonSettings = !hideButtonSettings;
|
||||||
|
}
|
||||||
|
}
|
||||||
SelectedDevice = device;
|
SelectedDevice = device;
|
||||||
DeviceCopy = device.CopyDevice();
|
DeviceCopy = device.CopyDevice();
|
||||||
}
|
newpage = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void OnSave()
|
private async void OnSave()
|
||||||
|
|||||||
Reference in New Issue
Block a user