Invest Confirm
This template displays the details of an investment confirmation after a user has made an investment. It includes investment details such as plan, principal return, credit amount, currency, profit, and additional information. The template also includes a JavaScript snippet that checks the payment status periodically and redirects the user upon confirmation.
Template Structure
Header Inclusion
{include file="mheader.tpl"}
: Includes the header template file (mheader.tpl
). This is typically used to include common header elements across multiple pages.
Main Content
<section class="bg-light" id="result">
: Main section of the page with a light background, containing the investment confirmation details.<div class="container">
: Bootstrap container for proper alignment and spacing.<div class="row justify-content-center">
: Centers the content horizontally within the row.<table class="table table-bordered table-striped">
: Displays investment details in a styled table with borders and striped rows.Plan:
<th>Plan:</th>
: Table header for the investment plan.<td>{$plan_name}</td>
: Displays the name of the investment plan.
Principal Return:
<th>Principal Return:</th>
: Table header for the principal return.<td>{$principal}{if $principal_hold > 0}, With {$principal_hold}% fee {/if}</td>
: Displays the principal return and optionally includes a fee if applicable.
Credit Amount:
<th>Credit Amount:</th>
: Table header for the credit amount.<td>{$credit|fiat}</td>
: Displays the credit amount formatted with the fiat currency.
Currency:
<th>Currency:</th>
: Table header for the currency used.<td>{$payment_method}</td>
: Displays the payment method.
Profit:
<th>Profit:</th>
: Table header for the profit.<td>{$profit}{if $period > 1}s{/if} {if $etype == 1}(Mon-Fri) {/if}</td>
: Displays the profit percentage and optionally indicates the frequency and specific days if applicable.
Principal Withdraw:
<th>Principal Withdraw:</th>
: Table header for principal withdrawal.<td>
: Displays withdrawal information if allowed, including fees and duration.{if $allowprincipal}
: Checks if principal withdrawal is allowed.{foreach from=$details.depositduration item=t key=key}
: Loops through deposit durations to display withdrawal fees.{else}Not available{/if}
: Displays a message if principal withdrawal is not allowed.
Compound:
{if $compound}
: Checks if compound information is available.<td>{$deposit.compound|number_format}%</td>
: Displays the compound percentage formatted as a number.
Deposit Fee:
{if $fee}
: Checks if a deposit fee is applicable.<th>Deposit Fee:</th>
: Table header for the deposit fee.<td>{$fee|fiat})</td>
: Displays the deposit fee formatted with the fiat currency.
Auto Re-invest:
{if $auto_reinvest}
: Checks if auto re-invest is enabled.<th>Auto Re-invest:</th>
: Table header for auto re-invest.<td>Yes</td>
: Displays "Yes" if auto re-invest is enabled.
Tag:
{if $tag}
: Checks if a tag is available.<th>Tag:</th>
: Table header for the tag.<td>{$tag}</td>
: Displays the tag value.
QR Code and Address:
{if $address}
: Checks if an address is available.<td>QR Code</td>
: Table cell for QR code.<td><img class="" style="max-width: 100%; height: auto; width: auto\9;" alt="qrcode" data-size="200" src="{$img}" /></td>
: Displays a QR code image for the address.<td>Amount in {$symbol}</td>
: Table cell for displaying the amount in a specific currency symbol.<td>{$amount}</td>
: Displays the amount.
Address:
<td>Address for {$payment_method}</td>
: Table cell for displaying the address used for the payment method.<td>{$address}</td>
: Displays the payment address.
{if $form} {$form} {/if}
: Conditionally includes a form if$form
is set.
Footer Inclusion
{include file="mfooter.tpl"}
: Includes the footer template file (mfooter.tpl
). This is typically used to include common footer elements across multiple pages.
JavaScript for Payment Confirmation
{if $address}
: Checks if an address is available to run the JavaScript code.<script>
: Includes a script to handle periodic checks for payment confirmation.var myVar = setInterval(alertFunc, 10000);
: Sets an interval to run thealertFunc
function every 10 seconds.function alertFunc() { ... }
: Defines thealertFunc
function to check payment status.const xhttp = new XMLHttpRequest();
: Creates a new XMLHttpRequest object.xhttp.onload = function() { ... }
: Defines what happens when the request loads.if(this.responseText == '0') { console.log("Waiting for payment") }
: Logs "Waiting for payment" if the response is '0'.else if(this.responseText == '1') { window.location.replace('/invested'); }
: Redirects to the '/invested' page if the response is '1'.
xhttp.open("GET", "index.php?address={$address}");
: Opens a GET request to check the payment status.xhttp.send();
: Sends the request.
Notes
Ensure the included template files (
mheader.tpl
andmfooter.tpl
) are correctly defined and available in the project.Customize the JavaScript code if additional actions are needed based on the payment status.
Verify that the variables (
$plan_name
,$principal
,$credit
, etc.) are correctly passed to this template for accurate display.
Last updated