Difference between revisions of "Template:User"
From cm2.liecourt.com
(Fill database) |
(Fill database) |
||
Line 18: | Line 18: | ||
</noinclude><includeonly> | </noinclude><includeonly> | ||
− | <div class="d-none">__NOTITLE__ __NOTOC__{{#if:{{{Name|}}}|{{#set:Class=Member|Role={{#if:{{{Roles|}}}|{{{Roles|}}}|Juror}}|+sep=,|User={{{User|}}}|Name={{{Name|}}}|Email={{{Email|}}}|Volunteer={{{Volunteer|}}} }} | + | <div class="d-none">__NOTITLE__ __NOTOC__{{#if:{{{Name|}}}|{{#set:Class=Member|Role={{#if:{{{Roles|}}}|{{{Roles|}}}|Juror, Judge}}|+sep=,|User={{{User|}}}|Name={{{Name|}}}|Email={{{Email|}}}|Volunteer={{{Volunteer|}}}|Tokens spent={{{Tokens spent|}}} }} |
</div> | </div> | ||
{{#vardefine:@allowed|{{#ifeq:User:{{CURRENTLOGGEDUSER}}|{{FULLPAGENAME}}|Yes|{{#ifsysop:Yes|No}}}}}} | {{#vardefine:@allowed|{{#ifeq:User:{{CURRENTLOGGEDUSER}}|{{FULLPAGENAME}}|Yes|{{#ifsysop:Yes|No}}}}}} | ||
Line 107: | Line 107: | ||
<div class="col-12 col-lg-4"> | <div class="col-12 col-lg-4"> | ||
<div class="info-box"> | <div class="info-box"> | ||
− | <h2>TruthTokens</h2><div id="balance"> | + | <h2>TruthTokens</h2><div id="balance"><!-- |
− | <span class="truth-token">{{fa|gavel}}</span>× <span class="nr"> | + | -->{{#vardefine:@spent|{{#ask:[[Class::Workflow]][[Filed by::{{FULLPAGENAME}}]]|link=none|format=count}} }}<!-- |
+ | -->{{#vardefine:@bought|{{#arraymap:{{#ask:[[Class::Order]][[User::{{FULLPAGENAME}}]][[Transaction::+]]|?Tokens|format=array|link=none}}|,|@@@|{{#explode:@@@|<PROP>|1}}|+}} }}<!-- | ||
+ | -->{{#vardefine:@sent|{{#arraymap:{{#ask:[[Class::Transaction]][[User::{{FULLPAGENAME}}]][[To::!None]]|?Tokens|link=none|format=array}}|,|@@@|{{#explode:@@@|<PROP>|1}}|+}} }}<!-- | ||
+ | -->{{#vardefine:@recieved|{{#arraymap:{{#ask:[[Class::Transaction]][[To::{{FULLPAGENAME}}]]|?Tokens|link=none|format=array}}|,|@@@|{{#explode:@@@|<PROP>|1}}|+}} }}<!-- | ||
+ | -->{{#vardefine:@balance|{{#expr:{{#if:{{#var:@bought}}|{{#var:@bought}}|0}} + {{#if:{{#var:@recieved}}|{{#var:@recieved}}|0}} - {{#expr:{{#if:{{#var:@spent}}|{{#var:@spent}}|0}} + {{#if:{{#var:@sent}}|{{#var:@sent}}|0}} }} }} }} | ||
+ | <span class="truth-token">{{fa|gavel}}</span>× <span class="nr">{{#var:@balance}}</span> {{#tag:wsfield|Buy more|type=button|onclick=buyMore()|class=btn ml-4 btn-green|id=buy-more-button}}</div> | ||
+ | {{#tag:wsfield|Send to a friend|type=button|onclick=sendTokens()|class=btn |id=send-tokens}} | ||
<div id="buy-more" class="d-none"> | <div id="buy-more" class="d-none"> | ||
− | < | + | <wsform action="addToWiki" > |
+ | {{#tag:wscreate||mwwrite=Order/|mwtemplate=Order|mwoption=range:00001-99999|mwfollow=true}} | ||
<div><span class="truth-token">{{fa|gavel}}</span>× <wsfield type="number" min="1" class="form-control form-number" name="Tokens" value="1" /></div> | <div><span class="truth-token">{{fa|gavel}}</span>× <wsfield type="number" min="1" class="form-control form-number" name="Tokens" value="1" /></div> | ||
<wsfield type="hidden" name="Email" value="{{{Email|}}}" /> | <wsfield type="hidden" name="Email" value="{{{Email|}}}" /> | ||
Line 116: | Line 123: | ||
<wsfield type="hidden" name="User" value="{{FULLPAGENAME}}" /> | <wsfield type="hidden" name="User" value="{{FULLPAGENAME}}" /> | ||
<div class="total-token-price">Total $ <span id="total-price" >200</span>,-</div> | <div class="total-token-price">Total $ <span id="total-price" >200</span>,-</div> | ||
− | {{#widget:Pay}} | + | <!--{{#widget:Pay}}--> |
− | <!--<wsfield type="submit" value=" | + | <wsfield type="submit" value="buy" class="btn btn-green " /> |
+ | </wsform> | ||
+ | </div> | ||
+ | <div id="send-tokens-form" class="d-none"> | ||
+ | <wsform action="addToWiki" > | ||
+ | {{#tag:wscreate||mwwrite=Transaction/|mwtemplate=Transaction|mwoption=range:00001-99999|mwfollow=true}} | ||
+ | <div><span class="truth-token">{{fa|gavel}}</span>× <wsfield type="number" min="1" max="{{#var:@balance}}" class="form-control form-number" name="Tokens" value="1" /></div> | ||
+ | <wsfield type="hidden" name="User" value="{{FULLPAGENAME}}" /> | ||
+ | <wsfield type="text" name="To" placeholder="User:name" class="form-control mt-4 mb-4" /> | ||
+ | <!--{{#widget:Pay}}--> | ||
+ | <wsfield type="submit" value="send" class="btn btn-green " /> | ||
+ | </wsform> | ||
</div> | </div> | ||
− | <div id="result"></div> | + | <div id="result"></div><!--{{Payment form| |
− | |||
− | <!--{{Payment form| | ||
|Billing name={{{Name|}}} | |Billing name={{{Name|}}} | ||
|Billing email={{{Email|}}} | |Billing email={{{Email|}}} | ||
|Price=200 | |Price=200 | ||
− | }}--> | + | }}--></div> |
− | |||
− | </div> | ||
<div class="info-box"> | <div class="info-box"> | ||
<h2>Messages</h2> | <h2>Messages</h2> | ||
Line 377: | Line 391: | ||
document.getElementById(elem).classList.remove('d-flex'); | document.getElementById(elem).classList.remove('d-flex'); | ||
+ | } | ||
+ | |||
+ | function sendTokens(){ | ||
+ | document.getElementById('send-tokens-form').classList.remove('d-none'); | ||
+ | document.getElementById('balance').classList.add('buy'); | ||
+ | document.getElementById('balance').querySelector('button').classList.add('d-none'); | ||
} | } | ||
function buyMore(){ | function buyMore(){ | ||
+ | document.getElementById('send-tokens').classList.add('d-none'); | ||
document.getElementById('buy-more').classList.remove('d-none'); | document.getElementById('buy-more').classList.remove('d-none'); | ||
document.getElementById('balance').classList.add('buy'); | document.getElementById('balance').classList.add('buy'); | ||
Line 396: | Line 417: | ||
if(formnumber.value > 0){ | if(formnumber.value > 0){ | ||
− | document.querySelector('#buyButton').removeAttribute('disabled'); | + | //document.querySelector('#buyButton').removeAttribute('disabled'); |
if(formnumber.value > -1){ | if(formnumber.value > -1){ | ||
Line 403: | Line 424: | ||
} | } | ||
}else{ | }else{ | ||
− | document.querySelector('#buyButton').setAttribute('disabled','disabled'); | + | //document.querySelector('#buyButton').setAttribute('disabled','disabled'); |
} | } | ||
Revision as of 09:16, 14 May 2020
This is the Member template. It should be called in the following format:
{{Member |User= |Roles= |Name= |Filed by= }}
TruthTokens
× 3
Please log in first.
Messages
Participant in 0 case