improve flex-table logic, with accompanying period list template

This commit is contained in:
Mathieu Jaumotte 2021-08-01 18:38:31 +02:00
parent d34a00b2c0
commit ee819e7767
10 changed files with 180 additions and 147 deletions

View File

@ -1,59 +1,80 @@
/* /*
* FLEX RESPONSIVE TABLE/BLOCK PRESENTATION * FLEX RESPONSIVE TABLE/BLOCK PRESENTATION
*/ */
div.flex-bloc, div.flex-bloc,
div.flex-table { div.flex-table {
display: flex;
align-items: stretch;
align-content: stretch;
box-sizing: border-box;
margin: 1.5em 0; margin: 1.5em 0;
div.item-bloc {
display: flex;
@include border-collapse;
padding: 1em;
div.item-row {
display: flex;
div.item-col:last-child {
display: flex;
}
}
}
h2, h3, h4, dl, p { h2, h3, h4, dl, p {
margin: 0; margin: 0;
} }
h2, h3, h4 { h2, h3, h4 {
color: $blue; color: $blue;
} }
div.item-bloc {
@include border-collapse; ul.record_actions {
margin: 0;
li {
margin-right: 5px;
}
} }
} }
/* /*
* Bloc appearance * Bloc appearance
*/ */
div.flex-bloc { div.flex-bloc {
box-sizing: border-box;
display: flex;
flex-direction: row; flex-direction: row;
flex-wrap: wrap; flex-wrap: wrap;
align-items: stretch;
align-content: stretch;
div.item-bloc { div.item-bloc {
flex-grow: 0; flex-shrink: 1; flex-basis: auto; flex-grow: 0; flex-shrink: 1; flex-basis: auto;
margin: 0;
padding: 1em;
display: flex;
flex-direction: column; flex-direction: column;
margin: 0;
div.item-row { div.item-row {
flex-grow: 1; flex-shrink: 1; flex-basis: auto; flex-grow: 1; flex-shrink: 1; flex-basis: auto;
display: flex;
flex-direction: column; flex-direction: column;
div.item-col { div.item-col {
&.separator {
margin-top: 0.5em;
border-top: 1px dotted $gray-900;
padding-top: 0.5em;
}
&:first-child { &:first-child {
flex-grow: 0; flex-shrink: 0; flex-basis: auto; flex-grow: 0; flex-shrink: 0; flex-basis: auto;
padding-bottom: 0.5em;
border-bottom: 1px dotted $gray-900;
margin-bottom: 0.5em;
} }
&:last-child { &:last-child {
flex-grow: 1; flex-shrink: 1; flex-basis: auto; flex-grow: 1; flex-shrink: 1; flex-basis: auto;
display: flex;
ul.record_actions { ul.record_actions {
margin: 0;
align-self: flex-end; align-self: flex-end;
flex-grow: 1; flex-shrink: 0; flex-basis: auto; flex-grow: 1; flex-shrink: 0; flex-basis: auto;
margin: 0;
li { li {
margin-right: 5px; margin-right: 5px;
} }
@ -67,53 +88,47 @@ div.flex-bloc {
/* /*
* Table appearance * Table appearance
*/ */
div.flex-table { div.flex-table {
display: flex;
flex-direction: column; flex-direction: column;
align-items: stretch;
align-content: stretch;
div.item-bloc { div.item-bloc {
display: flex;
flex-direction: column; flex-direction: column;
padding: 1em;
&:nth-child(even) { &:nth-child(even) {
background-color: $gray-200; background-color: $gray-200;
.chill-user-quote { .chill-user-quote {
background-color: shade-color($gray-200, 5%) background-color: shade-color($gray-200, 5%)
} }
} }
div.item-row { div.item-row {
display: flex;
flex-direction: row; flex-direction: row;
&:not(:first-child) { &.separator {
margin-top: 0.5em; margin-top: 0.5em;
border-top: 1px dotted $gray-900; border-top: 1px dotted $gray-900;
padding-top: 0.5em; padding-top: 0.5em;
flex-direction: column; //flex-direction: column;
} }
div.item-col { div.item-col {
&:first-child { &:first-child {
flex-grow: 0; flex-shrink: 0; flex-basis: auto; flex-grow: 0; flex-shrink: 0; flex-basis: auto;
} }
&:last-child { &:last-child {
flex-grow: 1; flex-shrink: 1; flex-basis: auto; flex-grow: 1; flex-shrink: 1; flex-basis: auto;
display: flex;
justify-content: flex-end; justify-content: flex-end;
ul.record_actions { ul.record_actions {
flex-grow: 1; flex-shrink: 0; flex-basis: auto; flex-grow: 1; flex-shrink: 0; flex-basis: auto;
align-self: flex-start; align-self: flex-start;
margin: 0;
li {
margin-right: 5px;
}
} }
} }
} }
@media only screen and (max-width: 900px) { @media only screen and (max-width: 900px) {
flex-direction: column; flex-direction: column;
div.item-col { div.item-col {
@ -124,7 +139,6 @@ div.flex-table {
} }
} }
} }
} }
} }
} }

View File

@ -1,6 +1,6 @@
// //
// // Titles in forms
// //
@mixin title_in_form { @mixin title_in_form {

View File

@ -4,29 +4,24 @@
/* /*
* PERSON CONTEXT * PERSON CONTEXT
*/ */
div.banner {
div#header-person-name { div#header-person-name {
background: none repeat scroll 0 0 $chill-green-dark; background: none repeat scroll 0 0 $chill-green-dark;
color: $white; color: $white;
padding-top: 1em; padding-top: 1em;
padding-bottom: 1em; padding-bottom: 1em;
} }
div#header-person-details {
div#header-person-details { background: none repeat scroll 0 0 $chill-green;
background: none repeat scroll 0 0 $chill-green; color: $white;
color: $white; padding-top: 1em;
padding-top: 1em; padding-bottom: 1em;
padding-bottom: 1em; div.contact {
div.contact { & > * {
& > * { margin-right: 1em;
margin-right: 1em; }
} }
} }
}
div#person_details_container {
padding-top: 20px;
padding-bottom: 20px;
} }
div.person-view { div.person-view {
@ -83,83 +78,77 @@ div.person-view {
* ACCOMPANYING_COURSE CONTEXT * ACCOMPANYING_COURSE CONTEXT
* Header custom for Accompanying Course * Header custom for Accompanying Course
*/ */
$chill-accourse: #718596; $chill-accourse-context: #718596;
div#header-accompanying_course-name { div.banner {
background: none repeat scroll 0 0 $chill-accourse; div#header-accompanying_course-name {
color: $white; background: none repeat scroll 0 0 $chill-accourse-context;
h1 { color: $white;
margin: 0.4em 0; h1 {
} margin: 0.4em 0;
span {
a {
color: $white;
} }
a:hover { span {
text-decoration: underline; a {
color: $white;
}
a:hover {
text-decoration: underline;
}
} }
} }
} div#header-accompanying_course-details {
div#header-accompanying_course-details { background: none repeat scroll 0 0 tint-color($chill-accourse-context, 20%);
background: none repeat scroll 0 0 tint-color($chill-accourse, 20%); color: $white;
color: $white; padding-top: 1em;
padding-top: 1em; padding-bottom: 1em;
padding-bottom: 1em;
}
// flex-table precision
div.accompanyingcourse-resume {
div.associated-persons {
.flex-table .item-row .item-col:first-child { flex-basis: 33%; }
} }
} }
/* /*
* HOUSEHOLD CONTEXT * HOUSEHOLD CONTEXT
* Header custom for Household * Header custom for Household
*/ */
$chill-household: #929d69; $chill-household-context: #929d69;
div#header-household-name { div.banner {
background: none repeat scroll 0 0 $chill-household; div#header-household-name {
color: $white; background: none repeat scroll 0 0 $chill-household-context;
h1 { color: $white;
margin: 0.4em 0; h1 {
} margin: 0.4em 0;
span {
a {
color: $white;
} }
a:hover { span {
text-decoration: underline; a {
color: $white;
}
a:hover {
text-decoration: underline;
}
}
div.household-members {
display: flex;
flex-direction: row;
flex-wrap: wrap;
span.badge-member {
flex-shrink: 0; flex-grow: 0; flex-basis: auto;
color: $white;
border: 1px solid #ffffff3b;
border-radius: 8px;
padding: 0.4em 0.8em;
margin-bottom: 0.2em;
margin-right: 0.3em;
&.holder { order: -1; }
&.child { order: 2; }
}
} }
} }
div.household-members { div#header-household-details {
display: flex; background: none repeat scroll 0 0 tint-color($chill-household-context, 15%);
flex-direction: row; color: $white;
flex-wrap: wrap; padding-top: 1em;
span.badge-member { padding-bottom: 1em;
flex-shrink: 0; flex-grow: 0; flex-basis: auto; span.current-members-explain {
color: $white; font-weight: bold;
border: 1px solid #ffffff3b;
border-radius: 8px;
padding: 0.4em 0.8em;
margin-bottom: 0.2em;
margin-right: 0.3em;
&.holder { order: -1; }
&.child { order: 2; }
} }
} }
} }
div#header-household-details {
background: none repeat scroll 0 0 tint-color($chill-household, 15%);
color: $white;
padding-top: 1em;
padding-bottom: 1em;
span.current-members-explain {
font-weight: bold;
}
}

View File

@ -8,6 +8,7 @@ require('./scss/household_banner.scss');
require('./scss/accompanying_period_work.scss'); require('./scss/accompanying_period_work.scss');
require('./scss/person_by_phonenumber.scss'); require('./scss/person_by_phonenumber.scss');
require('./scss/render_box.scss'); require('./scss/render_box.scss');
require('./scss/flex_table.scss');
require('./scss/address_history.scss'); require('./scss/address_history.scss');
require('./svg/phone-alt-solid.svg'); require('./svg/phone-alt-solid.svg');

View File

@ -0,0 +1,31 @@
/*
* flex-table overwrite: precision and exceptions
*/
///
div.accompanyingcourse-resume {
div.associated-persons {
.flex-table .item-row .item-col:first-child {
flex-basis: 33%;
}
}
}
///
div.accompanyingcourse-list, div.household-members {
.flex-table .item-bloc .item-row {
&:nth-child(2) {
flex-direction: row;
}
&:last-child {
flex-direction: column;
}
}
}
///
div.list-with-period {
div.flex-table div.item-row div.item-col:first-child {
flex-basis: 33%;
}
}

View File

@ -1,11 +1,6 @@
/// overwrite flex-table
div.list-with-period {
div.flex-table div.item-row div.item-col:first-child { flex-basis: 33%; }
}
/// ///
div.list-with-period, div.list-with-period, div.list-household-members {
div.list-household-members {
div.periods { div.periods {
div.header, div.header,

View File

@ -5,33 +5,28 @@
<div class="item-row"> <div class="item-row">
<div class="item-col"> <div class="item-col">
<b>#{{ accompanying_period.id }}</b> <span class="h3">
<i class="fa fa-fw fa-random"></i>
<b>{{ accompanying_period.id }}</b>
</span>
{% if accompanying_period.step == 'DRAFT' %}
<span class="badge bg-primary">{{- 'Draft'|trans|upper -}}</span>
{% else %}
<span class="badge bg-primary">{{- 'Confirmed'|trans|upper -}}</span>
{% endif %}
{% if accompanying_period.emergency %} {% if accompanying_period.emergency %}
<span class="badge bg-primary">{{- 'Emergency'|trans|upper -}}</span> <span class="badge bg-primary">{{- 'Emergency'|trans|upper -}}</span>
{% endif %} {% endif %}
{% if accompanying_period.confidential %} {% if accompanying_period.confidential %}
<span class="badge bg-primary">{{- 'Confidential'|trans|upper -}}</span> <span class="badge bg-primary">{{- 'Confidential'|trans|upper -}}</span>
{% endif %} {% endif %}
{% if accompanying_period.step == 'DRAFT' %}
<span class="badge bg-primary">{{- 'Draft'|trans|upper -}}</span>
{% else %}
<span class="badge bg-primary">{{- 'Confirmed'|trans|upper -}}</span>
{% endif %}
</div>
<div class="item-col">
{% if chill_accompanying_periods.fields.user == 'visible' %}
{% if accompanying_period.user %}
{{ accompanying_period.user.username }}
{% else %}
<span class="chill-no-data-statement">{{ 'No accompanying user'|trans }}</span>
{% endif %}
{% endif %}
</div> </div>
<div class="item-col"></div>
</div> </div>
<div class="item-row"> <div class="item-row">
<div class="item-col">
{% if accompanying_period.closingDate == null %} {% if accompanying_period.closingDate == null %}
{{ 'accompanying_period.dates_from_%opening_date%'|trans({ '%opening_date%': accompanying_period.openingDate|format_date('long') } ) }} {{ 'accompanying_period.dates_from_%opening_date%'|trans({ '%opening_date%': accompanying_period.openingDate|format_date('long') } ) }}
{% else %} {% else %}
@ -46,9 +41,20 @@
</dl> </dl>
{% endif %} {% endif %}
{% endif %} {% endif %}
</div>
<div class="item-col">
{% if chill_accompanying_periods.fields.user == 'visible' %}
{% if accompanying_period.user %}
{{ accompanying_period.user.username }}
{% else %}
<span class="chill-no-data-statement">{{ 'No accompanying user'|trans }}</span>
{% endif %}
{% endif %}
</div>
</div> </div>
<div class="item-row"> <div class="item-row separator">
<div class="item-col"><h3>{{ 'Participants'|trans }}</h3></div> <div class="item-col"><h3>{{ 'Participants'|trans }}</h3></div>
<div class="item-col"> <div class="item-col">
@ -99,17 +105,14 @@
{% endif %} {% endif %}
</div> </div>
<div class="item-row"> <div class="item-row separator">
<ul class="record_actions"> <ul class="record_actions">
{# TODO if enable_accompanying_course_with_multiple_persons is true ... #} {# TODO if enable_accompanying_course_with_multiple_persons is true ... #}
<li> <li>
<a href="{{ path('chill_person_accompanying_course_index', { 'accompanying_period_id': accompanying_period.id }) }}" <a href="{{ path('chill_person_accompanying_course_index', { 'accompanying_period_id': accompanying_period.id }) }}"
class="btn btn-primary" title="{{ 'See accompanying period'|trans }}"> class="btn btn-show" title="{{ 'See accompanying period'|trans }}">{{ 'See this period'|trans }}</a>
<i class="fa fa-fw fa-random"></i>
{{ 'See this period'|trans }}
</a>
</li> </li>
{# TODO cause error in household context. only works in person context {# TODO cause error in household context. only works in person context

View File

@ -89,7 +89,7 @@
<div class="item-col"> <div class="item-col">
{{ _self.label(person, options) }} {{ _self.label(person, options) }}
</div> </div>
<div class="item-col"> <div class="item-col separator">
<ul class="list-content fa-ul"> <ul class="list-content fa-ul">
{% set multiline = (options['address_multiline']) ? true : false %} {% set multiline = (options['address_multiline']) ? true : false %}
{{ person.getLastAddress|chill_entity_render_box({ {{ person.getLastAddress|chill_entity_render_box({

View File

@ -68,7 +68,7 @@
{%- endfor %} {%- endfor %}
{% if apps|length > 0 %} {% if apps|length > 0 %}
<div class="item-row periods"> <div class="item-row separator periods">
{% for app in apps %} {% for app in apps %}
<div class="header"> <div class="header">

View File

@ -66,7 +66,7 @@
<div class="item-col"> <div class="item-col">
{{ _self.label(thirdparty, options) }} {{ _self.label(thirdparty, options) }}
</div> </div>
<div class="item-col"> <div class="item-col separator">
<ul class="list-content fa-ul"> <ul class="list-content fa-ul">
{{ thirdparty.getAddress|chill_entity_render_box({ {{ thirdparty.getAddress|chill_entity_render_box({
'render': 'list', 'render': 'list',