

## switchmember.html

<%page args="vectorobj, memberobj, loggedin"/>


 % if vectorobj.perm == "ro" or not loggedin:

## Show the read only switch status


 <div class="w3-content" style="max-width:60%;margin-top:1vh">
  <div class="w3-row">

   ## label

   <div class="w3-container w3-threequarter">
     <p>${memberobj.label}</p>
   </div>

   ## status

   <div class="w3-container w3-quarter">
      % if memberobj.membervalue == "On":
        <button class="w3-button w3-xlarge w3-circle w3-blue">On</button>
      % else:
        <button class="w3-button w3-xlarge w3-circle w3-grey">Off</button>
      % endif
   </div>

  </div>
 </div>

% else:

## Show rw and wo switch status, followed by switches

 <div class="w3-content" style="max-width:70%;margin-top:1vh">
  <div class="w3-row">

   ## label

   <div class="w3-container w3-third">
     <p>${memberobj.label}</p>
   </div>

   ## status

   <div class="w3-container w3-third">
      % if memberobj.membervalue == "On":
        <button class="w3-button w3-xlarge w3-circle w3-blue">On</button>
      % else:
        <button class="w3-button w3-xlarge w3-circle w3-grey">Off</button>
      % endif
   </div>


   ## switches

   <div class="w3-container w3-third">
     <label class="switch">
       <input id="switch_${memberobj.itemid|h}" type="checkbox" name="member_${memberobj.itemid|h}" value="On" hx-preserve

% if memberobj.membervalue == "On":
  checked
% endif

% if vectorobj.rule != "AnyOfMany":

onclick="switchFunction([
% for mbr in vectorobj.members().values():
   % if mbr.name != memberobj.name:
'switch_${mbr.itemid|h}',
   % endif
%endfor
])"

% endif
 />

         <span class="slider"></span>
     </label>
   </div>



 </div>
</div>

 % endif
