protected override void ProcessCore(TagHelperContext context, TagHelperOutput output) { if (For != null) { TargetInputSelector = "#" + HtmlHelper.GenerateIdFromName(For.Name); } var options = new { entityType = EntityType, url = UrlHelper.Action("Picker", "Entity", new { area = string.Empty }), caption = (DialogTitle.NullEmpty() ?? Caption).HtmlEncode(), disableIf = DisableGroupedProducts ? "groupedproduct" : (DisableBundleProducts ? "notsimpleproduct" : null), disableIds = DisabledEntityIds == null ? null : string.Join(',', DisabledEntityIds), thumbZoomer = EnableThumbZoomer, highligtSearchTerm = HighlightSearchTerm, returnField = FieldName, delim = Delimiter, targetInput = TargetInputSelector, selected = Selected, appendMode = AppendMode, maxItems = MaxItems, onDialogLoading = OnDialogLoadingHandler, onDialogLoaded = OnDialogLoadedHandler, onSelectionCompleted = OnSelectionCompletedHandler }; var buttonId = "entpicker-toggle-" + CommonHelper.GenerateRandomInteger(); output.TagName = "button"; output.TagMode = TagMode.StartTagAndEndTag; output.MergeAttribute("id", buttonId); output.MergeAttribute("type", "button"); output.AppendCssClass("btn btn-secondary"); if (IconCssClass.HasValue()) { output.Content.AppendHtml($"<i class='{ IconCssClass }'></i>"); } if (Caption.HasValue()) { output.Content.AppendHtml($"<span>{ Caption }</span>"); } var json = JsonConvert.SerializeObject(options, new JsonSerializerSettings { ContractResolver = SmartContractResolver.Instance, Formatting = Formatting.None, NullValueHandling = NullValueHandling.Ignore }); output.PostElement.AppendHtmlLine(@$ "<script data-origin='EntityPicker'>$(function() {{ $('#{buttonId}').entityPicker({json}); }})</script>"); }
public void Include(DialogTitle title) { title = new DialogTitle(null); title = new DialogTitle(null, null); title = new DialogTitle(null, null, 0); }
private DialogSourceViewModel GetTimerFormModel() { var result = new DialogSourceViewModel { PanelCaption = DialogTitle.Get(_context), FontSize = FontSize.Get(_context), IsMenuVisible = false, }; var footerMenu = new List <ValueDataField>(); var menuNext = new ValueDataField { Name = "Menu0", Caption = "Далее", Value = Key.Enter.ToString() }; menuNext.Set(ValueDataFieldConstants.Row, 0); menuNext.Set(ValueDataFieldConstants.Column, 1); footerMenu.Add(menuNext); ValueDataField field; var message = Message.Get(_context); if (!string.IsNullOrEmpty(message)) { field = new ValueDataField { Name = "txtMessage", FieldType = typeof(string), LabelPosition = "None", IsEnabled = false, Value = message }; field.FieldName = field.Name; field.SourceName = field.Name; result.Fields.Add(field); } var dateFrom = DateFrom.Get(_context); if (dateFrom.HasValue) { field = new ValueDataField { Name = "dtDateFrom", Caption = "С", FieldType = typeof(DateTime), LabelPosition = "Left", Value = dateFrom.Value, DisplayFormat = DefaultDateTimeFormat, IsEnabled = false, SetFocus = false, CloseDialog = false }; field.FieldName = field.Name; field.SourceName = field.Name; result.Fields.Add(field); } var timevalue = TimeSpan.FromSeconds(dateFrom.HasValue ? (DateTime.Now - dateFrom.Value).TotalSeconds - TimerOffset.Get(_context) : 0); field = new ValueDataField { Name = TimerFieldName, Caption = "Таймер", FieldType = typeof(TimeSpan), LabelPosition = "Left", DisplayFormat = "hh\\:mm\\:ss", Value = timevalue, IsEnabled = false, SetFocus = false, CloseDialog = false }; field.FieldName = field.Name; field.SourceName = field.Name; result.Fields.Add(field); var fieldFooterMenu = new ValueDataField { Name = "footerMenu", FieldType = typeof(IFooterMenu) }; fieldFooterMenu.FieldName = fieldFooterMenu.Name; fieldFooterMenu.SourceName = fieldFooterMenu.Name; fieldFooterMenu.Properties["FooterMenu"] = footerMenu.ToArray(); result.Fields.Add(fieldFooterMenu); result.UpdateSource(); return(result); }