Skip to content

Commit

Permalink
feat: new layout
Browse files Browse the repository at this point in the history
  • Loading branch information
kamgrzeski committed Oct 17, 2024
1 parent da447cc commit 37fcc24
Show file tree
Hide file tree
Showing 134 changed files with 4,061 additions and 11,641 deletions.
2 changes: 1 addition & 1 deletion app/Http/Controllers/CRM/ClientController.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function processShowClientDetails(ClientsModel $client): \Illuminate\View
public function processRenderUpdateForm(ClientsModel $client): \Illuminate\View\View
{
// Return the view for updating the client record.
return view('crm.clients.edit')->with(['client' => $this->clientService->loadClientDetails($client)]);
return view('crm.clients.update')->with(['client' => $this->clientService->loadClientDetails($client)]);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/CRM/CompaniesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function processListOfCompanies(): \Illuminate\View\View
public function processRenderUpdateForm(CompaniesModel $company): \Illuminate\View\View
{
// Return view with company and clients
return view('crm.companies.edit')->with([
return view('crm.companies.update')->with([
'company' => $company,
'clients' => ClientsQueries::getAll()
]);
Expand Down
11 changes: 8 additions & 3 deletions app/Http/Controllers/CRM/DealsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function processListOfDeals(): \Illuminate\View\View
public function processRenderUpdateForm(DealsModel $deal): \Illuminate\View\View
{
// Load the deal record for editing.
return view('crm.deals.edit')->with([
return view('crm.deals.update')->with([
'deal' => $deal,
'companies' => CompaniesQueries::getAll(),
]);
Expand Down Expand Up @@ -163,7 +163,7 @@ public function processDeleteDeal(DealsModel $deal): \Illuminate\Http\RedirectRe
public function processSetIsActive(DealsModel $deal): \Illuminate\Http\RedirectResponse
{
// Update the deal status.
$this->dispatchSync(new UpdateDealJob(['is_active' => $deal->is_active], $deal));
$this->dispatchSync(new UpdateDealJob(['is_active' => ! $deal->is_active], $deal));

// Log the action.
$this->dispatchSync(new StoreSystemLogJob('Deals has been enabled with id: ' . $deal->id, 201, auth()->user()));
Expand All @@ -189,7 +189,7 @@ public function processStoreDealTerms(StoreDealTermRequest $request, DealsModel
$this->dispatchSync(new StoreSystemLogJob('Deals terms has been added.', 201, auth()->user()));

// Redirect back with a success message.
return redirect()->back()->with('message_success', $this->getMessage('messages.deal_term_store'));
return redirect()->route('deals.view', $deal)->with('message_success', $this->getMessage('messages.deal_term_store'));
}

/**
Expand Down Expand Up @@ -223,4 +223,9 @@ public function processDeleteDealTerm(DealsTermsModel $dealTerm): \Illuminate\Ht
// Redirect back with a success message.
return redirect()->back()->with('message_success', $this->getMessage('messages.deal_term_delete'));
}

public function processRenderTermCreateForm(DealsModel $deal)
{
return view('crm.deals.terms.create')->with(['deal' => $deal]);
}
}
2 changes: 1 addition & 1 deletion app/Http/Controllers/CRM/EmployeesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function processListOfEmployees(): \Illuminate\View\View
public function processRenderUpdateForm(EmployeesModel $employee): \Illuminate\View\View
{
// Load the employee record details and the clients data to be used in the form.
return view('crm.employees.edit')->with([
return view('crm.employees.update')->with([
'employee' => $employee,
'clients' => ClientsQueries::getAll()
]);
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/CRM/FinancesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ public function processListOfFinances()
public function processRenderUpdateForm(FinancesModel $finance)
{
// Return the view with the finance record and the companies.
return view('crm.finances.edit')->with([
return view('crm.finances.update')->with([
'finance' => $finance,
'companies' => CompaniesQueries::getAll(true)
'companies' => CompaniesQueries::getAll()
]);
}

Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/CRM/ProductsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function processShowProductsDetails(ProductsModel $product): \Illuminate\
public function processRenderUpdateForm(ProductsModel $product): \Illuminate\View\View
{
// Load the product details and render the update form.
return view('crm.products.edit')->with(['product' => $product]);
return view('crm.products.update')->with(['product' => $product]);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/CRM/SalesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function processShowSalesDetails(SalesModel $sale): \Illuminate\View\View
public function processRenderUpdateForm(SalesModel $sale): \Illuminate\View\View
{
// Load the sale record details and the products data to be used in the form.
return view('crm.sales.edit')->with([
return view('crm.sales.update')->with([
'sale' => $sale,
'products' => ProductsQueries::getAll()
]);
Expand Down
6 changes: 3 additions & 3 deletions app/Http/Controllers/CRM/TasksController.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function __construct(EmployeesService $employeesService)
public function processRenderCreateForm(): \Illuminate\View\View
{
// Load the employees for the task.
return view('crm.tasks.create')->with(['employees' => $this->employeesService->loadEmployees(true)]);
return view('crm.tasks.create')->with(['employees' => $this->employeesService->loadEmployees()]);
}

/**
Expand Down Expand Up @@ -77,7 +77,7 @@ public function processShowTasksDetails(TasksModel $task): \Illuminate\View\View
public function processRenderUpdateForm(TasksModel $task): \Illuminate\View\View
{
// Load the task record for editing.
return view('crm.tasks.edit')->with([
return view('crm.tasks.update')->with([
'task' => $task,
'employees' => $this->employeesService->loadEmployees()
]);
Expand Down Expand Up @@ -153,7 +153,7 @@ public function processDeleteTask(TasksModel $task): \Illuminate\Http\RedirectRe
public function processTaskSetIsActive(TasksModel $task): \Illuminate\Http\RedirectResponse
{
// Update the task status.
$this->dispatchSync(new UpdateTaskJob(['is_active' => $task->is_active], $task));
$this->dispatchSync(new UpdateTaskJob(['is_active' => ! $task->is_active], $task));

// Log the task status change.
$this->dispatchSync(new StoreSystemLogJob('Tasks has been enabled with id: ' . $task->id, 201, auth()->user()));
Expand Down
4 changes: 4 additions & 0 deletions app/Http/Controllers/DashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ private function storeInCacheUsableVariables(): void
Cache::put('completedTasks', $this->tasksService->loadCompletedTasks(), env('CACHE_TIME'));
Cache::put('uncompletedTasks', $this->tasksService->loadUncompletedTasks(), env('CACHE_TIME'));


//loading circle
Cache::put('loadingCircle', SettingsQueries::getSettingValue('loading_circle'), env('CACHE_TIME'));

// currency
Cache::put('currency', SettingsQueries::getSettingValue('currency'), env('CACHE_TIME'));

Expand Down
2 changes: 1 addition & 1 deletion app/Http/Requests/DealStoreRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function rules()
'name' => 'required|string',
'start_time' => 'required',
'end_time' => 'required',
'companies_id' => 'required|integer',
'company_id' => 'required|integer',
];
}
}
2 changes: 1 addition & 1 deletion app/Http/Requests/DealUpdateRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function rules()
'name' => 'required|string',
'start_time' => 'required',
'end_time' => 'required',
'companies_id' => 'required|integer',
'company_id' => 'required|integer',
];
}
}
2 changes: 1 addition & 1 deletion app/Http/Requests/FinanceStoreRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function rules()
{
return [
'name' => 'required|string',
'companies_id' => 'required|integer',
'company_id' => 'required|integer',
'description' => 'required|string',
'type' => 'required|string',
'gross' => 'required|string',
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Requests/FinanceUpdateRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function rules()
{
return [
'name' => 'required|string',
'companies_id' => 'required|integer',
'company_id' => 'required|integer',
'description' => 'required|string',
'type' => 'required|string',
'gross' => 'required|string',
Expand Down
2 changes: 1 addition & 1 deletion app/Models/DealsModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class DealsModel extends Model
{
use SoftDeletes, BelongsToCompany, HasManyDealTerms;

protected $fillable = ['name', 'companies_id', 'is_active'];
protected $fillable = ['name', 'company_id', 'is_active'];

protected $table = 'deals';
protected $dates = ['deleted_at'];
Expand Down
3 changes: 1 addition & 2 deletions app/Models/EmployeesModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ class EmployeesModel extends Model
use SoftDeletes, HasManyCompanies, BelongsToDeal, BelongsToClient, HasManyTasks;

protected $fillable = [
'first_name',
'last_name',
'full_name',
'email',
'phone',
'company_id',
Expand Down
3 changes: 2 additions & 1 deletion app/Models/FinancesModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ class FinancesModel extends Model
use SoftDeletes, BelongsToCompany;

protected $fillable = [
'companies_id',
'name',
'company_id',
'gross',
'net',
'vat',
Expand Down
6 changes: 1 addition & 5 deletions app/Queries/CompaniesQueries.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,10 @@ class CompaniesQueries
/**
* Get all companies.
*
* @param bool $createForm Whether to return companies in a format suitable for form creation.
* @return \Illuminate\Support\Collection|\Illuminate\Database\Eloquent\Collection
*/
public static function getAll(bool $createForm = false): \Illuminate\Support\Collection|\Illuminate\Database\Eloquent\Collection
public static function getAll(): \Illuminate\Support\Collection|\Illuminate\Database\Eloquent\Collection
{
if($createForm) {
return CompaniesModel::pluck('name', 'id');
}
return CompaniesModel::all()->sortBy('created_at');
}

Expand Down
2 changes: 1 addition & 1 deletion app/Relations/Has/HasManySales.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ trait HasManySales

public function sales(): HasMany
{
return $this->hasMany(SalesModel::class);
return $this->hasMany(SalesModel::class, 'product_id');
}
}
2 changes: 1 addition & 1 deletion app/Services/DealsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function loadGenerateDealTermsInPDF(DealsTermsModel $dealTerm, DealsModel
'body' => $dealTerm->body
];

$pdf = PDF::loadView('crm.deals.terms_pdf', $data);
$pdf = PDF::loadView('crm.deals.terms.terms_pdf', $data);

return $pdf->download($deal->name . '.pdf');
}
Expand Down
7 changes: 1 addition & 6 deletions app/Services/EmployeesService.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,9 @@ class EmployeesService
/**
* Load all employees, optionally for creating a form.
*
* @param bool $createForm Whether to load employees for creating a form.
*/
public function loadEmployees(bool $createForm = false): \Illuminate\Support\Collection
public function loadEmployees(): \Illuminate\Support\Collection
{
if($createForm) {
return EmployeesModel::pluck('full_name', 'id');
}

$employees = EmployeesModel::orderBy('created_at')->get();

foreach($employees as $key => $employee) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('deals', function (Blueprint $table) {
$table->date('start_time')->change();
$table->date('end_time')->change();
});
}

/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('deals', function (Blueprint $table) {
$table->string('start_time')->change();
$table->string('end_time')->change();
});
}
};
Loading

0 comments on commit 37fcc24

Please sign in to comment.