Skip to content

Commit

Permalink
fix hour (keyboard) timesheet input
Browse files Browse the repository at this point in the history
default to 8 hours days
  • Loading branch information
digitalfox committed Nov 21, 2024
1 parent 53acb2d commit 3f770e0
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
18 changes: 14 additions & 4 deletions media/css/pydici.css
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,20 @@ h5 { font-size:1rem; }
.tablesmall-form-row input:focus { border:0px; }

.tablesmall-form-row input.timesheet-keyboard {
margin: 0;
padding: 0;
width: 2.5em;
margin: 0px;
padding: 0px;
width: 100%;
height: 100%;
text-align: center;
border: none;
}

.tablesmall-form-row td:has(input.timesheet-keyboard) {
width: 32px;
min-width: 32px;
max-width: 32px;
font-size: 13px;
border: 0.1px solid #e6e6e6;
}

.tablesmall-form-row input.timesheet-keyboard:focus {
Expand Down Expand Up @@ -246,7 +256,7 @@ td.in-holidays {
font-style: normal;
}

.tablesmall-form-row td.timesheet-day > input[type="text"], .tablesmall-form-row td.timesheet-day-weekend > input[type="text"] {
input.timesheet-cycle{
text-align: center;
height: 100%;
width: 100%;
Expand Down
2 changes: 1 addition & 1 deletion pydici/settings/pydici.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

# can be "cycle" or "keyboard"
TIMESHEET_INPUT_METHOD = "cycle"
TIMESHEET_DAY_DURATION = 7
TIMESHEET_DAY_DURATION = 8

# Telegram integration
TELEGRAM_IS_ENABLED = False # Wether to enable or not Telegram notifications
Expand Down
2 changes: 1 addition & 1 deletion staffing/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ def __init__(self, *args, **kwargs):
self.widget.attrs.setdefault("class", "timesheet-keyboard")

def prepare_value(self, day_percent):
if isinstance(day_percent, types.StringTypes):
if isinstance(day_percent, str):
# day_percent may already be a string if prepare_value() is called
# with the final value
return day_percent
Expand Down
3 changes: 1 addition & 2 deletions staffing/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,7 @@ def staffingDates(n=12, format=None, minDate=None, maxDate=None):

def time_string_for_day_percent(day_percent, day_duration=settings.TIMESHEET_DAY_DURATION):
if day_percent is None:
hours = 0
minutes = 0
return ""
else:
# Using round() is important here because int() truncates the decimal
# part so int(24.99) returns 24, whereas round(24.99) returns 25.
Expand Down

0 comments on commit 3f770e0

Please sign in to comment.