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>
|
<div style="display: flex; gap: 0.75rem;">
|
||||||
<div class="buttons">
|
|
||||||
|
|
||||||
% if request.has_perm('people_profile.toggle_employee'):
|
% if request.has_perm('people_profile.toggle_employee'):
|
||||||
|
|
||||||
<b-button v-if="!employee.current"
|
<b-button v-if="!employee.current"
|
||||||
type="is-primary"
|
type="is-primary"
|
||||||
@click="startEmployeeInit()">
|
@click="startEmployeeInit()">
|
||||||
${person} is now an Employee
|
${person} is now an Employee
|
||||||
</b-button>
|
</b-button>
|
||||||
|
|
||||||
<b-button v-if="employee.current"
|
<b-button v-if="employee.current"
|
||||||
type="is-primary"
|
type="is-primary"
|
||||||
@click="stopEmployeeInit()">
|
@click="stopEmployeeInit()">
|
||||||
${person} is no longer an Employee
|
${person} is no longer an Employee
|
||||||
</b-button>
|
</b-button>
|
||||||
|
|
||||||
<${b}-modal has-modal-card
|
<${b}-modal has-modal-card
|
||||||
% if request.use_oruga:
|
% if request.use_oruga:
|
||||||
v-model:active="startEmployeeShowDialog"
|
v-model:active="startEmployeeShowDialog"
|
||||||
% else:
|
% else:
|
||||||
:active.sync="startEmployeeShowDialog"
|
:active.sync="startEmployeeShowDialog"
|
||||||
% endif
|
% endif
|
||||||
>
|
>
|
||||||
<div class="modal-card">
|
<div class="modal-card">
|
||||||
|
|
||||||
<header class="modal-card-head">
|
<header class="modal-card-head">
|
||||||
<p class="modal-card-title">Employee Start</p>
|
<p class="modal-card-title">Employee Start</p>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<section class="modal-card-body">
|
<section class="modal-card-body">
|
||||||
<b-field label="Employee Number">
|
<b-field label="Employee Number">
|
||||||
<b-input v-model="startEmployeeID"></b-input>
|
<b-input v-model="startEmployeeID"></b-input>
|
||||||
</b-field>
|
</b-field>
|
||||||
<b-field label="Start Date">
|
<b-field label="Start Date">
|
||||||
<tailbone-datepicker v-model="startEmployeeStartDate"
|
<tailbone-datepicker v-model="startEmployeeStartDate"
|
||||||
ref="startEmployeeStartDate" />
|
ref="startEmployeeStartDate" />
|
||||||
</b-field>
|
</b-field>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<footer class="modal-card-foot">
|
<footer class="modal-card-foot">
|
||||||
<b-button @click="startEmployeeShowDialog = false">
|
<b-button @click="startEmployeeShowDialog = false">
|
||||||
Cancel
|
Cancel
|
||||||
</b-button>
|
</b-button>
|
||||||
<b-button type="is-primary"
|
<b-button type="is-primary"
|
||||||
@click="startEmployeeSave()"
|
@click="startEmployeeSave()"
|
||||||
:disabled="startEmployeeSaveDisabled"
|
:disabled="startEmployeeSaveDisabled"
|
||||||
icon-pack="fas"
|
icon-pack="fas"
|
||||||
icon-left="save">
|
icon-left="save">
|
||||||
{{ startEmployeeSaving ? "Working, please wait..." : "Save" }}
|
{{ startEmployeeSaving ? "Working, please wait..." : "Save" }}
|
||||||
</b-button>
|
</b-button>
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
</${b}-modal>
|
</${b}-modal>
|
||||||
|
|
||||||
<${b}-modal has-modal-card
|
<${b}-modal has-modal-card
|
||||||
% if request.use_oruga:
|
% if request.use_oruga:
|
||||||
v-model:active="stopEmployeeShowDialog"
|
v-model:active="stopEmployeeShowDialog"
|
||||||
% else:
|
% else:
|
||||||
:active.sync="stopEmployeeShowDialog"
|
:active.sync="stopEmployeeShowDialog"
|
||||||
% endif
|
% endif
|
||||||
>
|
>
|
||||||
<div class="modal-card">
|
<div class="modal-card">
|
||||||
|
|
||||||
<header class="modal-card-head">
|
<header class="modal-card-head">
|
||||||
<p class="modal-card-title">Employee End</p>
|
<p class="modal-card-title">Employee End</p>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<section class="modal-card-body">
|
<section class="modal-card-body">
|
||||||
<b-field label="End Date"
|
<b-field label="End Date"
|
||||||
:type="stopEmployeeEndDate ? null : 'is-danger'">
|
:type="stopEmployeeEndDate ? null : 'is-danger'">
|
||||||
<tailbone-datepicker v-model="stopEmployeeEndDate"></tailbone-datepicker>
|
<tailbone-datepicker v-model="stopEmployeeEndDate"></tailbone-datepicker>
|
||||||
</b-field>
|
</b-field>
|
||||||
<b-field label="Revoke Internal App Access">
|
<b-field label="Revoke Internal App Access">
|
||||||
<b-checkbox v-model="stopEmployeeRevokeAccess">
|
<b-checkbox v-model="stopEmployeeRevokeAccess">
|
||||||
</b-checkbox>
|
</b-checkbox>
|
||||||
</b-field>
|
</b-field>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<footer class="modal-card-foot">
|
<footer class="modal-card-foot">
|
||||||
<b-button @click="stopEmployeeShowDialog = false">
|
<b-button @click="stopEmployeeShowDialog = false">
|
||||||
Cancel
|
Cancel
|
||||||
</b-button>
|
</b-button>
|
||||||
<b-button type="is-primary"
|
<b-button type="is-primary"
|
||||||
@click="stopEmployeeSave()"
|
@click="stopEmployeeSave()"
|
||||||
:disabled="stopEmployeeSaveDisabled"
|
:disabled="stopEmployeeSaveDisabled"
|
||||||
icon-pack="fas"
|
icon-pack="fas"
|
||||||
icon-left="save">
|
icon-left="save">
|
||||||
{{ stopEmployeeSaving ? "Working, please wait..." : "Save" }}
|
{{ stopEmployeeSaving ? "Working, please wait..." : "Save" }}
|
||||||
</b-button>
|
</b-button>
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
</${b}-modal>
|
</${b}-modal>
|
||||||
% endif
|
% endif
|
||||||
|
|
||||||
% if request.has_perm('people_profile.edit_employee_history'):
|
% if request.has_perm('people_profile.edit_employee_history'):
|
||||||
<${b}-modal has-modal-card
|
<${b}-modal has-modal-card
|
||||||
% if request.use_oruga:
|
% if request.use_oruga:
|
||||||
v-model:active="editEmployeeHistoryShowDialog"
|
v-model:active="editEmployeeHistoryShowDialog"
|
||||||
% else:
|
% else:
|
||||||
:active.sync="editEmployeeHistoryShowDialog"
|
:active.sync="editEmployeeHistoryShowDialog"
|
||||||
% endif
|
% endif
|
||||||
>
|
>
|
||||||
<div class="modal-card">
|
<div class="modal-card">
|
||||||
|
|
||||||
<header class="modal-card-head">
|
<header class="modal-card-head">
|
||||||
<p class="modal-card-title">Edit Employee History</p>
|
<p class="modal-card-title">Edit Employee History</p>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<section class="modal-card-body">
|
<section class="modal-card-body">
|
||||||
<b-field label="Start Date">
|
<b-field label="Start Date">
|
||||||
<tailbone-datepicker v-model="editEmployeeHistoryStartDate"></tailbone-datepicker>
|
<tailbone-datepicker v-model="editEmployeeHistoryStartDate"></tailbone-datepicker>
|
||||||
</b-field>
|
</b-field>
|
||||||
<b-field label="End Date">
|
<b-field label="End Date">
|
||||||
<tailbone-datepicker v-model="editEmployeeHistoryEndDate"
|
<tailbone-datepicker v-model="editEmployeeHistoryEndDate"
|
||||||
:disabled="!editEmployeeHistoryEndDateRequired">
|
:disabled="!editEmployeeHistoryEndDateRequired">
|
||||||
</tailbone-datepicker>
|
</tailbone-datepicker>
|
||||||
</b-field>
|
</b-field>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<footer class="modal-card-foot">
|
<footer class="modal-card-foot">
|
||||||
<b-button @click="editEmployeeHistoryShowDialog = false">
|
<b-button @click="editEmployeeHistoryShowDialog = false">
|
||||||
Cancel
|
Cancel
|
||||||
</b-button>
|
</b-button>
|
||||||
<b-button type="is-primary"
|
<b-button type="is-primary"
|
||||||
@click="editEmployeeHistorySave()"
|
@click="editEmployeeHistorySave()"
|
||||||
:disabled="editEmployeeHistorySaveDisabled"
|
:disabled="editEmployeeHistorySaveDisabled"
|
||||||
icon-pack="fas"
|
icon-pack="fas"
|
||||||
icon-left="save">
|
icon-left="save">
|
||||||
{{ editEmployeeHistorySaving ? "Working, please wait..." : "Save" }}
|
{{ editEmployeeHistorySaving ? "Working, please wait..." : "Save" }}
|
||||||
</b-button>
|
</b-button>
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
</${b}-modal>
|
</${b}-modal>
|
||||||
% endif
|
% 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'):
|
% if request.has_perm('employees.view'):
|
||||||
<b-button v-if="employee.view_url"
|
<b-button v-if="employee.view_url"
|
||||||
|
|
|
@ -803,6 +803,12 @@ class PersonView(MasterView):
|
||||||
app = self.get_rattail_app()
|
app = self.get_rattail_app()
|
||||||
handler = app.get_employment_handler()
|
handler = app.get_employment_handler()
|
||||||
context = handler.get_context_employee(employee)
|
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)
|
context['view_url'] = self.request.route_url('employees.view', uuid=employee.uuid)
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue