Printable Directory

This report is intended to be printed to pdf on 8.5x11 paper. It's a photo directory. The logic for the photos is it pulls the household photo if the person is in a household, if they are not then it pulls the individuals photo, if there is no photo it uses the PCO no image avatar. You can change that by editing the assign no_avatar url at the top of the report.

Preview

Report Preview


  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
{% assign sorted_people = people | sort_natural: 'last_name' %}
{% assign no_avatar = 'https://people.planningcenteronline.com/static/no_photo_thumbnail.gif' %}

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  {{ helpers.bootstrap_3 }}

  <style>
    @page {
      size: Letter;
      margin: 0.5in;

      @bottom-center {
        content: "Page " counter(page) " of " counter(pages);
        font-size: 10px;
        color: #666;
      }
    }

    body {
      font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
      font-size: 12px;
      color: #1f2937;
    }

    .directory {
      column-count: 2;
      column-gap: 0.35in;
    }

    .entry {
      break-inside: avoid;
      page-break-inside: avoid;
      -webkit-column-break-inside: avoid;

      border: 1px solid #e5e7eb;
      border-radius: 10px;
      padding: 10px;
      margin: 0 0 10px 0;
      background: #fff;
    }

    .photo-wrap {
      float: right;
      width: 92px;
      height: 92px;
      margin-left: 10px;
    }

    .photo {
      width: 92px;
      height: 92px;
      border-radius: 12px;
      object-fit: cover;
      border: 1px solid #e5e7eb;
      background: #f3f4f6;
      display: block;
    }

    .clearfix::after {
      content: "";
      display: table;
      clear: both;
    }

    .name-line {
      font-size: 14px;
      font-weight: 700;
      margin: 0 0 4px 0;
      letter-spacing: 0.2px;
    }

    .address {
      margin: 0 0 6px 0;
      color: #374151;
      line-height: 1.25;
      white-space: pre-line;
    }

    .section-label {
      margin-top: 10px;
      font-size: 11px;
      font-weight: 700;
      letter-spacing: 0.6px;
      text-transform: uppercase;
      color: #6b7280;
    }

    .contact-person {
      margin-top: 8px;
      padding-top: 8px;
      border-top: 1px dashed #e5e7eb;
    }

    .phone-line { margin: 2px 0; }
    .phone-label { color: #6b7280; }

    .muted { color: #6b7280; }
  </style>
</head>

<body>
  {% assign printed_household_ids = "|" %}

  <div class="directory">
    {% for person in sorted_people %}

      {% if person.households != empty %}
        {% assign household = person.households.first %}
        {% capture household_key %}|{{ household.id }}|{% endcapture %}

        {% unless printed_household_ids contains household_key %}
          {% assign printed_household_ids = printed_household_ids | append: household_key %}

          {%- comment -%}Header formatting: two-adult special case, else list adult first names{%- endcomment -%}
          {% assign adult_count = 0 %}
          {% assign adult_first_1 = "" %}
          {% assign adult_first_2 = "" %}
          {% assign household_last = "" %}

          {% assign child_count = 0 %}
          {% for hp in household.people %}
            {% if hp.child %}
              {% assign child_count = child_count | plus: 1 %}
            {% else %}
              {% assign adult_count = adult_count | plus: 1 %}
              {% if adult_count == 1 %}
                {% assign adult_first_1 = hp.first_name %}
                {% assign household_last = hp.last_name %}
              {% elsif adult_count == 2 %}
                {% assign adult_first_2 = hp.first_name %}
              {% endif %}
            {% endif %}
          {% endfor %}

          {% if household_last == "" %}
            {% assign household_last = person.last_name %}
          {% endif %}

          {%- comment -%}Address: use household primary contact home address when available{%- endcomment -%}
          {% assign addr_line = "" %}
          {% if household.primary_contact and household.primary_contact.addresses != empty %}
            {% for a in household.primary_contact.addresses %}
              {% if a.location == "Home" %}
                {% assign addr_line = a.postal_address %}
              {% endif %}
            {% endfor %}
            {% if addr_line == "" %}
              {% assign addr_line = household.primary_contact.addresses.first.postal_address %}
            {% endif %}
          {% endif %}

          {%- comment -%}
            PHOTO RULE:
            If in a household -> use household.photo_url (else placeholder)
          {%- endcomment -%}
          {% assign photo_url = household.photo_url %}
          {% if photo_url == blank %}
            {% assign photo_url = no_avatar %}
          {% endif %}

          <div class="entry clearfix">
            <div class="photo-wrap">
              <img class="photo" src="{{ photo_url }}" alt="Household Photo">
            </div>

            <div class="name-line">
              {% if adult_count == 2 %}
                {{ household_last }}, {{ adult_first_1 }} &amp; {{ adult_first_2 }}
              {% else %}
                {{ household_last }},
                {%- assign printed_any_adult = false -%}
                {% for hp in household.people %}
                  {% unless hp.child %}
                    {% if printed_any_adult %}, {% endif %}
                    {{ hp.first_name }}
                    {% assign printed_any_adult = true %}
                  {% endunless %}
                {% endfor %}
              {% endif %}
            </div>

            {% if addr_line != "" %}
              <div class="address">{{ addr_line }}</div>
            {% else %}
              <div class="address muted">No address on file</div>
            {% endif %}

            {%- comment -%}Adults (no heading) then Children (with heading){%- endcomment -%}
            {% for hp in household.people %}
              {% unless hp.child %}
                <div class="contact-person">
                  <div><strong>{{ hp.first_name }}</strong></div>

                  {% if hp.phone_numbers != empty %}
                    {% for phone_number in hp.phone_numbers %}
                      <div class="phone-line">
                        {{ phone_number.number }}
                        <span class="phone-label">({{ phone_number.location }})</span>
                      </div>
                    {% endfor %}
                  {% endif %}

                  {% if hp.emails != empty %}
                    <div>{{ hp.emails.first.address }}</div>
                  {% endif %}
                </div>
              {% endunless %}
            {% endfor %}

            {% if child_count > 0 %}
              <div class="section-label">Children</div>

              {% for hp in household.people %}
                {% if hp.child %}
                  <div class="contact-person">
                    <div><strong>{{ hp.first_name }}</strong></div>

                    {% if hp.phone_numbers != empty %}
                      {% for phone_number in hp.phone_numbers %}
                        <div class="phone-line">
                          {{ phone_number.number }}
                          <span class="phone-label">({{ phone_number.location }})</span>
                        </div>
                      {% endfor %}
                    {% endif %}

                    {% if hp.emails != empty %}
                      <div>{{ hp.emails.first.address }}</div>
                    {% endif %}
                  </div>
                {% endif %}
              {% endfor %}
            {% endif %}
          </div>

        {% endunless %}

      {% else %}
        {%- comment -%}Single-person entry (no household){%- endcomment -%}

        {% assign addr_line = "" %}
        {% if person.addresses != empty %}
          {% for a in person.addresses %}
            {% if a.location == "Home" %}
              {% assign addr_line = a.postal_address %}
            {% endif %}
          {% endfor %}
          {% if addr_line == "" %}
            {% assign addr_line = person.addresses.first.postal_address %}
          {% endif %}
        {% endif %}

        {%- comment -%}
          PHOTO RULE:
          If NOT in a household -> use person.photo_url (else placeholder)
        {%- endcomment -%}
        {% assign photo_url = person.photo_url %}
        {% if photo_url == blank %}
          {% assign photo_url = no_avatar %}
        {% endif %}

        <div class="entry clearfix">
          <div class="photo-wrap">
            <img class="photo" src="{{ photo_url }}" alt="Photo">
          </div>

          <div class="name-line">{{ person.last_name }}, {{ person.first_name }}</div>

          {% if addr_line != "" %}
            <div class="address">{{ addr_line }}</div>
          {% else %}
            <div class="address muted">No address on file</div>
          {% endif %}

          {% if person.phone_numbers != empty %}
            {% for phone_number in person.phone_numbers %}
              <div class="phone-line">
                {{ phone_number.number }}
                <span class="phone-label">({{ phone_number.location }})</span>
              </div>
            {% endfor %}
          {% endif %}

          {% if person.emails != empty %}
            <div>{{ person.emails.first.address }}</div>
          {% endif %}
        </div>

      {% endif %}

    {% endfor %}
  </div>
</body>
</html>