v2 first commit
This commit is contained in:
@ -1,33 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\ViewComposers;
|
||||
|
||||
use App\Traits\DateTime;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class All
|
||||
{
|
||||
use DateTime;
|
||||
|
||||
/**
|
||||
* Bind data to the view.
|
||||
*
|
||||
* @param View $view
|
||||
* @return void
|
||||
*/
|
||||
public function compose(View $view)
|
||||
{
|
||||
// Make sure it's installed
|
||||
if (!env('APP_INSTALLED') && (env('APP_ENV') !== 'testing')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Share user logged in
|
||||
$auth_user = auth()->user();
|
||||
|
||||
// Share date format
|
||||
$date_format = $auth_user ? $this->getCompanyDateFormat() : 'd F Y';
|
||||
|
||||
$view->with(['auth_user' => $auth_user, 'date_format' => $date_format]);
|
||||
}
|
||||
}
|
@ -19,22 +19,20 @@ class Header
|
||||
*/
|
||||
public function compose(View $view)
|
||||
{
|
||||
$user = Auth::user();
|
||||
$user = user();
|
||||
|
||||
$bills = [];
|
||||
$invoices = [];
|
||||
$items = [];
|
||||
$items_reminder = [];
|
||||
$notifications = 0;
|
||||
$company = null;
|
||||
|
||||
// Get customer company
|
||||
if ($user->customer()) {
|
||||
if ($user->contact) {
|
||||
$company = (object)[
|
||||
'company_name' => setting('general.company_name'),
|
||||
'company_email' => setting('general.company_email'),
|
||||
'company_address' => setting('general.company_address'),
|
||||
'company_logo' => setting('general.company_logo'),
|
||||
'company_name' => setting('company.name'),
|
||||
'company_email' => setting('company.email'),
|
||||
'company_address' => setting('company.address'),
|
||||
'company_logo' => setting('company.logo'),
|
||||
];
|
||||
}
|
||||
|
||||
@ -52,14 +50,6 @@ class Header
|
||||
$invoices[$data['invoice_id']] = $data['amount'];
|
||||
$notifications++;
|
||||
break;
|
||||
case 'App\Notifications\Common\Item':
|
||||
$items[$data['item_id']] = $data['name'];
|
||||
$notifications++;
|
||||
break;
|
||||
case 'App\Notifications\Common\ItemReminder':
|
||||
$items_reminder[$data['item_id']] = $data['name'];
|
||||
$notifications++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -72,8 +62,6 @@ class Header
|
||||
'notifications' => $notifications,
|
||||
'bills' => $bills,
|
||||
'invoices' => $invoices,
|
||||
'items' => $items,
|
||||
'items_reminder' => $items_reminder,
|
||||
'company' => $company,
|
||||
'updates' => $updates,
|
||||
]);
|
||||
|
@ -3,6 +3,7 @@
|
||||
namespace App\Http\ViewComposers;
|
||||
|
||||
use Date;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class Index
|
||||
@ -29,5 +30,37 @@ class Index
|
||||
}
|
||||
|
||||
$view->with(['limits' => $limits, 'this_year' => $this_year, 'years' => $years]);
|
||||
|
||||
// Add Bulk Action
|
||||
$module = false;
|
||||
$view_name = $view->getName();
|
||||
|
||||
if (Str::contains($view_name, '::')) {
|
||||
$names = explode('::', $view_name);
|
||||
|
||||
$params = explode('.', $view_name);
|
||||
|
||||
$type = $params[0];
|
||||
|
||||
// Check is module
|
||||
$module = module($names[0]);
|
||||
} else {
|
||||
$params = explode('.', $view_name);
|
||||
|
||||
$group = $params[0];
|
||||
$type = $params[1];
|
||||
}
|
||||
|
||||
if ($module instanceof \Akaunting\Module\Module) {
|
||||
$class = 'Modules\\' . $module->getStudlyName() . '\BulkActions\\' . ucfirst($type);
|
||||
} else {
|
||||
$class = 'App\BulkActions\\' . ucfirst($group) . '\\' . ucfirst($type);
|
||||
}
|
||||
|
||||
if (class_exists($class)) {
|
||||
$bulk_actions = app($class);
|
||||
|
||||
$view->with(['bulk_actions' => $bulk_actions->actions]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,22 +17,22 @@ class InvoiceText
|
||||
{
|
||||
$text_override = [];
|
||||
|
||||
$text_items = setting('general.invoice_item', 'general.items');
|
||||
$text_items = setting('invoice.item_name', 'general.items');
|
||||
|
||||
if ($text_items == 'custom') {
|
||||
$text_items = setting('general.invoice_item_input');
|
||||
$text_items = setting('invoice.item_input');
|
||||
}
|
||||
|
||||
$text_quantity = setting('general.invoice_quantity', 'invoices.quantity');
|
||||
$text_quantity = setting('invoice.quantity_name', 'invoices.quantity');
|
||||
|
||||
if ($text_quantity == 'custom') {
|
||||
$text_quantity = setting('general.invoice_quantity_input');
|
||||
$text_quantity = setting('invoice.quantity_input');
|
||||
}
|
||||
|
||||
$text_price = setting('general.invoice_price', 'invoices.price');
|
||||
$text_price = setting('invoice.price_name', 'invoices.price');
|
||||
|
||||
if ($text_price == 'custom') {
|
||||
$text_price = setting('general.invoice_price_input');
|
||||
$text_price = setting('invoice.price_input');
|
||||
}
|
||||
|
||||
$text_override['items'] = $text_items;
|
||||
|
@ -21,10 +21,10 @@ class Logo
|
||||
{
|
||||
$logo = '';
|
||||
|
||||
$media_id = setting('general.company_logo');
|
||||
$media_id = setting('company.logo');
|
||||
|
||||
if (setting('general.invoice_logo')) {
|
||||
$media_id = setting('general.invoice_logo');
|
||||
if (setting('invoice.logo')) {
|
||||
$media_id = setting('invoice.logo');
|
||||
}
|
||||
|
||||
$media = Media::find($media_id);
|
||||
|
@ -14,19 +14,13 @@ class Menu
|
||||
*/
|
||||
public function compose(View $view)
|
||||
{
|
||||
$customer = null;
|
||||
$user = auth()->user();
|
||||
|
||||
// Get all companies
|
||||
$companies = $user->companies()->enabled()->limit(10)->get()->each(function ($com) {
|
||||
$com->setSettings();
|
||||
})->sortBy('name');
|
||||
|
||||
// Get customer
|
||||
if ($user->customer) {
|
||||
$customer = $user;
|
||||
// Get user companies
|
||||
if ($user = user()) {
|
||||
$companies = $user->companies()->enabled()->limit(10)->get()->sortBy('name');
|
||||
} else {
|
||||
$companies = [];
|
||||
}
|
||||
|
||||
$view->with(['companies' => $companies, 'customer' => $customer]);
|
||||
$view->with(['companies' => $companies]);
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ class Modules
|
||||
*/
|
||||
public function compose(View $view)
|
||||
{
|
||||
if (setting('general.api_token')) {
|
||||
if (setting('apps.api_key')) {
|
||||
$categories = Cache::remember('modules.categories.' . language()->getShortCode(), Date::now()->addHour(6), function () {
|
||||
return collect($this->getCategories())->pluck('name', 'slug')
|
||||
->prepend(trans('general.all_type', ['type' => trans_choice('general.categories', 2)]), '');
|
||||
|
33
app/Http/ViewComposers/Show.php
Normal file
33
app/Http/ViewComposers/Show.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\ViewComposers;
|
||||
|
||||
use Date;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class Show
|
||||
{
|
||||
/**
|
||||
* Bind data to the view.
|
||||
*
|
||||
* @param View $view
|
||||
* @return void
|
||||
*/
|
||||
public function compose(View $view)
|
||||
{
|
||||
$limits = ['10' => '10', '25' => '25', '50' => '50', '100' => '100'];
|
||||
|
||||
$now = Date::now();
|
||||
|
||||
$this_year = $now->year;
|
||||
|
||||
$years = [];
|
||||
$y = $now->addYears(2);
|
||||
for ($i = 0; $i < 10; $i++) {
|
||||
$years[$y->year] = $y->year;
|
||||
$y->subYear();
|
||||
}
|
||||
|
||||
$view->with(['limits' => $limits, 'this_year' => $this_year, 'years' => $years]);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user