Fixes for designs (#3463)

* Fixes for designs

* remove logs
This commit is contained in:
David Bomba 2020-03-10 07:07:46 +11:00 committed by GitHub
parent fbf9f39cc6
commit 6ffea888b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 36 additions and 30 deletions

View File

@ -88,12 +88,15 @@ class Bold extends AbstractDesign
}
public function task() {
return '';
}
public function task_table() {
return '
<table class="w-full table-auto mt-8">
<thead class="text-left">
<tr>
$task_table_header
</tr>
$task_table_header
</thead>
<tbody>
$task_table_body
@ -103,20 +106,22 @@ class Bold extends AbstractDesign
}
public function product() {
return '';
}
public function product_table() {
return '
<table class="w-full table-auto mt-8">
<thead class="text-left">
<tr>
$product_table_header
</tr>
$product_table_header
</thead>
<tbody>
$product_table_body
</tbody>
</table>
';
}
}
public function footer() {

View File

@ -20,8 +20,6 @@ class Business extends AbstractDesign
public function includes()
{
return '
<!DOCTYPE html>
<html lang="en">
<head>
<title>$number</title>
<meta charset="utf-8">
@ -29,9 +27,6 @@ class Business extends AbstractDesign
<meta http-equiv="x-ua-compatible" content="ie=edge">
<link rel="stylesheet" href="/css/design/business.css">
</head>
<body>
<style>
@page
{
@ -50,6 +45,7 @@ class Business extends AbstractDesign
.table_body_td_class border-4 border-white text-orange-700 px-4 py-4
</style>
</head>
';
}
@ -57,7 +53,6 @@ class Business extends AbstractDesign
public function header() {
return '
<div class="my-16 mx-10">
<div class="flex justify-between">
<div class="w-1/2">

View File

@ -25,22 +25,31 @@ class Custom extends AbstractDesign
public $footer;
public $name;
public function __construct($design)
{
$this->includes = $design->includes;
$this->name = $design->name;
$this->header = $design->header;
$this->body = $design->body;
$this->product = $design->product;
$this->task = $design->task;
$this->includes = $design->design->includes;
$this->footer = $design->footer;
$this->header = $design->design->header;
$this->body = $design->design->body;
$this->product = $design->design->product;
$this->task = $design->design->task;
$this->footer = $design->design->footer;
}
public function name()
{
return $this->name;
}
public function includes()
{
return $this->includes;

View File

@ -57,7 +57,7 @@ class Designer {
{
$this->entity = $entity;
$this->design = $design;
$this->design = $design->design;
$this->design_name = property_exists($design, 'name') ? lcfirst($design->name) : 'custom';

View File

@ -99,7 +99,7 @@ class PreviewController extends BaseController
if(!is_object($design_object))
return response()->json(['message' => 'Invalid custom design object'], 400);
$invoice_design = new Custom($design_object->design->design);
$invoice_design = new Custom($design_object->design);
$entity = ucfirst(request()->input('entity'));
@ -158,7 +158,7 @@ class PreviewController extends BaseController
if(!is_object($design_object))
return response()->json(['message' => 'Invalid custom design object'], 400);
$invoice_design = new Custom($design_object->design->design);
$invoice_design = new Custom($design_object->design);
$designer = new Designer($invoice, $invoice_design, $invoice->client->getSetting('pdf_variables'), lcfirst(request()->has('entity')));

View File

@ -45,7 +45,6 @@ class StoreInvoiceRequest extends Request
protected function prepareForValidation()
{
$input = $this->all();
\Log::error(print_r($input,));
if(array_key_exists('design_id', $input) && is_string($input['design_id']))
$input['design_id'] = $this->decodePrimaryKey($input['design_id']);

View File

@ -511,14 +511,14 @@ trait MakesInvoiceValues
/* Table Header */
//$table_header = '<thead><tr class="'.$css['table_header_thead_class'].'">';
$table_header = '';
$table_header = '<tr>';
$column_headers = $this->transformColumnsForHeader($columns);
foreach ($column_headers as $column)
$table_header .= '<td class="table_header_td_class">' . ctrans('texts.'.$column.'') . '</td>';
//$table_header .= '</tr></thead>';
$table_header .= '</tr>';
return $table_header;

View File

@ -32,8 +32,6 @@ class HtmlGenerationTest extends TestCase
$html = $this->generateEntityHtml($designer, $this->invoice);
\Log::error($html);
$this->assertNotNull($html);
}