forked from krayin/laravel-crm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
Added Feature krayin#1815
1 parent
1f90616
commit bc6fadc
Showing
10 changed files
with
245 additions
and
3 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
45 changes: 45 additions & 0 deletions
45
packages/Webkul/Admin/src/Http/Controllers/Contact/Organizations/ActivityController.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,45 @@ | ||
<?php | ||
|
||
namespace Webkul\Admin\Http\Controllers\Contact\Organizations; | ||
|
||
use Webkul\Activity\Repositories\ActivityRepository; | ||
use Webkul\Admin\Http\Controllers\Controller; | ||
use Webkul\Admin\Http\Resources\ActivityResource; | ||
use Webkul\Email\Repositories\EmailRepository; | ||
|
||
class ActivityController extends Controller | ||
{ | ||
/** | ||
* Create a new controller instance. | ||
* | ||
* @return void | ||
*/ | ||
public function __construct( | ||
protected ActivityRepository $activityRepository, | ||
protected EmailRepository $emailRepository | ||
) {} | ||
|
||
/** | ||
* Display a listing of the resource. | ||
* | ||
* @param int $id | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function index($id) | ||
{ | ||
$activities = $this->activityRepository | ||
->leftJoin('organization_activities', 'activities.id', '=', 'organization_activities.activity_id') | ||
->where('organization_activities.organization_id', $id) | ||
->get(); | ||
|
||
return ActivityResource::collection($this->concatEmail($activities)); | ||
} | ||
|
||
/** | ||
* Store a newly created resource in storage. | ||
*/ | ||
public function concatEmail($activities) | ||
{ | ||
return $activities->sortByDesc('id')->sortByDesc('created_at'); | ||
} | ||
} |
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
85 changes: 85 additions & 0 deletions
85
packages/Webkul/Admin/src/Resources/views/contacts/organizations/view.blade.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,85 @@ | ||
<x-admin::layouts> | ||
<x-slot:title> | ||
@lang('admin::app.contacts.organizations.view.title', ['name' => $organization->name]) | ||
</x-slot> | ||
|
||
<!-- Content --> | ||
<div class="flex gap-4"> | ||
<!-- Left Panel --> | ||
{!! view_render_event('admin.contact.organizations.view.left.before', ['organization' => $organization]) !!} | ||
|
||
<div class="[&>div:last-child]:border-b-0 sticky top-[73px] flex min-w-[394px] max-w-[394px] flex-col self-start rounded-lg border border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-900"> | ||
<!-- organization Information --> | ||
<div class="flex w-full flex-col gap-2 border-b border-gray-200 p-4 dark:border-gray-800"> | ||
<!-- Breadcrumbs --> | ||
<div class="flex items-center justify-between"> | ||
<x-admin::breadcrumbs | ||
name="contacts.organizations.view" | ||
:entity="$organization" | ||
/> | ||
</div> | ||
|
||
<!-- Title --> | ||
<div class="mb-4 flex flex-col gap-0.5"> | ||
{!! view_render_event('admin.contact.organizations.view.title.before', ['organization' => $organization]) !!} | ||
|
||
<h3 class="text-lg font-bold dark:text-white"> | ||
{{ $organization->name }} | ||
</h3> | ||
|
||
<p class="dark:text-white"> | ||
{{ $organization->job_title }} | ||
</p> | ||
|
||
{!! view_render_event('admin.contact.organizations.view.title.after', ['organization' => $organization]) !!} | ||
</div> | ||
|
||
<!-- Activity Actions --> | ||
<div class="flex flex-wrap gap-2"> | ||
{!! view_render_event('admin.contact.organizations.view.actions.before', ['organization' => $organization]) !!} | ||
|
||
<!-- Mail Activity Action --> | ||
<x-admin::activities.actions.mail | ||
:entity="$organization" | ||
entity-control-name="organization_id" | ||
/> | ||
|
||
<!-- File Activity Action --> | ||
<x-admin::activities.actions.file | ||
:entity="$organization" | ||
entity-control-name="organization_id" | ||
/> | ||
|
||
<!-- Note Activity Action --> | ||
<x-admin::activities.actions.note | ||
:entity="$organization" | ||
entity-control-name="organization_id" | ||
/> | ||
|
||
<!-- Activity Action --> | ||
<x-admin::activities.actions.activity | ||
:entity="$organization" | ||
entity-control-name="organization_id" | ||
/> | ||
|
||
{!! view_render_event('admin.contact.organizations.view.actions.after', ['organization' => $organization]) !!} | ||
</div> | ||
</div> | ||
|
||
<!-- organization Attributes --> | ||
@include ('admin::contacts.organizations.view.attributes') | ||
</div> | ||
|
||
{!! view_render_event('admin.contact.organizations.view.left.after', ['organization' => $organization]) !!} | ||
|
||
<!-- Right Panel --> | ||
<div class="flex w-full flex-col gap-4 rounded-lg"> | ||
{!! view_render_event('admin.contact.organizations.view.right.before', ['organization' => $organization]) !!} | ||
|
||
<!-- Stages Navigation --> | ||
<x-admin::activities :endpoint="route('admin.contacts.organizations.activities.index', $organization->id)" /> | ||
|
||
{!! view_render_event('admin.contact.organizations.view.right.after', ['organization' => $organization]) !!} | ||
</div> | ||
</div> | ||
</x-admin::layouts> |
35 changes: 35 additions & 0 deletions
35
packages/Webkul/Admin/src/Resources/views/contacts/organizations/view/attributes.blade.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,35 @@ | ||
{!! view_render_event('admin.contacts.organization.view.attributes.before', ['organization' => $organization]) !!} | ||
|
||
<div class="flex w-full flex-col gap-4 border-b border-gray-200 p-4 dark:border-gray-800"> | ||
<h4 class="font-semibold dark:text-white"> | ||
@lang('admin::app.contacts.persons.view.about-organization') | ||
</h4> | ||
|
||
{!! view_render_event('admin.contacts.organization.view.attributes.form_controls.before', ['organization' => $organization]) !!} | ||
|
||
<x-admin::form | ||
v-slot="{ meta, errors, handleSubmit }" | ||
as="div" | ||
ref="modalForm" | ||
> | ||
<form @submit="handleSubmit($event, () => {})"> | ||
{!! view_render_event('admin.contacts.organization.view.attributes.form_controls.attributes_view.before', ['organization' => $organization]) !!} | ||
|
||
<x-admin::attributes.view | ||
:custom-attributes="app('Webkul\Attribute\Repositories\AttributeRepository')->findWhere([ | ||
'entity_type' => 'organizations', | ||
['code', 'NOTIN', ['name', 'jon_title']] | ||
])" | ||
:entity="$organization" | ||
:url="route('admin.contacts.organizations.update', $organization->id)" | ||
:allow-edit="true" | ||
/> | ||
|
||
{!! view_render_event('admin.contacts.organization.view.attributes.form_controls.attributes_view.after', ['organization' => $organization]) !!} | ||
</form> | ||
</x-admin::form> | ||
|
||
{!! view_render_event('admin.contacts.organization.view.attributes.form_controls.after', ['organization' => $organization]) !!} | ||
</div> | ||
|
||
{!! view_render_event('admin.contacts.organization.view.attributes.before', ['organization' => $organization]) !!} |
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
30 changes: 30 additions & 0 deletions
30
...ontact/src/Database/Migrations/2025_01_02_161212_create_organization_activities_table.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,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::create('organization_activities', function (Blueprint $table) { | ||
$table->integer('activity_id')->unsigned(); | ||
$table->foreign('activity_id')->references('id')->on('activities')->onDelete('cascade'); | ||
|
||
$table->integer('organization_id')->unsigned(); | ||
$table->foreign('organization_id')->references('id')->on('organizations')->onDelete('cascade'); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
*/ | ||
public function down(): void | ||
{ | ||
Schema::dropIfExists('lead_activities'); | ||
} | ||
}; |
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