Active Investments

Active Investment Page is invest_list.tpl

Active Investment page will show Active Investments of a user with multiple details.

Usage

 {foreach from=$rows item=value}
 
 {$value.name}
 
{/foreach}

Overview

This template renders a responsive table that displays investment details. It utilizes a loop to iterate over investment records and dynamically populate the table with various attributes related to each investment. The table includes interactive elements for managing investments and visual progress bars to represent profit and accrual data.

Table Structure

Table Header

The table header defines the following columns:

  • Name: The name of the investment.

  • Amount: The amount invested.

  • Active Date: The date when the investment became active.

  • Expiry: The date when the investment expires.

  • Status: The current status of the investment (Active/Expired) with a link to release capital if applicable.

  • Reinvest: Options to enable or disable automatic reinvestment.

Table Body

The table body is populated with dynamic data from the {foreach} loop. Each row displays the following details:

  • Name ({$value.name}): The name of the investment.

  • Amount ({$value.amount|fiat:$value.cid}): The investment amount formatted with a fiat currency filter. $value.cid is used to determine the currency format.

  • Active Date ({$value.datetime}): The date when the investment became active.

  • Expiry ({$value.expiry}): The expiration date of the investment.

  • Status:

    • If the investment is active ($value.status == '1'), it shows "Active".

    • If the investment has expired ($value.status == '0'), it shows "Expired".

    • Additionally, if the release flag is set to '1', a link to "Release Capital" (<a href="release_investment?id={$value.id}">Release Capital</a>) is provided.

  • Reinvest:

    • If the reinvest flag is set to '1', it displays a link to enable or disable reinvestment based on the auto_reinvest flag.

      • If auto_reinvest is '1', the link text is "Disable" (<a href="invested?reinvest={$value.id}">Disable</a>).

      • If auto_reinvest is '0', the link text is "Enable" (<a href="invested?reinvest={$value.id}">Enable</a>).

Additional Details Rows

For each investment, additional rows provide detailed information:

  • Transaction ({$value.txn_id}): The transaction ID related to the investment.

  • Accruals ({$value.avail} / {$value.duration}): Displays current accruals versus total accruals.

  • Remaining Accruals ({$value.duration - $value.avail}): The difference between total accruals and current accruals.

  • Next Earning ({$value.next_earning}): Expected amount for the next earning.

  • Next Earning Time ({$value.next_earning_time}): The time when the next earning is expected.

  • Last Earning Time ({$value.last_earning_time}): The time of the last earning.

  • Profit ({$value.profit|fiat} - {$value.total_profit|fiat}): The current profit and total profit formatted with a fiat currency filter.

  • Profit Percentage ({$value.percentage}%): The percentage of profit earned.

  • Total Profit Percentage ({$value.total_percentage}%): The total profit percentage.

  • Total Profit Earned ({$value.earned}): The total amount of profit earned.

  • Profit %:

    • A progress bar showing the percentage of profit based on accruals. The width is calculated as {$value.percentage * $value.avail}%.

  • Profit $:

    • A progress bar showing the dollar amount of profit based on accruals. The width is calculated as {$value.profit * $value.avail}%, and the amount is displayed as ${$value.profit * $value.avail}.

  • Profit Accruals:

    • A progress bar showing the remaining accruals as a percentage of the total duration. The width is calculated as {$value.duration - $value.avail}%, and the progress bar is striped and colored green to indicate progress.

Empty State

If no investment records are found, the table will display a message in a single row indicating "No transactions found."

Templating Details

  • {foreach from=$rows item=value}: Loops through each investment record in the $rows array.

  • {$value.name}: Investment name.

  • {$value.amount}: Investment amount.

  • {$value.datetime}: Active date of the investment.

  • {$value.expiry}: Expiry date of the investment.

  • {$value.status}: Status of the investment.

  • {$value.release}: Flag to indicate if capital release is available.

  • {$value.reinvest}: Flag to indicate if reinvestment options are available.

  • {$value.auto_reinvest}: Flag to indicate if automatic reinvestment is enabled.

  • {$value.txn_id}: Transaction ID.

  • {$value.avail}: Current accruals.

  • {$value.duration}: Total accruals.

  • {$value.next_earning}: Expected next earning amount.

  • {$value.next_earning_time}: Time of the next earning.

  • {$value.last_earning_time}: Time of the last earning.

  • {$value.profit}: Current profit.

  • {$value.total_profit}: Total profit.

  • {$value.percentage}: Profit percentage.

  • {$value.total_percentage}: Total profit percentage.

  • {$value.earned}: Total profit earned.

Notes

  • Ensure that the $rows variable is properly populated with investment data.

  • Modify the template as needed to fit the specific attributes and actions required for your use case.

Last updated