-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3744 from ColoredCow/feat/phase-2-prospect-module
[Feat]:- Prospect Module Updates
- Loading branch information
Showing
17 changed files
with
345 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
Modules/Prospect/Database/Migrations/2024_10_28_221259_added-client-id-project-name.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
class AddedClientIdProjectName extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::table('prospects', function (Blueprint $table) { | ||
$table->unsignedBigInteger('client_id')->nullable(); | ||
$table->string('project_name')->nullable(); | ||
$table->string('organization_name')->nullable()->change(); | ||
|
||
$table->foreign('client_id')->references('id')->on('clients'); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
Schema::table('prospects', function (Blueprint $table) { | ||
$table->dropForeign(['client_id']); | ||
$table->dropColumn('client_id'); | ||
$table->dropColumn('project_name'); | ||
$table->string('organization_name')->nullable(false)->change(); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
const CUSTOMER_TYPES = { | ||
NEW: 'new', | ||
EXISTING: 'existing', | ||
DORMANT: 'dormant' | ||
}; | ||
document.addEventListener('DOMContentLoaded', function () { | ||
const customerTypeField = document.getElementById('customer_type'); | ||
const orgNameTextField = document.getElementById('org_name_text_field'); | ||
const orgNameSelectField = document.getElementById('org_name_select_field'); | ||
const orgNameTextInput = document.getElementById('org_name'); | ||
const orgNameSelectInput = document.getElementById('org_name_select'); | ||
|
||
function toggleOrgNameField() { | ||
if (customerTypeField.value === CUSTOMER_TYPES.NEW) { | ||
orgNameTextField.classList.remove('d-none'); | ||
orgNameSelectField.classList.add('d-none'); | ||
orgNameTextInput.required = true; | ||
orgNameSelectInput.value = ''; | ||
orgNameSelectInput.required = false; | ||
} else if (customerTypeField.value === CUSTOMER_TYPES.EXISTING) { | ||
orgNameTextField.classList.add('d-none'); | ||
orgNameSelectField.classList.remove('d-none'); | ||
orgNameSelectInput.required = true; | ||
orgNameTextInput.required = false; | ||
orgNameTextInput.value = null; | ||
} else { | ||
orgNameTextField.classList.remove('d-none'); | ||
orgNameSelectField.classList.add('d-none'); | ||
orgNameTextInput.required = true; | ||
orgNameSelectInput.value = ''; | ||
orgNameSelectInput.required = false; | ||
} | ||
} | ||
|
||
toggleOrgNameField(); | ||
|
||
customerTypeField.addEventListener('change', toggleOrgNameField); | ||
}); |
Oops, something went wrong.