Skip to content

Commit

Permalink
Merge pull request #1771 from /issues/1767
Browse files Browse the repository at this point in the history
Issues/1767
  • Loading branch information
Raj6939 authored Nov 21, 2022
2 parents b7b9fc8 + 44c47ae commit 4e54722
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,9 @@ export default {
} else if(isEmpty(this.queryParamAttributeData.fieldPlaceHolder)) {
isValid = false
return this.notifyErr('Enter Label')
} else if (isValidURL(this.queryParamAttributeData.fieldPlaceHolder)) {
isValid = false
return this.notifyErr('Enter Valid Label')
}
return isValid
},
Expand Down Expand Up @@ -830,6 +833,9 @@ export default {
} else if(isEmpty(this.attributeData.fieldPlaceHolder)) {
isValid = false
return this.notifyErr('Enter Label')
} else if (isValidURL(this.attributeData.fieldPlaceHolder)) {
isValid = false
return this.notifyErr('Enter Valid Label')
}
return isValid
},
Expand Down Expand Up @@ -931,6 +937,7 @@ export default {
this.selected.type = "CUSTOM_API_GET"
this.showAttribute = true
this.isGet = true
this.bodyParameterAttributeArray = []
this.isPost = false
} else if(e === "POST") {
this.selected.type = "CUSTOM_API_POST"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,23 @@
</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="Referral Usage Limit is limit for user participant to share the 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">
<tool-tips infoMessage="% of tasks a user must do in order to receieve referral points."></tool-tips><label for="referralPoint" class="col-form-label"
Expand Down
5 changes: 4 additions & 1 deletion src/components/participant/Action.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="accordion mt-3 mx-auto overflow-hidden" role="tablist" style="max-width: 600px"
@click="checkIfUserHasLoggedIn()">
<loading :active.sync="isLoading" :can-cancel="true" :is-full-page="fullPage"></loading>
<Profile v-if="userProfile" :user="userProfile" />
<Profile v-if="userProfile" :user="userProfile" :userReferralCount="userReferralCount" />

<template v-for="(actionItem, index) in ActionSchema">
<component v-if="actionItem.type==='INFO_TEXT'" :is="CapitaliseString(actionItem.type)" :key="index"
Expand Down Expand Up @@ -87,6 +87,9 @@ export default {
required: true,
type: Object,
},
userReferralCount: {
type: Object,
},
authToken: {
required: true,
type: String
Expand Down
8 changes: 4 additions & 4 deletions src/components/participant/ActionInputs/CustomApi.vue
Original file line number Diff line number Diff line change
Expand Up @@ -164,26 +164,26 @@ computed:{
switch (attribute.fieldType) {
case "STRING":
if(attribute.fieldValue === null || attribute.fieldValue === "") {
throw new Error(`Please fill ${attribute.fieldName} field`)
throw new Error(`Please fill ${attribute.fieldPlaceHolder} field`)
}
break;
case "NUMBER":
if(attribute.fieldValue === null || attribute.fieldValue === "") {
throw new Error(`Please fill ${attribute.fieldName} field`)
throw new Error(`Please fill ${attribute.fieldPlaceHolder} field`)
} else if(!Number.isInteger(parseFloat((attribute.fieldValue)))) {
throw new Error('Enter Integer value')
}
break;
case "FLOAT":
if(attribute.fieldValue === null || attribute.fieldValue === "") {
throw new Error(`Please fill ${attribute.fieldName} field`)
throw new Error(`Please fill ${attribute.fieldPlaceHolder} field`)
} else if(!isFloat(attribute.fieldValue)) {
throw new Error('Enter Float value')
}
break;
case "BOOLEAN":
if(attribute.fieldValue === null) {
throw new Error(`Please fill ${attribute.fieldName} field`)
throw new Error(`Please fill ${attribute.fieldPlaceHolder} field`)
}
break;
default:
Expand Down
14 changes: 13 additions & 1 deletion src/components/participant/ActionInputs/Profile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
><i class="far fa-copy"></i
></span>
</div>
</b-col>
<small class="countCss">Valid Upto {{userReferralCount.count}} referrals</small>
</b-col>
</b-row>
</b-card-body>
</b-collapse>
Expand All @@ -48,6 +49,14 @@
cursor: pointer;
color: grey;
}
.countCss{
font-weight: 520;
font-size: 11px;
line-height: 20px;
letter-spacing: 0.2px;
color: #252733;
opacity: 0.6;
}
</style>
<script>
import notificationMixin from "../../../mixins/notificationMixins";
Expand All @@ -60,6 +69,9 @@ export default {
required: true,
type: Object,
},
userReferralCount: {
type: Object,
}
},
data() {
return {
Expand Down
14 changes: 13 additions & 1 deletion src/views/admin/Events.vue
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,7 @@ export default {
tags: [],
slug: "",
referralDifficulty:30,
referralUsageLimit:10
},
DeleteId:"",
projectToDelete:"",
Expand Down Expand Up @@ -1243,7 +1244,16 @@ export default {
) {
throw new Error(Messages.EVENTS.REF_POINT.NOT_POS_INP);
}
if (
isNaN(parseInt(this.project.referralUsageLimit))
) {
throw new Error('Enter valid usage limit')
}
if (
parseInt(this.project.referralUsageLimit) < 0
) {
throw new Error('Enter Usage Limit should be positive number')
}
//this.isLoading = true;
const url = `${this.$config.studioServer.BASE_URL}api/v1/project`;
let headers = {
Expand Down Expand Up @@ -1272,6 +1282,7 @@ export default {
this.project.tags = this.tagsTemp;
this.project.refereePoint = this.project.refereePoint.toString();
this.project.referralPoint = this.project.referralPoint.toString();
this.project.referralUsageLimit = this.project.referralUsageLimit.toString();
const resp = await apiClientMixin.makeCall({
url,
body: this.project,
Expand Down Expand Up @@ -1435,6 +1446,7 @@ export default {
referralPoint: 5,
tags: [],
referralDifficulty:30,
referralUsageLimit:10,
}),
this.DeleteId="",
this.projectToDelete="";
Expand Down
11 changes: 10 additions & 1 deletion src/views/participant/Event.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

<template>
<Action v-if="eventData.projectStatus"
:userReferralCount="userReferralCount"
:userProfile="Object.keys(userProfileData).length > 0 ? userProfileData : null"
:ActionSchema="eventActionsToShow" :authToken="authToken" :prizeData="prizeData"
@UserUpdateEvent="updateUserData" :themeData="eventData.orgData" />
Expand Down Expand Up @@ -72,6 +73,10 @@ export default {
authToken: "",
externalUserId:"",
userEventData: null,
userReferralCount:{
count:0,
usageCount:0
},
userAuthData: null,
eventActionsToShow: [],
eventSlug: "",
Expand Down Expand Up @@ -219,7 +224,7 @@ export default {
this.eventData = {
...resp.data
}
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']){
this.eventData['orgData'] = {}
Expand Down Expand Up @@ -324,6 +329,10 @@ export default {
this.userEventData = {
...res.data[0]
}
if(this.eventData.referralUsageLimit && this.userEventData.referralCount >= 0) {
this.userReferralCount.count = 0;
this.userReferralCount.count = this.eventData.referralUsageLimit - this.userEventData.referralCount
}
this.prizeData=this.eventData.actions.filter((x) => {
Expand Down

0 comments on commit 4e54722

Please sign in to comment.