Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- This file is a merged representation of a subset of the codebase, containing specifically included files, combined into a single document by Repomix.
- ================================================================
- File Summary
- ================================================================
- Purpose:
- --------
- This file contains a packed representation of a subset of the repository's contents that is considered the most important context.
- It is designed to be easily consumable by AI systems for analysis, code review,
- or other automated processes.
- File Format:
- ------------
- The content is organized as follows:
- 1. This summary section
- 2. Repository information
- 3. Directory structure
- 4. Repository files (if enabled)
- 5. Multiple file entries, each consisting of:
- a. A separator line (================)
- b. The file path (File: path/to/file)
- c. Another separator line
- d. The full contents of the file
- e. A blank line
- Usage Guidelines:
- -----------------
- - This file should be treated as read-only. Any changes should be made to the
- original repository files, not this packed version.
- - When processing this file, use the file path to distinguish
- between different files in the repository.
- - Be aware that this file may contain sensitive information. Handle it with
- the same level of security as you would the original repository.
- Notes:
- ------
- - Some files may have been excluded based on .gitignore rules and Repomix's configuration
- - Binary files are not included in this packed representation. Please refer to the Repository Structure section for a complete list of file paths, including binary files
- - Only files matching these patterns are included: gmm_client/src/pages/year_to_date.rs, gmm_client/src/pages/well_rev.rs, gmm_client/src/pages/tax_year.rs, gmm_client/src/pages/stats.rs, gmm_client/src/pages/leases.rs, gmm_client/src/pages/jibs.rs, gmm_client/src/pages/incoming.rs, gmm_client/src/pages/dashboard.rs, gmm_client/src/pages/contacts.rs, gmm_client/src/pages/assets.rs, gmm_client/src/components/table.rs, gmm_client/src/components/pie_chart.rs, gmm_client/src/server/app_pools.rs
- - Files matching patterns in .gitignore are excluded
- - Files matching default ignore patterns are excluded
- - Files are sorted by Git change count (files with more changes are at the bottom)
- ================================================================
- Directory Structure
- ================================================================
- gmm_client/
- src/
- components/
- pie_chart.rs
- table.rs
- pages/
- assets.rs
- contacts.rs
- dashboard.rs
- incoming.rs
- jibs.rs
- leases.rs
- stats.rs
- tax_year.rs
- well_rev.rs
- year_to_date.rs
- server/
- app_pools.rs
- ================================================================
- Files
- ================================================================
- ================
- File: gmm_client/src/components/pie_chart.rs
- ================
- use leptos::*;
- /// Represents a single slice of the pie chart.
- #[derive(Debug, Clone)]
- pub struct PieSlice {
- pub label: String,
- pub value: f64,
- pub color: String,
- }
- #[component]
- pub fn PieChart(
- title: String,
- sub_title: String,
- mut data: Vec<PieSlice>,
- ) -> impl IntoView {
- data.sort_by(|a, b| a.label.cmp(&b.label));
- let angles = {
- let total: f64 = data.iter().map(|s| s.value).sum();
- let mut start_angle = -90.0;
- let mut computed_angles = Vec::new();
- for slice in &data {
- let angle = (slice.value / total) * 360.0;
- computed_angles.push((start_angle, start_angle + angle));
- start_angle += angle;
- }
- computed_angles
- };
- view! {
- <div class="pie-chart-wrapper">
- <h3 class="pie-header">{title.clone()}</h3>
- <p class="pie-sub">{sub_title}</p>
- <div class="pie-chart-container">
- <svg width="250" height="255" viewBox="0 0 250 255" class="pie-chart">
- {
- if data.len() == 1 {
- let slice = &data[0];
- vec![
- view! {
- <path
- d="M125,2.5 A125,125 0 1,1 124.9,2.5 Z"
- fill={slice.color.clone()}
- stroke="white"
- stroke-width="1"
- />
- }
- ]
- } else {
- data.iter().zip(angles.iter()).enumerate().map(|(_i, (slice, &(start, end)))| {
- let radius = 125.0;
- let center_x = 125.0;
- let center_y = 127.5;
- let start_x = center_x + radius * start.to_radians().cos();
- let start_y = center_y + radius * start.to_radians().sin();
- let end_x = center_x + radius * end.to_radians().cos();
- let end_y = center_y + radius * end.to_radians().sin();
- let large_arc = if end - start > 180.0 { 1 } else { 0 };
- let path = format!(
- "M{},{} L{},{} A{},{} 0 {} 1 {},{} Z",
- center_x, center_y,
- start_x, start_y,
- radius, radius,
- large_arc,
- end_x, end_y
- );
- view! {
- <path d=path fill={slice.color.clone()} stroke="white" stroke-width="1"/>
- }
- }).collect::<Vec<_>>()
- }
- }
- </svg>
- <table class="pie-chart-legend">
- <tbody>
- {data.iter().map(|slice| {
- view! {
- <tr>
- <td>
- <svg width="20" height="20" xmlns="http://www.w3.org/2000/svg">
- <path d="M0 20 L6.8404 1.20615 A20 20 0 0 1 20 20Z" fill={slice.color.clone()} stroke="white" stroke-width="1"/>
- </svg>
- </td>
- <td>{
- slice.label.clone()
- // slice.label.clone().replace('.', " ") without the dot
- }</td>
- <td>{format!("{:.2}%", slice.value)}</td>
- </tr>
- }
- }).collect::<Vec<_>>()}
- </tbody>
- </table>
- </div>
- </div>
- }
- }
- ================
- File: gmm_client/src/components/table.rs
- ================
- use leptos::*;
- use crate::components::popover::Popover;
- #[derive(Clone, Debug)]
- pub struct TableData {
- pub headers: Vec<View>,
- pub rows: Vec<Vec<View>>,
- pub links: Vec<Option<Vec<String>>>,
- pub has_totals: bool,
- }
- #[component]
- pub fn Table(
- #[prop(optional, default = TableData {
- headers: vec![],
- rows: vec![],
- links: vec![],
- has_totals: false,
- })]
- data: TableData,
- ) -> impl IntoView {
- let (active_popover, set_active_popover) = create_signal(None::<usize>);
- view! {
- <div class="w-auto table-wrapper">
- <table class="table-content mb-3">
- <thead>
- <tr class="bg-table-header">
- {data.headers.iter().map(|header| {
- view! {
- <th class="bg-table-header">
- <div class="d-flex align-items-center justify-content-center min-w-100 bg-table-header">
- {header}
- <div class="margin-sort">
- <div>
- <svg viewBox="0 0 100 100">
- <path d="m 0,100 50,-100 50,100 z"></path>
- </svg>
- </div>
- <div>
- <svg viewBox="0 0 100 100">
- <path d="m 0,0 50,100 50,-100 z"></path>
- </svg>
- </div>
- </div>
- </div>
- </th>
- }
- }).collect::<Vec<_>>()}
- </tr>
- </thead>
- <tbody>
- {data.rows.iter().enumerate().map(|(index, row)| {
- let is_last_row = data.has_totals && index == data.rows.len() - 1;
- let row_class = if is_last_row {
- "border-t-2"
- } else {
- ""
- };
- let row_link = data.links.get(index).cloned().flatten().unwrap_or_default();
- view! {
- <tr class={row_class}>
- {
- if !row_link.is_empty() {
- row.iter().enumerate().map(|(cell_index, cell)| {
- let cell_class = if cell_index == 0 {
- "text-left"
- } else {
- "text-right"
- };
- if row_link.len() == 1 {
- view! {
- <td class="text-right">
- <a href={row_link[0].clone()} target="_blank" class="black">
- {cell}
- </a>
- </td>
- }
- } else {
- let popover_index = index * 1000 + cell_index;
- view! {
- <td class={cell_class}>
- <Popover
- index={popover_index}
- links={row_link.clone()}
- trigger={cell.clone()}
- active_popover={active_popover.clone()}
- set_active_popover={set_active_popover.clone()}
- text_align={cell_class.to_string()}
- />
- </td>
- }
- }
- }).collect::<Vec<_>>()
- } else {
- row.iter().enumerate().map(|(cell_index, cell)| {
- let cell_class = if cell_index == 0 {
- "text-left"
- } else {
- "text-right"
- };
- view! { <td class={cell_class}>{cell}</td> }
- }).collect::<Vec<_>>()
- }
- }
- </tr>
- }
- }).collect::<Vec<_>>() }
- </tbody>
- </table>
- </div>
- }
- }
- ================
- File: gmm_client/src/pages/assets.rs
- ================
- use leptos::*; // Import the Leptos framework // Import the AssetsResource struct
- use std::vec;
- use crate::components::table::*; // Import the Table component
- use crate::tables::assets::resource::AssetsResource;
- use crate::components::table_skeleton::TableSkeleton; // Import the TableSkeleton component
- #[component]
- pub fn Assets() -> impl IntoView {
- // Create an instance of the AssetsResource to fetch asset data
- let assets_resource = AssetsResource::new();
- view! {
- <div class="tables">
- <h2 class="title-guardian-content">Assets</h2>
- <p class="font-georgia mb-0">A current listing of your owned assets.</p>
- // Create a transition with a fallback view when data is still loading
- <Suspense fallback={move || view!
- {
- <div>
- <TableSkeleton />
- </div>
- }
- }>
- {move ||
- // Check the result of fetching asset data
- match assets_resource.revenue_rows.get() {
- // If assets data is successfully fetched
- Some(Ok(assets)) => {
- let visibility_classes: Vec<(RwSignal<String>, RwSignal<bool>)> =
- assets.iter().map(|_| (create_rw_signal("max-width-text-hidden".to_string()), create_rw_signal(false))).collect();
- // Define the table data structure
- let data_assets = TableData {
- // Table headers
- headers: vec![
- view! { <p>"State"</p> }.into_view(),
- view! { <p>"Location Details"</p> }.into_view(),
- view! { <p>"Interest Type"</p> }.into_view(),
- view! { <p>"Area Share"<br />"(NMA)"</p> }.into_view(),
- view! { <p>"Conveyance Type"</p> }.into_view(),
- ],
- // Table rows mapped from the fetched assets
- rows: assets.iter().enumerate().map(|(index, asset)| {
- let visibility_class = visibility_classes[index].clone();
- let toggle_visibility = move |_| {
- let current_class = visibility_class.0.get_untracked();
- if current_class == "max-width-text-hidden" {
- visibility_class.0.set("max-width-text-visible".to_string());
- } else {
- visibility_class.0.set("max-width-text-hidden".to_string());
- }
- };
- let full_text = format!(
- "{} {}",
- asset.county.as_deref().unwrap_or("").trim(),
- asset.full_legal_description.as_deref().unwrap_or("").trim()
- ).trim().to_string();
- let show_button = full_text.chars().count() > 40;
- vec![
- view! { <p>{asset.state.clone()}</p> }.into_view(),
- view! {
- <div class="d-flex justify-content-between align-items-end max-width-text">
- <p class=move || format!("text-left {}", visibility_class.0.get())>
- {format!(
- "{} {}",
- asset.county.clone().unwrap_or_default(),
- asset.full_legal_description.clone().unwrap_or_default()
- )}
- </p>
- {
- if show_button {
- view! {
- <button
- class="toggle-button-visibility-class text-right"
- on:click=toggle_visibility
- >
- {move || if visibility_class.0.get() == "max-width-text-hidden" {
- view!{ <p>"... more"</p> }
- } else {
- view!{ <p>"... less"</p> }
- }}
- </button>
- }.into_view()
- } else {
- view! {}.into_view()
- }
- }
- </div>
- }.into_view(),
- view! { <p class="text-left">{asset.interest_type.clone()}</p> }.into_view(),
- view! { <p class="text-right">{asset.area_share_nma.clone()}</p> }.into_view(),
- view! { <p class="text-right">{asset.conveyance_type.clone()}</p> }.into_view(),
- ]
- }).collect::<Vec<_>>(),
- // Links for each row (example with Google links)
- links: vec![Some(vec!["https://www.google.com".to_string(); 4])],
- // No totals to display in the table
- has_totals: false,
- };
- // Render the table with the provided data
- view! {
- <div>
- <Table data={data_assets} />
- </div>
- }
- },
- // If an error occurs while fetching data
- Some(Err(_)) => {
- log::error!("Error fetching assets {}", assets_resource.revenue_rows.get().unwrap().err().unwrap());
- view! { <div><p>"Error..."</p></div> }
- },
- // If no data is available (still loading)
- None => view! {
- <div>
- <TableSkeleton />
- </div>
- },
- }
- }
- </Suspense>
- </div>
- }
- }
- ================
- File: gmm_client/src/pages/contacts.rs
- ================
- use leptos::*;
- use crate::hooks::use_is_pw_layout;
- #[component]
- pub fn Contacts() -> impl IntoView {
- let is_pw_layout = use_is_pw_layout::use_is_pw_layout();
- view! {
- <>
- {
- (move || if is_pw_layout.get() {
- view! {
- <h2 class="title-guardian-content">Contacts Us</h2>
- }
- } else {
- view! {
- <h2 class="title-guardian-content">Contacts</h2>
- }
- })()
- }
- <p class="font-georgia">Should you have any questions or need anything further, please feel free to contact us. Thank you for the opportunity to provide our services. To save your visualization, please click download and save the file as you wish. You can also view this visualization from your computer, ipad or tablet or smart tv. </p>
- {move || if is_pw_layout.get() {
- view! {
- <>
- <h2 class="title-guardian-content">Post Office Box</h2>
- <p class="font-georgia mb-0">PW Energy</p>
- <p class="font-georgia mb-0">PO Box 471939</p>
- <p class="font-georgia mb-0">Fort Worth, Texas 76147</p>
- <h2 class="title-guardian-content">Lead Contacts</h2>
- <table class="table-contacts w-auto d-flex">
- <tr>
- <td class="font-georgia">
- <div class="d-flex flex-column">
- <span>Bryan Frazier, CPL</span>
- <span>Partner, Head of Energy Asset Management</span>
- <span>Phone: 817-247-7858</span>
- </div>
- </td>
- </tr>
- <tr>
- <td class="font-georgia">
- <div class="d-flex flex-column">
- <span>Pedie Monta, CPL</span>
- <span>Director of Land - Energy Asset Management</span>
- <span>Phone: 907-723-9340</span>
- </div>
- </td>
- </tr>
- <tr>
- <td class="font-georgia">
- <div class="d-flex flex-column">
- <span>Mac Laas, CPL</span>
- <span>Senior Landman - Energy Asset Management</span>
- <span>Phone: 210-296-7099</span>
- </div>
- </td>
- </tr>
- </table>
- </>
- }
- } else {
- view! {
- <>
- <h2 class="title-guardian-footer">Main Office</h2>
- <p class="font-georgia">(888) 348-7318</p>
- <p class="font-georgia">Guardian Mineral Management & Consulting</p>
- <p class="font-georgia">6115 Camp Bowie Blvd, Suite 245</p>
- <p class="font-georgia">Fort Worth, Texas 76116</p>
- <h2 class="title-guardian-footer">Post Office Box</h2>
- <p class="font-georgia">Guardian Mineral Management & Consulting</p>
- <p class="font-georgia">PO Box 471489</p>
- <p class="font-georgia">Fort Worth, Texas 76147</p>
- <h2 class="title-guardian-footer">Lead Contacts</h2>
- <table class="table-contacts w-auto">
- <tr>
- <td class="font-georgia">
- <div class="d-flex flex-column">
- <span>Diana Frazier, CPL</span>
- <span>Founder and President</span>
- <span>Cell: (817) 808-1430</span>
- </div>
- </td>
- <td class="font-georgia">
- <div class="d-flex flex-column">
- <span>June D Silva</span>
- <span>Director of Analysis and Information Visualization</span>
- <span>Cell: 312-804-0087</span>
- </div>
- </td>
- </tr>
- <tr>
- <td class="font-georgia">
- <div class="d-flex flex-column">
- <span>Marcia Newton</span>
- <span>Office Manager</span>
- <span>Cell: 682-269-8765</span>
- </div>
- </td>
- <td class="font-georgia">
- <div class="d-flex flex-column">
- <span>Grant Carlisle, CPL</span>
- <span>VP of Land</span>
- <span>Cell: 405-880-5053</span>
- </div>
- </td>
- </tr>
- </table>
- </>
- }
- }}
- </>
- }
- }
- ================
- File: gmm_client/src/pages/dashboard.rs
- ================
- use leptos::*; // Import the Leptos framework
- use std::vec;
- use chrono::NaiveDate;
- use crate::components::table::*; // Import the Table component
- use crate::tables::dashboardjibs::resource::DashboardJibsResource; // Import the DashboardJibsResource struct
- use crate::tables::dashboardrevenue::resource::DashboardRevenueResource; // Import the DashboardRevenueResource struct
- use crate::components::table_skeleton::TableSkeleton; // Import the TableSkeleton component
- #[derive(Clone, Debug)]
- pub struct FilterDashboard {
- pub operator: String,
- pub payment_status: String,
- pub month_from: String,
- pub year_from: String,
- pub month_to: String,
- pub year_to: String,
- }
- #[component]
- pub fn Dashboard() -> impl IntoView {
- let dashboard_resource = DashboardJibsResource::new();
- let dashboard_revenue = DashboardRevenueResource::new();
- let (filter, set_filter) = create_signal(FilterDashboard {
- operator: String::new(),
- payment_status: "All".to_string(),
- month_from: "Jan".to_string(),
- year_from: "2015".to_string(),
- month_to: "Dec".to_string(),
- year_to: "2025".to_string(),
- });
- let (error_message, set_error_message) = create_signal(None::<String>);
- let months = vec![
- "Jan", "Feb", "Mar", "Apr", "May", "Jun",
- "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
- ];
- let years = vec![
- "2025", "2024", "2023", "2022", "2021",
- ];
- let payment_options = vec![
- "All".to_string(),
- "Approved".to_string(),
- "Not Approved".to_string(),
- ];
- let months_clone = months.clone();
- let years_clone = years.clone();
- let filtered_dashboard_jibs = create_memo(move |_| {
- let current_filter = filter.get();
- let from = build_ym(¤t_filter.year_from, ¤t_filter.month_from);
- let to = build_ym(¤t_filter.year_to, ¤t_filter.month_to);
- dashboard_resource
- .rows
- .get()
- .map(|pages| {
- pages
- .iter()
- .flat_map(|page| page.iter())
- .filter(|dashboard| {
- let date = &dashboard.month;
- (current_filter.operator.is_empty()
- || dashboard.operator_name.to_lowercase().contains(¤t_filter.operator.to_lowercase()))
- && (current_filter.payment_status == "All"
- || (current_filter.payment_status == "Approved"
- && dashboard.jib_amount > 0.0)
- || (current_filter.payment_status == "Not Approved"
- && dashboard.jib_amount <= 0.0))
- && (from <= *date && *date <= to)
- })
- .cloned()
- .collect::<Vec<_>>()
- })
- });
- let filtered_dashboard_revenue = create_memo(move |_| {
- let current_filter = filter.get();
- let from = build_ym(¤t_filter.year_from, ¤t_filter.month_from);
- let to = build_ym(¤t_filter.year_to, ¤t_filter.month_to);
- dashboard_revenue
- .rows
- .get()
- .map(|pages| {
- pages
- .iter()
- .flat_map(|page| page.iter())
- .filter(|revenue| {
- let date = revenue.payment_date.clone();
- (current_filter.operator.is_empty()
- || revenue.operator_purchaser.to_lowercase().contains(¤t_filter.operator.to_lowercase()))
- && (from <= date && date <= to)
- })
- .cloned()
- .collect::<Vec<_>>()
- })
- });
- fn is_invalid_range(filter: &FilterDashboard) -> bool {
- let parse = |m: &str, y: &str| {
- let num = match m {
- "Jan" => 1, "Feb" => 2, "Mar" => 3, "Apr" => 4,
- "May" => 5, "Jun" => 6, "Jul" => 7, "Aug" => 8,
- "Sep" => 9, "Oct" => 10, "Nov" => 11, "Dec" => 12,
- _ => 1,
- };
- NaiveDate::from_ymd_opt(y.parse().unwrap_or(2000), num, 1).unwrap()
- };
- parse(&filter.month_from, &filter.year_from)
- > parse(&filter.month_to, &filter.year_to)
- }
- create_effect(move |_| {
- let current = filter.get();
- if is_invalid_range(¤t) {
- set_error_message.set(Some("The 'From' date cannot be after the 'To' date.".into()));
- } else {
- set_error_message.set(None);
- }
- });
- view! {
- <div class="tables">
- { move || {
- error_message.get().as_ref().map(|msg| view! {
- <div
- class="alert-danger push-left d-flex align-items-center justify-content-between mb-3 w-75"
- role="alert"
- >
- <img src="/error-icon.png" class="icon-sm" alt="Error" />
- <span class="alert-message">{ msg }</span>
- <img
- src="/close-icon.png"
- class="icon-sm clickable"
- alt="Close"
- on:click=move |_| set_error_message.set(None)
- />
- </div>
- })
- }}
- <h2 class="title-guardian-content">Most Recent</h2>
- <div class="d-flex flex-sm-row align-items-center justify-content-start gap-2">
- <div class="d-flex align-items-center search-operator-mobile">
- <input
- type="search"
- placeholder="Filter by Operator Name"
- class="form-control w-auto"
- on:input=move |ev| {
- let v = event_target_value(&ev);
- set_filter.update(|f| f.operator = v);
- }
- prop:value=filter.get().operator.clone()
- />
- </div>
- <div class="d-flex align-items-center gap-2">
- <select
- class="form-select w-auto"
- on:change=move |e| {
- let v = event_target_value(&e);
- set_filter.update(|f| f.payment_status = v);
- }
- prop:value=filter.get().payment_status.clone()
- >
- { payment_options.iter().map(|opt| view! {
- <option value={opt.clone()}>{opt}</option>
- }).collect_view() }
- </select>
- </div>
- <div class="d-flex align-items-center gap-2">
- <p class="fs-06">"from"</p>
- <select
- class="form-select w-auto"
- on:change=move |e| {
- let v = event_target_value(&e);
- set_filter.update(|f| f.month_from = v);
- }
- prop:value=filter.get().month_from.clone()
- >
- { months.iter().map(|m| view! {
- <option value={m.to_string()}>{m.to_string()}</option>
- }).collect_view() }
- </select>
- <select
- class="form-select w-auto"
- on:change=move |e| {
- let v = event_target_value(&e);
- set_filter.update(|f| f.year_from = v);
- }
- prop:value=filter.get().year_from.clone()
- >
- { years.iter().map(|y| view! {
- <option value={y.to_string()}>{y.to_string()}</option>
- }).collect_view() }
- </select>
- </div>
- <div class="d-flex align-items-center gap-2">
- <p class="fs-06">"to"</p>
- <select
- class="form-select w-auto"
- on:change=move |e| {
- let v = event_target_value(&e);
- set_filter.update(|f| f.month_to = v);
- }
- prop:value=filter.get().month_to.clone()
- >
- { months_clone.iter().map(|m| view! {
- <option value={m.to_string()}>{m.to_string()}</option>
- }).collect_view() }
- </select>
- <select
- class="form-select w-auto"
- on:change=move |e| {
- let v = event_target_value(&e);
- set_filter.update(|f| f.year_to = v);
- }
- prop:value=filter.get().year_to.clone()
- >
- { years_clone.iter().map(|y| view! {
- <option value={y.to_string()}>{y.to_string()}</option>
- }).collect_view() }
- </select>
- </div>
- </div>
- <h2 class="title-guardian-footer">
- JIBs to pay
- </h2>
- <p class="font-georgia mb-0">
- JIBs received in the last 30 days. Please click Yes or No button to process them.
- </p>
- <Suspense fallback={move || view! {
- <div>
- <TableSkeleton />
- </div>
- }}>
- {move ||
- match filtered_dashboard_jibs.get() {
- Some(dashboards) => {
- log::info!("Fetched dashboards: {:?}", dashboards);
- let approval_states: Vec<RwSignal<Option<bool>>> = dashboards
- .iter()
- .map(|_| create_rw_signal(None))
- .collect();
- let data = TableData {
- headers: vec![
- view! { <p>"Operator Name"</p> }.into_view(),
- view! { <p>"JIB Amount"</p> }.into_view(),
- view! { <p>"Netted Amount"</p> }.into_view(),
- view! { <p>"Difference"</p> }.into_view(),
- view! { <p>"Month"</p> }.into_view(),
- view! { <p>"Approve to Pay"</p> }.into_view(),
- ],
- rows: dashboards.iter().enumerate().map(|(index, dashboard)| {
- let approval = approval_states[index];
- let action_cell = move || {
- {
- if dashboard.jib_amount > 0.0 {
- view! {
- <>
- <label class="checkbox-label">
- <input
- id="approved"
- name="approved"
- type="radio"
- checked={move || approval.get() == Some(true)}
- on:change={move |_| {
- if approval.get() == Some(true) {
- approval.set(None);
- } else {
- approval.set(Some(true));
- }
- }}
- disabled={move || approval.get() == Some(true)}
- />
- {
- move || if approval.get() == Some(true) {
- "Approved"
- } else {
- "Yes"
- }
- }
- </label>
- <label class="checkbox-label">
- <input
- id="approved"
- name="approved"
- type="radio"
- checked={move || approval.get() == Some(false)}
- on:change={move |_| {
- if approval.get() == Some(false) {
- approval.set(None);
- } else {
- approval.set(Some(false));
- }
- }}
- disabled={move || approval.get() == Some(false)}
- />
- {
- move || if approval.get() == Some(false) {
- "Not Approved"
- } else {
- "No"
- }
- }
- </label>
- </>
- }.into_view()
- } else {
- view! { <button class="d-none" disabled=true></button> }.into_view()
- }
- }
- };
- vec![
- view! { <p>{dashboard.operator_name.clone()}</p> }.into_view(),
- view! { <p>{dashboard.jib_amount.to_string()}</p> }.into_view(),
- view! { <p>{dashboard.netted_amount.map_or("N/A".to_string(), |n| n.to_string())}</p> }.into_view(),
- view! { <p>{dashboard.difference.clone()}</p> }.into_view(),
- view! { <p>{dashboard.month.clone()}</p> }.into_view(),
- view! {
- <div class="checkbox-group">
- {action_cell()}
- </div>
- }.into_view(),
- ]
- }).collect::<Vec<_>>(),
- links: vec![Some(vec!["https://www.google.com".to_string(); 4])],
- has_totals: false,
- };
- view! {
- <div>
- <Table data={data} />
- </div>
- }
- },
- None => view! {
- <div>
- <TableSkeleton />
- </div>
- },
- }
- }
- </Suspense>
- <h2 class="title-guardian-footer">Lease Bonuses, Settlements, and Shut-Ins</h2>
- <p class="font-georgia mb-0">
- Lease bonuses, settlements, and shut-in payments received in the last 30 days.
- </p>
- <Suspense fallback={move || view! {
- <div>
- <TableSkeleton />
- </div>
- }}>
- {move ||
- match filtered_dashboard_revenue.get() {
- Some(revenues) => {
- log::info!("Fetched revenues: {:?}", revenues);
- let data = TableData {
- headers: vec![
- view! { <p>"Operator Purchaser"</p> }.into_view(),
- view! { <p>"Gross Revenue"</p> }.into_view(),
- view! { <p>"Taxes"</p> }.into_view(),
- view! { <p>"Deductions"</p> }.into_view(),
- view! { <p>"Net Revenue"</p> }.into_view(),
- view! { <p>"Payment Amount"</p> }.into_view(),
- view! { <p>"Payment Date"</p> }.into_view(),
- ],
- rows: revenues.iter().map(|revenue| {
- vec![
- view! { <p>{revenue.operator_purchaser.clone()}</p> }.into_view(),
- view! { <p>{revenue.gross_revenue.map_or("N/A".to_string(), |g| g.to_string())}</p> }.into_view(),
- view! { <p>{revenue.taxes.map_or("N/A".to_string(), |t| t.to_string())}</p> }.into_view(),
- view! { <p>{revenue.deductions.map_or("N/A".to_string(), |d| d.to_string())}</p> }.into_view(),
- view! { <p>{revenue.net_revenue.map_or("N/A".to_string(), |n| n.to_string())}</p> }.into_view(),
- view! { <p>{revenue.payment_amount.map_or("N/A".to_string(), |pa| pa.to_string())}</p> }.into_view(),
- view! { <p>{revenue.payment_date.clone()}</p> }.into_view(),
- ]
- }).collect::<Vec<_>>(),
- links: vec![Some(vec!["https://www.google.com".to_string(); 4])],
- has_totals: false,
- };
- view! {
- <div>
- <Table data={data} />
- </div>
- }
- },
- None => view! {
- <div>
- <TableSkeleton />
- </div>
- },
- }
- }
- </Suspense>
- </div>
- }
- }
- fn build_ym(year: &str, month_str: &str) -> String {
- format!("{}-{}", year, month_str_to_number(month_str))
- }
- fn month_str_to_number(m: &str) -> &str {
- match m {
- "Jan" => "01", "Feb" => "02", "Mar" => "03", "Apr" => "04",
- "May" => "05", "Jun" => "06", "Jul" => "07", "Aug" => "08",
- "Sep" => "09", "Oct" => "10", "Nov" => "11", "Dec" => "12",
- _ => "00",
- }
- }
- ================
- File: gmm_client/src/pages/incoming.rs
- ================
- use crate::components::filter_tables::*;
- use crate::components::table::*;
- use crate::components::table_skeleton::TableSkeleton;
- use crate::tables::incominglocation::resource::IncomingLocationResource;
- use crate::tables::incomingproducts::resource::IncomingProductsResource;
- use crate::tables::incomingtable1::resource::IncomingTable1Resource;
- use crate::tables::incomingtable2::resource::IncomingTable2Resource;
- use leptos::*;
- #[component]
- pub fn Incoming() -> impl IntoView {
- let incoming_by_operator = IncomingTable1Resource::new();
- let incoming_by_from_lease_bonuses = IncomingTable2Resource::new();
- let incoming_products_resource = IncomingProductsResource::new();
- let incoming_location_resource = IncomingLocationResource::new();
- view! {
- <div class="tables">
- <h2 class="title-guardian-content">"Incoming"</h2>
- <FilterTables />
- <p class="font-georgia mb-0">
- "This table contains revenue by operator."
- </p>
- <Suspense fallback={move || view!
- {
- <div>
- <TableSkeleton />
- </div>
- }
- }>
- {
- move ||
- // Check the result of fetching incoming data
- match incoming_by_operator.revenue_rows.get() {
- // If incoming data is successfully fetched
- Some(Ok(incoming)) => {
- // Define the table data structure
- let data_revenue_by_operator = TableData {
- // Table headers
- headers: vec![
- view! { <p class="max-w-300">"Operator"</p> }.into_view(),
- view! { <p>"Gross"<br />"Revenue"</p> }.into_view(),
- view! { <p>"Taxes"</p> }.into_view(),
- view! { <p>"Deductions"</p> }.into_view(),
- view! { <p>"Net" <br/> "Revenue"</p> }.into_view(),
- view! { <p>"Payment" <br/> "Amount"</p> }.into_view(),
- view! { <p>"Payment" <br/> "Date"</p> }.into_view(),
- view! { <p>"Depletion" <br/> "15%"</p> }.into_view(),
- view! { <p>"Net Post-"<br />"Depletion" <br/> "15%"</p> }.into_view(),
- view! { <p>"Depletion" <br/> "27.5%"</p> }.into_view(),
- view! { <p>"Net Post-"<br />"Depletion" <br/> "27.5%"</p> }.into_view(),
- ],
- // Table rows mapped from the fetched incoming data
- rows: incoming.iter().enumerate().take(100).map(|(_index, incoming)| {
- vec![
- view! { <p class="max-w-300">{incoming.operator_name.clone()}</p> }.into_view(),
- view! { <p class="max-w-200">{incoming.gross_revenue.clone()}</p> }.into_view(),
- view! { <p>{incoming.taxes.clone()}</p> }.into_view(),
- view! { <p>{incoming.deductions.clone()}</p> }.into_view(),
- view! { <p>{incoming.net_revenue.clone()}</p> }.into_view(),
- view! { <p>{incoming.payment_amount.clone()}</p> }.into_view(),
- view! { <p>{incoming.payment_date.clone()}</p> }.into_view(),
- view! { <p>{incoming.depletion_15.clone()}</p> }.into_view(),
- view! { <p>{incoming.net_post_depletion_15.clone()}</p> }.into_view(),
- view! { <p>{incoming.depletion_275.clone()}</p> }.into_view(),
- view! { <p>{incoming.net_post_depletion_275.clone()}</p> }.into_view(),
- ]
- }).collect::<Vec<_>>(),
- // Links for each row (example with Google links)
- links: vec![Some(vec!["https://www.google.com".to_string(); 4])],
- // No totals to display in the table
- has_totals: false,
- };
- // Render the table with the provided data
- view! {
- <div>
- <Table data={data_revenue_by_operator} />
- </div>
- }
- },
- // If an error occurs while fetching data
- Some(Err(_)) => {
- log::error!("Error fetching incoming {}", incoming_by_operator.revenue_rows.get().unwrap().err().unwrap());
- view! { <div><p>"Error..."</p></div> }
- },
- // If no data is available (still loading)
- None => view! {
- <div>
- <TableSkeleton />
- </div>
- },
- }
- }
- </Suspense>
- <p class="font-georgia mb-0">
- "This table contains revenue from lease bonuses, settlements and shut-ins."
- </p>
- <Suspense fallback={move || view!
- {
- <div>
- <TableSkeleton />
- </div>
- }
- }>
- {
- move ||
- // Check the result of fetching incoming data
- match incoming_by_from_lease_bonuses.rows.get() {
- // If incoming data is successfully fetched
- Some(Ok(incoming)) => {
- // Define the table data structure
- let data_revenue_from_lease_bonuses = TableData {
- // Table headers
- headers: vec![
- view! { <p class="max-w-300">"Operator"</p> }.into_view(),
- view! { <p>"Description"</p> }.into_view(),
- view! { <p>"Gross"<br />"Revenue"</p> }.into_view(),
- view! { <p>"Taxes"</p> }.into_view(),
- view! { <p>"Deductions"</p> }.into_view(),
- view! { <p>"Net" <br/> "Revenue"</p> }.into_view(),
- view! { <p>"Payment" <br/> "Amount"</p> }.into_view(),
- view! { <p>"Payment" <br/> "Date"</p> }.into_view(),
- ],
- // Table rows mapped from the fetched incoming data
- rows: incoming.iter().enumerate().take(100).map(|(_index, incoming)| {
- vec![
- view! { <p class="max-w-300">{incoming.operator_name.clone()}</p> }.into_view(),
- view! { <p>{incoming.description.clone()}</p> }.into_view(),
- view! { <p>{incoming.gross_revenue.clone()}</p> }.into_view(),
- view! { <p>{incoming.taxes.clone()}</p> }.into_view(),
- view! { <p>{incoming.deductions.clone()}</p> }.into_view(),
- view! { <p>{incoming.net_revenue.clone()}</p> }.into_view(),
- view! { <p>{incoming.payment_amount.clone()}</p> }.into_view(),
- view! { <p>{incoming.payment_date.clone()}</p> }.into_view(),
- ]
- }).collect::<Vec<_>>(),
- // Links for each row (example with Google links)
- links: vec![Some(vec!["https://www.google.com".to_string(); 4])],
- // No totals to display in the table
- has_totals: false,
- };
- // Render the table with the provided data
- view! {
- <div>
- <Table data={data_revenue_from_lease_bonuses} />
- </div>
- }
- },
- // If an error occurs while fetching data
- Some(Err(_)) => {
- log::error!("Error fetching incoming {}", incoming_by_from_lease_bonuses.rows.get().unwrap().err().unwrap());
- view! { <div><p>"Error..."</p></div> }
- },
- // If no data is available (still loading)
- None => view! {
- <div>
- <TableSkeleton />
- </div>
- },
- }
- }
- </Suspense>
- <h2 class="title-guardian-footer">"Location"</h2>
- <p class="font-georgia mb-0">"Wells by State & County."</p>
- <Suspense fallback={move || view!
- {
- <div>
- <TableSkeleton />
- </div>
- }
- }>
- {
- move ||
- // Check the result of fetching incoming location data
- match incoming_location_resource.revenue_rows.get() {
- // If incoming location data is successfully fetched
- Some(Ok(location)) => {
- // Define the table data structure
- let data_location = TableData {
- // Table headers
- headers: vec![
- view! { <p>"State"</p> }.into_view(),
- view! { <p>"County"</p> }.into_view(),
- view! { <p>"Gross"<br />"Revenue"</p> }.into_view(),
- view! { <p>"Taxes"</p> }.into_view(),
- view! { <p>"Deductions"</p> }.into_view(),
- view! { <p>"Net" <br/> "Revenue"</p> }.into_view(),
- view! { <p>"Payment" <br/> "Date"</p> }.into_view(),
- ],
- // Table rows mapped from the fetched location data
- rows: location.iter().enumerate().take(100).map(|(_index, location)| {
- vec![
- view! { <p>{location.state.clone()}</p> }.into_view(),
- view! { <p>{location.county.clone()}</p> }.into_view(),
- view! { <p>{location.gross_revenue.clone()}</p> }.into_view(),
- view! { <p>{location.taxes.clone()}</p> }.into_view(),
- view! { <p>{location.deductions.clone()}</p> }.into_view(),
- view! { <p>{location.net_revenue.clone()}</p> }.into_view(),
- view! { <p>{location.payment_date.clone()}</p> }.into_view(),
- ]
- }).collect::<Vec<_>>(),
- // Links for each row (example with Google links)
- links: vec![Some(vec!["https://www.google.com".to_string(); 4])],
- // No totals to display in the table
- has_totals: false,
- };
- // Render the table with the provided data
- view! {
- <div>
- <Table data={data_location} />
- </div>
- }
- },
- // If an error occurs while fetching data
- Some(Err(_)) => {
- log::error!("Error fetching location {}", incoming_location_resource.revenue_rows.get().unwrap().err().unwrap());
- view! { <div><p>"Error..."</p></div> }
- },
- // If no data is available (still loading)
- None => view! {
- <div>
- <TableSkeleton />
- </div>
- },
- }
- }
- </Suspense>
- <h2 class="title-guardian-footer">"Products"</h2>
- <Suspense fallback={move || view!
- {
- <div>
- <TableSkeleton />
- </div>
- }
- }>
- {move ||
- // Check the result of fetching incoming products data
- match incoming_products_resource.revenue_rows.get() {
- // If incoming products data is successfully fetched
- Some(Ok(products)) => {
- // Define the table data structure
- let data_products = TableData {
- // Table headers
- headers: vec![
- view! { <p class="max-w-300">"Product"</p> }.into_view(),
- view! { <p class="max-w-200">"Gross"<br />"Revenue"</p> }.into_view(),
- view! { <p>"Taxes"</p> }.into_view(),
- view! { <p>"Deductions"</p> }.into_view(),
- view! { <p>"Net" <br/> "Revenue"</p> }.into_view(),
- view! { <p>"Payment" <br/> "Date"</p> }.into_view(),
- ],
- // Table rows mapped from the fetched products
- rows: products.iter().enumerate().take(100).map(|(_index, product)| {
- vec![
- view! { <p class="max-w-300">{product.product.clone()}</p> }.into_view(),
- view! { <p class="max-w-200">{product.gross_revenue.clone()}</p> }.into_view(),
- view! { <p>{product.taxes.clone()}</p> }.into_view(),
- view! { <p>{product.deductions.clone()}</p> }.into_view(),
- view! { <p>{product.net_revenue.clone()}</p> }.into_view(),
- view! { <p>{product.payment_date.clone()}</p> }.into_view(),
- ]
- }).collect::<Vec<_>>(),
- // Links for each row (example with Google links)
- links: vec![Some(vec!["https://www.google.com".to_string(); 4])],
- // No totals to display in the table
- has_totals: false,
- };
- // Render the table with the provided data
- view! {
- <div>
- <Table data={data_products} />
- </div>
- }
- },
- // If an error occurs while fetching data
- Some(Err(_)) => {
- log::error!("Error fetching products {}", incoming_products_resource.revenue_rows.get().unwrap().err().unwrap());
- view! { <div><p>"Error..."</p></div> }
- },
- // If no data is available (still loading)
- None => view! {
- <div>
- <TableSkeleton />
- </div>
- },
- }
- }
- </Suspense>
- </div>
- }
- }
- ================
- File: gmm_client/src/pages/jibs.rs
- ================
- use leptos::*;
- use crate::components::filter_tables::*;
- use crate::components::table::*;
- use crate::components::table_skeleton::TableSkeleton;
- use crate::tables::jibdetails::resource::JibDetailsResource;
- use crate::tables::jibnetting::resource::JibNettingResource;
- use crate::tables::jibsummary::resource::JibSummaryResource;
- use crate::tables::revjibdetails::resource::RevJibDetailsResource;
- use crate::tables::revjibsummary::resource::RevJibSummaryResource;
- #[component]
- pub fn Jibs() -> impl IntoView {
- let jib_details_resource = JibDetailsResource::new();
- let jib_netting_resource = JibNettingResource::new();
- let jib_summary_resource = JibSummaryResource::new();
- let jib_rev_jib_details = RevJibDetailsResource::new();
- let jib_rev_jib_summary = RevJibSummaryResource::new();
- view! {
- <div class="tables">
- <h2 class="title-guardian-content">Joint Interest Billings</h2>
- <FilterTables />
- <h2 class="title-guardian-footer">Jib Netting</h2>
- <p class="font-georgia mb-0">The amount owed on your joint interest billing invoice and deducted from your revenue.</p>
- <Suspense fallback={move || view!
- {
- <div>
- <TableSkeleton />
- </div>
- }
- }>
- {move ||
- // Check the result of fetching jib netting data
- match jib_netting_resource.revenue_rows.get() {
- // If jib netting data is successfully fetched
- Some(Ok(jib_netting)) => {
- // Define the table data structure
- let dataJibNetting = TableData {
- // Table headers
- headers: vec![
- view! { <p class="max-w-300">"Operator"</p> }.into_view(),
- view! { <p class="max-w-200">"Payment" <br/> "Date"</p> }.into_view(),
- view! { <p class="max-w-200">"Netted Revenue"</p> }.into_view(),
- ],
- // Table rows mapped from the fetched jib netting
- rows: jib_netting.iter().map(|jib_netting| {
- vec![
- view! { <p>{jib_netting.operator_purchaser.clone()}</p> }.into_view(),
- view! { <p>{jib_netting.check_date.clone()}</p> }.into_view(),
- view! { <p>{jib_netting.share_net_revenue.clone()}</p> }.into_view(),
- ]
- }).collect(),
- links: vec![Some(vec!["https://www.google.com".to_string(); 4])],
- has_totals: false,
- };
- // Render the table with the provided data
- view! {
- <div>
- <Table data={dataJibNetting} />
- </div>
- }
- },
- // If an error occurs while fetching data
- Some(Err(_)) => {
- log::error!("Error fetching jib netting {}", jib_netting_resource.revenue_rows.get().unwrap().err().unwrap());
- view! { <div><p>"Error..."</p></div> }
- },
- // If no data is available (still loading)
- None => view! {
- <div>
- <TableSkeleton />
- </div>
- },
- }
- }
- </Suspense>
- <h2 class="title-guardian-footer">Jib Summary</h2>
- <p class="font-georgia mb-0">Please see all your JIBs listed here.</p>
- <Suspense fallback={move || view!
- {
- <div>
- <TableSkeleton />
- </div>
- }
- }>
- {move ||
- // Check the result of fetching jib summary data
- match jib_summary_resource.revenue_rows.get() {
- // If jib summary data is successfully fetched
- Some(Ok(jib_summary)) => {
- // Define the table data structure
- let dataJibsSummary = TableData {
- // Table headers
- headers: vec![
- view! { <p class="max-w-300">"Operator"</p> }.into_view(),
- view! { <p class="max-w-200">"Payment" <br/> "Date"</p> }.into_view(),
- view! { <p class="max-w-200">"Reference Number"</p> }.into_view(),
- view! { <p class="max-w-200">"Amount"</p> }.into_view(),
- ],
- // Table rows mapped from the fetched jib summary
- rows: jib_summary.iter().map(|jib_summary| {
- vec![
- view! { <p class="max-w-300">{jib_summary.payor.clone()}</p> }.into_view(),
- view! { <p class="max-w-200">{jib_summary.payment_date.clone()}</p> }.into_view(),
- view! { <p class="max-w-200">{jib_summary.invoice_number.clone()}</p> }.into_view(),
- view! { <p class="max-w-200">{jib_summary.total_amount.clone()}</p> }.into_view()
- ]
- }).collect(),
- links: vec![Some(vec!["https://www.google.com".to_string(); 4])],
- has_totals: false,
- };
- // Render the table with the provided data
- view! {
- <div>
- <Table data={dataJibsSummary} />
- </div>
- }
- },
- // If an error occurs while fetching data
- Some(Err(_)) => {
- log::error!("Error fetching jib summary {}", jib_summary_resource.revenue_rows.get().unwrap().err().unwrap());
- view! { <div><p>"Error..."</p></div> }
- },
- // If no data is available (still loading)
- None => view! {
- <div>
- <TableSkeleton />
- </div>
- },
- }
- }
- </Suspense>
- <h2 class="title-guardian-footer">Jib Details</h2>
- <Suspense fallback={move || view!
- {
- <div>
- <TableSkeleton />
- </div>
- }
- }>
- {move ||
- // Check the result of fetching jib details data
- match jib_details_resource.revenue_rows.get() {
- // If jib details data is successfully fetched
- Some(Ok(jib_details)) => {
- // Define the table data structure
- let dataJibsDetails = TableData {
- // Table headers
- headers: vec![
- view! { <p class="max-w-300">"Operator"</p> }.into_view(),
- view! { <p>"Payment" <br/> "Date"</p> }.into_view(),
- view! { <p class="max-w-200">"Reference Number"</p> }.into_view(),
- view! { <p>"Cost Center"</p> }.into_view(),
- view! { <p>"Venture"<br />"Number"</p> }.into_view(),
- view! { <p>"Description"</p> }.into_view(),
- view! { <p>"Amount"</p> }.into_view(),
- ],
- // Table rows mapped from the fetched jib details
- rows: jib_details.iter().map(|jib_detail| {
- vec![
- view! { <p>{jib_detail.payor.clone()}</p> }.into_view(),
- view! { <p>{jib_detail.payment_date.clone()}</p> }.into_view(),
- view! { <p class="max-w-200">{jib_detail.invoice_number.clone()}</p> }.into_view(),
- view! { <p>{jib_detail.cost_center.clone()}</p> }.into_view(),
- view! { <p>{jib_detail.venture_number.clone()}</p> }.into_view(),
- view! { <p>{jib_detail.description.clone()}</p> }.into_view(),
- view! { <p>{jib_detail.total_amount.clone()}</p> }.into_view()
- ]
- }).collect(),
- links: vec![Some(vec!["https://www.google.com".to_string(); 4])],
- has_totals: false,
- };
- // Render the table with the provided data
- view! {
- <div>
- <Table data={dataJibsDetails} />
- </div>
- }
- },
- // If an error occurs while fetching data
- Some(Err(_)) => {
- log::error!("Error fetching jib details {}", jib_details_resource.revenue_rows.get().unwrap().err().unwrap());
- view! { <div><p>"Error..."</p></div> }
- },
- // If no data is available (still loading)
- None => view! {
- <div>
- <TableSkeleton />
- </div>
- },
- }
- }
- </Suspense>
- <h2 class="title-guardian-footer">Revenue and JIB Summary</h2>
- <p class="font-georgia mb-0">Please see all your Revenue and JIBs listed here.</p>
- <Suspense fallback={move || view!
- {
- <div>
- <TableSkeleton />
- </div>
- }
- }>
- {move ||
- // Check the result of fetching revenue and JIB summary data
- match jib_rev_jib_summary.revenue_rows.get() {
- // If revenue and JIB summary data is successfully fetched
- Some(Ok(rev_jib_summary)) => {
- // Define the table data structure
- let dataRevenueAndJibsSummary = TableData {
- // Table headers
- headers: vec![
- view! { <p class="max-w-300">"Operator"</p> }.into_view(),
- view! { <p>"Net" <br/> "Revenue"</p> }.into_view(),
- view! { <p>"Jib Amount"</p> }.into_view(),
- view! { <p>"Year"</p> }.into_view(),
- ],
- // Table rows mapped from the fetched revenue and JIB summary
- rows: rev_jib_summary.iter().map(|rev_jib_summary| {
- vec![
- view! { <p class="max-w-300">{rev_jib_summary.operator_name.clone()}</p> }.into_view(),
- view! { <p>{rev_jib_summary.total_share_net_revenue.clone()}</p> }.into_view(),
- view! { <p>{rev_jib_summary.total_jib_amount.clone()}</p> }.into_view(),
- view! { <p>{rev_jib_summary.year.clone()}</p> }.into_view(),
- ]
- }).collect(),
- links: vec![Some(vec!["https://www.google.com".to_string(); 4])],
- has_totals: false,
- };
- // Render the table with the provided data
- view! {
- <div>
- <Table data={dataRevenueAndJibsSummary} />
- </div>
- }
- },
- // If an error occurs while fetching data
- Some(Err(_)) => {
- log::error!("Error fetching revenue and JIB summary {}", jib_rev_jib_summary.revenue_rows.get().unwrap().err().unwrap());
- view! { <div><p>"Error..."</p></div> }
- },
- // If no data is available (still loading)
- None => view! {
- <div>
- <TableSkeleton />
- </div>
- },
- }
- }
- </Suspense>
- <h2 class="title-guardian-footer">Revenue and JIB Details</h2>
- <p class="font-georgia">Please see all your Revenue and JIB details by well listed here.</p>
- <Suspense fallback={move || view!
- {
- <div>
- <TableSkeleton />
- </div>
- }
- }>
- {move ||
- // Check the result of fetching revenue and JIB details data
- match jib_rev_jib_details.revenue_rows.get() {
- // If revenue and JIB details data is successfully fetched
- Some(Ok(rev_jib_details)) => {
- // Define the table data structure
- let dataRevenueAndJibsDetails = TableData {
- // Table headers
- headers: vec![
- view! { <p>"Well"</p> }.into_view(),
- view! { <p>"Share Revenue"</p> }.into_view(),
- view! { <p>"Share Taxes"</p> }.into_view(),
- view! { <p>"Share Deductions"</p> }.into_view(),
- view! { <p>"Net" <br/> "Revenue"</p> }.into_view(),
- view! { <p>"JIB Amount"</p> }.into_view(),
- view! { <p>"Year"</p> }.into_view(),
- ],
- // Table rows mapped from the fetched revenue and JIB details
- rows: rev_jib_details.iter().map(|rev_jib_detail| {
- vec![
- view! { <p>{rev_jib_detail.well_name.clone()}</p> }.into_view(),
- view! { <p>{rev_jib_detail.total_share_gross_revenue.clone()}</p> }.into_view(),
- view! { <p>{rev_jib_detail.total_share_taxes.clone()}</p> }.into_view(),
- view! { <p>{rev_jib_detail.total_share_deductions.clone()}</p> }.into_view(),
- view! { <p>{rev_jib_detail.total_share_net_revenue.clone()}</p> }.into_view(),
- view! { <p>{rev_jib_detail.total_jib_amount.clone()}</p> }.into_view(),
- view! { <p>{rev_jib_detail.year.clone()}</p> }.into_view(),
- ]
- }).collect(),
- links: vec![Some(vec!["https://www.google.com".to_string(); 4])],
- has_totals: false,
- };
- // Render the table with the provided data
- view! {
- <div>
- <Table data={dataRevenueAndJibsDetails} />
- </div>
- }
- },
- // If an error occurs while fetching data
- Some(Err(_)) => {
- log::error!("Error fetching revenue and JIB details {}", jib_rev_jib_details.revenue_rows.get().unwrap().err().unwrap());
- view! { <div><p>"Error..."</p></div> }
- },
- // If no data is available (still loading)
- None => view! {
- <div>
- <TableSkeleton />
- </div>
- },
- }
- }
- </Suspense>
- </div>
- }
- }
- ================
- File: gmm_client/src/pages/leases.rs
- ================
- use leptos::*;
- use crate::{components::table::*, tables::leases::resource::LeasesResource};
- use crate::components::table_skeleton::TableSkeleton; // Import the TableSkeleton component
- #[component]
- pub fn Leases() -> impl IntoView {
- let leases_resource = LeasesResource::new();
- view! {
- <div class="tables">
- <h2 class="title-guardian-content">Leases</h2>
- <p class="font-georgia mb-0">A current listing of your owned leases.</p>
- <Suspense fallback={move || view!
- {
- <div>
- <TableSkeleton />
- </div>
- }
- }>
- {move ||
- // Check the result of fetching leases data
- match leases_resource.revenue_rows.get() {
- // If leases data is successfully fetched
- Some(Ok(lease)) => {
- // Define the table data structure
- let dataLeases = TableData {
- // Table headers
- headers: vec![
- view! { <p class="max-w-400">"Lessee"</p> }.into_view(),
- view! { <p>"Effective"</p> }.into_view(),
- view! { <p>"Expiration"</p> }.into_view(),
- view! { <p>"Term"</p> }.into_view(),
- view! { <p>"Royalty"</p> }.into_view(),
- view! { <p>"Lease Type"</p> }.into_view(),
- view! { <p>"Status"</p> }.into_view(),
- ],
- // Table rows mapped from the fetched leases
- rows: lease.iter().map(|lease| {
- vec![
- view! { <p class="max-w-400">{lease.lessee.clone()}</p> }.into_view(),
- view! { <p>{lease.effective.clone()}</p> }.into_view(),
- view! { <p>{lease.expiration.clone()}</p> }.into_view(),
- view! { <p>{lease.term.clone()}</p> }.into_view(),
- view! { <p>{lease.royalty.clone()}</p> }.into_view(),
- view! { <p>{lease.lease_type.clone()}</p> }.into_view(),
- view! { <p>{lease.status.clone()}</p> }.into_view(),
- ]
- }).collect::<Vec<_>>(),
- links: vec![Some(vec!["https://www.google.com".to_string(); 4])],
- has_totals: false,
- };
- // Render the table with the provided data
- view! {
- <div>
- <Table data={dataLeases} />
- </div>
- }
- },
- // If an error occurs while fetching data
- Some(Err(_)) => {
- log::error!("Error fetching leases {}", leases_resource.revenue_rows.get().unwrap().err().unwrap());
- view! { <div><p>"Error..."</p></div> }
- },
- // If no data is available (still loading)
- None => view! {
- <div>
- <TableSkeleton />
- </div>
- },
- }
- }
- </Suspense>
- </div>
- }
- }
- ================
- File: gmm_client/src/pages/stats.rs
- ================
- use crate::components::line_chart::*;
- use crate::components::table::*;
- use crate::components::table_skeleton::TableSkeleton;
- use crate::tables::statslistofcounts::resource::StatsListOfCountsResource;
- use crate::tables::statsproduction::resource::StatsProductionResource;
- use crate::tables::statstopoperators::resource::StatsTopOperatorsResource;
- use leptos::*;
- #[component]
- pub fn Stats() -> impl IntoView {
- let stats_production_resource = StatsProductionResource::new();
- let stats_top_operators_resource = StatsTopOperatorsResource::new();
- let stats_list_of_counts_resource = StatsListOfCountsResource::new();
- view! {
- <div class="tables">
- <h2 class="title-guardian-content">Stats</h2>
- <p class="font-georgia">These are your top operators for the month of <strong>2024-04.</strong></p>
- <p class="font-georgia mb-0">The Exponential Mean is the average revenue on a log scale and scatter is how dispersed the revenue payment amounts are for each operator.</p>
- <Suspense fallback={move || view!
- {
- <div>
- <TableSkeleton />
- </div>
- }
- }>
- {move ||
- // Check the result of fetching top operators data
- match stats_top_operators_resource.top_operators.get() {
- // If top operators data is successfully fetched
- Some(Ok(operator)) => {
- // Define the table data structure
- let dataTopOperators = TableData {
- // Table headers
- headers: vec![
- view! { <p class="min-w-200">"Operator"</p> }.into_view(),
- view! { <p>"Owner Net Revenue"</p> }.into_view(),
- view! { <p>"Exponential Mean"</p> }.into_view(),
- view! { <p>"Scatter"</p> }.into_view(),
- ],
- // Table rows mapped from the fetched top operators data
- rows: operator.iter().map(|operator| {
- vec![
- view! { <p>{operator.operator_purchaser.clone()}</p> }.into_view(),
- view! { <p>{operator.owner_net_revenue.clone()}</p> }.into_view(),
- view! { <p>{operator.exponential_mean.clone()}</p> }.into_view(),
- view! { <p>{operator.scatter.clone()}</p> }.into_view(),
- ]
- }).collect(),
- links: vec![Some(vec!["https://www.google.com".to_string(); 4])],
- has_totals: false,
- };
- // Render the table with the provided data
- view! {
- <div>
- <Table data={dataTopOperators} />
- </div>
- }
- },
- // If an error occurs while fetching data
- Some(Err(_)) => {
- log::error!("Error fetching leases {}", stats_top_operators_resource.top_operators.get().unwrap().err().unwrap());
- view! { <div><p>"Error..."</p></div> }
- },
- // If the data is still loading
- None => {
- view! {
- <div>
- <TableSkeleton />
- </div>
- }
- }
- } }
- </Suspense>
- <h2 class="title-guardian-footer">Summary List of Counts</h2>
- <Suspense fallback={move || view!
- {
- <div class="w-176 h-126 skeleton" />
- }
- }>
- {move ||
- // Check the result of fetching summary list of counts data
- match stats_list_of_counts_resource.stats_rows.get() {
- // If summary list of counts data is successfully fetched
- Some(Ok(counts)) => {
- view! {
- <div>
- <table class="table-contacts">
- {
- counts.iter().map(|count| {
- view! {
- <tr>
- <td class="font-georgia"><p>"Number of States"</p></td>
- <td class="font-georgia text-right"><p>{count.number_of_states.clone()}</p></td>
- </tr>
- <tr>
- <td class="font-georgia"><p>"Number of Counties"</p></td>
- <td class="font-georgia text-right"><p>{count.number_of_counties.clone()}</p></td>
- </tr>
- <tr>
- <td class="font-georgia"><p>"Number of Assets"</p></td>
- <td class="font-georgia text-right"><p>{count.number_of_assets.clone()}</p></td>
- </tr>
- <tr>
- <td class="font-georgia"><p>"Number of Leases"</p></td>
- <td class="font-georgia text-right"><p>{count.number_of_leases.clone()}</p></td>
- </tr>
- <tr>
- <td class="font-georgia"><p>"Number of Wells"</p></td>
- <td class="font-georgia text-right"><p>{count.number_of_wells.clone()}</p></td>
- </tr>
- }
- }).collect::<Vec<_>>()
- }
- </table>
- </div>
- }
- },
- // If an error occurs while fetching data
- Some(Err(_)) => {
- log::error!("Error fetching leases {}", stats_list_of_counts_resource.stats_rows.get().unwrap().err().unwrap());
- view! { <div><p>"Error..."</p></div> }
- },
- // If no data is available (still loading)
- None => view! {
- <div>
- </div>
- },
- } }
- </Suspense>
- <h2 class="title-guardian-footer">Spot Prices</h2>
- <div class="d-flex flex-column justify-content-center align-items-center gap-2">
- <LineChart
- title="Europe Brent FOB Price Trend — USD per barrel".to_string()
- image_url="/europe.png".to_string()
- />
- <LineChart
- title="Henry Hub Natural Gas FOB Price Trend — USD per million BTU".to_string()
- image_url="/henry.png".to_string()
- />
- <LineChart
- title="WTI Cushing OK FOB Price Trend — USD per barrel".to_string()
- image_url="/wti.png".to_string()
- />
- <LineChart
- title="U.S. Natural Gas Liquid Composite FOB Price Trend — USD per million BTU".to_string()
- image_url="/us.png".to_string()
- />
- </div>
- <h2 class="mt-5 title-guardian-footer">Production Statistics</h2>
- <p class="font-georgia">This table presents production statistics on the period from November 1st, 2019 through the end of the current reporting month.</p>
- <Suspense fallback={move || view!
- {
- <div>
- <TableSkeleton />
- </div>
- }
- }>
- {move ||
- // Check the result of fetching stats production data
- match stats_production_resource.stats_rows.get() {
- // If stats production data is successfully fetched
- Some(Ok(stats)) => {
- // Define the table data structure
- let dataStatsProduction = TableData {
- // Table headers
- headers: vec![
- view! { <p>"Product"</p> }.into_view(),
- view! { <p>"Ave Price"<br />"Min Price"<br />"Max Price"<br />"Volatility"</p> }.into_view(),
- view! { <p>"Ave Prod Rate *"<br />"Min Prod Rate *"<br />"Max Prod Rate *"<br />"Volatility"</p> }.into_view(),
- view! { <p>"Gross"<br />"Ave Rate *"</p> }.into_view(),
- ],
- // Table rows mapped from the fetched stats production data
- rows: stats.iter().map(|stat| {
- vec![
- view! { <p>{stat.product.clone()}</p> }.into_view(),
- view! { <p>{stat.avg_price.clone()}<br />{stat.min_price.clone()}<br />{stat.max_price.clone()}<br />{stat.price_volatility.clone()}</p> }.into_view(),
- view! { <p>{stat.avg_prod_rate.clone()}<br />{stat.min_prod_rate.clone()}<br />{stat.max_prod_rate.clone()}<br />{stat.prod_volatility.clone()}</p> }.into_view(),
- view! { <p>{stat.gross_avg_rate.clone()}<br />{stat.avg_prod_rate.clone()}</p> }.into_view(),
- ]
- }).collect(),
- links: vec![Some(vec!["https://www.google.com".to_string(); 4])],
- has_totals: false,
- };
- // Render the table with the provided data
- view! {
- <div>
- <Table data={dataStatsProduction} />
- </div>
- }
- },
- // If an error occurs while fetching data
- Some(Err(_)) => {
- log::error!("Error fetching leases {}", stats_production_resource.stats_rows.get().unwrap().err().unwrap());
- view! { <div><p>"Error..."</p></div> }
- },
- // If the data is still loading
- None => {
- view! {
- <div>
- <TableSkeleton />
- </div>
- }
- }
- } }
- </Suspense>
- <p class="font-georgia">* The bottom two statistics are presented as average daily production mil rates rather than the more common month s production value. The units are thousandths of units of production per day and thousandths of U.S. dollars per day respectively. As months lengths may vary, changes over time may more accurately be compared using the daily production rate as the production metric. The gross average rate in the fourth column is an indicator of the rate at which you acquire gross revenue. It is your share of the income per day, calculated by multiplying price, volume per day times, and the mil factor of 1,000.</p>
- <p class="font-georgia">The abbreviations "ave", "min", and "max" are average (mean), minimum, and maximum over the course of the reporting period.</p>
- <p class="font-georgia">Volatility, the bottom most statistic in each row, has been evaluated relative to price. This practice is called normalization, allowing volatility to be rationally compared between energy products. Volatility is shown as the quotient of the standard deviation over the mean. Although some reporting products do not divide by the mean, such would be a conceptual error for a table like this one. The units of a standard deviation are the same as that of the mean, so the quotient is unitless. Comparison of volatility requires the value to be unitless so that it is free from physical unit designations, which vary in economic meaning from product to product.</p>
- </div>
- }
- }
- ================
- File: gmm_client/src/pages/tax_year.rs
- ================
- use leptos::*;
- use crate::components::table::*;
- use crate::components::table_skeleton::TableSkeleton;
- use crate::tables::taxyearfullyeartotals::resource::TaxYearFullYearTotalsResource;
- use crate::tables::taxyearinterestbystate::resource::TaxYearInterestByStateResource;
- use crate::tables::taxyearrevenueand1099s::resource::TaxYearRevenueAnd1099sResource;
- use crate::tables::taxyearwellsbystate::resource::TaxYearWellsByStateResource;
- use crate::tables::taxyear1099details::resource::TaxYear1099DetailsResource;
- #[component]
- pub fn TaxYear() -> impl IntoView {
- let tax_year_1099_details_resource = TaxYear1099DetailsResource::new();
- let tax_year_full_year_totals_resource = TaxYearFullYearTotalsResource::new();
- let tax_year_interest_by_state_resource = TaxYearInterestByStateResource::new();
- let tax_year_revenue_and_1099s_resource = TaxYearRevenueAnd1099sResource::new();
- let tax_year_wells_by_state_resource = TaxYearWellsByStateResource::new();
- view! {
- <div class="tables">
- <h2 class="title-guardian-content">Tax Year</h2>
- <h2 class="title-guardian-footer">Your 2024 Full Year Totals</h2>
- <Suspense fallback={move || view!
- {
- <div class="w-176 h-126 skeleton" />
- }
- }>
- {
- move ||
- match tax_year_full_year_totals_resource.totals_rows.get() {
- Some(Ok(data)) => {
- view! {
- <div>
- <table class="table-contacts">
- {
- data.into_iter().map(|row| view! {
- <tr>
- <td class="font-georgia"><p>"Gross Revenue"</p></td>
- <td class="font-georgia text-right"><p>{row.gross_share}</p></td>
- </tr>
- <tr>
- <td class="font-georgia"><p>"Share Taxes"</p></td>
- <td class="font-georgia text-right"><p>{row.share_taxes}</p></td>
- </tr>
- <tr>
- <td class="font-georgia"><p>"Share Deductions"</p></td>
- <td class="font-georgia text-right"><p>{row.share_deductions}</p></td>
- </tr>
- <tr>
- <td class="font-georgia"><p>"Net" <br/> "Revenue"</p></td>
- <td class="font-georgia text-right"><p>{row.net_revenue}</p></td>
- </tr>
- <tr>
- <td class="font-georgia"><p>"JIBs"</p></td>
- <td class="font-georgia text-right"><p>{row.jibs}</p></td>
- </tr>
- }).collect_view()
- }
- </table>
- </div>
- }
- },
- Some(Err(_)) => {
- view! { <div><p>"Error loading data"</p></div> }
- },
- None => {
- view! { <div><p>"Loading data..."</p></div> }
- }
- }
- }
- </Suspense>
- <h2 class="title-guardian-footer">Wells by State for the year 2024</h2>
- <Suspense fallback={move || view!
- {
- <div>
- <TableSkeleton />
- </div>
- }
- }>
- {
- move || {
- match tax_year_wells_by_state_resource.rows.get() {
- Some(Ok(data)) => {
- let data_table = TableData {
- headers: vec![
- view! { <p>"State"</p> }.into_view(),
- view! { <p>"Gross"<br />"Revenue"</p> }.into_view(),
- view! { <p>"Taxes"</p> }.into_view(),
- view! { <p>"Deductions"</p> }.into_view(),
- view! { <p>"Net" <br/> "Revenue"</p> }.into_view(),
- view! { <p>"Percentage of Portfolio"</p> }.into_view(),
- ],
- rows: data.iter().map(|row| {
- vec![
- view! { <p>{row.state.clone()}</p> }.into_view(),
- view! { <p>{row.gross_revenue.clone()}</p> }.into_view(),
- view! { <p>{row.taxes.clone()}</p> }.into_view(),
- view! { <p>{row.deductions.clone()}</p> }.into_view(),
- view! { <p>{row.net_revenue.clone()}</p> }.into_view(),
- view! { <p>{row.percentage_of_portfolio.clone()}</p> }.into_view(),
- ]
- }).collect(),
- links: vec![None],
- has_totals: false,
- };
- view! {
- <div>
- <Table
- data={data_table}
- />
- </div>
- }
- },
- Some(Err(_)) => {
- view! {
- <div>
- <p>"Error loading data"</p>
- </div>
- }
- },
- None => {
- view! {
- <div>
- <p>"Loading data..."</p>
- </div>
- }
- }
- }
- }
- }
- </Suspense>
- // <Table data={dataWell} />
- <h2 class="title-guardian-footer">Interest by State for the year 2024</h2>
- <Suspense fallback={move || view!
- {
- <div>
- <TableSkeleton />
- </div>
- }
- }>
- {
- move || {
- match tax_year_interest_by_state_resource.state_rows.get() {
- Some(Ok(data)) => {
- let data_table = TableData {
- headers: vec![
- view! { <p>"State"</p> }.into_view(),
- view! { <p>"Gross"<br />"Revenue"</p> }.into_view(),
- view! { <p>"Taxes"</p> }.into_view(),
- view! { <p>"Deductions"</p> }.into_view(),
- view! { <p>"Net" <br/> "Revenue"</p> }.into_view(),
- view! { <p>"Percentage of Portfolio"</p> }.into_view(),
- ],
- rows: data.iter().map(|row| {
- vec![
- view! { <p>{row.state.clone()}</p> }.into_view(),
- view! { <p>{row.gross_revenue.clone()}</p> }.into_view(),
- view! { <p>{row.taxes.clone()}</p> }.into_view(),
- view! { <p>{row.deductions.clone()}</p> }.into_view(),
- view! { <p>{row.net_revenue.clone()}</p> }.into_view(),
- view! { <p>{row.interest_type.clone()}</p> }.into_view(),
- ]
- }).collect(),
- links: vec![None],
- has_totals: false,
- };
- view! {
- <div>
- <Table
- data={data_table}
- />
- </div>
- }
- },
- Some(Err(_)) => {
- view! {
- <div>
- <p>"Error loading data"</p>
- </div>
- }
- },
- None => {
- view! {
- <div>
- <p>"Loading data..."</p>
- </div>
- }
- }
- }
- }
- }
- </Suspense>
- // <Table data={dataInterest} />
- <h2 class="title-guardian-footer">1099 Details</h2>
- <p class="font-georgia mb-0">These amounts are based on operator (payor) reporting through 2024-03-01.</p>
- <Suspense fallback={move || view!
- {
- <div>
- <TableSkeleton />
- </div>
- }
- }>
- {
- move || {
- match tax_year_1099_details_resource.details_rows.get() {
- Some(Ok(data)) => {
- let data_table = TableData {
- headers: vec![
- view! { <p>"Payer"</p> }.into_view(),
- view! { <p>"TIN"</p> }.into_view(),
- view! { <p>"Box #"</p> }.into_view(),
- view! { <p>"Box Name"</p> }.into_view(),
- view! { <p>"Reported"</p> }.into_view(),
- ],
- rows: data.iter().map(|row| {
- vec![
- view! { <p>{row.payee.clone()}</p> }.into_view(),
- view! { <p>{row.tin.clone()}</p> }.into_view(),
- view! { <p>{row.box_number.clone()}</p> }.into_view(),
- view! { <p>{row.box_name.clone()}</p> }.into_view(),
- view! { <p>{row.reported_amount.clone()}</p> }.into_view(),
- ]
- }).collect(),
- links: vec![None],
- has_totals: false,
- };
- view! {
- <div>
- <Table
- data={data_table}
- />
- </div>
- }
- },
- Some(Err(_)) => {
- view! {
- <div>
- <p>"Error loading data"</p>
- </div>
- }
- },
- None => {
- view! {
- <div>
- <p>"Loading data..."</p>
- </div>
- }
- }
- }
- }
- }
- </Suspense>
- // <Table data={data1099} />
- <h2 class="title-guardian-footer">Revenue and 1099 Totals for the year 2024</h2>
- <p class="font-georgia mb-0">Operators with revenue under $600 have been marked with an asterisk. IRS Form 1099-MISC does not require reporting of income under $600.</p>
- <Suspense fallback={move || view!
- {
- <div>
- <TableSkeleton />
- </div>
- }
- }>
- {
- move || {
- match tax_year_revenue_and_1099s_resource.rows.get() {
- Some(Ok(data)) => {
- let data_table = TableData {
- headers: vec![
- view! { <p class="min-w-200">"Operator"</p> }.into_view(),
- view! { <p>"Gross"<br />"Revenue"</p> }.into_view(),
- view! { <p>"Taxes"</p> }.into_view(),
- view! { <p>"Deducts"</p> }.into_view(),
- view! { <p>"Net"<br />"Revenue"</p> }.into_view(),
- view! { <p>"1099"<br />"Amount"</p> }.into_view(),
- view! { <p>"Difference"<br />"($)"</p> }.into_view(),
- view! { <p>"Difference"<br />"(%)"</p> }.into_view(),
- view! { <p>"Material Difference (over"<br />"25%)"</p> }.into_view(),
- ],
- rows: data.iter().map(|row| {
- vec![
- view! { <p>{row.operator.clone()}</p> }.into_view(),
- view! { <p>{row.gross_revenue.clone()}</p> }.into_view(),
- view! { <p>{row.taxes.clone()}</p> }.into_view(),
- view! { <p>{row.deducts.clone()}</p> }.into_view(),
- view! { <p>{row.net_revenue.clone()}</p> }.into_view(),
- view! { <p>{row.amount_1099.clone()}</p> }.into_view(),
- view! { <p>{row.difference_dollars.clone()}</p> }.into_view(),
- view! { <p>{row.difference_percent.clone()}</p> }.into_view(),
- view! { <p>{row.material_difference.clone()}</p> }.into_view(),
- ]
- }).collect(),
- links: vec![None],
- has_totals: false,
- };
- view! {
- <div>
- <Table
- data={data_table}
- />
- </div>
- }
- },
- Some(Err(_)) => {
- view! {
- <div>
- <p>"Error loading data"</p>
- </div>
- }
- },
- None => {
- view! {
- <div>
- <p>"Loading data..."</p>
- </div>
- }
- }
- }
- }
- }
- </Suspense>
- // <Table data={dataRevenueAnd1099} />
- <p class="disclaimer mb-0">
- The above values are as reported prior to the generation of this view. Discrepancies found after all visualizations through December 2023 are accounted for (with respect to all wells for which your interest is known) will be investigated.
- Guardian recommends you use the 1099 information as is for your tax filings unless your CPA, licensed accounting firm, or IRS savvy legal professional recommends otherwise.
- Issues in the 1099 amounts can be resolved when full documentation indicating any inaccuracies becomes available to assemble as a complete set of evidence.
- </p>
- </div>
- }
- }
- // <Table data={dataRevenueAnd1099} />
- ================
- File: gmm_client/src/pages/well_rev.rs
- ================
- use crate::components::table::*;
- use crate::tables::wellrev::resource::WellRevResource;
- use crate::components::table_skeleton::TableSkeleton; // Import the TableSkeleton component
- use leptos::*;
- #[component]
- pub fn WellRev() -> impl IntoView {
- let well_rev_resource = WellRevResource::new();
- // let dataWellRev = TableData {
- // headers: vec![
- // view! { <p>"Operator"</p> }.into_view(),
- // view! { <p>"Well/Property"<br />"Name"</p> }.into_view(),
- // view! { <p>"Well Number"</p> }.into_view(),
- // view! { <p>"Production"<br />"Date"</p> }.into_view(),
- // view! { <p>"Product"</p> }.into_view(),
- // view! { <p>"Unit"<br />"Price"</p> }.into_view(),
- // view! { <p>"Pie"<br />"Gross"<br />"Volume"</p> }.into_view(),
- // view! { <p>"Owner"<br />"Proportion"</p> }.into_view(),
- // view! { <p>"Share"<br />"Revenue"</p> }.into_view(),
- // view! { <p>"Share"<br />"Taxes"</p> }.into_view(),
- // view! { <p>"Share"<br />"Deductions"</p> }.into_view(),
- // view! { <p>"Net"<br />"Revenue"</p> }.into_view(),
- // ],
- // rows: vec![
- // vec![
- // view! { <p>"Operator 1"</p> }.into_view(),
- // view! { <p>"Well 1"</p> }.into_view(),
- // view! { <p>"42-485-32001"</p> }.into_view(),
- // view! { <p>"2024-04-01"</p> }.into_view(),
- // view! { <p>"Oil"</p> }.into_view(),
- // view! { <p>"50.00"</p> }.into_view(),
- // view! { <p>"1000"</p> }.into_view(),
- // view! { <p>"0.50"</p> }.into_view(),
- // view! { <p>"500.00"</p> }.into_view(),
- // view! { <p>"50.00"</p> }.into_view(),
- // view! { <p>"25.00"</p> }.into_view(),
- // view! { <p>"425.00"</p> }.into_view(),
- // ],
- // vec![
- // view! { <p>"Totals"</p> }.into_view(),
- // view! { <p>"Well 1"</p> }.into_view(),
- // view! { <p>"42-485-32001"</p> }.into_view(),
- // view! { <p>"2024-04-01"</p> }.into_view(),
- // view! { <p>"Oil"</p> }.into_view(),
- // view! { <p>"50.00"</p> }.into_view(),
- // view! { <p>"1000"</p> }.into_view(),
- // view! { <p>"0.50"</p> }.into_view(),
- // view! { <p>"500.00"</p> }.into_view(),
- // view! { <p>"50.00"</p> }.into_view(),
- // view! { <p>"25.00"</p> }.into_view(),
- // view! { <p>"425.00"</p> }.into_view(),
- // ]
- // ],
- // links: vec![
- // Some(vec!["https://www.google.com".to_string(); 4]);2
- // ],
- // has_totals: true
- // };
- view! {
- <div class="tables">
- <h2 class="title-guardian-content">Well Revenue (US$)</h2>
- <p class="font-georgia mb-0">A current listing of your wells for the month of <strong>2024-04.</strong></p>
- <Suspense fallback={move || view! {
- <div>
- <TableSkeleton />
- </div>
- }}>
- {move ||
- // Check the result of fetching well operations data
- match well_rev_resource.rows.get() {
- // If well operations data is successfully fetched
- Some(Ok(well_revs)) => {
- // Define the table data structure
- let dataWellRev = TableData {
- // Table headers
- headers: vec![
- view! { <p class="max-w-200">"Operator"</p> }.into_view(),
- view! { <p class="max-w-200">"Well/Property"<br />"Name"</p> }.into_view(),
- view! { <p class="max-w-200">"Well Number"</p> }.into_view(),
- view! { <p class="max-w-200">"Production"<br />"Date"</p> }.into_view(),
- view! { <p class="max-w-200">"Product"</p> }.into_view(),
- view! { <p class="max-w-200">"Unit"<br />"Price"</p> }.into_view(),
- view! { <p class="max-w-200">"Pie"<br />"Gross"<br />"Volume"</p> }.into_view(),
- view! { <p class="max-w-200">"Owner"<br />"Proportion"</p> }.into_view(),
- view! { <p class="max-w-200">"Share"<br />"Revenue"</p> }.into_view(),
- view! { <p class="max-w-200">"Share"<br />"Taxes"</p> }.into_view(),
- view! { <p class="max-w-200">"Share"<br />"Deductions"</p> }.into_view(),
- view! { <p class="max-w-200">"Net"<br />"Revenue"</p> }.into_view(),
- ],
- // Table rows mapped from the fetched well revenue
- rows: well_revs.iter().map(|well_rev| {
- vec![
- view! { <p class="max-w-200">{well_rev.operator.clone()}</p> }.into_view(),
- view! { <p class="max-w-200">{well_rev.well_property_name.clone()}</p> }.into_view(),
- view! { <p class="max-w-200">{well_rev.well_number.clone()}</p> }.into_view(),
- view! { <p class="max-w-200">{well_rev.production_date.clone()}</p> }.into_view(),
- view! { <p class="max-w-200">{well_rev.product.clone()}</p> }.into_view(),
- view! { <p class="max-w-200">{well_rev.unit_price.clone()}</p> }.into_view(),
- view! { <p class="max-w-200">{well_rev.pie_gross_volume.clone()}</p> }.into_view(),
- view! { <p class="max-w-200">{well_rev.owner_proportion.clone()}</p> }.into_view(),
- view! { <p class="max-w-200">{well_rev.share_revenue.clone()}</p> }.into_view(),
- view! { <p class="max-w-200">{well_rev.share_taxes.clone()}</p> }.into_view(),
- view! { <p class="max-w-200">{well_rev.share_deductions.clone()}</p> }.into_view(),
- view! { <p class="max-w-200">{well_rev.net_revenue.clone()}</p> }.into_view(),
- ]
- }).collect::<Vec<_>>(),
- links: vec![Some(vec!["https://www.google.com".to_string(); 4])],
- has_totals: false,
- };
- // Render the table with the provided data
- view! {
- <div>
- <Table data={dataWellRev} />
- </div>
- }
- },
- // If an error occurs while fetching data
- Some(Err(_)) => {
- // Handle error case (e.g., show an error message)
- view! {
- <div class="error-message">
- "Error fetching well rev data."
- </div>
- }
- },
- None => {
- // Loading state or initial state before data is fetched
- view! {
- <div class="loading-message">
- "Loading..."
- </div>
- }
- },
- }
- }
- </Suspense>
- </div>
- }
- }
- ================
- File: gmm_client/src/pages/year_to_date.rs
- ================
- use leptos::*;
- use crate::components::table::*;
- use crate::components::table_skeleton::TableSkeleton;
- use crate::tables::ytdcurrentyear::resource::YTDCurrentYearResource;
- use crate::tables::ytdpasttaxyear::resource::YtdPastTaxYearResource;
- use crate::tables::ytdpfibyoperator::resource::YtdPfiByOperatorResource;
- use crate::tables::ytdpfibyproduct::resource::YtdPfiByProductResource;
- use crate::tables::ytdrevenuebyoperator::resource::YtdRevenueByOperatorResource;
- use crate::tables::ytdcurrentyear::query::YTDCurrentYearRow;
- use crate::tables::ytdpasttaxyear::query::YTDPastTaxYearRow;
- use crate::tables::ytdpfibyoperator::query::YTDPFIByOperatorRow;
- use crate::tables::ytdpfibyproduct::query::YTDPFIByProductRow;
- use crate::tables::ytdrevenuebyoperator::query::YTDRevenueByOperatorRow;
- #[component]
- pub fn YearToDate() -> impl IntoView {
- // let data = create_data();
- // let dataYourShare = create_data_your_share();
- // let dataOperator = create_data_operator();
- // let dataProjectedFutureIncomeByProduct = create_data_projected_future_income_by_product();
- // let dataProjectedFutureIncomeByOperator = create_data_projected_future_income_by_operator();
- let ytd_current_resource = YTDCurrentYearResource::new();
- let ytd_past_tax_year_resource = YtdPastTaxYearResource::new();
- let ytd_pfi_by_operator_resource = YtdPfiByOperatorResource::new();
- let ytd_pfi_by_product_resource = YtdPfiByProductResource::new();
- let ytd_revenue_by_operator_resource = YtdRevenueByOperatorResource::new();
- view! {
- <div class="tables">
- <h2 class="title-guardian-content">Year To Date</h2>
- <p class="font-georgia mb-0">The current year for which Guardian has been provided with reasonably complete information by you, operators, purchasers, government offices, and data aggregators.</p>
- <Suspense fallback={move || view!
- {
- <div>
- <TableSkeleton />
- </div>
- }
- }>
- {
- move ||
- match ytd_current_resource.rows.get() {
- Some(Ok(rows)) => {
- let dataYtdCurrent = create_ytd_current_data(&rows);
- view! {
- <div>
- <Table data={dataYtdCurrent} />
- </div>
- }
- },
- Some(Err(_)) => {
- view! {
- <div>
- <p>"Error loading data"</p>
- </div>
- }
- },
- None => {
- view! {
- <div>
- <p>"Loading data..."</p>
- </div>
- }
- }
- }
- }
- </Suspense>
- <h2 class="title-guardian-content">Your Share for Each Month of 2024</h2>
- <p class="font-georgia mb-0">These amounts are based on operator reporting for each month of the past tax year.</p>
- <Suspense fallback={move || view! {
- <div>
- <TableSkeleton />
- </div>
- }}>
- {
- move ||
- match ytd_past_tax_year_resource.rows.get() {
- Some(Ok(rows)) => {
- let dataYtdPastTaxYear = create_ytd_past_tax_year_data(&rows);
- view! {
- <div>
- <Table data={dataYtdPastTaxYear} />
- </div>
- }
- },
- Some(Err(_)) => {
- view! {
- <div>
- <p>"Error loading data"</p>
- </div>
- }
- },
- None => {
- view! {
- <div>
- <p>"Loading data..."</p>
- </div>
- }
- }
- }
- }
- </Suspense>
- // <Table data={dataYourShare} />
- <h2 class="title-guardian-content">Revenue by Operator</h2>
- <p class="font-georgia mb-0">Your revenue to date by operator for the current year.</p>
- <Suspense fallback={move || view! {
- <div>
- <TableSkeleton />
- </div>
- }}>
- {
- move ||
- match ytd_revenue_by_operator_resource.rows.get() {
- Some(Ok(rows)) => {
- let dataYtdRevenueByOperator = create_ytd_revenue_by_operator_data(&rows);
- view! {
- <div>
- <Table data={dataYtdRevenueByOperator} />
- </div>
- }
- },
- Some(Err(_)) => {
- view! {
- <div>
- <p>"Error loading data"</p>
- </div>
- }
- },
- None => {
- view! {
- <div>
- <p>"Loading data..."</p>
- </div>
- }
- }
- }
- }
- </Suspense>
- // <Table data={dataOperator} />
- <h2 class="title-guardian-content">Year To Date</h2>
- <p class="font-georgia font-bold">
- The purpose of these tables is to provide a visual representation of the potential cash flow of your asset base at various commodity price ranges. These tables will better assist you in conservatively estimating the potential future gains or losses of your asset base, given the fluctuation in commodity prices. Please note, these tables are used only for projection purposes and are not provided to determine or to predict actual future value. Also, please remember these assets are both depleting and highly subject to operational and geopolitical issues as well as national and global supply chain issues.
- </p>
- <h2 class="title-guardian-content">Projected Future Income by Product</h2>
- <p class="font-georgia mb-0">
- This is the actual one month revenue average of these commodities for the presented timeframes.
- </p>
- <Suspense fallback={move || view! {
- <div>
- <TableSkeleton />
- </div>
- }}>
- {
- move ||
- match ytd_pfi_by_product_resource.rows.get() {
- Some(Ok(rows)) => {
- let dataYtdPfiByProduct = create_ytd_pfi_by_product_data(&rows);
- view! {
- <div>
- <Table data={dataYtdPfiByProduct} />
- </div>
- }
- },
- Some(Err(_)) => {
- view! {
- <div>
- <p>"Error loading data"</p>
- </div>
- }
- },
- None => {
- view! {
- <div>
- <p>"Loading data..."</p>
- </div>
- }
- }
- }
- }
- </Suspense>
- // <Table data={dataProjectedFutureIncomeByProduct} />
- <h2 class="title-guardian-content">Projected Future Income by Operator</h2>
- <p class="font-georgia">
- These revenue and volume averages are a one month mathematical average based on a 12 month prior period, while showing an example of what different commodity prices in the future could look like.
- </p>
- <p class="font-georgia mb-0">
- This information could be skewed by other products and anomalous data.
- </p>
- <Suspense fallback={move || view! {
- <div>
- <TableSkeleton />
- </div>
- }}>
- {
- move ||
- match ytd_pfi_by_operator_resource.rows.get() {
- Some(Ok(rows)) => {
- let dataYtdPfiByOperator = create_ytd_pfi_by_operator_data(&rows);
- view! {
- <div>
- <Table data={dataYtdPfiByOperator} />
- </div>
- }
- },
- Some(Err(_)) => {
- view! {
- <div>
- <p>"Error loading data"</p>
- </div>
- }
- },
- None => {
- view! {
- <div>
- <p>"Loading data..."</p>
- </div>
- }
- }
- }
- }
- </Suspense>
- // <Table data={dataProjectedFutureIncomeByOperator} />
- </div>
- }
- }
- fn create_ytd_current_data(rows: &Vec<YTDCurrentYearRow>) -> TableData {
- TableData {
- headers: vec![
- view! { <p>"Month"</p> }.into_view(),
- view! { <p>"Gross"<br />"Revenue"</p> }.into_view(),
- view! { <p>"Taxes"</p> }.into_view(),
- view! { <p>"Deductions"</p> }.into_view(),
- view! { <p>"Depletion" <br/> "15%"</p> }.into_view(),
- view! { <p>"Net" <br/> "Revenue"</p> }.into_view(),
- view! { <p>"Net Post-"<br />"Depletion" <br/> "15%"</p> }.into_view(),
- view! { <p>"Depletion"<br />"27.5%"</p> }.into_view(),
- view! { <p>"Net Post-"<br />"Depletion"<br />"27.5%"</p> }.into_view(),
- ],
- rows: rows.iter().map(|row| {
- vec![
- view! { <p>{row.month.clone()}</p> }.into_view(),
- view! { <p>{row.gross_revenue.clone()}</p> }.into_view(),
- view! { <p>{row.taxes.clone()}</p> }.into_view(),
- view! { <p>{row.deductions.clone()}</p> }.into_view(),
- view! { <p>{row.net_revenue.clone()}</p> }.into_view(),
- view! { <p>{row.depletion_15.clone()}</p> }.into_view(),
- view! { <p>{row.net_post_depletion_15.clone()}</p> }.into_view(),
- view! { <p>{row.depletion_275.clone()}</p> }.into_view(),
- view! { <p>{row.net_post_depletion_275.clone()}</p> }.into_view(),
- ]
- }).collect::<Vec<_>>(),
- links: vec![None, None],
- has_totals: true,
- }
- }
- fn create_ytd_past_tax_year_data(rows: &Vec<YTDPastTaxYearRow>) -> TableData {
- TableData {
- headers: vec![
- view! { <p>"Month"</p> }.into_view(),
- view! { <p>"Gross"<br />"Revenue"</p> }.into_view(),
- view! { <p>"Taxes"</p> }.into_view(),
- view! { <p>"Deductions"</p> }.into_view(),
- view! { <p>"Net" <br/> "Revenue"</p> }.into_view(),
- view! { <p>"Depletion" <br/> "15%"</p> }.into_view(),
- view! { <p>"Net Post-"<br />"Depletion" <br/> "15%"</p> }.into_view(),
- view! { <p>"Depletion"<br />"27.5%"</p> }.into_view(),
- view! { <p>"Net Post-"<br />"Depletion"<br />"27.5%"</p> }.into_view(),
- ],
- rows: rows.iter().map(|row| {
- vec![
- view! { <p>{row.month.clone()}</p> }.into_view(),
- view! { <p>{row.gross_revenue.clone()}</p> }.into_view(),
- view! { <p>{row.taxes.clone()}</p> }.into_view(),
- view! { <p>{row.deductions.clone()}</p> }.into_view(),
- view! { <p>{row.net_revenue.clone()}</p> }.into_view(),
- view! { <p>{row.depletion_15.clone()}</p> }.into_view(),
- view! { <p>{row.net_post_depletion_15.clone()}</p> }.into_view(),
- view! { <p>{row.depletion_275.clone()}</p> }.into_view(),
- view! { <p>{row.net_post_depletion_275.clone()}</p> }.into_view(),
- ]
- }).collect::<Vec<_>>(),
- links: vec![None, None],
- has_totals: true,
- }
- }
- fn create_ytd_pfi_by_operator_data(rows: &Vec<YTDPFIByOperatorRow>) -> TableData {
- TableData {
- headers: vec![
- view! { <p>"Operator"</p> }.into_view(),
- view! { <p>"Oil"<br />"Volume"<br />"(bbl)"</p> }.into_view(),
- view! { <p>"Natural Gas"<br />"Volume"<br />"(mcf)"</p> }.into_view(),
- view! { <p>"Oil"<br />"Revenue"<br />"$60"</p> }.into_view(),
- view! { <p>"Oil"<br />"Revenue"<br />"$75"</p> }.into_view(),
- view! { <p>"Oil"<br />"Revenue"<br />"$90"</p> }.into_view(),
- view! { <p>"Gas"<br />"Revenue"<br />"$2"</p> }.into_view(),
- view! { <p>"Gas"<br />"Revenue"<br />"$2.50"</p> }.into_view(),
- view! { <p>"Gas"<br />"Revenue"<br />"$3"</p> }.into_view(),
- ],
- rows: rows.iter().map(|row| {
- vec![
- view! { <p>{row.operator_purchaser.clone()}</p> }.into_view(),
- view! { <p>{row.oil_volume.clone()}</p> }.into_view(),
- view! { <p>{row.natural_gas_volume.clone()}</p> }.into_view(),
- view! { <p>{row.oil_volume_60.clone()}</p> }.into_view(),
- view! { <p>{row.oil_volume_75.clone()}</p> }.into_view(),
- view! { <p>{row.oil_volume_90.clone()}</p> }.into_view(),
- view! { <p>{row.natural_gas_volume_2.clone()}</p> }.into_view(),
- view! { <p>{row.natural_gas_volume_25.clone()}</p> }.into_view(),
- view! { <p>{row.natural_gas_volume_3.clone()}</p> }.into_view(),
- ]
- }).collect::<Vec<_>>(),
- links: vec![None, None],
- has_totals: true,
- }
- }
- fn create_ytd_pfi_by_product_data(rows: &Vec<YTDPFIByProductRow>) -> TableData {
- TableData {
- headers: vec![
- view! { <p>"Product"</p> }.into_view(),
- view! { <p>"Last Month"</p> }.into_view(),
- view! { <p>"3 Months"</p> }.into_view(),
- view! { <p>"6 Months"</p> }.into_view(),
- view! { <p>"12 Months"</p> }.into_view(),
- ],
- rows: rows.iter().map(|row| {
- vec![
- view! { <p>{row.product_category.clone()}</p> }.into_view(),
- view! { <p>{row.last_month_avg_share_net.clone()}</p> }.into_view(),
- view! { <p>{row.three_months_avg_share_net.clone()}</p> }.into_view(),
- view! { <p>{row.six_months_avg_share_net.clone()}</p> }.into_view(),
- view! { <p>{row.twelve_months_avg_share_net.clone()}</p> }.into_view(),
- ]
- }).collect::<Vec<_>>(),
- links: vec![None, None],
- has_totals: true,
- }
- }
- fn create_ytd_revenue_by_operator_data(rows: &Vec<YTDRevenueByOperatorRow>) -> TableData {
- TableData {
- headers: vec![
- view! { <p>"Operator"</p> }.into_view(),
- view! { <p>"Owner Net Revenue"</p> }.into_view(),
- ],
- rows: rows.iter().map(|row| {
- vec![
- view! { <p>{row.operator_purchaser.clone()}</p> }.into_view(),
- view! { <p>{row.total_share_net.clone()}</p> }.into_view(),
- ]
- }).collect::<Vec<_>>(),
- links: vec![None, None],
- has_totals: true,
- }
- }
- ================
- File: gmm_client/src/server/app_pools.rs
- ================
- #[cfg(feature = "ssr")]
- pub mod ssr {
- use crate::{
- server::initialize_test_data::ssr::initialize_test_data, // Import the function from ssr module
- // server::land_migration::ssr::land_migration, // Import the land_migration function
- server::load_accounts_configuration::ssr::load_accounts_configuration,
- server::load_admins_configuration::ssr::load_admins_configuration,
- server::open::ssr::open_read_only_land_pool,
- };
- use sqlx::migrate::MigrateDatabase;
- use sqlx::sqlite::SqlitePoolOptions;
- use sqlx::SqlitePool;
- use std::fs;
- #[derive(Debug, Clone)]
- pub struct AppPools {
- pub app_pool: SqlitePool,
- pub land_pool: SqlitePool,
- }
- use leptos::*;
- pub fn app_pools() -> Result<AppPools, ServerFnError> {
- use_context::<AppPools>()
- .ok_or_else(|| ServerFnError::ServerError("App Pools missing.".into()))
- }
- impl AppPools {
- pub async fn new() -> AppPools {
- // Create db directory if it doesn't exist
- if let Err(e) = fs::create_dir_all("db") {
- panic!("Failed to create db directory: {:?}", e);
- }
- // Create db directory if it doesn't exist
- if let Err(e) = fs::create_dir_all("db") {
- panic!("Failed to create db directory: {:?}", e);
- }
- // App database setup
- let db_url = "sqlite:db/GmmClient04.db?mode=rwc";
- if !sqlx::Sqlite::database_exists(db_url)
- .await
- .unwrap_or(false)
- {
- println!("Creating app database");
- match sqlx::Sqlite::create_database(db_url).await {
- Ok(_) => println!("App database created successfully"),
- Err(error) => panic!("Error creating app database: {:?}", error),
- }
- }
- let app_pool = SqlitePoolOptions::new()
- .connect(db_url)
- .await
- .expect("Could not connect to app database");
- // Land database setup (keep as is)
- // let land_db_path = "land_db/land.db";
- let app_db_path = "app_db/bridge.db";
- // land_migration(land_db_path).await.unwrap();
- let rw_land_pool = SqlitePoolOptions::new()
- .connect(&format!("sqlite:{}?mode=rw", app_db_path))
- .await
- .expect("Could not connect to land database.");
- if let Err(e) = sqlx::migrate!().run(&app_pool).await {
- eprintln!("{e:?}");
- }
- let test_app_pools = AppPools {
- app_pool: app_pool.clone(),
- land_pool: rw_land_pool.clone(),
- };
- // Initialize test data after migrations
- initialize_test_data(&test_app_pools)
- .await
- .expect("Failed to initialize test data");
- // initialize_indexes(&rw_land_pool)
- // .await
- // .expect("Could not create indexes");
- // Close the temporary read-write land pool before reopening in read-only mode
- rw_land_pool.close().await;
- let land_pool = open_read_only_land_pool(app_db_path).await;
- let app_pools = AppPools {
- app_pool: app_pool.clone(),
- land_pool: land_pool.clone(),
- };
- load_accounts_configuration(&app_pools)
- .await
- .expect("Failed to load accounts configuration");
- load_admins_configuration(&app_pools)
- .await
- .expect("Failed to load admins configuration");
- app_pools
- }
- }
- }
- ================================================================
- End of Codebase
- ================================================================
Add Comment
Please, Sign In to add comment