Browse Source
[ADD] website_shift: Personal page for working information (#33)
[ADD] website_shift: Personal page for working information (#33)
* [ADD] website_shift: Add configuration irregular_shift_limit: Maximum shift that will be shown highlight_rule: Treshold of available space in a shift that trigger the highlight of the shift hide_rule: Treshold ((available space)/(max space)) in percentage of available space under wich the shift is hidden The last one replaces the old hide filter. * [FIX] website_shift: Wrong mail on regular shift Fix the wrong email address that is shown on the public page that show available shift for irregular worker. * [ADD] website_shift: Irregular personal work page Add personal shift page for irregular worker that allows you to subscribe to a shift. * [ADD] website_shift: Personal page for non-worker Add a personal page for non-worker that shows a simple message telling them that they don't have to do a shift. * [ADD] website_shift: Regular personal work page Add personal shift page for regular worker. * [ADD] website_shift: Exempted personal work page Add personal shift page for exempted worker. * [IMP] website_shift: Shopping status personal page This add a label that shows the shopping status of a user. If the label is green the user can shop. If the label is red the user cannot shop. There is also icons for disambiguation. * [ADD] website_shift: Config en & dis shift sign up This add a configuration boolean that enable or disable the shift sign up for irregular worker. * [IMP] website_shift: Status on personal pages Show dates properly. Hide what's useless. Give meaningful name. * [IMP] website_shift: Design of personal pages * Lower size of h2 title. * Add top margin to h1. * Change highlight color. * Change position of explanation test. * [IMP] website_shift: Refactor templates Refactor templates to avoid dupplicate code. Refactor the controller to match with new templates. Add license. * [ADD] website_shift: Past shifts on personal page Add a list of the previous shifts for a worker. * [ADD] website_shift: Super Coop info Add a button to show email and phone of the super cooperator of a shift. Tell you if you are a Super Co-operator * [IMP] website_shift: Next shifts regular worker Add configuration to specify how many next shifts for regular worker must be shown to them on their personal web page. This config is called `regular_next_shift_limit`. Improve the view that shows the next shifts on the personal page for a regular worker regarding to the `regular_next_shift_limit`. Because all the next shifts are not created in the database, we need to create 'fictive' one that are not stored. * [ADD] website_shift: Warning about holidays Add a warning message on the personal page for a regular worker that tells that public holidays are not taken into account for the moment. * [IMP] website_theme: colors for warnings * [FIX] website_shift: 403 when subscribing Fix the case when an irregular worker that doesn't have write access to beesdoo.shift.shift try to subscribe to a shift and got a 403 error. * [FIX] website_theme: Theme must be an application As wrote in this document : https://www.odoo.com/documentation/9.0/howtos/themes.html#create-a-theme-module a theme module must be an application. * [FIX] webs_shift: Wrong display of date last shift Fix the case when an irregular worker is in alert and that the date before last shift is displayed. The `date_before_last_shift` is renamed in `future_alert_start_time`. This name better represent what this variable contains. It also explains why this information does not have to be displayed when the worker is already in alert mode as this date is the date in the future on which the worker will be in alert. * [FIX] website_shift: Co-operator -> Cooperator * [FIX] website_shift: Past shifts not ordered desc The past shift was not properly ordered. This fix by ordering the past shifts from the newest to the oldest. * [FIX] website_shift: Holiday shown after end of it Before: The holiday is shown even if the holiday is in the past. After: The holiday is shown only if the holiday is now or in the future.pull/37/head
Rémy Taymans
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 1500 additions and 177 deletions
-
1beesdoo_website_shift/__init__.py
-
12beesdoo_website_shift/__openerp__.py
-
443beesdoo_website_shift/controllers/main.py
-
37beesdoo_website_shift/data/res_config_data.xml
-
2beesdoo_website_shift/i18n/fr_BE.po
-
1beesdoo_website_shift/models/__init__.py
-
103beesdoo_website_shift/models/res_config.py
-
685beesdoo_website_shift/views/my_shift_website_templates.xml
-
100beesdoo_website_shift/views/res_config_views.xml
-
130beesdoo_website_shift/views/shift_website_templates.xml
-
1beesdoo_website_theme/__openerp__.py
-
54beesdoo_website_theme/static/src/less/beesdoo_website_design.less
@ -1 +1,2 @@ |
|||
from . import controllers |
|||
from . import models |
@ -0,0 +1,37 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<!-- |
|||
Copyright 2017-2018 Rémy Taymans <remytaymans@gmail.com> |
|||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|||
--> |
|||
<openerp> |
|||
<data noupdate="1"> |
|||
<record id="beesdoo_website_shift.irregular_shift_limit" model="ir.config_parameter"> |
|||
<field name="key">beesdoo_website_shift.irregular_shift_limit</field> |
|||
<field name="value">0</field> |
|||
</record> |
|||
<record id="beesdoo_website_shift.highlight_rule" model="ir.config_parameter"> |
|||
<field name="key">beesdoo_website_shift.highlight_rule</field> |
|||
<field name="value">3</field> |
|||
</record> |
|||
<record id="beesdoo_website_shift.hide_rule" model="ir.config_parameter"> |
|||
<field name="key">beesdoo_website_shift.hide_rule</field> |
|||
<field name="value">20</field> |
|||
</record> |
|||
<record id="beesdoo_website_shift.irregular_enable_sign_up" model="ir.config_parameter"> |
|||
<field name="key">beesdoo_website_shift.irregular_enable_sign_up</field> |
|||
<field name="value">True</field> |
|||
</record> |
|||
<record id="beesdoo_website_shift.irregular_past_shift_limit" model="ir.config_parameter"> |
|||
<field name="key">beesdoo_website_shift.irregular_past_shift_limit</field> |
|||
<field name="value">10</field> |
|||
</record> |
|||
<record id="beesdoo_website_shift.regular_past_shift_limit" model="ir.config_parameter"> |
|||
<field name="key">beesdoo_website_shift.regular_past_shift_limit</field> |
|||
<field name="value">10</field> |
|||
</record> |
|||
<record id="beesdoo_website_shift.regular_next_shift_limit" model="ir.config_parameter"> |
|||
<field name="key">beesdoo_website_shift.regular_next_shift_limit</field> |
|||
<field name="value">13</field> |
|||
</record> |
|||
</data> |
|||
</openerp> |
@ -0,0 +1 @@ |
|||
from . import res_config |
@ -0,0 +1,103 @@ |
|||
# -*- coding: utf-8 -*- |
|||
|
|||
# Copyright 2017-2018 Rémy Taymans <remytaymans@gmail.com> |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|||
|
|||
from ast import literal_eval |
|||
from openerp import fields, models, api |
|||
|
|||
PARAMS = [ |
|||
('irregular_shift_limit', 'beesdoo_website_shift.irregular_shift_limit'), |
|||
('highlight_rule', 'beesdoo_website_shift.highlight_rule'), |
|||
('hide_rule', 'beesdoo_website_shift.hide_rule'), |
|||
('irregular_enable_sign_up', 'beesdoo_website_shift.irregular_enable_sign_up'), |
|||
('irregular_past_shift_limit', 'beesdoo_website_shift.irregular_past_shift_limit'), |
|||
('regular_past_shift_limit', 'beesdoo_website_shift.regular_past_shift_limit'), |
|||
('regular_next_shift_limit', 'beesdoo_website_shift.regular_next_shift_limit'), |
|||
] |
|||
|
|||
|
|||
class WebsiteShiftConfigSettings(models.TransientModel): |
|||
|
|||
_name = 'beesdoo.website.shift.config.settings' |
|||
_inherit = 'res.config.settings' |
|||
|
|||
# Irregular worker settings |
|||
irregular_shift_limit = fields.Integer( |
|||
help="Maximum shift that will be shown" |
|||
) |
|||
highlight_rule = fields.Integer( |
|||
help="Treshold of available space in a shift that trigger the highlight of the shift" |
|||
) |
|||
hide_rule = fields.Integer( |
|||
help="Treshold ((available space)/(max space)) in percentage of available space under wich the shift is hidden" |
|||
) |
|||
irregular_enable_sign_up = fields.Boolean( |
|||
help="Enable shift sign up for irregular worker" |
|||
) |
|||
irregular_past_shift_limit = fields.Integer( |
|||
help="Maximum past shift that will be shown for irregular worker" |
|||
) |
|||
|
|||
# Regular worker settings |
|||
regular_past_shift_limit = fields.Integer( |
|||
help="Maximum past shift that will be shown for regular worker" |
|||
) |
|||
regular_next_shift_limit = fields.Integer( |
|||
help="Maximun number of next shift that will be shown" |
|||
) |
|||
|
|||
@api.multi |
|||
def set_params(self): |
|||
self.ensure_one() |
|||
|
|||
for field_name, key_name in PARAMS: |
|||
value = getattr(self, field_name) |
|||
self.env['ir.config_parameter'].set_param(key_name, str(value)) |
|||
|
|||
@api.multi |
|||
def get_default_irregular_shift_limit(self): |
|||
return { |
|||
'irregular_shift_limit': int(self.env['ir.config_parameter'].get_param( |
|||
'beesdoo_website_shift.irregular_shift_limit')) |
|||
} |
|||
|
|||
@api.multi |
|||
def get_default_highlight_rule(self): |
|||
return { |
|||
'highlight_rule': int(self.env['ir.config_parameter'].get_param('beesdoo_website_shift.highlight_rule')) |
|||
} |
|||
|
|||
@api.multi |
|||
def get_default_hide_rule(self): |
|||
return { |
|||
'hide_rule': int(self.env['ir.config_parameter'].get_param('beesdoo_website_shift.hide_rule')) |
|||
} |
|||
|
|||
@api.multi |
|||
def get_default_irregular_shift_sign_up(self): |
|||
return { |
|||
'irregular_enable_sign_up': literal_eval(self.env['ir.config_parameter'].get_param( |
|||
'beesdoo_website_shift.irregular_enable_sign_up')) |
|||
} |
|||
|
|||
@api.multi |
|||
def get_default_irregular_past_shift_limit(self): |
|||
return { |
|||
'irregular_past_shift_limit': int(self.env['ir.config_parameter'].get_param( |
|||
'beesdoo_website_shift.irregular_past_shift_limit')) |
|||
} |
|||
|
|||
@api.multi |
|||
def get_default_regular_past_shift_limit(self): |
|||
return { |
|||
'regular_past_shift_limit': int(self.env['ir.config_parameter'].get_param( |
|||
'beesdoo_website_shift.regular_past_shift_limit')) |
|||
} |
|||
|
|||
@api.multi |
|||
def get_default_regular_next_shift_limit(self): |
|||
return { |
|||
'regular_next_shift_limit': int(self.env['ir.config_parameter'].get_param( |
|||
'beesdoo_website_shift.regular_next_shift_limit')) |
|||
} |
@ -0,0 +1,685 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<!-- |
|||
Copyright 2017-2018 Rémy Taymans <remytaymans@gmail.com> |
|||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|||
--> |
|||
<openerp> |
|||
|
|||
<!-- 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> |
|||
</xpath> |
|||
</template> |
|||
|
|||
<!-- Reusable templates --> |
|||
<template |
|||
id="my_shift_title" |
|||
name="My Shift Title"> |
|||
|
|||
<div class="oe_structure"/> |
|||
|
|||
<section class="wrap"> |
|||
<div class="container"> |
|||
<div class="row"> |
|||
<div class="col-md-12"> |
|||
<h1 class="text-center"> |
|||
Your shifts |
|||
</h1> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</section> |
|||
|
|||
<div class="oe_structure"/> |
|||
|
|||
</template> |
|||
|
|||
<template |
|||
id="my_shift_worker_status_title" |
|||
name="My Shift Worker Status Title"> |
|||
|
|||
<div class="oe_structure"/> |
|||
|
|||
<section class="wrap"> |
|||
<div class="container"> |
|||
<div class="row"> |
|||
<div class="col-md-12"> |
|||
<h2> |
|||
Worker status |
|||
<span t-att-class="'label %s pull-right' % ('label-success' if status.can_shop else 'label-danger',)"> |
|||
<span class="fa fa-shopping-cart"></span> |
|||
<t t-if="status.can_shop"> |
|||
<span class="fa fa-check"></span> |
|||
</t> |
|||
<t t-if="not status.can_shop"> |
|||
<span class="fa fa-times"></span> |
|||
</t> |
|||
</span> |
|||
</h2> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</section> |
|||
|
|||
<div class="oe_structure"/> |
|||
|
|||
</template> |
|||
|
|||
<template |
|||
id="my_shift_worker_status_common" |
|||
name="My Shift Worker Status Common"> |
|||
|
|||
<p> |
|||
<label>Working Mode:</label> |
|||
<t t-esc="dict(status.fields_get(allfields=['working_mode'])['working_mode']['selection'])[status.working_mode]"/> |
|||
</p> |
|||
|
|||
<p t-if="status.super"> |
|||
You are a Super Cooperator |
|||
</p> |
|||
|
|||
<p> |
|||
<label>Status:</label> |
|||
<t t-esc="dict(status.fields_get(allfields=['status'])['status']['selection'])[status.status]"/> |
|||
</p> |
|||
|
|||
<p t-if="status.holiday_start_time and status.holiday_start_time > status.today or status.status == 'holiday'"> |
|||
<label>Begin of Holiday:</label> |
|||
<t t-esc="time.strftime('%A %d %B %Y', time.strptime(status.holiday_start_time, '%Y-%m-%d'))"/> |
|||
</p> |
|||
|
|||
<p t-if="status.holiday_end_time and status.holiday_end_time > status.today or status.status == 'holiday'"> |
|||
<label>End of Holiday:</label> |
|||
<t t-esc="time.strftime('%A %d %B %Y', time.strptime(status.holiday_end_time, '%Y-%m-%d'))"/> |
|||
</p> |
|||
|
|||
</template> |
|||
|
|||
<template |
|||
id="my_shift_next_shifts" |
|||
name="My Shift : Next Shifts"> |
|||
|
|||
<div class="oe_structure"/> |
|||
|
|||
<section class="wrap"> |
|||
<div class="container"> |
|||
<div class="row"> |
|||
<div class="col-md-12"> |
|||
<h2> |
|||
Your next shifts |
|||
</h2> |
|||
</div> |
|||
</div> |
|||
</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="'%s %s' % (shift.start_day, shift.start_date)"/> |
|||
<span t-esc="shift.start_time"/> - |
|||
<span t-esc="shift.end_time"/> |
|||
</div> |
|||
</div> |
|||
<div class="panel-body"> |
|||
<t t-esc="shift.task_type_name"/> |
|||
<button type="button" class="btn btn-default btn-sm pull-right" |
|||
t-if="shift.super_coop_name" |
|||
data-toggle="modal" |
|||
t-att-data-target="'#super_coop-shift-%s' % shift.id"> |
|||
<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="shift.start_day"/> |
|||
</td> |
|||
<td> |
|||
<t t-esc="shift.start_date"/> |
|||
</td> |
|||
<td> |
|||
<span t-esc="shift.start_time"/> - |
|||
<span t-esc="shift.end_time"/> |
|||
</td> |
|||
<td> |
|||
<t t-esc="shift.task_type_name"/> |
|||
</td> |
|||
<td class="text-center"> |
|||
<button type="button" class="btn btn-default btn-sm" |
|||
t-if="shift.super_coop_name" |
|||
data-toggle="modal" |
|||
t-att-data-target="'#super_coop-shift-%s' % shift.id"> |
|||
<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_name" t-att-id="'super_coop-shift-%s' % shift.id" tabindex="-1" role="dialog" |
|||
t-att-aria-labelledby="'super_coop-shift-%s-label' % shift.id"> |
|||
<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.id"> |
|||
<t t-esc="shift.super_coop_name"/> |
|||
</h4> |
|||
</div> |
|||
<div class="modal-body"> |
|||
<i class="fa fa-phone" aria-hidden="true"></i> <t t-esc="shift.super_coop_phone"/><br/> |
|||
<i class="fa fa-envelope" aria-hidden="true"></i> |
|||
<a t-att-href="'mailto:%s' % shift.super_coop_email"> |
|||
<t t-esc="shift.super_coop_email"/> |
|||
</a> |
|||
</div> |
|||
<div class="modal-footer"> |
|||
<button type="button" class="btn btn-primary" data-dismiss="modal">Close</button> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</t> |
|||
|
|||
<section class="wrap" t-if="not subscribed_shifts"> |
|||
<div class="container"> |
|||
<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. |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</section> |
|||
|
|||
<div class="oe_structure"/> |
|||
|
|||
</template> |
|||
|
|||
<template |
|||
id="my_shift_past_shifts" |
|||
name="My Shift : Past Shifts"> |
|||
|
|||
<div class="oe_structure"/> |
|||
|
|||
<section class="wrap"> |
|||
<div class="container"> |
|||
<div class="row"> |
|||
<div class="col-md-12"> |
|||
<h2> |
|||
Your past shifts |
|||
</h2> |
|||
</div> |
|||
</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"> |
|||
<span class="fa fa-check" aria-hidden="true"></span> |
|||
Subscribed |
|||
</div> |
|||
</t> |
|||
<t t-if="not is_subscribed"> |
|||
<button type="button" class="btn btn-default btn-sm" 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> |
|||
</td> |
|||
</tr> |
|||
</t> |
|||
</tbody> |
|||
</table> |
|||
|
|||
<!-- 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]" /> |
|||
<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"> |
|||
<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="'subscribe-shift-%s-label' % shift.id"> |
|||
Are you shure you want to subscribe to this shift? |
|||
</h4> |
|||
</div> |
|||
<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) |
|||
</div> |
|||
<div class="modal-footer"> |
|||
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button> |
|||
<a class="btn btn-primary" |
|||
t-if="irregular_enable_sign_up" |
|||
t-att-href="'/shift/%s/subscribe?nexturl=%s' % (shift.id, nexturl)"> |
|||
Subscribe |
|||
</a> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</t> |
|||
|
|||
<div class="oe_structure"/> |
|||
|
|||
</template> |
|||
|
|||
<!-- Shift for non-worker --> |
|||
<template |
|||
id="my_shift_non_worker" |
|||
name="My Shift for Non Worker" |
|||
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-md-12"> |
|||
<div class="alert alert-info"> |
|||
You don't have to participate to shift system. |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</section> |
|||
|
|||
<div class="oe_structure"/> |
|||
|
|||
</t> |
|||
</template> |
|||
|
|||
<!-- Shifts Exempted Workers --> |
|||
<template |
|||
id="my_shift_exempted_worker" |
|||
name="My Shifts for Exempted Workers" |
|||
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"> |
|||
|
|||
<t t-call="beesdoo_website_shift.my_shift_worker_status_title"/> |
|||
|
|||
<t t-call="beesdoo_website_shift.my_shift_worker_status_common"/> |
|||
|
|||
<p t-if="status.exempt_reason_id"> |
|||
<label>Exempt Reason:</label> |
|||
<t t-esc="status.exempt_reason_id.name"/> |
|||
</p> |
|||
|
|||
<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"> |
|||
You don't have to participate to shift system. |
|||
</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" |
|||
name="My Shifts for Regular Workers" |
|||
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"> |
|||
|
|||
<t t-call="beesdoo_website_shift.my_shift_worker_status_title"/> |
|||
|
|||
<t t-call="beesdoo_website_shift.my_shift_worker_status_common"/> |
|||
|
|||
<p t-if="status.sr != 0"> |
|||
<label>Shift in Advance:</label> |
|||
<t t-esc="status.sr"/> |
|||
</p> |
|||
|
|||
<p t-if="status.sc != 0"> |
|||
<label>Compensation Shift:</label> |
|||
<t t-esc="status.sc"/> |
|||
</p> |
|||
|
|||
<p t-if="status.alert_start_time"> |
|||
<label>In Alert Since:</label> |
|||
<t t-esc="time.strftime('%A %d %B %Y', time.strptime(status.alert_start_time, '%Y-%m-%d'))"/> |
|||
</p> |
|||
|
|||
<p t-if="status.extension_start_time"> |
|||
<label>In Extension Since:</label> |
|||
<t t-esc="time.strftime('%A %d %B %Y', time.strptime(status.extension_start_time, '%Y-%m-%d'))"/> |
|||
</p> |
|||
|
|||
<div class="oe_structure"/> |
|||
|
|||
</div> |
|||
|
|||
<div class="col-xs-12 col-md-8"> |
|||
|
|||
<t t-call="beesdoo_website_shift.my_shift_next_shifts"/> |
|||
|
|||
<t t-call="beesdoo_website_shift.my_shift_past_shifts"/> |
|||
|
|||
</div> <!-- col-md-8 --> |
|||
</div> <!-- row --> |
|||
</div> <!-- container --> |
|||
</section> |
|||
|
|||
<div class="oe_structure"/> |
|||
|
|||
</t> |
|||
</template> |
|||
|
|||
<!-- Shifts for Irregular Workers --> |
|||
<template |
|||
id="my_shift_irregular_worker" |
|||
name="Shifts for Irregular Workers" |
|||
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"> |
|||
|
|||
<t t-call="beesdoo_website_shift.my_shift_worker_status_title"/> |
|||
|
|||
<t t-call="beesdoo_website_shift.my_shift_worker_status_common"/> |
|||
|
|||
<p> |
|||
<label>Shift in Advance:</label> |
|||
<t t-esc="status.sr"/> |
|||
</p> |
|||
|
|||
<p t-if="future_alert_date"> |
|||
<label>Future Date of Alert:</label> |
|||
<t t-esc="time.strftime('%A %d %B %Y', time.strptime(future_alert_date, '%Y-%m-%d'))"/> |
|||
</p> |
|||
|
|||
<p t-if="status.irregular_absence_date"> |
|||
<label>Last Absence Date:</label> |
|||
<t t-esc="time.strftime('%A %d %B %Y', time.strptime(status.irregular_absence_date, '%Y-%m-%d'))"/> |
|||
</p> |
|||
|
|||
<p t-if="status.irregular_absence_counter"> |
|||
<label>Number of Absence:</label> |
|||
<t t-esc="status.irregular_absence_counter"/> |
|||
</p> |
|||
|
|||
<div class="oe_structure"/> |
|||
|
|||
</div> |
|||
|
|||
<div class="col-xs-12 col-md-8"> |
|||
|
|||
<t t-call="beesdoo_website_shift.my_shift_next_shifts"/> |
|||
|
|||
<section class="wrap"> |
|||
<div class="container"> |
|||
<div class="row"> |
|||
<div class="col-md-12"> |
|||
<h2> |
|||
Available Shifts |
|||
</h2> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</section> |
|||
|
|||
<div class="oe_structure"/> |
|||
|
|||
<section class="wrap"> |
|||
<div class="container"> |
|||
<div class="row"> |
|||
<div class="col-xs-12 col-sm-6"> |
|||
<p> |
|||
Explanation text |
|||
</p> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</section> |
|||
<div class="oe_structure"/> |
|||
|
|||
<t t-call="beesdoo_website_shift.available_shift_irregular_worker"/> |
|||
|
|||
<t t-call="beesdoo_website_shift.my_shift_past_shifts"/> |
|||
|
|||
</div> <!-- col-md-8 --> |
|||
</div> <!-- row --> |
|||
</div> <!-- container --> |
|||
</section> |
|||
|
|||
<div class="oe_structure"/> |
|||
|
|||
</t> |
|||
</template> |
|||
|
|||
</openerp> |
@ -0,0 +1,100 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<!-- |
|||
Copyright 2017-2018 Rémy Taymans <remytaymans@gmail.com> |
|||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|||
--> |
|||
<openerp> |
|||
<data> |
|||
|
|||
<record id="view_website_shift_config_irregular" model="ir.ui.view"> |
|||
<field name="name">Website Shift Settings Irregular Worker</field> |
|||
<field name="model">beesdoo.website.shift.config.settings</field> |
|||
<field name="arch" type="xml"> |
|||
<form string="Configure Website Shift Irregular Worker" class="oe_form_configuration"> |
|||
<header> |
|||
<button string="Apply" type="object" name="execute" class="oe_highlight"/> |
|||
<button string="Cancel" type="object" name="cancel" class="oe_link" special="cancel"/> |
|||
</header> |
|||
<div> |
|||
<label for="irregular_shift_limit"/> |
|||
<field name="irregular_shift_limit"/> |
|||
</div> |
|||
<div> |
|||
<label for="highlight_rule"/> |
|||
<field name="highlight_rule"/> |
|||
</div> |
|||
<div> |
|||
<label for="hide_rule"/> |
|||
<field name="hide_rule"/> |
|||
</div> |
|||
<div> |
|||
<label for="irregular_enable_sign_up"/> |
|||
<field name="irregular_enable_sign_up"/> |
|||
</div> |
|||
<div> |
|||
<label for="irregular_past_shift_limit"/> |
|||
<field name="irregular_past_shift_limit"/> |
|||
</div> |
|||
</form> |
|||
</field> |
|||
</record> |
|||
|
|||
<record id="view_website_shift_config_regular" model="ir.ui.view"> |
|||
<field name="name">Website Shift Settings Regular Worker</field> |
|||
<field name="model">beesdoo.website.shift.config.settings</field> |
|||
<field name="arch" type="xml"> |
|||
<form string="Configure Website Shift Regular Worker" class="oe_form_configuration"> |
|||
<header> |
|||
<button string="Apply" type="object" name="execute" class="oe_highlight"/> |
|||
<button string="Cancel" type="object" name="cancel" class="oe_link" special="cancel"/> |
|||
</header> |
|||
<div> |
|||
<label for="regular_past_shift_limit"/> |
|||
<field name="regular_past_shift_limit"/> |
|||
</div> |
|||
<div> |
|||
<label for="regular_next_shift_limit"/> |
|||
<field name="regular_next_shift_limit"/> |
|||
</div> |
|||
</form> |
|||
</field> |
|||
</record> |
|||
|
|||
<record id="action_website_shift_config_irregular" model="ir.actions.act_window"> |
|||
<field name="name">Website Shift Settings Irregular Worker</field> |
|||
<field name="res_model">beesdoo.website.shift.config.settings</field> |
|||
<field name="view_id" ref="view_website_shift_config_irregular"/> |
|||
<field name="view_mode">form</field> |
|||
<field name="target">inline</field> |
|||
</record> |
|||
|
|||
<record id="action_website_shift_config_regular" model="ir.actions.act_window"> |
|||
<field name="name">Website Shift Settings Regular Worker</field> |
|||
<field name="res_model">beesdoo.website.shift.config.settings</field> |
|||
<field name="view_id" ref="view_website_shift_config_regular"/> |
|||
<field name="view_mode">form</field> |
|||
<field name="target">inline</field> |
|||
</record> |
|||
|
|||
<menuitem |
|||
id="menu_website_shift_root" |
|||
name="Shift" |
|||
parent="website.menu_website_configuration" |
|||
sequence="20"/> |
|||
|
|||
<menuitem |
|||
id="menu_website_shift_irregular" |
|||
name="Irregular Shift" |
|||
action="action_website_shift_config_irregular" |
|||
parent="menu_website_shift_root" |
|||
sequence="1"/> |
|||
|
|||
<menuitem |
|||
id="menu_website_shift_regular" |
|||
name="Regular Shift" |
|||
action="action_website_shift_config_regular" |
|||
parent="menu_website_shift_root" |
|||
sequence="10"/> |
|||
|
|||
</data> |
|||
</openerp> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue