mirror of
https://codeberg.org/vyn/mirai.git
synced 2025-07-02 01:13:19 +00:00
60 lines
1.5 KiB
Text
60 lines
1.5 KiB
Text
import { Backend, TaskData } from "../Backend.slint";
|
|
import { Button, VerticalBox, CheckBox, Date, ScrollView, ComboBox } from "std-widgets.slint";
|
|
import { VPopupIconMenu, VDatePicker, VTimePicker, VCheckBox, VButton, VTag, VText, VTextInput, Svg, Palette } from "@selenite";
|
|
import { NewTaskData, SaveTaskData } from "../Backend.slint";
|
|
|
|
export component TaskEdit inherits VerticalLayout {
|
|
in-out property <TaskData> task;
|
|
out property <bool> should-show;
|
|
|
|
private property <Date> newDate: task.date;
|
|
|
|
public function show(task: TaskData) {
|
|
root.task = task;
|
|
should-show = true;
|
|
}
|
|
public function close() {
|
|
should-show = false;
|
|
}
|
|
callback accepted(SaveTaskData);
|
|
|
|
if !should-show : Rectangle {}
|
|
|
|
if should-show : Rectangle {
|
|
function modify() {
|
|
root.accepted({
|
|
id: task.id,
|
|
sourceId: task.sourceId,
|
|
title: newTaskTitleInput.text,
|
|
scheduled: newDate.year != 0,
|
|
date: newDate
|
|
});
|
|
}
|
|
background: Palette.background;
|
|
border-radius: 8px;
|
|
VerticalLayout {
|
|
padding: 16px;
|
|
spacing: 8px;
|
|
|
|
newTaskTitleInput := VTextInput {
|
|
text: root.task.title;
|
|
accepted => { modify() }
|
|
}
|
|
HorizontalLayout {
|
|
alignment: start;
|
|
spacing: 8px;
|
|
if root.task.eventId == -1 : taskDateInput := VDatePicker {
|
|
date: task.date;
|
|
enabled: true;
|
|
edited(date) => { newDate = date; }
|
|
}
|
|
VButton {
|
|
text: "Modify";
|
|
icon-svg: Svg.correct;
|
|
icon-colorize: greenyellow;
|
|
clicked => { modify() }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|