nicer-cal #573

Merged
philipp merged 3 commits from nicer-cal into staging 2024-06-06 07:11:34 +02:00
3 changed files with 7 additions and 3 deletions
Showing only changes of commit e1b78b2725 - Show all commits

View File

@ -98,6 +98,7 @@ FROM trip WHERE planned_event_id = ?
} }
} }
#[derive(Debug)]
pub struct EventUpdate<'a> { pub struct EventUpdate<'a> {
pub name: &'a str, pub name: &'a str,
pub planned_amount_cox: i32, pub planned_amount_cox: i32,
@ -361,7 +362,7 @@ WHERE trip_details.id=?
))); )));
let mut name = String::new(); let mut name = String::new();
if event.is_cancelled() { if event.is_cancelled() {
name.push_str("ABGESAGT :-( "); name.push_str("ABGESAGT! :-( ");
} }
name.push_str(&format!("{} ", event.name)); name.push_str(&format!("{} ", event.name));
@ -370,7 +371,9 @@ WHERE trip_details.id=?
name.push_str(&format!("{} ", triptype.name)) name.push_str(&format!("{} ", triptype.name))
} }
if let Some(notes) = tripdetails.notes { if let Some(notes) = tripdetails.notes {
name.push_str(&format!("({notes}) ")) if !notes.is_empty() {
name.push_str(&format!("({notes}) "))
}
} }
vevent.push(Summary::new(name)); vevent.push(Summary::new(name));
calendar.add_event(vevent); calendar.add_event(vevent);

View File

@ -40,7 +40,7 @@ async fn create(
} }
//TODO: add constraints (e.g. planned_amount_cox > 0) //TODO: add constraints (e.g. planned_amount_cox > 0)
#[derive(FromForm)] #[derive(FromForm, Debug)]
struct UpdateEventForm<'r> { struct UpdateEventForm<'r> {
id: i64, id: i64,
name: &'r str, name: &'r str,

View File

@ -251,6 +251,7 @@
{{ macros::input(label='', name='planned_amount_cox', type='hidden', value=event.planned_amount_cox) }} {{ macros::input(label='', name='planned_amount_cox', type='hidden', value=event.planned_amount_cox) }}
{{ macros::input(label='', name='always_show', type='hidden', value=event.always_show) }} {{ macros::input(label='', name='always_show', type='hidden', value=event.always_show) }}
{{ macros::input(label='', name='is_locked', type='hidden', value=event.is_locked) }} {{ macros::input(label='', name='is_locked', type='hidden', value=event.is_locked) }}
{{ macros::input(label='', name='trip_type', type='hidden', value=event.trip_type_id) }}
<input value="Ausfahrt absagen" class="btn btn-alert" type="submit" /> <input value="Ausfahrt absagen" class="btn btn-alert" type="submit" />
</form> </form>
</div> </div>