geer-builder 1.2.580 → 1.2.583

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.
@@ -0,0 +1,189 @@
1
+ <template>
2
+ <div class="companyplan" v-if="this.user_info">
3
+ <div class="q-mt-md">
4
+ <g-card>
5
+ <div class="q-pt-sm grid-item" style="cursor:pointer;" @click="is_open_token_claim=true" >
6
+ <div class="label">
7
+ Unused Token: {{unused_token}}
8
+ </div>
9
+ </div>
10
+ <div class="q-pt-sm grid-item" style="cursor:pointer;" @click="is_open_token_claim=true" >
11
+ <div class="label">
12
+ <q-btn size="12px" class="full-width q-pa-sm text-primary" flat>
13
+ <q-icon class="q-mr-sm" name="fas fa-money-check" size="16px"></q-icon>
14
+ <div>Use Token</div>
15
+ </q-btn>
16
+ </div>
17
+ </div>
18
+ </g-card>
19
+ </div>
20
+ <div class="q-mt-md">
21
+ <g-card>
22
+ <div>
23
+ <template v-if="plan_list.length > 0">
24
+ <div @click="viewPlan(plan)" class="plan" v-for="(plan, i) in plan_list" :key="i">
25
+ <div class="group">
26
+ <div class="label">Plan</div>
27
+ <div class="value text-primary" style="font-size: 1em; font-weight:500">{{plan.plan.name}}</div>
28
+ </div>
29
+ <div class="group">
30
+ <div class="label">Total amount to earn </div>
31
+ <div class="value">{{ $_formatNumber(plan.total_earn, { decimal: 2})}}</div>
32
+ </div>
33
+ <div class="group">
34
+ <div class="label">Status</div>
35
+ <div class="value">{{plan.status}}</div>
36
+ </div>
37
+ </div>
38
+ </template>
39
+ <template v-if="plan_list.length == 0">
40
+ <div class="no-plan">
41
+ No Plan
42
+ </div>
43
+ </template>
44
+ </div>
45
+ </g-card>
46
+ </div>
47
+
48
+ <q-dialog :maximized="$q.platform.is.mobile" transition-show="slide-up" transition-hide="slide-down" v-model="is_open_token_claim">
49
+ <company-token-claim @emitTest="emitTest" @closeDialog="is_open_token_claim = false"></company-token-claim>
50
+ </q-dialog>
51
+
52
+ <q-dialog :maximized="$q.platform.is.mobile" transition-show="slide-up" transition-hide="slide-down" v-model="is_open_token_claim_slot">
53
+ <company-token-claim-slot :plan_id="plan_id" @closeDialog="is_open_token_claim_slot = false"></company-token-claim-slot>
54
+ </q-dialog>
55
+
56
+ </div>
57
+ <div v-else>
58
+ <span>You need to login to view this component.</span>
59
+ </div>
60
+
61
+ </template>
62
+ <script>
63
+
64
+ import GHeader from './components/GHeader';
65
+ import GCard from './components/GCard';
66
+ import DB_USER from './models/DB_USER';
67
+ import DB_SLOT from './models/DB_SLOT';
68
+ import DB_COMPANY_TOKEN_PLAN from './models/DB_COMPANY_TOKEN_PLAN';
69
+ import GlobalMixins from './mixins/global_mixins';
70
+ import CompanyTokenClaim from './dialogs/CompanyTokenClaim';
71
+ import CompanyTokenClaimSlot from './dialogs/CompanyTokenClaimSlot';
72
+
73
+
74
+ export default
75
+ {
76
+ components: { GHeader, GCard, CompanyTokenClaim, CompanyTokenClaimSlot },
77
+ mixins: [GlobalMixins],
78
+ data: () =>
79
+ ({
80
+ unused_token: 0,
81
+ is_open_token_claim: false,
82
+ is_open_token_claim_slot: false,
83
+ db_user: new DB_USER(),
84
+ db_slot: new DB_SLOT(),
85
+ plan_list: [],
86
+ plan_id: null,
87
+ settings:{}
88
+ }),
89
+ props:
90
+ {
91
+
92
+ },
93
+ async mounted()
94
+ {
95
+ await this.$_getSlotInfo();
96
+ await this.loadPlan();
97
+ this.settings = await this.$_getData('public_settings');
98
+ },
99
+ methods:
100
+ {
101
+ emitTest(value)
102
+ {
103
+ this.unused_token = this.unused_token - value;
104
+ },
105
+ async loadPlan()
106
+ {
107
+ this.unused_token = this.current_slot_info.points.company_token;
108
+ // console.log(this.current_slot_info.points.company_token);
109
+ await this.$bind('plan_list', new DB_COMPANY_TOKEN_PLAN().collection().where('slot_owner', '==', this.current_slot_info.id));
110
+ },
111
+ async viewPlan(plan)
112
+ {
113
+ this.plan_id = plan.id;
114
+ this.is_open_token_claim_slot = true;
115
+ }
116
+ },
117
+ computed:
118
+ {
119
+
120
+ },
121
+ }
122
+ </script>
123
+
124
+ <style lang="scss">
125
+ .companyplan {
126
+ margin-bottom: 20px;
127
+
128
+ &-tabs {
129
+ display: grid;
130
+ grid-template-columns: 1fr 1fr;
131
+ text-align: center;
132
+ width: 100%;
133
+ grid-gap: 1px;
134
+ background-color: #ddd;
135
+ margin-bottom: 10px;
136
+
137
+ .tab {
138
+ padding: 10px;
139
+ border-bottom: 1px solid #ddd;
140
+ background-color: #fafafa;
141
+ color: #666;
142
+ font-weight: bold;
143
+ cursor: pointer;
144
+
145
+ &.active {
146
+ border-bottom: 1px solid #fff;
147
+ background-color: #fff;
148
+ color: #333;
149
+ }
150
+ }
151
+ }
152
+
153
+ .no-plan {
154
+ padding: 100px 20px;
155
+ text-align: center;
156
+ color: #aaa;
157
+ }
158
+
159
+ .plan {
160
+ border-bottom: 1px dashed #eee;
161
+ display: grid;
162
+ padding: 10px;
163
+ grid-template-columns: 1fr 1fr 1fr;
164
+ align-items: center;
165
+ grid-gap: 20px;
166
+ cursor: pointer;
167
+
168
+ &:hover {
169
+ background-color: #fafafa;
170
+ }
171
+
172
+ .icon {
173
+ color: #aaa;
174
+ width: 60px;
175
+ text-align: center;
176
+ }
177
+ .group {
178
+ .label {
179
+ font-weight: bold;
180
+ color: #aaa;
181
+ text-transform: uppercase;
182
+ }
183
+ .value {
184
+ font-size: 20px;
185
+ }
186
+ }
187
+ }
188
+ }
189
+ </style>
@@ -0,0 +1,192 @@
1
+ <template>
2
+ <q-card class="claim-investment-dialog">
3
+ <q-bar class='bg-primary text-white q-pa-lg'>
4
+ <b>Use Token</b>
5
+ <q-space />
6
+ <q-btn dense flat icon='close' v-close-popup><q-tooltip content-class='bg-white text-primary'>Close</q-tooltip></q-btn>
7
+ </q-bar>
8
+
9
+ <div class="plan" style="border-bottom: 1px dashed #eee;" v-for="(plan, i) in plan_list" :key="i">
10
+ <div class="desc text-center q-pa-lg">
11
+ <h6 style="margin:0 auto">Plan Name: {{plan.name}} </h6>
12
+ <h6 style="margin:0 auto">Required Token: {{plan.token_required}} </h6>
13
+ <h6 style="margin:0 auto">Lock-in Days: {{plan.total_days}} </h6>
14
+ <h6 style="margin:0 auto">Days to earn: Every {{plan.days_to_earn}} days </h6>
15
+ <h6 style="margin:0 auto">Amount to earned: {{ $_formatNumber(plan.earned_amount, { decimal: 2}) }} </h6>
16
+ </div>
17
+ <div class="button-holder text-center q-pa-md">
18
+ <q-btn size="12px" @click="claimPlan(plan,i)" class="text-white bg-primary investment__actions-button q-pa-sm">
19
+ <q-icon class="q-mr-sm" name="fas fa-chart-line" size="16px"></q-icon>
20
+ <div>Claim</div>
21
+ </q-btn>
22
+ </div>
23
+ </div>
24
+ </q-card>
25
+ </template>
26
+ <script>
27
+
28
+ import DB_SLOT from '../models/DB_SLOT';
29
+ import GlobalMixins from '../mixins/global_mixins.js';
30
+
31
+
32
+ export default
33
+ {
34
+ components: { },
35
+ mixins: [GlobalMixins],
36
+ data: () =>
37
+ ({
38
+ is_open_add_slot_dialog: false,
39
+ db_slot: new DB_SLOT(),
40
+ membership_list: null,
41
+ slot_membership:null,
42
+ plan_list: null,
43
+ settings:{}
44
+ }),
45
+ props:
46
+ {
47
+
48
+ },
49
+ async mounted()
50
+ {
51
+ await this.$_getSlotInfo();
52
+ await this.loadPlan();
53
+
54
+ this.settings = await this.$_getData('public_settings');
55
+ },
56
+ methods:
57
+ {
58
+ async loadPlan()
59
+ {
60
+ this.membership_list = await this.$_getData('membership_list');
61
+
62
+ this.slot_membership = this._getMembershipByID(this.current_slot_info.membership,this.membership_list);
63
+
64
+ this.plan_list = this.slot_membership.computation.company_token_plan;
65
+
66
+ console.log(this.plan_list);
67
+ },
68
+ async viewPlan()
69
+ {
70
+
71
+ },
72
+ async claimPlan(plan,id)
73
+ {
74
+ this.$q.dialog(
75
+ {
76
+ title: 'Confirm',
77
+ message: 'Would you to like claim this '+plan.name+'?',
78
+ cancel: true,
79
+ persistent: true
80
+ }).onOk(() =>
81
+ {
82
+ this.submitCompanyToken(plan,id);
83
+ });
84
+ },
85
+ async submitCompanyToken(plan,id)
86
+ {
87
+ this.$q.loading.show();
88
+
89
+ let sendData = {};
90
+ sendData.id = id;
91
+ sendData.slot_id = this.current_slot_info.id;
92
+
93
+ try
94
+ {
95
+ let res = await this.$_fbCall('memberClaimCompanyToken', sendData);
96
+ this.$emit('emitTest',plan.token_required);
97
+ this.$q.loading.hide();
98
+ }
99
+ catch (error)
100
+ {
101
+ this.$q.loading.hide();
102
+ this.$q.dialog({ title: `Something's not quite right`, message: error.message });
103
+ }
104
+ },
105
+ _getMembershipByID(mem, mem_list)
106
+ {
107
+ let membership = null;
108
+
109
+ mem_list.forEach(val =>
110
+ {
111
+ if(val.membership_id === mem.membership_id)
112
+ {
113
+ membership = val;
114
+ }
115
+ });
116
+
117
+ return membership;
118
+ }
119
+ },
120
+ computed:
121
+ {
122
+
123
+ },
124
+ }
125
+ </script>
126
+
127
+ <style lang="scss">
128
+ .companyplan {
129
+ margin-bottom: 20px;
130
+
131
+ &-tabs {
132
+ display: grid;
133
+ grid-template-columns: 1fr 1fr;
134
+ text-align: center;
135
+ width: 100%;
136
+ grid-gap: 1px;
137
+ background-color: #ddd;
138
+ margin-bottom: 10px;
139
+
140
+ .tab {
141
+ padding: 10px;
142
+ border-bottom: 1px solid #ddd;
143
+ background-color: #fafafa;
144
+ color: #666;
145
+ font-weight: bold;
146
+ cursor: pointer;
147
+
148
+ &.active {
149
+ border-bottom: 1px solid #fff;
150
+ background-color: #fff;
151
+ color: #333;
152
+ }
153
+ }
154
+ }
155
+
156
+ .no-plan {
157
+ padding: 100px 20px;
158
+ text-align: center;
159
+ color: #aaa;
160
+ }
161
+
162
+ .plan {
163
+ border-bottom: 1px dashed #eee;
164
+ display: grid;
165
+ padding: 10px;
166
+ grid-template-columns: 1fr 1fr 1fr;
167
+ align-items: center;
168
+ grid-gap: 20px;
169
+ cursor: pointer;
170
+
171
+ &:hover {
172
+ background-color: #fafafa;
173
+ }
174
+
175
+ .icon {
176
+ color: #aaa;
177
+ width: 60px;
178
+ text-align: center;
179
+ }
180
+ .group {
181
+ .label {
182
+ font-weight: bold;
183
+ color: #aaa;
184
+ text-transform: uppercase;
185
+ }
186
+ .value {
187
+ font-size: 20px;
188
+ }
189
+ }
190
+ }
191
+ }
192
+ </style>
@@ -0,0 +1,121 @@
1
+ <template>
2
+ <q-card >
3
+ <q-bar class='bg-primary text-white q-pa-lg'>
4
+ <b>Claim</b>
5
+ <q-space />
6
+ <q-btn dense flat icon='close' v-close-popup><q-tooltip content-class='bg-white text-primary'>Close</q-tooltip></q-btn>
7
+ </q-bar>
8
+ <q-card-section class='content'>
9
+ <div class="row">
10
+ <!-- TABLE -->
11
+ <div class="col-12 text-right q-mb-md">
12
+ <div class="q-mt-sm text-left">
13
+ <table style="width: 500px; min-width: 500px;">
14
+ <tr>
15
+ <th>Plan</th>
16
+ <th>Amount</th>
17
+ <th style="min-width: 30px;"></th>
18
+ <th></th>
19
+ </tr>
20
+ <tr v-for="(plan_data, i) in table_data" :key="i">
21
+ <td>{{ $_formatDate(plan_data.available_date, 'MM/DD/YY (hh:mm A)')}} </td>
22
+ <td>{{ $_formatNumber(plan_data.amount, { decimal: 2})}}</td>
23
+ <td></td>
24
+ <td v-if="plan_data.status == 'Claimed'">
25
+ <q-btn style="min-width: 130px;" :disabled="true" color="primary" label="Claimed" />
26
+ </td>
27
+ <td v-else-if="date_now >= plan_data.available_date.toDate() == true">
28
+ <q-btn style="min-width: 130px;" @click="claimNow(plan_data)" color="primary" label="Claim" />
29
+ </td>
30
+ <td v-else>
31
+ <q-btn style="min-width: 130px;" :disabled="true" color="primary" label="Unclaimable" />
32
+ </td>
33
+ </tr>
34
+ </table>
35
+ </div>
36
+ </div>
37
+ </div>
38
+ </q-card-section>
39
+ </q-card>
40
+ </template>
41
+
42
+ <script>
43
+ import DB_COMPANY_TOKEN_PLAN_DATE from '../models/DB_COMPANY_TOKEN_PLAN_DATE';
44
+ import GlobalMixins from '../mixins/global_mixins.js';
45
+ import moment from 'moment';
46
+ export default
47
+ {
48
+ mixins: [GlobalMixins],
49
+ components:{
50
+ },
51
+ data: () =>
52
+ ({
53
+ pagination: { rowsPerPage: 8 },
54
+ table_loading: true,
55
+ table_data: [],
56
+ public_settings:[],
57
+ date_now:null
58
+ }),
59
+ props:
60
+ {
61
+ plan_id : String,
62
+ },
63
+ async mounted()
64
+ {
65
+ this.date_now = moment();
66
+
67
+ await this.$_getSlotInfo();
68
+ await this.getTableData();
69
+ },
70
+ methods:
71
+ {
72
+ async getTableData()
73
+ {
74
+
75
+ await this.$bind("table_data", new DB_COMPANY_TOKEN_PLAN_DATE(this.plan_id).collection().orderBy('available_date', 'asc'));
76
+
77
+
78
+ this.table_loading = false;
79
+ },
80
+ getHumanDate : function (date)
81
+ {
82
+ return moment(date);
83
+ },
84
+ async claimNow(plan_data)
85
+ {
86
+ this.$q.dialog(
87
+ {
88
+ title: 'Confirm',
89
+ message: 'It may take a couple of minutes to reflect on your wallet. Please confirm.',
90
+ cancel: true,
91
+ persistent: true
92
+ }).onOk(() =>
93
+ {
94
+ this.claimNextStep(plan_data);
95
+ });
96
+ },
97
+ async claimNextStep(plan_data)
98
+ {
99
+ this.$q.loading.show();
100
+ try
101
+ {
102
+ let sendData = {};
103
+ sendData.id = plan_data.id;
104
+ sendData.plan_id = this.plan_id;
105
+
106
+ let res = await this.$_fbCall('memberClaimCompanyTokenEarn', sendData);
107
+ this.$q.loading.hide();
108
+ }
109
+ catch (error)
110
+ {
111
+ this.$q.loading.hide();
112
+ this.$q.dialog({ title: `Something's not quite right`, message: error.message });
113
+ }
114
+ }
115
+ },
116
+ created()
117
+ {
118
+
119
+ }
120
+ }
121
+ </script>
@@ -0,0 +1,9 @@
1
+ import MODEL from './MODEL';
2
+
3
+ export default class DB_COMPANY_TOKEN_PLAN extends MODEL
4
+ {
5
+ constructor()
6
+ {
7
+ super('company_token_plan');
8
+ }
9
+ }
@@ -0,0 +1,9 @@
1
+ import MODEL from './MODEL';
2
+
3
+ export default class DB_COMPANY_TOKEN_PLAN_DATE extends MODEL
4
+ {
5
+ constructor(plan_id)
6
+ {
7
+ super(`company_token_plan/${plan_id}/date`);
8
+ }
9
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "geer-builder",
3
- "version": "1.2.580",
3
+ "version": "1.2.583",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {