Skip to content

Commit

Permalink
hodně úprav
Browse files Browse the repository at this point in the history
  • Loading branch information
martinrotter committed Mar 28, 2024
1 parent 2132b20 commit 60e6269
Show file tree
Hide file tree
Showing 9 changed files with 130 additions and 15 deletions.
8 changes: 8 additions & 0 deletions ZZZO/ZZZO.Common/API/BodProgramu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ public enum TypBoduProgramu

#endregion

public bool JeEditovatelny
{
get => Typ == TypBoduProgramu.DoplnenyBodZasedani ||
Typ == TypBoduProgramu.BodZasedani;
}

#region Proměnné

private bool _jePodbod;
Expand Down Expand Up @@ -108,7 +114,9 @@ public TypBoduProgramu Typ
}

_typ = value;

OnPropertyChanged();
OnPropertyChanged(nameof(JeEditovatelny));
}
}

Expand Down
6 changes: 6 additions & 0 deletions ZZZO/ZZZO.Common/API/Usneseni.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ public ObservableCollection<HlasovaniZastupitele> VolbyZastupitelu
}
}

public bool ZoNebereNaVedomi
{
get => !ZoBereNaVedomi;
}

public bool ZoBereNaVedomi
{
get => _zoBereNaVedomi;
Expand All @@ -71,6 +76,7 @@ public bool ZoBereNaVedomi

_zoBereNaVedomi = value;
OnPropertyChanged();
OnPropertyChanged(nameof(ZoNebereNaVedomi));
}
}

Expand Down
13 changes: 13 additions & 0 deletions ZZZO/ZZZO.Common/API/Zasedani.cs
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,19 @@ public static Zasedani GenerateSample()
PopisMista = "zasedací místnosti"
};

var schvaleniZapisovatele = new BodProgramu
{
Typ = BodProgramu.TypBoduProgramu.SchvaleniZapisOver,
Nadpis = "Schvalování zapisovatele"
};

zas.Program.BodyProgramu.Add(schvaleniZapisovatele);

zas.AddUsneseni(schvaleniZapisovatele, new Usneseni
{
Text = "Hlasování o zapisovateli/ověřovatelích"
});

var schvaleniProgramu = new BodProgramu
{
Typ = BodProgramu.TypBoduProgramu.SchvaleniProgramu,
Expand Down
31 changes: 27 additions & 4 deletions ZZZO/ZZZO.Common/Generators/GeneratorHtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,20 @@ private void GenerateBody(XmlElement html, Zasedani zas, IProgress<int> progress
}

BodProgramu schvaleniProgramu = zas.Program.BodyProgramu.FirstOrDefault(prog => prog.Typ == BodProgramu.TypBoduProgramu.SchvaleniProgramu);
BodProgramu schvaleniZapisovatele = zas.Program.BodyProgramu.FirstOrDefault(prog => prog.Typ == BodProgramu.TypBoduProgramu.SchvaleniZapisOver);


if (schvaleniProgramu?.Usneseni == null || schvaleniProgramu.Usneseni.Count == 0)
{
throw new Exception("v programu chybí bod a usnesení pro schválení programu jako takového");
}


if (schvaleniZapisovatele?.Usneseni == null || schvaleniZapisovatele.Usneseni.Count == 0)
{
throw new Exception("v programu chybí bod a usnesení pro schválení zapisovatele/ověřovatelů");
}

IEnumerable<BodProgramu> bodyProgramu = zas.Program.BodyProgramu.Where(prog => prog.Typ == BodProgramu.TypBoduProgramu.BodZasedani ||
prog.Typ == BodProgramu.TypBoduProgramu.DoplnenyBodZasedani);

Expand Down Expand Up @@ -180,11 +188,19 @@ private void GenerateBody(XmlElement html, Zasedani zas, IProgress<int> progress
body.AppendElem("h2").InnerText = "Určení ověřovatelů zápisu a zapisovatele v souladu s \u00a7 95 odst. 1 č. 128/2000 Sb.";

body.AppendElem("p").InnerText =
$"Řídící osoba zasedání ZO {zas.NazevObce} rozhodla, že zapisovatelem je " +
$"{zapisovatel.Jmeno} {zapisovatel.Prijmeni} a ověřovateli zápisu jsou {string.Join(
$"Řídící osoba zasedání ZO {zas.NazevObce} navrhla, aby zapisovatelem byl " +
$"{zapisovatel.Jmeno} {zapisovatel.Prijmeni} a ověřovateli zápisu byli {string.Join(
" a ",
overovatele.Select(over => over.Jmeno + " " + over.Prijmeni))}.";

GenerateResolution(
body,
zas,
schvaleniZapisovatele,
schvaleniZapisovatele.Usneseni.First(),
lastResolutionNumber,
"Hlasování o navrženém zapisovateli a ověřovatelích zápisu");

progress.Report(40);

///
Expand All @@ -194,11 +210,18 @@ private void GenerateBody(XmlElement html, Zasedani zas, IProgress<int> progress

GenerateProgramEntries(body, bodyProgramu.ToList());

body.AppendElem("p").InnerText = "Pan řídící navrhl schválit výše uvedený návrh programu. " +
body.AppendElem("p").InnerText = $"Řídící osoba zasedání ZO {zas.NazevObce} navrhla schválit výše " +
$"uvedený návrh programu. " +
$"Všechna hlasování na tomto zasedání ZO {zas.NazevObce} " +
"jsou veřejná a zastupitelé hlasují zdvižením ruky.";

GenerateResolution(body, zas, schvaleniProgramu, schvaleniProgramu.Usneseni.First(), lastResolutionNumber, "Hlasování o návrhu programu");
GenerateResolution(
body,
zas,
schvaleniProgramu,
schvaleniProgramu.Usneseni.First(),
lastResolutionNumber,
"Hlasování o návrhu programu");

progress.Report(50);

Expand Down
15 changes: 10 additions & 5 deletions ZZZO/ZZZO/Controls/ProgramEntry.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
</UserControl.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="5*" />
<ColumnDefinition Width="4*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<StackPanel Grid.Row="0"
Grid.Column="0"
Expand All @@ -33,10 +33,13 @@
<TextBox materialDesign:HintAssist.Hint="Nadpis bodu programu"
Height="75"
TextWrapping="Wrap"
Visibility="{Binding ProgramEntry.JeEditovatelny, Converter={StaticResource BooleanToVisibilityConverter}}"
Text="{Binding ProgramEntry.Nadpis, UpdateSourceTrigger=PropertyChanged}" />
<CheckBox Content="Podbod předchozího bodu programu"
<CheckBox Content="Jedná se o předchozího bodu programu"
Visibility="{Binding ProgramEntry.JeEditovatelny, Converter={StaticResource BooleanToVisibilityConverter}}"
IsChecked="{Binding ProgramEntry.JePodbod, UpdateSourceTrigger=PropertyChanged}" />
<GroupBox Header="Text bodu programu">
<GroupBox Header="Text bodu programu"
Visibility="{Binding ProgramEntry.JeEditovatelny, Converter={StaticResource BooleanToVisibilityConverter}}">
<local:TinyMceEditor Margin="-14 -14 0 0"
HtmlContent="{Binding ProgramEntry.Text, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
Height="400" />
Expand All @@ -49,18 +52,20 @@
<StackPanel Orientation="Vertical">
<WrapPanel Orientation="Horizontal">
<Button Command="{Binding AddUsneseniCmd}"
IsEnabled="{Binding ProgramEntry.JeEditovatelny}"
ToolTip="Přidat nové usnesení">
<materialDesign:PackIcon Kind="PlusCircle" />
</Button>
<Button ToolTip="Smazat vybrané usnesení"
IsEnabled="{Binding ProgramEntry.JeEditovatelny}"
Command="{Binding RemoveUsneseniCmd}">
<materialDesign:PackIcon Kind="MinusCircle" />
</Button>
</WrapPanel>
<ComboBox IsSynchronizedWithCurrentItem="True"
Name="CmbUsneseni"
SelectedValue="{Binding ChosenUsneseni, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
IsEnabled="{Binding ElementName=CmbUsneseni, Path=HasItems}"
IsEnabled="{Binding LzeEditovatUsneseni}"
ItemsSource="{Binding ProgramEntry.Usneseni}">
<ComboBox.ItemTemplate>
<DataTemplate>
Expand Down
12 changes: 7 additions & 5 deletions ZZZO/ZZZO/Controls/Resolution.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,18 @@
</Style>
</UserControl.Resources>
<StackPanel Orientation="Vertical">
<CheckBox Name="CbBereNaVedomi"
Content="ZO bere na vědomí"
IsChecked="{Binding Usneseni.ZoBereNaVedomi, UpdateSourceTrigger=PropertyChanged}" />
<TextBox materialDesign:HintAssist.Hint="Text usnesení"
MinLines="4"
TextWrapping="Wrap"
AcceptsReturn="True"
IsEnabled="{Binding ElementName=CbBereNaVedomi, Path=IsChecked, Converter={StaticResource CollapseOnTrueConverter}}"
IsEnabled="{Binding JeEditovatelne}"
Text="{Binding Usneseni.Text, UpdateSourceTrigger=PropertyChanged}" />
<GroupBox Header="Hlasování">
<CheckBox Name="CbBereNaVedomi"
Content="ZO bere na vědomí"
IsEnabled="{Binding ProgramEntry.JeEditovatelny}"
IsChecked="{Binding Usneseni.ZoBereNaVedomi, UpdateSourceTrigger=PropertyChanged}" />
<GroupBox Header="Hlasování"
Visibility="{Binding Usneseni.ZoNebereNaVedomi, Converter={StaticResource BooleanToVisibilityConverter}}">
<WrapPanel Orientation="Vertical">
<DataGrid materialDesign:DataGridAssist.CellPadding="4 2 2 2"
materialDesign:DataGridAssist.ColumnHeaderPadding="4 2 2 2"
Expand Down
23 changes: 23 additions & 0 deletions ZZZO/ZZZO/ViewModels/ProgramEntryViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ public IEnumerable<BodProgramu.TypBoduProgramu> TypyBoduProgramu
get => Enum.GetValues<BodProgramu.TypBoduProgramu>();
}

public bool LzeEditovatUsneseni
{
get => _programEntry != null && _programEntry.JeEditovatelny && _programEntry.Usneseni.Count > 0;
}

public Usneseni ChosenUsneseni
{
get => _chosenUsneseni;
Expand All @@ -54,6 +59,7 @@ public Usneseni ChosenUsneseni

_chosenUsneseni = value;

ResolutionViewModel.ProgramEntry = _programEntry;
ResolutionViewModel.Usneseni = _chosenUsneseni;

OnPropertyChanged();
Expand Down Expand Up @@ -86,6 +92,23 @@ public BodProgramu ProgramEntry
}

_programEntry = value;

if (_programEntry != null && _programEntry.Usneseni != null)
{
_programEntry.PropertyChanged += (sender, args) =>
{
if (args.PropertyName == nameof(BodProgramu.JeEditovatelny))
{
OnPropertyChanged(nameof(LzeEditovatUsneseni));
}
};

_programEntry.Usneseni.CollectionChanged += (sender, args) =>
{
OnPropertyChanged(nameof(LzeEditovatUsneseni));
};
}

OnPropertyChanged();
}
}
Expand Down
33 changes: 32 additions & 1 deletion ZZZO/ZZZO/ViewModels/ResolutionViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ public ICommand AllDisagreeCmd
get;
}

public bool JeEditovatelne
{
get => ProgramEntry != null && ProgramEntry.JeEditovatelny &&
(Usneseni == null || !Usneseni.ZoBereNaVedomi);
}

public Usneseni Usneseni
{
get => _usneseni;
Expand All @@ -37,7 +43,20 @@ public Usneseni Usneseni
}

_usneseni = value;

if (_usneseni != null)
{
_usneseni.PropertyChanged += (sender, args) =>
{
if (args.PropertyName == nameof(Usneseni.ZoBereNaVedomi))
{
OnPropertyChanged(nameof(JeEditovatelne));
}
};
}

OnPropertyChanged();
OnPropertyChanged(nameof(JeEditovatelne));
}
}

Expand Down Expand Up @@ -67,7 +86,20 @@ public BodProgramu ProgramEntry
}

_programEntry = value;

if (_programEntry != null)
{
_programEntry.PropertyChanged += (sender, args) =>
{
if (args.PropertyName == nameof(BodProgramu.Typ))
{
OnPropertyChanged(nameof(JeEditovatelne));
}
};
}

OnPropertyChanged();
OnPropertyChanged(nameof(JeEditovatelne));
}
}

Expand All @@ -78,7 +110,6 @@ public BodProgramu ProgramEntry
public ResolutionViewModel(ZzzoCore core)
{
Core = core;


AllAgreeCmd = new RelayCommand(obj => MarkAllAgreed(), obj => Usneseni != null);
AllDisagreeCmd = new RelayCommand(obj => MarkAllDisagreed(), obj => Usneseni != null);
Expand Down
4 changes: 4 additions & 0 deletions resources/styles/svésedlice.css
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ h1, h2, h3, h4, h5, h6 {
height: 1em;
}

.resolution-text {
font-weight: 600;
}

.resolution-success-icon {
color: var(--success-color);
}
Expand Down

0 comments on commit 60e6269

Please sign in to comment.