Skip to content

Commit 4e9a455

Browse files
committed
add filters
1 parent dade8c6 commit 4e9a455

File tree

5 files changed

+73
-25
lines changed

5 files changed

+73
-25
lines changed

src/aura/calendar/calendar.cmp

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,40 @@
11
<aura:component controller="CampaignCalendar" implements="force:appHostable,flexipage:availableForAllPageTypes">
22
<ltng:require
3-
styles="/resource/Fullcalendar/2.6.0/fullcalendar.min.css
4-
,/resource/Fullcalendar/jquery.qtip.css"
3+
styles="/resource/Fullcalendar/2.6.0/fullcalendar.min.css,
4+
/resource/Fullcalendar/jquery.qtip.css,
5+
/resource/Fullcalendar/select2.css"
56
scripts="/resource/Fullcalendar/2.6.0/lib/jquery.min.js,
67
/resource/Fullcalendar/2.6.0/lib/jquery-ui.custom.min.js,
78
/resource/Fullcalendar/2.6.0/lib/moment.min.js,
89
/resource/Fullcalendar/2.6.0/fullcalendar.min.js,
910
/resource/Fullcalendar/jquery.qtip.js,
10-
/resource/Fullcalendar/jsrender.js"
11+
/resource/Fullcalendar/jsrender.js,
12+
/resource/Fullcalendar/select2.js"
1113
afterScriptsLoaded="{!c.doInit}" />
1214

13-
<aura:attribute name="campaignObj" type="Campaign" default="{ sobjectType: 'Campaign' }"/>
14-
15+
<aura:attribute name="campaignObj" type="Campaign" default="{ sobjectType: 'Campaign' }"/>
16+
<div>
1517
<div class="filterBox">
1618
<span class="filterBoxTitle">FILTERS</span>
1719
<div style="margin-top:5px;padding:10px;">
18-
<b class="label">Parent Campaign</b>
19-
<select id="parentCampaign" class="combo" style="min-width:240px">
20-
<aura:iteration items="{!v.parentCampaigns}" var="p">
21-
<option value="{!p.Id}">{!p.Name}</option>
22-
</aura:iteration>
23-
</select>
24-
<b class="label">Campaign Type</b>
25-
<force:inputField value="{!v.campaignObj.Type}" />
20+
<div id="filter-elem-1">
21+
<b class="label">Parent Campaign</b>
22+
<div class="filter">
23+
<select id="parentCampaign" class="combo" style="min-width:240px">
24+
<option value="--None--">--None--</option>
25+
<aura:iteration items="{!v.parentCampaigns}" var="p">
26+
<option value="{!p.Id}">{!p.Name}</option>
27+
</aura:iteration>
28+
</select>
29+
</div>
30+
</div>
31+
<div id="filter-elem-2">
32+
<b class="label">Campaign Type</b>
33+
<div class="filter">
34+
<force:inputField value="{!v.campaignObj.Type}" />
35+
</div>
36+
</div>
37+
<div style="clear:both"/>
2638
</div>
2739
</div>
2840
<div style="clear:both"/>
@@ -47,4 +59,5 @@
4759
</aura:iteration>
4860
</table>
4961
</div>
62+
</div>
5063
</aura:component>

src/aura/calendar/calendar.css

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,41 @@
2626

2727
}
2828

29+
.THIS .uiInputSelect{
30+
display: inline-block;
31+
}
32+
2933
.THIS .filterBoxTitle{
3034
position:absolute;
3135
color:#808080;
3236
font-weight:bold;
33-
37+
font-size: 12px;
3438
}
3539

3640
.THIS .label{
3741
margin-left:8px;
42+
font-size: 13px;
43+
margin-right:5px;
3844
}
3945

4046
.THIS .combo{
4147
margin-left:4px;
4248
}
49+
50+
.THIS .filter{
51+
float:right;
52+
}
53+
54+
.THIS #filter-elem-1{
55+
float:left;
56+
}
57+
58+
.THIS #filter-elem-2{
59+
float:right;
60+
}
61+
62+
@media all and (max-width: 980px) {
63+
.THIS #filter-elem-2{
64+
display: block;;
65+
}
66+
}
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
({
22
doInit : function(component, event, helper) {
33
helper.doInit(helper,component);
4+
},
5+
reload :function(component, event, helper){
6+
console.log('reloading');
7+
helper.load(component,helper);
48
}
5-
})
9+
})

src/aura/calendar/calendarHelper.js

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
({
22
doInit : function(helper,component) {
3+
var me = this;
34
helper.getParentCampaigns(component);
45
helper.describeFieldSet("MarketingCalendarPopup",component,function(r){
56
component.set('v.MarketingCalendarPopupFields',r.getReturnValue());
6-
helper.load(helper,component);
7-
$('.forceInputPicklist select').removeAttr('disabled');
7+
helper.load(helper,component,"","");
8+
$('.forceInputPicklist select').removeAttr('disabled');
9+
$('select').select2({width: 'resolve'}).on('change',function(){
10+
helper.load(helper,component,$('#parentCampaign').val(),$('.forceInputPicklist select').val());
11+
});
812
});
913
},
10-
load : function(helper,component){
11-
helper.fetchCalendarData(helper,component,function(response){
14+
load : function(helper,component,parentCampaignId,type){
15+
helper.fetchCalendarData(helper,component,parentCampaignId,type,function(response){
1216
if (response.getState() === "SUCCESS") {
1317
//component.set('v.campaigns',response.getReturnValue());
1418
helper.initCalendar(helper,helper.parseEnteries(response.getReturnValue()));
@@ -19,10 +23,12 @@
1923
}
2024
})
2125
},
22-
fetchCalendarData : function(helper,component,cb){
26+
fetchCalendarData : function(helper,component,parentCampaignId,type,cb){
27+
parentCampaignId = (parentCampaignId == '--None--' ? '' : parentCampaignId);
28+
type = (type == '--None--' ? '' : type);
2329
var action = component.get("c.getCalendarEntryAura");
24-
action.setParams({"parentCampaignId":"","type" : ""});
25-
action.setCallback(this,cb);
30+
action.setParams({"parentCampaignId":parentCampaignId,"type" : type});
31+
action.setCallback(helper,cb);
2632
$A.enqueueAction(action);
2733
},
2834
describeFieldSet : function(fs,component,cb){
@@ -50,6 +56,7 @@
5056
return results;
5157
},
5258
initCalendar : function(helper,calendarEntries){
59+
console.log(calendarEntries);
5360
$('#calendarX').empty();
5461
$('#calendarX').fullCalendar({
5562
editable: false,
@@ -88,12 +95,13 @@
8895
}
8996
},
9097
parseErrors : function(errorObj){
98+
console.log('error',errorObj);
9199
var error = [];
92100
for(var i = 0; i < errorObj.length > 0; i ++){
93101
if(errorObj[i].pageErrors){
94102
error = error.concat(errorObj[i].pageErrors);
95103
}
96-
console.log('error',error);
104+
97105
if(errorObj[i].fieldErrors){
98106
for(f in errorObj[i].fieldErrors){
99107
error = errorObj[i].fieldErrors[f].concat(errorObj[i].pageErrors);
@@ -111,7 +119,6 @@
111119
var action = component.get("c.getActiveParentCampaignObjects");
112120
action.setParams({});
113121
action.setCallback(this,function(response){
114-
console.log(response,response.getReturnValue());
115122
component.set("v.parentCampaigns",response.getReturnValue());
116123
});
117124
$A.enqueueAction(action);

src/classes/CampaignCalendar.cls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public with sharing class CampaignCalendar {
104104
}
105105

106106
@AuraEnabled
107-
public List<Campaign> getActiveParentCampaignObjects(){
107+
public static List<Campaign> getActiveParentCampaignObjects(){
108108
Set<Id> campaignSet = new Set<Id>();
109109
for(AggregateResult ar : [
110110
SELECT ParentId,Count(Id)recordCount

0 commit comments

Comments
 (0)