private function showUserDetails() { $oauthLoginUrls = []; foreach (AuthService::$providers as $provider) { $oauthLoginUrls[] = ['label' => $provider, 'url' => '/auth/' . strtolower($provider)]; } $data = ['account' => Account::with('users')->findOrFail(Auth::user()->account_id), 'title' => trans('texts.user_details'), 'user' => Auth::user(), 'oauthProviderName' => AuthService::getProviderName(Auth::user()->oauth_provider_id), 'oauthLoginUrls' => $oauthLoginUrls]; return View::make('accounts.user_details', $data); }
/** * @return \Illuminate\Contracts\View\View */ public function showUserDetails() { $oauthLoginUrls = []; foreach (AuthService::$providers as $provider) { $oauthLoginUrls[] = ['label' => $provider, 'url' => URL::to('/auth/' . strtolower($provider))]; } $data = ['account' => Account::with('users')->findOrFail(Auth::user()->account_id), 'title' => trans('texts.user_details'), 'user' => Auth::user(), 'oauthProviderName' => AuthService::getProviderName(Auth::user()->oauth_provider_id), 'oauthLoginUrls' => $oauthLoginUrls, 'referralCounts' => $this->referralRepository->getCounts(Auth::user()->id)]; return View::make('accounts.user_details', $data); }
public function showSection($section = ACCOUNT_DETAILS, $subSection = false) { if ($section == ACCOUNT_DETAILS) { $oauthLoginUrls = []; foreach (AuthService::$providers as $provider) { $oauthLoginUrls[] = ['label' => $provider, 'url' => '/auth/' . strtolower($provider)]; } $data = ['account' => Account::with('users')->findOrFail(Auth::user()->account_id), 'countries' => Cache::get('countries'), 'sizes' => Cache::get('sizes'), 'industries' => Cache::get('industries'), 'timezones' => Cache::get('timezones'), 'dateFormats' => Cache::get('dateFormats'), 'datetimeFormats' => Cache::get('datetimeFormats'), 'currencies' => Cache::get('currencies'), 'languages' => Cache::get('languages'), 'title' => trans('texts.company_details'), 'user' => Auth::user(), 'oauthProviderName' => AuthService::getProviderName(Auth::user()->oauth_provider_id), 'oauthLoginUrls' => $oauthLoginUrls]; return View::make('accounts.details', $data); } elseif ($section == ACCOUNT_PAYMENTS) { $account = Auth::user()->account; $account->load('account_gateways'); $count = count($account->account_gateways); if ($count == 0) { return Redirect::to('gateways/create'); } else { return View::make('accounts.payments', ['showAdd' => $count < count(Gateway::$paymentTypes), 'title' => trans('texts.online_payments')]); } } elseif ($section == ACCOUNT_NOTIFICATIONS) { $data = ['account' => Account::with('users')->findOrFail(Auth::user()->account_id), 'title' => trans('texts.notifications')]; return View::make('accounts.notifications', $data); } elseif ($section == ACCOUNT_IMPORT_EXPORT) { return View::make('accounts.import_export', ['title' => trans('texts.import_export')]); } elseif ($section == ACCOUNT_ADVANCED_SETTINGS) { $account = Auth::user()->account->load('country'); $data = ['account' => $account, 'feature' => $subSection, 'title' => trans('texts.invoice_settings')]; if ($subSection == ACCOUNT_INVOICE_DESIGN || $subSection == ACCOUNT_CUSTOMIZE_DESIGN) { $invoice = new stdClass(); $client = new stdClass(); $contact = new stdClass(); $invoiceItem = new stdClass(); $client->name = 'Sample Client'; $client->address1 = ''; $client->city = ''; $client->state = ''; $client->postal_code = ''; $client->work_phone = ''; $client->work_email = ''; $invoice->invoice_number = $account->getNextInvoiceNumber(); $invoice->invoice_date = Utils::fromSqlDate(date('Y-m-d')); $invoice->account = json_decode($account->toJson()); $invoice->amount = $invoice->balance = 100; $invoice->terms = trim($account->invoice_terms); $invoice->invoice_footer = trim($account->invoice_footer); $contact->email = '*****@*****.**'; $client->contacts = [$contact]; $invoiceItem->cost = 100; $invoiceItem->qty = 1; $invoiceItem->notes = 'Notes'; $invoiceItem->product_key = 'Item'; $invoice->client = $client; $invoice->invoice_items = [$invoiceItem]; $data['account'] = $account; $data['invoice'] = $invoice; $data['invoiceLabels'] = json_decode($account->invoice_labels) ?: []; $data['title'] = trans('texts.invoice_design'); $data['invoiceDesigns'] = InvoiceDesign::getDesigns(); $design = false; foreach ($data['invoiceDesigns'] as $item) { if ($item->id == $account->invoice_design_id) { $design = $item->javascript; break; } } if ($subSection == ACCOUNT_CUSTOMIZE_DESIGN) { $data['customDesign'] = $account->custom_design && !$design ? $account->custom_design : $design; } } else { if ($subSection == ACCOUNT_TEMPLATES_AND_REMINDERS) { $data['templates'] = []; $data['defaultTemplates'] = []; foreach ([ENTITY_INVOICE, ENTITY_QUOTE, ENTITY_PAYMENT, REMINDER1, REMINDER2, REMINDER3] as $type) { $data['templates'][$type] = ['subject' => $account->getEmailSubject($type), 'template' => $account->getEmailTemplate($type)]; $data['defaultTemplates'][$type] = ['subject' => $account->getDefaultEmailSubject($type), 'template' => $account->getDefaultEmailTemplate($type)]; } $data['emailFooter'] = $account->getEmailFooter(); $data['title'] = trans('texts.email_templates'); } else { if ($subSection == ACCOUNT_USER_MANAGEMENT) { $data['title'] = trans('texts.users_and_tokens'); } } } return View::make("accounts.{$subSection}", $data); } elseif ($section == ACCOUNT_PRODUCTS) { $data = ['account' => Auth::user()->account, 'title' => trans('texts.product_library')]; return View::make('accounts.products', $data); } }