Browse Source

[ADD] Message for non-worker mode

pull/67/head
nicolasjamoulle 5 years ago
parent
commit
b6dd0fa3b1
  1. 18
      beesdoo_website_shift/controllers/main.py
  2. 7
      beesdoo_website_shift/i18n/fr_BE.po
  3. 380
      beesdoo_website_shift/views/my_shift_website_templates.xml

18
beesdoo_website_shift/controllers/main.py

@ -28,6 +28,11 @@ class WebsiteShiftController(http.Controller):
working_mode = user.partner_id.working_mode
return working_mode == 'regular'
def is_user_regular_without_shift(self):
user = request.env['res.users'].browse(request.uid)
return (not user.partner_id.subscribed_shift_ids.id and
self.is_user_regular())
def is_user_exempted(self):
user = request.env['res.users'].browse(request.uid)
working_mode = user.partner_id.working_mode
@ -89,7 +94,12 @@ class WebsiteShiftController(http.Controller):
'beesdoo_website_shift.my_shift_irregular_worker',
self.my_shift_irregular_worker(nexturl='/my/shift')
)
if self.is_user_regular():
if self.is_user_regular_without_shift():
return request.render(
'beesdoo_website_shift.my_shift_regular_worker_without_shift',
self.my_shift_regular_worker_without_shift()
)
if self.is_user_regular() and not self.is_user_regular_without_shift():
return request.render(
'beesdoo_website_shift.my_shift_regular_worker',
self.my_shift_regular_worker()
@ -199,6 +209,12 @@ class WebsiteShiftController(http.Controller):
return template_context
def my_shift_regular_worker_without_shift(self):
"""
Return template variables for 'beesdoo_website_shift.my_shift_regular_worker_without_shift' template
"""
return self.my_shift_worker_status()
def my_shift_regular_worker(self):
"""
Return template variables for 'beesdoo_website_shift.my_shift_regular_worker' template

7
beesdoo_website_shift/i18n/fr_BE.po

@ -562,10 +562,15 @@ msgstr "Vous êtes un supercoopérateur"
#. module: beesdoo_website_shift
#: model:ir.ui.view,arch_db:beesdoo_website_shift.my_shift_exempted_worker
#: model:ir.ui.view,arch_db:beesdoo_website_shift.my_shift_non_worker
msgid "You don't have to participate to shift system."
msgstr "Vous ne devez pas participer au système de shift."
#. module: beesdoo_website_shift
#: model:ir.ui.view,arch_db:beesdoo_website_shift.my_shift_non_worker
#: model:ir.ui.view,arch_db:beesdoo_website_shift.my_shift_regular_worker_without_shift
msgid "Please contact the members office to suscribe to shifts."
msgstr "Merci de contacter le bureau des membres pour vous inscrire à un créneau de travail."
#. module: beesdoo_website_shift
#: model:ir.ui.view,arch_db:beesdoo_website_shift.my_shift_next_shifts
msgid "Your next shifts"

380
beesdoo_website_shift/views/my_shift_website_templates.xml

@ -8,7 +8,9 @@
<!-- Add menu entries -->
<template id="my_shift_link" name="Link to frontend portal" inherit_id="website.layout">
<xpath expr="//li[@id='o_logout']" position="before">
<li><a href="/my/shift" role="menuitem">My Shift</a></li>
<li>
<a href="/my/shift" role="menuitem">My Shift</a>
</li>
</xpath>
</template>
@ -241,6 +243,104 @@
<t t-foreach="subscribed_shifts" t-as="shift">
<div class="modal fade" t-if="shift.super_coop_id.name" t-att-id="'super_coop-shift-%s' % shift_index" tabindex="-1" role="dialog"
t-att-aria-labelledby="'super_coop-shift-%s-label' % shift_index">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<h4 class="modal-title" t-att-id="'super_coop-shift-%s-label' % shift_index">
<t t-esc="shift.super_coop_id.name"/>
</h4>
</div>
</section>
<div class="oe_structure"/>
<section class="wrap" t-if="is_regular">
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="alert alert-warning">
<strong>Warning !</strong>
For the moment public holidays are not taken into account. If your shift
occures during a public holiday, you do not have to do it.
</div>
</div>
</div>
</div>
</section>
<div class="oe_structure"/>
<div class="visible-xs" t-foreach="subscribed_shifts" t-as="shift">
<div class="panel panel-default">
<div class="panel-heading clearfix">
<div class="panel-title">
<t t-esc="time.strftime('%A %d %B %Y', time.strptime(shift.start_time, '%Y-%m-%d %H:%M:%S'))"/>
<span t-field="shift.start_time" t-field-options='{"format": "HH:mm"}'/>
-
<span t-field="shift.end_time" t-field-options='{"format": "HH:mm"}'/>
</div>
</div>
<div class="panel-body">
<t t-esc="shift.task_type_id.name"/>
<button type="button" class="btn btn-default btn-sm pull-right"
t-if="shift.super_coop_id.name"
data-toggle="modal"
t-att-data-target="'#super_coop-shift-%s' % shift_index">
<span class="fa fa-info" aria-hidden="true"></span>
Super Cooperator Info
</button>
</div>
</div>
</div>
<table class="hidden-xs table table-striped" t-if="subscribed_shifts">
<thead>
<tr>
<th>Day</th>
<th>Date</th>
<th>Time</th>
<th>Type of Shift</th>
<th class="text-center">Super Cooperator Info</th>
</tr>
</thead>
<tbody>
<t t-foreach="subscribed_shifts" t-as="shift">
<tr>
<td>
<t t-esc="time.strftime('%A', time.strptime(shift.start_time, '%Y-%m-%d %H:%M:%S'))"/>
</td>
<td>
<t t-esc="time.strftime('%d %B %Y', time.strptime(shift.start_time, '%Y-%m-%d %H:%M:%S'))"/>
</td>
<td>
<span t-field="shift.start_time" t-field-options='{"format": "HH:mm"}'/>
-
<span t-field="shift.end_time" t-field-options='{"format": "HH:mm"}'/>
</td>
<td>
<t t-esc="shift.task_type_id.name"/>
</td>
<td class="text-center">
<button type="button" class="btn btn-default btn-sm"
t-if="shift.super_coop_id.name"
data-toggle="modal"
t-att-data-target="'#super_coop-shift-%s' % shift_index">
<span class="fa fa-info" aria-hidden="true"></span>
</button>
</td>
</tr>
</t>
</tbody>
</table>
<!-- Super Cooperator info modal -->
<t t-foreach="subscribed_shifts" t-as="shift">
<div class="modal fade" t-if="shift.super_coop_id.name" t-att-id="'super_coop-shift-%s' % shift_index"
tabindex="-1" role="dialog"
t-att-aria-labelledby="'super_coop-shift-%s-label' % shift_index">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
@ -252,7 +352,9 @@
</h4>
</div>
<div class="modal-body">
<i class="fa fa-phone" aria-hidden="true"></i> <t t-esc="shift.super_coop_id.phone"/><br/>
<i class="fa fa-phone" aria-hidden="true"></i>
<t t-esc="shift.super_coop_id.phone"/>
<br/>
<i class="fa fa-envelope" aria-hidden="true"></i>
<a t-att-href="'mailto:%s' % shift.super_coop_id.email">
<t t-esc="shift.super_coop_id.email"/>
@ -271,7 +373,8 @@
<div class="row">
<div class="col-md-12">
<div class="alert alert-warning">
<strong>Warning !</strong> You have not yet signed up to a shift.
<strong>Warning !</strong>
You have not yet signed up to a shift.
</div>
</div>
</div>
@ -286,8 +389,6 @@
id="my_shift_past_shifts"
name="My Shift : Past Shifts">
<div class="oe_structure"/>
<section class="wrap">
<div class="container">
<div class="row">
@ -444,6 +545,162 @@
<td class="text-center">
<t t-esc="count"/>
</td>
<td class="text-center" t-if="irregular_enable_sign_up">
<t t-if="is_subscribed">
<div class="label label-success">
<span class="fa fa-check" aria-hidden="true"></span>
Subscribed
</div>
</div>
</section>
<div class="oe_structure"/>
<div class="visible-xs" t-foreach="past_shifts" t-as="shift">
<div class="panel panel-default">
<div class="panel-heading clearfix">
<div class="panel-title">
<t t-esc="time.strftime('%A %d %B %Y', time.strptime(shift.start_time, '%Y-%m-%d %H:%M:%S'))"/>
<span t-field="shift.start_time" t-field-options='{"format": "HH:mm"}'/>
-
<span t-field="shift.end_time" t-field-options='{"format": "HH:mm"}'/>
</div>
</div>
<div class="panel-body">
<t t-esc="shift.task_type_id.name"/>
</div>
</div>
</div>
<table class="hidden-xs table table-striped" t-if="past_shifts">
<thead>
<tr>
<th>Day</th>
<th>Date</th>
<th>Time</th>
<th>Type of Shift</th>
<th>Status</th>
</tr>
</thead>
<tbody>
<t t-foreach="past_shifts" t-as="shift">
<tr>
<td>
<t t-esc="time.strftime('%A', time.strptime(shift.start_time, '%Y-%m-%d %H:%M:%S'))"/>
</td>
<td>
<t t-esc="time.strftime('%d %B %Y', time.strptime(shift.start_time, '%Y-%m-%d %H:%M:%S'))"/>
</td>
<td>
<span t-field="shift.start_time" t-field-options='{"format": "HH:mm"}'/>
-
<span t-field="shift.end_time" t-field-options='{"format": "HH:mm"}'/>
</td>
<td>
<t t-esc="shift.task_type_id.name"/>
</td>
<td>
<t t-esc="shift.stage_id.name"/>
</td>
</tr>
</t>
</tbody>
</table>
<section class="wrap" t-if="not past_shifts">
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="alert alert-info">
<strong>Info !</strong>
You don't have any past shift.
</div>
</div>
</div>
</div>
</section>
<div class="oe_structure"/>
</template>
<template
id="available_shift_irregular_worker"
name="Available Shift for Irregular Worker">
<div class="oe_structure"/>
<div class="visible-xs" t-foreach="shift_templates" t-as="shift_count_subscribed">
<t t-set="shift" t-value="shift_count_subscribed[0]"/>
<t t-set="count" t-value="shift_count_subscribed[1]"/>
<t t-set="is_subscribed" t-value="shift_count_subscribed[2]"/>
<t t-set="highlight_class" t-value="'panel-warning' if count >= highlight_rule else 'panel-default'"/>
<div t-att-class="'panel %s' % highlight_class">
<div class="panel-heading clearfix">
<div class="panel-title pull-left">
<t t-esc="time.strftime('%A %d %B %Y', time.strptime(shift.start_time, '%Y-%m-%d %H:%M:%S'))"/>
<span t-field="shift.start_time" t-field-options='{"format": "HH:mm"}'/>
-
<span t-field="shift.end_time" t-field-options='{"format": "HH:mm"}'/>
</div>
<div class="label label-default pull-right">
<t t-esc="count"/>
space(s)
</div>
</div>
<div class="panel-body clearfix">
<t t-esc="shift.task_type_id.name"/>
<t t-if="is_subscribed">
<div class="label label-success pull-right">
<span class="fa fa-check" aria-hidden="true"></span>
Subscribed
</div>
</t>
<t t-if="irregular_enable_sign_up and not is_subscribed">
<button type="button" class="btn btn-default btn-sm pull-right" data-toggle="modal"
t-att-data-target="'#subscribe-shift-%s' % shift.id">
<span class="fa fa-user-plus" aria-hidden="true"></span>
Subscribe
</button>
</t>
</div>
</div>
</div>
<table class="hidden-xs table table-striped">
<thead>
<tr>
<th>Day</th>
<th>Date</th>
<th>Time</th>
<th>Type of Shift</th>
<th class="text-center">Available Spaces</th>
<th class="text-center" t-if="irregular_enable_sign_up">Subscribed</th>
</tr>
</thead>
<tbody>
<t t-foreach="shift_templates" t-as="shift_count_subscribed">
<t t-set="shift" t-value="shift_count_subscribed[0]"/>
<t t-set="count" t-value="shift_count_subscribed[1]"/>
<t t-set="is_subscribed" t-value="shift_count_subscribed[2]"/>
<tr t-attf-class="{{ 'warning' if count >= highlight_rule else '' }}">
<td>
<t t-esc="time.strftime('%A', time.strptime(shift.start_time, '%Y-%m-%d %H:%M:%S'))"/>
</td>
<td>
<t t-esc="time.strftime('%d %B %Y', time.strptime(shift.start_time, '%Y-%m-%d %H:%M:%S'))"/>
</td>
<td>
<span t-field="shift.start_time" t-field-options='{"format": "HH:mm"}'/>
-
<span t-field="shift.end_time" t-field-options='{"format": "HH:mm"}'/>
</td>
<td>
<t t-esc="shift.task_type_id.name"/>
</td>
<td class="text-center">
<t t-esc="count"/>
</td>
<td class="text-center" t-if="irregular_enable_sign_up">
<t t-if="is_subscribed">
<div class="label label-success">
@ -466,9 +723,9 @@
<!-- Subscribe check -->
<t t-foreach="shift_templates" t-as="shift_count_subscribed">
<t t-set="shift" t-value="shift_count_subscribed[0]" />
<t t-set="count" t-value="shift_count_subscribed[1]" />
<t t-set="is_subscribed" t-value="shift_count_subscribed[2]" />
<t t-set="shift" t-value="shift_count_subscribed[0]"/>
<t t-set="count" t-value="shift_count_subscribed[1]"/>
<t t-set="is_subscribed" t-value="shift_count_subscribed[2]"/>
<div class="modal fade" t-att-id="'subscribe-shift-%s' % shift.id" tabindex="-1" role="dialog"
t-att-aria-labelledby="'subscribe-shift-%s-label' % shift.id">
<div class="modal-dialog" role="document">
@ -484,10 +741,14 @@
<div class="modal-body">
<t t-esc="time.strftime('%A', time.strptime(shift.start_time, '%Y-%m-%d %H:%M:%S'))"/>
<t t-esc="time.strftime('%d %B %Y', time.strptime(shift.start_time, '%Y-%m-%d %H:%M:%S'))"/>
<span t-field="shift.start_time" t-field-options='{"format": "HH:mm"}'/> -
<span t-field="shift.end_time" t-field-options='{"format": "HH:mm"}'/><br/>
<t t-esc="shift.task_type_id.name"/><br/>
<t t-esc="count"/> available space(s)
<span t-field="shift.start_time" t-field-options='{"format": "HH:mm"}'/>
-
<span t-field="shift.end_time" t-field-options='{"format": "HH:mm"}'/>
<br/>
<t t-esc="shift.task_type_id.name"/>
<br/>
<t t-esc="count"/>
available space(s)
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
@ -533,7 +794,10 @@
id="help_text_common"
name="Help Text Common">
<div class="oe_structure alert alert-info">
<strong>Info!</strong> If you do not agree with your status, please contact the members office by mail (membre@bees-coop.be) or during the open hours of the office (Monday 5PM to 7:30PM, Wednesday 5PM to 7:30 PM and Friday 2:30PM to 5 PM).
<strong>Info!</strong>
If you do not agree with your status, please contact the members office by mail (membre@bees-coop.be) or
during the open hours of the office (Monday 5PM to 7:30PM, Wednesday 5PM to 7:30 PM and Friday 2:30PM to 5
PM).
</div>
<p class="oe_structure">
@ -553,17 +817,22 @@
<strong>Alert:</strong>
If you are in alert status, that means you didn't do your last shift. You have
until your next scheduled shift to do your compensation shift according to your situation.
Your compensation is either simple or double. If you don't how how many compensation shifts you have to do, please contact your supercooperator.
To do your compensation shift, no need to subscribe in advance : you come at the beginning of the shift that best suits you.
Your compensation is either simple or double. If you don't how how many compensation shifts you have to do,
please contact your supercooperator.
To do your compensation shift, no need to subscribe in advance : you come at the beginning of the shift that
best suits you.
Add your name and the indication "compensation shift" on the attendance list.
No panic, you still can come and shop, so can your eaters if you have any.
</p>
<p class="oe_structure">
<strong>Suspended:</strong>
If you are suspended, that means you didn't come to a shift and you didn't do you compensation shifts in the delay (4 weeks).
You cannot shop (so as your eaters). But no need to panic : a two-weeks delay is activable on demand at the entrance of the supermarket.
If you are suspended, that means you didn't come to a shift and you didn't do you compensation shifts in the
delay (4 weeks).
You cannot shop (so as your eaters). But no need to panic : a two-weeks delay is activable on demand at the
entrance of the supermarket.
You will be able to shop during 2 more weeks and to put your situation in order.
To do your compensation shift, no need to subscribe in advance : you come at the beginning of the shift that best suits you.
To do your compensation shift, no need to subscribe in advance : you come at the beginning of the shift that
best suits you.
Add your name and the indication "compensation shift" on the attendance list.
</p>
<p class="oe_structure">
@ -574,8 +843,10 @@
</p>
<p class="oe_structure">
<strong>Unsubscribed:</strong>
You did not attend two consecutive shifts. You are now unsubscribed. You cannot shop (nor can your eaters) nor come to work.
To subscribe again, please contact membre@bees-coop.be or come to the members office during the opening hours.
You did not attend two consecutive shifts. You are now unsubscribed. You cannot shop (nor can your eaters)
nor come to work.
To subscribe again, please contact membre@bees-coop.be or come to the members office during the opening
hours.
</p>
</template>
@ -588,7 +859,8 @@
Your counter is now negative, directly to -2.
You have 4 weeks to do 2 shifts to be up to date.
For the compensation shifts, subscribe like you do for a normal shift.
Be careful, in addition to these 2 shifts, don't forget to do your normal shift in the same delay to prevent to be in the same situation next month.
Be careful, in addition to these 2 shifts, don't forget to do your normal shift in the same delay to prevent
to be in the same situation next month.
</p>
<p class="oe_structure">
<strong>Suspended:</strong>
@ -608,7 +880,8 @@
<strong>Unsubscribed:</strong>
Your counter is negative and you haven't come to work for more than 8 weeks.
You are unsubscribed. You cannot shop nor can your eaters.
To subscribe again of if it's a mistake, please contact membre@bees-coop.be or come to the members office during the opening hours.
To subscribe again of if it's a mistake, please contact membre@bees-coop.be or come to the members office
during the opening hours.
</p>
</template>
@ -626,7 +899,7 @@
<div class="row">
<div class="col-md-12">
<div class="alert alert-info">
You don't have to participate to shift system.
Please contact the members office to suscribe to shifts.
</div>
</div>
</div>
@ -691,6 +964,55 @@
</t>
</template>
<!-- Shifts regular worker without shift -->
<template
id="my_shift_regular_worker_without_shift"
name="My Shifts for regular worker without shift"
page="True">
<t t-call="website.layout">
<t t-call="beesdoo_website_shift.my_shift_title"/>
<section class="wrap">
<div class="container">
<div class="row">
<div class="col-xs-12 col-md-4 pull-right text-justify">
<t t-call="beesdoo_website_shift.my_shift_worker_status_title"/>
<t t-call="beesdoo_website_shift.my_shift_worker_status_common"/>
<div class="oe_structure"/>
</div>
<div class="col-xs-12 col-md-8">
<section class="wrap">
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="alert alert-info">
Please contact the members office to suscribe to shifts.
</div>
</div>
</div>
</div>
</section>
<div class="oe_structure"/>
</div> <!-- col-md-8 -->
</div> <!-- row -->
</div> <!-- container -->
</section>
<div class="oe_structure"/>
</t>
</template>
<!-- Shifts for Regular Workers -->
<template
id="my_shift_regular_worker"
@ -812,10 +1134,12 @@
<span aria-hidden="true">×</span>
</button>
<t t-if="success">
<strong>Success!</strong> Your subscription has succeded.
<strong>Success!</strong>
Your subscription has succeded.
</t>
<t t-if="not success">
<strong>Failed!</strong> Your subscription has failed. Someone
<strong>Failed!</strong>
Your subscription has failed. Someone
subscribed before you or the shift was deleted. Try again in a
moment.
</t>
@ -842,8 +1166,10 @@
<div class="row">
<div class="col-xs-12 col-sm-6 text-justify">
<p>
Please, subscribe, in priority, to the highlighted shifts. To sign up to a shift click on the
subscribe button. Notice that you can not unsubscribe online. To unsubscribe to a shift, please,
Please, subscribe, in priority, to the highlighted shifts. To sign up to
a shift click on the
subscribe button. Notice that you can not unsubscribe online. To
unsubscribe to a shift, please,
contact us.
</p>
</div>

Loading…
Cancel
Save