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 />
|
||||
<Row>
|
||||
<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" />
|
||||
</Button>
|
||||
</Column>
|
||||
@@ -124,7 +124,7 @@
|
||||
</ListView>
|
||||
</Column>
|
||||
<Column ColumnSize="ColumnSize.Is6.OnDesktop.Is12.OnMobile" Margin="Margin.Is3.FromTop.OnMobile" Padding="Padding.Is4.FromStart.OnMobile">
|
||||
<Div>
|
||||
<Div hidden="@hideButtonSettings">
|
||||
<Field>
|
||||
<FieldLabel>
|
||||
<h2>
|
||||
@@ -179,10 +179,10 @@
|
||||
</DropdownMenu>
|
||||
</Dropdown>
|
||||
</Field>
|
||||
</Div>
|
||||
<Column ColumnSize="ColumnSize.IsFull" TextAlignment="TextAlignment.End">
|
||||
<Button Color="Color.Primary">Save</Button>
|
||||
</Column>
|
||||
</Div>
|
||||
</Column>
|
||||
</Div>
|
||||
</Row>
|
||||
@@ -191,12 +191,35 @@
|
||||
@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) };
|
||||
|
||||
User? SelectedUser = null;
|
||||
User? UserCopy = null;
|
||||
|
||||
bool hideButtonSettings = true;
|
||||
bool newpage = true;
|
||||
|
||||
private Modal? modalRefDelete;
|
||||
|
||||
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()
|
||||
{
|
||||
return modalRefDelete!.Show();
|
||||
|
||||
@@ -143,8 +143,7 @@
|
||||
List<Device> plugs = new List<Device>();
|
||||
|
||||
bool hideButtonSettings = true;
|
||||
|
||||
int clicks = 0;
|
||||
bool newpage = true;
|
||||
|
||||
double electricityPrice = 0;
|
||||
|
||||
@@ -165,18 +164,20 @@
|
||||
|
||||
private void Toggle(Device device)
|
||||
{
|
||||
if (device == SelectedDevice || clicks == 0)
|
||||
if (device == SelectedDevice || newpage)
|
||||
{
|
||||
hideButtonSettings = !hideButtonSettings;
|
||||
SelectedDevice = device;
|
||||
DeviceCopy = device.CopyDevice();
|
||||
clicks++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (hideButtonSettings)
|
||||
{
|
||||
hideButtonSettings = !hideButtonSettings;
|
||||
}
|
||||
}
|
||||
SelectedDevice = device;
|
||||
DeviceCopy = device.CopyDevice();
|
||||
}
|
||||
newpage = false;
|
||||
}
|
||||
|
||||
private async void OnSave()
|
||||
|
||||
Reference in New Issue
Block a user