diff --git a/Modules/Lead/Config/.gitkeep b/Modules/Lead/Config/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/Modules/Lead/Config/config.php b/Modules/Lead/Config/config.php deleted file mode 100644 index 03fd4e464d..0000000000 --- a/Modules/Lead/Config/config.php +++ /dev/null @@ -1,5 +0,0 @@ - 'Lead', -]; diff --git a/Modules/Lead/Console/.gitkeep b/Modules/Lead/Console/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/Modules/Lead/Database/Factories/.gitkeep b/Modules/Lead/Database/Factories/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/Modules/Lead/Database/Migrations/.gitkeep b/Modules/Lead/Database/Migrations/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/Modules/Lead/Database/Seeders/.gitkeep b/Modules/Lead/Database/Seeders/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/Modules/Lead/Database/Seeders/LeadDatabaseSeeder.php b/Modules/Lead/Database/Seeders/LeadDatabaseSeeder.php deleted file mode 100644 index 7a14c0f80d..0000000000 --- a/Modules/Lead/Database/Seeders/LeadDatabaseSeeder.php +++ /dev/null @@ -1,36 +0,0 @@ - 'lead.create'], - ['name' => 'lead.view'], - ['name' => 'lead.update'], - ['name' => 'lead.delete'], - ]; - foreach ($leadPermissions as $permission) { - Permission::updateOrCreate($permission); - } - - // set permissions for admin role - $adminRole = Role::where(['name' => 'admin'])->first(); - foreach ($leadPermissions as $permission) { - $adminRole->givePermissionTo($permission); - } - } -} diff --git a/Modules/Lead/Entities/.gitkeep b/Modules/Lead/Entities/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/Modules/Lead/Http/Controllers/.gitkeep b/Modules/Lead/Http/Controllers/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/Modules/Lead/Http/Controllers/LeadController.php b/Modules/Lead/Http/Controllers/LeadController.php deleted file mode 100644 index 4ae4324b89..0000000000 --- a/Modules/Lead/Http/Controllers/LeadController.php +++ /dev/null @@ -1,16 +0,0 @@ -registerTranslations(); - $this->registerConfig(); - $this->registerViews(); - $this->registerFactories(); - $this->loadMigrationsFrom(module_path($this->moduleName, 'Database/Migrations')); - } - - /** - * Register the service provider. - * - * @return void - */ - public function register() - { - $this->app->register(RouteServiceProvider::class); - } - - /** - * Register views. - * - * @return void - */ - public function registerViews() - { - $viewPath = resource_path('views/modules/' . $this->moduleNameLower); - - $sourcePath = module_path($this->moduleName, 'Resources/views'); - - $this->publishes([ - $sourcePath => $viewPath, - ], ['views', $this->moduleNameLower . '-module-views']); - - $this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->moduleNameLower); - } - - /** - * Register translations. - * - * @return void - */ - public function registerTranslations() - { - $langPath = resource_path('lang/modules/' . $this->moduleNameLower); - - if (is_dir($langPath)) { - $this->loadTranslationsFrom($langPath, $this->moduleNameLower); - } else { - $this->loadTranslationsFrom(module_path($this->moduleName, 'Resources/lang'), $this->moduleNameLower); - } - } - - /** - * Register an additional directory of factories. - * - * @return void - */ - public function registerFactories() - { - if (! app()->environment('production') && $this->app->runningInConsole()) { - app(Factory::class)->load(module_path($this->moduleName, 'Database/factories')); - } - } - - /** - * Get the services provided by the provider. - * - * @return array - */ - public function provides() - { - return []; - } - - /** - * Register config. - * - * @return void - */ - protected function registerConfig() - { - $this->publishes([ - module_path($this->moduleName, 'Config/config.php') => config_path($this->moduleNameLower . '.php'), - ], 'config'); - $this->mergeConfigFrom( - module_path($this->moduleName, 'Config/config.php'), - $this->moduleNameLower - ); - } - - private function getPublishableViewPaths(): array - { - $paths = []; - foreach (\Config::get('view.paths') as $path) { - if (is_dir($path . '/modules/' . $this->moduleNameLower)) { - $paths[] = $path . '/modules/' . $this->moduleNameLower; - } - } - - return $paths; - } -} diff --git a/Modules/Lead/Providers/RouteServiceProvider.php b/Modules/Lead/Providers/RouteServiceProvider.php deleted file mode 100644 index 7c456ef1da..0000000000 --- a/Modules/Lead/Providers/RouteServiceProvider.php +++ /dev/null @@ -1,57 +0,0 @@ -mapApiRoutes(); - - $this->mapWebRoutes(); - } - - /** - * Define the "web" routes for the application. - * - * These routes all receive session state, CSRF protection, etc. - * - * @return void - */ - protected function mapWebRoutes() - { - Route::middleware('web') - ->namespace($this->moduleNamespace) - ->group(module_path('Lead', '/Routes/web.php')); - } - - /** - * Define the "api" routes for the application. - * - * These routes are typically stateless. - * - * @return void - */ - protected function mapApiRoutes() - { - Route::prefix('api') - ->middleware('api') - ->namespace($this->moduleNamespace) - ->group(module_path('Lead', '/Routes/api.php')); - } -} diff --git a/Modules/Lead/Resources/assets/.gitkeep b/Modules/Lead/Resources/assets/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/Modules/Lead/Resources/assets/js/app.js b/Modules/Lead/Resources/assets/js/app.js deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/Modules/Lead/Resources/assets/sass/app.scss b/Modules/Lead/Resources/assets/sass/app.scss deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/Modules/Lead/Resources/lang/.gitkeep b/Modules/Lead/Resources/lang/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/Modules/Lead/Resources/views/.gitkeep b/Modules/Lead/Resources/views/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/Modules/Lead/Resources/views/index.blade.php b/Modules/Lead/Resources/views/index.blade.php deleted file mode 100644 index 8d77403546..0000000000 --- a/Modules/Lead/Resources/views/index.blade.php +++ /dev/null @@ -1,7 +0,0 @@ -@extends('lead::layouts.master') - -@section('content') -
-

Coming Soon!!

-
-@endsection diff --git a/Modules/Lead/Resources/views/layouts/master.blade.php b/Modules/Lead/Resources/views/layouts/master.blade.php deleted file mode 100644 index 9010386620..0000000000 --- a/Modules/Lead/Resources/views/layouts/master.blade.php +++ /dev/null @@ -1,6 +0,0 @@ -@extends('layouts.app') -@section('js_scripts') -@endsection - -@section('css_scripts') -@endsection diff --git a/Modules/Lead/Routes/.gitkeep b/Modules/Lead/Routes/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/Modules/Lead/Routes/api.php b/Modules/Lead/Routes/api.php deleted file mode 100644 index 8d6fe8897d..0000000000 --- a/Modules/Lead/Routes/api.php +++ /dev/null @@ -1,18 +0,0 @@ -get('/lead', function (Request $request) { - return $request->user(); -}); diff --git a/Modules/Lead/Routes/web.php b/Modules/Lead/Routes/web.php deleted file mode 100644 index 534d2beda5..0000000000 --- a/Modules/Lead/Routes/web.php +++ /dev/null @@ -1,16 +0,0 @@ -group(function () { - Route::get('/', 'LeadController@index'); -}); diff --git a/Modules/Lead/Tests/Feature/.gitkeep b/Modules/Lead/Tests/Feature/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/Modules/Lead/Tests/Unit/.gitkeep b/Modules/Lead/Tests/Unit/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/Modules/Lead/composer.json b/Modules/Lead/composer.json deleted file mode 100644 index 24fe4c3960..0000000000 --- a/Modules/Lead/composer.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name": "nwidart/lead", - "description": "", - "authors": [ - { - "name": "Nicolas Widart", - "email": "n.widart@gmail.com" - } - ], - "extra": { - "laravel": { - "providers": [ - "Modules\\Lead\\Providers\\LeadServiceProvider" - ], - "aliases": { - - } - } - }, - "autoload": { - "psr-4": { - "Modules\\Lead\\": "" - } - } -} diff --git a/Modules/Lead/module.json b/Modules/Lead/module.json deleted file mode 100644 index eba51c523c..0000000000 --- a/Modules/Lead/module.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "name": "Lead", - "alias": "lead", - "description": "", - "keywords": [], - "order": 0, - "providers": [ - "Modules\\Lead\\Providers\\LeadServiceProvider" - ], - "aliases": {}, - "files": [], - "requires": [] -} diff --git a/Modules/Lead/package.json b/Modules/Lead/package.json deleted file mode 100644 index 4599509fec..0000000000 --- a/Modules/Lead/package.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "private": true, - "scripts": { - "dev": "npm run development", - "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", - "watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", - "watch-poll": "npm run watch -- --watch-poll", - "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js", - "prod": "npm run production", - "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js" - }, - "devDependencies": { - "cross-env": "^7.0", - "laravel-mix": "^5.0.1", - "laravel-mix-merge-manifest": "^0.1.2" - } -} diff --git a/Modules/Lead/webpack.mix.js b/Modules/Lead/webpack.mix.js deleted file mode 100644 index 3b782b4d8e..0000000000 --- a/Modules/Lead/webpack.mix.js +++ /dev/null @@ -1,14 +0,0 @@ -const dotenvExpand = require('dotenv-expand'); -dotenvExpand(require('dotenv').config({ path: '../../.env'/*, debug: true*/})); - -const mix = require('laravel-mix'); -require('laravel-mix-merge-manifest'); - -mix.setPublicPath('../../public').mergeManifest(); - -mix.js(__dirname + '/Resources/assets/js/app.js', 'js/lead.js') - .sass( __dirname + '/Resources/assets/sass/app.scss', 'css/lead.css'); - -if (mix.inProduction()) { - mix.version(); -} diff --git a/Modules/Prospect/Database/Migrations/2024_10_28_120851_make-nullable-fields.php b/Modules/Prospect/Database/Migrations/2024_10_28_120851_make-nullable-fields.php new file mode 100644 index 0000000000..2e5feaba06 --- /dev/null +++ b/Modules/Prospect/Database/Migrations/2024_10_28_120851_make-nullable-fields.php @@ -0,0 +1,50 @@ +date('proposal_sent_date')->nullable()->change(); + $table->string('domain')->nullable()->change(); + $table->string('customer_type')->nullable()->change(); + $table->text('budget')->nullable()->change(); + $table->string('proposal_status')->nullable()->change(); + $table->date('introductory_call')->nullable()->change(); + $table->date('last_followup_date')->nullable()->change(); + $table->string('rfp_link')->nullable()->change(); + $table->string('proposal_link')->nullable()->change(); + $table->string('currency')->nullable()->change(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('prospects', function (Blueprint $table) { + $table->date('proposal_sent_date')->nullable(false)->change(); + $table->string('domain')->nullable(false)->change(); + $table->string('customer_type')->nullable(false)->change(); + $table->text('budget')->nullable(false)->change(); + $table->string('proposal_status')->nullable(false)->change(); + $table->date('introductory_call')->nullable(false)->change(); + $table->date('last_followup_date')->nullable(false)->change(); + $table->string('rfp_link')->nullable(false)->change(); + $table->string('proposal_link')->nullable(false)->change(); + $table->string('currency')->nullable(false)->change(); + }); + } +} diff --git a/Modules/Prospect/Entities/Prospect.php b/Modules/Prospect/Entities/Prospect.php index a1d67722e4..85d850d0d2 100644 --- a/Modules/Prospect/Entities/Prospect.php +++ b/Modules/Prospect/Entities/Prospect.php @@ -2,6 +2,7 @@ namespace Modules\Prospect\Entities; +use Carbon\Carbon; use Illuminate\Database\Eloquent\Model; use Modules\User\Entities\User; @@ -19,4 +20,10 @@ public function comments() { return $this->hasMany(ProspectComment::class); } + + public function getFormattedDate($date) + { + return $date ? Carbon::parse($date)->format('M d, Y') + : '-'; + } } diff --git a/Modules/Prospect/Http/Controllers/ProspectController.php b/Modules/Prospect/Http/Controllers/ProspectController.php index 307e6301df..9a7a08b8c1 100644 --- a/Modules/Prospect/Http/Controllers/ProspectController.php +++ b/Modules/Prospect/Http/Controllers/ProspectController.php @@ -42,9 +42,9 @@ public function index() */ public function create() { + $countries = Country::all(); $user = new User(); $activeUsers = $user->active_users; - $countries = Country::all(); return view('prospect::create', [ 'users' => $activeUsers, @@ -88,9 +88,9 @@ public function show($id) public function edit($id) { $prospect = Prospect::with(['pocUser', 'comments'])->find($id); + $countries = Country::all(); $user = new User(); $activeUsers = $user->active_users; - $countries = Country::all(); return view('prospect::edit', [ 'prospect' => $prospect, diff --git a/Modules/Prospect/Http/Requests/ProspectRequest.php b/Modules/Prospect/Http/Requests/ProspectRequest.php index 92c6c46996..fe1ff644d3 100644 --- a/Modules/Prospect/Http/Requests/ProspectRequest.php +++ b/Modules/Prospect/Http/Requests/ProspectRequest.php @@ -16,14 +16,16 @@ public function rules() return [ 'org_name' => 'required', 'poc_user_id' => 'required', - 'proposal_sent_date' => 'required', - 'domain' => 'required', - 'customer_type' => 'required', - 'budget' => 'required', - 'proposal_status' => 'required', - 'currency' => 'required', - 'rfp_link' => 'required', - 'proposal_link' => 'required', + 'proposal_sent_date' => 'nullable|date', + 'domain' => 'nullable', + 'customer_type' => 'nullable', + 'budget' => 'nullable', + 'proposal_status' => 'nullable', + 'introductory_call' => 'nullable', + 'last_followup_date' => 'nullable|date', + 'rfp_link' => 'nullable|url', + 'proposal_link' => 'nullable|url', + 'currency' => 'nullable', ]; } @@ -47,13 +49,6 @@ public function messages() return [ 'org_name.required' => 'Organization name is required', 'poc_user_id.required' => 'Point of contact user ID is required', - 'proposal_sent_date.required' => 'Proposal sent date is required', - 'domain.required' => 'Domain is required', - 'customer_type.required' => 'Customer type is required', - 'budget.required' => 'Budget is required', - 'proposal_status.required' => 'Proposal status is required', - 'rfp_url.required' => 'RFP URL is required', - 'proposal_url.required' => 'Proposal URL is required', ]; } } diff --git a/Modules/Prospect/Resources/views/create.blade.php b/Modules/Prospect/Resources/views/create.blade.php index 57347362b4..9a57422a9d 100644 --- a/Modules/Prospect/Resources/views/create.blade.php +++ b/Modules/Prospect/Resources/views/create.blade.php @@ -36,22 +36,21 @@
- + + id="proposal_sent_date" value="{{ old('proposal_sent_date') }}">
- + + placeholder="Enter Domain" value="{{ old('domain') }}">

- - @foreach (config('prospect.customer-types') as $key => $customer_type)
- +
+ value="{{ old('budget') }}">

- + + placeholder="Enter Proposal Status" value="{{ old('proposal_status') }}">
- +
@@ -94,7 +93,7 @@ class="input-group-text" required="required">
- +
diff --git a/Modules/Prospect/Resources/views/index.blade.php b/Modules/Prospect/Resources/views/index.blade.php index 2886d45cb8..43358d8b66 100644 --- a/Modules/Prospect/Resources/views/index.blade.php +++ b/Modules/Prospect/Resources/views/index.blade.php @@ -10,18 +10,16 @@
@endif -
-
-
-

- Active Prospect -

-
- -
+
+
+

+ Active Prospect +

+
+
@can('prospect.create') @@ -49,31 +47,32 @@
{{ $prospect->organization_name }} + href="{{ route('prospect.show', $prospect->id) }}">{{ $prospect->organization_name ?? '-' }}
- {{ $prospect->pocUser->name }}pocUser->name }}> + {{ $prospect->pocUser->name ?? '-' }} - {{ \Carbon\Carbon::parse($prospect->proposal_sent_date)->format('M d, Y') }} + {{ $prospect->getFormattedDate($prospect->proposal_sent_date) }} - {{ $prospect->domain }} + {{ $prospect->domain ?? '-' }} - {{ ucfirst($prospect->customer_type) }} + {{ ucfirst($prospect->customer_type) ?? '-' }} + - {{ $currencySymbols[$prospect->currency] ?? '' }} - {{ number_format($prospect->budget ?? 0, 2) }} + {{ isset($prospect->currency) && isset($currencySymbols[$prospect->currency]) ? $currencySymbols[$prospect->currency] : '' }} + {{ $prospect->budget ? round($prospect->budget, 2) : '-' }} - {{ $prospect->proposal_status }} + {{ $prospect->proposal_status ?? '-' }} @endforeach diff --git a/Modules/Prospect/Resources/views/subviews/edit-prospect-details.blade.php b/Modules/Prospect/Resources/views/subviews/edit-prospect-details.blade.php index e56286aaf3..93ed715021 100644 --- a/Modules/Prospect/Resources/views/subviews/edit-prospect-details.blade.php +++ b/Modules/Prospect/Resources/views/subviews/edit-prospect-details.blade.php @@ -8,14 +8,13 @@
- + + placeholder="Enter Organization Name" value="{{ $prospect->organization_name }}">
- - @foreach ($users as $user)
{{ $prospect->introductory_call ? \Carbon\Carbon::parse($prospect->introductory_call)->format('M d, Y') : 'N/A' }} + class="ml-2">{{ $prospect->introductory_call ? $prospect->getFormattedDate($prospect->introductory_call) : 'N/A' }}
@@ -75,14 +76,18 @@ class="ml-2">{{ $prospect->introductory_call ? \Carbon\Carbon::parse($prospect->
- {{ $prospect->proposal_status }} + {{ $prospect->proposal_status ?? 'N/A' }}
- View + @if ($prospect->proposal_link) + View + @else + N/A + @endif
@@ -91,8 +96,12 @@ class="fa fa-external-link">
- View + @if ($prospect->rfp_link) + View + @else + N/A + @endif
diff --git a/Modules/Prospect/Resources/views/subviews/show.blade.php b/Modules/Prospect/Resources/views/subviews/show.blade.php index fae72cbacc..9e83091b0a 100644 --- a/Modules/Prospect/Resources/views/subviews/show.blade.php +++ b/Modules/Prospect/Resources/views/subviews/show.blade.php @@ -1,5 +1,6 @@ @extends('prospect::layouts.master') @section('content') + @includeWhen(session('status'), 'toast', ['message' => session('status')])

diff --git a/Modules/Prospect/Services/ProspectService.php b/Modules/Prospect/Services/ProspectService.php index e37534ac7a..19b86e93b4 100644 --- a/Modules/Prospect/Services/ProspectService.php +++ b/Modules/Prospect/Services/ProspectService.php @@ -17,22 +17,23 @@ public function store($validated) public function update($request, $id) { + $budget = $request->budget ?? null; $prospect = Prospect::find($id); $prospect->organization_name = $request->org_name; $prospect->poc_user_id = $request->poc_user_id; $prospect->proposal_sent_date = $request->proposal_sent_date; $prospect->domain = $request->domain; $prospect->customer_type = $request->customer_type; - $prospect->budget = $request->budget; + $prospect->budget = $budget; $prospect->proposal_status = $request->proposal_status; $prospect->introductory_call = $request->introductory_call; $prospect->last_followup_date = $request->last_followup_date; $prospect->rfp_link = $request->rfp_link; $prospect->proposal_link = $request->proposal_link; - $prospect->currency = $request->currency; + $prospect->currency = $budget ? $request->currency : null; $prospect->save(); - return redirect()->route('prospect.edit', $prospect->id)->with('status', 'Prospect updated successfully!'); + return redirect()->route('prospect.show', $prospect->id)->with('status', 'Prospect updated successfully!'); } public function commentUpdate($validated, $id) @@ -48,18 +49,19 @@ public function commentUpdate($validated, $id) private function saveProspectData($prospect, $validated) { + $budget = $validated['budget'] ?? null; $prospect->organization_name = $validated['org_name']; $prospect->poc_user_id = $validated['poc_user_id']; - $prospect->proposal_sent_date = $validated['proposal_sent_date']; - $prospect->domain = $validated['domain']; - $prospect->customer_type = $validated['customer_type']; - $prospect->budget = $validated['budget']; - $prospect->proposal_status = $validated['proposal_status']; - $prospect->introductory_call = $validated['introductory_call'] ?? $validated['proposal_sent_date']; - $prospect->last_followup_date = $validated['last_followup_date'] ?? $validated['proposal_sent_date']; - $prospect->rfp_link = $validated['rfp_link']; - $prospect->proposal_link = $validated['proposal_link']; - $prospect->currency = $validated['currency']; + $prospect->proposal_sent_date = $validated['proposal_sent_date'] ?? null; + $prospect->domain = $validated['domain'] ?? null; + $prospect->customer_type = $validated['customer_type'] ?? null; + $prospect->budget = $budget; + $prospect->proposal_status = $validated['proposal_status'] ?? null; + $prospect->introductory_call = $validated['introductory_call'] ?? null; + $prospect->last_followup_date = $validated['last_followup_date'] ?? null; + $prospect->rfp_link = $validated['rfp_link'] ?? null; + $prospect->proposal_link = $validated['proposal_link'] ?? null; + $prospect->currency = $budget ? $validated['currency'] : null; $prospect->save(); } } diff --git a/Modules/User/Entities/User.php b/Modules/User/Entities/User.php index 4175d5757c..89243765be 100644 --- a/Modules/User/Entities/User.php +++ b/Modules/User/Entities/User.php @@ -240,16 +240,16 @@ public function prospects() public function getActiveUsersAttribute() { - $users = self::all(); - $activeUser = []; + $users = self::query()->orderBy('name')->get(); + $activeUsers = []; foreach ($users as $user) { if (! $user->isActiveEmployee) { continue; } - $activeUser[] = $user; + $activeUsers[] = $user; } - return $activeUser; + return $activeUsers; } public function prospectsComments() diff --git a/resources/views/layouts/navbar.blade.php b/resources/views/layouts/navbar.blade.php index d287641e2e..cb9dcee4e3 100644 --- a/resources/views/layouts/navbar.blade.php +++ b/resources/views/layouts/navbar.blade.php @@ -105,9 +105,6 @@ @can('prospect.view') Prospects @endcan - @can('lead.view') - Leads - @endcan @can('sales_automation.view') Sales Automation @endcan