KoolReport shows blank page in laravel vuejs - mysql

I am trying to use the KoolReport in laravel vuejs but it shows me the blank page any help will be highly appreciated.
Code in MyReport.php is like below
<?php
namespace App\Reports;
class MyReport extends \koolreport\KoolReport
{
//We leave this blank to demo only
Code in MyReport.view.php is like below
<html>
<head>
<title>My Report</title>
</head>
<body>
<h1>It works</h1>
</body>
</html>
Code in ReportController.php is like below
<?php
namespace App\Http\Controllers;
use App\Reports\MyReport;
class ReportController extends Controller
{
public function __contruct()
{
$this->middleware("guest");
}
public function index()
{
$report = new MyReport;
$report->run();
return view("report",["report"=>$report]);
}
}
Code in report.blade.php is like below
{{ $report->render() }}
Code in ReportController#index is like below
Route::get('/report', "ReportController#index");

Related

Is there a way to inline a Spring MVC model attribute in JSON in thymeleaf for an html attribute?

Okay, So, I have a model object that we will call Station, with a list of codes associated.
class Station {
public List<String> codes;
}
I have a controller method which render a view showing the list of a station.
class StationController {
#Autowired
private StationService stationService;
#GetMapping()
public String showAllStations(Model model) {
model.addAttribute("stations", stationService.getAllStations())
return "stationsView"
}
}
Here is my template
<html xmlns:th="http://www.thymeleaf.org">
<body>
<div th:each="station : ${stations}" th:text="${station.codes}">
</div>
</body>
</html>
So, let's say my first station as two codes, CD1 et CD2. The rendered html will be the following :
<html xmlns:th="http://www.thymeleaf.org">
<body>
<div>[CD1, CD2]</div>
...Skipping the additional divs.
</body>
</html>
Is there a way to render the codes as a JSON array ? I know thymeleaf can do it in javascript, using inline.
For example,
<script type="text/javascript" th:inline="javascript">
/*<![CDATA[*/
var data = [[${renter.sabreCodes}]];
/*]]>*/
</script>
will be rendered as
<script type="text/javascript" th:inline="javascript">
/*<![CDATA[*/
var data = ["CD1","CD2"];
/*]]>*/
</script>
So I would want the same result for an attribute value.
Of course, I have a lot of workaround for this, but I would want to know if these workaround are needed, or if it just me who don't know how to get straight to the point.

Email subject in Laravel 4

I have a simple problem which I couldn't solve until now, the problem is when the user asks for rest password, the email is sent correctly except one thing that the email, doesn't contain a Subject. And I want to add the subject but I wasn't able to do it.
here is the postRemind function in my controller:
public function postRemind()
{
$this->reminderForm->validate(Input::only('email'));
switch ($response = Password::remind(Input::only('email'))) {
case Password::INVALID_USER:
return Redirect::back()->with('error', Lang::get($response));
case Password::REMINDER_SENT:
return Redirect::back()->with('status', Lang::get($response));
}
}
and here is my blade :
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
</head>
<body>
<h3>Password Reset</h3>
<div>
You have requested password reset. Complete this form: {{ URL::to('password/reset', array($token)) }}
</div>
</body>
</html>
You can pass a closure to Password::remind where you can set the subject.
https://laravel.com/docs/4.2/security#password-reminders-and-reset
public function postRemind()
{
$this->reminderForm->validate(Input::only('email'));
$response = Password::remind(Input::only('email'), function($message)
{
$message->subject('Password Reminder');
});
switch ($response) {
case Password::INVALID_USER:
return Redirect::back()->with('error', Lang::get($response));
case Password::REMINDER_SENT:
return Redirect::back()->with('status', Lang::get($response));
}
}

how can display html page in action

my project structure :
RouteConfig :
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
}
index.html :
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="utf-8" />
</head>
<body>
<h3>hi</h3>
</body>
</html>
Home Controller :
public class HomeController : Controller
{
public ActionResult Index()
{
return View();
}
}
WebApi is startup project.
how can display index.html in Index action or replace Index view with index.html.
The files are in different profects, you canĀ“t do it at this way.
Why you dont use the home/index action and views/home/index.cshtml to put your index.html content?
Or you can make a redirect to index.html URL on home/index action.
By default, your controller action will return Index.cshtml view instead of Index.html page. If you want to do redirection pointed at Index.html on WebClient project, modify your Index action method inside controller like this (set your WebClient's full address path, because tidle sign to replace site root path doesn't work at this case):
public class HomeController : Controller
{
public ActionResult Index()
{
return Redirect("http://ServerAddressOrName:Port/WebClient/Index.html");
}
}
Afterwards, you need to build both projects then assign your WebApi and WebClient to different sites, since it is impossible to combine them with different Web.config content.

On Spring Boot, how to get the html to communicate with the model

This probably a very simple question, but I can't figure it out alone. I have the following controller:
#RestController
public class TestController extends AbstractCloudController {
private final EquipmentRepository equipmentRepository;
#Autowired
TestController(EquipmentRepository er) {
equipmentRepository = er;
}
#RequestMapping(method=RequestMethod.GET) void index() {
List<String> codes = equipmentRepository.findAllEquipments();
String output = "";
for (String code : codes) {
output += "ID "+code+"\n";
}
}
}
And the following index.html:
<!doctype html>
<html>
<head>
<title>Test Page</title>
<link rel="stylesheet"
href="./bower_components/bootstrap-css-only/css/bootstrap.min.css" />
</head>
<body ng-app="testApp">
<div class="outer">
<h1>Hello World!</h1>
<div class="container">
<div ng-controller="TestController" ng-cloak="ng-cloak">
<p>This is a test page</p>
</div>
</div>
<script src="js/angular-bootstrap.js" type="text/javascript"></script>
<script src="js/hello.js"></script>
</div>
</body>
</html>
How do I get the information from the controller to the server side without it overriding the html? When I make the controller return something, it ends up overwriting the html and printing only the equipment code instead instead of the "Hello World", even the page title doesn't show.
I don't know what do you returned in your controller, but you may check this document: http://docs.spring.io/spring/docs/current/spring-framework-reference/html/mvc.html#mvc-ann-return-types
If you want to print the content of output, you may add it to a Model
#RequestMapping(method=RequestMethod.GET, Model model) void index() {
List<String> codes = equipmentRepository.findAllEquipments();
String output = "";
for (String code : codes) {
output += "ID "+code+"\n";
}
model.addAttribute("output", output);
}
then use JSP Expression Language to get the content
${output}
PS. Spring will treat a returned string as view name, not html content by default.

HTML file not working within a GWT/GXT project

The following code is working fine when I run it by itself but when I run it from within a widget in my project the alert does not show up. Am I doing something wrong or forgetting to do something?
<html>
<head>
<title>Upload</title>
<script>
function test() {
alert("Works");
}
</script>
</head>
<body>
<input type='file' size='30' id='fileDiag' maxlength='45'
name='fileDiag'>
<input type="button" onclick="test()" value="TEST" />
</body>
</html>
Try replacing the content of your widget's HTML with just this:
<input type='file' size='30' id='fileDiag' maxlength='45' name='fileDiag'>
<input type="button" onclick="test()" value="TEST" />
<script>
function test() {
alert("Works");
}
</script>
You also shouldn't place JavaScript function directly in your widget's html. You can either create it using a UiBinder and specify a handler using #UiHandler in your UiBinder class, or create a class that extends a Composite and then use a XTemplates as follows:
public interface WidgetTemplates extends XTemplates {
#XTemplate(source = "content.html")
SafeHtml content();
}
Then in your widget's constructor you can add the template's content:
WidgetTemplates templates = GWT.create(WidgetTemplates.class);
public class MyWidget extends Composite {
public MyWidget() {
HTMLPanel rootPanel = new HTMLPanel(templates.content());
initWidget(rootPanel);
sinkEvents(Event.ONCLICK);
}
public void onBrowserEvent(Event evt) {
// handler for all events
}
}
I didn't fully test the above code, but you might get the general idea. You want to code the GWT way, not to circumvent it.