/// <summary> /// Creates the child controls. /// </summary> /// <returns></returns> public override Control[] CreateChildControls(Type entityType, FilterField filterControl) { AccountPicker accountPicker = new AccountPicker(); accountPicker.AllowMultiSelect = true; accountPicker.ID = filterControl.ID + "_accountPicker"; accountPicker.Label = "Accounts"; filterControl.Controls.Add(accountPicker); SlidingDateRangePicker slidingDateRangePicker = new SlidingDateRangePicker(); slidingDateRangePicker.ID = filterControl.ID + "_slidingDateRangePicker"; slidingDateRangePicker.AddCssClass("js-sliding-date-range"); slidingDateRangePicker.Label = "Date Range"; slidingDateRangePicker.Help = "The date range of the transactions using the 'Sunday Date' of each transaction"; slidingDateRangePicker.Required = true; filterControl.Controls.Add(slidingDateRangePicker); RockCheckBox cbUseSundayDate = new RockCheckBox(); cbUseSundayDate.ID = filterControl.ID + "_cbUseSundayDate"; cbUseSundayDate.Label = "Use Sunday Date"; cbUseSundayDate.Help = "Use the Sunday Date instead of the actual transaction date."; cbUseSundayDate.AddCssClass("js-use-sunday-date"); filterControl.Controls.Add(cbUseSundayDate); var controls = new Control[3] { accountPicker, slidingDateRangePicker, cbUseSundayDate }; return(controls); }
/// <summary> /// Creates the child controls. /// </summary> /// <returns></returns> public override Control[] CreateChildControls(Type entityType, FilterField filterControl) { var gtpGroupType = new GroupTypePicker(); gtpGroupType.ID = filterControl.ID + "_0"; gtpGroupType.AddCssClass("js-group-type"); filterControl.Controls.Add(gtpGroupType); gtpGroupType.UseGuidAsValue = true; gtpGroupType.IsSortedByName = true; gtpGroupType.GroupTypes = new GroupTypeService(new RockContext()).Queryable().ToList(); var cbChildGroupTypes = new RockCheckBox(); cbChildGroupTypes.ID = filterControl.ID + "_cbChildGroupTypes"; cbChildGroupTypes.AddCssClass("js-child-group-types"); cbChildGroupTypes.Text = "Include Child Group Types(s)"; filterControl.Controls.Add(cbChildGroupTypes); var ddlIntegerCompare = ComparisonHelper.ComparisonControl(ComparisonHelper.NumericFilterComparisonTypes); ddlIntegerCompare.Label = "Attendance Count"; ddlIntegerCompare.ID = filterControl.ID + "_ddlIntegerCompare"; ddlIntegerCompare.AddCssClass("js-filter-compare"); filterControl.Controls.Add(ddlIntegerCompare); var tbAttendedCount = new RockTextBox(); tbAttendedCount.ID = filterControl.ID + "_2"; tbAttendedCount.Label = " "; // give it whitespace label so it lines up nicely tbAttendedCount.AddCssClass("js-attended-count"); filterControl.Controls.Add(tbAttendedCount); var slidingDateRangePicker = new SlidingDateRangePicker(); slidingDateRangePicker.Label = "Date Range"; slidingDateRangePicker.ID = filterControl.ID + "_slidingDateRangePicker"; slidingDateRangePicker.AddCssClass("js-sliding-date-range"); filterControl.Controls.Add(slidingDateRangePicker); var controls = new Control[5] { gtpGroupType, cbChildGroupTypes, ddlIntegerCompare, tbAttendedCount, slidingDateRangePicker }; // convert pipe to comma delimited var defaultDelimitedValues = slidingDateRangePicker.DelimitedValues.Replace("|", ","); var defaultCount = 4; // set the default values in case this is a newly added filter SetSelection( entityType, controls, string.Format("{0}|{1}|{2}|{3}|false", gtpGroupType.Items.Count > 0 ? gtpGroupType.Items[0].Value : "0", ComparisonType.GreaterThanOrEqualTo.ConvertToInt().ToString(), defaultCount, defaultDelimitedValues)); return(controls); }
/// <summary> /// Creates the child controls. /// </summary> /// <returns></returns> public override Control[] CreateChildControls(Type entityType, FilterField filterControl) { var pGroupPicker = new GroupPicker(); pGroupPicker.AllowMultiSelect = true; pGroupPicker.ID = filterControl.ID + "_pGroupPicker"; pGroupPicker.AddCssClass("js-group-picker"); filterControl.Controls.Add(pGroupPicker); var cbChildGroups = new RockCheckBox(); cbChildGroups.ID = filterControl.ID + "_cbChildGroups"; cbChildGroups.AddCssClass("js-child-groups"); cbChildGroups.Text = "Include Child Groups"; filterControl.Controls.Add(cbChildGroups); var ddlIntegerCompare = ComparisonHelper.ComparisonControl(ComparisonHelper.NumericFilterComparisonTypes); ddlIntegerCompare.Label = "Attendance Count"; ddlIntegerCompare.ID = filterControl.ID + "_ddlIntegerCompare"; ddlIntegerCompare.AddCssClass("js-filter-compare"); filterControl.Controls.Add(ddlIntegerCompare); var tbAttendedCount = new RockTextBox(); tbAttendedCount.ID = filterControl.ID + "_2"; tbAttendedCount.Label = " "; // give it whitespace label so it lines up nicely tbAttendedCount.AddCssClass("js-attended-count"); filterControl.Controls.Add(tbAttendedCount); var slidingDateRangePicker = new SlidingDateRangePicker(); slidingDateRangePicker.Label = "Date Range"; slidingDateRangePicker.ID = filterControl.ID + "_slidingDateRangePicker"; slidingDateRangePicker.AddCssClass("js-sliding-date-range"); filterControl.Controls.Add(slidingDateRangePicker); var controls = new Control[5] { pGroupPicker, cbChildGroups, ddlIntegerCompare, tbAttendedCount, slidingDateRangePicker }; // convert pipe to comma delimited var defaultDelimitedValues = slidingDateRangePicker.DelimitedValues.Replace("|", ","); var defaultCount = 4; // set the default values in case this is a newly added filter SetSelection( entityType, controls, string.Format("{0}|{1}|{2}|{3}|false", string.Empty, ComparisonType.GreaterThanOrEqualTo.ConvertToInt().ToString(), defaultCount, defaultDelimitedValues)); return(controls); }
/// <summary> /// Creates the child controls. /// </summary> /// <returns></returns> public override Control[] CreateChildControls(Type entityType, FilterField filterControl) { var pGroupPicker = new GroupPicker(); pGroupPicker.AllowMultiSelect = true; pGroupPicker.ID = $"{filterControl.ID}_{nameof( pGroupPicker )}"; pGroupPicker.AddCssClass("js-group-picker"); filterControl.Controls.Add(pGroupPicker); var cbChildGroups = new RockCheckBox(); cbChildGroups.ID = $"{filterControl.ID}_{nameof( cbChildGroups )}"; cbChildGroups.AddCssClass("js-child-groups"); cbChildGroups.Text = "Include Child Groups"; filterControl.Controls.Add(cbChildGroups); var ddlIntegerCompare = ComparisonHelper.ComparisonControl(ComparisonHelper.NumericFilterComparisonTypes); ddlIntegerCompare.Label = "Attendance Count"; ddlIntegerCompare.ID = $"{filterControl.ID}_{nameof( ddlIntegerCompare )}"; ddlIntegerCompare.AddCssClass("js-filter-compare"); filterControl.Controls.Add(ddlIntegerCompare); var tbAttendedCount = new RockTextBox(); tbAttendedCount.ID = $"{filterControl.ID}_{nameof( tbAttendedCount )}"; tbAttendedCount.Label = " "; // give it whitespace label so it lines up nicely tbAttendedCount.AddCssClass("js-attended-count"); filterControl.Controls.Add(tbAttendedCount); var slidingDateRangePicker = new SlidingDateRangePicker(); slidingDateRangePicker.Label = "Date Range"; slidingDateRangePicker.ID = $"{filterControl.ID}_{nameof( slidingDateRangePicker )}"; slidingDateRangePicker.AddCssClass("js-sliding-date-range"); filterControl.Controls.Add(slidingDateRangePicker); var schedulePicker = new SchedulePicker(); schedulePicker.Label = "Schedules"; schedulePicker.ID = $"{filterControl.ID}_{nameof( schedulePicker )}"; schedulePicker.AddCssClass("js-schedule-picker"); schedulePicker.AllowMultiSelect = true; filterControl.Controls.Add(schedulePicker); var controls = new Control[6] { pGroupPicker, cbChildGroups, ddlIntegerCompare, tbAttendedCount, slidingDateRangePicker, schedulePicker }; var defaultGroupAttendanceFilterSelection = new GroupAttendanceFilterSelection { IntegerCompare = ComparisonType.GreaterThanOrEqualTo.ConvertToInt().ToString(), AttendedCount = 4, SlidingDateRange = slidingDateRangePicker.DelimitedValues, IncludeChildGroups = false, }; // set the default values in case this is a newly added filter SetSelection( entityType, controls, defaultGroupAttendanceFilterSelection.ToJson()); return(controls); }