Newer
Older
---
layout: null
permalink: /nobreakspace/inventory
---
<?xml version="1.0" encoding="UTF-8"?>
<inventoy>
{%- for device in site.inventory -%}
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
{% assign tool = device -%}
{% assign display_info = 0 -%}
{% assign display_info_next_week = 0 -%}
{% if tool.out_of_service -%}
{% assign display_info = 1 -%}
{% endif -%}
{% capture nowunix %}{{'now' | date: '%s'}}{% endcapture %}
{%- capture next_week %}{{'now' | date: '%s' | plus: 604800 }}{%- endcapture -%}
{% for loan in site.loan -%}
{% capture eventdate %}{{loan.eventdate | date: '%s'}}{% endcapture %}
{% capture eventend %}{{loan.eventend | date: '%s'}}{% endcapture %}
{% if loan.devices -%}
{% if loan.devices contains tool.uid -%}
{% if eventdate < nowunix -%}
{% if nowunix < eventend -%}
{% assign display_info = 2 -%}
{% endif -%}
{% else -%}
{% if eventdate < next_week -%}
{% assign display_info_next_week = 2 -%}
{% endif -%}
{% endif -%}
{% endif -%}
{% endif -%}
{% if loan.sets -%}
{% for set in tool.sets -%}
{% if loan.sets contains set -%}
{% if eventdate < nowunix -%}
{% if nowunix < eventend -%}
{% assign display_info = 2 -%}
{% endif -%}
{% else -%}
{% if eventdate < next_week -%}
{% assign display_info_next_week = 2 -%}
{% endif -%}
{% endif -%}
{% endif -%}
{% endfor -%}
{% endif -%}
{% endfor -%}
{% for loan in site.events %}
{% capture eventdate %}{{loan.eventdate | date: '%s'}}{% endcapture %}
{% capture eventend %}{{loan.eventend | date: '%s'}}{% endcapture %}
{% if loan.devices -%}
{% if loan.devices contains tool.uid -%}
{% if eventdate < nowunix -%}
{% if nowunix < eventend -%}
{% assign display_info = 3 -%}
{% endif -%}
{% else -%}
{% if eventdate < next_week -%}
{% assign display_info_next_week = 3 -%}
{% endif -%}
{% endif -%}
{% endif -%}
{% endif -%}
{% if loan.sets -%}
{% for set in tool.sets -%}
{% if loan.sets contains set -%}
{% if eventdate < nowunix -%}
{% if nowunix < eventend -%}
{% assign display_info = 3 -%}
{% endif -%}
{% else -%}
{% if eventdate < next_week -%}
{% assign display_info_next_week = 3 -%}
{% endif -%}
{% endif -%}
{% endif -%}
{% endfor -%}
{% endif -%}
{% endfor -%}
<device>
<name>{{device.name}}</name>
<uid>{{device.uid}}</uid>
{% if device.safetybriefing -%}
<safetybriefing>true</safetybriefing>
{% else %}
<safetybriefing>false</safetybriefing>
{% endif -%}
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
{% if display_info == 1 -%}
<outofservice>true</outofservice>
{% else %}
<outofservice>false</outofservice>
{% endif -%}
{% if display_info == 2 -%}
<onloan>true</onloan>
{% else %}
<onloan>false</onloan>
{% endif -%}
{% if display_info == 3 -%}
<usedinevent>true</usedinevent>
{% else %}
<usedinevent>false</usedinevent>
{% endif -%}
{% assign futureLoans = "" | split: ',' -%}
{% for loan in site.loan -%}
{% capture eventdate %}{{loan.eventdate | date: '%s'}}{% endcapture %}
{% capture eventend %}{{loan.eventend | date: '%s'}}{% endcapture %}
{% if loan.devices -%}
{% if loan.devices contains tool.uid -%}
{% if eventend > nowunix -%}
{% assign futureLoans = futureLoans | push: loan -%}
{% endif -%}
{% endif -%}
{% endif -%}
{% if loan.sets -%}
{% for set in tool.sets -%}
{% if loan.sets contains set -%}
{% if eventend > nowunix -%}
{% assign futureLoans = futureLoans | push: loan -%}
{% endif -%}
{% endif -%}
{% endfor -%}
{% endif -%}
{% endfor -%}
{% for loan in site.events -%}
{% capture eventdate %}{{loan.eventdate | date: '%s'}}{% endcapture -%}
{% capture eventend %}{{loan.eventend | date: '%s'}}{% endcapture -%}
{% if loan.devices -%}
{% if loan.devices contains tool.uid -%}
{% if eventend > nowunix -%}
{% assign futureLoans = futureLoans | push: loan -%}
{% endif -%}
{% endif -%}
{% endif -%}
{% if loan.sets -%}
{% for set in tool.sets -%}
{% if loan.sets contains set -%}
{% if eventend > nowunix -%}
{% assign futureLoans = futureLoans | push: loan -%}
{% endif -%}
{% endif -%}
{% endfor -%}
{% endif -%}
{% endfor -%}
{% assign floans = futureLoans | sort: 'eventdate' -%}
<futurebookings>
{% for floan in floans -%}
<booking>
<start>{{floan.eventdate | date: '%s'}}</start>
<end>{{floan.eventend | date: '%s'}}</end>
</booking>
{% endfor -%}
</futurebookings>
<wikilink>{{device.wikilink}}</wikilink>
<sets>
{%- for set in device.sets -%}
<set>{{set}}</set>
{%- endfor -%}
</sets>
<contacts>
{%- for contact in device.contact -%}
{% for person in site.people -%}
{% if contact == person.person_id %}
<contact>{{contact.name}}</contact>
{% endif -%}
{% endfor -%}
{% endfor -%}
</contacts>