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