fix: allow view supplements to add extra links for profile employee tab
This commit is contained in:
parent
793a15883e
commit
89d7009a18
|
@ -1274,141 +1274,151 @@
|
|||
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div class="buttons">
|
||||
<div style="display: flex; gap: 0.75rem;">
|
||||
|
||||
% if request.has_perm('people_profile.toggle_employee'):
|
||||
% if request.has_perm('people_profile.toggle_employee'):
|
||||
|
||||
<b-button v-if="!employee.current"
|
||||
type="is-primary"
|
||||
@click="startEmployeeInit()">
|
||||
${person} is now an Employee
|
||||
</b-button>
|
||||
<b-button v-if="!employee.current"
|
||||
type="is-primary"
|
||||
@click="startEmployeeInit()">
|
||||
${person} is now an Employee
|
||||
</b-button>
|
||||
|
||||
<b-button v-if="employee.current"
|
||||
type="is-primary"
|
||||
@click="stopEmployeeInit()">
|
||||
${person} is no longer an Employee
|
||||
</b-button>
|
||||
<b-button v-if="employee.current"
|
||||
type="is-primary"
|
||||
@click="stopEmployeeInit()">
|
||||
${person} is no longer an Employee
|
||||
</b-button>
|
||||
|
||||
<${b}-modal has-modal-card
|
||||
% if request.use_oruga:
|
||||
v-model:active="startEmployeeShowDialog"
|
||||
% else:
|
||||
:active.sync="startEmployeeShowDialog"
|
||||
% endif
|
||||
>
|
||||
<div class="modal-card">
|
||||
<${b}-modal has-modal-card
|
||||
% if request.use_oruga:
|
||||
v-model:active="startEmployeeShowDialog"
|
||||
% else:
|
||||
:active.sync="startEmployeeShowDialog"
|
||||
% endif
|
||||
>
|
||||
<div class="modal-card">
|
||||
|
||||
<header class="modal-card-head">
|
||||
<p class="modal-card-title">Employee Start</p>
|
||||
</header>
|
||||
<header class="modal-card-head">
|
||||
<p class="modal-card-title">Employee Start</p>
|
||||
</header>
|
||||
|
||||
<section class="modal-card-body">
|
||||
<b-field label="Employee Number">
|
||||
<b-input v-model="startEmployeeID"></b-input>
|
||||
</b-field>
|
||||
<b-field label="Start Date">
|
||||
<tailbone-datepicker v-model="startEmployeeStartDate"
|
||||
ref="startEmployeeStartDate" />
|
||||
</b-field>
|
||||
</section>
|
||||
<section class="modal-card-body">
|
||||
<b-field label="Employee Number">
|
||||
<b-input v-model="startEmployeeID"></b-input>
|
||||
</b-field>
|
||||
<b-field label="Start Date">
|
||||
<tailbone-datepicker v-model="startEmployeeStartDate"
|
||||
ref="startEmployeeStartDate" />
|
||||
</b-field>
|
||||
</section>
|
||||
|
||||
<footer class="modal-card-foot">
|
||||
<b-button @click="startEmployeeShowDialog = false">
|
||||
Cancel
|
||||
</b-button>
|
||||
<b-button type="is-primary"
|
||||
@click="startEmployeeSave()"
|
||||
:disabled="startEmployeeSaveDisabled"
|
||||
icon-pack="fas"
|
||||
icon-left="save">
|
||||
{{ startEmployeeSaving ? "Working, please wait..." : "Save" }}
|
||||
</b-button>
|
||||
</footer>
|
||||
</div>
|
||||
</${b}-modal>
|
||||
<footer class="modal-card-foot">
|
||||
<b-button @click="startEmployeeShowDialog = false">
|
||||
Cancel
|
||||
</b-button>
|
||||
<b-button type="is-primary"
|
||||
@click="startEmployeeSave()"
|
||||
:disabled="startEmployeeSaveDisabled"
|
||||
icon-pack="fas"
|
||||
icon-left="save">
|
||||
{{ startEmployeeSaving ? "Working, please wait..." : "Save" }}
|
||||
</b-button>
|
||||
</footer>
|
||||
</div>
|
||||
</${b}-modal>
|
||||
|
||||
<${b}-modal has-modal-card
|
||||
% if request.use_oruga:
|
||||
v-model:active="stopEmployeeShowDialog"
|
||||
% else:
|
||||
:active.sync="stopEmployeeShowDialog"
|
||||
% endif
|
||||
>
|
||||
<div class="modal-card">
|
||||
<${b}-modal has-modal-card
|
||||
% if request.use_oruga:
|
||||
v-model:active="stopEmployeeShowDialog"
|
||||
% else:
|
||||
:active.sync="stopEmployeeShowDialog"
|
||||
% endif
|
||||
>
|
||||
<div class="modal-card">
|
||||
|
||||
<header class="modal-card-head">
|
||||
<p class="modal-card-title">Employee End</p>
|
||||
</header>
|
||||
<header class="modal-card-head">
|
||||
<p class="modal-card-title">Employee End</p>
|
||||
</header>
|
||||
|
||||
<section class="modal-card-body">
|
||||
<b-field label="End Date"
|
||||
:type="stopEmployeeEndDate ? null : 'is-danger'">
|
||||
<tailbone-datepicker v-model="stopEmployeeEndDate"></tailbone-datepicker>
|
||||
</b-field>
|
||||
<b-field label="Revoke Internal App Access">
|
||||
<b-checkbox v-model="stopEmployeeRevokeAccess">
|
||||
</b-checkbox>
|
||||
</b-field>
|
||||
</section>
|
||||
<section class="modal-card-body">
|
||||
<b-field label="End Date"
|
||||
:type="stopEmployeeEndDate ? null : 'is-danger'">
|
||||
<tailbone-datepicker v-model="stopEmployeeEndDate"></tailbone-datepicker>
|
||||
</b-field>
|
||||
<b-field label="Revoke Internal App Access">
|
||||
<b-checkbox v-model="stopEmployeeRevokeAccess">
|
||||
</b-checkbox>
|
||||
</b-field>
|
||||
</section>
|
||||
|
||||
<footer class="modal-card-foot">
|
||||
<b-button @click="stopEmployeeShowDialog = false">
|
||||
Cancel
|
||||
</b-button>
|
||||
<b-button type="is-primary"
|
||||
@click="stopEmployeeSave()"
|
||||
:disabled="stopEmployeeSaveDisabled"
|
||||
icon-pack="fas"
|
||||
icon-left="save">
|
||||
{{ stopEmployeeSaving ? "Working, please wait..." : "Save" }}
|
||||
</b-button>
|
||||
</footer>
|
||||
</div>
|
||||
</${b}-modal>
|
||||
% endif
|
||||
<footer class="modal-card-foot">
|
||||
<b-button @click="stopEmployeeShowDialog = false">
|
||||
Cancel
|
||||
</b-button>
|
||||
<b-button type="is-primary"
|
||||
@click="stopEmployeeSave()"
|
||||
:disabled="stopEmployeeSaveDisabled"
|
||||
icon-pack="fas"
|
||||
icon-left="save">
|
||||
{{ stopEmployeeSaving ? "Working, please wait..." : "Save" }}
|
||||
</b-button>
|
||||
</footer>
|
||||
</div>
|
||||
</${b}-modal>
|
||||
% endif
|
||||
|
||||
% if request.has_perm('people_profile.edit_employee_history'):
|
||||
<${b}-modal has-modal-card
|
||||
% if request.use_oruga:
|
||||
v-model:active="editEmployeeHistoryShowDialog"
|
||||
% else:
|
||||
:active.sync="editEmployeeHistoryShowDialog"
|
||||
% endif
|
||||
>
|
||||
<div class="modal-card">
|
||||
% if request.has_perm('people_profile.edit_employee_history'):
|
||||
<${b}-modal has-modal-card
|
||||
% if request.use_oruga:
|
||||
v-model:active="editEmployeeHistoryShowDialog"
|
||||
% else:
|
||||
:active.sync="editEmployeeHistoryShowDialog"
|
||||
% endif
|
||||
>
|
||||
<div class="modal-card">
|
||||
|
||||
<header class="modal-card-head">
|
||||
<p class="modal-card-title">Edit Employee History</p>
|
||||
</header>
|
||||
<header class="modal-card-head">
|
||||
<p class="modal-card-title">Edit Employee History</p>
|
||||
</header>
|
||||
|
||||
<section class="modal-card-body">
|
||||
<b-field label="Start Date">
|
||||
<tailbone-datepicker v-model="editEmployeeHistoryStartDate"></tailbone-datepicker>
|
||||
</b-field>
|
||||
<b-field label="End Date">
|
||||
<tailbone-datepicker v-model="editEmployeeHistoryEndDate"
|
||||
:disabled="!editEmployeeHistoryEndDateRequired">
|
||||
</tailbone-datepicker>
|
||||
</b-field>
|
||||
</section>
|
||||
<section class="modal-card-body">
|
||||
<b-field label="Start Date">
|
||||
<tailbone-datepicker v-model="editEmployeeHistoryStartDate"></tailbone-datepicker>
|
||||
</b-field>
|
||||
<b-field label="End Date">
|
||||
<tailbone-datepicker v-model="editEmployeeHistoryEndDate"
|
||||
:disabled="!editEmployeeHistoryEndDateRequired">
|
||||
</tailbone-datepicker>
|
||||
</b-field>
|
||||
</section>
|
||||
|
||||
<footer class="modal-card-foot">
|
||||
<b-button @click="editEmployeeHistoryShowDialog = false">
|
||||
Cancel
|
||||
</b-button>
|
||||
<b-button type="is-primary"
|
||||
@click="editEmployeeHistorySave()"
|
||||
:disabled="editEmployeeHistorySaveDisabled"
|
||||
icon-pack="fas"
|
||||
icon-left="save">
|
||||
{{ editEmployeeHistorySaving ? "Working, please wait..." : "Save" }}
|
||||
</b-button>
|
||||
</footer>
|
||||
</div>
|
||||
</${b}-modal>
|
||||
% endif
|
||||
<footer class="modal-card-foot">
|
||||
<b-button @click="editEmployeeHistoryShowDialog = false">
|
||||
Cancel
|
||||
</b-button>
|
||||
<b-button type="is-primary"
|
||||
@click="editEmployeeHistorySave()"
|
||||
:disabled="editEmployeeHistorySaveDisabled"
|
||||
icon-pack="fas"
|
||||
icon-left="save">
|
||||
{{ editEmployeeHistorySaving ? "Working, please wait..." : "Save" }}
|
||||
</b-button>
|
||||
</footer>
|
||||
</div>
|
||||
</${b}-modal>
|
||||
% endif
|
||||
|
||||
<div style="display: flex; flex-direction: column; align-items: right; gap: 0.75rem;">
|
||||
|
||||
<b-button v-for="link in employee.external_links"
|
||||
:key="link.url"
|
||||
type="is-primary"
|
||||
tag="a" :href="link.url" target="_blank"
|
||||
icon-pack="fas"
|
||||
icon-left="external-link-alt">
|
||||
{{ link.label }}
|
||||
</b-button>
|
||||
|
||||
% if request.has_perm('employees.view'):
|
||||
<b-button v-if="employee.view_url"
|
||||
|
|
|
@ -803,6 +803,12 @@ class PersonView(MasterView):
|
|||
app = self.get_rattail_app()
|
||||
handler = app.get_employment_handler()
|
||||
context = handler.get_context_employee(employee)
|
||||
context.setdefault('external_links', [])
|
||||
|
||||
for supp in self.iter_view_supplements():
|
||||
if hasattr(supp, 'get_context_for_employee'):
|
||||
context = supp.get_context_for_employee(employee, context)
|
||||
|
||||
context['view_url'] = self.request.route_url('employees.view', uuid=employee.uuid)
|
||||
return context
|
||||
|
||||
|
|
Loading…
Reference in a new issue