Browse Source

[backend] Rapports : possibilité de sélectionner / déselectionner un mois entier en un seul clic

refactoring
Guillaume Bourgeois 5 years ago
parent
commit
57e2642519
4 changed files with 40 additions and 11 deletions
  1. +11
    -8
      backend/views/report/index.php
  2. +7
    -3
      backend/web/css/screen.css
  3. +15
    -0
      backend/web/js/vuejs/report-index.js
  4. +7
    -0
      backend/web/sass/report/_index.scss

+ 11
- 8
backend/views/report/index.php View File

</select> </select>
</div> </div>
<div class="content-max-height"> <div class="content-max-height">
<div class="distribution-month" v-for="distributionsMonth in distributionsByMonthArray" v-if="distributionsMonth.year == distributionYear && distributionsMonth.distributions.length > 0">
<a class="btn btn-default link-month-distribution" @click="distributionsMonth.display = !distributionsMonth.display">{{ distributionsMonth.month }} <span class="glyphicon glyphicon-menu-down"></span></a>
<ul v-if="distributionsMonth.display">
<li v-for="distribution in distributionsMonth.distributions">
<input type="checkbox" :id="'distribution_'+distribution.id" v-model="distribution.checked" @change="reportChange" />
<label :for="'distribution_'+distribution.id">{{ distribution.date }}</label>
</li>
</ul>
<div class="distribution-month" v-for="(distributionsMonth, month) in distributionsByMonthArray" v-if="distributionsMonth.year == distributionYear && distributionsMonth.distributions.length > 0">
<a class="btn btn-default link-month-distribution" @click="distributionsMonth.display = !distributionsMonth.display">{{ distributionsMonth.month }} <span class="label label-success" v-if="countDistributionsByMonth(month)">{{ countDistributionsByMonth(month) }}</span> <span class="glyphicon glyphicon-menu-down"></span></a>
<div class="the-distributions" v-if="distributionsMonth.display">
<a @click="selectDistributions(month)" class="btn btn-default btn-xs btn-select"><span class="glyphicon glyphicon-check"></span> Tout <span v-if="countDistributionsByMonth(month)">déselectionner</span><span v-else>sélectionner</span></a>
<ul>
<li v-for="distribution in distributionsMonth.distributions">
<input type="checkbox" :id="'distribution_'+distribution.id" v-model="distribution.checked" @change="reportChange" />
<label :for="'distribution_'+distribution.id">{{ distribution.date }}</label>
</li>
</ul>
</div>
</div> </div>
</div> </div>
</div> </div>

+ 7
- 3
backend/web/css/screen.css View File

.report-index #parameters #section-distributions .distribution-month .link-month-distribution .glyphicon { .report-index #parameters #section-distributions .distribution-month .link-month-distribution .glyphicon {
float: right; float: right;
} }
/* line 114, ../sass/report/_index.scss */
/* line 109, ../sass/report/_index.scss */
.report-index #parameters #section-distributions .distribution-month .the-distributions {
margin-top: 8px;
}
/* line 121, ../sass/report/_index.scss */
.report-index #report .section { .report-index #report .section {
margin-bottom: 15px; margin-bottom: 15px;
} }
/* line 117, ../sass/report/_index.scss */
/* line 124, ../sass/report/_index.scss */
.report-index #report .section h3 { .report-index #report .section h3 {
margin: 0px; margin: 0px;
padding: 0px; padding: 0px;
font-size: 16px; font-size: 16px;
text-transform: uppercase; text-transform: uppercase;
} }
/* line 123, ../sass/report/_index.scss */
/* line 130, ../sass/report/_index.scss */
.report-index #report .section .comma:last-child { .report-index #report .section .comma:last-child {
display: none; display: none;
} }

+ 15
- 0
backend/web/js/vuejs/report-index.js View File

} }
return count ; return count ;
}, },
countDistributionsByMonth: function(month) {
var count = 0 ;
for(var j = 0; j < this.distributionsByMonthArray[month].distributions.length; j++) {
if(this.distributionsByMonthArray[month].distributions[j].checked) {
count ++ ;
}
}
return count ;
},
selectDistributions: function(month) {
var countDistributions = this.countDistributionsByMonth(month) ;
for(var j = 0; j < this.distributionsByMonthArray[month].distributions.length; j++) {
Vue.set(this.distributionsByMonthArray[month].distributions[j], 'checked', countDistributions ? false : true);
}
},
generateReport: function() { generateReport: function() {
var app = this ; var app = this ;
app.showLoading = true ; app.showLoading = true ;

+ 7
- 0
backend/web/sass/report/_index.scss View File

float: right ; float: right ;
} }
} }
.the-distributions {
margin-top: 8px ;
.btn-select {
}
}
} }
} }
} }

Loading…
Cancel
Save