Commit ccda0152 by François C.

Merge branch '2170-create-delete-binome' into 'dev_cooperatic'

2170 create delete binome

See merge request !141
parents 385a7122 186dcc63
Pipeline #2021 passed with stage
in 1 minute 27 seconds
......@@ -1217,6 +1217,14 @@ class CagetteMembers(models.Model):
res = api.search_read('res.partner', cond, fields)
return res
@staticmethod
def get_attached_members():
api = OdooAPI()
cond = [['is_associated_people','=', True]]
fields = ['id', 'name', 'parent_name']
res = api.search_read('res.partner', cond, fields)
return res
class CagetteServices(models.Model):
"""Class to handle cagette Odoo services."""
......
.header {
margin: 1rem 0;
}
.login_area {
position: absolute;
display: block;
top: 5px;
right: 5px;
}
#back_to_admin_index {
position: absolute;
top: 5px;
left: 5px;
}
/* Buttons */
.management_type_buttons {
margin-top: 60px;
display: flex;
justify-content: center;
}
.management_type_button {
height: 2.2em;
width: 30%;
border-radius: 3px;
margin: 10px;
font-size: 1.3em;
}
.create_pair_button {
display: flex;
justify-content: center;
margin: 120px 0 120px 0;
}
@media screen and (max-width: 992px) {
.create_pair_button {
margin: auto;
}
}
#createPair {
border-radius: 30px;
}
/* Search membres area */
.search_member_form_area {
align-items: center;
padding-bottom: 20px;
}
.search_member_form {
margin-left: 10px;
}
/* Member infos */
.tile_icon {
margin-right: 15px;
color: #00a573;
}
.member_info {
font-weight: bold;
}
.member_status_text_container {
margin: 1rem;
}
/* Attached members table */
.table_area {
margin-top: 20px;
}
#table_top_area {
display: flex;
justify-content: space-between;
}
/* -- Tiles */
.tiles_container {
display: flex;
flex-wrap: wrap;
}
@media screen and (max-width: 992px) {
.tiles_container {
flex-direction: column;
}
}
.tile {
flex: 1 0 20%;
display: flex;
flex-direction: column;
text-align: center;
border-radius: 30px;
margin: 1rem 1rem;
padding: 1rem;
box-shadow: 2px 2px 3px rgba(10,10,10,.1),0 0 0 1px rgba(10,10,10,.1);
}
.tile_content {
height: 100%;
flex-direction: column;
text-align: center;
font-size: 1.6rem;
}
.spinner {
height:40px;
}
......@@ -9,10 +9,14 @@ $(document).ready(function() {
$('.management_type_button').on('click', function() {
if (this.id == 'manage_makeups_button') {
window.location.assign(location + "/manage_makeups");
} else if (this.id == 'manage_attached_button') {
console.log('coming soon...');
} else if (this.id == 'manage_shift_registrations_button') {
window.location.assign(location + "/manage_shift_registrations");
} else if (this.id == 'manage_attached_button') {
window.location.assign(location + "/manage_attached");
} else if (this.id == 'manage_attached_delete_pair_button') {
window.location.assign(location + "/delete_pair");
} else if (this.id == 'manage_attached_create_pair_button') {
window.location.assign(location + "/create_pair");
} else if (this.id == 'manage_leaves_button') {
console.log('coming soon...');
} else if (this.id == 'manage_regular_shifts_button') {
......
......@@ -51,7 +51,7 @@ urlpatterns = [
url(r'^easy_validate_shift_presence$', views.easy_validate_shift_presence),
# conso / groupe recherche / socio
url(r'^panel_get_purchases$', views.panel_get_purchases),
# BDM
# BDM
url(r'^save_partner_info$', views.save_partner_info),
# BDM - members admin
......@@ -63,4 +63,12 @@ urlpatterns = [
url(r'^update_members_makeups$', admin.update_members_makeups),
url(r'^delete_shift_registration$', admin.delete_shift_registration),
url(r'^delete_shift_template_registration$', admin.delete_shift_template_registration),
url(r'^admin/manage_attached$', admin.manage_attached),
url(r'^admin/manage_attached/create_pair$', admin.create_pair),
url(r'^admin/manage_attached/delete_pair$', admin.delete_pair),
url(r'^get_makeups_members$', admin.get_makeups_members),
url(r'^update_members_makeups$', admin.update_members_makeups),
url(r'^delete_shift_registration$', admin.delete_shift_registration),
url(r'^get_member_info/(\d+)$', admin.get_member_info),
url(r'^get_attached_members$', admin.get_attached_members),
]
......@@ -70,6 +70,11 @@ class OdooAPI:
return self.models.execute_kw(self.db, self.uid, self.passwd,
entity, 'create', [fields])
def delete(self, entity, ids):
"""Destroy entity instance by given ids."""
return self.models.execute_kw(self.db, self.uid, self.passwd,
entity, 'unlink', [ids])
def execute(self, entity, method, ids, params={}):
return self.models.execute_kw(self.db, self.uid, self.passwd,
entity, method, [ids], params)
......
......@@ -6,7 +6,7 @@
.b_yellow {background: #fcf3cc;}
.red {color:#FF0000;}
.b_red, .b_less_than_25pc {background:#ff3333 !important;}
.loading {background-image: url("/static/img/ajax-loader.gif"); background-repeat:no-repeat;}
.loading {background-image: url("/static/img/ajax-loader.gif"); background-repeat:no-repeat; background-position: center; background-color: #efefef;}
.loading2 {display: none; position:absolute; top:-20px;}
.loading2-container {position:relative;}
......
var actions_last_dates = {};
var show_enqueued_messages = function() {
var stored = null;
try {
stored = JSON.parse(localStorage.getItem('enqueued_messages'));
alert(stored.join("\n"))
localStorage.removeItem('enqueued_messages')
} catch (e) {
//no rescue system for the moment
}
};
var enqueue_message_for_next_loading = function(msg) {
try {
let messages = [],
stored = localStorage.getItem('enqueued_messages');
if (stored) {
messages = JSON.parse(stored);
}
messages.push(msg)
localStorage.setItem('enqueued_messages', JSON.stringify(messages));
} catch (e) {
//no rescue system for the moment
}
}
function get_litteral_shift_template_name(name) {
var l_name = '';
......@@ -209,6 +236,10 @@ function openModal() {
// 4th argument: if set and false, validate button doesn't close the modal
if (typeof (arguments[3]) == "undefined" || arguments[3] != false)
btn_ok.on('click', closeModal);
else
btn_ok.on('click', function() {
$(this).addClass("loading")
})
btns.append(btn_ok);
......@@ -482,3 +513,5 @@ function isMacUser() {
}
if (isMacUser() && isSafari()) $('.mac-msg').show();
show_enqueued_messages();
\ No newline at end of file
......@@ -29,10 +29,9 @@
Gestion des présences
<span class="management_type_button_icons"><i class="fas fa-arrow-right"></i></span>
</button><br>
<button type="button" class="btn--primary management_type_button" id="manage_attached_button" disabled>
<button type="button" class="btn--primary management_type_button" id="manage_attached_button">
Gestion des binômes
<span class="management_type_button_icons"><i class="fas fa-wrench"></i></span>
{# <span class="management_type_button_icons"><i class="fas fa-arrow-right"></i></span> #}
<span class="management_type_button_icons"><i class="fas fa-arrow-right"></i></span>
</button><br>
<button type="button" class="btn--primary management_type_button" id="manage_regular_shifts_button">
Gestion des créneaux
......
{% extends "base.html" %}
{% load static %}
{% block additionnal_css %}
<link rel="stylesheet" href="{% static 'css/datatables/datatables.min.css' %}">
<link rel="stylesheet" href="{% static 'css/admin/manage_attached.css' %}">
<link rel="stylesheet" href="{% static 'jquery-ui-1.12.1/jquery-ui.min.css' %}">
{% endblock %}
{% block additionnal_scripts %}
<script type="text/javascript" src="{% static 'jquery-ui-1.12.1/jquery-ui.min.js' %}"></script>
<script type="text/javascript" src="{% static 'js/datatables/datatables.min.js' %}"></script>
{% endblock %}
{% block content %}
<div class="page_body">
<div id="back_to_admin_index">
<button type="button" class="btn--danger"><i class="fas fa-arrow-left"></i>&nbsp; Retour</button>
</div>
<div class="login_area">
{% include "common/conn_admin.html" %}
</div>
<div class="header txtcenter">
<h1>Gestion des Binômes</h1>
</div>
<div class="page_content">
<div class="management_type_buttons txtcenter">
<button type="button" class="btn--primary management_type_button" id="manage_attached_create_pair_button">
Créer un binôme
<span class="management_type_button_icons"></span>
</button><br>
<button type="button" class="btn--primary management_type_button" id="manage_attached_delete_pair_button">
Désolidariser un binôme
<span class="management_type_button_icons"></span>
</button><br>
</div>
</div>
</div>
<script src='{% static "js/all_common.js" %}?v='></script>
<script src='{% static "js/admin/manage_attached.js" %}?v='></script>
<script src='{% static "js/admin/bdm_index.js" %}?v='></script>
{% endblock %}
\ No newline at end of file
{% extends "base.html" %}
{% load static %}
{% block additionnal_css %}
<link rel="stylesheet" href="{% static 'css/datatables/datatables.min.css' %}">
<link rel="stylesheet" href="{% static 'css/admin/manage_attached.css' %}">
<link rel="stylesheet" href="{% static 'jquery-ui-1.12.1/jquery-ui.min.css' %}">
{% endblock %}
{% block additionnal_scripts %}
<script type="text/javascript" src="{% static 'jquery-ui-1.12.1/jquery-ui.min.js' %}"></script>
<script type="text/javascript" src="{% static 'js/datatables/datatables.min.js' %}"></script>
{% endblock %}
{% block content %}
<div id="template" style="display:None;">
<div id="confirmModal">
<h3>Le binôme est sur le point d'être créé</h3>
<br/>
<p>Voulez-vous vraiment créer le binôme avec comme titulaire <b><span id="parentName"></span></b> et comme suppléant <b><span id="childName"></span></b>
<p>Êtes-vous sur de vouloir continuer ?</p>
<hr/>
</div>
</div>
<div class="page_body">
<div id="back_to_admin_index">
<button type="button" class="btn--danger"><i class="fas fa-arrow-left"></i>&nbsp; Retour</button>
</div>
<div class="login_area">
{% include "common/conn_admin.html" %}
</div>
<div class="header txtcenter">
<h1>Gestion des Binômes</h1>
</div>
<div class="page_content">
<div class="tiles_container">
<div class="tile">
<div class="search_member_form_area" id="search_member_form_area">
<h4>Rechercher le.a coopérateur.ice titulaire</h4>
<form autocomplete="off" id="search_member_form" class="search_member_form" action="javascript:;" method="post">
<input name="searchParent" type="text" id="search_member_input" value="" placeholder="Nom ou numéro du coop..." required>
<img id="spinner1" class="spinner" src="{% static 'img/Loading_2.gif' %}" alt="loading" style="display:none;">
</form>
</div>
<div id="parentInfo" style="display:none;">
<div class="tile_title">
<i class="fas fa-user tile_icon"></i>
<span class="member_info member_name"></span>
</div>
<div class="tile_content">
<div class="member_status_text_container">
<span>Mon statut : </span>
<span class="member_info member_status"></span>
<br>
<span>Nombre de rattrapage(s) : </span>
<span class="member_makeups_to_do member_info"></span>
</div>
<div class="member_shift_name_area">
<span>Mon créneau : </span>
<span class="member_shift_name member_info"></span>
</div>
</div>
</div>
</div>
<div class="create_pair_button">
<button id="createPair" type="button" name="button" disabled>Créer le binôme</button>
</div>
<div class="tile">
<div class="search_member_form_area" id="search_member_form_area">
<h4>Rechercher le.a coopérateur.ice suppléant.e</h4>
<form autocomplete="off" id="search_member_form_child" class="search_member_form" action="javascript:;" method="post">
<input name="searchChild" type="text" id="search_child_input" value="" placeholder="Nom ou numéro du coop..." required>
<img id="spinner2" class="spinner" src="{% static 'img/Loading_2.gif' %}" alt="loading" style="display:none;">
</form>
</div>
<div id="childInfo" style="display:none;">
<div class="tile_title">
<i class="fas fa-user tile_icon"></i>
<span class="member_info member_name"></span>
</div>
<div class="tile_content">
<div class="member_status_text_container">
<span>Mon statut : </span>
<span class="member_info member_status"></span>
<br>
<span>Nombre de rattrapage(s) : </span>
<span class="member_makeups_to_do member_info"></span>
</div>
<div class="member_shift_name_area">
<span>Mon créneau : </span>
<span class="member_shift_name member_info"></span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script src='{% static "js/all_common.js" %}?v='></script>
<script src='{% static "js/admin/manage_attached.js" %}?v='></script>
{% endblock %}
{% extends "base.html" %}
{% load static %}
{% block additionnal_css %}
<link rel="stylesheet" href="{% static 'css/datatables/datatables.min.css' %}">
<link rel="stylesheet" href="{% static 'css/admin/manage_attached.css' %}">
<link rel="stylesheet" href="{% static 'jquery-ui-1.12.1/jquery-ui.min.css' %}">
{% endblock %}
{% block additionnal_scripts %}
<script type="text/javascript" src="{% static 'jquery-ui-1.12.1/jquery-ui.min.js' %}"></script>
<script type="text/javascript" src="{% static 'js/datatables/datatables.min.js' %}"></script>
{% endblock %}
{% block content %}
<div id="template" style="display:None;">
<div id="confirmModal">
<div class="mconfirm">
<h3>Le binôme est sur le point d'être désolidarisé</h3>
<br />
<p>Êtes-vous sur de vouloir désolidariser <b><span id="parentName"></span></b> et
<b><span id="childName"></span></b>
</p>
<hr/>
</div>
</div>
</div>
<div class="page_body">
<div id="back_to_admin_index">
<button type="button" class="btn--danger"><i class="fas fa-arrow-left"></i>&nbsp; Retour</button>
</div>
<div class="login_area">
{% include "common/conn_admin.html" %}
</div>
<div class="header txtcenter">
<h1>Gestion des Binômes</h1>
</div>
<div class="page_content">
<div id="subheader">
<h4>Liste des membres en binômes</h4>
</div>
<div class="table_area">
<table id="attached_members_table" class="display" cellspacing="0" width="100%"></table>
</div>
</div>
</div>
<script src='{% static "js/all_common.js" %}?v='></script>
<script src='{% static "js/admin/manage_attached.js" %}?v='></script>
{% endblock %}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment