This report generates photo directories with household photos, and custom listing preferences for member contact info. It can also display asterisks beside non-members. It requires several of custom fields, which are described in the notes at the top of the code. If you want to create a PDF for this report, you must generate it as HTML, and then convert to PDF. This is because of the way Planning Center's PDF generator handles (or doesn't handle) image files in custom tabs.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 | <!-- If you want to create a PDF for this report, you must generate it as HTML, and then convert to PDF. This is because of the way Planning Center's PDF generator handles (or doesn't handle) image files in custom tabs. This photo directory report assumes several custom fields are configured - primary_contact.custom_tabs.communication_preferences.household_photo -- This is where you upload a household photo to the primary contact. -- It should be square (300 to 600px work well) JPEG. If no household -- photo exists, it will use the primary contact's avatar. If neither exist, -- it will show a gray square. - primary_contact.custom_tabs.communication_preferences.hide_household_photo -- Dropdown with single option: "Hide". -- This hides both the household and individual photo from the directory, -- even if they exist. Display a gray square instead. - primary_contact.custom_tabs.communication_preferences.listed_address -- Check-boxes with three options: "Home", "Work", "Other" -- This controls which addresses are listed for the household. Mailing -- addresses are only checked for the primary contact. - person.custom_tabs.communication_preferences.listed_phone -- Check-boxes with three options: "Home", "Mobile", "Work" -- This controls which phone numbers are listed for each adult. Home phone -- numbers are only checked for the primary contact. - person.custom_tabs.communication_preferences.listed_email -- Check-boxes with two options: "Home", "Work" -- This controls which emails are listed for each adult. - person.custom_tabs.communication_preferences.directory_inclusion -- Dropdown with single option: "Force Exclude". (You may also add a -- "Force Include" option for use in list creation.) This will prevent -- individuals from showing up in the directory, even if their household -- appears on your list. This report works best with be two adults per household. Adult children should be accounted for, but the report has not been well tested in these scenarios. Contact info is never listed for children. (If you want this listed, you can change the for-loop to include all household members.) This report can also add asterisks based on membership status. You can disable this below if you do not want any asterisks. {% assign showAsterisks = false %} Which membership types should be printed without asterisks? List membership types, separated by commas. {% capture membershipTypes -%} Member,Active Participant {%- endcapture %} {% assign membershipTypes = membershipTypes | split: ',' %} --> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <link href="https://fonts.googleapis.com/css?family=Open+Sans+Condensed:300,700|Open+Sans:400,700&display=swap" rel="stylesheet"> <style> html, * {font-family: "Open Sans", sans-serif; line-height:1.4em;} @page {margin: .5in 0;} /*-- PDF margin reset --*/ body {margin: 0;} /*-- Fonts --*/ .adults {font-size: 12pt; font-weight: bold;} .children {font-size: 12pt; font-weight: normal;} .contacts li {font-size: 10.5pt;} /*-- Layout --*/ .avatar {width: 172px; max-height: 258px; border-radius: 10%; overflow: hidden;} .avatar > img {width: 100%; display: block;} .avatar-noimg {background: #ddd; width: 172px; height: 172px; border-radius: 10%; overflow: hidden;} ul {list-style-type: none; display:block; vertical-align:middle; margin:0; padding:0;} .household-item {display: inline-block; width: 172px; vertical-align: top; padding: .5em; page-break-inside: avoid;} li.email {overflow-wrap: break-word; word-wrap: break-word;} /*-- allows long emails to break into multiple lines --*/ @media screen { /*----- The wrapper class controls the preview frame in the HTML generated report. ----*/ /*----- Portrait view = max-width: 720px ----*/ .wrapper {padding: 1.5em; border: 1px solid rgb(204,204,204); margin:1.5em auto; max-width:766px;} } @media print { .no-print {display: none;} body {margin: .25in;} /*----- Adjust this to change the page margins for printing ----*/ } </style> </head> <body> <div class="wrapper"> <div class="main"> {% for household in households %} <div class="household-item"> {% assign sameLast = false %} {% assign lastname = 'nolastname'%} {% assign coupleString = '' %} {% assign adultsString = '' %} {% assign childrenString = '' %} {% assign finalString = '' %} {% assign coupleArray = '' | split: '::' %} {% assign adultsArray = '' | split: '::' %} {% assign childrenArray = '' | split: '::' %} {% assign lastNameArray = '' | split: '::' %} <!-- Check if married adults share a last name --> {% for person in household.adults %} {% assign addArray = '' | split: '::' %} {% if person.active and person.marital_status == 'Married' %} {% assign addArray = person.last_name | split: '::' %} {% assign lastNameArray = lastNameArray | concat: addArray %} {% endif %} {% assign lastNameArray = lastNameArray | uniq %} {% endfor %} {% if lastNameArray.size <= 1 %} {% assign sameLast = true %} {% endif %} <!-- Find adults and add to appropriate array --> <!-- Primary contact --> {% for person in household.adults %} {% assign addArray = '' | split: '::' %} {% assign nameArray = '' | split: '::' %} {% if household.primary_contact.id == person.id and person.active %} {% assign addArray = person.name_prefix | split: '::' %} {% assign nameArray = nameArray | concat: addArray %} {% assign addArray = person.first_name | split: '::' %} {% assign nameArray = nameArray | concat: addArray %} {% if sameLast and person.marital_status == 'Married' %} {% assign addArray = person.name_suffix | split: '::' %} {% assign nameArray = nameArray | concat: addArray %} {% endif %} {% unless sameLast and person.marital_status == 'Married' %} {% assign addArray = person.last_name | split: '::' %} {% assign nameArray = nameArray | concat: addArray %} {% assign addArray = person.name_suffix | split: '::' %} {% assign nameArray = nameArray | concat: addArray %} {% endunless %} <!-- Append non-member asterisk --> {% assign nameArray = nameArray | join: ' ' | split: '::' %} {% if showAsterisks %} {% unless membershipTypes contains person.membership %} {% assign addArray = '*' | split: '::' %} {% assign nameArray = nameArray | concat: addArray %} {% assign nameArray = nameArray | join: '' | split: '::' %} {% endunless %} {% endif %} {% assign addArray = nameArray | join: ' ' | split: '::' %} <!-- End name generation --> {% if person.marital_status == 'Married' %} {% assign coupleArray = coupleArray | concat: addArray %} {% else %} {% assign adultsArray = adultsArray | concat: addArray %} {% endif %} {% endif %} {% endfor %} <!-- Non-primary adults --> {% for person in household.adults %} {% assign addArray = '' | split: '::' %} {% assign nameArray = '' | split: '::' %} {% if household.primary_contact.id != person.id and person.active and person.custom_tabs.communication_preferences.directory_inclusion.value != 'Force Exclude' %} <!-- Begin adult name generation --> {% assign addArray = person.name_prefix | split: '::' %} {% assign nameArray = nameArray | concat: addArray %} {% assign addArray = person.first_name | split: '::' %} {% assign nameArray = nameArray | concat: addArray %} {% if sameLast and person.marital_status == 'Married' %} {% assign addArray = person.name_suffix | split: '::' %} {% assign nameArray = nameArray | concat: addArray %} {% endif %} {% unless sameLast and person.marital_status == 'Married' %} {% assign addArray = person.last_name | split: '::' %} {% assign nameArray = nameArray | concat: addArray %} {% assign addArray = person.name_suffix | split: '::' %} {% assign nameArray = nameArray | concat: addArray %} {% endunless %} <!-- Append non-member asterisk --> {% assign nameArray = nameArray | join: ' ' | split: '::' %} {% if showAsterisks %} {% unless membershipTypes contains person.membership %} {% assign addArray = '*' | split: '::' %} {% assign nameArray = nameArray | concat: addArray %} {% assign nameArray = nameArray | join: '' | split: '::' %} {% endunless %} {% endif %} {% assign addArray = nameArray | join: ' ' | split: '::' %} <!-- End name generation --> {% if person.marital_status == 'Married' %} {% assign coupleArray = coupleArray | concat: addArray %} {% else %} {% assign adultsArray = adultsArray | concat: addArray %} {% endif %} {% endif %} {% endfor %} <!-- Generate couple/adult strings --> {% if coupleArray.size > 0 %} {% if sameLast %} {% assign coupleString = coupleArray | join: ' & ' | append: ' ' | append: household.primary_contact.last_name %} {% else %} {% assign coupleString = coupleArray | join: ' & ' %} {% endif %} {% endif %} {% assign adultsString = adultsArray | join: ', ' %} <!-- If there's a couple, set them as finalString; strip last name from other adults and them add to childrenArray --> {% if coupleString.size > 1 %} {% assign finalString = coupleString %} {% assign removeLastName = household.primary_contact.last_name | prepend: ' ' %} {% assign adultsString = adultsString | remove: removeLastName %} {% assign childrenArray = adultsString | split: ', ' %} <!-- Otherwise use unmarried adults as finalString --> {% else %} {% assign finalString = adultsString %} {% endif %} <!-- Find children and add to array --> {% for person in household.children %} {% assign addArray = '' | split: '::' %} {% assign nameArray = '' | split: '::' %} {% if person.active and person.custom_tabs.communication_preferences.directory_inclusion.value != 'Force Exclude' %} <!-- Begin child name generation --> {% assign addArray = person.name_prefix | split: '::' %} {% assign nameArray = nameArray | concat: addArray %} {% assign addArray = person.first_name | split: '::' %} {% assign nameArray = nameArray | concat: addArray %} {% unless sameLast and person.last_name == household.primary_contact.last_name %} {% assign addArray = person.last_name | split: '::' %} {% assign nameArray = nameArray | concat: addArray %} {% endunless %} {% assign addArray = person.name_suffix | split: '::' %} {% assign nameArray = nameArray | concat: addArray %} <!-- Append non-member asterisk --> {% assign nameArray = nameArray | join: ' ' | split: '::' %} {% if showAsterisks %} {% unless membershipTypes contains person.membership %} {% assign addArray = '*' | split: '::' %} {% assign nameArray = nameArray | concat: addArray %} {% assign nameArray = nameArray | join: '' | split: '::' %} {% endunless %} {% endif %} {% assign addArray = nameArray | join: ' ' | split: '::' %} <!-- End name generation --> {% assign childrenArray = childrenArray | concat: addArray %} {% endif %} {% assign childrenString = childrenArray | join: ', ' %} {% endfor %} <!-- Begin generating entry --> <!-- Insert household or individual photo --> {% if household.primary_contact.custom_tabs.communication_preferences.hide_household_photo.value != 'Hide' %} {% if household.primary_contact.custom_tabs.communication_preferences.household_photo.value.size > 1 %} {% assign imgurl = household.primary_contact.custom_tabs.communication_preferences.household_photo.value | split: '"' %} {% assign imgurl = imgurl[1] %} <div class="avatar"> <img src="{{- imgurl -}}"></img> </div> {% else %} {% unless household.primary_contact.photo_url contains 'initials' %} {% assign imgurl = household.primary_contact.photo_url | split: '?' %} {% assign imgurl = imgurl[0] | append: '?g=600x600' %} <div class="avatar"> <img src="{{- imgurl -}}"></img> </div> {% else %} <div class="avatar-noimg"></div> {% endunless %} {% endif %} {% else %} <div class="avatar-noimg"></div> {% endif %} <div class="adults"> {{ finalString }} </div> <div class="children"> {{ childrenString }} </div> <div class="contacts"> <ul> {% assign includetest = household.primary_contact.custom_tabs.communication_preferences.listed_address | join: ', ' %} {% for address in household.primary_contact.addresses %} {% if includetest contains address.location and address.location == 'Other' %} <li class="address">{{ address.street_line_1 }}{% if address.street_line2 %}<br />{{ address.street_line_2 }}{% endif %}<br />{{ address.city }}, {{ address.state }} {{ address.zip | slice: 0, 5 }}</li> {% endif %} {% endfor %} {% for address in household.primary_contact.addresses %} {% if includetest contains address.location and address.location == 'Home' %} <li class="address">{{ address.street_line_1 }}{% if address.street_line2 %}<br />{{ address.street_line_2 }}{% endif %}<br />{{ address.city }}, {{ address.state }} {{ address.zip | slice: 0, 5 }}</li> {% endif %} {% endfor %} {% assign includetest = household.primary_contact.custom_tabs.communication_preferences.listed_phone | join: ', ' %} {% for phone_number in household.primary_contact.phone_numbers %} {% if includetest contains phone_number.location and phone_number.location == 'Home' %} <li class="phone">{{ phone_number.number }} ({{ phone_number.location }})</li> {% endif %} {% endfor %} {% for person in household.adults %} {% if person.active %} {% assign includetest = person.custom_tabs.communication_preferences.listed_phone | join: ', ' %} {% for phone_number in person.phone_numbers %} {% if includetest contains phone_number.location and phone_number.location != 'Home' %} <li class="phone">{{ phone_number.number }} ({{ person.first_name }})</li> {% endif %} {% endfor %} {% assign includetest = person.custom_tabs.communication_preferences.listed_email | join: ', ' %} {% for email in person.emails %} {% if includetest contains email.location %} <li class="email">{{ email.address }} ({{ person.first_name }})</li> {% endif %} {% endfor %} {% endif %} {% endfor %} </ul> </div> </div> {% endfor %} </div> </div> </body> </html> |