Commit b7031bb8 by Damien Moulard

allow to change shift at employee validation & fix shift change not working

parent 644261a5
Pipeline #2728 passed with stage
in 1 minute 32 seconds
...@@ -55,14 +55,14 @@ function display_current_coop_form() { ...@@ -55,14 +55,14 @@ function display_current_coop_form() {
// form.find('[name="barcode_base"]').val(current_coop.barcode_base); // form.find('[name="barcode_base"]').val(current_coop.barcode_base);
form.find('[name="email"]').val(current_coop._id); form.find('[name="email"]').val(current_coop._id);
if (current_coop.shift_template && if (current_coop.shift_template &&
current_coop.shift_template.data.type == 2 && current_coop.shift_template.data.type == 2 &&
typeof manage_ftop != "undefined" && manage_ftop == true) { typeof manage_ftop != "undefined" && manage_ftop == true) {
$('#choosen_shift input').hide(); $('#choosen_shift input').hide();
ftop_shift.val('Volant'); ftop_shift.val('Volant');
ftop_shift.show(); ftop_shift.show();
} else { } else {
// Bien laisser dans cet ordre // Bien laisser dans cet ordre
$('#choosen_shift input').show(); $('#choosen_shift input').show();
ftop_shift.hide(); ftop_shift.hide();
...@@ -100,13 +100,11 @@ function display_current_coop_form() { ...@@ -100,13 +100,11 @@ function display_current_coop_form() {
$('#checks').show(); $('#checks').show();
for (var i = 1; i <= current_coop.checks_nb; i++) { for (var i = 1; i <= current_coop.checks_nb; i++) {
$(check_details).append('<p>Chèque #' + i +' : <input type="text" name="check_' + i + '" class="b_green check_item" required/> € </p>'); $(check_details).append('<p>Chèque #' + i + ' : <input type="text" name="check_' + i + '" class="b_green check_item" required/> € </p>');
} }
} }
} }
var show_change_shift = false;
if (current_coop.shift_template) { if (current_coop.shift_template) {
var st = current_coop.shift_template.data; var st = current_coop.shift_template.data;
...@@ -121,25 +119,20 @@ function display_current_coop_form() { ...@@ -121,25 +119,20 @@ function display_current_coop_form() {
place = 'Bureau'; place = 'Bureau';
} }
form.find('[name="place"]').val(place); form.find('[name="place"]').val(place);
if (current_coop.coop_msg) {
show_change_shift = true;
}
} else {
show_change_shift = true;
} }
let show_change_shift = current_coop.validation_state === 'waiting_validation_employee';
if (show_change_shift == true) { if (show_change_shift == true) {
chgt_shift_btn.show(); chgt_shift_btn.show();
chgt_shift_btn.on('click', open_shift_choice); chgt_shift_btn.on('click', open_shift_choice);
} }
if (typeof(coop_page) != "undefined") { if (typeof (coop_page) != "undefined") {
coop_page.show(); coop_page.show();
} }
} }
$('#payment_meaning').change(function() { $('#payment_meaning').change(function () {
if ($(this).val() == 'ch') { if ($(this).val() == 'ch') {
show_checks_nb(); show_checks_nb();
} else { } else {
......
...@@ -124,6 +124,8 @@ def get_shift_templates_next_shift(request, id): ...@@ -124,6 +124,8 @@ def get_shift_templates_next_shift(request, id):
def prepa_odoo(request): def prepa_odoo(request):
"""Generate coop subscription form, to be fill by BDM.""" """Generate coop subscription form, to be fill by BDM."""
template = loader.get_template('members/prepa_odoo.html') template = loader.get_template('members/prepa_odoo.html')
committees_shift_id = CagetteServices.get_committees_shift_id()
context = {'title': 'Préparation Odoo Inscriptions', context = {'title': 'Préparation Odoo Inscriptions',
'warning_placeholder': 'Par exemple, il manque un chèque', 'warning_placeholder': 'Par exemple, il manque un chèque',
'couchdb_server': settings.COUCHDB['url'], 'couchdb_server': settings.COUCHDB['url'],
...@@ -137,7 +139,9 @@ def prepa_odoo(request): ...@@ -137,7 +139,9 @@ def prepa_odoo(request):
'ask_for_street2': getattr(settings, 'SUBSCRIPTION_ADD_STREET2', False), 'ask_for_street2': getattr(settings, 'SUBSCRIPTION_ADD_STREET2', False),
'ask_for_second_phone': getattr(settings, 'SUBSCRIPTION_ADD_SECOND_PHONE', False), 'ask_for_second_phone': getattr(settings, 'SUBSCRIPTION_ADD_SECOND_PHONE', False),
'show_ftop_button': getattr(settings, 'SHOW_FTOP_BUTTON', True), 'show_ftop_button': getattr(settings, 'SHOW_FTOP_BUTTON', True),
'db': settings.COUCHDB['dbs']['member']} 'db': settings.COUCHDB['dbs']['member'],
'committees_shift_id': committees_shift_id,
}
# with_addr_complement # with_addr_complement
# with_second_phone # with_second_phone
......
...@@ -106,6 +106,7 @@ ...@@ -106,6 +106,7 @@
var mag_place_string = '{{mag_place_string}}'; var mag_place_string = '{{mag_place_string}}';
var office_place_string = '{{office_place_string}}' var office_place_string = '{{office_place_string}}'
var max_begin_hour = '{{max_begin_hour}}' var max_begin_hour = '{{max_begin_hour}}'
var committees_shift_id = '{{committees_shift_id}}';
</script> </script>
<script src="{% static "js/all_common.js" %}"?v=1651853225></script> <script src="{% static "js/all_common.js" %}"?v=1651853225></script>
<script src="{% static "js/common.js" %}"?v=1651853225></script> <script src="{% static "js/common.js" %}"?v=1651853225></script>
......
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