[IMP] partner_profiles_portal: add positions details in portal

Adds several portal views to consult all the positions of a structure,
and their details.
This commit is contained in:
Stéphan Sainléger
2023-06-13 16:06:47 +02:00
committed by Stéphan Sainléger
parent 95ddef62c3
commit 43d21befbf
9 changed files with 500 additions and 10 deletions

View File

@@ -24,6 +24,14 @@
</button>
</a>
</div>
<div
id="positions" t-if="user_id.partner_id.is_company">
<a t-attf-href="/my/positions">
<button class="btn btn-primary mb8">
My positions
</button>
</a>
</div>
</div>
</div>
</xpath>

View File

@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="portal_my_positions" name="My Positions">
<t t-call="portal.portal_layout">
<t t-set="breadcrumbs_searchbar" t-value="True" />
<t t-call="portal.portal_searchbar">
<t t-set="title">My Positions</t>
</t>
<h3>
My positions
</h3>
<div class="oe_position" id="oe_position_portal_my_positions_1" />
<t t-if="not positions">
<div class="alert alert-warning mt8" role="alert">
You do not have any positions in your structure.
</div>
</t>
<t t-if="positions" t-call="portal.portal_table">
<thead>
<tr class="active">
<th>
<span class='d-none d-md-inline'>Person name</span>
</th>
<th>
<span class='d-none d-md-inline'>Function</span>
</th>
</tr>
</thead>
<tbody>
<tr t-foreach="positions" t-as="position">
<td>
<a t-attf-href="/my/position/#{position.id}?{{ keep_query() }}">
<span t-field="position.name" />
</a>
</td>
<td>
<span t-field="position.function" />
</td>
</tr>
</tbody>
</t>
</t>
</template>
</odoo>

View File

@@ -0,0 +1,94 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="portal_position" name="Position Details">
<t t-call="portal.portal_layout">
<t t-set="o_portal_fullwidth_alert" groups="profile.group_profile_user">
<t t-call="portal.portal_back_in_edit_mode">
<t t-set="backend_url"
t-value="'/web#return_label=Website&amp;model=res.partner&amp;id=%s&amp;view_type=form' % (position.id)" />
</t>
</t>
<t t-set="additional_title">My Position Details</t>
<div style="text-align:right">
<br />
<a href="/my/positions">
<span class="fa fa-arrow-left" /> Back to my positions list </a>
</div>
<form action="/my/position/save" method="post" enctype="multipart/form-data">
<input type="hidden" name="csrf_token" t-att-value="request.csrf_token()" />
<div class="row o_portal_details">
<div class="col-lg-12">
<h1 style="text-align: center;">
<span t-field="position.name" /> details </h1>
<div t-if="success" class="alert alert-success py-1 mb-2">
<i class="fa fa-fw fa-check-circle" /> Data saved! </div>
<div t-if="error_message" role="alert" class="col-lg-12 alert alert-danger">
<t t-foreach="error_message" t-as="err">
<t t-esc="err" />
<br />
</t>
</div>
<!-- ##################### -->
<!-- POSITION PROFILE DATA -->
<!-- ##################### -->
<div>
<br />
<h3>
<span t-field="position.name" />'s position in the structure </h3>
<div class="row" id="position_function">
<div
t-attf-class="form-group #{error.get('function') and 'o_has_error' or ''} col-xl-6">
<label class="col-form-label" for="function">Function: </label>
<input type="text" name="function"
t-attf-class="form-control #{error.get('function') and 'is-invalid' or ''}"
t-att-value="function or position.function" />
</div>
</div>
<div class="row" id="position_contact">
<div
t-attf-class="form-group #{error.get('email') and 'o_has_error' or ''} col-xl-6">
<label class="col-form-label" for="email">Email Pro: </label>
<input type="email" name="email"
t-attf-class="form-control #{error.get('email') and 'is-invalid' or ''}"
t-att-value="email or position.email" />
</div>
<div
t-attf-class="form-group #{error.get('phone') and 'o_has_error' or ''} col-xl-6">
<label class="col-form-label" for="phone">Phone Pro: </label>
<input type="tel" name="phone"
t-attf-class="form-control #{error.get('phone') and 'is-invalid' or ''}"
t-att-value="phone or position.phone" />
</div>
</div>
</div>
<div id="position_access_rights">
<br />
<h3>
Access rights </h3>
<div id="edit_structure_profiles"
t-attf-class="form-group #{error.get('edit_structure_profiles') and 'o_has_error' or ''} col-xl-6">
<input type="checkbox" name="edit_structure_profiles"
t-att-checked="edit_structure_profiles or position.edit_structure_profiles" />
<label class="col-form-label" for="edit_structure_profiles">Manage
the structure's profiles</label>
</div>
</div>
<br />
<input type="hidden" name="position_id" t-att-value="position_id" />
<input type="hidden" name="redirect" t-att-value="redirect" />
<div style="text-align:right;">
<button type="submit"
class="btn btn-primary ">Save
</button>
</div>
</div>
</div>
</form>
<div style="text-align:right">
<br />
<a href="/my/positions">
<span class="fa fa-arrow-left" /> Back to my positions list </a>
</div>
</t>
</template>
</odoo>