diff --git a/src/includes/components/widgets.pug b/src/includes/components/widgets.pug index 8c22bbecb20fd6ae51409935be919d829383bc0c..0660933920b7f2156b4fc3959ec3a9886ff5904b 100644 --- a/src/includes/components/widgets.pug +++ b/src/includes/components/widgets.pug @@ -109,6 +109,14 @@ sib-widget(name='cs-broken-action') data-src="\${src}" next="\${value}" ) <i class="fas fa-heart-broken"></i> ${label} + +sib-widget(name='cs-request-status-action') + template + div + sib-link.button_base.pull-right( + data-src="\${src}" + next="confirm_status_change" + ) ${label} sib-widget(name='cs-section_introduction') template diff --git a/src/includes/mentor/resources/confirmation-status-change.pug b/src/includes/mentor/resources/confirmation-status-change.pug new file mode 100644 index 0000000000000000000000000000000000000000..924d4f275928712cdb23dbd5ed806e876b3c5b86 --- /dev/null +++ b/src/includes/mentor/resources/confirmation-status-change.pug @@ -0,0 +1,18 @@ +include ../../components/widgets + +.block_log.block_creat_count.no_shadow + sib-link(class="backlink", next="mentor-resource-list") + .like + p + i.fas.fa-times + + h2.title_lead_avenir Are you sur you want to archive this request ? + + sib-form#change_status_request( + bind-resources + fields='button(status, name, description, skills)' + value-status = "validated" + widget-button = "hidden-widget" + submit-button = "Archive this request" + next="mentor-resource-list" + ) diff --git a/src/includes/mentor/resources/list.pug b/src/includes/mentor/resources/list.pug index 7ab4c61c3e6a384f84bf8bfdf2ac3fd3c44e0641..4f0d522c2a931440df38929d4ca5ee314ae04775 100644 --- a/src/includes/mentor/resources/list.pug +++ b/src/includes/mentor/resources/list.pug @@ -2,10 +2,14 @@ include ../../components/widgets sib-router sib-route( name='confirm_suppress', use-id) + sib-route( name='confirm_status_change', id-prefix=`${endpoints.requests}`, use-id) dialog#confirm_suppress.no-sidebar include ./confirmation-deletion +dialog#confirm_status_change.no-sidebar + include ./confirmation-status-change + div.container_min h2.title_lead.fd_bleu International index of resources for cooperative mentors and entrepreneurs button.button_dark.pull-right Watch the presentation @@ -58,11 +62,11 @@ div.block_list div#loader-requests-mentor hidden i.fas.fa-spinner.fa-spin - sib-display.request_accordion( + sib-display#request-list.request_accordion( loader-id="loader-requests-mentor" data-src=`${endpoints.requests}` - fields='name, content(description, info(fields, language.name, target, submitter.email), create)', - + fields='name, content(description, info(fields, language.name, target, submitter.email, status))', + search-fields='status' label-target='Target audience:' label-language.name='Language:' label-submitter.email="submitter'email :" @@ -74,10 +78,13 @@ div.block_list widget-target='cs-display-resource-property' widget-submitter.email='cs-display-resource-property' widget-name='accordion-request-resource' + search-widget-status='hidden-widget' + search-value-status='pending' + + label-status='Dealt with' + widget-status='cs-request-status-action' + action-status="status" - label-create='Post a resource' - action-create="mentor-resource-create" - widget-create='cs-validate-action' ) diff --git a/src/scripts/coopstarter.js b/src/scripts/coopstarter.js index 33cea8bf7ec21dc3da65da4e9ee5d7e267aee0eb..205bf06eb7841f1c5020bfd94c1821b0c9979c5c 100644 --- a/src/scripts/coopstarter.js +++ b/src/scripts/coopstarter.js @@ -196,8 +196,9 @@ function manageAccordionForRequest(){ /* Toggle between hiding and showing the active panel */ var panelRequest = this.nextElementSibling; - if (panelRequest.style.maxHeight) { + if (!this.classList.contains("active")) { panelRequest.style.maxHeight = null; + refreshPagination(); } else { panelRequest.style.maxHeight = panelRequest.scrollHeight + "px"; } @@ -228,7 +229,6 @@ function addProperFilterToSearchComponents(targetId) { var forms = baseElement.querySelectorAll(".resource_by_step"); forms.forEach(form => { form.addEventListener("populate", e => { - //Manage fake tabs let tabs = baseElement.getElementsByClassName("filter_by_type"); for (let tab of tabs) { @@ -243,7 +243,9 @@ function addProperFilterToSearchComponents(targetId) { //https://git.happy-dev.fr/startinblox/framework/sib-core/issues/379 //TODO: Wait for a solution to filter with multiple value with "OR" instead of "AND". let keyword_form = baseElement.querySelectorAll(".search-by-keyword")[0]; - let keyword_field = keyword_form.querySelector(`input[name="name_keyword"]`); + let keyword_field = keyword_form.querySelector( + `input[name="name_keyword"]` + ); if (keyword_field) { let keyword_submit = baseElement.querySelectorAll(" .keyword_submit")[0]; @@ -287,12 +289,9 @@ function addProperFilterToSearchComponents(targetId) { //Manage fake tabs for type let tabs = baseElement.getElementsByClassName("filter_by_type"); for (let tab of tabs) { - tab.addEventListener( - "click", - function() { - selectHiddenManagementForType(tab, form) - } - ); + tab.addEventListener("click", function() { + selectHiddenManagementForType(tab, form); + }); } //To retrieve format @@ -427,6 +426,7 @@ jQuery(document).ready(function($) { refreshList("mentor_profile_edition", "mentor_complementary"); refreshList("mentor_profile_edition", "mentor_contact"); refreshList("mentor_profile_edition", "user-account-picture"); + refreshList("change_status_request", "request-list"); var header_dropdown = $(".dropdownWrapper"), drop_choices = header_dropdown.find(".dropdownLabel"); @@ -451,23 +451,21 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXX MENTOR DASHBOARD XXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX*/ window.setTimeout(() => { - var forms = document.querySelectorAll("sib-form"); - forms.forEach(form => { - form.addEventListener("populate", e => { + // var forms = document.querySelectorAll("sib-form"); + // forms.forEach(form => { + // form.addEventListener("populate", e => { var previewImage = document.querySelectorAll( "sib-form-file input[name='preview_image']+input" ); - var previewlabel = document.querySelectorAll( - "sib-form-file div" - ); + var previewlabel = document.querySelectorAll("sib-form-file div"); for (let item of previewlabel) { - item.innerHTML="Upload a file" + item.innerHTML = "Upload a file"; } for (let item of previewImage) { item.addEventListener("change", loadFile); } - }); + // }); //Manage the accordion in request mentor dashboard. manageAccordionForRequest() @@ -494,9 +492,9 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX*/ }) ); }); - } - }); - }, 2000); + // } + }; + }, 3000); /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX diff --git a/src/styles/index.scss b/src/styles/index.scss index 562fca4e965af1baa21efda316fd092117f6fe1e..665ec505d677955d8eccdd35835c106315bb59fa 100644 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -1266,7 +1266,7 @@ sib-set-default[name="submitter_info"]{ } } /* XXXXXXXXXXXXXXXXXXXXXXXXX Modal XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX*/ -#confirm_suppress, #resource-validation-process, +#confirm_suppress, #confirm_status_change, #resource-validation-process, #resource-validation-process-confirmation { border: none; top: 0;