Jump to content

Full Width Panel Above Client Area Home Page Panels


iamcorbito

Recommended Posts

On 11/10/2018 at 06:06, iamcorbito said:

Is there a way to add your own full width panel above the client area home page panels? I tried looking at their documentation but i didnt find what I wanted. Or if i could make one of those panels into full width that could work too.

if it's just one panel that you want to make full width, then frankly I would just fake it in the clientareahome.tpl template... you'd have to redesign the template to allow them to be full-width by default.

CWvkxNN.png

so in the above example, i've just copied the "Overdue invoices" panel source code and pasted it in a col-12 div...

<div class="client-home-panels">
    <div class="row">
		<div class="col-sm-12">
			<div menuItemName="Full Panel 1" class="panel panel-default panel-accent-red">
				<div class="panel-heading">
					<h3 class="panel-title">
						<div class="pull-right">
							<a href="clientarea.php?action=masspay&all=true" class="btn btn-default bg-color-red btn-xs">
							<i class="fas fa-arrow-right"></i>{$LANG.invoicespaynow}
							</a>
						</div>
						<i class="fas fa-calculator"></i>&nbsp;{$LANG.clientHomePanels.overdueInvoices}
					</h3>
				</div>
				<div class="panel-body">
					<p>You have 5 overdue invoice(s) with a total balance due of £59.03 GBP. Pay them now to avoid any interruptions in service.</p>
				</div>
			<div class="panel-footer">
		</div>
	</div>
</div>

        <div class="col-sm-6">
            {function name=outputHomePanels}

in practice, what you should do is replace the titles with Language Overrides (as above) and then it's just a case of customising it for your own needs.

For example, if the content of this panel needs to behave like the other panels and pull information from the database, then you'd be looking at using a ClientAreaPageHome hook to get the required information and pass it back to the template as a variable and then use that variable in the body of the panel instead of the above string.

if you had multiple full-width panels, you could even do the same with the links, but I wouldn't have though it would be worth it under most circumstances.

Link to comment
Share on other sites

On 16/10/2018 at 07:01, iamcorbito said:

Also can you give an example of this?

at its most basic, you're returning array(s) back to the template - they could be text strings, variables pulled from the class docs or database etc..

<?php

function custom_welcome_back($vars)
{
	$clientsdetails = $vars['clientsdetails'];
	$welcomemessage = Lang::trans('welcomeback').', '.$clientsdetails['firstname'];
	return array('welcomemessage' => $welcomemessage);
}
add_hook("ClientAreaPageHome",1,"custom_welcome_back");

so the above hook will create a string using a combination of a Language string and the client's first name and return it the clientareahome page template as a variable that can be output using {$welcomemessage}

<div class="panel-body">
	<p>{$welcomemessage}</p>
</div>

zI0A7C2.png

in many ways, it's a silly hook example because you could do all that in the template anyway without the need for a hook (using available Smarty variables in the template), but I daresay whatever example I gave probably wouldn't be applicable to your specific situation. 🙂

there are other hook examples posted in the community, by myself and others, that show how to pull information from the database and/or the Class docs - but if none of them cover what you want to do, you can always ask for advice.

 

Link to comment
Share on other sites

19 hours ago, iamcorbito said:

The above example is exactly what i need actually

if you're not going to query the database or the class docs for information, and can get it from existing template variables, then I wouldn't bother using a hook - you're having to edit the template anyway, so just add your code using Smarty to it... e.g to reproduce that hook in your template, it just needs this...

<div class="panel-body">
	<p>{$LANG.welcomeback}, {$clientsdetails.firstname}.</p>
</div>

that said, I can't see anything wrong with the hook code as I did test it before posting and included the output it generated..

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated