Kimai time management system (PHP 5.6 / MySQL) with custom extensions: - Budget tracking (ki_budget) - Change request form (ki_changerequest) - Invoice generation (ki_invoice) - Expense tracking (ki_expenses) - Flexi time (ki_flexitime) - Export, admin panel, timesheets, tasks, summary Database: ~900K time entries, 2,000+ users, 439 projects. Config: includes/autoconf.php — localhost/kimai/kimai
180 lines
6.9 KiB
Smarty
180 lines
6.9 KiB
Smarty
{literal}
|
|
<script type="text/javascript">
|
|
|
|
$(document).ready(function() {
|
|
$('#help').hide();
|
|
|
|
var availableEndDay = 9;
|
|
var availableStartDay = 9;
|
|
|
|
|
|
var tpl_template = {/literal}{$tpl_template|@json_encode}{literal};
|
|
var tpl_jasper_url = tpl_template[0].tpl_jasper_url;
|
|
var tpl_jasper_usr = tpl_template[0].tpl_jasper_usr;
|
|
var tpl_jasper_pwd = tpl_template[0].tpl_jasper_pwd;
|
|
availableEndDay = tpl_template[0].tpl_start_weekday;
|
|
availableStartDay = tpl_template[0].tpl_end_weekday;
|
|
|
|
|
|
function disableEndDays(date) {
|
|
var day = date.getDay();
|
|
if(availableEndDay < 7){
|
|
var str1 = "beforeShowDay: ";
|
|
return [(day == availableEndDay), ""];
|
|
}else{
|
|
return [(day == 0 ||day == 1 || day == 2 ||day == 3 || day == 4 ||day == 5 || day == 6), ""];
|
|
}
|
|
}
|
|
|
|
function disableStartDays(date) {
|
|
var day = date.getDay();
|
|
if(availableStartDay < 7){
|
|
var str1 = "beforeShowDay: ";
|
|
return [(day == availableStartDay), ""];
|
|
}else{
|
|
return [(day == 0 ||day == 1 || day == 2 ||day == 3 || day == 4 ||day == 5 || day == 6), ""];
|
|
}
|
|
}
|
|
|
|
$('#tpl_ID').change(function(){
|
|
var x = document.getElementById("tpl_ID").selectedIndex;
|
|
tpl_template = {/literal}{$tpl_template|@json_encode}{literal};
|
|
for (var i = 0; i < tpl_template.length; i++){
|
|
// look for the entry with a matching `code` value
|
|
if (tpl_template[i].tpl_index == x){
|
|
// we found it
|
|
tpl_jasper_url = tpl_template[i].tpl_jasper_url;
|
|
tpl_jasper_usr = tpl_template[i].tpl_jasper_usr;
|
|
tpl_jasper_pwd = tpl_template[i].tpl_jasper_pwd;
|
|
availableEndDay = tpl_template[i].tpl_start_weekday;
|
|
availableStartDay = tpl_template[i].tpl_end_weekday;
|
|
}
|
|
}
|
|
//availableEndDay = tpl_end_weekday; // disable wednesdays
|
|
$("#select_in_day").datepicker("refresh");
|
|
});
|
|
|
|
$('#tpl_view_btn').click(function(){
|
|
var user_id = "{/literal}{$kga.usr.usr_ID}{literal}";
|
|
var fromdate = $('#select_in_day').val();
|
|
var todate = $('#select_out_day').val();
|
|
var jasper_server_base_url = "{/literal}{$kga.lang.jasper_server_base_url}{literal}";
|
|
if (fromdate != '' && todate != ''){
|
|
var urlstring = 'https://tms.alteram.co.za/digital.php'.concat("?from_date=", fromdate, "&to_date=", todate, "&kimaiuserid=", user_id, "&reportid=", tpl_jasper_url);
|
|
//var urlstring = jasper_server_base_url.concat(tpl_jasper_url,".html?from_date=", fromdate, "&to_date=", todate, "&KimaiUserId=", user_id, "&j_username=", tpl_jasper_usr, "&j_password=", tpl_jasper_pwd);
|
|
window.open(urlstring);
|
|
}else{
|
|
window.alert("Please select date range!");
|
|
}
|
|
});
|
|
|
|
$('#tpl_download_btn').click(function(){
|
|
var user_id = "{/literal}{$kga.usr.usr_ID}{literal}";
|
|
var fromdate = $('#select_in_day').val();
|
|
var todate = $('#select_out_day').val();
|
|
var jasper_server_base_url = "{/literal}{$kga.lang.jasper_server_base_url}{literal}";
|
|
if (fromdate != '' && todate != ''){
|
|
var urlstring = 'https://tms.alteram.co.za/manual.php'.concat("?from_date=", fromdate, "&to_date=", todate, "&kimaiuserid=", user_id, "&reportid=", tpl_jasper_url);
|
|
// var urlstring = jasper_server_base_url.concat(tpl_jasper_url,".pdf?from_date=", fromdate, "&to_date=", todate, "&KimaiUserId=", user_id, "&j_username=", tpl_jasper_usr, "&j_password=", tpl_jasper_pwd);
|
|
window.open(urlstring);
|
|
}else{
|
|
window.alert("Please select date range!");
|
|
}
|
|
});
|
|
|
|
setupDatePicker()
|
|
|
|
function setupDatePicker(){
|
|
$('#select_in_day').datepicker({
|
|
dateFormat: 'yy-mm-dd',
|
|
closeText: 'Clear',
|
|
beforeShowDay: disableEndDays,
|
|
onSelect: function(dateText, instance) {
|
|
$('#select_out_day').datepicker( "option", $('#select_in_day').datepicker("getDate") );
|
|
}
|
|
});
|
|
$('#select_out_day').datepicker({
|
|
dateFormat: 'yy-mm-dd',
|
|
closeText: 'Clear',
|
|
beforeShowDay: disableStartDays,
|
|
onSelect: function(dateText, instance) {
|
|
$('#select_in_day').datepicker( "option", $('#select_out_day').datepicker("getDate") );
|
|
}
|
|
});
|
|
}
|
|
});
|
|
</script>
|
|
{/literal}
|
|
|
|
|
|
<div id="floater_innerwrap">
|
|
|
|
<div id="floater_handle">
|
|
<span id="floater_title">{if $id}{$kga.lang.edit}{else}{$kga.lang.printtimesheet}{/if}</span>
|
|
<div class="right">
|
|
<a href="#" class="close" onClick="floaterClose();">{$kga.lang.close}</a>
|
|
<a href="#" class="help" onClick="$(this).blur(); $('#help').slideToggle();">{$kga.lang.help}</a>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="help">
|
|
<div class="content">
|
|
{$kga.lang.dateAndTimeHelp}
|
|
</div>
|
|
</div>
|
|
|
|
<div class="menuBackground">
|
|
|
|
<ul class="menu tabSelection">
|
|
</ul>
|
|
</div>
|
|
|
|
<form id="mn_ext_form_add_edit_record" action="../extensions/ki_timesheets/processor.php" method="post">
|
|
<input name="id" type="hidden" value="{$id}" />
|
|
<input name="axAction" type="hidden" value="add_edit_record" />
|
|
|
|
|
|
<div id="floater_tabs" class="floater_content">
|
|
<fieldset id="general">
|
|
|
|
<ul>
|
|
<li>
|
|
<label for="tpl_ID" >{$kga.lang.tpl}:</label>
|
|
<select class="formfield" name="tpl_ID" id="tpl_ID">
|
|
{html_options values=$sel_tpl_IDs output=$sel_tpl_names}
|
|
</select>
|
|
</li>
|
|
|
|
{* -------------------------------------------------------------------- *}
|
|
|
|
<li>
|
|
<label for="select_in_day">{$kga.lang.fromdate}:</label>
|
|
<input id='select_in_day' type='text' name='select_in_day' value='{$select_in_day|escape:'html'}' maxlength='10' size='10' tabindex='5' autocomplete="off" onChange="mn_timeToDuration();" {if $kga.conf.autoselection}onClick="this.select();"{/if} />
|
|
</li>
|
|
<li>
|
|
<label for="select_out_day">{$kga.lang.todate}:</label>
|
|
<input id='select_out_day' type='text' name='select_out_day' value='{$select_out_day|escape:'html'}' maxlength='10' size='10' tabindex='6' autocomplete="off" onChange="mn_timeToDuration();" {if $kga.conf.autoselection}onClick="this.select();"{/if} />
|
|
</li>
|
|
|
|
</ul>
|
|
</fieldset>
|
|
{* -------------------------------------------------------------------- *}
|
|
|
|
{* -------------------------------------------------------------------- *}
|
|
</fieldset>
|
|
|
|
</div>
|
|
|
|
<div id="formbuttons">
|
|
<input class='btn_norm' type='button' value='{$kga.lang.cancel}' onClick='floaterClose(); return false;' />
|
|
<input class='btn_ok' id="tpl_view_btn" type='button' value='{$kga.lang.view}'/>
|
|
<input class='btn_ok' id="tpl_download_btn" type='button' value='{$kga.lang.download}'/>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{* -------------------------------------------------------------------- *}
|
|
|
|
</form>
|
|
|
|
</div> |