-
Notifications
You must be signed in to change notification settings - Fork 1
/
consentua-linear-selector.html
204 lines (196 loc) · 6.43 KB
/
consentua-linear-selector.html
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
<link rel="import" href="../polymer/polymer-element.html">
<dom-module id="consentua-linear-selector">
<template>
<style>
:host {
display: block;
}
paper-button{
background-color: var(--green-l);
color: #fff;
text-transform: capitalize;
min-width: 22%;
}
paper-button iron-icon{
--iron-icon-height: 32px;
--iron-icon-width: 32px;
}
paper-button[disabled]{
background-color: var(--green-d);
}
.main-page{
}
.main-page > article{
box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.35);
height: 670px;
width: 70%;
padding: 1em;
margin: 0em 1em;
background: #fff;
border-radius: 5px;
}
.linear-page{
display: flex;
}
.linear-page paper-radio-group{
--paper-radio-group-item-padding: 0.7em auto;
padding: 1em 0em 1em 2em;
}
.linear-page paper-radio-button{
--paper-radio-button-size: 25px;
--paper-radio-button-checked-color: var(--green-l);
--paper-radio-button-checked-ink-color: var(--green-l);
--paper-radio-button-unchecked-background-color: var(--main-background-color);
--paper-radio-button-radio-container:{
margin: 0px auto;
/*border: 7px solid var(--main-background-color);*/
border-radius: 50%;
};
}
/* .linear-page paper-radio-button[checked]:before{
content: '';
position: absolute;
display: block;
width: 0;
height: 0;
border-style: solid;
border-width: 10px 20px 10px 0;
border-color: transparent #ffffff transparent transparent;
margin-left: 45px;
margin-top: 8px;
}*/
.linear-page paper-radio-button:after{
content: '';
position: relative;
display: block;
/*background-color: #d6d6d6;*/
width: 14px;
height: 25px;
left: 27%;
}
.linear-page paper-radio-button:nth-last-of-type(1):after{
background-color: transparent;
}
/*.linear-page paper-radio-button:before{
position: relative;
display: block;
content: '';
width: 15px;
height: 15px;
border-radius: 50%;
background-color: #7e7e7e;
top: 25px;
left: 10px;
}*/
.linear-page > article{
display:flex;
flex-direction:column;
}
#pageLinear{
flex: 1;
border-top: 2px solid #eee;
border-bottom: 2px solid #eee;
}
.linear-page #linearBtnContainer{
align-self: flex-start;
width: 55%;
margin: 1em 0px;
}
</style>
<section>
<!-- <template is="dom-repeat" items="[[purposeGroup]]"> -->
<div class="main-page linear-page">
<!-- page nav radio buttons -->
<paper-radio-group attr-for-selected="name" selected="{{selectedLinearPage}}">
<template is="dom-repeat" items="[[purposeGroup.Purposes]]">
<paper-radio-button noink name="[[index]]"></paper-radio-button><br>
</template>
</paper-radio-group>
<article>
<h2>[[purposeGroup.Description]]</h2>
<p>[[purposeGroup.Explanation]]</p>
<iron-pages selected="[[selectedLinearPage]]" id="pageLinear" fallback-selection="0">
<template is="dom-repeat" items="[[purposeGroup.Purposes]]">
<div>
<h3>We will use</h3>
<p>[[item.DataUse]]</p>
<h3>For the purposes of</h3>
<p>[[item.DataPurpose]]</p>
<div id="linearBtnContainer">
<dom-if if="[[!_getUserConsent(item, userConsents)]]">
<template>
<h3>no</h3>
<!-- <paper-button class="btn-setting" on-tap="_linearSelect" raised>Use this setting</paper-button> -->
</template>
</dom-if>
<dom-if if="[[_getUserConsent(item, userConsents)]]">
<template>
<h3>ye</h3>
<!-- <paper-button class="btn-setting" raised>Current setting <iron-icon class="linear-btn-icon" icon="consentua-icons:check"></iron-icon></paper-button> -->
</template>
</dom-if>
</div>
</div>
</template>
</iron-pages>
</article>
</div>
<!-- </template> -->
</section>
</template>
<script>
class ConsentuaLinearSelector extends Polymer.Element {
static get is() { return 'consentua-linear-selector'; }
static get properties() {
return {
purposeGroup: {
type: Object,
notify: true,
reflectToAttribute: true,
value: {}
},
selectedLinearPage:{
type: Number,
notify: true,
value: 0,
},
userConsents: {
type: Object,
notify: true
}
};
}
ready() {
super.ready();
}
_linearSelect(linearCurrentSetting){
if (this.linearCurrentSetting) {
this.linearCurrentSetting = false;
} else{
this.linearCurrentSetting = true;
}
}
_getUserConsent(item, userConsents){
console.log("item", item.Id);
// if this purpose is the same as matching 1 in userConsents return t else f
if (userConsents.Consent != undefined) {
console.log(userConsents.Consent.Purposes);
// var arr = this.userConsents.Consent.Purposes;
}
// var isConsented = arr.find(function(findConsent){
// return findConsent.PurposeId === item.Id;
// });
// console.log("isConsented", isConsented);
// if(isConsented != undefined){
// // user's consent was found and return it
// return isConsented.Consent;
// } else{
// // user's consent was not found
// return false;
// }
}
}
// Associate the new class with an element name
customElements.define(ConsentuaLinearSelector.is, ConsentuaLinearSelector);
</script>
</dom-module>