fix: include edit profile email/phone dialogs only if user has perms

otherwise we get JS errors when page loads
This commit is contained in:
Lance Edgar 2024-07-02 14:14:15 -05:00
parent d72d6f8c7c
commit 1f38894f02

View file

@ -461,72 +461,75 @@
</${b}-table>
<${b}-modal has-modal-card
% if request.use_oruga:
v-model:active="deletePhoneShowDialog"
% else:
:active.sync="deletePhoneShowDialog"
% endif
>
<div class="modal-card">
% if request.has_perm('people_profile.edit_person'):
<header class="modal-card-head">
<p class="modal-card-title">Delete Phone</p>
</header>
<${b}-modal has-modal-card
% if request.use_oruga:
v-model:active="deletePhoneShowDialog"
% else:
:active.sync="deletePhoneShowDialog"
% endif
>
<div class="modal-card">
<section class="modal-card-body">
<p class="block">Really delete this phone number?</p>
<p class="block has-text-weight-bold">{{ deletePhoneNumber }}</p>
</section>
<header class="modal-card-head">
<p class="modal-card-title">Delete Phone</p>
</header>
<footer class="modal-card-foot">
<b-button type="is-danger"
@click="deletePhoneSave()"
:disabled="deletePhoneSaving"
icon-pack="fas"
icon-left="trash">
{{ deletePhoneSaving ? "Working, please wait..." : "Delete" }}
</b-button>
<b-button @click="deletePhoneShowDialog = false">
Cancel
</b-button>
</footer>
</div>
</${b}-modal>
<section class="modal-card-body">
<p class="block">Really delete this phone number?</p>
<p class="block has-text-weight-bold">{{ deletePhoneNumber }}</p>
</section>
<${b}-modal has-modal-card
% if request.use_oruga:
v-model:active="preferPhoneShowDialog"
% else:
:active.sync="preferPhoneShowDialog"
% endif
>
<div class="modal-card">
<footer class="modal-card-foot">
<b-button type="is-danger"
@click="deletePhoneSave()"
:disabled="deletePhoneSaving"
icon-pack="fas"
icon-left="trash">
{{ deletePhoneSaving ? "Working, please wait..." : "Delete" }}
</b-button>
<b-button @click="deletePhoneShowDialog = false">
Cancel
</b-button>
</footer>
</div>
</${b}-modal>
<header class="modal-card-head">
<p class="modal-card-title">Set Preferred Phone</p>
</header>
<${b}-modal has-modal-card
% if request.use_oruga:
v-model:active="preferPhoneShowDialog"
% else:
:active.sync="preferPhoneShowDialog"
% endif
>
<div class="modal-card">
<section class="modal-card-body">
<p class="block">Really make this the preferred phone number?</p>
<p class="block has-text-weight-bold">{{ preferPhoneNumber }}</p>
</section>
<header class="modal-card-head">
<p class="modal-card-title">Set Preferred Phone</p>
</header>
<footer class="modal-card-foot">
<b-button type="is-primary"
@click="preferPhoneSave()"
:disabled="preferPhoneSaving"
icon-pack="fas"
icon-left="save">
{{ preferPhoneSaving ? "Working, please wait..." : "Set Preferred" }}
</b-button>
<b-button @click="preferPhoneShowDialog = false">
Cancel
</b-button>
</footer>
</div>
</${b}-modal>
<section class="modal-card-body">
<p class="block">Really make this the preferred phone number?</p>
<p class="block has-text-weight-bold">{{ preferPhoneNumber }}</p>
</section>
<footer class="modal-card-foot">
<b-button type="is-primary"
@click="preferPhoneSave()"
:disabled="preferPhoneSaving"
icon-pack="fas"
icon-left="save">
{{ preferPhoneSaving ? "Working, please wait..." : "Set Preferred" }}
</b-button>
<b-button @click="preferPhoneShowDialog = false">
Cancel
</b-button>
</footer>
</div>
</${b}-modal>
% endif
</div>
</div>
</div>
@ -694,72 +697,75 @@
</${b}-table>
<${b}-modal has-modal-card
% if request.use_oruga:
v-model:active="deleteEmailShowDialog"
% else:
:active.sync="deleteEmailShowDialog"
% endif
>
<div class="modal-card">
% if request.has_perm('people_profile.edit_person'):
<header class="modal-card-head">
<p class="modal-card-title">Delete Email</p>
</header>
<${b}-modal has-modal-card
% if request.use_oruga:
v-model:active="deleteEmailShowDialog"
% else:
:active.sync="deleteEmailShowDialog"
% endif
>
<div class="modal-card">
<section class="modal-card-body">
<p class="block">Really delete this email address?</p>
<p class="block has-text-weight-bold">{{ deleteEmailAddress }}</p>
</section>
<header class="modal-card-head">
<p class="modal-card-title">Delete Email</p>
</header>
<footer class="modal-card-foot">
<b-button type="is-danger"
@click="deleteEmailSave()"
:disabled="deleteEmailSaving"
icon-pack="fas"
icon-left="trash">
{{ deleteEmailSaving ? "Working, please wait..." : "Delete" }}
</b-button>
<b-button @click="deleteEmailShowDialog = false">
Cancel
</b-button>
</footer>
</div>
</${b}-modal>
<section class="modal-card-body">
<p class="block">Really delete this email address?</p>
<p class="block has-text-weight-bold">{{ deleteEmailAddress }}</p>
</section>
<${b}-modal has-modal-card
% if request.use_oruga:
v-model:active="preferEmailShowDialog"
% else:
:active.sync="preferEmailShowDialog"
% endif
>
<div class="modal-card">
<footer class="modal-card-foot">
<b-button type="is-danger"
@click="deleteEmailSave()"
:disabled="deleteEmailSaving"
icon-pack="fas"
icon-left="trash">
{{ deleteEmailSaving ? "Working, please wait..." : "Delete" }}
</b-button>
<b-button @click="deleteEmailShowDialog = false">
Cancel
</b-button>
</footer>
</div>
</${b}-modal>
<header class="modal-card-head">
<p class="modal-card-title">Set Preferred Email</p>
</header>
<${b}-modal has-modal-card
% if request.use_oruga:
v-model:active="preferEmailShowDialog"
% else:
:active.sync="preferEmailShowDialog"
% endif
>
<div class="modal-card">
<section class="modal-card-body">
<p class="block">Really make this the preferred email address?</p>
<p class="block has-text-weight-bold">{{ preferEmailAddress }}</p>
</section>
<header class="modal-card-head">
<p class="modal-card-title">Set Preferred Email</p>
</header>
<footer class="modal-card-foot">
<b-button type="is-primary"
@click="preferEmailSave()"
:disabled="preferEmailSaving"
icon-pack="fas"
icon-left="save">
{{ preferEmailSaving ? "Working, please wait..." : "Set Preferred" }}
</b-button>
<b-button @click="preferEmailShowDialog = false">
Cancel
</b-button>
</footer>
</div>
</${b}-modal>
<section class="modal-card-body">
<p class="block">Really make this the preferred email address?</p>
<p class="block has-text-weight-bold">{{ preferEmailAddress }}</p>
</section>
<footer class="modal-card-foot">
<b-button type="is-primary"
@click="preferEmailSave()"
:disabled="preferEmailSaving"
icon-pack="fas"
icon-left="save">
{{ preferEmailSaving ? "Working, please wait..." : "Set Preferred" }}
</b-button>
<b-button @click="preferEmailShowDialog = false">
Cancel
</b-button>
</footer>
</div>
</${b}-modal>
% endif
</div>
</div>
</div>