|
|
|
|
@ -3,7 +3,7 @@ use sycamore::prelude::*;
|
|
|
|
|
|
|
|
|
|
use crate::components::base_table::TableContent;
|
|
|
|
|
|
|
|
|
|
use super::transaction::{TransactionCompany, TransactionsAggregated, LatestTransaction};
|
|
|
|
|
use super::transaction::{TransactionCompany, TransactionsAggregated, LatestTransaction, MajorTransactions};
|
|
|
|
|
|
|
|
|
|
pub trait IntoTableData<G>
|
|
|
|
|
where
|
|
|
|
|
@ -143,3 +143,50 @@ where
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl<G> IntoTableData<G> for PaginatedResponse<MajorTransactions>
|
|
|
|
|
where
|
|
|
|
|
G: GenericNode,
|
|
|
|
|
{
|
|
|
|
|
fn into_table_data(self, cx: Scope) -> TableContent<G> {
|
|
|
|
|
let headers_view = vec![
|
|
|
|
|
view! {cx, "Company" },
|
|
|
|
|
view! {cx, "Date published" },
|
|
|
|
|
view! {cx, "Date executed" },
|
|
|
|
|
view! {cx, "Nature" },
|
|
|
|
|
view! {cx, "Instrument" },
|
|
|
|
|
view! {cx, "Volume" },
|
|
|
|
|
view! {cx, "Unit price" },
|
|
|
|
|
view! {cx, "Total" },
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
let data_view: Vec<Vec<View<G>>> = self
|
|
|
|
|
.list
|
|
|
|
|
.into_iter()
|
|
|
|
|
.map(|t| {
|
|
|
|
|
let mut res = vec![];
|
|
|
|
|
res.push(view! {cx,
|
|
|
|
|
a (href=format!("transactions/{}", t.slug),
|
|
|
|
|
class="text-indigo-800 dark:text-indigo-300 hover:text-indigo-500 hover:underline dark:hover:text-indigo-600",
|
|
|
|
|
) {
|
|
|
|
|
(t.company_name.to_owned())
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
res.push(view! {cx, (t.date_published.to_owned()) });
|
|
|
|
|
res.push(view! {cx, (t.date_executed.to_owned()) });
|
|
|
|
|
res.push(view! {cx, (t.nature.to_owned()) });
|
|
|
|
|
res.push(view! {cx, (t.instrument.to_owned()) });
|
|
|
|
|
res.push(view! {cx, (t.volume.to_owned()) });
|
|
|
|
|
res.push(view! {cx, (t.unit_price.to_owned()) });
|
|
|
|
|
res.push(view! {cx, (t.total.to_string()) });
|
|
|
|
|
|
|
|
|
|
res
|
|
|
|
|
})
|
|
|
|
|
.collect();
|
|
|
|
|
|
|
|
|
|
TableContent {
|
|
|
|
|
headers_view,
|
|
|
|
|
data_view,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|