diff --git a/src/includes/account-creation.pug b/src/includes/account-creation.pug index 4c83f46b7ddfdfe7f070a49c3529891a18111d2b..a268f923950a30d7ea33dedeea962b298879f9d7 100644 --- a/src/includes/account-creation.pug +++ b/src/includes/account-creation.pug @@ -24,7 +24,7 @@ sib-router(default-route='account-creation-index') h2.button_base I am an entrepreneur #mentor-new-account(hidden).no-sidebar.container - include mentor/create.pug + include mentor/profile/create.pug #entrepreneur-new-account(hidden).no-sidebar.container - include entrepreneur/create.pug + include entrepreneur/profile/create.pug diff --git a/src/includes/entrepreneur/components/menu.pug b/src/includes/entrepreneur/components/menu.pug index 79869cdc9887ec34016828034c5f6dd3cfeefdb3..b69341d19cd3c24f102b4b5408e8ba5b4b1ac7fb 100644 --- a/src/includes/entrepreneur/components/menu.pug +++ b/src/includes/entrepreneur/components/menu.pug @@ -1,4 +1,5 @@ sib-router(default-route='entrepreneur-resource-list') sib-route(name='entrepreneur-resource-list') sib-route(name='entrepreneur-account', id-prefix=`${endpoints.users}`, use-id) + sib-route(name='entrepreneur-account-edit', id-prefix=`${endpoints.users}`, use-id) \ No newline at end of file diff --git a/src/includes/entrepreneur/dashboard.pug b/src/includes/entrepreneur/dashboard.pug index 55d83d3493c259e70335e8144e3e824911492966..422ad21fd8a727c97644a9127b34b4fcfdc5b62f 100644 --- a/src/includes/entrepreneur/dashboard.pug +++ b/src/includes/entrepreneur/dashboard.pug @@ -8,10 +8,6 @@ header#header(role='banner') section#home - 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 - //TODO: //-Distinguish the search form from the listing //-Create two Sib-displays getting the resources by "types" @@ -21,7 +17,7 @@ section#home //TODO : investigate why we have to remove hidden attribute to see this even if we are on the right route. - #entrepreneur-resource-list() + #entrepreneur-resource-list(hidden).no-sidebar.container include ./resources/list.pug sib-router @@ -36,5 +32,8 @@ section#home p.flex sib-link(next='entrepreneur-resource-list', class='button_base') Ok - #entrepreneur-account(hidden) - h2 account + #entrepreneur-account(hidden).no-sidebar.container + include profile/detail.pug + + #entrepreneur-account-edit(hidden).no-sidebar.container + include profile/edit.pug diff --git a/src/includes/entrepreneur/create.pug b/src/includes/entrepreneur/profile/create.pug similarity index 96% rename from src/includes/entrepreneur/create.pug rename to src/includes/entrepreneur/profile/create.pug index 1a07b3822f25844da13eaa7304eb218c0702815a..8eb14484cb31bbd26206253af3e000870482f81b 100644 --- a/src/includes/entrepreneur/create.pug +++ b/src/includes/entrepreneur/profile/create.pug @@ -1,4 +1,4 @@ -include ../components/widgets +include ../../components/widgets figure.logo img(src="../images/logo.png" diff --git a/src/includes/entrepreneur/profile/detail.pug b/src/includes/entrepreneur/profile/detail.pug new file mode 100644 index 0000000000000000000000000000000000000000..a597bd0cb78a454819cb3e489fde11c7854867d0 --- /dev/null +++ b/src/includes/entrepreneur/profile/detail.pug @@ -0,0 +1,40 @@ +include ../../components/widgets + +div.container_min + h2.title_lead.fd_bleu My Account + +div.block_list.flex + div.button__actions.w_25 + + div.dashboard__database + sib-link(next='entrepreneur-database') + div.button_base.ico_gauche.ico_database Browse database + + div.dashboard__database + sib-link(next='entrepreneur-resource-list') + div.button_base.ico_gauche.ico_search Back to dashboard + + div.dashboard__database + div.logout-button.button_base( + role='log out' + ) Logout + + div.profile_information.block_log.w_75 + sib-link(next='entrepreneur-account-edit') + button.button_edit Edit + + sib-display( + bind-user + fields='name, entrepreneur_profile.organisation.name, registered_on' + widget-name='cs-display-property' + widget-entrepreneur_profile.organisation.name='cs-display-property' + widget-entrepreneur_profile.registered_on='cs-display-property' + ) + + sib-display( + bind-user + fields='email' + label-email='Email:' + class-email="contact_profil" + widget-email='cs-display-resource-property' + ) \ No newline at end of file diff --git a/src/includes/entrepreneur/profile/edit.pug b/src/includes/entrepreneur/profile/edit.pug new file mode 100644 index 0000000000000000000000000000000000000000..3f0197f8e9e1544b6b7090b085ca80eeeb182f91 --- /dev/null +++ b/src/includes/entrepreneur/profile/edit.pug @@ -0,0 +1,29 @@ +include ../../components/widgets + +h2.title_create Edit your account + +sib-form.block_log.block_creat_count( + bind-user + fields="last_name, first_name, username, email, entrepreneur_profile.organisation" + + range-entrepreneur_profile.organisation=`${endpoints.organisations}` + + label-first_name="Surname" + label-last_name="Name" + label-username="Username" + label-entrepreneur_profile.organisation="Organisation" + + widget-username="sib-form-hidden" + + class-last_name='form-label is-dark input_big' + class-first_name='form-label is-dark input_big' + class-email='form-label is-dark input_big' + class-entrepreneur_profile.phone='form-label is-dark input_big' + + class-entrepreneur_profile.organisation='form-label is-dark input_big' + multiple-entrepreneur_profile.organisation='sib-multiple-select' + widget-entrepreneur_profile.organisation='sib-form-auto-completion' + + submit-button="Save modifications" + next='entrepreneur-resource-list' +) \ No newline at end of file diff --git a/src/includes/entrepreneur/resources/list.pug b/src/includes/entrepreneur/resources/list.pug index 6cd839a3b104b5f47fdc9000dc8a65d325e42bbb..ae045d1c4a2eaaacca516ba2bd16bda84bdcd5db 100644 --- a/src/includes/entrepreneur/resources/list.pug +++ b/src/includes/entrepreneur/resources/list.pug @@ -1,6 +1,8 @@ include ../../components/widgets - +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 //-Question : //In my opinion, "multiple ressource" solution is closer to the wanted result than the "group-by" solution @@ -24,8 +26,11 @@ include ../../components/widgets widget-name_keyword='cs-display-property' widget-author='cs-display-property' - submit-button='Search' - ) + naked + ) + + div#keyword_submit.button__actions + div.button_base.ico_gauche Search sib-form( data-src=`${endpoints.resources}`, @@ -70,6 +75,12 @@ include ../../components/widgets naked ) +div.side-block.block_log + p Can't find the ressource you need ? + div.button__actions + sib-link(next='entrepreneur-request-create') + div + div.button_base.ico_gauche.ico_plus Make a request #circles sib-display#circles-list( @@ -288,9 +299,3 @@ include ../../components/widgets //- widget-description='cs-display-property' //- widget-name='cs-display-property' -div.side-block - p Can't find the ressource you need ? - div.button__actions - sib-link(next='entrepreneur-request-create') - div - div.button_base.ico_gauche.ico_plus Make a request \ No newline at end of file diff --git a/src/includes/mentor/components/menu.pug b/src/includes/mentor/components/menu.pug index 8dc3954f695aeb56a8e3ca2cbe71c2d066ef0ae2..f52aa70cbaa020513d84cabf4d20d5bea6b0c172 100644 --- a/src/includes/mentor/components/menu.pug +++ b/src/includes/mentor/components/menu.pug @@ -1,6 +1,7 @@ sib-router(default-route='mentor-resource-list') sib-route(name='mentor-resource-list') sib-route(name='mentor-account', id-prefix=`${endpoints.users}`, use-id) + sib-route(name='mentor-account-edit', id-prefix=`${endpoints.users}`, use-id) sib-ac-checker(permission="acl:Write") sib-route(name='mentor-resource-create') sib-ac-checker(permission="acl:Write" bind-resources) diff --git a/src/includes/mentor/dashboard.pug b/src/includes/mentor/dashboard.pug index 77b3b6035392b82f59cea967415e3a0fb9175d02..245cf662f7ebaf9f5ef8a9837bdd2c63c11ba4d7 100644 --- a/src/includes/mentor/dashboard.pug +++ b/src/includes/mentor/dashboard.pug @@ -43,4 +43,9 @@ section#home include resources/list.pug #mentor-account(hidden).no-sidebar.container - include profile.pug + include profile/detail.pug + + #mentor-account-edit(hidden).no-sidebar.container + include profile/edit.pug + + diff --git a/src/includes/mentor/create.pug b/src/includes/mentor/profile/create.pug similarity index 98% rename from src/includes/mentor/create.pug rename to src/includes/mentor/profile/create.pug index 3b6d162d18bce98a36375810fc0f4c5639acab02..96049e4fcfaca9a2e2f3df66908c8c3b54860b43 100644 --- a/src/includes/mentor/create.pug +++ b/src/includes/mentor/profile/create.pug @@ -1,4 +1,4 @@ -include ../components/widgets +include ../../components/widgets figure.logo img(src="../images/logo.png" diff --git a/src/includes/mentor/profile.pug b/src/includes/mentor/profile/detail.pug similarity index 94% rename from src/includes/mentor/profile.pug rename to src/includes/mentor/profile/detail.pug index 55c9374b73295a8c7c57a8d8a8ee59c1031ae65c..00a95bf89c4aebfbc3d6f31e86fdc545a09fa84b 100644 --- a/src/includes/mentor/profile.pug +++ b/src/includes/mentor/profile/detail.pug @@ -1,4 +1,4 @@ -include ../components/widgets +include ../../components/widgets div.container_min h2.title_lead.fd_bleu My Account @@ -19,11 +19,14 @@ div.block_list.flex div.button_base.ico_gauche.ico_search Back to dashboard div.dashboard__database - div#logout-button.button_base( + div.logout-button.button_base( role='log out' ) Logout div.profile_information.block_log.w_75 + sib-link(next='mentor-account-edit') + button.button_edit Edit + sib-display( bind-user fields='account.picture, name, mentor_profile.headline, mentor_profile.city, mentor_profile.country, registered_on' diff --git a/src/includes/mentor/profile/edit.pug b/src/includes/mentor/profile/edit.pug new file mode 100644 index 0000000000000000000000000000000000000000..773da3ff42668170307730e4f515c0c0788e27c0 --- /dev/null +++ b/src/includes/mentor/profile/edit.pug @@ -0,0 +1,62 @@ +include ../../components/widgets + +h2.title_create Edit your account + +sib-form.block_log.block_creat_count( + bind-user + fields="account_information(last_name, first_name, mentor_profile.organisation,\ + mentor_profile.phone, mentor_profile.languages, mentor_profile.fields),\ + about_you(header_about_you, account.picture, mentor_profile.headline, mentor_profile.city, mentor_profile.country,\ + mentor_profile.biography, mentor_profile.skills),\ + social_media(header_social_media, mentor_profile.linkedin, mentor_profile.twitter), username" + + range-mentor_profile.fields=`${endpoints.fields}` + range-mentor_profile.organisation=`${endpoints.organisations}` + range-mentor_profile.languages=`${endpoints.languages}` + + label-header_about_you="About you" + label-header_social_media="Social medias" + + widget-header_social_media="cs-section_header" + widget-header_about_you="cs-section_introduction" + + label-first_name="Surname" + label-last_name="Name" + label-mentor_profile.organisation="Organisation" + label-mentor_profile.phone="Phone number" + label-mentor_profile.languages="Languages" + label-mentor_profile.fields="Fields" + label-account.picture="Photo" + label-mentor_profile.headline="Headline or current position" + class-mentor_profile.headline="w_75" + label-mentor_profile.city="City" + label-mentor_profile.country="Country" + label-mentor_profile.biography="Tell us more about your activities" + label-mentor_profile.skills="What skills can you share with our entrepreneurs ?" + label-mentor_profile.linkedin="Linkedin" + label-mentor_profile.twitter="Twitter" + + widget-mentor_profile.skills="sib-form-textarea" + widget-mentor_profile.biography="sib-form-textarea" + widget-username="sib-form-hidden" + + class-mentor_profile.organisation='form-label is-dark' + multiple-mentor_profile.organisation='sib-multiple-select' + widget-mentor_profile.organisation='sib-form-auto-completion' + + class-mentor_profile.languages='form-label is-dark' + multiple-mentor_profile.languages='sib-multiple-select' + widget-mentor_profile.languages='sib-form-auto-completion' + + class-mentor_profile.fields='form-label is-dark' + multiple-mentor_profile.fields='sib-multiple-select' + widget-mentor_profile.fields='sib-form-auto-completion' + + upload-url-account.picture=`${sdn}/upload/` + widget-account.picture='sib-form-file' + class-account.picture='input_photo w_25' + class-headline='w_75' + + submit-button="Save modifications" + next='mentor-dashboard' +) \ No newline at end of file diff --git a/src/scripts/coopstarter.js b/src/scripts/coopstarter.js index e9084b23f78cf6a13998a89f9a40144f1ba59b29..654f04c07ef01158ed255919a1cc3d4ccf1c06ce 100644 --- a/src/scripts/coopstarter.js +++ b/src/scripts/coopstarter.js @@ -1,77 +1,94 @@ function openTab(pageName, elmnt) { - // Hide all elements with class="tabcontent" by default */ - var i, tabcontent, tablinks; - tabcontent = document.getElementsByClassName("tabcontent"); - tablinks = document.getElementsByClassName("tablink"); + // Hide all elements with class="tabcontent" by default */ + var i, tabcontent, tablinks; + tabcontent = document.getElementsByClassName("tabcontent"); + tablinks = document.getElementsByClassName("tablink"); - for (i = 0; i < tabcontent.length; i++) { - tabcontent[i].style.display = "none"; - tablinks[i].classList.remove("active"); - } - - // Show the specific tab content - document.getElementById(pageName).style.display = "block"; - elmnt.classList.add("active"); + for (i = 0; i < tabcontent.length; i++) { + tabcontent[i].style.display = "none"; + tablinks[i].classList.remove("active"); + } + + // Show the specific tab content + document.getElementById(pageName).style.display = "block"; + elmnt.classList.add("active"); } function linkDatasetToField(detail, targetFormName, inputName) { - let targetForm = document.getElementById(targetFormName); - targetForm.addEventListener("populate", event => { - let resourceField = targetForm.querySelector(`input[name="${inputName}"]`); - if (resourceField) { - resourceField.value = JSON.stringify({ '@id': detail.dataset.src }); - resourceField.setAttribute('value', JSON.stringify({ '@id': detail.dataset.src })); - } - }); + let targetForm = document.getElementById(targetFormName); + targetForm.addEventListener("populate", event => { + let resourceField = targetForm.querySelector(`input[name="${inputName}"]`); + if (resourceField) { + resourceField.value = JSON.stringify({ "@id": detail.dataset.src }); + resourceField.setAttribute( + "value", + JSON.stringify({ "@id": detail.dataset.src }) + ); + } + }); } function refreshList(formId, listId) { - let form = document.getElementById(formId); - form.addEventListener("save", event => { - let list = document.getElementById(listId); - list.dataset.src = list.dataset.src; - }); + let form = document.getElementById(formId); + form.addEventListener("save", event => { + let list = document.getElementById(listId); + list.dataset.src = list.dataset.src; + }); } +jQuery(document).ready(function($) { + // Get the element with id="defaultOpen" and click on it + document.getElementById("defaultOpen").click(); + let userAccountDataSrc = document.getElementById("user-account-picture"); + linkDatasetToField(userAccountDataSrc, "validation-form", "reviewer"); + linkDatasetToField(userAccountDataSrc, "improvement-dialog-form", "reviewer"); + linkDatasetToField(userAccountDataSrc, "refusal-dialog-form", "reviewer"); -jQuery(document).ready(function($) { - // Get the element with id="defaultOpen" and click on it - document.getElementById("defaultOpen").click(); - - let userAccountDataSrc = document.getElementById("user-account-picture"); - linkDatasetToField(userAccountDataSrc, 'validation-form', 'reviewer'); - linkDatasetToField(userAccountDataSrc, 'improvement-dialog-form', 'reviewer'); - linkDatasetToField(userAccountDataSrc, 'refusal-dialog-form', 'reviewer'); + refreshList("resource-creation-form", "resources-history"); + refreshList("validation-form", "pending-resources"); + refreshList("refusal-dialog-form", "pending-resources"); + refreshList("improvement-dialog-form", "pending-resources"); - refreshList("resource-creation-form", "resources-history"); - refreshList("validation-form", "pending-resources"); - refreshList("refusal-dialog-form", "pending-resources"); - refreshList("improvement-dialog-form", "pending-resources"); - - const logoutButton = document.getElementById('logout-button'); - logoutButton.addEventListener('click', function() { - window.dispatchEvent( - new CustomEvent('requestNavigation', { detail: { route: 'splash-index' } }) - ); - document.querySelector('sib-auth').logout(); - setTimeout(function(){ location.reload(); }, 1000); - }) + const logoutButtons = document.getElementsByClassName("logout-button"); + console.log(logoutButtons); + for (var i = 0; i < logoutButtons.length; i++) { + logoutButtons[i].addEventListener("click", function() { + window.dispatchEvent( + new CustomEvent("requestNavigation", { + detail: { route: "splash-index" } + }) + ); + document.querySelector("sib-auth").logout(); + setTimeout(function() { + location.reload(); + }, 1000); + }); + } - //In the entrepreneur dashboard, we set data from the display form to the hidden ones. - let keyword_form = document.getElementById('search-by-keyword'); - keyword_form.addEventListener("populate", event => { + //In the entrepreneur dashboard, we set data from the display form to the hidden ones. + var forms = document.querySelectorAll(".resource_by_step"); + forms.forEach(form => { + form.addEventListener("populate", e => { + let keyword_form = document.getElementById("search-by-keyword"); + // keyword_form.addEventListener("populate", event => { let keyword_field = keyword_form.querySelector(`input[name="keyword"]`); - let hidden_fields= document.querySelectorAll('hidden-widget[name="search_for_a_resource"] input') - console.log(keyword_field) - console.log(hidden_fields) - keyword_field.addEventListener("input", function(){ - hidden_fields.forEach(hidden_field => { - hidden_field.setAttribute("value", keyword_field.value) - console.log(hidden_fields) - console.log("hidden_field.value", hidden_field.value) - console.log("keyword_field.value", keyword_field.value) - }); - }) - }); - }); \ No newline at end of file + let keyword_submit = document.getElementById(`keyword_submit`); + let hidden_fields = document.querySelectorAll( + 'hidden-widget[name="search_for_a_resource"] input' + ); + console.log(keyword_field); + console.log(hidden_fields); + keyword_submit.addEventListener("click", function() { + hidden_fields.forEach(hidden_field => { + hidden_field.setAttribute("value", keyword_field.value); + form.querySelector("sib-form").component.inputChange(); + console.log(hidden_fields); + console.log("hidden_field.value", hidden_field.value); + console.log("keyword_field.value", keyword_field.value); + }); + }); + }); + // }); + }); +});