Skip to content

Commit

Permalink
CTP-2955 - Marks transfer wizard - improve table design
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartlamour committed Jan 23, 2024
1 parent 6c97428 commit 78feaf6
Show file tree
Hide file tree
Showing 2 changed files with 145 additions and 81 deletions.
17 changes: 17 additions & 0 deletions classes/output/renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,13 +199,16 @@ public function render_dashboard(array $moduledeliveries, int $courseid) : strin
$assessmentmapping = new \stdClass();
$assessmentmapping->info =
$assessmentmapping->id = $componentgrade->assessmentmappingid;
$assessmentmapping->cmid = $coursemodule->id;
$assessmentmapping->type = get_module_types_names()[$coursemodule->modname];
$assessmentmapping->name = $coursemodule->name;
$coursemoduleurl = new \moodle_url(
'/mod/' . $coursemodule->modname . '/view.php',
['id' => $coursemodule->id]
);
$assessmentmapping->url = $coursemoduleurl->out(false);
$assessmentmapping->inprogress = $this->get_assessment_mapping_status($componentgrade->assessmentmappingid);

$assessmentmapping->status =
$this->get_assessment_mapping_status_icon($componentgrade->assessmentmappingid);
$assessmentmapping->statusicon = $assessmentmapping->status->statusicon;
Expand Down Expand Up @@ -378,6 +381,20 @@ private function get_last_push_task_time(int $assessmentmappingid) {
return $time;
}

/**
* Get assessment mapping status.
*
* @param int $assessmentmappingid Assessment mapping ID
*/
private function get_assessment_mapping_status(int $assessmentmappingid): bool {
$manager = manager::get_manager();

if ($task = $manager->get_pending_task_in_queue($assessmentmappingid)) {
return true;
}
return false;
}

/**
* Get the assessment mapping status icon.
*
Expand Down
209 changes: 128 additions & 81 deletions templates/module_delivery_table.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -74,89 +74,136 @@
"graduatetype": "POSTGRADUATE"
}
}}
<table id="{{tableid}}" class="module-delivery-table table table-hover table-bordered">
<thead>
<tr>
<th colspan="5">
<div class="row">
<div class="col header-part" style="text-align: left">{{#str}} dashboard:modcode, local_sitsgradepush, {{modcode}} {{/str}}</div>
<div class="col header-part">{{#str}} dashboard:academicyear, local_sitsgradepush, {{academicyear}} {{/str}}</div>
<div class="col header-part" style="text-align: right">{{#str}} dashboard:level, local_sitsgradepush, {{level}} {{/str}} {{graduatetype}}</div>
</div>
</th>
</tr>
<tr>
<th colspan="5" style="text-align: left">{{#str}} dashboard:mapcode, local_sitsgradepush, {{mapcode}} {{/str}}</th>
</tr>
<tr>
<th class="seq-col">{{#str}} dashboard:seq, local_sitsgradepush {{/str}}</th>
<th class="title-col">{{#str}} dashboard:title, local_sitsgradepush {{/str}}</th>
<th class="weight-col">{{#str}} dashboard:weight, local_sitsgradepush {{/str}}</th>
<th class="mark-col">{{#str}} dashboard:source, local_sitsgradepush {{/str}}</th>
<th class="action-col">{{#str}} dashboard:actions, local_sitsgradepush {{/str}}</th>
</tr>
</thead>
<tbody>
{{#componentgrades}}
<tr>
<td class="seq-col">{{mabseq}}</td>
<td class="title-col">{{mabname}}</td>
<td class="weight-col">{{mabperc}}</td>
<td class="mark-col">

<!-- Header. -->
<div id="{{{ tableid }}}" class="pb-3">
<hr>
<div class="row">
<div class="col-6">
<small>Module Delivery</small>
<h3 class="mb-0">{{{ modcode }}}</h3>
<small>{{{ level }}}</small>
</div>
<div class="col-6">
<small>Map code<br></small>
<div class="h3">{{{ mapcode }}}</div>
</div>
</div>
</div>

<!-- Table. -->
<table class="table table-bordered mb-5">

<thead class="thead-light">
<tr class="small">
<th>SITS assessment</th>
<th>Weight</th>
<th>Moodle activity</th>
<th >Marks to transfer</th>
</tr>
</thead>

<tbody>
{{#componentgrades}}
<th scope="row">
<span class="badge badge-dark">{{{ mabseq }}}</span>
{{{ mabname }}}
</th>

<td>{{{ mabperc }}}%</td>

<td>
{{#assessmentmapping}}
<a href="{{url}}" target="_blank" data-toggle="tooltip" data-placement="top" title="{{type}}">{{name}}</a>
{{/assessmentmapping}}
{{^assessmentmapping}}
<a href="{{selectsourceurl}}" class="btn btn-primary btn-sm" data-toggle="tooltip" data-placement="top"
title="Add Source"><i class="fa-solid fa-plus"></i></a>
<p>
<span class="badge badge-info">{{{ type }}}</span>
<a href="{{url}}" target="_blank" title="{{type}}">{{name}}</a>
</p>
{{/assessmentmapping}}

{{^disablechangesourcebutton}}
<a href="{{{selectsourceurl}}}" class="btn btn-secondary btn-sm" type="button">
{{#assessmentmapping}}Edit {{/assessmentmapping}}
{{^assessmentmapping}}Add {{/assessmentmapping}}
activity
</a>
{{/disablechangesourcebutton}}
</td>
<td class="action-col">
<div style="display: flex; justify-content: space-around; align-items: center">
<span>
<button type="button"
class="btn btn-secondary btn-sm change-source-button"
data-toggle="tooltip"
data-placement="top"
title="{{#str}} dashboard:changesource, local_sitsgradepush {{/str}}"
data-url="{{selectsourceurl}}"
{{#assessmentmapping}}
data-assessmentmappingid="{{id}}"
{{/assessmentmapping}}
{{disablechangesourcebutton}}>
<i class="fa-solid fa-gear"></i>
</button>
</span>
<span>
<button type="button"
class="btn btn-warning btn-sm push-mark-button"
data-toggle="tooltip"
data-placement="top"
title="{{#str}} dashboard:transfermark, local_sitsgradepush {{/str}}"
{{#assessmentmapping}}
data-assessmentmappingid="{{id}}"
{{/assessmentmapping}}
{{disablepushgradebutton}}>
<i class="fa-solid fa-upload"></i>
</button>
</span>
<span style="width: 20px">
{{#assessmentmapping}}
{{{statusicon}}}
{{/assessmentmapping}}
{{^assessmentmapping}}
<i class="fa-solid fa-circle-info" data-toggle="tooltip" data-placement="top"
title="{{#str}} pushrecordsnotexist, local_sitsgradepush {{/str}}"></i>
{{/assessmentmapping}}
</span>
</div>

<td>
{{#assessmentmapping}}
{{#inprogress}}
<a href="{{ config.root }}/local/sitsgradepush/index.php?id={{cmid}}" target="_blank" class="badge badge-warning p-2"><i class="fa-solid fa-hourglass-half mr-1"></i> Mark transfer in progress</a>

{{! Progress code example. }}
{{!
<small>Progress: 40%</small>
<div class="progress ">
<div class="progress-bar bg-success" role="progressbar" aria-valuenow="40" style="width: 40%" aria-valuemin="0" aria-valuemax="100"></div>
</div>
}}
{{/inprogress}}

{{^inprogress}}
<a href="{{ config.root }}/local/sitsgradepush/index.php?id={{cmid}}" target="_blank">{{ count }} marked</a>

<button type="button" class="btn btn-primary btn-sm js-btn-transfer-marks" data-toggle="modal" data-target="#transferModal" data-mappingid="{{ id }}">
<i class="fa-solid fa-cloud-arrow-up mr-2"></i>Transfer marks
</button>
{{/inprogress}}
{{/assessmentmapping}}

{{! TODO - transfering... }}
{{#transfering}}
<a href="{{ config.root }}/local/sitsgradepush/index.php?id={{cmid}}" target="_blank" class="badge badge-warning p-2"><i class="fa-solid fa-hourglass-half mr-1"></i> Mark transfer in progress</a>

{{! Progress code example. }}
{{!
<small>Progress: 40%</small>
<div class="progress ">
<div class="progress-bar bg-success" role="progressbar" aria-valuenow="40" style="width: 40%" aria-valuemin="0" aria-valuemax="100"></div>
</div>
}}
{{/transfering}}

</td>
</tr>
{{/componentgrades}}
{{^componentgrades}}
<tr>
<td colspan="6">{{#str}} error:no_mab_found, local_sitsgradepush {{/str}}</td>
</tr>
{{/componentgrades}}
</tbody>

{{/record}}
</tbody>
</table>

{{! Modal }}
<div class="modal fade" id="transferModal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Confirm mark transfer?</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<p>Just a heads-up: once a student's mark has zipped over to SITS, it's like sending a rocket into space - there's no turning back!</p>
<p>If you need to tweak something later, just update it in Portico like usual. Easy peasy!</p>

<p class="strong">Patience is a Virtue (Especially with These Grades!)</h5>

<p>Moving all those fantastic grades takes time, even for our super-speedy computer friends. Keep an eye on the marks transfer table for updates, and we'll also ping you with an email when everything's landed safely in SITS.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
{{! href is populated via js, from the js-btn-transfer-marks data-mappingid attribute. }}
<a id="js-transfer-modal-button" href="#" type="button" class="btn btn-primary">Confirm</a>
</div>
</div>
</div>
</div>

{{#js}}
require(['jquery'], function($) {
$('.js-btn-transfer-marks').on('click', function() {
var datamappingid = $(this).attr('data-mappingid');
$('#js-transfer-modal-button').attr('href', datamappingid);
$('#js-transfer-modal-button').attr('data-mappingid', datamappingid);
});
});
{{/js}}

0 comments on commit 78feaf6

Please sign in to comment.