Skip to content

Commit

Permalink
Merge pull request #1785 from hypersign-protocol/stage
Browse files Browse the repository at this point in the history
Stage
  • Loading branch information
varsha766 authored Nov 23, 2022
2 parents 5106271 + a38203d commit c2d28f4
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@
placeholder="Field label for user input">
</div>
</div>
<div class="form-group row mt-4" v-if="isAdd">
<div class="form-group row mt-4" v-if="isAddForQuerry">
<div class="col-sm-10">
<hf-buttons
name="Add"
Expand Down Expand Up @@ -556,7 +556,8 @@ export default {
attrFlash:null,
selectedId:null,
showAttribute:false,
isAdd:true,
isAdd: true,
isAddForQuerry:true,
visible:false,
counter:0,
isGet:false,
Expand Down Expand Up @@ -708,7 +709,7 @@ export default {
let temp = [ ...this.queryParameterAttributeArray]
const index = temp.findIndex((x)=> x.fieldName === this.querryAttrFlash)
if(temp.length!==0){
if(this.isAdd === false){
if(this.isAddForQuerry === false){
temp.splice(index,1)
}
const element = temp.find((value) => {
Expand Down Expand Up @@ -752,7 +753,7 @@ export default {
let updateData = found
// this.selectedAttrId = id
this.queryParamAttributeData = { ...updateData}
this.isAdd = false
this.isAddForQuerry = false
},
updateQueryParamAttributeData() {
let isValid = this.handleQueryParamValidation()
Expand All @@ -767,7 +768,7 @@ export default {
if(indexToUpdate > -1){
this.queryParameterAttributeArray[indexToUpdate] = obj
this.clearQuerryAttributeData()
this.isAdd = true
this.isAddForQuerry = true
this.modifyAPIEnpoint()
}
}
Expand All @@ -779,7 +780,7 @@ export default {
this.queryParameterAttributeArray.splice(attrIndex,1)
}
this.clearQuerryAttributeData()
this.isAdd = true
this.isAddForQuerry = true
this.modifyAPIEnpoint()
},
addBodyParamAttributesToBox() {
Expand Down Expand Up @@ -970,6 +971,7 @@ export default {
clearSelected() {
this.visible = false
this.isAdd = true
this.isAddForQuerry = true
// this.isGet = false,
// this.isPost = false,
this.isBoolean = false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@
background: #fcedc8; /* Green background */
cursor: pointer; /* Cursor on hover */
}
.usageDiv {
height: calc(1.5em + 0.75rem + 2px);
padding: 0.375rem 0.75rem;
}
.alignDiv{
display: inline-flex;
}
</style>

<template>
Expand All @@ -61,7 +68,7 @@
>Referral Points<span style="color: red">*</span>:
</label>
</div>
<div class=" col-lg-7 col-md-7 px-0">
<div class="col-lg-7 col-md-7 px-0">
<input
v-model="project.referralPoint"
type="number"
Expand All @@ -72,22 +79,6 @@
</div>
</div>

<div class="row g-3 align-items-center w-100 mt-4">
<div class="col-lg-5 col-md-5 text-left">
<tool-tips infoMessage="Number of participants can use a referral link"></tool-tips><label for="referralUsageLimit" class="col-form-label"
>Referral Usage Limit<span style="color: red">*</span>:
</label>
</div>
<div class=" col-lg-7 col-md-7 px-0">
<input
v-model="project.referralUsageLimit"
type="number"
placeholder=""
id="referralUsageLimit"
class="form-control w-100"
/>
</div>
</div>

<div class="row g-3 align-items-center w-100 mt-4">
<div class="col-lg-5 col-md-5 text-left">
Expand All @@ -111,6 +102,27 @@

</div>
</div>
<div class="row g-3 align-items-center w-100 mt-4">
<div class="text-left col-lg-5 col-md-5 text-left usageDiv">
<tool-tips infoMessage="Number of participants can use a referral link"></tool-tips>
<label for="referralUsageLimit"
>Referral Limit:</label>
</div>
<div class="col-lg-6 col-md-6 w-100 px-0 align-items-center alignDiv">
<div class="col-lg-2 col-md-2 px-0">
<b-form-checkbox v-model="project.isReferralLimitEnabled" name="check-button" switch></b-form-checkbox>
</div>
<div class="col-lg-12 col-md-6 pr-1 text-right px-0"
v-if="project.isReferralLimitEnabled === true">
<input
v-model="project.referralUsageLimit"
type="number"
id="referralUsageLimit"
class="form-control w-100"
/>
</div>
</div>
</div>
</div>
</template>

Expand Down
34 changes: 28 additions & 6 deletions src/components/participant/ActionInputs/Profile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,15 @@
<div class="text text-left">
{{ truncate1(referalLink,25) }}
<span @click="copy" class="copy"
v-if="userReferralCount.count !==0"
v-if="showCopyIcon"
><i class="far fa-copy"></i
></span>
</div>
<div v-if="userReferralCount.isReferralLimitEnabled === true">
<small class="countCss" v-if="userReferralCount.count == null">Valid Upto {{userReferralCount.usageCount}} referrals</small>
<small class="countCss" v-else-if="userReferralCount.count >0 ">Valid Upto {{userReferralCount.count}} referrals</small>
<small class="countCss" v-else>Referral link expired</small>
<small class="expiredText" v-else>Referral link expired!</small>
</div>
</b-col>
</b-row>
</b-card-body>
Expand All @@ -46,19 +48,27 @@
</template>

<style scoped>
.expiredText{
font-weight: 510;
font-size: 10px;
line-height: 20px;
letter-spacing: 0.2px;
color: #e4181e;
opacity: 0.7;
}
.copy {
padding: 4px;
font-size: large;
cursor: pointer;
color: grey;
}
.countCss{
font-weight: 520;
font-size: 11px;
font-weight: 510;
font-size: 10px;
line-height: 20px;
letter-spacing: 0.2px;
color: #252733;
opacity: 0.6;
color: #01411C;
opacity: 0.7;
}
</style>
<script>
Expand All @@ -76,6 +86,18 @@ export default {
type: Object,
}
},
computed: {
showCopyIcon() {
if (this.userReferralCount.count < 0 && this.userReferralCount.isReferralLimitEnabled === true) {
return false
}else if((this.userReferralCount.count !==0||this.userReferralCount.usageCount === undefined)
|| (this.userReferralCount.isReferralLimitEnabled === false)) {
return true
} else {
return false
}
}
},
data() {
return {
visible: false,
Expand Down
38 changes: 29 additions & 9 deletions src/views/admin/Events.vue
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,7 @@ import {
checkTitle,
checkValue,
isValidSlug,
isFloat
} from "../../mixins/fieldValidationMixin.js";
import CreateProjectSlide from "../../components/admin/createProjectSlider/CreateProjectSlide.vue";
import dayjs from "dayjs";
Expand Down Expand Up @@ -474,6 +475,7 @@ export default {
fromDate: "",
toDate: "",
isNotificaionEnabled: false,
isReferralLimitEnabled: false,
ownerDid: "did:hs:QWERTlkasd090123SWEE12322",
investorsCount: 0,
social: {},
Expand All @@ -484,7 +486,7 @@ export default {
tags: [],
slug: "",
referralDifficulty:30,
referralUsageLimit:10
referralUsageLimit:10,
},
DeleteId:"",
projectToDelete:"",
Expand Down Expand Up @@ -916,6 +918,10 @@ export default {
// return new Date(d).toLocaleString();
},
editProject(project) {
if(!project.isReferralLimitEnabled && !project.referralUsageLimit) { // making this for old events since "project.isReferralLimitEnabled" & "project.referralUsageLimit" are not there
project['isReferralLimitEnabled'] = false
project['referralUsageLimit'] = 10
}
eventBus.$emit("resetForFresh")
this.resetAllValues();
this.isProjectEditing = true;
Expand Down Expand Up @@ -978,6 +984,10 @@ export default {
},
async cloneProject(project) {
if(!project.isReferralLimitEnabled && !project.referralUsageLimit) { // making this for old events
project['isReferralLimitEnabled'] = false
project['referralUsageLimit'] = 10
}
this.resetAllValues();
this.isProjectEditing = false;
this.isProjectClonning = true;
Expand Down Expand Up @@ -1040,13 +1050,16 @@ export default {
let index = this.eventActionList
.map((action) => action.title)
.indexOf("Hypersign Authentication");
this.eventActionList.splice(index, 1);
index = this.eventActionList
if(index >-1 ) {
this.eventActionList.splice(index, 1);
}
let indexToFindNotification = this.eventActionList
.map((action) => action.title)
.indexOf("Subscribe Notification");
this.eventActionList.splice(index, 1);
this.tagsTemp = project.tags;
if(indexToFindNotification > -1) {
this.eventActionList.splice(indexToFindNotification, 1);
}
this.tagsTemp = project.tags;
await this.saveProject();
},
async handlePaginateByProjectName(namePaginate) {
Expand Down Expand Up @@ -1244,15 +1257,21 @@ export default {
) {
throw new Error(Messages.EVENTS.REF_POINT.NOT_POS_INP);
}
if (
if(this.project.isReferralLimitEnabled === true) {
if (
isNaN(parseInt(this.project.referralUsageLimit))
) {
throw new Error('Enter valid usage limit')
throw new Error('Enter valid Referral Usage Limit')
}
if (
parseInt(this.project.referralUsageLimit) < 0
) {
throw new Error('Enter Usage Limit should be positive number')
throw new Error('Enter Referral Usage Limit should be positive number')
}
if (isFloat(this.project.referralUsageLimit)
) {
throw new Error('Referral Usage Limit should be Positive Integer')
}
}
//this.isLoading = true;
const url = `${this.$config.studioServer.BASE_URL}api/v1/project`;
Expand Down Expand Up @@ -1447,6 +1466,7 @@ export default {
tags: [],
referralDifficulty:30,
referralUsageLimit:10,
isReferralLimitEnabled:false
}),
this.DeleteId="",
this.projectToDelete="";
Expand Down
6 changes: 4 additions & 2 deletions src/views/participant/Event.vue
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ export default {
userEventData: null,
userReferralCount:{
count:0,
usageCount:0
usageCount:0,
isReferralLimitEnabled:false
},
userAuthData: null,
eventActionsToShow: [],
Expand Down Expand Up @@ -223,7 +224,8 @@ export default {
const resp = await apiClient.makeCall({ method: "GET", url: url, header: headers })
this.eventData = {
...resp.data
}
}
this.userReferralCount.isReferralLimitEnabled = this.eventData.isReferralLimitEnabled
this.userReferralCount.usageCount = this.eventData.referralUsageLimit
// If it is old event then just recreating this variable using default values from config
if (!this.eventData['orgData']){
Expand Down

0 comments on commit c2d28f4

Please sign in to comment.