diff --git a/app/Utils/HtmlEngine.php b/app/Utils/HtmlEngine.php
index 058f9ed36731..efe31880ea9b 100644
--- a/app/Utils/HtmlEngine.php
+++ b/app/Utils/HtmlEngine.php
@@ -744,6 +744,20 @@ class HtmlEngine
return $data;
}
+ public function makeValuesNoPrefix() :array
+ {
+ $data = [];
+
+ $values = $this->buildEntityDataArray();
+
+ foreach ($values as $key => $value) {
+ $data[str_replace(["$","."],["_","_"],$key)] = $value['value'];
+ }
+
+ return $data;
+ }
+
+
public function generateLabelsAndValues()
{
$data = [];
diff --git a/app/Utils/PhantomJS/Phantom.php b/app/Utils/PhantomJS/Phantom.php
index 8080f5c66938..7e8f0d1bb40c 100644
--- a/app/Utils/PhantomJS/Phantom.php
+++ b/app/Utils/PhantomJS/Phantom.php
@@ -230,4 +230,123 @@ class Phantom
return view('pdf.html', $data);
}
+
+ public function blade()
+ {
+
+ $i = \App\Models\Invoice::first();
+
+ $html_variables = (new HtmlEngine($i->invitations->first()))->makeValuesNoPrefix();
+ $variables = (new HtmlEngine($i->invitations->first()))->makeValuesNoPrefix();
+
+ $html_variables = array_merge($html_variables, $variables);
+ // $smarty->assign($html_variables);
+
+ $template_string = '
+ display {$foo} here
+
+ {if $invoice.amount > 5}
+
+ ewwo {$invoice.amount * 5}
+ {/if}
+
+ {if isset($entry) && is_array($entry)}
+ I am a puppet
+ {/if}
+
+ {if 1 > 0}
+ 1 is greater than 0
+ {/if}
+
+ {if 0 > 1}
+ 0 is greater than 1
+ {/if}
+
+ {foreach $countries as $country}
+
+ {if $country.name = "Australia"}
+ {$country.name}
+ {/if}
+
+
+
+
+ {/foreach}
+
+
+{foreach $invoice.line_items as $item}
+ {$item->quantity} - {$item->cost} - {$item->notes} - {$item->line_total}
+{/foreach}
+
+ echo "I am a puppet";
+
+
+
+ ';
+
+$template_string = '
+
+
+
+
+ {{ _invoice_number }}
+
+
+ {{ _invoice_number }}
+ Athletes list
+
+ {% for item in invoice.line_items %}
+ - {{ item.product_key|e }} {{ item.quantity|e }} {{ item.type_id|e }} {{ item.notes|e }} {{ item.line_total|e }}
+ {% endfor %}
+
+
+
+{{ _invoiceDate }}
+{{ _shipping }}
+{{ _client_address|raw }}
+{{ xx }}
+
+$invoice.amount
+
+
+
+';
+
+$loader = new \Twig\Loader\FilesystemLoader(storage_path());
+// $tags = ['if','for','raw','html','sandbox'];
+// $filters = ['upper'];
+// $methods = [
+// 'Article' => ['getTitle', 'getBody'],
+// ];
+// $properties = [
+// 'Article' => ['title', 'body'],
+// ];
+// $functions = ['range'];
+// $policy = new \Twig\Sandbox\SecurityPolicy($tags, $filters, $methods, $properties, $functions);
+// $sandbox = new \Twig\Extension\SandboxExtension($policy);
+
+$twig = new \Twig\Environment($loader);
+// $twig->addExtension($sandbox);
+
+// $twig = new \Twig\Environment(new \Twig\Loader\ArrayLoader([]));
+$template = $twig->createTemplate($template_string);
+echo $template->render(array_merge([
+ 'invoice' => $i->toArray(),
+], $html_variables));
+
+
+ // try{
+ // $smarty->display('string:' . $template_string);
+ // }
+ // catch(\Throwable $e){
+ // echo $e->getMessage();
+ // exit;
+ // }
+
+ // $smarty->display('string:' . $template_string);
+
+ }
}
diff --git a/composer.json b/composer.json
index ae61a4b6334e..f49301bc8b99 100644
--- a/composer.json
+++ b/composer.json
@@ -76,6 +76,7 @@
"omnipay/paypal": "^3.0",
"payfast/payfast-php-sdk": "^1.1",
"pragmarx/google2fa": "^8.0",
+ "predis/predis": "^2",
"psr/http-message": "^1.0",
"pusher/pusher-php-server": "^7.2",
"razorpay/razorpay": "2.*",
@@ -83,6 +84,7 @@
"setasign/fpdf": "^1.8",
"setasign/fpdi": "^2.3",
"shopify/shopify-api": "^4.3",
+ "smarty/smarty": "^4.3",
"socialiteproviders/apple": "^5.2",
"socialiteproviders/microsoft": "^4.1",
"spatie/laravel-data": "^3.5",
@@ -93,7 +95,7 @@
"symfony/mailgun-mailer": "^6.1",
"symfony/postmark-mailer": "^6.1",
"turbo124/beacon": "^1.5",
- "predis/predis": "^2",
+ "twig/twig": "^3.0",
"twilio/sdk": "^6.40",
"webpatser/laravel-countries": "dev-master#75992ad",
"wepay/php-sdk": "^0.3",
diff --git a/composer.lock b/composer.lock
index fb13b2f575ac..79d85c1da1da 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "fe4e98a48b87b1d62a7c93b6f56c57cc",
+ "content-hash": "22c7a90fc3389d0e5478e03f626d9ddb",
"packages": [
{
"name": "adrienrn/php-mimetyper",
@@ -9904,6 +9904,72 @@
},
"time": "2023-08-10T06:11:26+00:00"
},
+ {
+ "name": "smarty/smarty",
+ "version": "v4.3.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/smarty-php/smarty.git",
+ "reference": "1d9cda2be34fd6edb74924684260636fd0b89288"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/smarty-php/smarty/zipball/1d9cda2be34fd6edb74924684260636fd0b89288",
+ "reference": "1d9cda2be34fd6edb74924684260636fd0b89288",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.1 || ^8.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^8.5 || ^7.5",
+ "smarty/smarty-lexer": "^3.1"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "4.0.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "libs/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "LGPL-3.0"
+ ],
+ "authors": [
+ {
+ "name": "Monte Ohrt",
+ "email": "monte@ohrt.com"
+ },
+ {
+ "name": "Uwe Tews",
+ "email": "uwe.tews@googlemail.com"
+ },
+ {
+ "name": "Rodney Rehm",
+ "email": "rodney.rehm@medialize.de"
+ },
+ {
+ "name": "Simon Wisselink",
+ "homepage": "https://www.iwink.nl/"
+ }
+ ],
+ "description": "Smarty - the compiling PHP template engine",
+ "homepage": "https://smarty-php.github.io/smarty/",
+ "keywords": [
+ "templating"
+ ],
+ "support": {
+ "forum": "https://github.com/smarty-php/smarty/discussions",
+ "issues": "https://github.com/smarty-php/smarty/issues",
+ "source": "https://github.com/smarty-php/smarty/tree/v4.3.2"
+ },
+ "time": "2023-07-19T10:27:36+00:00"
+ },
{
"name": "socialiteproviders/apple",
"version": "5.5.2",
@@ -13895,6 +13961,77 @@
},
"time": "2023-08-20T23:18:11+00:00"
},
+ {
+ "name": "twig/twig",
+ "version": "v3.7.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/twigphp/Twig.git",
+ "reference": "a0ce373a0ca3bf6c64b9e3e2124aca502ba39554"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/twigphp/Twig/zipball/a0ce373a0ca3bf6c64b9e3e2124aca502ba39554",
+ "reference": "a0ce373a0ca3bf6c64b9e3e2124aca502ba39554",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=7.2.5",
+ "symfony/polyfill-ctype": "^1.8",
+ "symfony/polyfill-mbstring": "^1.3"
+ },
+ "require-dev": {
+ "psr/container": "^1.0|^2.0",
+ "symfony/phpunit-bridge": "^5.4.9|^6.3"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "Twig\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com",
+ "homepage": "http://fabien.potencier.org",
+ "role": "Lead Developer"
+ },
+ {
+ "name": "Twig Team",
+ "role": "Contributors"
+ },
+ {
+ "name": "Armin Ronacher",
+ "email": "armin.ronacher@active-4.com",
+ "role": "Project Founder"
+ }
+ ],
+ "description": "Twig, the flexible, fast, and secure template language for PHP",
+ "homepage": "https://twig.symfony.com",
+ "keywords": [
+ "templating"
+ ],
+ "support": {
+ "issues": "https://github.com/twigphp/Twig/issues",
+ "source": "https://github.com/twigphp/Twig/tree/v3.7.1"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/fabpot",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/twig/twig",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2023-08-28T11:09:02+00:00"
+ },
{
"name": "twilio/sdk",
"version": "6.44.4",
diff --git a/database/migrations/2023_09_09_135250_client_and_company_type.php b/database/migrations/2023_09_09_135250_client_and_company_type.php
new file mode 100644
index 000000000000..4fb7f69afceb
--- /dev/null
+++ b/database/migrations/2023_09_09_135250_client_and_company_type.php
@@ -0,0 +1,27 @@
+string('classification')->nullable();
+ });
+
+ }
+
+ /**
+ * Reverse the migrations.
+ */
+ public function down(): void
+ {
+ //
+ }
+};
diff --git a/routes/client.php b/routes/client.php
index c9fec140ea3a..56e872f232a0 100644
--- a/routes/client.php
+++ b/routes/client.php
@@ -141,6 +141,7 @@ Route::group(['middleware' => ['invite_db'], 'prefix' => 'client', 'as' => 'clie
});
Route::get('phantom/{entity}/{invitation_key}', [Phantom::class, 'displayInvitation'])->middleware(['invite_db', 'phantom_secret'])->name('phantom_view');
+Route::get('blade/', [Phantom::class, 'blade'])->name('blade');
Route::get('.env', function () {
})->middleware('throttle:honeypot');