Difference between revisions of "Template:Participant"

From cm2.liecourt.com
(Fill database)
(Fill database)
Line 35: Line 35:
 
     -->{{Item responsive |Cols={{#var:@cols|4-8}}
 
     -->{{Item responsive |Cols={{#var:@cols|4-8}}
 
|1=Search class
 
|1=Search class
|2=<wstoken id="tokener" name="Class request" json="/extensions/WSForm/WSForm.api.php?action=handleExternalRequest&script=semantic_ask&query=[[Class::Workflow]][[Type::Class]]&limit=99999&returntext=Lie" placeholder="Type minimal 3 letters" class="form-control">
+
|2=<wstoken id="tokener" name="Class request" json="/extensions/WSForm/WSForm.api.php?action=handleExternalRequest&script=semantic_ask&query=[[Class::Workflow]][[Type::Class]]&limit=99999&returntext=Lie" placeholder="Type 3 characters" class="form-control">
 
</wstoken>
 
</wstoken>
 
}}{{#widget:link|datatoggle=pill|href=#info-tab-form-2|text=+ Create a new class|type=a|class=btn btn-green float-right}}
 
}}{{#widget:link|datatoggle=pill|href=#info-tab-form-2|text=+ Create a new class|type=a|class=btn btn-green float-right}}
Line 133: Line 133:
 
{{#tag:wsedit||target={{PAGEID:{{{Workflow}}} }}|template=Workflow|formfield=Juror amount }}
 
{{#tag:wsedit||target={{PAGEID:{{{Workflow}}} }}|template=Workflow|formfield=Juror amount }}
 
{{#tag:wsedit||target={{PAGEID:{{{Workflow}}} }}|template=Workflow|formfield=Suit date }}
 
{{#tag:wsedit||target={{PAGEID:{{{Workflow}}} }}|template=Workflow|formfield=Suit date }}
{{#tag:wsedit||target={{PAGEID:{{{Workflow}}} }}|template=Workflow|formfield=Random juror|value={{#ask:[[Class::Member]][[Role::Juror]][[!{{{User|}}}]][[!{{#show:{{{Workflow}}}|?Filed by|link=none}}]]|Limit=1|format=array|order=random}} }}<!--
+
<div id="jurors">{{#tag:wsedit||target={{PAGEID:{{{Workflow}}} }}|template=Workflow|formfield=Random juror|value={{#ask:[[Class::Member]][[Role::Juror]][[!{{{User|}}}]][[!{{#show:{{{Workflow}}}|?Filed by|link=none}}]]|Limit=4|format=array|order=random}} }}</div><!--
  
 
-->{{Item responsive |Cols={{#var:@cols|4-8}}
 
-->{{Item responsive |Cols={{#var:@cols|4-8}}
 
|1=<b>Number of Jurors needed for the case</b>
 
|1=<b>Number of Jurors needed for the case</b>
|2={{#tag:wsfield||type=number|name=Juror amount|class=form-number form-control|value=0}}
+
|2={{#tag:wsfield||type=number|name=Juror amount|min=1|max=4|class=form-number form-control|value=1}}
 
}}
 
}}
 
{{Item responsive |Cols={{#var:@cols|4-8}}
 
{{Item responsive |Cols={{#var:@cols|4-8}}
 
|1=<b>Date for the suit</b>
 
|1=<b>Date for the suit</b>
 
|2={{#tag:wsfield||type=date|name=Suit date|class=form-control}}
 
|2={{#tag:wsfield||type=date|name=Suit date|class=form-control}}
}}
+
}}<!--
<wsfield type="submit" value="Create docket" class="btn btn-green mb-4"/><!--
+
--><wsfield type="button" onclick="setJurors()" class="btn btn-green mb-4" >Create docket</wsfield>
 +
<wsfield type="submit" value="Create docket" id="submit-docket" class="btn btn-green mb-4 d-none"/><!--
 +
-->{{#tag:html|<script>
 +
  var oldjurrors = document.getElementById('jurors').querySelector('input').value;
 +
 
 +
function setJurors(){
 +
  var amount = document.querySelector('[name="Juror amount"]').value;
 +
  var jur = oldjurrors.split('-^^--^^-')[1];
 +
  var jurarray = jur.split(',');
 +
  var newjurrors = jurarray.slice(0 , amount);
 +
  document.getElementById('jurors').querySelector('input').value = oldjurrors.split('-^^--^^-')[0]+'-^^--^^-'+newjurrors;
 +
  document.getElementById('submit-docket').click();
 +
}
  
 +
</script>}}<!--
  
 
--></wsform>|<!--
 
--></wsform>|<!--
Line 154: Line 167:
 
{{#tag:wsedit||target={{PAGEID:{{{Workflow}}} }}|template=Workflow|formfield=Change|value=yes }}
 
{{#tag:wsedit||target={{PAGEID:{{{Workflow}}} }}|template=Workflow|formfield=Change|value=yes }}
 
{{#tag:wsedit||target={{PAGEID:{{{Workflow}}} }}|template=Workflow|formfield=Change seen by|value=none }}
 
{{#tag:wsedit||target={{PAGEID:{{{Workflow}}} }}|template=Workflow|formfield=Change seen by|value=none }}
{{#tag:wsedit||target={{PAGEID:{{{Workflow}}} }}|template=Workflow|formfield=Suit date }}
+
{{#tag:wsedit||target={{PAGEID:{{{Workflow}}} }}|template=Workflow|formfield=Suit date }}<!--
{{#ifeq:{{#show:{{{Workflow}}}|?Jurors|link=none}}|done|
+
--><div id="jurrors" class="d-none">{{#vardefine:@wf|{{#ask:[[{{{Workflow}}}]]|?Random juror|?Declined juror|?Jurors|?Filed by|link=none|format=array}} }}{{#arraymap:{{#explode:{{#var:@wf}}|<PROP>|1}}|<MANY>|@@@|@@@|,}}</div>
{{#tag:wsedit||target={{PAGEID:{{{Workflow}}} }}|template=Workflow|formfield=Random juror|value={{#ask:[[Class::Member]][[Role::Juror]][[!{{{User|}}}]][[!{{#show:{{{Workflow}}}|?Filed by|link=none}}]]|Limit=1|format=array|order=random}} }}
+
<div id="jurors">{{#tag:wsedit||target={{PAGEID:{{{Workflow}}} }}|template=Workflow|formfield=Random juror|value={{#ask:[[Class::Member]][[Role::Juror]][[!{{{User|}}}]][[!{{#explode:{{#var:@wf}}|<PROP>|4}}]]{{#arraymap:{{#explode:{{#var:@wf}}|<PROP>|1}}|<MANY>|@@@|[[!@@@]]|}}{{#arraymap:{{#explode:{{#var:@wf}}|<PROP>|2}}|<MANY>|@@@|[[!@@@]]|}}{{#arraymap:{{#explode:{{#var:@wf}}|<PROP>|3}}|<MANY>|@@@|[[!@@@]]|}}|Limit=4|format=array|order=random}} }}</div>
}}
+
 
 
{{Item responsive |Cols={{#var:@cols|4-8}}
 
{{Item responsive |Cols={{#var:@cols|4-8}}
 
|1=<b>Number of Jurors needed for the case</b>
 
|1=<b>Number of Jurors needed for the case</b>
|2={{#tag:wsfield||type=number|name=Juror amount|class=form-number form-control|value={{#show:{{{Workflow}}}|?Juror amount }} }}
+
|2={{#tag:wsfield||type=number|name=Juror amount|class=form-number form-control|value={{#show:{{{Workflow}}}|?Juror amount }}|min={{#show:{{{Workflow}}}|?Juror amount }}|max=4 }}
 
}}
 
}}
 
{{Item responsive |Cols={{#var:@cols|4-8}}
 
{{Item responsive |Cols={{#var:@cols|4-8}}
Line 166: Line 179:
 
|2={{#tag:wsfield||type=date|name=Suit date|class=form-control|value={{#show:{{{Workflow}}}|?Suit date }}}}
 
|2={{#tag:wsfield||type=date|name=Suit date|class=form-control|value={{#show:{{{Workflow}}}|?Suit date }}}}
 
}}
 
}}
<wsfield type="submit" value="Change suit" class="btn btn-green mb-4"/>
+
<wsfield type="button" onclick="changeJurors()" class="btn btn-green mb-4" >Change suit</wsfield>
 +
<wsfield type="submit" value="Change suit" id="change-suit" class="btn btn-green mb-4 d-none"/>
 +
{{#tag:html|<script>
 +
      var oldjurrors = document.getElementById('jurors').querySelector('input').value;
 +
 
 +
 
 +
function changeJurors(){
 +
var amount = document.querySelector('[name="Juror amount"]').value;
 +
  var oldamount = document.querySelector('[name="Juror amount"]').getAttribute('min');
 +
 
 +
 
 +
if(amount > oldamount){
 +
  var pastjurrors = document.getElementById('jurrors').innerHTML;
 +
 
 +
  var jur = oldjurrors.split('-^^--^^-')[1];
 +
  var jurarray = jur.split(',');
 +
  var oldjurarray = pastjurrors.split(',');
 +
  var newjurrors = jurarray.slice(0 , amount - oldamount);
 +
  document.getElementById('jurors').querySelector('input').value = oldjurrors.split('-^^--^^-')[0]+'-^^--^^-'+oldjurarray.join()+','+newjurrors;
 +
  document.getElementById('change-suit').click();
 +
}else{
 +
    var pastjurrors = document.getElementById('jurrors').innerHTML;
 +
    var oldjurarray = pastjurrors.split(',');
 +
    document.getElementById('jurors').querySelector('input').value = oldjurrors.split('-^^--^^-')[0]+'-^^--^^-'+oldjurarray.join();
 +
 
 +
  document.getElementById('change-suit').click();
 +
 
 +
}
 +
}
 +
 
 +
</script>}}
 
</wsform>
 
</wsform>
 
<wsform action="addToWiki">   
 
<wsform action="addToWiki">   
 
{{#tag:wsedit||target={{PAGEID:{{{Workflow}}} }}|template=Workflow|formfield=Stage|value=Settled}}
 
{{#tag:wsedit||target={{PAGEID:{{{Workflow}}} }}|template=Workflow|formfield=Stage|value=Settled}}
<wsfield type="submit" value="Mark case settled" class="btn btn-red mb-4"/>
+
<wsfield type="submit" value="Mark case settled" class="btn btn-red mb-4 float-right"/>
 
</wsform>
 
</wsform>
 
}}}}<!--
 
}}}}<!--
Line 188: Line 231:
  
 
--><div class="info-box">
 
--><div class="info-box">
<h2>Chat</h2>
+
<h2>Chat</h2><!--
{{#arraymap:{{#ask:[[Class::Chat]][[Workflow::{{{Workflow|}}}]]|?Message|?Role|?User|?Modification date|format=array|sort=Modification date}}|,|@@@|  
+
-->{{#arraydefine:@chat|{{#ask:[[Class::Chat]][[Workflow::{{{Workflow|}}}]]|?Message|?Role|?User|?Modification date|format=array|limit=10|sort=Modification date|order=desc}} }}{{#arraysort:@chat|reverse}}<!--
 +
-->{{#ifexpr:{{#arraysize:@chat}} > 9 |<span class="btn btn-green pt-1 pb-1 pr-4 pl-4">{{fa|history}} Load older</span><hr>}}<!--
 +
-->{{#arraymap:{{#arrayprint:@chat}}|,|@@@|  
 
<div class="chat {{#ifeq:{{#explode:@@@|<PROP>|3}}|{{{User|}}}|me}} "><div class="d-flex"><h3>{{#explode:@@@|<PROP>|2}}</h3><h4 class="pl-2">{{#explode:@@@|<PROP>|4}}</h4></div>{{#explode:@@@|<PROP>|1}}</div>
 
<div class="chat {{#ifeq:{{#explode:@@@|<PROP>|3}}|{{{User|}}}|me}} "><div class="d-flex"><h3>{{#explode:@@@|<PROP>|2}}</h3><h4 class="pl-2">{{#explode:@@@|<PROP>|4}}</h4></div>{{#explode:@@@|<PROP>|1}}</div>
 
|}}
 
|}}
  
  
<wsform action="addToWiki">
+
<wsform action="addToWiki" id="case-form">
 
<wscreate mwwrite="Chat/" mwtemplate="Chat" mwoption="range:00001-99999" />
 
<wscreate mwwrite="Chat/" mwtemplate="Chat" mwoption="range:00001-99999" />
 
<wsfield type="hidden" name="Case ID" value="{{{Case ID|}}}" />
 
<wsfield type="hidden" name="Case ID" value="{{{Case ID|}}}" />

Revision as of 13:34, 18 May 2020


This is the Participant template. It should be called in the following format:

{{Participant
|User=
|Workflow=
|Case ID=
|Role=
}}