This repository has been archived on 2024-03-28. You can view files and clone it, but cannot push or open issues or pull requests.
atsebay.t/htdocs/views/correction.html

150 lines
8.6 KiB
HTML

<div class="btn-group-toggle float-right ml-1" data-toggle="buttons">
<label class="btn btn-secondary active">
<input type="checkbox" ng-model="notCorrected"> Pas corrigés
</label>
</div>
<div class="float-right ml-1">
<input class="form-control" ng-model="highlight" placeholder="highlight1,highlight2,..." ng-change="chHilight()">
</div>
<h2>
<span class="text-muted">{{ survey.title }}</span>
<small>
<span class="badge badge-danger" ng-if="survey.start_availability > now">Prévu</span>
<span class="badge badge-warning" ng-if="survey.start_availability <= now && survey.end_availability >= now">En cours</span>
<span class="badge badge-danger" ng-if="survey.end_availability < now">Clos</span>
</small>
</h2>
<h3>
{{ question.title }}
</h3>
<div class="mb-5" ng-submit="submitCorrections()" ng-cloak>
<form class="card mb-2" ng-repeat="response in responses" ng-if="!notCorrected || !response.time_scored">
<div class="card-body">
<button type="button" class="btn btn-success ml-1 float-right" ng-class="{'mt-4': $index%2}" ng-click="submitCorrection()"><svg class="bi bi-check" width="1em" height="1em" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M15.854 5.646a.5.5 0 010 .708l-7 7a.5.5 0 01-.708 0l-3.5-3.5a.5.5 0 11.708-.708L8.5 12.293l6.646-6.647a.5.5 0 01.708 0z" clip-rule="evenodd"></path></svg></button>
<p class="card-text" style="white-space: pre-line" ng-bind="response.value" ng-if="question.kind == 'text' || question.kind == 'int'"></p>
<div class="card-text" ng-if="question.kind == 'mcq'" ng-controller="ProposalsController">
<div class="form-group form-check" ng-repeat="proposal in proposals">
<input type="checkbox" disabled class="form-check-input" id="p{{proposal.id}}" ng-checked="response.value.indexOf(proposal.id) != -1">
<label class="form-check-label" for="p{{proposal.id}}">{{ proposal.label }}</label>
</div>
</div>
<div class="card-text" ng-if="question.kind == 'ucq'" ng-controller="ProposalsController">
<div class="form-group form-check" ng-repeat="proposal in proposals">
<input type="radio" disabled class="form-check-input" id="p{{proposal.id}}" ng-checked="response.value.indexOf(proposal.id) != -1">
<label class="form-check-label" for="p{{proposal.id}}">{{ proposal.label }}</label>
</div>
</div>
<div class="row">
<div class="col-6" ng-controller="CorrectionsTemplateController">
<div ng-repeat="template in templates">
<div class="form-group mb-2 form-check">
<input type="checkbox" class="form-check-input" id="u{{response.id_user}}p{{template.id}}" ng-checked="template_corrected[template.id][response.id_user]" ng-click="changeCorrection(response.id_user)">
<label class="form-check-label" for="u{{response.id_user}}p{{template.id}}">{{ template.label }}</label>
<button type="button" class="btn btn-sm btn-primary ml-1 float-right" ng-click="editTemplate()"><svg class="bi bi-pencil" width="1em" height="1em" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M13.293 3.293a1 1 0 011.414 0l2 2a1 1 0 010 1.414l-9 9a1 1 0 01-.39.242l-3 1a1 1 0 01-1.266-1.265l1-3a1 1 0 01.242-.391l9-9zM14 4l2 2-9 9-3 1 1-3 9-9z" clip-rule="evenodd"></path><path fill-rule="evenodd" d="M14.146 8.354l-2.5-2.5.708-.708 2.5 2.5-.708.708zM5 12v.5a.5.5 0 00.5.5H6v.5a.5.5 0 00.5.5H7v.5a.5.5 0 00.5.5H8v-1.5a.5.5 0 00-.5-.5H7v-.5a.5.5 0 00-.5-.5H5z" clip-rule="evenodd"></path></svg></button>
<button type="button" class="btn btn-sm btn-info ml-1 float-right" ng-click="addTemplate()" ng-if="$last"><svg class="bi bi-plus" width="1em" height="1em" viewBox="0 0 16 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M8 3.5a.5.5 0 01.5.5v4a.5.5 0 01-.5.5H4a.5.5 0 010-1h3.5V4a.5.5 0 01.5-.5z" clip-rule="evenodd"></path><path fill-rule="evenodd" d="M7.5 8a.5.5 0 01.5-.5h4a.5.5 0 010 1H8.5V12a.5.5 0 01-1 0V8z" clip-rule="evenodd"></path></svg></button>
</div>
</div>
<button type="button" class="btn btn-info ml-1 float-right" ng-click="addTemplate()" ng-if="templates.length === 0"><svg class="bi bi-plus" width="1em" height="1em" viewBox="0 0 16 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M8 3.5a.5.5 0 01.5.5v4a.5.5 0 01-.5.5H4a.5.5 0 010-1h3.5V4a.5.5 0 01.5-.5z" clip-rule="evenodd"></path><path fill-rule="evenodd" d="M7.5 8a.5.5 0 01.5-.5h4a.5.5 0 010 1H8.5V12a.5.5 0 01-1 0V8z" clip-rule="evenodd"></path></svg> Ajouter un template</button>
</div>
<div class="col-6">
<div class="form-group row mb-2">
<div class="col-6 input-group">
<input class="form-control" type="number" ng-model="response.score" integer>
<div class="input-group-append">
<span class="input-group-text">/100</span>
</div>
</div>
<div class="col-6 row">
<label class="col-4 col-form-label">Auto&nbsp;:</label>
<div class="col-8">
<input type="text" class="form-control-plaintext" value="{{ users_corrected[response.id_user].score}} / 100" readonly>
</div>
</div>
</div>
<div class="form-group mb-2">
<textarea class="form-control" rows="1" ng-model="response.score_explaination" placeholder="Appréciation : "></textarea>
{{ users_corrected[response.id_user].score_explaination }}
</div>
<div class="form-group row mb-1" ng-if="response.time_scored">
<label class="col-4 col-form-label col-form-label-sm">Correction effectuée&nbsp;:</label>
<div class="col-8">
<input type="text" class="form-control-plaintext form-control-sm" value="{{ response.time_scored | date:'medium'}}" readonly>
</div>
</div>
<div class="form-group row mb-1" ng-if="response.time_scored">
<label class="col-4 col-form-label col-form-label-sm">Correcteur&nbsp;:</label>
<div class="col-8">
<input type="text" class="form-control-plaintext form-control-sm" value="{{ response.id_corrector }}" readonly>
</div>
</div>
</div>
</div>
</div>
</form>
<button type="submit" class="btn btn-primary" ng-disabled="submitInProgress">Soumettre les corrections</button>
</form>
<div class="modal fade" id="correctionTemplateModal" tabindex="-1" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Édition de modèle de correction</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<form ng-submit="saveTemplate()">
<input type="hidden" id="tcid">
<input type="hidden" id="tcidquestion">
<div class="form-group">
<label for="tclabel">Label</label>
<input type="text" class="form-control" id="tclabel" placeholder="Label">
</div>
<div class="form-group">
<label for="tcscore">Score</label>
<input type="number" class="form-control" id="tcscore" placeholder="Score">
</div>
<div class="form-group">
<label for="tcexplaination">Explaination</label>
<textarea class="form-control" id="tcexplaination" placeholder="Explaination"></textarea>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger" id="tcdelbtn" ng-click="deleteTemplate()">Supprimer</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">Annuler</button>
<button type="button" class="btn btn-primary" ng-click="saveTemplate()">Enregistrer</button>
</div>
</div>
</div>
</div>
<script>
$('#correctionTemplateModal').on('show.bs.modal', function (event) {
var template = $(this).data('bs.modal')._config.template
var modal = $(this)
modal.find('#tclabel').val("")
modal.find('#tcscore').val(0)
modal.find('#tcexplaination').val("")
modal.find('#tcidquestion').val(0)
modal.find('#tcid').val(0)
modal.find('#tclabel').val(template.label)
modal.find('#tcscore').val(template.score)
modal.find('#tcexplaination').val(template.score_explaination)
modal.find('#tcidquestion').val(template.id_question)
modal.find('#tcid').val(template.id)
if (template.id) {
modal.find('#tcdelbtn').show()
} else {
modal.find('#tcdelbtn').hide()
}
})
</script>