378 lines
20 KiB
PHP
378 lines
20 KiB
PHP
@extends('layouts.app')
|
|
|
|
@section('title', __('crm::lang.crm'))
|
|
|
|
@section('content')
|
|
|
|
@include('crm::layouts.nav')
|
|
|
|
<section class="content no-print crm-page">
|
|
<div class="crm-page-header">
|
|
<div>
|
|
<h1><i class="fas fa-tachometer-alt" style="color:#4f46e5;margin-left:8px;"></i> @lang('crm::lang.crm')</h1>
|
|
<p class="crm-subtitle">@lang('home.welcome_message', ['name' => Session::get('user.first_name')])</p>
|
|
</div>
|
|
</div>
|
|
|
|
{{-- Personal stats --}}
|
|
<div class="crm-admin-section">
|
|
<div class="crm-stat-grid">
|
|
@if(auth()->user()->can('crm.access_all_schedule') || auth()->user()->can('crm.access_own_schedule'))
|
|
<div class="crm-stat-card crm-stat-indigo">
|
|
<div class="crm-stat-icon"><i class="fas fa-calendar-check"></i></div>
|
|
<span class="crm-stat-label">{{ __('crm::lang.todays_followups') }}</span>
|
|
<span class="crm-stat-value">{{ $todays_followups }}</span>
|
|
</div>
|
|
@endif
|
|
@if(auth()->user()->can('crm.access_all_leads') || auth()->user()->can('crm.access_own_leads'))
|
|
<div class="crm-stat-card crm-stat-teal">
|
|
<div class="crm-stat-icon"><i class="fas fa-user-check"></i></div>
|
|
<span class="crm-stat-label">{{ __('crm::lang.my_leads') }}</span>
|
|
<span class="crm-stat-value">{{ $my_leads }}</span>
|
|
</div>
|
|
@endif
|
|
<div class="crm-stat-card crm-stat-amber">
|
|
<div class="crm-stat-icon"><i class="fas fa-exchange-alt"></i></div>
|
|
<span class="crm-stat-label">{{ __('crm::lang.my_leads_to_customer_conversion') }}</span>
|
|
<span class="crm-stat-value">{{ $my_conversion }}</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="crm-widget-grid">
|
|
@if(auth()->user()->can('crm.access_all_schedule') || auth()->user()->can('crm.access_own_schedule'))
|
|
<div>
|
|
<div class="crm-card">
|
|
<div class="crm-card-header">
|
|
<h3 class="crm-card-title"><i class="fas fa-tasks" style="color:#4f46e5;margin-left:6px;"></i> @lang('crm::lang.my_followups')</h3>
|
|
</div>
|
|
<div class="crm-card-body" style="padding:0;">
|
|
<table class="table no-margin">
|
|
@foreach($statuses as $key => $value)
|
|
<tr>
|
|
<th style="padding:10px 20px;font-weight:600;color:#4a5b6f;">{{$value}}</th>
|
|
<td style="padding:10px 20px;font-weight:700;color:#1a1f36;">
|
|
{{ $my_follow_ups_arr[$key] ?? 0 }}
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
@if(isset($my_follow_ups_arr['__other']))
|
|
<tr>
|
|
<th style="padding:10px 20px;">@lang('lang_v1.others')</th>
|
|
<td style="padding:10px 20px;font-weight:700;">{{ $my_follow_ups_arr['__other'] }}</td>
|
|
</tr>
|
|
@endif
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@endif
|
|
@if(config('constants.enable_crm_call_log'))
|
|
<div>
|
|
<div class="crm-card">
|
|
<div class="crm-card-header">
|
|
<h3 class="crm-card-title"><i class="fas fa-phone-alt" style="color:#0d9488;margin-left:6px;"></i> @lang('crm::lang.my_call_logs')</h3>
|
|
</div>
|
|
<div class="crm-card-body" style="padding:0;">
|
|
<table class="table no-margin">
|
|
<tr>
|
|
<th style="padding:10px 20px;">@lang('crm::lang.calls_today')</th>
|
|
<td style="padding:10px 20px;font-weight:700;">{{ $my_call_logs->calls_today ?? 0 }}</td>
|
|
</tr>
|
|
<tr>
|
|
<th style="padding:10px 20px;">@lang('crm::lang.calls_yesterday')</th>
|
|
<td style="padding:10px 20px;font-weight:700;">{{ $my_call_logs->calls_yesterday ?? 0 }}</td>
|
|
</tr>
|
|
<tr>
|
|
<th style="padding:10px 20px;">@lang('crm::lang.calls_this_month')</th>
|
|
<td style="padding:10px 20px;font-weight:700;">{{ $my_call_logs->calls_this_month ?? 0 }}</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@endif
|
|
</div>
|
|
</div>
|
|
|
|
@if($is_admin)
|
|
<hr class="crm-section-divider">
|
|
|
|
<div class="crm-admin-section">
|
|
<div class="crm-stat-grid">
|
|
<div class="crm-stat-card crm-stat-sky">
|
|
<div class="crm-stat-icon"><i class="fas fa-user-friends"></i></div>
|
|
<span class="crm-stat-label">{{ __('lang_v1.customers') }}</span>
|
|
<span class="crm-stat-value">{{ $total_customers }}</span>
|
|
</div>
|
|
<div class="crm-stat-card crm-stat-indigo">
|
|
<div class="crm-stat-icon"><i class="fas fa-user-tag"></i></div>
|
|
<span class="crm-stat-label">{{ __('crm::lang.leads') }}</span>
|
|
<span class="crm-stat-value">{{ $total_leads }}</span>
|
|
</div>
|
|
<div class="crm-stat-card crm-stat-amber">
|
|
<div class="crm-stat-icon"><i class="fas fa-search"></i></div>
|
|
<span class="crm-stat-label">{{ __('crm::lang.sources') }}</span>
|
|
<span class="crm-stat-value">{{ $total_sources }}</span>
|
|
</div>
|
|
<div class="crm-stat-card crm-stat-rose">
|
|
<div class="crm-stat-icon"><i class="fas fa-life-ring"></i></div>
|
|
<span class="crm-stat-label">{{ __('crm::lang.life_stages') }}</span>
|
|
<span class="crm-stat-value">{{ $total_life_stage }}</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="crm-insight-grid">
|
|
<div class="crm-insight-stack">
|
|
<div class="crm-card">
|
|
<div class="crm-card-header">
|
|
<h3 class="crm-card-title">@lang('crm::lang.sources')</h3>
|
|
</div>
|
|
<div class="crm-card-body" style="padding:0;">
|
|
<table class="table no-margin">
|
|
<thead>
|
|
<tr>
|
|
<th>{{ __('crm::lang.sources') }}</th>
|
|
<th>{{ __('sale.total') }}</th>
|
|
<th>{{ __('crm::lang.conversion') }}</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@forelse($sources as $source)
|
|
<tr>
|
|
<td>{{ $source->name }}</td>
|
|
<td>{{ $leads_count_by_source[$source->id]['count'] ?? 0 }}</td>
|
|
<td>
|
|
@if(!empty($customers_count_by_source[$source->id]) && !empty($contacts_count_by_source[$source->id]))
|
|
@php $conversion = ($customers_count_by_source[$source->id]['count'] / $contacts_count_by_source[$source->id]['count']) * 100; @endphp
|
|
<span class="label label-success">{{ round($conversion) }}%</span>
|
|
@else
|
|
<span class="label label-default">0%</span>
|
|
@endif
|
|
</td>
|
|
</tr>
|
|
@empty
|
|
<tr><td colspan="3" class="text-center">@lang('lang_v1.no_data')</td></tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="crm-card">
|
|
<div class="crm-card-header">
|
|
<h3 class="crm-card-title">@lang('crm::lang.life_stages')</h3>
|
|
</div>
|
|
<div class="crm-card-body" style="padding:0;">
|
|
<table class="table no-margin">
|
|
<thead>
|
|
<tr>
|
|
<th>{{ __('crm::lang.life_stages') }}</th>
|
|
<th>{{ __('sale.total') }}</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@forelse($life_stages as $life_stage)
|
|
<tr>
|
|
<td>{{ $life_stage->name }}</td>
|
|
<td>{{ !empty($leads_by_life_stage[$life_stage->id]) ? count($leads_by_life_stage[$life_stage->id]) : 0 }}</td>
|
|
</tr>
|
|
@empty
|
|
<tr><td colspan="2" class="text-center">@lang('lang_v1.no_data')</td></tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="crm-insight-main">
|
|
<div class="crm-card">
|
|
<div class="crm-card-header">
|
|
<h3 class="crm-card-title">
|
|
<i class="fas fa-birthday-cake" style="color:#e11d48;margin-left:6px;"></i>
|
|
@lang('crm::lang.birthdays')
|
|
</h3>
|
|
<a data-href="{{action([\Modules\Crm\Http\Controllers\CampaignController::class, 'create'])}}" class="crm-btn crm-btn-primary btn-xs" id="wish_birthday">
|
|
<i class="fas fa-paper-plane"></i> @lang('crm::lang.send_wishes')
|
|
</a>
|
|
</div>
|
|
<div class="crm-card-body" style="padding:0;">
|
|
<table class="table no-margin table-striped">
|
|
<caption style="padding:10px 20px;font-weight:700;color:#4a5b6f;">@lang('home.today')</caption>
|
|
<thead>
|
|
<tr>
|
|
<th>#</th>
|
|
<th>@lang('user.name')</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@forelse($todays_birthdays as $birthday)
|
|
<tr>
|
|
<td><input type="checkbox" class="contat_id" name="contat_id[]" value="{{$birthday['id']}}" id="contat_id_{{$birthday['id']}}"></td>
|
|
<td><label for="contat_id_{{$birthday['id']}}" class="cursor-pointer fw-100">{{$birthday['name']}}</label></td>
|
|
</tr>
|
|
@empty
|
|
<tr><td colspan="2" class="text-center">@lang('lang_v1.no_data')</td></tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
@if(!empty($upcoming_birthdays))<hr class="m-2">@endif
|
|
<table class="table no-margin table-striped">
|
|
<caption style="padding:10px 20px;font-weight:700;color:#4a5b6f;">@lang('crm::lang.upcoming')</caption>
|
|
<thead>
|
|
<tr>
|
|
<th>#</th>
|
|
<th>@lang('user.name')</th>
|
|
<th>@lang('crm::lang.birthday_on')</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@forelse($upcoming_birthdays as $birthday)
|
|
<tr>
|
|
<td><input type="checkbox" class="contat_id" name="contat_id[]" value="{{$birthday['id']}}" id="contat_id_{{$birthday['id']}}"></td>
|
|
<td><label for="contat_id_{{$birthday['id']}}" class="cursor-pointer fw-100">{{$birthday['name']}}</label></td>
|
|
<td>{{ $birthday['dob_display'] }}</td>
|
|
</tr>
|
|
@empty
|
|
<tr><td colspan="3" class="text-center">@lang('lang_v1.no_data')</td></tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<hr class="crm-section-divider">
|
|
|
|
<div class="crm-admin-section">
|
|
<div class="crm-card">
|
|
<div class="crm-card-header">
|
|
<h3 class="crm-card-title">@lang('crm::lang.follow_ups_by_user')</h3>
|
|
</div>
|
|
<div class="crm-card-body">
|
|
<div class="row">
|
|
<div class="col-md-3">
|
|
<div class="form-group">
|
|
{!! Form::label('follow_up_user_date_range', __('report.date_range') . ':') !!}
|
|
{!! Form::text('follow_up_user_date_range', null, ['placeholder' => __('lang_v1.select_a_date_range'), 'class' => 'form-control', 'readonly']); !!}
|
|
</div>
|
|
</div>
|
|
<div class="col-md-3">
|
|
<div class="form-group">
|
|
{!! Form::label('followup_category_id', __('crm::lang.followup_category') .':') !!}
|
|
{!! Form::select('followup_category_id', $followup_category, null, ['class' => 'form-control select2', 'style' => 'width: 100%;', 'placeholder' => __('messages.all')]); !!}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="table-responsive">
|
|
<table class="table table-bordered table-striped" id="follow_ups_by_user_table" style="width: 100%;">
|
|
<thead>
|
|
<tr>
|
|
<th>@lang('role.user')</th>
|
|
@foreach($statuses as $key => $value)
|
|
<th>{{ $value }}</th>
|
|
@endforeach
|
|
<th>@lang('lang_v1.none')</th>
|
|
<th>@lang('crm::lang.total_follow_ups')</th>
|
|
</tr>
|
|
</thead>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="crm-report-grid">
|
|
<div>
|
|
<div class="crm-card">
|
|
<div class="crm-card-header">
|
|
<h3 class="crm-card-title">@lang('crm::lang.lead_to_customer_conversion')</h3>
|
|
</div>
|
|
<div class="crm-card-body">
|
|
<div class="table-responsive">
|
|
<table class="table table-bordered table-striped" id="lead_to_customer_conversion" style="width: 100%;">
|
|
<thead>
|
|
<tr>
|
|
<th> </th>
|
|
<th>@lang('crm::lang.converted_by')</th>
|
|
<th>@lang('sale.total')</th>
|
|
</tr>
|
|
</thead>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
@if(config('constants.enable_crm_call_log'))
|
|
<div>
|
|
<div class="crm-card">
|
|
<div class="crm-card-header">
|
|
<h3 class="crm-card-title">@lang('crm::lang.all_users_call_log')</h3>
|
|
</div>
|
|
<div class="crm-card-body">
|
|
<div class="table-responsive">
|
|
<table class="table" id="all_users_call_log" style="width: 100%;">
|
|
<thead>
|
|
<tr>
|
|
<th>@lang('role.user')</th>
|
|
<th>@lang('crm::lang.calls_today')</th>
|
|
<th>@lang('crm::lang.calls_this_month')</th>
|
|
<th>@lang('lang_v1.all')</th>
|
|
</tr>
|
|
</thead>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@endif
|
|
</div>
|
|
</div>
|
|
@endif
|
|
</section>
|
|
@endsection
|
|
|
|
@section('javascript')
|
|
<script src="{{ asset('modules/crm/js/crm.js?v=' . $asset_v) }}"></script>
|
|
@include('crm::reports.report_javascripts')
|
|
<script type="text/javascript">
|
|
$(document).ready(function () {
|
|
$(document).on('click', '#wish_birthday', function () {
|
|
var url = $(this).data('href');
|
|
var contact_ids = [];
|
|
$("input.contat_id").each(function(){
|
|
if ($(this).is(":checked")) {
|
|
contact_ids.push($(this).val());
|
|
}
|
|
});
|
|
|
|
if (_.isEmpty(contact_ids)) {
|
|
alert("{{__('crm::lang.plz_select_user')}}");
|
|
} else {
|
|
location.href = url+'?contact_ids='+contact_ids;
|
|
}
|
|
});
|
|
|
|
@if(config('constants.enable_crm_call_log'))
|
|
all_users_call_log = $("#all_users_call_log").DataTable({
|
|
processing: true,
|
|
serverSide: true,
|
|
scrollY: "75vh",
|
|
scrollX: true,
|
|
scrollCollapse: true,
|
|
fixedHeader: false,
|
|
'ajax': {
|
|
url: "{{action([\Modules\Crm\Http\Controllers\CallLogController::class, 'allUsersCallLog'])}}"
|
|
},
|
|
columns: [
|
|
{ data: 'username', name: 'u.username' },
|
|
{ data: 'calls_today', searchable: false },
|
|
{ data: 'calls_yesterday', searchable: false },
|
|
{ data: 'all_calls', searchable: false }
|
|
],
|
|
});
|
|
@endif
|
|
});
|
|
</script>
|
|
@endsection
|