-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDivisionSales.dart
More file actions
298 lines (239 loc) · 7.04 KB
/
DivisionSales.dart
File metadata and controls
298 lines (239 loc) · 7.04 KB
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
// Generated Dart class from HTML template.
// DO NOT EDIT.
String safeHTML(String html) {
// TODO(terry): Escaping for XSS vulnerabilities TBD.
return html;
}
class DivisionSales {
Map<String, Object> _scopes;
Element _fragment;
var divisions;
// Elements bound to a variable:
List productZippy; // Repeated elements.
DivisionSales(this.divisions) : _scopes = new Map<String, Object>() {
//Global initializers.
productZippy = [];
// Insure stylesheet for template exist in the document.
add_DivisionSales_templatesStyles();
_fragment = new DocumentFragment();
var e0 = new Element.html('<div></div>');
_fragment.elements.add(e0);
each_0(divisions, e0);
}
Element get root() => _fragment;
// CSS class selectors for this template.
static String get divisionItem() => "division-item";
static String get productItem() => "product-item";
static String get productTitle() => "product-title";
static String get productName() => "product-name";
static String get productUsers() => "product-users";
static String get expandCollapse() => "expand-collapse";
static String get expand() => "expand";
static String get collapse() => "collapse";
static String get showSales() => "show-sales";
static String get hideSales() => "hide-sales";
static String get salesItem() => "sales-item";
static String get ytdSales() => "ytd-sales";
// Injection functions:
String inject_0() {
// Local scoped block names.
var div = _scopes["div"];
return safeHTML('${div.name}');
}
String inject_1() {
// Local scoped block names.
var div = _scopes["div"];
return safeHTML('${div.id}');
}
String inject_2() {
// Local scoped block names.
var div = _scopes["div"];
var divProd = _scopes["divProd"];
return safeHTML('${divProd.name}');
}
String inject_3() {
// Local scoped block names.
var div = _scopes["div"];
var divProd = _scopes["divProd"];
return safeHTML('${divProd.users}');
}
String inject_4() {
// Local scoped block names.
var div = _scopes["div"];
var divProd = _scopes["divProd"];
var divProdSales = _scopes["divProdSales"];
return safeHTML('${divProdSales.country}');
}
String inject_5() {
// Local scoped block names.
var div = _scopes["div"];
var divProd = _scopes["divProd"];
var divProdSales = _scopes["divProdSales"];
return safeHTML('${divProdSales.yearly}');
}
// Each functions:
each_0(List items, Element parent) {
for (var div in items) {
_scopes["div"] = div;
var e0 = new Element.html('<div class="division-item"></div>');
parent.elements.add(e0);
var e1 = new Element.html('<span>${inject_0()}</span>');
e0.elements.add(e1);
var e2 = new Element.html('<span> - </span>');
e0.elements.add(e2);
var e3 = new Element.html('<span>${inject_1()}</span>');
e0.elements.add(e3);
var e4 = new Element.html('<div></div>');
parent.elements.add(e4);
each_1(div.products, e4);
_scopes.remove("div");
}
}
each_1(List items, Element parent) {
for (var divProd in items) {
_scopes["divProd"] = divProd;
var e0 = new Element.html('<div class="product-item"></div>');
parent.elements.add(e0);
var tmp_productZippy = new Element.html('<span class="expand-collapse expand">▼</span>');
e0.elements.add(tmp_productZippy);
productZippy.add(tmp_productZippy);
var e1 = new Element.html('<span class="product-title">Product</span>');
e0.elements.add(e1);
var e2 = new Element.html('<span class="product-name">${inject_2()}</span>');
e0.elements.add(e2);
var e3 = new Element.html('<span class="product-users">${inject_3()} </span>');
e0.elements.add(e3);
var e4 = new Element.html('<div class="show-sales"></div>');
e0.elements.add(e4);
each_2(divProd.sales, e4);
_scopes.remove("divProd");
}
}
each_2(List items, Element parent) {
for (var divProdSales in items) {
_scopes["divProdSales"] = divProdSales;
var e0 = new Element.html('<div class="sales-item"></div>');
parent.elements.add(e0);
var e1 = new Element.html('<span>${inject_4()}</span>');
e0.elements.add(e1);
var e2 = new Element.html('<span class="ytd-sales">${inject_5()}</span>');
e0.elements.add(e2);
_scopes.remove("divProdSales");
}
}
// With functions:
// CSS for this template.
static final String stylesheet = '''
.division-item {
background-color: #bbb;
border-top: 2px solid #ffffff;
line-height: 20pt;
padding-left: 5px;
}
.product-item {
background-color: #d3d3d3;
margin-left: 10px;
border-top: 2px solid #ffffff;
line-height: 20pt;
}
.product-title {
position: absolute;
left: 45px;
}
.product-name {
font-weight: bold;
position: absolute;
left: 100px;
}
.product-users {
position: absolute;
right: 150px;
font-style: italic;
color: #808080;
width: 110px;
}
.expand-collapse {
margin-left: 5px;
margin-right: 5px;
vertical-align: top;
cursor: pointer;
}
.expand {
font-size: 9pt;
}
.collapse {
font-size: 8pt;
}
.show-sales {
display: inherit;
}
.hide-sales {
display: none;
}
.sales-item {
font-family: arial;
background-color: #d3d3d3;
margin-left: 10px;
border-top: 1px solid #ffffff;
line-height: 18pt;
padding-left: 5px;
}
.ytd-sales {
position: absolute;
left: 100px;
}
''';
// Stylesheet class selectors:
}
class Header {
Map<String, Object> _scopes;
Element _fragment;
String company;
Date date;
Header(this.company, this.date) : _scopes = new Map<String, Object>() {
// Insure stylesheet for template exist in the document.
add_DivisionSales_templatesStyles();
_fragment = new DocumentFragment();
var e0 = new Element.html('<div align="center" class="header"></div>');
_fragment.elements.add(e0);
var e1 = new Element.html('<h2>${inject_0()}</h2>');
e0.elements.add(e1);
var e2 = new Element.html('<div align="right">${inject_1()}</div>');
e0.elements.add(e2);
}
Element get root() => _fragment;
// CSS class selectors for this template.
static String get header() => "header";
// Injection functions:
String inject_0() {
return safeHTML('${company}');
}
String inject_1() {
return safeHTML('${date}');
}
// Each functions:
// With functions:
// CSS for this template.
static final String stylesheet = '''
.header {
background-color: #708090;
font-family: arial;
color: #d3d3d3;
font-weight: bold;
padding-top: 20px;
}
''';
// Stylesheet class selectors:
}
// Inject all templates stylesheet once into the head.
bool DivisionSales_stylesheet_added = false;
void add_DivisionSales_templatesStyles() {
if (!DivisionSales_stylesheet_added) {
StringBuffer styles = new StringBuffer();
// All templates stylesheet.
styles.add(DivisionSales.stylesheet);
styles.add(Header.stylesheet);
DivisionSales_stylesheet_added = true;
document.head.elements.add(new Element.html('<style>${styles.toString()}</style>'));
}
}