Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(sms-limiting): ui changes for modal #2541

Merged
merged 5 commits into from
Aug 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ function PopUpModalController($uibModalInstance, externalScope) {
vm.description = externalScope.description
vm.confirmButtonText = externalScope.confirmButtonText
vm.cancelButtonText = externalScope.cancelButtonText
vm.isImportant = externalScope.isImportant
vm.cancel = $uibModalInstance.close

vm.confirm = function () {
Expand Down
4 changes: 4 additions & 0 deletions src/public/modules/forms/admin/css/edit-form.css
Original file line number Diff line number Diff line change
Expand Up @@ -1437,3 +1437,7 @@ a.modal-cancel-btn:hover {
display: flex;
justify-content: flex-end;
}

.sms-counts {
color: #484848;
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
<div class="row">
<div class="toggle-option">
<div class="toggle-option label-bottom">
<div
ng-class="{'toggle-option--disabled' : field.hasAdminExceededSmsLimit || field.hasRetrievalError}"
class="col-xs-8 label-custom label-medium label-bottom"
class="col-xs-8"
>
OTP verification
<i
class="glyphicon glyphicon-question-sign"
uib-tooltip="When enabled, respondents must verify by entering a code sent to their mobile number"
tooltip-trigger="'click mouseenter'"
></i>
<div class="label-custom label-medium">
OTP verification
<i
class="glyphicon glyphicon-question-sign"
uib-tooltip="When enabled, respondents must verify by entering a code sent to their mobile number"
tooltip-trigger="'click mouseenter'"
></i>
</div>
<div ng-show="!isLoading && !field.hasRetrievalError">
<small class="sms-counts"
>{{verifiedSmsCount}}/{{smsVerificationLimit}} SMSes used</small
>
</div>
</div>
<div class="col-xs-4 field-input">
<div ng-show="isLoading" class="loading-spinner">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ function configureMobileDirective() {
form: '<',
name: '=',
characterLimit: '=',
smsVerificationLimit: '=',
verifiedSmsCount: '=',
isLoading: '<',
},
controller: [
Expand Down Expand Up @@ -66,7 +68,7 @@ function configureMobileDirective() {
AdminMetaService.getFreeSmsCountsUsedByFormAdmin($scope.form._id),
)
.then(({ quota, freeSmsCounts }) => {
$scope.verifiedSmsCount = freeSmsCounts
$scope.verifiedSmsCount = formatStringAsNumber(freeSmsCounts)
$scope.adminVerifiedSmsState = getAdminVerifiedSmsState(
freeSmsCounts,
$scope.form.msgSrvcName,
Expand Down Expand Up @@ -117,27 +119,23 @@ function configureMobileDirective() {
externalScope: function () {
return {
title: `OTP verification will be disabled at ${$scope.smsVerificationLimit} responses`,
confirmButtonText: 'Accept',
confirmButtonText: 'I understand',
description: `
We provide SMS OTP verification for free up to ${
$scope.smsVerificationLimit
} responses. OTP verification will be automatically disabled when your account reaches ${
$scope.smsVerificationLimit
} responses.
We provide ${$scope.smsVerificationLimit} free SMS OTP verifications per account, only counting owned forms.

Once this limit is reached, SMS OTP verification will be automatically disabled for all owned forms.

<br></br>

If you are a collaborator, ensure the form's owner has enough free verifications.

<br></br>
If you require OTP verification for more than ${
$scope.smsVerificationLimit
} responses,
<a href=${
$scope.verifiedSmsSetupLink
} target="_blank" class=""> please arrange advance billing with us. </a>

If you require more than ${$scope.smsVerificationLimit} verifications, please <a href=${$scope.verifiedSmsSetupLink} target="_blank" class=""> arrange advance billing with us. </a>

<br></br>
<small>Current response count: ${formatStringAsNumber(
$scope.verifiedSmsCount,
)}/${$scope.smsVerificationLimit}</small>
<small>Current response count: ${$scope.verifiedSmsCount}/${$scope.smsVerificationLimit}</small>
`,
isImportant: true,
}
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<button
type="submit"
ng-click="vm.confirm()"
ng-class="vm.isImportant ? 'red-bg-dark' : 'modal-save-btn'"
ng-class="modal-save-btn"
class="btn-custom btn-medium"
>
{{ vm.confirmButtonText || 'OK' }}
Expand Down