Skip to content

Commit

Permalink
Merge pull request #2870 from Leantime/my-timesheet-fix
Browse files Browse the repository at this point in the history
My timesheet fixes
  • Loading branch information
marcelfolaron authored Jan 3, 2025
2 parents 64d7bdc + c66b75c commit ce2e86a
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 54 deletions.
7 changes: 4 additions & 3 deletions app/Domain/Timesheets/Js/timesheetsController.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export const initTimesheetsTable = function (groupBy) {
};

// Make public what you want to have public, everything else is private
export default {
initTimesheetsTable: initTimesheetsTable,
};

export const timesheetsController = {
initTimesheetsTable: initTimesheetsTable
}
55 changes: 30 additions & 25 deletions app/Domain/Timesheets/Templates/showMy.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,28 +93,6 @@
jQuery(this).find('td a').removeClass('ui-state-hover');
});
jQuery(".project-select").chosen();
jQuery(".ticket-select").chosen();
jQuery(".project-select").change(function(){
jQuery(".ticket-select").removeAttr("selected");
jQuery(".ticket-select").val("");
jQuery(".ticket-select").trigger("liszt:updated");
jQuery(".ticket-select option").show();
jQuery("#ticketSelect .chosen-results li").show();
var selectedValue = jQuery(this).find("option:selected").val();
jQuery(".ticket-select option").not(".project_"+selectedValue).hide();
jQuery("#ticketSelect .chosen-results li").not(".project_"+selectedValue).hide();
jQuery(".ticket-select").chosen("destroy").chosen();
});
jQuery(".ticket-select").change(function() {
var selectedValue = jQuery(this).find("option:selected").attr("data-value");
jQuery(".project-select option[value="+selectedValue+"]").attr("selected", "selected");
jQuery(".project-select").trigger("liszt:updated");
jQuery(".ticket-select").chosen("destroy").chosen();
});
jQuery("#nextWeek").click(function() {
var date = jQuery("#endDate").datepicker('getDate');
var endDate = new Date(date.getFullYear(), date.getMonth(), date.getDate() + 7);
Expand All @@ -140,6 +118,28 @@
jQuery("#timesheetList").submit();
});
// jQuery(".project-select").chosen();
// jQuery(".ticket-select").chosen();
// jQuery(".project-select").change(function(){
// jQuery(".ticket-select").removeAttr("selected");
// jQuery(".ticket-select").val("");
// jQuery(".ticket-select").trigger("liszt:updated");
// jQuery(".ticket-select option").show();
// jQuery("#ticketSelect .chosen-results li").show();
// var selectedValue = jQuery(this).find("option:selected").val();
// jQuery(".ticket-select option").not(".project_"+selectedValue).hide();
// jQuery("#ticketSelect .chosen-results li").not(".project_"+selectedValue).hide();
// jQuery(".ticket-select").chosen("destroy").chosen();
// });
// jQuery(".ticket-select").change(function() {
// var selectedValue = jQuery(this).find("option:selected").attr("data-value");
// jQuery(".project-select option[value="+selectedValue+"]").attr("selected", "selected");
// jQuery(".project-select").trigger("liszt:updated");
// jQuery(".ticket-select").chosen("destroy").chosen();
// });
jQuery(".timesheetTable input").change(function(){
//Row Sum
let colSum1 = 0;
Expand Down Expand Up @@ -219,13 +219,14 @@
</x-global::actions.dropdown>

</div>
<div class="pull-left" style="padding-left:5px; margin-top:-3px;">
<div class="pull-left mb-2" style="padding-left:5px; margin-top:-3px;">

<div class="padding-top-sm">
<span><?php echo $tpl->__('label.week_from')?></span>
<a href="javascript:void(0)" style="font-size:16px;" id="prevWeek"><i class="fa fa-chevron-left"></i></a>
<input type="text" class="week-picker" name="startDate" autocomplete="off" id="startDate" placeholder="<?php echo $tpl->__('language.dateformat')?>" value="<?php echo $dateFrom->formatDateForUser() ?>" style="margin-top:5px;"/>
{{ __("label.until") }}
{{-- {{ __("label.until") }} --}}
<span class="pr-1">{{ __("label.until") }}</span>
<input type="text" class="week-picker" name="endDate" autocomplete="off" id="endDate" placeholder="<?php echo $tpl->__('language.dateformat')?>" value="<?php echo $dateFrom->addDays(6)->formatDateForUser() ?>" style="margin-top:6px;"/>
<a href="javascript:void(0)" style="font-size:16px;" id="nextWeek"><i class="fa fa-chevron-right"></i></a>
<input type="hidden" name="search" value="1" />
Expand Down Expand Up @@ -389,7 +390,11 @@ class="project_{{ $ticketRow['projectId'] }}"
</div>
</td>
<td width="14%">
<x-global::forms.select name="kindId">
<x-global::forms.select
data-placeholder="Choose type"
name="kindId"
>
<x-global::forms.select.select-option value=""></x-global::forms.select.select-option>
@foreach ($tpl->get('kind') as $key => $kindRow)
<x-global::forms.select.select-option :value="$key">
{!! __($kindRow) !!}
Expand Down
60 changes: 37 additions & 23 deletions app/Domain/Timesheets/Templates/showMyList.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,31 +26,37 @@

<form action="<?php echo BASE_URL ?>/timesheets/showMyList" method="post" id="form" name="form">

<div class="relative">
<div class="pull-left">
<x-global::actions.dropdown variant="card" content-role="ghost" cardLabel="Filter Options">
<x-slot:labelText>
{!! __("links.filter") !!} (1)
</x-slot:labelText>

<x-slot:cardContent>
<div class="filterBoxLeft">
<label for="dateFrom">{{ __("label.date_from") }} {{ __("label.date_to") }}</label>
<input type="text"
id="dateFrom"
class="dateFrom"
name="dateFrom"
value="<?php echo $tpl->get('dateFrom')->formatDateForUser(); ?>"
style="margin-bottom:10px; width:90px; float:left; margin-right:10px"/>
<input type="text"
id="dateTo"
class="dateTo"
name="dateTo"
value="<?php echo $tpl->get('dateTo')->formatDateForUser(); ?>"
style="margin-bottom:10px; width:90px" />
<x-global::forms.text-input
type="text"
name="dateFrom"
id="dateFrom"
class="dateFrom"
labelText="Date from"
value="<?php echo $tpl->get('dateFrom')->formatDateForUser(); ?>"
variant="fullWidth"
/>

<x-global::forms.text-input
type="text"
name="dateTo"
id="dateTo"
class="dateTo"
labelText="Date to"
value="<?php echo $tpl->get('dateTo')->formatDateForUser(); ?>"
variant="fullWidth"
/>
</div>

<div>
<x-global::forms.select id="kind" name="kind" onchange="submit();">
<x-global::forms.select id="kind" name="kind" labelText="Type" >
<x-global::forms.select.select-option value="all">
{!! __("label.all_types") !!}
</x-global::forms.select.select-option>
Expand All @@ -65,20 +71,19 @@ class="dateTo"
</div>

<div>
<label>&nbsp;</label>
<x-global::forms.button type="submit" class="reload">
<x-global::forms.button type="submit" class="reload" contentRole="primary">
{{ __('buttons.search') }}
</x-global::forms.button>
</div>

<div class="clearall"></div>
</x-slot:cardContents>
</x-slot:cardContent>
</x-global::actions.dropdown>

</div>
<div class="pull-right">
<div class="btn-group">
<x-global::actions.dropdown content-role="ghost">
<x-global::actions.dropdown content-role="ghost" align="end">
<x-slot:label-text>
{!! __('links.list_view') !!} {!! __('links.view') !!}
</x-slot:label-text>
Expand Down Expand Up @@ -215,15 +220,24 @@ class="dateTo"
</tr>
</tfoot>
</table>
@php
$tpl->dispatchTplEvent('filters.beforeBar');
$tpl->dispatchTplEvent('filters.beforeFormClose');
@endphp

</form>
</div>
</div>

<script type="text/javascript">
<script type="module">
import "@mix('/js/Domain/Timesheets/Js/timesheetsController.js')"
import "@mix('/js/components/datePickers.module.js')"
jQuery(document).ready(function(){
leantime.timesheetsController.initTimesheetsTable();
leantime.timesheetsController.initEditTimeModal();
leantime.dateController.initDateRangePicker(".dateFrom", ".dateTo", 1);
timesheetsController.initTimesheetsTable();
// timesheetsController.initEditTimeModal();
datePickers.initDateRangePicker(".dateFrom", ".dateTo", 1);
});
</script>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
};
$cardClassBase = 'dropdown-content rounded-element bg-base-100 p-2 shadow w-fit z-50';
// Determine the menu class based on the variant
$cardClass = match ($variant) {
'card' => 'card card-compact ' . $cardClassBase, // Card variant class
Expand Down Expand Up @@ -71,9 +72,9 @@
@if ($variant === 'card')
<!-- Card Body for Card Variant -->
<div tabindex="0" class="{{ $cardClass }}">
<div class="card-body p-1">
@if ($cardLabel)
<h3 class="card-title">{{ $cardLabel }}</h3>
<div class="card-body">
@if($cardLabel)
<h2 class="card-title">{{ $cardLabel }}</h2>
@endif

{!! $cardContent ?? '' !!}
Expand Down
1 change: 1 addition & 0 deletions public/assets/css/components/overwrites.css
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ div.tagsinput span.tag, .chosen-container .chosen-results .highlighted

.week-picker {
width:100px;
background-color: transparent;
}

.timesheetTable select {
Expand Down

0 comments on commit ce2e86a

Please sign in to comment.