diff --git a/src/styles/dashboard.scss b/src/styles/dashboard.scss index 286efd385a1bf3582eda3b92d665da2a7f7d2043..9cd11569c92bb6d6ae764c0224ed7b594d732f2e 100644 --- a/src/styles/dashboard.scss +++ b/src/styles/dashboard.scss @@ -8,6 +8,7 @@ --color-body: #636363; --color-gray-1: #D3D5DD; --color-bg-page: #F2F2F2; + --color-blue-light: #D5EDFF; } body { color: var(--color-body); diff --git a/src/styles/index.scss b/src/styles/index.scss index a09a659ef8325a669915999065936387bc66ba86..58b7b5a5d08098553ee833be3113a7b0bec3c710 100644 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -405,4 +405,8 @@ main div[data-view] { margin: 0 0 10px 0; padding: 0 0 10px 10px; list-style-position: inside; +} + +.padding-bottom-none { + padding-bottom: 0; } \ No newline at end of file diff --git a/src/styles/requests.scss b/src/styles/requests.scss index 1904359a6eea3ec69052bab71946ffa5395499c0..e4b03b3f6987543a2bc3d6048a13cc6a80c0a1fe 100644 --- a/src/styles/requests.scss +++ b/src/styles/requests.scss @@ -1,5 +1,113 @@ +#tzcld-suivit { + background-color: var(--color-blue-light); + min-height: calc(100vh - 50px); + margin-top: -30px; + margin-left: -24px; + margin-right: -15px; + &>div { + padding: 30px 15px 30px 24px; + + &.padding-bottom-none { + padding-bottom: 0; + } + } + .table-requests { + nav { + display: none; + } + } + &>h2 { + margin-left: 24px; + } + +} +#tzcld-suivit-request-edit, #tzcld-suivit-request-add { label { display: block; } +} +#tzcld-suivit-requests { + background-color: var(--color-blue-light); + min-height: calc(100vh - 50px); + margin-top: -30px; + margin-left: -24px; + margin-right: -15px; + &>div { + padding: 30px 15px 30px 24px; + } + nav { + width: 100%; + display: block!important; + } +} + +.table-requests { + table { + width: 100%; + border-right: 1px solid #c9c8c8; + border-top: 1px solid #c9c8c8; + border-collapse: collapse; + box-shadow: 2px 2px 8px 0px rgba(0, 0, 0, 0.25); + th { + height: 50px; + border-right: 1px solid #fff; + color: var(--color-heading); + text-align: center; + vertical-align: middle; + border-bottom: 1px solid #c9c8c8; + border-left: 1px solid #c9c8c8; + font-size: 16px; + font-weight: 600; + letter-spacing: .25px; + background-color: var(--color-third); + + &:first-child { + text-align: left; + position: relative; + padding-left: 15px; + &:after { + display: inline; + display: none; + float: right; + content: '\f35d'; + font-size: 20px; + margin-right: 10px; + font-family: 'material-design-icons' !important; + font-style: normal; + font-weight: 400; + speak: none; + text-decoration: inherit; + width: 1em; + text-align: center; + font-variant: normal; + text-transform: none; + line-height: 1em; + -webkit-font-smoothing: antialiased; + } + &.asc:after { + content: '\f360'; + } + } + } + td { + width: 20%; + background-color: #fff; + padding: 10px 15px; + border-bottom: 1px solid #c9c8c8; + border-left: 1px solid #c9c8c8; + &:nth-child(2) { + max-width: 10%; + } + &:nth-child(3) { + width: 1%; + white-space: nowrap; + } + &:first-child, + &:last-child { + width: 1%; + white-space: nowrap; + } + } + } } \ No newline at end of file diff --git a/src/styles/territory-profile.scss b/src/styles/territory-profile.scss index 7a76753f9931504ab8f298685e6c4cf191501bf7..baa656600e2abd53b4da7a0e13569608270c0238 100644 --- a/src/styles/territory-profile.scss +++ b/src/styles/territory-profile.scss @@ -142,4 +142,12 @@ } } -} \ No newline at end of file +} +#tzcld-mon-territoire { + &>div { + margin-left: -24px; + &>div { + padding-left: 24px; + } + } +} diff --git a/src/utils.js b/src/utils.js index 3b45b85e9349cb33357dda0473503e82b1ad7495..0c6989d5812b5bdb878aa777c686e0d7d37796b8 100644 --- a/src/utils.js +++ b/src/utils.js @@ -8,6 +8,8 @@ export const TZCLD_URLS = { my_territory_follow: 'tzcld-suivit', my_territory_follow_requests_all: 'tzcld-suivit-requests', my_territory_follow_request_add: 'tzcld-suivit-request-add', + my_territory_follow_request_edit: 'tzcld-suivit-request-edit', + my_territory_follow_request_space: 'tzcld-suivit-request-space', my_territory_follow: 'tzcld-suivit', my_territory_exchanges: 'tzcld-echnages', my_territory_all_exchanges: 'tzcld-tous-les-echnages', diff --git a/src/views-terrytories.js b/src/views-terrytories.js index dde3607e152c8f76887e41dec49d542c1d5675b2..eb6192791b7f3080d66331c5ff9f180bf85e79a1 100644 --- a/src/views-terrytories.js +++ b/src/views-terrytories.js @@ -89,6 +89,7 @@ import("./utils.js").then((utils) => { <solid-route name="${utils.TZCLD_URLS.my_territory_all_exchanges}" use-id></solid-route> <solid-route name="${utils.TZCLD_URLS.my_territory_add_exchange}" use-id></solid-route> <solid-route name="${utils.TZCLD_URLS.my_territory_exchange_space}" use-id></solid-route> + <solid-route name="${utils.TZCLD_URLS.my_territory_follow_request_space}" use-id></solid-route> <solid-route name="${utils.TZCLD_URLS.my_territory_follow_requests_all}" use-id></solid-route> <solid-route name="${utils.TZCLD_URLS.my_territory_follow_request_add}" use-id></solid-route> </ul> @@ -201,6 +202,14 @@ import("./utils.js").then((utils) => { </template> </solid-widget> + <solid-widget name="tzcld-orbit-folow-request-actions"> + <template> + <solid-ac-checker permission="acl:Write" data-src="\${value}"> + <solid-link class="icon icon-pencil" data-src="\${value}" next="${utils.TZCLD_URLS.my_territory_follow_request_edit}"></solid-link> + </solid-ac-checker> + </template> + </solid-widget> + <solid-widget name="tzcld-exchanges-conversations-counter"> <template> <div class="text-right"> @@ -695,7 +704,7 @@ import("./utils.js").then((utils) => { </template> </solid-widget> - <h2 class="margin-top-xxsmall margin-left-xsmall margin-bottom-medium sm-margin-none sm-margin-right-xsmall sm-margin-bottom-small sm-margin-left-xsmall text-xlarge text-bold text-color-heading text-uppercase">Auto-évaluation</h2> + <h2 class="margin-none margin-bottom-medium sm-margin-none sm-margin-right-xsmall sm-margin-bottom-small sm-margin-left-xsmall text-color-heading text-bold text-xxxlarge text-letter-spacing-large">Auto-évaluation</h2> <div class="segment full shadow bg-color-white margin-bottom-large padding-large padding-left-small sm-padding-none whitespace-normal child-accordion"> <h2 class="margin-none margin-top-none margin-left-none text-xlarge text-xbold text-color-heading text-color-dark-blue">Carte d’identité du territoire</h2> @@ -813,14 +822,15 @@ import("./utils.js").then((utils) => { let render = ` - <h2 class="margin-top-xxsmall margin-left-xsmall margin-bottom-medium sm-margin-none sm-margin-right-xsmall sm-margin-bottom-small sm-margin-left-xsmall text-xlarge text-bold text-color-heading text-uppercase">Suivoit interne</h2> + <h2 class="margin-left-xsmall margin-none sm-margin-none sm-margin-right-xsmall sm-margin-bottom-small sm-margin-left-xsmall text-color-heading text-bold text-xxxlarge text-letter-spacing-largee">Suivit interne</h2> - <div class="margin-bottom-large"> + <div class="padding-bottom-none"> <h2 class="margin-none margin-bottom-xsmall text-xlarge text-xbold text-color-heading">Historique des échanges</h2> <div class="segment table-wrapper"> <div class="table"> <solid-form-search id="tzcld-history-request-sorter" + class="hidden" fields="field, order" enum-field="date" class-field="hidden" @@ -828,80 +838,84 @@ import("./utils.js").then((utils) => { value-order="desc" enum-order="asc = asc, desc = desc" ></solid-form-search> - <div class="table-header bg-color-third text-color-heading full"> - <div class="segment table-cell table-cell width-20">Date</div> - <div class="segment table-cell table-cell width-20">Type de contact</div> - <div class="segment table-cell table-cell width-20">Interlmocuteur</div> - <div class="segment table-cell table-cell width-20">Sujet/demande</div> - </div> - <solid-display - class="table-body full shadow bg-color-white" + <solid-table + header + class="table-requests block shadow bg-color-white pagination" bind-resources="" nested-field="tzcld_community_requests" - fields="cell1(date), cell2(contactType), cell3(user.username), cell4(subject)" - class-cell1="segment table-cell width-20 text-center whitespace-normal" - class-cell2="segment table-cell width-20 whitespace-normal" - class-cell3="segment table-cell width-20 whitespace-normal" - class-cell4="segment table-cell width-20 whitespace-normal" + fields="date, contactType, user.name, subject, @id" + label-date="Date" + class-label-date="Date" + label-contactType="Type de contact" + label-user.name="Interlocuteur" + label-subject="Sujet/demande" + label-@id=" " + class-date="text-center whitespace-normal" + class-contactType="whitespace-normal" + class-user.name="" + class-subject="whitespace-normal" + widget-date="tzcld-format-date-1" + widget-id="tzcld-orbit-folow-request-actions" sorted-by="tzcld-history-request-sorter" - paginate-by="1" - > - </solid-display> + paginate-by="5" + > + </solid-table> </div> - <p class="text-right padding-right-xxlarge"><solid-link class="segment margin-top-xxlarge sm-full button text-xsmall text-bold text-uppercase text-center reversed color-secondary bordered button-icon icon icon-square-edit icon-margin-right-xsmall" bind-resources next="${utils.TZCLD_URLS.my_territory_follow_requests_all}">Voir tout</solid-link> + <p class="text-right"><solid-link class="segment margin-top-xxlarge sm-full button text-xsmall text-bold text-uppercase text-center reversed color-secondary bordered button-icon icon icon-square-edit icon-margin-right-xsmall" bind-resources next="${utils.TZCLD_URLS.my_territory_follow_requests_all}">Voir tout</solid-link> <solid-link class="segment margin-top-xxlarge margin-left-xxlarge margin-right-xxlarge sm-full button text-xsmall text-bold text-uppercase text-center color-secondary bordered button-icon icon icon-square-edit icon-margin-right-xsmall" bind-resources next="${utils.TZCLD_URLS.my_territory_follow_request_add}">Ajouter</solid-link></p> </div> </div> - - <div class="segment full shadow bg-color-white margin-bottom-large padding-large padding-left-small sm-padding-none whitespace-normal child-accordion"> - <h2 class="margin-none text-xlarge text-xbold text-color-heading">Synthèse</h2> - - <solid-form - class="form hidden segment block margin-top-large whitespace-normal padding-left-large padding-right-small" - bind-resources - solid-resource - partial - autosave - nested-field="tzcld_profile_identity" - loader-id="loader-${this.route}-general-follow" - fields="segment(context, strongPoints), segment1(questions, needs), segment2(targetdate), spacer" - - class-segment="segment full" - class-segment1="segment full" - class-segment2="segment full" - - label-context="Contexte" - label-strongPoints="Points forts" - label-questions="Interrogations / Risques / Difficultés" - label-needs="Besoins d'accompagnement / Actions à suivre" - label-targetdate="Date souhaité de dépôt de candidature" - - - class-context="segment margin-bottom-medium half sm-full padding-right-small sm-padding-none text-small text-semibold text-color-heading whitespace-normal text-xlarge" - class-strongPoints="segment margin-bottom-medium half sm-full padding-left-small sm-padding-none text-small text-semibold text-color-heading whitespace-normal text-xlarge" + <div class="segment block sm-margin-none padding-bottom-none"> + <div class="segment full shadow bg-color-white padding-large padding-left-small sm-padding-none whitespace-normal child-accordion"> + <h2 class="margin-none text-xlarge text-xbold text-color-heading">Synthèse</h2> - class-questions="segment margin-bottom-medium half sm-full padding-right-small sm-padding-none text-small text-semibold text-color-heading whitespace-normal text-xlarge" - class-needs="segment margin-bottom-medium half sm-full padding-left-small sm-padding-none text-small text-semibold text-color-heading whitespace-normal text-xlarge" - - class-targetdate="segment margin-bottom-medium half sm-full padding-right-small sm-padding-none text-small text-semibold text-color-heading whitespace-normal text-xlarge" - - widget-context="solid-form-textarea-label" - widget-strongPoints="solid-form-textarea-label" - widget-questions="solid-form-textarea-label" - widget-needs="solid-form-textarea-label" - widget-targetdate="solid-form-date-label" - - - class-spacer="segment third sm-hidden" - widget-spacer="span"> - </solid-form> - <div class="loader" id="loader-${this.route}-general-follow"> - <div></div> - <div></div> - <div></div> - <div></div> + <solid-form + class="form hidden segment block margin-top-large whitespace-normal padding-left-large padding-right-small" + bind-resources + solid-resource + partial + autosave + nested-field="tzcld_profile_identity" + loader-id="loader-${this.route}-general-follow" + fields="segment(context, strongPoints), segment1(questions, needs), segment2(targetdate), spacer" + + class-segment="segment full" + class-segment1="segment full" + class-segment2="segment full" + + label-context="Contexte" + label-strongPoints="Points forts" + label-questions="Interrogations / Risques / Difficultés" + label-needs="Besoins d'accompagnement / Actions à suivre" + label-targetdate="Date souhaité de dépôt de candidature" + + + class-context="segment margin-bottom-medium half sm-full padding-right-small sm-padding-none text-small text-semibold text-color-heading whitespace-normal text-xlarge" + class-strongPoints="segment margin-bottom-medium half sm-full padding-left-small sm-padding-none text-small text-semibold text-color-heading whitespace-normal text-xlarge" + + class-questions="segment margin-bottom-medium half sm-full padding-right-small sm-padding-none text-small text-semibold text-color-heading whitespace-normal text-xlarge" + class-needs="segment margin-bottom-medium half sm-full padding-left-small sm-padding-none text-small text-semibold text-color-heading whitespace-normal text-xlarge" + + class-targetdate="segment margin-bottom-medium half sm-full padding-right-small sm-padding-none text-small text-semibold text-color-heading whitespace-normal text-xlarge" + + widget-context="solid-form-textarea-label" + widget-strongPoints="solid-form-textarea-label" + widget-questions="solid-form-textarea-label" + widget-needs="solid-form-textarea-label" + widget-targetdate="solid-form-date-label" + + + class-spacer="segment third sm-hidden" + widget-spacer="span"> + </solid-form> + <div class="loader" id="loader-${this.route}-general-follow"> + <div></div> + <div></div> + <div></div> + <div></div> + </div> </div> </div> <div class="segment block sm-margin-none"> @@ -939,16 +953,17 @@ import("./utils.js").then((utils) => { <a class="backlink text-xlarge line-xlarge margin-right-xxsmall" href="javascript:history.back();">Retour</a> </div> - <h2 class="margin-top-xxsmall margin-left-xsmall margin-bottom-medium sm-margin-none sm-margin-right-xsmall sm-margin-bottom-small sm-margin-left-xsmall text-xlarge text-bold text-color-heading text-uppercase">Suivoit interne - Echanges</h2> + <h2 class="margin-top-xxsmall margin-left-xsmall margin-bottom-medium sm-margin-none sm-margin-right-xsmall sm-margin-bottom-small sm-margin-left-xsmall text-xlarge text-bold text-color-heading text-uppercase">Suivoit interne - échanges</h2> <p class="text-right padding-none margin-none"><solid-link class="segment margin-top-xxlarge sm-full button text-xsmall text-bold text-uppercase text-center color-secondary bordered button-icon icon icon-square-edit icon-margin-right-xsmall" bind-resources next="${utils.TZCLD_URLS.my_territory_follow_request_add}">Ajouter un échange</solid-link></p> <div class="margin-bottom-large"> - <h2 class="margin-none margin-bottom-xsmall text-xlarge text-xbold text-color-heading">Historique des tous les échanges</h2> - <div class="segment table-wrapper"> - <div class="table"> + <h2 class="margin-none margin-bottom-xsmall text-xlarge text-xbold text-color-heading">Historique des échanges</h2> + <div class="segment block"> + <div class=""> <solid-form-search id="tzcld-history-all-requests-sorter" + class="hidden" fields="field, order" enum-field="date" class-field="hidden" @@ -956,25 +971,28 @@ import("./utils.js").then((utils) => { value-order="desc" enum-order="asc = asc, desc = desc" ></solid-form-search> - <div class="table-header bg-color-third text-color-heading full"> - <div class="segment table-cell table-cell width-20">Date</div> - <div class="segment table-cell table-cell width-20">Type de contact</div> - <div class="segment table-cell table-cell width-20">Interlmocuteur</div> - <div class="segment table-cell table-cell width-20">Sujet/demande</div> - </div> - <solid-display - class="table-body full shadow bg-color-white pagination" + <solid-table + header + class="table-requests block shadow bg-color-white pagination" bind-resources="" nested-field="tzcld_community_requests" - fields="cell1(date), cell2(contactType), cell3(user.username), cell4(subject)" - class-cell1="segment table-cell width-20 text-center whitespace-normal" - class-cell2="segment table-cell width-20 whitespace-normal" - class-cell3="segment table-cell width-20 whitespace-normal" - class-cell4="segment table-cell width-20 whitespace-normal" + fields="date, contactType, user.name, subject, @id" + label-date="Date" + class-label-date="Date" + label-contactType="Type de contact" + label-user.name="Interlocuteur" + label-subject="Sujet/demande" + label-@id=" " + class-date="text-center whitespace-normal" + class-contactType="whitespace-normal" + class-user.name="" + class-subject="whitespace-normal" + widget-date="tzcld-format-date-1" + widget-id="tzcld-orbit-folow-request-actions" sorted-by="tzcld-history-all-requests-sorter" - paginate-by="1" + paginate-by="20" > - </solid-display> + </solid-table> </div> </div> </div> @@ -988,8 +1006,6 @@ import("./utils.js").then((utils) => { viewCommunityFollowRequestAdd() { - console.log('eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee'); - console.log(this) ; let render = ` <div class="segment block margin-right-xxsmall margin-left-xxsmall sm-margin-none padding-top-none sm-padding-xsmall"> <div class="segment block sm-hidden text-left"> @@ -997,7 +1013,7 @@ import("./utils.js").then((utils) => { </div> <div class="segment full padding-xsmall whitespace-normal"> - <div class="loader" id="loader-${this.route}-tzcld-add-request-exchange"> + <div class="loader" id="loader-${this.route}-${utils.TZCLD_URLS.my_territory_follow_requests_add}"> <div></div> <div></div> <div></div> @@ -1033,7 +1049,7 @@ import("./utils.js").then((utils) => { widget-user="solid-form-dropdown-autocompletion-label" order-asc-user="username" range-user="${this.rangeUser}" - loader-id="loader-${this.route}-tzcld-add-request-exchange" + loader-id="loader-${this.route}-${utils.TZCLD_URLS.my_territory_follow_requests_add}" bind-resources="" nested-field="tzcld_community_requests" solid-resource="" @@ -1051,6 +1067,68 @@ import("./utils.js").then((utils) => { return render; } + + viewCommunityFollowRequestEdit() { + let render = ` + <div class="segment block margin-right-xxsmall margin-left-xxsmall sm-margin-none padding-top-none sm-padding-xsmall"> + <div class="segment block sm-hidden text-left"> + <a class="backlink text-xlarge line-xlarge margin-right-xxsmall" href="javascript:history.back();">Retour</a> + </div> + + <div class="segment full padding-xsmall whitespace-normal"> + <div class="loader" id="loader-${this.route}-${utils.TZCLD_URLS.my_territory_follow_requests_edit}"> + <div></div> + <div></div> + <div></div> + <div></div> + </div> + <solid-form + fields="segment1(segment2(title(title_prefix), segment3(date, contactType), segment4(user, subject)))" + class="segment block whitespace-normal form" + class-visible="hidden" + value-visible="admins" + class-segment1="segment bg-color-white shadow border-rounded-xxsmall full text-top whitespace-normal" + class-segment2="segment block padding-xlarge text-left" + class-segment3="segment block" + class-segment4="segment block" + + class-date="segment margin-bottom-medium half sm-full padding-right-small sm-padding-none text-small text-semibold text-color-heading whitespace-normal text-xlarge" + class-contactType="segment margin-bottom-medium half sm-full padding-right-small sm-padding-none text-xlarge text-semibold text-color-heading" + class-user="segment margin-bottom-medium half sm-full padding-right-small sm-padding-none text-xlarge text-semibold text-color-heading text-top" + class-subject="segment margin-bottom-medium half sm-full padding-right-small sm-padding-none text-small text-semibold text-color-heading whitespace-normal text-xlarge" + + widget-title="h2" + class-title="margin-bottom-large margin-top-none margin-left-none text-xlarge text-xbold text-color-heading text-color-dark-blue" + widget-title_prefix="span" + value-title_prefix="Nouvelle entrée pour l'historique des échanges" + + label-date="Date" + label-contactType="Type de contact" + label-subject="Sujet/demande" + label-user="Interlmocuteur" + + widget-date="solid-form-date-label" + widget-subject="solid-form-textarea-label" + widget-user="solid-form-dropdown-autocompletion-label" + order-asc-user="username" + range-user="${this.rangeUser}" + loader-id="loader-${this.route}-${utils.TZCLD_URLS.my_territory_follow_requests_edit}" + bind-resources="" + solid-resource="" + patrtial + submit-button="Enregistrer" + submit-widget="button" + class-submit-button="submit-button segment sm-full margin-top-xsmall text-xsmall children-link-button children-link-text-bold children-link-text-uppercase children-link-reversed color-secondary bordered children-button-icon children-icon-rocket children-icon-small children-icon-margin-right-xsmall" + > + </solid-form> + </div> + `; + + render += ` + </div>`; + + return render; + } template(props) { @@ -1101,7 +1179,7 @@ import("./utils.js").then((utils) => { ${this.viewAllExchanges()} </div> - <div id="${utils.TZCLD_URLS.my_territory_exchange_space}" data-view="${utils.TZCLD_URLS.my_territory_exchange_space}" class="community-exchanges one" hidden> + <div id="${utils.TZCLD_URLS.my_territory_exchange_space}" data-view="${utils.TZCLD_URLS.my_territory_exchange_space}" class="community-exchanges one" hidden> <solid-router default-route="my_territory_all_exchanges_empty" route-prefix=""> <solid-route name="my_territory_all_exchanges_empty" use-id></solid-route> @@ -1124,6 +1202,21 @@ import("./utils.js").then((utils) => { + </div> + <div id="${utils.TZCLD_URLS.my_territory_follow_request_space}" data-view="${utils.TZCLD_URLS.my_territory_follow_request_space}" class="community-folow-request one" hidden> + + <solid-router default-route="my_territory_follow_request_empty" route-prefix=""> + <solid-route name="my_territory_follow_request_empty" use-id></solid-route> + <solid-route name="${utils.TZCLD_URLS.my_territory_follow_request_edit}" use-id></solid-route> + </solid-router> + + <div id="my_territory_follow_request_empty" data-view="my_territory_follow_request_empty" class="community-exchanges one" hidden> + + </div> + + <div id="${utils.TZCLD_URLS.my_territory_follow_request_edit}" data-view="${utils.TZCLD_URLS.my_territory_follow_request_edit}" class="community-folow-request-edit one" hidden> + ${this.viewCommunityFollowRequestEdit()} + </div> </div> @@ -1131,7 +1224,7 @@ import("./utils.js").then((utils) => { ${this.viewCommunityAnswers()} </div> - <div id="${utils.TZCLD_URLS.my_territory_follow}" data-view="${utils.TZCLD_URLS.my_territory_follow}" class="community-answers" hidden> + <div id="${utils.TZCLD_URLS.my_territory_follow}" data-view="${utils.TZCLD_URLS.my_territory_follow}" class="community-answers padding-top-xlarge" hidden> ${this.viewCommunityFollow()} </div> @@ -1151,6 +1244,43 @@ import("./utils.js").then((utils) => { e.target.classList.toggle("open") ; e.target.nextElementSibling.classList.toggle("hidden") ; }); + /*utils.live('click', '.table-requests th:first-child', function(e){ + e.target.classList.toggle("asc") ; + let table = utils.findAncestor (e.target, 'table-requests') + console.log(table.getAttribute('sorted-by')) ; + let formFilterId = table.getAttribute('sorted-by') ; + let selectFilter = document.querySelector('#'+formFilterId+' select[name="order"]') ; + console.log(selectFilter) ; + if (selectFilter.value == 'asc') { + selectFilter.value = 'desc' ; + } else { + selectFilter.value = 'asc' ; + let selectOption = document.querySelector('#'+formFilterId+' select[name="order"] option[value="asc"]') ; + console.log(selectOption) ; + selectOption.dispatchEvent(new Event('click')); + } + + if(document.createEvent){ + let event = document.createEvent("HTMLEvents"); + event.initEvent("click", true, true); + event.eventName = "click"; + selectFilter.dispatchEvent(event); + } else { + let event = document.createEventObject(); + event.eventName = "click"; + event.eventType = "click"; + selectFilter.fireEvent("on" + event.eventType, event); + } + + selectFilter.closest("form").dispatchEvent(new Event('selectionchange')); + console.log(selectFilter.closest("form")) ; + var EVENTS = ["selectionchange", "mousedown", "mouseup", "click", "change"]; + EVENTS.forEach(function(eventName) { + selectFilter.dispatchEvent(new Event(eventName, { 'bubbles': true })); + }) ; + + + });*/ return render; }