Commit 37baee98 by Etienne Freiss

work

parent e6577d4f
...@@ -52,7 +52,6 @@ ...@@ -52,7 +52,6 @@
#shifts_list { #shifts_list {
flex-direction: column; flex-direction: column;
display: none; display: none;
width: min-content;
max-width: 100%; max-width: 100%;
white-space: nowrap; white-space: nowrap;
} }
......
...@@ -146,6 +146,7 @@ function init_history() { ...@@ -146,6 +146,7 @@ function init_history() {
* Init the Incoming shifts section: display them * Init the Incoming shifts section: display them
*/ */
function init_incoming_shifts() { function init_incoming_shifts() {
console.log(partner_data)
$(".loading-incoming-shifts").hide(); $(".loading-incoming-shifts").hide();
$("#incoming_shifts").show(); $("#incoming_shifts").show();
...@@ -157,6 +158,28 @@ function init_incoming_shifts() { ...@@ -157,6 +158,28 @@ function init_incoming_shifts() {
for (shift of incoming_shifts) { for (shift of incoming_shifts) {
let shift_line_template = prepare_shift_line_template(shift.date_begin); let shift_line_template = prepare_shift_line_template(shift.date_begin);
if(partner_data.associated_partner_id != "False" && shift.associate_registered==="partner"){
shift_line_template.find(".shift_line_associate").text(' - '+partner_data.name+'')
}else if(partner_data.associated_partner_id != "False" && shift.associate_registered==="associated"){
shift_line_template.find(".shift_line_associate").text(' - '+partner_data.associated_partner_name+'')
}else if(partner_data.associated_partner_id != "False" && shift.associate_registered==="both"){
shift_line_template.find(".shift_line_associate").text(' - Les deux' )
}
else if(partner_data.parent_id != "False" && shift.associate_registered==="partner"){
shift_line_template.find(".shift_line_associate").text(' - '+partner_data.parent_name+'')
}else if(partner_data.parent_id != "False" && shift.associate_registered==="associated"){
shift_line_template.find(".shift_line_associate").text(' - '+partner_data.name+'')
}else if(partner_data.parent_id != "False" && shift.associate_registered==="both"){
shift_line_template.find(".shift_line_associate").text(' - Les deux' )
}
$("#incoming_shifts").append(shift_line_template.html()); $("#incoming_shifts").append(shift_line_template.html());
} }
} }
......
...@@ -112,6 +112,7 @@ function add_or_change_shift(new_shift_id) { ...@@ -112,6 +112,7 @@ function add_or_change_shift(new_shift_id) {
} }
function init_shifts_list() { function init_shifts_list() {
console.log(partner_data)
$(".loading-incoming-shifts").hide(); $(".loading-incoming-shifts").hide();
$("#shifts_list").show(); $("#shifts_list").show();
...@@ -142,6 +143,30 @@ function init_shifts_list() { ...@@ -142,6 +143,30 @@ function init_shifts_list() {
shift_line_template.find(".checkbox").prop("value", shift.id); shift_line_template.find(".checkbox").prop("value", shift.id);
} }
if(partner_data.associated_partner_id === "False" && partner_data.parent_id === "False"){
shift_line_template.find('.affect_associate_reistered').hide();
}else{
shift_line_template.find('.affect_associate_registered').attr('id',shift.id)
if (shift.associate_registered==="both"){
shift_line_template.find('.affect_associate_registered').text("Les deux")
}else if (shift.associate_registered==="partner"){
if(partner_data.associated_partner_id !== "False"){
shift_line_template.find('.affect_associate_registered').text(partner_data.name)
}else{
shift_line_template.find('.affect_associate_registered').text(partner_data.parent_name)
}
}else if (shift.associate_registered==="associate"){
if(partner_data.associated_partner_id !== "False"){
shift_line_template.find('.affect_associate_registered').text(partner_data.associated_partner_name)
}else{
shift_line_template.find('.affect_associate_registered').text(partner_data.name)
}
}else{
shift_line_template.find('.affect_associate_registered').text("A déterminer")
}
}
$("#shifts_list").append(shift_line_template.html()); $("#shifts_list").append(shift_line_template.html());
} }
...@@ -171,6 +196,32 @@ function init_shifts_list() { ...@@ -171,6 +196,32 @@ function init_shifts_list() {
} }
} }
}); });
$(".affect_associate_registered").on("click", function(e) {
// Display modal
let modal_template = $("#modal_affect_shift");
console.log( modal_template.find(".partner").html())
if(partner_data.associated_partner_id != "False") {
modal_template.find(".partner").text(partner_data.name);
modal_template.find(".associate").text(partner_data.associated_partner_name);
}else{
modal_template.find(".partner").text(partner_data.associated_partner_name);
modal_template.find(".associate").text(partner_data.parent_name);
}
// modal_template.find(".time_old_shift").text(old_shift_time);
// modal_template.find(".date_new_shift").text(new_shift_date);
// modal_template.find(".time_new_shift").text(new_shift_time);
openModal(
modal_template.html(),
() => {
// add_or_change_shift(new_shift_id);
},
"Valider"
);
modal.find(".btn-modal-ok").hide()
});
} }
} }
...@@ -480,7 +531,6 @@ function init_shifts_exchange() { ...@@ -480,7 +531,6 @@ function init_shifts_exchange() {
$(".select_makeups").on('click', () => { $(".select_makeups").on('click', () => {
openModal(); openModal();
// Create 6 month delay // Create 6 month delay
request_delay() request_delay()
.then(() => { .then(() => {
......
...@@ -83,7 +83,7 @@ class CagetteShift(models.Model): ...@@ -83,7 +83,7 @@ class CagetteShift(models.Model):
def get_shift_partner(self, id): def get_shift_partner(self, id):
"""Récupère les shift du membre""" """Récupère les shift du membre"""
fields = ['date_begin', 'date_end','final_standard_point', fields = ['date_begin', 'date_end','final_standard_point',
'shift_id', 'shift_type','partner_id', "id"] # res.partner 'shift_id', 'shift_type','partner_id', "id", "associate_registered"] # res.partner
cond = [['partner_id.id', '=', id],['state', '=', 'open'], cond = [['partner_id.id', '=', id],['state', '=', 'open'],
['date_begin', '>', datetime.datetime.now().isoformat()]] ['date_begin', '>', datetime.datetime.now().isoformat()]]
shiftData = self.o_api.search_read('shift.registration', cond, fields, order ="date_begin ASC") shiftData = self.o_api.search_read('shift.registration', cond, fields, order ="date_begin ASC")
......
...@@ -31,17 +31,34 @@ ...@@ -31,17 +31,34 @@
<div id="shift_line_template"> <div id="shift_line_template">
<div class="shift_line"> <div class="shift_line">
<i class="fas fa-chevron-right shift_line_chevron"></i> <i class="fas fa-chevron-right shift_line_chevron"></i>
<span class="shift_line_date"></span> - <span class="shift_line_time"></span> <span class="shift_line_date"></span> - <span class="shift_line_time"></span> <span class="shift_line_associate"> </span>
</div> </div>
</div> </div>
<div id="selectable_shift_line_template"> <div id="selectable_shift_line_template">
<div class="d-flex">
<div class="selectable_shift_line btn--primary"> <div class="selectable_shift_line btn--primary">
<input type="checkbox" class="checkbox"> <input type="checkbox" class="checkbox">
<div class="selectable_shift_line_text"> <div class="selectable_shift_line_text">
<span class="shift_line_date"></span> - <span class="shift_line_time"></span> <span class="shift_line_date"></span> - <span class="shift_line_time"></span>
</div> </div>
</div> </div>
<div class="affect_associate_registered button--warning">
</div>
</div>
</div>
<div id="modal_affect_shift">
<div>Qui sera présent ?</div>
<div class="partner btn--primary">
</div>
<div class="associate btn--primary">
</div>
<div class="both btn--primary">
Les deux
</div>
</div> </div>
<div id="modal_shift_exchange_template"> <div id="modal_shift_exchange_template">
......
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