geer-builder 1.2.792 → 1.2.794
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/GCodeVault.vue +54 -21
- package/package.json +1 -1
package/GCodeVault.vue
CHANGED
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
<div class="label">Pin</div>
|
|
37
37
|
<div class="value">{{ code.pin }}</div>
|
|
38
38
|
<div class="label">Status</div>
|
|
39
|
-
<div class="value" :style="`color: ${ code.used ? 'red' : 'green' }`">{{ code.used ? 'Used by ' + code.used_by : 'Not Yet Used' }}</div>
|
|
39
|
+
<div class="value" :style="`color: ${ code.used ? 'red' : checkExpiration(code.created_date) ? 'red' : 'green' }`">{{ checkExpiration(code.created_date) ? 'Expired' : (code.used ? 'Used by ' + code.used_by : 'Not Yet Used') }}</div>
|
|
40
40
|
<div class="label">Sale ID</div>
|
|
41
41
|
<div class="value text-red">{{ code.sale_id}}</div>
|
|
42
42
|
</div>
|
|
@@ -106,7 +106,7 @@ import GlobalMixins from './mixins/global_mixins';
|
|
|
106
106
|
import AddSlotDialog from './dialogs/AddSlotDialog';
|
|
107
107
|
import UpgradeSlotDialog from './dialogs/UpgradeSlotDialog';
|
|
108
108
|
import AddSubslotDialog from './dialogs/AddSubslotDialog';
|
|
109
|
-
|
|
109
|
+
import moment from 'moment';
|
|
110
110
|
|
|
111
111
|
export default
|
|
112
112
|
{
|
|
@@ -144,6 +144,30 @@ export default
|
|
|
144
144
|
},
|
|
145
145
|
methods:
|
|
146
146
|
{
|
|
147
|
+
checkExpiration(created_date)
|
|
148
|
+
{
|
|
149
|
+
let is_expired = false;
|
|
150
|
+
try
|
|
151
|
+
{
|
|
152
|
+
if(this.settings && this.settings.hasOwnProperty('membership_code_expiration_days') && this.settings.membership_code_expiration_days > 0)
|
|
153
|
+
{
|
|
154
|
+
|
|
155
|
+
let expiration_days = this.settings.membership_code_expiration_days;
|
|
156
|
+
let days_diff = moment().diff(moment( new Date(created_date.toDate()) ), 'days')
|
|
157
|
+
|
|
158
|
+
if(days_diff >= expiration_days)
|
|
159
|
+
{
|
|
160
|
+
is_expired = true;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
catch(error)
|
|
165
|
+
{
|
|
166
|
+
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
return is_expired;
|
|
170
|
+
},
|
|
147
171
|
async loadCodes()
|
|
148
172
|
{
|
|
149
173
|
await this.$bind('code_list', this.db_code.collection().where('recipient', '==', this.user_info.uid));
|
|
@@ -163,37 +187,46 @@ export default
|
|
|
163
187
|
{
|
|
164
188
|
this.code = code;
|
|
165
189
|
|
|
166
|
-
|
|
167
|
-
{
|
|
168
|
-
this.$q.loading.show();
|
|
169
|
-
console.log('asd');
|
|
170
|
-
|
|
171
|
-
let slot_info = await this.db_slot.get(code.used_by);
|
|
172
|
-
let user_info = await this.db_user.get(slot_info.owner);
|
|
173
|
-
|
|
174
|
-
this.$q.loading.hide();
|
|
175
|
-
this.$_showProfile(user_info);
|
|
190
|
+
let is_expired = checkExpiration(code.created_date);
|
|
176
191
|
|
|
192
|
+
if(is_expired == true)
|
|
193
|
+
{
|
|
194
|
+
|
|
177
195
|
}
|
|
178
196
|
else
|
|
179
197
|
{
|
|
180
|
-
if(code.
|
|
198
|
+
if(code.used == true)
|
|
181
199
|
{
|
|
182
|
-
this.
|
|
200
|
+
this.$q.loading.show();
|
|
201
|
+
console.log('asd');
|
|
202
|
+
|
|
203
|
+
let slot_info = await this.db_slot.get(code.used_by);
|
|
204
|
+
let user_info = await this.db_user.get(slot_info.owner);
|
|
205
|
+
|
|
206
|
+
this.$q.loading.hide();
|
|
207
|
+
this.$_showProfile(user_info);
|
|
208
|
+
|
|
183
209
|
}
|
|
184
210
|
else
|
|
185
211
|
{
|
|
186
|
-
if(code.
|
|
187
|
-
{
|
|
188
|
-
this.is_open_add_slot_dialog = true;
|
|
189
|
-
}
|
|
190
|
-
else if(code.kit_for_upgrade === "Only For Upgrade")
|
|
212
|
+
if(code.hasOwnProperty('product') && code.product.type === 'Subslot Kit')
|
|
191
213
|
{
|
|
192
|
-
this.
|
|
214
|
+
this.is_open_add_subslot_dialog = true;
|
|
193
215
|
}
|
|
194
216
|
else
|
|
195
217
|
{
|
|
196
|
-
|
|
218
|
+
if(code.kit_for_upgrade === "Don't use for Upgrade")
|
|
219
|
+
{
|
|
220
|
+
this.is_open_add_slot_dialog = true;
|
|
221
|
+
}
|
|
222
|
+
else if(code.kit_for_upgrade === "Only For Upgrade")
|
|
223
|
+
{
|
|
224
|
+
this.is_open_upgrade_slot_dialog = true;
|
|
225
|
+
}
|
|
226
|
+
else
|
|
227
|
+
{
|
|
228
|
+
this.is_select_action_dialog_open = true;
|
|
229
|
+
}
|
|
197
230
|
}
|
|
198
231
|
}
|
|
199
232
|
}
|