1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Minor fixes

This commit is contained in:
David Bomba 2024-05-09 09:35:50 +10:00
parent 496afc5c20
commit 20abbc339f
3 changed files with 46 additions and 31 deletions

View File

@ -20,7 +20,7 @@ class ReactBuilder extends Command
*
* @var string
*/
protected $signature = 'ninja:react';
protected $signature = 'ninja:react {--type=}';
/**
* The console command description.
@ -46,31 +46,39 @@ class ReactBuilder extends Command
*/
public function handle()
{
// $includes = '';
if($this->option('type') == 'local') {
// $directoryIterator = false;
// try {
// $directoryIterator = new \RecursiveDirectoryIterator(public_path('react/v'.config('ninja.app_version').'/'), \RecursiveDirectoryIterator::SKIP_DOTS);
// } catch (\Exception $e) {
// $this->error('React files not found');
// return;
// }
$includes = '';
// foreach (new \RecursiveIteratorIterator($directoryIterator) as $file) {
// if ($file->getExtension() == 'js') {
// if (str_contains($file->getFileName(), 'index-')) {
// $includes .= '<script type="module" crossorigin src="/react/v'.config('ninja.app_version').'/'.$file->getFileName().'"></script>'."\n";
// } else {
// $includes .= '<link rel="modulepreload" href="/react/v'.config('ninja.app_version').'/'.$file->getFileName().'">'."\n";
// }
// }
$directoryIterator = false;
// if (str_contains($file->getFileName(), '.css')) {
// $includes .= '<link rel="stylesheet" href="/react/v'.config('ninja.app_version').'/'.$file->getFileName().'">'."\n";
// }
// }
try {
$directoryIterator = new \RecursiveDirectoryIterator(public_path('react/v'.config('ninja.app_version').'/'), \RecursiveDirectoryIterator::SKIP_DOTS);
} catch (\Exception $e) {
$this->error('React files not found');
return;
}
// file_put_contents(resource_path('views/react/head.blade.php'), $includes);
foreach (new \RecursiveIteratorIterator($directoryIterator) as $file) {
if ($file->getExtension() == 'js') {
if (str_contains($file->getFileName(), 'index-')) {
$includes .= '<script type="module" crossorigin src="/react/v'.config('ninja.app_version').'/'.$file->getFileName().'"></script>'."\n";
} else {
$includes .= '<link rel="modulepreload" href="/react/v'.config('ninja.app_version').'/'.$file->getFileName().'">'."\n";
}
}
if (str_contains($file->getFileName(), '.css')) {
$includes .= '<link rel="stylesheet" href="/react/v'.config('ninja.app_version').'/'.$file->getFileName().'">'."\n";
}
}
file_put_contents(resource_path('views/react/head.blade.php'), $includes);
}
}
}

View File

@ -11,14 +11,14 @@
namespace App\Helpers\Invoice;
use App\Models\Quote;
use App\Models\Credit;
use App\Models\Invoice;
use App\Models\PurchaseOrder;
use App\Models\Quote;
use App\Models\RecurringInvoice;
use App\Models\RecurringQuote;
use App\Utils\Traits\NumberFormatter;
use App\Models\RecurringInvoice;
use Illuminate\Support\Collection;
use App\Utils\Traits\NumberFormatter;
class InvoiceSumInclusive
{

View File

@ -11,17 +11,18 @@
namespace App\Jobs\Report;
use App\Jobs\Mail\NinjaMailerJob;
use App\Jobs\Mail\NinjaMailerObject;
use App\Models\User;
use App\Models\Company;
use App\Libraries\MultiDB;
use App\Mail\DownloadReport;
use App\Models\Company;
use Illuminate\Bus\Queueable;
use App\Jobs\Mail\NinjaMailerJob;
use App\Jobs\Mail\NinjaMailerObject;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\Middleware\WithoutOverlapping;
use Illuminate\Queue\SerializesModels;
class SendToAdmin implements ShouldQueue
{
@ -54,12 +55,18 @@ class SendToAdmin implements ShouldQueue
MultiDB::setDb($this->company->db);
$export = new $this->report_class($this->company, $this->request);
$csv = $export->run();
$user = $this->company->owner();
if(isset($this->request['user_id']))
{
$user = User::find($this->request['user_id']) ?? $this->company->owner();
}
$nmo = new NinjaMailerObject();
$nmo->mailable = new DownloadReport($this->company, $csv, $this->file_name);
$nmo->company = $this->company;
$nmo->settings = $this->company->settings;
$nmo->to_user = $this->company->owner();
$nmo->to_user = $user;
NinjaMailerJob::dispatch($nmo);
}