MDL-64506 templates: BS2 pull-x -> BS4 float-x
[moodle.git] / admin / tool / lp / templates / plan_page.mustache
1 {{!
2     This file is part of Moodle - http://moodle.org/
4     Moodle is free software: you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation, either version 3 of the License, or
7     (at your option) any later version.
9     Moodle is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
14     You should have received a copy of the GNU General Public License
15     along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
16 }}
17 {{!
18     Plan page template.
19 }}
20 <div data-region="plan-page" data-id="{{plan.id}}" data-userid="{{plan.userid}}">
21     <h2>
22         {{{plan.name}}}
23         {{#plan.canbeedited}}
24             <a href="{{pluginbaseurl}}/editplan.php?id={{plan.id}}&amp;userid={{plan.userid}}">{{#pix}}t/edit, core, {{#str}}editplan, tool_lp{{/str}}{{/pix}}</a>
25         {{/plan.canbeedited}}
26     </h2>
27     {{#plan.canbeedited}}
28     <div data-region="actions" class="clearfix">
29         <div class="float-left">
30             <!-- Button to add competencies to the plan -->
31             <button class="btn btn-secondary" data-action="add">{{#pix}}t/add{{/pix}} {{#str}}addcompetency, tool_lp{{/str}}</button>
32         </div>
33     </div>
34     {{/plan.canbeedited}}
35     <div data-region="plan-summary" class="mt-1">
36         {{{plan.description}}}
37         <dl>
38             <dt>{{#str}}status, tool_lp{{/str}}</dt>
39             <dd>
40                 {{plan.statusname}}
42                 {{#plan.isinreview}}
43                     - {{plan.reviewer.fullname}}
44                 {{/plan.isinreview}}
46                 {{#plan.iscompleteallowed}}
47                     (<a data-action="plan-complete" href="#">{{#str}}completeplan, tool_lp{{/str}}</a>)
48                 {{/plan.iscompleteallowed}}
49                 {{#plan.isreopenallowed}}
50                     (<a data-action="plan-reopen" href="#">{{#str}}reopenplan, tool_lp{{/str}}</a>)
51                 {{/plan.isreopenallowed}}
52                 {{#plan.isrequestreviewallowed}}
53                     (<a data-action="plan-request-review" href="#">{{#str}}requestreview, tool_lp{{/str}}</a>)
54                 {{/plan.isrequestreviewallowed}}
55                 {{#plan.iscancelreviewrequestallowed}}
56                     (<a data-action="plan-cancel-review-request" href="#">{{#str}}cancelreviewrequest, tool_lp{{/str}}</a>)
57                 {{/plan.iscancelreviewrequestallowed}}
58                 {{#plan.isstartreviewallowed}}
59                     (<a data-action="plan-start-review" href="#">{{#str}}startreview, tool_lp{{/str}}</a>)
60                 {{/plan.isstartreviewallowed}}
61                 {{#plan.isstopreviewallowed}}
62                     (<a data-action="plan-stop-review" href="#">{{#str}}stopreview, tool_lp{{/str}}</a>)
63                 {{/plan.isstopreviewallowed}}
64                 {{#plan.isapproveallowed}}
65                     (<a data-action="plan-approve" href="#">{{#str}}planapprove, tool_lp{{/str}}</a>)
66                 {{/plan.isapproveallowed}}
67                 {{#plan.isunapproveallowed}}
68                     (<a data-action="plan-unapprove" href="#">{{#str}}planunapprove, tool_lp{{/str}}</a>)
69                 {{/plan.isunapproveallowed}}
71             </dd>
72             {{#plan.duedate}}
73                 <dt>{{#str}}duedate, tool_lp{{/str}}</dt>
74                 <dd>{{plan.duedateformatted}}</dd>
75             {{/plan.duedate}}
76             {{#plan.template}}
77                 <dt>{{#str}}template, tool_lp{{/str}}</dt>
78                 <dd>
79                     {{#canread}}
80                         <a href="{{pluginbaseurl}}/templatecompetencies.php?templateid={{id}}&amp;pagecontextid={{contextid}}">
81                     {{/canread}}
82                     {{{plan.template.shortname}}}{{#canread}}</a>{{/canread}}
83                     {{#plan.isunlinkallowed}}
84                         (<a data-action="plan-unlink" href="#">{{#str}}unlinkplantemplate, tool_lp{{/str}}</a>)
85                     {{/plan.isunlinkallowed}}
86                 </dd>
87             {{/plan.template}}
88             {{#description}}
89                 <dt>{{#str}}description{{/str}}</dt>
90                 <dd>{{{plan.description}}}</dd>
91             {{/description}}
92             <dt>{{#str}}progress, tool_lp{{/str}}</dt>
93             <dd>
94             {{< tool_lp/progress_bar}}
95                 {{$progresstext}}
96                     {{#str}}xcompetenciesproficientoutofy, tool_lp, { "x": "{{proficientcompetencycount}}", "y": "{{competencycount}}" }{{/str}}
97                 {{/progresstext}}
98                 {{$percentage}}{{proficientcompetencypercentage}}{{/percentage}}
99                 {{$percentlabel}}{{proficientcompetencypercentageformatted}}&nbsp;%{{/percentlabel}}
100             {{/tool_lp/progress_bar}}
101             </dd>
102         </dl>
103     </div>
104     {{#plan.commentarea}}
105         {{#canpostorhascomments}}
106             <div data-region="comments" class="mt-1">
107                 {{>tool_lp/comment_area}}
108             </div>
109         {{/canpostorhascomments}}
110     {{/plan.commentarea}}
111     <div data-region="plan-competencies" class="mt-1">
112         <h3>{{#str}}learningplancompetencies, tool_lp{{/str}}</h3>
113         <table class="generaltable fullwidth managecompetencies">
114             <thead>
115                 <tr>
116                     <th scope="col">{{#str}}shortname, tool_lp{{/str}}</th>
117                     <th scope="col">{{#str}}rating, tool_lp{{/str}}</th>
118                     <th scope="col">{{#str}}proficient, tool_lp{{/str}}</th>
119                     {{^plan.iscompleted}}
120                         <th scope="col">{{#str}}status, tool_lp{{/str}}</th>
121                         <th scope="col">{{#str}}actions, tool_lp{{/str}}</th>
122                     {{/plan.iscompleted}}
123                 </tr>
124             </thead>
125             <tbody class="drag-parentnode">
126                 {{#competencies}}
127                 <tr class="drag-samenode" data-node="user-competency" data-id="{{competency.id}}"
128                         data-competencyid="{{competency.id}}"
129                         data-userid="{{plan.userid}}">
130                     <td>
131                         {{#plan.canbeedited}}
132                         <span class="drag-handlecontainer float-left"></span>
133                         {{/plan.canbeedited}}
134                         <a data-usercompetency="true" href="#">{{{competency.shortname}}}</a>
135                         <em>{{competency.idnumber}}</em>
136                         {{#comppath}}
137                             <br>
138                             <span class="float-left">{{#str}}path, tool_lp{{/str}}&nbsp;</span>{{> tool_lp/competency_path }}
139                         {{/comppath}}
140                     </td>
141                     {{#plan.iscompleted}}
142                         <td>{{usercompetencyplan.gradename}}</td>
143                         <td>{{usercompetencyplan.proficiencyname}}</td>
144                     {{/plan.iscompleted}}
145                     {{^plan.iscompleted}}
146                         <td>{{usercompetency.gradename}}</td>
147                         <td>{{usercompetency.proficiencyname}}</td>
148                         <td>{{usercompetency.statusname}}</td>
149                     {{/plan.iscompleted}}
150                     {{^plan.iscompleted}}
151                         <td>
152                             <ul title="{{#str}}edit{{/str}}" class="user-competency-actions">
153                                 <li>
154                                     <a href="#">{{#str}}edit{{/str}}</a><b class="caret"></b>
155                                     <ul class="dropdown dropdown-menu">
156                                         {{#usercompetency.isrequestreviewallowed}}
157                                             <li class="dropdown-item">
158                                                 <a href="#" data-action="request-review">{{#pix}}t/edit, core{{/pix}} {{#str}}requestreview, tool_lp{{/str}}</a>
159                                             </li>
160                                         {{/usercompetency.isrequestreviewallowed}}
161                                         {{#usercompetency.iscancelreviewrequestallowed}}
162                                             <li class="dropdown-item">
163                                                 <a href="#" data-action="cancel-review-request">{{#pix}}t/edit, core{{/pix}} {{#str}}cancelreviewrequest, tool_lp{{/str}}</a>
164                                             </li>
165                                         {{/usercompetency.iscancelreviewrequestallowed}}
166                                         {{#plan.canbeedited}}
167                                             <li class="dropdown-item">
168                                                 <a href="#" data-action="delete-competency-link" data-id="{{competency.id}}">{{#pix}}t/delete, core{{/pix}} {{#str}}delete{{/str}}</a>
169                                             </li>
170                                         {{/plan.canbeedited}}
171                                         <li class="dropdown-item">
172                                             <a href="#" data-action="find-courses-link" data-id="{{competency.id}}">{{#pix}}t/preview, core{{/pix}} {{#str}}findcourses, tool_lp{{/str}}</a>
173                                         </li>
174                                     </ul>
175                                 </li>
176                             </ul>
177                         </td>
178                     {{/plan.iscompleted}}
179                 </tr>
180                 {{/competencies}}
181             </tbody>
182         </table>
183         {{^competencies}}
184             <p class="alert alert-info">
185                 {{#str}}nocompetenciesinlearningplan, tool_lp{{/str}}
186             </p>
187         {{/competencies}}
188     </div>
189 </div>
190 {{#js}}
191 require(['tool_lp/competencies', 'tool_lp/planactions', 'tool_lp/user_competency_workflow', 'tool_lp/user_competency_plan_popup'], function(mod, actionsMod, UserCompWorkflow, Popup) {
192     var planActions = new actionsMod('plan');
194     (new mod({{plan.id}}, 'plan', {{contextid}}));
195     (new Popup('[data-region=plan-page]', '[data-usercompetency=true]', {{plan.id}}));
196     planActions.registerEvents();
198     var ucw = new UserCompWorkflow();
199     ucw.enhanceMenubar('.user-competency-actions');
200     ucw.on('status-changed', planActions.refresh.bind(planActions, '[data-region="plan-summary"]'));
201     ucw.on('error-occured', planActions.refresh.bind(planActions, '[data-region="plan-summary"]'));
202 });
203 {{/js}}