punchclock

package
v0.9.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 3, 2023 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WORKING string = "Working"
	PAUSED  string = "Paused"
)
View Source
const (
	YYYYMMDD  = "2006-01-02"
	HHMMSS24h = "15:04"
)
View Source
const (
	COLUMNS = 5
)

Variables

This section is empty.

Functions

func CheckIfError

func CheckIfError(err error)

func IsSameDay

func IsSameDay(t1 time.Time, t2 time.Time) bool

func NewWorkDayModelSlice

func NewWorkDayModelSlice(records []WorkDayRecord) *[]WorkDayModel

func RoundDown

func RoundDown(t time.Time) time.Time

func RoundUp

func RoundUp(t time.Time) time.Time

func SetMainMenu

func SetMainMenu(metadata fyne.AppMetadata, w fyne.Window) *fyne.MainMenu

func UpdateTime

func UpdateTime(baseTime time.Time, s string) (time.Time, error)

Types

type BreakTimeEditor

type BreakTimeEditor struct {
	// contains filtered or unexported fields
}

func NewBreakTimeEditor

func NewBreakTimeEditor(w *WorkDay) *BreakTimeEditor

func (*BreakTimeEditor) Add

func (e *BreakTimeEditor) Add(startTime string, endTime string) error

func (*BreakTimeEditor) Delete

func (e *BreakTimeEditor) Delete(index int)

func (*BreakTimeEditor) Edit

func (e *BreakTimeEditor) Edit(index int, newStartTime string, newEndTime string) error

func (*BreakTimeEditor) GetEnd

func (e *BreakTimeEditor) GetEnd(index int) string

func (*BreakTimeEditor) GetPauseTime

func (e *BreakTimeEditor) GetPauseTime(index int) string

func (*BreakTimeEditor) GetPauses

func (e *BreakTimeEditor) GetPauses() []WorkPause

func (*BreakTimeEditor) GetStart

func (e *BreakTimeEditor) GetStart(index int) string

type EditBreakTimeView

type EditBreakTimeView struct {
	Pauses      []WorkPause
	OnSubmitted func()
	// contains filtered or unexported fields
}

func (*EditBreakTimeView) Show

func (v *EditBreakTimeView) Show(parent *fyne.Window, day WorkDay)

type FileHandler

type FileHandler struct {
	// contains filtered or unexported fields
}

func NewFileHandler

func NewFileHandler(filepath string) *FileHandler

func (*FileHandler) Load

func (fh *FileHandler) Load() ([]WorkDayRecord, error)

func (*FileHandler) Save

func (fh *FileHandler) Save(records []WorkDayRecord) error

type MainWindowView

type MainWindowView struct {
	// contains filtered or unexported fields
}

func (*MainWindowView) ShowMainWindow

func (v *MainWindowView) ShowMainWindow()

type PunchClock

type PunchClock struct {
	// contains filtered or unexported fields
}

func NewPunchClock

func NewPunchClock() *PunchClock

func NewPunchClockFromData

func NewPunchClockFromData(today WorkDay) *PunchClock

func (*PunchClock) GetCurrentWorkDay

func (pc *PunchClock) GetCurrentWorkDay() WorkDay

func (*PunchClock) GetPreviousWorkDay

func (pc *PunchClock) GetPreviousWorkDay() WorkDay

func (*PunchClock) Pause

func (pc *PunchClock) Pause()

func (*PunchClock) SetCurrentWorkDay

func (pc *PunchClock) SetCurrentWorkDay(wd WorkDay)

func (*PunchClock) Work

func (pc *PunchClock) Work()

type PunchclockController

type PunchclockController struct {
	Model  *PunchclockModel
	Status string
	// contains filtered or unexported fields
}

func NewPunchclockController

func NewPunchclockController(storage RecordStorage) *PunchclockController

func (*PunchclockController) Pause

func (c *PunchclockController) Pause()

func (*PunchclockController) Present

func (c *PunchclockController) Present()

func (*PunchclockController) Refresh

func (c *PunchclockController) Refresh()

func (*PunchclockController) ToggleSelectedMonth

func (c *PunchclockController) ToggleSelectedMonth() string

func (*PunchclockController) Update

func (c *PunchclockController) Update(day WorkDayRecord)

type PunchclockModel

type PunchclockModel struct {
	SelectedMonth []WorkDayModel
}

type RecordStorage

type RecordStorage interface {
	Save(records []WorkDayRecord) error
	Load() ([]WorkDayRecord, error)
}

type Selected

type Selected uint8
const (
	CurrentMonth Selected = iota
	PreviousMonth
)

type TappableLabel

type TappableLabel struct {
	widget.Label
	OnTapped func() `json:"-"`
}

func NewTappableLabel

func NewTappableLabel(text string, tapped func()) *TappableLabel

func (*TappableLabel) Tapped

func (t *TappableLabel) Tapped(*fyne.PointEvent)

func (*TappableLabel) TappedSecondary

func (t *TappableLabel) TappedSecondary(*fyne.PointEvent)

type TimesheetModel

type TimesheetModel struct {
	// contains filtered or unexported fields
}

func NewTimesheetModel

func NewTimesheetModel(records []WorkDayRecord) *TimesheetModel

func (*TimesheetModel) GetAllRecords

func (ts *TimesheetModel) GetAllRecords() []WorkDayRecord

func (*TimesheetModel) GetCurrentMonth

func (ts *TimesheetModel) GetCurrentMonth() (selected []WorkDayRecord)

func (*TimesheetModel) GetIndexOf

func (ts *TimesheetModel) GetIndexOf(day WorkDayRecord) int

func (*TimesheetModel) GetPreviousMonths

func (ts *TimesheetModel) GetPreviousMonths() (selected []WorkDayRecord)

func (*TimesheetModel) GetToday

func (ts *TimesheetModel) GetToday() WorkDay

func (*TimesheetModel) SortRecords

func (ts *TimesheetModel) SortRecords()

func (*TimesheetModel) UpdateWorkDay

func (ts *TimesheetModel) UpdateWorkDay(updated WorkDayRecord)

type ValidatedTimeEntry

type ValidatedTimeEntry struct {
	widget.Entry
}

func NewValidatedTimeEntry

func NewValidatedTimeEntry() *ValidatedTimeEntry

func (*ValidatedTimeEntry) Clear

func (e *ValidatedTimeEntry) Clear()

type WorkDay

type WorkDay struct {
	WorkStarted time.Time   `json:"WorkStarted"`
	WorkEnded   time.Time   `json:"WorkEnded"`
	Pauses      []WorkPause `json:"Pauses"`
}

func NewWorkDay

func NewWorkDay(startTime time.Time) *WorkDay

func (*WorkDay) AddPause

func (d *WorkDay) AddPause(p WorkPause)

type WorkDayModel

type WorkDayModel struct {
	// contains filtered or unexported fields
}

func NewWorkDayModel

func NewWorkDayModel(record WorkDayRecord) WorkDayModel

func (*WorkDayModel) Day

func (m *WorkDayModel) Day() string

func (*WorkDayModel) End

func (m *WorkDayModel) End() string

func (*WorkDayModel) Pause

func (m *WorkDayModel) Pause() string

func (*WorkDayModel) SetEnd

func (m *WorkDayModel) SetEnd(timeStr string) error

func (*WorkDayModel) SetPauses

func (m *WorkDayModel) SetPauses(pauses []WorkPause)

func (*WorkDayModel) SetStart

func (m *WorkDayModel) SetStart(timeStr string) error

func (*WorkDayModel) Start

func (m *WorkDayModel) Start() string

func (*WorkDayModel) WorkingTime

func (m *WorkDayModel) WorkingTime() string

type WorkDayRecord

type WorkDayRecord struct {
	WorkDay     WorkDay       `json:"WorkDay"`
	WorkingTime time.Duration `json:"WorkingTime"`
	PauseTime   time.Duration `json:"PauseTime"`
}

func CalculateWorkDay

func CalculateWorkDay(workday WorkDay) WorkDayRecord

type WorkPause

type WorkPause struct {
	Start time.Time `json:"Start"`
	End   time.Time `json:"End"`
}

func NewWorkPause

func NewWorkPause() WorkPause

func NewWorkPauseWithData

func NewWorkPauseWithData(start time.Time, end time.Time) WorkPause

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL