don't lose trip_type on event cancellation; don't add empty notes in cal
This commit is contained in:
parent
fa14cfbf83
commit
e1b78b2725
@ -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,8 +371,10 @@ 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 {
|
||||||
|
if !notes.is_empty() {
|
||||||
name.push_str(&format!("({notes}) "))
|
name.push_str(&format!("({notes}) "))
|
||||||
}
|
}
|
||||||
|
}
|
||||||
vevent.push(Summary::new(name));
|
vevent.push(Summary::new(name));
|
||||||
calendar.add_event(vevent);
|
calendar.add_event(vevent);
|
||||||
}
|
}
|
||||||
|
@ -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,
|
||||||
|
@ -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>
|
||||||
|
Loading…
Reference in New Issue
Block a user