Samples

Samples

1. Loops in loops.

<div class="card">

[foreach (location in MatchedLocations)]

<div class="card-header">Location: [SafeXml(location.Name)]</div>

<div class="card-body">

<div class="card">

[foreach (resource in GetResources(location))]

<div class="card-header">Calendar: [SafeXml(resource.Name)]</div>

<div class="card-body">

[foreach (booking in BookingsTodayByResource(resource))]

<div>

<div>[FormatDate("t", booking.DateFrom)] - [FormatDate("t",booking.DateTo)]</div>

<div>[SafeXML(booking.ResourcesString)]</div>

<div>[SafeXML(booking.Subject)]</div>

<div>[SafeXML(booking.Description)]</div>

</div>

[end foreach]

</div><!-- card body -->

[end foreach]

</div><!-- card -->

</div><!-- card body -->

[end foreach]

</div><!-- card -->




2. Use of week grids.

[var week = WeeklyBookings]

<table>

<tr>

<td><h2 id='corner'>Week [WeekNumber]</h2></td>[foreach (var d in (week.Days))]

<td><h2 id='days'>[GetDayName(d, false)]</h2></td>[end for]

</tr>

[var resources = GetResources("meetingroom,penthouse,cellar")]<!-- Filter using calendar tags -->

[foreach (var resource in resources)]

<tr>

<td class="tdleft"><h2>[SafeXml(resource.Name)]</h2></td>[foreach (var day in week.Days)]

<td class="tdcontent">[foreach (var booking in GetWeekBookings(week,resource,day))]<!-- Take week grid and get the bookings from selected calendar/day -->

[If (resource.UseSubject=true)][SafeXML(booking.Booking.Subject)][else][SafeXML(booking.Booking.ClientName)][end if]<br>

[end for]

</td>[end for]

</tr>

[end for]

</table>

card -->




3. The use of menus in a sample to a catering (Q-Desk) solution (Part 1)

<script type="text/javascript">

function testLogin() {

  // Pre: A client must have an RFID value of 325581

  Ajx("ajx=rfidauth&rfidtoken=325581");

}

function testInvalidLogin() {

  Ajx("ajx=rfidauth&rfidtoken=1231");

}


// Important: Handles JS menu order system

document.onDataHandler = function() { initMenuClasses(); }


</script>

<script type="text/javascript">

  function doSignup() { signup({

      prefix: document.getElementById('mailPrefix').value,

      domain: document.getElementById('selMailDom').value,

      onSet: function(result) {

        if (result)

          alrt({ title: "mail has been sent", text: "A mail has been sent to your superior for validation." });

        else

          alrt({ isError: true, title: "mail was not sent", text: "We failed to notify your superior by mail." });

      }

    }); }

</script>

<div style="display:none">

<resourcestatus>[if (CurrentBooking=null)]0[else]1[end if]</resourcestatus>

<remotecommand>noop</remotecommand>

</div>

<header style="vertical-align:top;">

<div style="float:left;">

<div>

<!-- RfidStatus: [RfidStatus] -->[if (CurrentClient!null)] [CurrentClient.Name] has been logged in :-) [else] please scan your access card (not logged in) [end if]

</div>

<!--

<input type="button" value="Test RFID Login" onclick="testLogin()">

<input type="button" value="test Signup mail" onclick="testInvalidLogin()">

-->

<br>

[FormatDate("D", UtcNow())] at [FormatDate("t", UtcNow())]

</div>

<div style="float:right">

<img src="[GetLogoUrl(Location, false)]" alt="[Location.Name]">

</div>

<div style="clear:both"></div>

</header>






4. Use of menu and sample of a catering solution (Part 2)

<!-- Default screen: Shows a welcome to The Cantina Ltd.. Must return to this point if no interaction for 30 seconds.  -->

[if (CurrentClient!null)]

<div style="background-color:#ffffff">

[foreach (var menu in Menus)]

<div style="clear: left;background-color:#808080;width:100%;height:35px;vertical-align:middle;line-height: 32px;" class="menuheader"><b>[menu.Name]</b>

</div>

[foreach (var section in menu.Sections)][foreach (var product in section.Products)]

<div class="productitem">

<div style="float:left;margin-right: 5px;height:200px"><img src="kantinemenu/[product.Sku].jpg" border="0" width="90"></div>

<div style="padding-left:5px;height:200px;">

<div style="height:140px">

[product.Name]<br>

[product.Description] <br>

<input type="number" class="product-amount" value="" data-svc="[menu.FoodServiceID]" data-sku="[product.Sku]" data-price="[product.UnitPrice]" readonly="">

<span class="product-print-price">[Format("{0:0.00}", product.UnitPrice)] DDK</span><br>

</div>

<div style="height:45px">

<button class="w3-button w3-xlarge w3-circle w3-teal product-add" data-svc="[menu.FoodServiceID]" data-sku="[product.Sku]">+</button>

<button class="w3-button w3-xlarge w3-circle w3-red product-remove" data-svc="[menu.FoodServiceID]" data-sku="[product.Sku]">-</button>

<!--<input type="number" class="product-price" value="" data-svc="[menu.FoodServiceID]" data-sku="[product.Sku]" readonly />-->

</div>

</div>

</div>

[end foreach] [end foreach] <!-- End of Looping sections and products  -->

[end foreach] <!-- End of Looping available menus -->

<div style="clear: left;">

<div style="float:left">

<span class="order-subtotal">Total:

<span class="order-total" data-svc="[menu.FoodServiceID]"></span>

</span>

<button class="order-button" data-svc="[menu.FoodServiceID]">Order...</button>

<input type="button" class="cancel-button" onclick="signoff()" value="Abort and return...">

</div>

</div>

[else]

[If (RfidStatus > 0)]

<div>

<h2>Registrer dig i systemet</h2>

Your card was not approved. However, you have the option to register in the system. <br>

You must enter your email address (and choose which domain you belong to). <br>

Next, you will receive an email in which you need to confirm, after which an email will be sent to the person in charge of the company you work in.<br>Only when these 2 steps are approved can you use the system.<br><br>

Enter your email:

<input type="text" id="mailPrefix" onkeypress="pokeSvr(true)">@<select id="selMailDom" onselect="pokeSvr(true)">[foreach (mainDom in  SignupDomains)]

<option>[mainDom]</option>

[end foreach]</select>

<input type="button" onclick="doSignup()" value=" Registrér dig ">

</div>

<br>

<br>