|
|
|
@ -4,6 +4,7 @@ use askama::Template;
|
|
|
|
use askama_axum::{IntoResponse, Response};
|
|
|
|
use askama_axum::{IntoResponse, Response};
|
|
|
|
use axum::extract::State;
|
|
|
|
use axum::extract::State;
|
|
|
|
use axum::{async_trait, debug_handler, Form};
|
|
|
|
use axum::{async_trait, debug_handler, Form};
|
|
|
|
|
|
|
|
use axum_htmx::{HxEvent, HxResponseTrigger};
|
|
|
|
use serde::Deserialize;
|
|
|
|
use serde::Deserialize;
|
|
|
|
use tracing::info;
|
|
|
|
use tracing::info;
|
|
|
|
use crate::app::routes::AppState;
|
|
|
|
use crate::app::routes::AppState;
|
|
|
|
@ -168,7 +169,17 @@ pub async fn create_item_form_post(
|
|
|
|
&form_data.pims_id, &form_data.vetcove_id,
|
|
|
|
&form_data.pims_id, &form_data.vetcove_id,
|
|
|
|
).await?;
|
|
|
|
).await?;
|
|
|
|
|
|
|
|
|
|
|
|
Ok(CreateItemFormData::base_template(&state).await?.into_response())
|
|
|
|
let fresh_form = CreateItemFormData::base_template(&state).await?;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let events = vec![
|
|
|
|
|
|
|
|
HxEvent::from("form-submit-success"),
|
|
|
|
|
|
|
|
HxEvent::from("new-item"),
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Ok( (
|
|
|
|
|
|
|
|
HxResponseTrigger::normal(events),
|
|
|
|
|
|
|
|
fresh_form.into_response()
|
|
|
|
|
|
|
|
).into_response() )
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[debug_handler]
|
|
|
|
#[debug_handler]
|
|
|
|
|