Created
October 14, 2015 13:40
-
-
Save JonDaniel/469ddd62af0e028b82cc to your computer and use it in GitHub Desktop.
Personal Reminders
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% extends "master.html" %} | |
{% block init %}{{ aek.set_aek_version(1.4) }} | |
{% endblock %} | |
{% block title %}Personal Reminders{% endblock %} | |
{% block main_content %} | |
{% set addons = aek.extension("AddonsWebServices") %} | |
<link rel="stylesheet" href="https://portal.ombiel.co.uk/assets/BradfordMDC/BradfordCouncil/css/bradford_mdc_aek.css" /> | |
<div> | |
<article> | |
<header class="theme1 schools"> | |
<h1>Reminders</h1> | |
</header> | |
{{ aek.add_lib("aek-subpages") }} | |
{{ aek.add_lib("aek-icons") }} | |
{% set action = aek.request("_action") %} | |
{{ aek.remove_from_cache }} | |
{# Actions ... #} | |
{% if action == "delete" %} | |
{% set response = addons.call("deleteReminders", {"personId":aek.person_id,"password":"[[password]]","reminderIds":aek.request("reminderId") }) %} | |
{% set action = "" %} | |
<div class="buttonmdc deletedbtn">Deleted reminder "{{aek.request("message") }}"</div> | |
{% endif %} | |
{% if action == "createcouncil2" %} | |
{% if aek.request("month") == "10" %} | |
{% set monthcron = "1,4,5,6,7,8,9,10,11,12 ?" %} | |
{% else %} | |
{% set monthcron = "* ?" %} | |
{% endif %} | |
{% set daytoremindon = aek.request("whichday") %} | |
{% if daytoremindon <= 0 %} | |
{% set daytoremindon = daytoremindon + 28 %} | |
{% endif %} | |
{% set cronstring = "0 0 12 " ~ daytoremindon ~ " " ~ monthcron %} | |
{% set createResponse = addons.call("createReminder", {"personId":aek.person_id,"password":"[[password]]","crontab_pattern":cronstring,"message":"Council Tax reminder","body":"You asked to be reminded that your Council Tax is due."}) %} | |
{% set action = "" %} | |
{% if createResponse.desc != "Successful" %} | |
<div class="errbtn">Failed to create alert "Council Tax reminder" -- {{ createResponse.detail.returnStatus.desc }}</div> | |
{% else %} | |
<div class="createdbtn">Created alert "Council Tax reminder"</div> | |
{% endif %} | |
{% endif %} | |
{% if action == "createbusrates2" %} | |
{% if aek.request("month") == "10" %} | |
{% set monthcron = "1,4,5,6,7,8,9,10,11,12 ?" %} | |
{% else %} | |
{% set monthcron = "* ?" %} | |
{% endif %} | |
{% set daytoremindon = aek.request("whichday") %} | |
{% if daytoremindon <= 0 %} | |
{% set daytoremindon = daytoremindon + 28 %} | |
{% endif %} | |
{% set todaystring = "{#TODAY#}" %} | |
{% set cronstring = "0 0 12 " ~ daytoremindon ~ " " ~ monthcron %} | |
{% set createResponse = addons.call("createReminder", {"personId":aek.person_id,"password":"[[password]]","crontab_pattern":cronstring,"message":"Business rates reminder -- " ~ aek.request("note"),"body":"You asked us to remind you about your business rates " ~ aek.request("note")}) %} | |
{% set action = "" %} | |
{% if createResponse.desc != "Successful" %} | |
<div class="errbtn">Failed to create alert "Business Rates reminder" -- {{ createResponse.detail.returnStatus.desc }}</div> | |
{% else %} | |
<div class="createdbtn">Created alert "Business Rates reminder"</div> | |
{% endif %} | |
{% endif %} | |
{% if action == "createmonthly2" %} | |
{% set monthcron = "* ?" %} | |
{% set daytoremindon = aek.request("whichday") %} | |
{% set todaystring = "{#TODAY#}" %} | |
{% set cronstring = "0 0 12 " ~ daytoremindon ~ " " ~ monthcron %} | |
{% set createResponse = addons.call("createReminder", {"personId":aek.person_id,"password":"[[password]]","crontab_pattern":cronstring,"message":"Reminder -- " ~ aek.request("note"),"body":aek.request("body")}) %} | |
{% set action = "" %} | |
{% if createResponse.desc != "Successful" %} | |
<div class="errbtn">Failed to create alert {{ aek.request("note") }} -- {{ createResponse.detail.returnStatus.desc }}</div> | |
{% else %} | |
<div class="createdbtn">Created alert {{ aek.request("note") }}</div> | |
{% endif %} | |
{% endif %} | |
{% if action == "createannual2" %} | |
{% set monthcron = aek.request("whichmonth") ~ " ?" %} | |
{% set daytoremindon = aek.request("whichday") %} | |
{% set cronstring = "0 0 12 " ~ daytoremindon ~ " " ~ monthcron %} | |
{% set createResponse = addons.call("createReminder", {"personId":aek.person_id,"password":"[[password]]","crontab_pattern":cronstring,"message":"Reminder -- " ~ aek.request("note"),"body":aek.request("body")}) %} | |
{% set action = "" %} | |
{% if createResponse.desc != "Successful" %} | |
<div class="errbtn">Failed to create alert {{ aek.request("note") }} -- {{ createResponse.detail.returnStatus.desc }}</div> | |
{% else %} | |
<div class="createdbtn">Created alert {{ aek.request("note") }}</div> | |
{% endif %} | |
{% endif %} | |
{% if action == "createonetime2" %} | |
{% set once_only = aek.request("when") ~ "T" ~ aek.request("time") ~ ":00.000" ~ aek.request("when")|format_date("P") %} | |
{% set createResponse = addons.call("createReminder", {"personId":aek.person_id,"password":"[[password]]","once_only":once_only,"message":aek.request("note"),"body":aek.request("body")}) %} | |
{% set action = "" %} | |
{% if createResponse.desc != "Successful" %} | |
<div class="errbtn">Failed to create alert {{ aek.request("note") }} -- {{ createResponse.detail.returnStatus.desc }}</div> | |
{% else %} | |
<div class="createdbtn">Created alert {{ aek.request("note") }} -- {{ createResponse.desc }}</div> | |
{% endif %} | |
{% endif %} | |
{# Show reminders list ... #} | |
{% if not action or action == "" %} | |
<section class="theme1"> | |
<p class="introtext">This page allows you to set up reminders for various things - you'll receive a push notification via the app</p> | |
<form name="createme" action="{{aek.current_url}}"> | |
<input type="hidden" name="_action" value="create"/> | |
<input type="submit" class="buttonbmdc" name="submit" value="Create new reminder"/> | |
</form> | |
</section> | |
{% set response = addons.call("viewReminders", {"personId":aek.person_id,"password":"[[password]]" }) %} | |
{% if response.reminders.reminder %} | |
<section class="theme1 currentreminders"> | |
<h2 class="theme1">Your current reminders</h2> | |
<ul class="listview"> | |
{% endif %} | |
{% for reminder in response.reminders.reminder %} | |
<li> | |
{% if reminder.once_only %} | |
<span class="reminderTitle"><b>Once only - on {{ reminder.once_only|format_date("d/m/y H:i") }}</b></span> | |
{% else %} | |
<span class="reminderTitle"><b>Repeating - {{ reminder.crontab_description }}</b></span> | |
{% endif %} | |
<i>{{reminder.message}}</i> | |
<div data-role="subpage" id="stuff"> | |
<section class="theme1"> | |
<p>This is a reminder that's due to be sent to you via the app:</p> | |
{% if reminder.once_only %} | |
<b>Once only - On {{ reminder.once_only|format_date("d/m/y H:i") }} (Once only)</b> | |
{% else %} | |
<b>Repeating - {{ reminder.crontab_description }}</b> | |
{% endif %} | |
<p><i>{{reminder.message}}</i></p> | |
<p>{{ reminder.body }}</p> | |
<form name="deleteme" action="{{aek.current_url}}"> | |
<input type="hidden" name="_action" value="delete"/> | |
<input type="hidden" name="message" value="{{reminder.message}}"/> | |
<input type="hidden" name="reminderId" value="{{reminder.reminderId}}"/> | |
<input type="submit" class="buttonbmdc" name="submit" value="Delete Reminder"/> | |
</form> | |
</section> | |
</div> | |
</li> | |
{% endfor %} | |
{% if response.reminders.reminder %} | |
</ul> | |
</section> | |
{% endif %} | |
{# Creation forms... #} | |
{% elseif action == "create" %} | |
<section class="theme1"> | |
<h2 class="sectiontext">What do you want to be reminded of?</h2> | |
<form name="createcouncil" action="{{aek.current_url}}" class="formpadding"> | |
<input type="hidden" name="_action" value="createcouncil"/> | |
<input type="submit" class="buttonbmdc" name="submit" value="Council Tax"/> | |
</form> | |
<form name="createbusrates" action="{{aek.current_url}}" class="formpadding"> | |
<input type="hidden" name="_action" value="createbusrates"/> | |
<input type="submit" class="buttonbmdc" name="submit" value="Business Rates"/> | |
</form> | |
<form name="createmonthly" action="{{aek.current_url}}" class="formpadding"> | |
<input type="hidden" name="_action" value="createmonthly"/> | |
<input type="submit" class="buttonbmdc" name="submit" value="Monthly reminder"/> | |
</form> | |
<form name="createannual" action="{{aek.current_url}}" class="formpadding"> | |
<input type="hidden" name="_action" value="createannual"/> | |
<input type="submit" class="buttonbmdc" name="submit" value="Annual reminder"/> | |
</form> | |
<!-- | |
<form name="createonceonly" action="{{aek.current_url}}" class="formpadding"> | |
<input type="hidden" name="_action" value="onceonly"/> | |
<input type="submit" class="buttonbmdc" name="submit" value="One-time message"/> | |
</form> | |
--> | |
</section> | |
{% elseif action == "createcouncil" %} | |
<section class="theme1"> | |
<h2 class="sectiontext">Create a Council Tax reminder</h2> | |
<form name="createcouncil2" action="{{aek.current_url}}"> | |
<div class="formpadding2"> | |
<input type="hidden" name="_action" value="createcouncil2"/> | |
<label for="month">Do you pay your Council Tax over 10 months or 12 months a year?</label> | |
<select name="month"> | |
<option value="10">10 months</option> | |
<option value="12">12 months</option> | |
</select> | |
</div> | |
<div class="formpadding2"> | |
<label for="whichday">Which day of the month do you want to be reminded?</label> | |
<select name="whichday"> | |
<option value="1">1st</option> | |
<option value="2">2nd</option> | |
<option value="3">3rd</option> | |
<option value="4">4th</option> | |
<option value="5">5th</option> | |
<option value="6">6th</option> | |
<option value="7">7th</option> | |
<option value="8">8th</option> | |
<option value="9">9th</option> | |
<option value="10">10th</option> | |
<option value="11">11th</option> | |
<option value="12">12th</option> | |
<option value="13">13th</option> | |
<option value="14">14th</option> | |
<option value="15">15th</option> | |
<option value="16">16th</option> | |
<option value="17">17th</option> | |
<option value="18">18th</option> | |
<option value="19">19th</option> | |
<option value="20">20th</option> | |
<option value="21">21st</option> | |
<option value="22">22nd</option> | |
<option value="23">23rd</option> | |
<option value="24">24th</option> | |
<option value="25">25th</option> | |
<option value="26">26th</option> | |
<option value="27">27th</option> | |
<option value="28">28th</option> | |
</select> | |
</div> | |
<input type="submit" class="buttonbmdc" name="submit" value="Create Council Tax Reminder"/> | |
</form> | |
</section> | |
{% elseif action == "createbusrates" %} | |
<section class="theme1"> | |
<h2 class="sectiontext">Create a business rates reminder</h2> | |
<form name="createbusrates2" action="{{aek.current_url}}"> | |
<div class="formpadding2"> | |
<input type="hidden" name="_action" value="createbusrates2"/> | |
<label for="month">Do you pay your Business Rates over 10 months or 12 months a year?</label> | |
<select name="month"> | |
<option value="10">10 months</option> | |
<option value="12">12 months</option> | |
</select> | |
</div> | |
<div class="formpadding2"> | |
<label for="whichday">Which day of the month do you want to be reminded?</label> | |
<select name="whichday"> | |
<option value="1">1st</option> | |
<option value="2">2nd</option> | |
<option value="3">3rd</option> | |
<option value="4">4th</option> | |
<option value="5">5th</option> | |
<option value="6">6th</option> | |
<option value="7">7th</option> | |
<option value="8">8th</option> | |
<option value="9">9th</option> | |
<option value="10">10th</option> | |
<option value="11">11th</option> | |
<option value="12">12th</option> | |
<option value="13">13th</option> | |
<option value="14">14th</option> | |
<option value="15">15th</option> | |
<option value="16">16th</option> | |
<option value="17">17th</option> | |
<option value="18">18th</option> | |
<option value="19">19th</option> | |
<option value="20">20th</option> | |
<option value="21">21st</option> | |
<option value="22">22nd</option> | |
<option value="23">23rd</option> | |
<option value="24">24th</option> | |
<option value="25">25th</option> | |
<option value="26">26th</option> | |
<option value="27">27th</option> | |
<option value="28">28th</option> | |
</select> | |
</div> | |
<div class="formpadding2"> | |
<label for="note">Any other details (will be included in the reminder)</label> | |
<input type="text" name="note"/> | |
</div> | |
<input type="submit" class="buttonbmdc" name="submit" value="Create Business Rates Reminder"/> | |
</form> | |
</section> | |
{% elseif action == "createmonthly" %} | |
<section class="theme1"> | |
<h2 class="sectiontext">Create a monthly reminder</h2> | |
<form name="createmonthly2" action="{{aek.current_url}}"> | |
<div class="formpadding2"> | |
<input type="hidden" name="_action" value="createmonthly2"/> | |
<label for="whichday">Which day of the month do you want to be reminded?</label> | |
<select name="whichday"> | |
<option value="1">1st</option> | |
<option value="2">2nd</option> | |
<option value="3">3rd</option> | |
<option value="4">4th</option> | |
<option value="5">5th</option> | |
<option value="6">6th</option> | |
<option value="7">7th</option> | |
<option value="8">8th</option> | |
<option value="9">9th</option> | |
<option value="10">10th</option> | |
<option value="11">11th</option> | |
<option value="12">12th</option> | |
<option value="13">13th</option> | |
<option value="14">14th</option> | |
<option value="15">15th</option> | |
<option value="16">16th</option> | |
<option value="17">17th</option> | |
<option value="18">18th</option> | |
<option value="19">19th</option> | |
<option value="20">20th</option> | |
<option value="21">21st</option> | |
<option value="22">22nd</option> | |
<option value="23">23rd</option> | |
<option value="24">24th</option> | |
<option value="25">25th</option> | |
<option value="26">26th</option> | |
<option value="27">27th</option> | |
<option value="28">28th</option> | |
</select> | |
</div> | |
<div class="formpadding2"> | |
<label for="note">Message that will be sent as the reminder</label> | |
<input type="text" name="note"/> | |
</div> | |
<div class="formpadding2"> | |
<label for="body">Details that will be sent in the reminder</label> | |
<textarea name="body"/> | |
</div> | |
<input type="submit" class="buttonbmdc" name="submit" value="Create Monthly Reminder"/> | |
</form> | |
</section> | |
{% elseif action == "createannual" %} | |
<section class="theme1"> | |
<h2 class="sectiontext">Create an annual reminder</h2> | |
<form name="createannual2" action="{{aek.current_url}}"> | |
<div class="formpadding2"> | |
<input type="hidden" name="_action" value="createannual2"/> | |
<label for="whichmonth">Which month do you want to be reminded?</label> | |
<select name="whichmonth"> | |
<option value="1">January</option> | |
<option value="2">February</option> | |
<option value="3">March</option> | |
<option value="4">April</option> | |
<option value="5">May</option> | |
<option value="6">June</option> | |
<option value="7">July</option> | |
<option value="8">August</option> | |
<option value="9">September</option> | |
<option value="10">October</option> | |
<option value="11">November</option> | |
<option value="12">December</option> | |
</select> | |
</div> | |
<div class="formpadding2"> | |
<label for="whichday">Which day of the month do you want to be reminded?</label> | |
<select name="whichday"> | |
<option value="1">1st</option> | |
<option value="2">2nd</option> | |
<option value="3">3rd</option> | |
<option value="4">4th</option> | |
<option value="5">5th</option> | |
<option value="6">6th</option> | |
<option value="7">7th</option> | |
<option value="8">8th</option> | |
<option value="9">9th</option> | |
<option value="10">10th</option> | |
<option value="11">11th</option> | |
<option value="12">12th</option> | |
<option value="13">13th</option> | |
<option value="14">14th</option> | |
<option value="15">15th</option> | |
<option value="16">16th</option> | |
<option value="17">17th</option> | |
<option value="18">18th</option> | |
<option value="19">19th</option> | |
<option value="20">20th</option> | |
<option value="21">21st</option> | |
<option value="22">22nd</option> | |
<option value="23">23rd</option> | |
<option value="24">24th</option> | |
<option value="25">25th</option> | |
<option value="26">26th</option> | |
<option value="27">27th</option> | |
<option value="28">28th</option> | |
</select> | |
</div> | |
<div class="formpadding2"> | |
<label for="note">Message that will be sent as the reminder</label> | |
<input type="text" name="note"/> | |
</div> | |
<div class="formpadding2"> | |
<label for="body">Details that will be sent in the reminder</label> | |
<textarea name="body"/> | |
</div> | |
<input type="submit" class="buttonbmdc" name="submit" value="Create Annual Reminder"/> | |
</form> | |
</section> | |
{% elseif action == "onceonly" %} | |
<section class="theme1"> | |
<h2 class="sectiontext">Create a one-time reminder</h2> | |
<form name="createonceonly2" action="{{aek.current_url}}"> | |
<div class="formpadding2"> | |
<input type="hidden" name="_action" value="createonetime2"/> | |
<label for="whichday">When do you want to be reminded?</label> | |
<input type="date" name="when"/> | |
</div> | |
<div class="formpadding2"> | |
<input type="time" name="time" value="09:00"> | |
</div> | |
<div class="formpadding2"> | |
<label for="note">Message that will be sent as the reminder</label> | |
<input type="text" name="note"/> | |
</div> | |
<div class="formpadding2"> | |
<label for="body">Details that will be sent in the reminder</label> | |
<textarea name="body"/> | |
</div> | |
<input type="submit" class="buttonbmdc" name="submit" value="Create one-time reminder"/> | |
</form> | |
</section> | |
{% endif %} | |
</article> | |
</div> | |
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% extends "master.html" %} | |
{% block init %}{{ aek.set_aek_version(1.4) }} | |
{% endblock %} | |
{% block title %}Reminders{% endblock %} | |
{% block main_content %} | |
{% set addons = aek.extension("AddonsWebServices") %} | |
<link rel="stylesheet" href="https://portal.ombiel.co.uk/assets/BradfordMDC/BradfordCouncil/css/bradford_mdc_aek.css" /> | |
<div> | |
<article> | |
<header class="theme1 schools" style="background-color: #792462;border-color: #792462;"> | |
<h1>Reminders</h1> | |
</header> | |
{{ aek.add_lib("aek-subpages") }} | |
{{ aek.add_lib("aek-icons") }} | |
{% set action = aek.request("_action") %} | |
{{ aek.remove_from_cache }} | |
{# Actions ... #} | |
{% if action == "delete" %} | |
{% set response = addons.call("deleteReminders", {"personId":aek.person_id,"password":"[[password]]","reminderIds":aek.request("reminderId") }) %} | |
{% set action = "" %} | |
<div class="buttonmdc deletedbtn">Deleted reminder "{{aek.request("message") }}"</div> | |
{% endif %} | |
{% if action == "createcouncil2" %} | |
{% if aek.request("month") == "10" %} | |
{% set monthcron = "1,4,5,6,7,8,9,10,11,12 ?" %} | |
{% else %} | |
{% set monthcron = "* ?" %} | |
{% endif %} | |
{% set daytoremindon = aek.request("whichday") %} | |
{% if daytoremindon <= 0 %} | |
{% set daytoremindon = daytoremindon + 28 %} | |
{% endif %} | |
{% set cronstring = "0 0 12 " ~ daytoremindon ~ " " ~ monthcron %} | |
{% set createResponse = addons.call("createReminder", {"personId":aek.person_id,"password":"[[password]]","crontab_pattern":cronstring,"message":"Council Tax reminder","body":"You asked to be reminded that your Council Tax is due."}) %} | |
{% set action = "" %} | |
{% if createResponse.desc != "Successful" %} | |
<div class="errbtn">Failed to create alert "Council Tax reminder" -- {{ createResponse.detail.returnStatus.desc }}</div> | |
{% else %} | |
<div class="createdbtn">Created alert "Council Tax reminder"</div> | |
{% endif %} | |
{% endif %} | |
{% if action == "createbusrates2" %} | |
{% if aek.request("month") == "10" %} | |
{% set monthcron = "1,4,5,6,7,8,9,10,11,12 ?" %} | |
{% else %} | |
{% set monthcron = "* ?" %} | |
{% endif %} | |
{% set daytoremindon = aek.request("whichday") %} | |
{% if daytoremindon <= 0 %} | |
{% set daytoremindon = daytoremindon + 28 %} | |
{% endif %} | |
{% set todaystring = "{#TODAY#}" %} | |
{% set cronstring = "0 0 12 " ~ daytoremindon ~ " " ~ monthcron %} | |
{% set createResponse = addons.call("createReminder", {"personId":aek.person_id,"password":"[[password]]","crontab_pattern":cronstring,"message":"Business rates reminder -- " ~ aek.request("note"),"body":"You asked us to remind you about your business rates " ~ aek.request("note")}) %} | |
{% set action = "" %} | |
{% if createResponse.desc != "Successful" %} | |
<div class="errbtn">Failed to create alert "Business Rates reminder" -- {{ createResponse.detail.returnStatus.desc }}</div> | |
{% else %} | |
<div class="createdbtn">Created alert "Business Rates reminder"</div> | |
{% endif %} | |
{% endif %} | |
{% if action == "createmonthly2" %} | |
{% set monthcron = "* ?" %} | |
{% set daytoremindon = aek.request("whichday") %} | |
{% set todaystring = "{#TODAY#}" %} | |
{% set cronstring = "0 0 12 " ~ daytoremindon ~ " " ~ monthcron %} | |
{% set createResponse = addons.call("createReminder", {"personId":aek.person_id,"password":"[[password]]","crontab_pattern":cronstring,"message":"Reminder -- " ~ aek.request("note"),"body":aek.request("body")}) %} | |
{% set action = "" %} | |
{% if createResponse.desc != "Successful" %} | |
<div class="errbtn">Failed to create alert {{ aek.request("note") }} -- {{ createResponse.detail.returnStatus.desc }}</div> | |
{% else %} | |
<div class="createdbtn">Created alert {{ aek.request("note") }}</div> | |
{% endif %} | |
{% endif %} | |
{% if action == "createannual2" %} | |
{% set monthcron = aek.request("whichmonth") ~ " ?" %} | |
{% set daytoremindon = aek.request("whichday") %} | |
{% set cronstring = "0 0 12 " ~ daytoremindon ~ " " ~ monthcron %} | |
{% set createResponse = addons.call("createReminder", {"personId":aek.person_id,"password":"[[password]]","crontab_pattern":cronstring,"message":"Reminder -- " ~ aek.request("note"),"body":aek.request("body")}) %} | |
{% set action = "" %} | |
{% if createResponse.desc != "Successful" %} | |
<div class="errbtn">Failed to create alert {{ aek.request("note") }} -- {{ createResponse.detail.returnStatus.desc }}</div> | |
{% else %} | |
<div class="createdbtn">Created alert {{ aek.request("note") }}</div> | |
{% endif %} | |
{% endif %} | |
{% if action == "createonetime2" %} | |
{% if aek.request("usewhen") == "true" %} | |
{% set once_only = aek.request("when") ~ "T" ~ aek.request("time") ~ ":00.000" ~ aek.request("when")|format_date("P") %} | |
{% set phpdate = once_only %} | |
{% else %} | |
{% set once_only = aek.request("year") ~ "-" ~ aek.request("month") ~ "-" ~ aek.request("day") ~ "T" ~ aek.request("hh") ~ ":" ~ aek.request("mm") ~ ":00.000" ~ aek.request("when")|format_date("P") %} | |
{% set phpdate = once_only %} | |
{% endif %} | |
{% if aek.request("howlongbefore") %} | |
{% set whattoadd = aek.request("howlongbefore") ~ " days" %} | |
{% set once_only = phpdate|date_sub(whattoadd, 'Y-m-d\\TH:i:s.uP') %} | |
{% endif %} | |
{% set createResponse = addons.call("createReminder", {"personId":aek.person_id,"password":"[[password]]","once_only":once_only,"message":aek.request("body"),"body":aek.request("note")}) %} | |
{% set action = "" %} | |
{% if createResponse.desc != "Successful" %} | |
<div class="errbtn">Failed to create alert {{ aek.request("note") }} -- {{ createResponse.detail.returnStatus.desc }}</div> | |
{% else %} | |
<div class="createdbtn">Created alert {{ aek.request("note") }} -- {{ createResponse.desc }}</div> | |
{% endif %} | |
{% endif %} | |
{# Show reminders list ... #} | |
{% if not action or action == "" %} | |
<section class="theme1"> | |
<p class="introtext">This page allows you to set up reminders for various things - you'll receive a push notification via the app</p> | |
<form name="createme" action="{{aek.current_url}}"> | |
<input type="hidden" name="_action" value="create"/> | |
<input type="submit" class="buttonbmdc" name="submit" value="Create new reminder" style="border-color: #792462; background-color: #792462;"/> | |
</form> | |
</section> | |
{% set response = addons.call("viewReminders", {"personId":aek.person_id,"password":"[[password]]" }) %} | |
{% if response.reminders.reminder %} | |
<section class="theme1 currentreminders"> | |
<h2 class="theme1">Your current reminders</h2> | |
<ul class="listview"> | |
{% endif %} | |
{% for reminder in response.reminders.reminder %} | |
<li> | |
{% if reminder.once_only %} | |
<span class="reminderTitle"><b>Once only - on {{ reminder.once_only|format_date("d/m/y H:i") }}</b></span> | |
{% else %} | |
<span class="reminderTitle"><b>Repeating - {{ reminder.crontab_description }}</b></span> | |
{% endif %} | |
<i>{{reminder.message}}</i> | |
<div data-role="subpage" id="stuff"> | |
<section class="theme1"> | |
<p>This is a reminder that's due to be sent to you via the app:</p> | |
{% if reminder.once_only %} | |
<b>Once only - On {{ reminder.once_only|format_date("d/m/y H:i") }} (Once only)</b> | |
{% else %} | |
<b>Repeating - {{ reminder.crontab_description }}</b> | |
{% endif %} | |
<p><i>{{reminder.message}}</i></p> | |
<p>{{ reminder.body }}</p> | |
<form name="deleteme" action="{{aek.current_url}}"> | |
<input type="hidden" name="_action" value="delete"/> | |
<input type="hidden" name="message" value="{{reminder.message}}"/> | |
<input type="hidden" name="reminderId" value="{{reminder.reminderId}}"/> | |
<input type="submit" class="buttonbmdc" name="submit" value="Delete Reminder" style="border-color: #792462; background-color: #792462;"/> | |
</form> | |
</section> | |
</div> | |
</li> | |
{% endfor %} | |
{% if response.reminders.reminder %} | |
</ul> | |
</section> | |
{% endif %} | |
{# Creation forms... #} | |
{% elseif action == "create" %} | |
<section class="theme1"> | |
<h2 class="sectiontext">What do you want to be reminded of?</h2> | |
<form name="createonceonly" action="{{aek.current_url}}" class="formpadding"> | |
<input type="hidden" name="_action" value="onceonly"/> | |
<input type="hidden" name="onceonlysectiontext" value="Create a reminder for the LAC Review"/> | |
<input type="hidden" name="message" value="This is a reminder about your LAC Review"/> | |
<input type="hidden" name="body" value="This is a reminder about your LAC Review. Please visit the <a href='https://www.vptol.co.uk'> | |
Viewpoint website.</a>"/> | |
<input type="hidden" name="daysbefore" value="10"/> | |
<input type="submit" class="buttonbmdc" name="submit" value="LAC Review" style="border-color: #792462; background-color: #792462;"/> | |
</form> | |
<form name="createonceonly" action="{{aek.current_url}}" class="formpadding"> | |
<input type="hidden" name="_action" value="onceonly"/> | |
<input type="hidden" name="onceonlysectiontext" value="Create a reminder for your PEP Meeting"/> | |
<input type="hidden" name="message" value="This is a reminder about your PEP Meeting"/> | |
<input type="hidden" name="body" value="This is a reminder about your PEP Meeting"/> | |
<input type="hidden" name="daysbefore" value="10"/> | |
<input type="submit" class="buttonbmdc" name="submit" value="PEP Meeting" style="border-color: #792462; background-color: #792462;"/> | |
</form> | |
<form name="createonceonly" action="{{aek.current_url}}" class="formpadding"> | |
<input type="hidden" name="_action" value="onceonly"/> | |
<input type="hidden" name="onceonlysectiontext" value="Create a reminder for your Health Review"/> | |
<input type="hidden" name="message" value="This is a reminder about your Health Review"/> | |
<input type="hidden" name="body" value="This is a reminder about your Health Review"/> | |
<input type="hidden" name="daysbefore" value="1"/> | |
<input type="submit" class="buttonbmdc" name="submit" value="Health Review" style="border-color: #792462; background-color: #792462;"/> | |
</form> | |
<form name="createonceonly" action="{{aek.current_url}}" class="formpadding"> | |
<input type="hidden" name="_action" value="onceonly"/> | |
<input type="hidden" name="onceonlysectiontext" value="Create a reminder for your Social Work appointment"/> | |
<input type="hidden" name="message" value="This is a reminder about your Social Work appointment"/> | |
<input type="hidden" name="body" value="This is a reminder about your Social Work appointment"/> | |
<input type="hidden" name="daysbefore" value="1"/> | |
<input type="submit" class="buttonbmdc" name="submit" value="Social Work appointment" style="border-color: #792462; background-color: #792462;"/> | |
</form> | |
<form name="createonceonly" action="{{aek.current_url}}" class="formpadding"> | |
<input type="hidden" name="_action" value="onceonly"/> | |
<input type="hidden" name="onceonlysectiontext" value="Create a reminder for your Dentist appointment"/> | |
<input type="hidden" name="message" value="This is a reminder about your Dentist appointment"/> | |
<input type="hidden" name="body" value="This is a reminder about your Dentist appointment"/> | |
<input type="hidden" name="daysbefore" value="1"/> | |
<input type="submit" class="buttonbmdc" name="submit" value="Dentist appointment" style="border-color: #792462; background-color: #792462;"/> | |
</form> | |
<form name="createonceonly" action="{{aek.current_url}}" class="formpadding"> | |
<input type="hidden" name="_action" value="onceonly"/> | |
<input type="hidden" name="onceonlysectiontext" value="Create a reminder"/> | |
<input type="hidden" name="daysbefore" value="1"/> | |
<input type="submit" class="buttonbmdc" name="submit" value="Other" style="border-color: #792462; background-color: #792462;"/> | |
</form> | |
</section> | |
{% elseif action == "createcouncil" %} | |
<section class="theme1"> | |
<h2 class="sectiontext">Create a Council Tax reminder</h2> | |
<form name="createcouncil2" action="{{aek.current_url}}"> | |
<div class="formpadding2"> | |
<input type="hidden" name="_action" value="createcouncil2"/> | |
<label for="month">Do you pay your Council Tax over 10 months or 12 months a year?</label> | |
<select name="month"> | |
<option value="10">10 months</option> | |
<option value="12">12 months</option> | |
</select> | |
</div> | |
<div class="formpadding2"> | |
<label for="whichday">Which day of the month do you want to be reminded?</label> | |
<select name="whichday"> | |
<option value="1">1st</option> | |
<option value="2">2nd</option> | |
<option value="3">3rd</option> | |
<option value="4">4th</option> | |
<option value="5">5th</option> | |
<option value="6">6th</option> | |
<option value="7">7th</option> | |
<option value="8">8th</option> | |
<option value="9">9th</option> | |
<option value="10">10th</option> | |
<option value="11">11th</option> | |
<option value="12">12th</option> | |
<option value="13">13th</option> | |
<option value="14">14th</option> | |
<option value="15">15th</option> | |
<option value="16">16th</option> | |
<option value="17">17th</option> | |
<option value="18">18th</option> | |
<option value="19">19th</option> | |
<option value="20">20th</option> | |
<option value="21">21st</option> | |
<option value="22">22nd</option> | |
<option value="23">23rd</option> | |
<option value="24">24th</option> | |
<option value="25">25th</option> | |
<option value="26">26th</option> | |
<option value="27">27th</option> | |
<option value="28">28th</option> | |
</select> | |
</div> | |
<input type="submit" class="buttonbmdc" name="submit" value="Create Council Tax Reminder"/> | |
</form> | |
</section> | |
{% elseif action == "createbusrates" %} | |
<section class="theme1"> | |
<h2 class="sectiontext">Create a business rates reminder</h2> | |
<form name="createbusrates2" action="{{aek.current_url}}"> | |
<div class="formpadding2"> | |
<input type="hidden" name="_action" value="createbusrates2"/> | |
<label for="month">Do you pay your Business Rates over 10 months or 12 months a year?</label> | |
<select name="month"> | |
<option value="10">10 months</option> | |
<option value="12">12 months</option> | |
</select> | |
</div> | |
<div class="formpadding2"> | |
<label for="whichday">Which day of the month do you want to be reminded?</label> | |
<select name="whichday"> | |
<option value="1">1st</option> | |
<option value="2">2nd</option> | |
<option value="3">3rd</option> | |
<option value="4">4th</option> | |
<option value="5">5th</option> | |
<option value="6">6th</option> | |
<option value="7">7th</option> | |
<option value="8">8th</option> | |
<option value="9">9th</option> | |
<option value="10">10th</option> | |
<option value="11">11th</option> | |
<option value="12">12th</option> | |
<option value="13">13th</option> | |
<option value="14">14th</option> | |
<option value="15">15th</option> | |
<option value="16">16th</option> | |
<option value="17">17th</option> | |
<option value="18">18th</option> | |
<option value="19">19th</option> | |
<option value="20">20th</option> | |
<option value="21">21st</option> | |
<option value="22">22nd</option> | |
<option value="23">23rd</option> | |
<option value="24">24th</option> | |
<option value="25">25th</option> | |
<option value="26">26th</option> | |
<option value="27">27th</option> | |
<option value="28">28th</option> | |
</select> | |
</div> | |
<div class="formpadding2"> | |
<label for="note">Any other details (will be included in the reminder)</label> | |
<input type="text" name="note"/> | |
</div> | |
<input type="submit" class="buttonbmdc" name="submit" value="Create Business Rates Reminder"/> | |
</form> | |
</section> | |
{% elseif action == "createmonthly" %} | |
<section class="theme1"> | |
<h2 class="sectiontext">Create a monthly reminder</h2> | |
<form name="createmonthly2" action="{{aek.current_url}}"> | |
<div class="formpadding2"> | |
<input type="hidden" name="_action" value="createmonthly2"/> | |
<label for="whichday">Which day of the month do you want to be reminded?</label> | |
<select name="whichday"> | |
<option value="1">1st</option> | |
<option value="2">2nd</option> | |
<option value="3">3rd</option> | |
<option value="4">4th</option> | |
<option value="5">5th</option> | |
<option value="6">6th</option> | |
<option value="7">7th</option> | |
<option value="8">8th</option> | |
<option value="9">9th</option> | |
<option value="10">10th</option> | |
<option value="11">11th</option> | |
<option value="12">12th</option> | |
<option value="13">13th</option> | |
<option value="14">14th</option> | |
<option value="15">15th</option> | |
<option value="16">16th</option> | |
<option value="17">17th</option> | |
<option value="18">18th</option> | |
<option value="19">19th</option> | |
<option value="20">20th</option> | |
<option value="21">21st</option> | |
<option value="22">22nd</option> | |
<option value="23">23rd</option> | |
<option value="24">24th</option> | |
<option value="25">25th</option> | |
<option value="26">26th</option> | |
<option value="27">27th</option> | |
<option value="28">28th</option> | |
</select> | |
</div> | |
<div class="formpadding2"> | |
<label for="note">Message that will be sent as the reminder</label> | |
<input type="text" name="note"/> | |
</div> | |
<div class="formpadding2"> | |
<label for="body">Details that will be sent in the reminder</label> | |
<textarea name="body"/> | |
</div> | |
<input type="submit" class="buttonbmdc" name="submit" value="Create Monthly Reminder"/> | |
</form> | |
</section> | |
{% elseif action == "createannual" %} | |
<section class="theme1"> | |
<h2 class="sectiontext">Create an annual reminder</h2> | |
<form name="createannual2" action="{{aek.current_url}}"> | |
<div class="formpadding2"> | |
<input type="hidden" name="_action" value="createannual2"/> | |
<label for="whichmonth">Which month do you want to be reminded?</label> | |
<select name="whichmonth"> | |
<option value="1">January</option> | |
<option value="2">February</option> | |
<option value="3">March</option> | |
<option value="4">April</option> | |
<option value="5">May</option> | |
<option value="6">June</option> | |
<option value="7">July</option> | |
<option value="8">August</option> | |
<option value="9">September</option> | |
<option value="10">October</option> | |
<option value="11">November</option> | |
<option value="12">December</option> | |
</select> | |
</div> | |
<div class="formpadding2"> | |
<label for="whichday">Which day of the month do you want to be reminded?</label> | |
<select name="whichday"> | |
<option value="1">1st</option> | |
<option value="2">2nd</option> | |
<option value="3">3rd</option> | |
<option value="4">4th</option> | |
<option value="5">5th</option> | |
<option value="6">6th</option> | |
<option value="7">7th</option> | |
<option value="8">8th</option> | |
<option value="9">9th</option> | |
<option value="10">10th</option> | |
<option value="11">11th</option> | |
<option value="12">12th</option> | |
<option value="13">13th</option> | |
<option value="14">14th</option> | |
<option value="15">15th</option> | |
<option value="16">16th</option> | |
<option value="17">17th</option> | |
<option value="18">18th</option> | |
<option value="19">19th</option> | |
<option value="20">20th</option> | |
<option value="21">21st</option> | |
<option value="22">22nd</option> | |
<option value="23">23rd</option> | |
<option value="24">24th</option> | |
<option value="25">25th</option> | |
<option value="26">26th</option> | |
<option value="27">27th</option> | |
<option value="28">28th</option> | |
</select> | |
</div> | |
<div class="formpadding2"> | |
<label for="note">Message that will be sent as the reminder</label> | |
<input type="text" name="note"/> | |
</div> | |
<div class="formpadding2"> | |
<label for="body">Details that will be sent in the reminder</label> | |
<textarea name="body"/> | |
</div> | |
<input type="submit" class="buttonbmdc" name="submit" value="Create Annual Reminder"/> | |
</form> | |
</section> | |
{% elseif action == "onceonly" %} | |
<section class="theme1"> | |
<h2 class="sectiontext">{{ aek.request("onceonlysectiontext") }}</h2> | |
<form name="createonceonly2" action="{{aek.current_url}}"> | |
<div class="formpadding2"> | |
<input type="hidden" name="_action" value="createonetime2"/> | |
{% if aek.request("onceonlysectiontext") == "Create a reminder for the LAC Review" %} | |
<center><a href="https://www.vptol.co.uk">Viewpoint website</a></center><br/> | |
{% endif %} | |
<label for="whichday">When is the appointment? (This is the time that the alert will be sent to you)</label> | |
<input type="hidden" name="usewhen" id="usewhen" value="true"/> | |
<input type="date" name="when" id="when"/> | |
<select style="width: 20%; display:inline;" name="day" id="day" > | |
<option value="01" selected>01</option> | |
<option value="02">02</option> | |
<option value="03">03</option> | |
<option value="04">04</option> | |
<option value="05">05</option> | |
<option value="06">06</option> | |
<option value="07">07</option> | |
<option value="08">08</option> | |
<option value="09">09</option> | |
<option value="10">10</option> | |
<option value="11">11</option> | |
<option value="12">12</option> | |
<option value="13">13</option> | |
<option value="14">14</option> | |
<option value="15">15</option> | |
<option value="16">16</option> | |
<option value="17">17</option> | |
<option value="18">18</option> | |
<option value="19">19</option> | |
<option value="20">20</option> | |
<option value="21">21</option> | |
<option value="22">22</option> | |
<option value="23">23</option> | |
<option value="24">24</option> | |
<option value="25">25</option> | |
<option value="26">26</option> | |
<option value="27">27</option> | |
<option value="28">28</option> | |
<option value="29">29</option> | |
<option value="30">30</option> | |
<option value="31">31</option> | |
</select> | |
<span id="hideme">/</span> | |
<select name="month" id="month" style="width:20%;display:inline;"> | |
<option value="01" selected>January</option> | |
<option value="02">Feburary</option> | |
<option value="03">March</option> | |
<option value="04">April</option> | |
<option value="05">May</option> | |
<option value="06">June</option> | |
<option value="07">July</option> | |
<option value="08">August</option> | |
<option value="09">September</option> | |
<option value="10">October</option> | |
<option value="11">November</option> | |
<option value="12">December</option> | |
</select> | |
<span id="hideme2">/</span> | |
<select name="year" style="width:20%;display:inline;" id="year"> | |
<option value="2015" selected>2015</option> | |
<option value="2016">2016</option> | |
<option value="2017">2017</option> | |
</select> | |
</div> | |
<input type="time" name="time" id="time" value="09:00"> | |
<div class="formpadding2"> | |
<select name="hh" id="hh" style="width:20%;display:inline;"> | |
<option value="07">07</option> | |
<option value="08">08</option> | |
<option value="09" selected>09</option> | |
<option value="10">10</option> | |
<option value="11">11</option> | |
<option value="12">12</option> | |
<option value="13">13</option> | |
<option value="14">14</option> | |
<option value="15">15</option> | |
<option value="16">16</option> | |
<option value="17">17</option> | |
<option value="18">18</option> | |
<option value="19">19</option> | |
<option value="20">20</option> | |
<option value="21">21</option> | |
<option value="22">22</option> | |
</select> | |
<select name="mm" id="mm" style="width:20%;display:inline;"> | |
<option value="00" selected>00</option> | |
<option value="10">10</option> | |
<option value="20">20</option> | |
<option value="30">30</option> | |
<option value="40">40</option> | |
<option value="50">50</option> | |
</select> | |
</div> | |
<div class="formpadding2"> | |
<label for="howlongbefore">How many days before do you want to be reminded?</label> | |
<select name="howlongbefore" id="howlongbefore"> | |
<option value="0">On the day</option> | |
{% for i in 1..10 %} | |
{% if i == aek.request("daysbefore") %} | |
<option value="{{i}}" selected>{{i}}</option> | |
{% else %} | |
<option value="{{i}}">{{i}}</option> | |
{% endif %} | |
{% endfor %} | |
Days before. | |
</select> | |
</div> | |
<div class="formpadding2"> | |
<label for="note">Message that will be sent as the reminder</label> | |
<input type="text" name="note" value="{{ aek.request("message") }}"/> | |
</div> | |
<div class="formpadding2"> | |
<label for="body">Details that will be sent in the reminder</label> | |
<textarea name="body">{{ aek.request("body") }}</textarea> | |
</div> | |
<input type="submit" class="buttonbmdc" name="submit" value="Create one-time reminder" style="border-color: #792462; background-color: #792462;"/> | |
</form> | |
</section> | |
<script> | |
{% if aek.is_native %} | |
document.getElementById('hh').style.visibility = "hidden"; | |
document.getElementById('mm').style.visibility = "hidden"; | |
document.getElementById('day').style.visibility = "hidden"; | |
document.getElementById('month').style.visibility = "hidden"; | |
document.getElementById('year').style.visibility = "hidden"; | |
document.getElementById('hideme').style.visibility = "hidden"; | |
document.getElementById('hideme2').style.visibility = "hidden"; | |
document.getElementById('usewhen').value = "true"; | |
{% else %} | |
document.getElementById('when').style.visibility = "hidden"; | |
document.getElementById('time').style.visibility = "hidden"; | |
document.getElementById('usewhen').value = "false"; | |
{% endif %} | |
</script> | |
{% endif %} | |
</article> | |
</div> | |
{% endblock %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment