kreta/KretaWeb/Areas/Adminisztracio/Views/SystemSettings/SystemSettingsPanelBar.cshtml
2024-03-13 00:33:46 +01:00

111 lines
6.9 KiB
Text

@using Kreta.Web.Models.EditorTemplates
@using Kreta.BusinessLogic.Helpers.SystemSettings
@using Kreta.Enums;
@using Kreta.KretaServer.SystemSettings.SettingsTypes
@model PanelBarChildModel
<table>
@foreach (var item in Model.Data)
{
SystemSettingControlInfo setting = (SystemSettingControlInfo)item;
if (setting.Control == null) { continue; }
SystemSettingsControlTypeEnum controlType = setting.ControlType;
var controlId = ((SettingsControlBase)setting.Control).Id;
<tr style="padding: 10px;" @if (setting.Disabled) { Write("class=disabledItem"); }>
<td width="15%" style="padding: 10px; font-weight:bold">
<label for="@controlId">@setting.Title</label>
</td>
<td width="65%" style="padding: 10px">@setting.Description</td>
<td width="20%" style="padding: 10px">
@switch (controlType)
{
//case SystemSettingsControlTypeEnum.CheckBox:
// var checkBox = (SettingsCheckBox)setting.Control;
// Html.KretaCheckBox(checkBox.Id, StringResourcesUtils.GetString(checkBox.StringResourcesID), checkBox.IsSelected);
// break;
case SystemSettingsControlTypeEnum.CheckBoxGroup:
var checkBoxGroup = (SettingsCheckBoxGroup)setting.Control;
@Html.KretaCheckBoxList(checkBoxGroup.Id, checkBoxGroup.Options)
break;
case SystemSettingsControlTypeEnum.MultiSelect:
var multiSelect = (SettingsMultiSelect)setting.Control;
if (controlId == RendszerBeallitasTipusEnum.lezart_osztalynaplok.ToString())
{
@Html.KretaMultiSelect(multiSelect.Id, multiSelect.Options, isSingleElementSet: false)
}
else
{
@Html.KretaMultiSelect(multiSelect.Id, multiSelect.Options)
}
break;
case SystemSettingsControlTypeEnum.DatePicker:
var datePicker = (SettingsDatePicker)setting.Control;
@Html.KretaDatePicker(datePicker.Id, minValue: datePicker.Min, maxValue: datePicker.Max).Value(datePicker.Date).RenderWithMask()
break;
case SystemSettingsControlTypeEnum.TimePicker:
var timePicker = (SettingsTimePicker)setting.Control;
@Html.KretaTimePicker(timePicker.Id, interval: 15).Value(timePicker.Time).RenderWithMask()
break;
case SystemSettingsControlTypeEnum.NumericTextBox:
var numericTextBox = (SettingsNumericTextBox)setting.Control;
//TODO: ennél majd szebb megoldás kell, pl: SystemsPercentageTextBox
if (controlId == RendszerBeallitasTipusEnum.Szakszeru_helyettesites_eseten_az_elszamolt_oraszam.ToString() ||
controlId == RendszerBeallitasTipusEnum.Nem_szakszeru_felugyelet_helyettesites_eseten_az_elszamolt_oraszam.ToString() ||
controlId == RendszerBeallitasTipusEnum.Oraosszevonasos_helyettesites_eseten_az_elszamolt_oraszam.ToString()
)
{
@Html.KretaNumeric(numericTextBox.Id).Format("p0").Min(0).Max(1).Step(0.01).Value(numericTextBox.Value)
}
else if (controlId == RendszerBeallitasTipusEnum.Naplozaras_heti_ertek.ToString())
{
@Html.KretaNumeric(numericTextBox.Id).Value(numericTextBox.Value).Min(0).Max(7).Step(1).Format("n0");
}
else if (controlId == RendszerBeallitasTipusEnum.Naplozaras_havi_ertek.ToString())
{
@Html.KretaNumeric(numericTextBox.Id).Value(numericTextBox.Value).Min(0).Max(31).Step(1).Format("n0");
}
else if (controlId == RendszerBeallitasTipusEnum.Ervenyes_tanitasi_nap_oraszam.ToString())
{
@Html.KretaNumeric(numericTextBox.Id).Value(numericTextBox.Value).Min(0).Max(24).Step(1).Format("n0");
}
else if ((controlId == RendszerBeallitasTipusEnum.Szakszeru_helyettesites_Szazalekos_Ertek_Osszegbe.ToString()) || (controlId == RendszerBeallitasTipusEnum.Nem_Szakszeru_Helyettesites_Szazalekos_Ertek_Osszegbe.ToString()) || (controlId == RendszerBeallitasTipusEnum.Oraosszevonas_Szazalekos_Ertek_Osszegbe.ToString()) || (controlId == RendszerBeallitasTipusEnum.Osszevont_Felugyelet_Szazalekos_Ertek_Osszegbe.ToString()))
{
@Html.KretaNumeric(numericTextBox.Id).Value(numericTextBox.Value).Min(0).Max(100).Step(1).Format("n0");
}
else if (controlId == RendszerBeallitasTipusEnum.Bukas_Veszelyre_Figyelmeztetes_Hatara.ToString())
{
@Html.KretaNumeric(numericTextBox.Id).Value(numericTextBox.Value).Min(1.00).Max(2.50).Step(0.01).Format("n2");
}
else if (controlId == RendszerBeallitasTipusEnum.Egy_statuszra_juto_kotelezo_oraszam.ToString())
{
@Html.KretaNumeric(numericTextBox.Id).Value(numericTextBox.Value).Min(0.00).Max(40).Step(0.01).Format("n2");
}
else
{
@Html.KretaNumeric(numericTextBox.Id).Value(numericTextBox.Value).Step(1);
}
break;
case SystemSettingsControlTypeEnum.DropDownList:
var dropDownList = (SettingsDropDownList)setting.Control;
@Html.KretaDropdownList(dropDownList.Id, dropDownList.Options);
break;
case SystemSettingsControlTypeEnum.RadioButtonGroup:
var radioButtonGroup = (SettingsRadioButtonGroup)setting.Control;
@Html.KretaRadioButtonList(radioButtonGroup.Id, radioButtonGroup.Options)
break;
case SystemSettingsControlTypeEnum.TrueFalse:
var switchButton = (SettingsSwitchButton)setting.Control;
<div style="padding-left:80px;">
@Html.KretaSwitchButton(switchButton.Id, switchButton.Value)
</div>
break;
default:
break;
}
</td>
</tr>
}
</table>