Skip to content

Commit

Permalink
Merge pull request #3740 from ColoredCow/hotfix/remove-mandatory-fields
Browse files Browse the repository at this point in the history
[Hotfix]:- Remove the Mandatory Field
  • Loading branch information
Ayush authored Oct 28, 2024
2 parents ce87ddd + 4f4ded8 commit ef79f3d
Show file tree
Hide file tree
Showing 11 changed files with 152 additions and 106 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php

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

class MakeNullableFields extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('prospects', function (Blueprint $table) {
$table->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();
});
}
}
7 changes: 7 additions & 0 deletions Modules/Prospect/Entities/Prospect.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Modules\Prospect\Entities;

use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
use Modules\User\Entities\User;

Expand All @@ -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')
: '-';
}
}
4 changes: 2 additions & 2 deletions Modules/Prospect/Http/Controllers/ProspectController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
15 changes: 0 additions & 15 deletions Modules/Prospect/Http/Requests/ProspectRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,6 @@ 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',
];
}

Expand All @@ -47,13 +39,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',
];
}
}
29 changes: 14 additions & 15 deletions Modules/Prospect/Resources/views/create.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,21 @@
<br>
<div class="form-row">
<div class="form-group col-md-5">
<label for="proposal_sent_date" class="field-required">Proposal Sent Date</label>
<label for="proposal_sent_date">Proposal Sent Date</label>
<input type="date" class="form-control" name="proposal_sent_date"
id="proposal_sent_date" value="{{ old('proposal_sent_date') }}" required="required">
id="proposal_sent_date" value="{{ old('proposal_sent_date') }}">
</div>
<div class="form-group offset-md-1 col-md-5">
<label for="domain" class="field-required">{{ __('Domain') }}</label>
<label for="domain">{{ __('Domain') }}</label>
<input type="text" class="form-control" name="domain" id="domain"
placeholder="Enter Domain" value="{{ old('domain') }}" required="required">
placeholder="Enter Domain" value="{{ old('domain') }}">
</div>
</div>
<br>
<div class="form-row">
<div class="form-group col-md-5">
<label for="customer_type" class="field-required">{{ __('Customer Type') }}</label>
<select name="customer_type" id="customer_type" class="form-control"
required="required">
<label for="customer_type">{{ __('Customer Type') }}</label>
<select name="customer_type" id="customer_type" class="form-control">
<option value="">Select Customer Type</option>
@foreach (config('prospect.customer-types') as $key => $customer_type)
<option value="{{ $key }}"
Expand All @@ -61,40 +60,40 @@
</select>
</div>
<div class="form-group offset-md-1 col-md-5">
<label for="budget" class="field-required">{{ __('Budget') }}</label>
<label for="budget">{{ __('Budget') }}</label>
<div class="input-group">
<div class="input-group-prepend">
<select name="currency" v-model="currency" id="currency"
class="input-group-text" required="required">
class="input-group-text">
<option value="">Select Currency</option>
@foreach ($countries as $country)
<option value="{{ $country->currency }}">{{ $country->currency }}
</option>
@endforeach
</select>
</div>
<input type="number" class="form-control" name="budget" placeholder="Enter Budget"
required="required" step=".01" min="0" value="{{ old('budget') }}">
value="{{ old('budget') }}">
</div>
</div>
</div>
<br>
<div class="form-row">
<div class="form-group col-md-5">
<label for="proposal_status" class="field-required">{{ __('Proposal Status') }}</label>
<label for="proposal_status">{{ __('Proposal Status') }}</label>
<input type="text" class="form-control" name="proposal_status" id="proposal_status"
placeholder="Enter Proposal Status" required="required"
value="{{ old('proposal_status') }}">
placeholder="Enter Proposal Status" value="{{ old('proposal_status') }}">
</div>
<div class="form-group offset-md-1 col-md-5">
<label for="rfp_link" class="field-required">{{ __('RFP Link') }}</label>
<label for="rfp_link">{{ __('RFP Link') }}</label>
<input type="url" class="form-control" name="rfp_link" id="rfp_link"
placeholder="Enter RFP URL" value="{{ old('rfp_link') }}">
</div>
</div>
<br />
<div class="form-row">
<div class="form-group col-md-5">
<label for="proposal_link" class="field-required">{{ __('Proposal Link') }}</label>
<label for="proposal_link">{{ __('Proposal Link') }}</label>
<input type="url" class="form-control" name="proposal_link" id="proposal_link"
placeholder="Enter Proposal URL" value="{{ old('proposal_link') }}">
</div>
Expand Down
42 changes: 20 additions & 22 deletions Modules/Prospect/Resources/views/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,16 @@
</button>
</div>
@endif
<div class="mb-2">
<form class="d-md-flex justify-content-between mt-5 mb-5" action="">
<div class='d-flex justify-content-between align-items-md-center mb-2 mb-xl-0'>
<h4 class="">
Active Prospect
</h4>
</div>
<div class="d-flex align-items-center">
<a href="{{ route('prospect.create') }}" class="btn btn-success text-white"><i class="fa fa-plus"></i>
{{ __('Add new prospect') }}</a>
</div>
</form>
<div class="mb-2 d-md-flex justify-content-between">
<div class='d-flex justify-content-between align-items-md-center mt-5 mb-5 mb-xl-0'>
<h4 class="">
Active Prospect
</h4>
</div>
<div class="d-flex align-items-center">
<a href="{{ route('prospect.create') }}" class="btn btn-success text-white"><i class="fa fa-plus"></i>
{{ __('Add new prospect') }}</a>
</div>
</div>
<div class='d-md-none mb-2'>
@can('prospect.create')
Expand Down Expand Up @@ -49,31 +47,31 @@
<td class="w-30p">
<div>
<a
href="{{ route('prospect.show', $prospect->id) }}">{{ $prospect->organization_name }}</a>
href="{{ route('prospect.show', $prospect->id) }}">{{ $prospect->organization_name ?? '-' }}</a>
</div>
</td>
<td class="w-15p">
<img src="{{ $prospect->pocUser->avatar }}" class="rounded-circle" width="30"
height="30" alt="{{ $prospect->pocUser->name }}"data-toggle="tooltip"
data-placement="top" title={{ $prospect->pocUser->name }}>
<img src="{{ $prospect->pocUser->avatar ?? '' }}" class="rounded-circle" width="30"
height="30" alt="{{ $prospect->pocUser->name ?? '-' }}" data-toggle="tooltip"
data-placement="top" title="{{ $prospect->pocUser->name ?? '-' }}">
</td>
<td class="w-30p">
<span>{{ \Carbon\Carbon::parse($prospect->proposal_sent_date)->format('M d, Y') }}</span>
<span>{{ $prospect->getFormattedDate($prospect->proposal_sent_date) }}</span>
</td>
<td class="w-20p">
<span>{{ $prospect->domain }}</span>
<span>{{ $prospect->domain ?? '-' }}</span>
</td>
<td class="w-20p">
<span>{{ ucfirst($prospect->customer_type) }}</span>
<span>{{ ucfirst($prospect->customer_type) ?? '-' }}</span>
</td>
<td class="w-30p">
<span>
{{ $currencySymbols[$prospect->currency] ?? '' }}
{{ number_format($prospect->budget ?? 0, 2) }}
{{ $prospect->budget ? $currencySymbols[$prospect->currency] : '' }}
{{ $prospect->budget ? round($prospect->budget, 2) : '-' }}
</span>
</td>
<td class="w-20p">
<span class="">{{ $prospect->proposal_status }}</span>
<span class="">{{ $prospect->proposal_status ?? '-' }}</span>
</td>
</tr>
@endforeach
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@
<input type="hidden" name="create_prospect" value="create_prospect">
<div class="form-row">
<div class="form-group form-group col-md-5">
<label for="name" class="field-required">Organization Name</label>
<label for="name">Organization Name</label>
<input type="text" class="form-control" name="org_name" id="org_name"
placeholder="Enter Organization Name" required="required"
value="{{ $prospect->organization_name }}">
placeholder="Enter Organization Name" value="{{ $prospect->organization_name }}">
</div>
<div class="form-group offset-md-1 col-md-5">
<label for="client_id" class="field-required">ColoredCow POC</label>
<select name="poc_user_id" id="poc_user_id" class="form-control" required="required">
<label for="client_id">ColoredCow POC</label>
<select name="poc_user_id" id="poc_user_id" class="form-control">
<option value="">Select POC User</option>
@foreach ($users as $user)
<option value="{{ $user->id }}"
Expand All @@ -27,20 +26,20 @@
</div>
<div class="form-row">
<div class="form-group col-md-5">
<label for="proposal_sent_date" class="field-required">Proposal Sent Date</label>
<label for="proposal_sent_date">Proposal Sent Date</label>
<input type="date" class="form-control" name="proposal_sent_date" id="proposal_sent_date"
value="{{ $prospect->proposal_sent_date }}" required="required">
value="{{ $prospect->proposal_sent_date }}">
</div>
<div class="form-group offset-md-1 col-md-5">
<label for="domain" class="field-required">{{ __('Domain') }}</label>
<label for="domain">{{ __('Domain') }}</label>
<input type="text" class="form-control" name="domain" id="domain"
placeholder="Enter Domain" value="{{ $prospect->domain }}" required="required">
placeholder="Enter Domain" value="{{ $prospect->domain }}">
</div>
</div>
<div class="form-row">
<div class="form-group col-md-5">
<label for="customer_type" class="field-required">{{ __('Customer Type') }}</label>
<select name="customer_type" id="customer_type" class="form-control" required="required">
<label for="customer_type">{{ __('Customer Type') }}</label>
<select name="customer_type" id="customer_type" class="form-control">
<option value="">Select Customer Type</option>
@foreach (config('prospect.customer-types') as $key => $customer_type)
<option value="{{ $key }}"
Expand All @@ -50,29 +49,27 @@
</select>
</div>
<div class="form-group offset-md-1 col-md-5">
<label for="budget" class="field-required">{{ __('Budget') }}</label>
<label for="budget">{{ __('Budget') }}</label>
<div class="input-group">
<div class="input-group-prepend">
<select name="currency" v-model="currency" id="currency" class="input-group-text"
required="required">
<select name="currency" v-model="currency" id="currency" class="input-group-text">
<option value="">Select Currency</option>
@foreach ($countries as $country)
<option value="{{ $country->currency }}">{{ $country->currency }}
</option>
@endforeach
</select>
</div>
<input type="number" class="form-control" name="budget" placeholder="Enter Budget"
required="required" id="budget" step=".01" min="0"
value="{{ $prospect->budget }}">
id="budget" step=".01" min="0" value="{{ $prospect->budget }}">
</div>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-5">
<label for="proposal_status" class="field-required">{{ __('Proposal Status') }}</label>
<label for="proposal_status">{{ __('Proposal Status') }}</label>
<input type="text" class="form-control" name="proposal_status" id="proposal_status"
placeholder="Enter Proposal Status" required="required"
value="{{ $prospect->proposal_status }}">
placeholder="Enter Proposal Status" value="{{ $prospect->proposal_status }}">
</div>
<div class="form-group offset-md-1 col-md-5">
<label for="introductory_call">{{ __('Introductory Call') }}</label>
Expand Down
Loading

0 comments on commit ef79f3d

Please sign in to comment.