Merge branch 'feature/VoiceFiles' into 'feature/CreateExcel'
Feature/voice files See merge request witel-back-end/crm!22
This commit is contained in:
@@ -70,3 +70,4 @@ TRUSTED_IP="127.0.0.1"
|
||||
|
||||
NOTIFICATION_SERVER_URL=
|
||||
LOGIN_HASH_VALUE=
|
||||
SETAD_IP=
|
||||
|
||||
32
app/Console/Commands/SendSupervisorCheckStatsCommand.php
Normal file
32
app/Console/Commands/SendSupervisorCheckStatsCommand.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Services\Commands\SendSupervisorCheckStatsReportService;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class SendSupervisorCheckStatsCommand extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'report:send-supervisor-check-stats';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'gather all supervisor check stats report and send them to the center';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*/
|
||||
public function handle(SendSupervisorCheckStatsReportService $service): void
|
||||
{
|
||||
$service->execute();
|
||||
$this->info('Done!');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\HeadquartersDashboard;
|
||||
|
||||
use App\Facades\DataTable\DataTableFacade;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class CumulativeSupervisorPerformanceStatsController extends Controller
|
||||
{
|
||||
public function index(Request $request): JsonResponse
|
||||
{
|
||||
$query = DB::table('supervisor_performances')->selectRaw("
|
||||
province_id,
|
||||
province_name,
|
||||
SUM(calls) AS total,
|
||||
SUM(reviews) AS reviews,
|
||||
SUM(good) AS good,
|
||||
SUM(bad) AS bad
|
||||
")
|
||||
->groupBy('province_id', 'province_name')
|
||||
->unionAll(DB::table('supervisor_performances')->selectRaw("
|
||||
0 as province_id,
|
||||
'کشوری' as province_name,
|
||||
SUM(calls) AS total,
|
||||
SUM(reviews) AS reviews,
|
||||
SUM(good) AS good,
|
||||
SUM(bad) AS bad
|
||||
"));
|
||||
|
||||
return response()->json(
|
||||
DataTableFacade::run(
|
||||
$query,
|
||||
$request,
|
||||
allowedFilters: ['*'],
|
||||
allowedSortings: ['*'])
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Http\Controllers\HeadquartersDashboard;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use app\Http\Traits\ApiResponse;
|
||||
use App\Models\Province;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
@@ -10,19 +11,20 @@ use Illuminate\Support\Facades\Hash;
|
||||
|
||||
class LoginToProvinceController extends Controller
|
||||
{
|
||||
public function loginToProvince(Request $request)
|
||||
use ApiResponse;
|
||||
|
||||
public function authenticate(Request $request)
|
||||
{
|
||||
$province_ip = Province::query()
|
||||
->Where('id', '=', $request->province_id)
|
||||
->value('ip_address');
|
||||
|
||||
$payload = [
|
||||
$data = [
|
||||
'user_id' => auth()->user()->id,
|
||||
'token' => Hash::make(config('globalVariables.LOGIN_HASH_VALUE')),
|
||||
'ip' => $province_ip,
|
||||
];
|
||||
|
||||
$url = $province_ip . "?" . http_build_query($payload);
|
||||
|
||||
return redirect($url);
|
||||
return $this->successResponse($data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,9 +37,11 @@ class ProfileController extends Controller
|
||||
public function changeAvatar(ChangeAvatarRequest $request): JsonResponse
|
||||
{
|
||||
$user = auth()->user();
|
||||
|
||||
if ($user->avatar){
|
||||
FileFacade::delete($user->avatar, true);
|
||||
}
|
||||
|
||||
$user->update([
|
||||
'avatar' => FileFacade::save($request->file('avatar'), 'users/avatars/' . $request->username)
|
||||
]);
|
||||
@@ -49,16 +51,19 @@ class ProfileController extends Controller
|
||||
|
||||
public function online(Request $request): JsonResponse
|
||||
{
|
||||
User::query()->where('telephone_id', '=', $request->telephone_id)->update([
|
||||
'is_online' => true,
|
||||
]);
|
||||
User::query()
|
||||
->firstWhere('telephone_id', '=', $request->telephone_id)
|
||||
->update(['is_online' => true,]);
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
public function offline(Request $request): JsonResponse
|
||||
{
|
||||
$user= User::query()->where('telephone_id', '=', $request->telephone_id)->first();
|
||||
$user->update(['is_online' => false]);
|
||||
User::query()
|
||||
->firstWhere('telephone_id', '=', $request->telephone_id)
|
||||
->update(['is_online' => false]);
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,8 @@ namespace App\Http\Controllers\ProvinceDashboard\OperatorDialogues;
|
||||
|
||||
use App\Exports\OperatorDialogues\OperatorCartableExcel;
|
||||
use App\Http\Controllers\Controller;
|
||||
use app\Http\Traits\ApiResponse;
|
||||
use App\Models\OperatorDialogue;
|
||||
use App\Services\Dashboard\Province\OperatorDialogues\DataTableService;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -12,6 +14,7 @@ use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
||||
|
||||
class OperatorController extends Controller
|
||||
{
|
||||
use ApiResponse;
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
@@ -23,9 +26,9 @@ class OperatorController extends Controller
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*/
|
||||
public function show(string $id)
|
||||
public function show(OperatorDialogue $operatorDialogue): JsonResponse
|
||||
{
|
||||
//
|
||||
return $this->successResponse($operatorDialogue);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -44,5 +44,4 @@ class SupervisorController extends Controller
|
||||
$data = $dataTableService->dataTable($request, true);
|
||||
return Excel::download(new SupervisorCartableExcel($data['data']), $name);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ namespace App\Http\Controllers\ProvinceDashboard\PeopleMessages;
|
||||
|
||||
use App\Exports\PeopleMessages\SupervisorCartableExcel;
|
||||
use App\Http\Controllers\Controller;
|
||||
use app\Http\Traits\ApiResponse;
|
||||
use App\Models\PeopleMessage;
|
||||
use App\Services\Dashboard\Province\PeopleMessages\DataTableService;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -11,6 +13,8 @@ use Maatwebsite\Excel\Facades\Excel;
|
||||
|
||||
class SupervisorController extends Controller
|
||||
{
|
||||
use ApiResponse;
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
@@ -29,8 +33,8 @@ class SupervisorController extends Controller
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*/
|
||||
public function show(string $id)
|
||||
public function show(PeopleMessage $peopleMessage)
|
||||
{
|
||||
//
|
||||
return $this->successResponse($peopleMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\ProvinceDashboard;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use app\Http\Traits\ApiResponse;
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
|
||||
class VerifyAuthenticationController extends Controller
|
||||
{
|
||||
use ApiResponse;
|
||||
|
||||
public function login(Request $request)
|
||||
{
|
||||
if (!Hash::check(config('globalVariables.LOGIN_HASH_VALUE'), $request->token)) {
|
||||
return $this->errorResponse('Invalid token');
|
||||
}
|
||||
|
||||
$user = User::query()->findOrFail($request->user_id);
|
||||
|
||||
Auth::login($user);
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
}
|
||||
@@ -11,18 +11,14 @@ class VerifySetadIp
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
|
||||
* @param Closure(Request): (Response) $next
|
||||
*/
|
||||
public function handle(Request $request, Closure $next): Response
|
||||
{
|
||||
$masterServerIp = env('MASTER_SERVER_IP');
|
||||
if (is_null($masterServerIp)) {
|
||||
return response('Master server IP not configured.', 500);
|
||||
}
|
||||
if ($request->ip() !== $masterServerIp) {
|
||||
return response('Unauthorized.', 401);
|
||||
|
||||
}
|
||||
if ($request->ip() == config('globalVariables.SETAD_IP')) {
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
abort(Response::HTTP_FORBIDDEN);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ExpertPerformance extends Model
|
||||
{
|
||||
/** @use HasFactory<\Database\Factories\ExpertPerformanceFactory> */
|
||||
use HasFactory;
|
||||
}
|
||||
15
app/Models/SupervisorPerformance.php
Normal file
15
app/Models/SupervisorPerformance.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Database\Factories\SupervisorPerformanceFactory;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class SupervisorPerformance extends Model
|
||||
{
|
||||
/** @use HasFactory<SupervisorPerformanceFactory> */
|
||||
use HasFactory;
|
||||
|
||||
protected $guarded = [];
|
||||
}
|
||||
@@ -2,13 +2,23 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Database\Factories\SystemMessageFactory;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
class SystemMessage extends Model
|
||||
{
|
||||
/** @use HasFactory<\Database\Factories\SystemMessageFactory> */
|
||||
/** @use HasFactory<SystemMessageFactory> */
|
||||
use HasFactory;
|
||||
|
||||
protected $guarded = [];
|
||||
|
||||
protected function voice(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: fn($value) => $value == null ? null : Storage::disk('public')->url($value)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Commands;
|
||||
|
||||
use Exception;
|
||||
use Illuminate\Http\Client\ConnectionException;
|
||||
use Illuminate\Http\Client\RequestException;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class SendSupervisorCheckStatsReportService
|
||||
{
|
||||
private string $url;
|
||||
private string $channelName;
|
||||
private string $provinceId;
|
||||
private string $provinceName;
|
||||
public function __construct()
|
||||
{
|
||||
$this->url = config('ProvinceInfo.center_ip');
|
||||
$this->channelName = 'send_supervisor_check_stats_report';
|
||||
$this->provinceId = config('ProvinceInfo.id');
|
||||
$this->provinceName = config('ProvinceInfo.name');
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws ConnectionException
|
||||
* @throws RequestException
|
||||
*/
|
||||
public function execute(): void
|
||||
{
|
||||
try
|
||||
{
|
||||
$data = $this->prepare();
|
||||
Http::post($this->url, $data)->throw();
|
||||
Log::channel($this->channelName)->info(SendSupervisorCheckStatsReportService::class, [$this->provinceName, array_sum($data), 'successful']);
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
Log::channel($this->channelName)->error(SendSupervisorCheckStatsReportService::class, [$e->getMessage()]);
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
private function prepare(): array
|
||||
{
|
||||
$query = "
|
||||
SELECT
|
||||
{$this->provinceId} AS province_id,
|
||||
'{$this->provinceName}' AS province_name,
|
||||
od.date,
|
||||
COUNT(*) AS reviews,
|
||||
COUNT(CASE WHEN is_good = 1 THEN 1 END) AS good,
|
||||
COUNT(CASE WHEN is_good = 0 THEN 1 END) AS bad,
|
||||
COALESCE(cdr_data.calls, 0) AS calls
|
||||
FROM (
|
||||
SELECT date, is_good
|
||||
FROM operator_dialogues
|
||||
WHERE supervisor_id IS NOT NULL
|
||||
AND create_at > NOW() - INTERVAL 3 DAY
|
||||
) AS od
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
DATE(calldate) AS d,
|
||||
COUNT(CASE
|
||||
WHEN dcontext = 'from-internal'
|
||||
AND disposition = 'ANSWERED'
|
||||
AND dst > 100 AND dst < 105
|
||||
THEN 1 END) AS calls
|
||||
FROM asteriskcdrdb.cdr
|
||||
WHERE calldate > NOW() - INTERVAL 3 DAY
|
||||
GROUP BY d
|
||||
) AS cdr_data
|
||||
ON od.date = cdr_data.d
|
||||
GROUP BY od.date, cdr_data.calls
|
||||
ORDER BY od.date DESC";
|
||||
|
||||
return DB::select($query);
|
||||
}
|
||||
}
|
||||
@@ -12,12 +12,11 @@ class DataTableService
|
||||
public function index(Request $request)
|
||||
{
|
||||
$query = DB::table('asteriskcdrdb.cdr')
|
||||
->leftJoin('crm_db.voice_experts', 'asteriskcdrdb.cdr.uniqueid', '=', 'crm_db.operator_dialogues.cdr_unique_id')
|
||||
->leftJoin('crm_db.operator_dialogues', 'asteriskcdrdb.cdr.uniqueid', '=', 'crm_db.operator_dialogues.cdr_unique_id')
|
||||
->where('dst', '<>', '')
|
||||
->where('lastapp', '=', 'Dial')
|
||||
->where('duration', '>', 0)
|
||||
->where('recordingfile', '<>', '')
|
||||
->select('*');
|
||||
->where('recordingfile', '<>', '');
|
||||
|
||||
return DataTableFacade::run(
|
||||
$query,
|
||||
|
||||
@@ -13,18 +13,18 @@ class ReportService
|
||||
$query = DB::table('asteriskcdrdb.cdr')
|
||||
->selectRaw("
|
||||
DATE(calldate) AS d,
|
||||
COUNT(CASE WHEN (recordingfile = '' OR recordingfile LIKE 'q-%') THEN 1 END) AS c_all,
|
||||
COUNT(CASE WHEN lastdata = 'IAX2/serverpeer/100' THEN 1 END) AS c_teh4,
|
||||
COUNT(CASE WHEN lastdata = 'IAX2/242serverpeer/200' THEN 1 END) AS c_teh5,
|
||||
COUNT(CASE WHEN dst = '500' THEN 1 END) AS c_os4,
|
||||
COUNT(CASE WHEN dst = '600' THEN 1 END) AS c_os5,
|
||||
COUNT(CASE WHEN dcontext = 'from-internal' AND disposition = 'ANSWERED' AND dst BETWEEN 101 AND 104 THEN 1 END) AS c_ok,
|
||||
COUNT(CASE WHEN dcontext = 'from-internal' AND disposition = 'NO ANSWER' AND dst BETWEEN 101 AND 104 AND duration > 14 THEN 1 END) AS c_nok,
|
||||
COUNT(CASE WHEN dcontext = 'from-internal' AND disposition = 'ANSWERED' AND dst BETWEEN 101 AND 104 AND billsec > 9 THEN 1 END) AS c_b10,
|
||||
COUNT(CASE WHEN lastapp = 'Busy' THEN 1 END) AS c_dnd,
|
||||
COUNT(CASE WHEN dst BETWEEN 502 AND 599 THEN 1 END) AS c_trans,
|
||||
COUNT(CASE WHEN disposition <> 'BUSY' AND dst BETWEEN 101 AND 105 THEN 1 END) AS ch_all,
|
||||
AVG(CASE WHEN dcontext = 'from-internal' AND disposition = 'ANSWERED' THEN billsec END) AS c_avg
|
||||
COUNT(CASE WHEN (recordingfile = '' OR recordingfile LIKE 'q-%') THEN 1 END) AS total,
|
||||
COUNT(CASE WHEN lastdata = 'IAX2/serverpeer/100' THEN 1 END) AS teh4,
|
||||
COUNT(CASE WHEN lastdata = 'IAX2/242serverpeer/200' THEN 1 END) AS teh5,
|
||||
COUNT(CASE WHEN dst = '500' THEN 1 END) AS os4,
|
||||
COUNT(CASE WHEN dst = '600' THEN 1 END) AS os5,
|
||||
COUNT(CASE WHEN dcontext = 'from-internal' AND disposition = 'ANSWERED' AND dst BETWEEN 101 AND 104 THEN 1 END) AS ok,
|
||||
COUNT(CASE WHEN dcontext = 'from-internal' AND disposition = 'NO ANSWER' AND dst BETWEEN 101 AND 104 AND duration > 14 THEN 1 END) AS nok,
|
||||
COUNT(CASE WHEN dcontext = 'from-internal' AND disposition = 'ANSWERED' AND dst BETWEEN 101 AND 104 AND billsec > 9 THEN 1 END) AS b10,
|
||||
COUNT(CASE WHEN lastapp = 'Busy' THEN 1 END) AS dnd,
|
||||
COUNT(CASE WHEN dst BETWEEN 502 AND 599 THEN 1 END) AS trans,
|
||||
COUNT(CASE WHEN disposition <> 'BUSY' AND dst BETWEEN 101 AND 105 THEN 1 END) AS all,
|
||||
AVG(CASE WHEN dcontext = 'from-internal' AND disposition = 'ANSWERED' THEN billsec END) AS avg
|
||||
");
|
||||
// ->whereBetween('calldate', [$from, $to]) // use Carbon or date strings
|
||||
// ->groupBy(DB::raw('DATE(calldate)'))
|
||||
@@ -44,8 +44,8 @@ class ReportService
|
||||
{
|
||||
$query = DB::table('people_messages')
|
||||
->selectRaw('
|
||||
COUNT(CASE WHEN is_listen = 1 THEN 1 END) AS c_l,
|
||||
COUNT(CASE WHEN is_listen = 0 THEN 1 END) AS c_nl
|
||||
COUNT(CASE WHEN is_listen = 1 THEN 1 END) AS l,
|
||||
COUNT(CASE WHEN is_listen = 0 THEN 1 END) AS nl
|
||||
');
|
||||
// ->whereBetween('date', [$date_from, $date_to])
|
||||
// ->first();
|
||||
@@ -85,21 +85,20 @@ class ReportService
|
||||
{
|
||||
$query = DB::table('asteriskcdrdb.cdr')
|
||||
->selectRaw("
|
||||
SELECT
|
||||
*
|
||||
(ch_all - (c_ok + c_nok)) AS c_fail
|
||||
(all - (ok + nok)) AS fail
|
||||
FROM (
|
||||
SELECT
|
||||
DATE(calldate) AS d,
|
||||
dst,
|
||||
COUNT(CASE WHEN dcontext = 'from-internal' AND disposition = 'ANSWERED' AND dst BETWEEN 101 AND 104 THEN 1 END) AS c_ok,
|
||||
COUNT(CASE WHEN dcontext = 'from-internal' AND disposition = 'NO ANSWER' AND dst BETWEEN 101 AND 104 AND duration > 14 THEN 1 END) AS c_nok,
|
||||
COUNT(CASE WHEN dcontext = 'from-internal' AND disposition = 'ANSWERED' AND dst BETWEEN 101 AND 104 AND billsec > 9 THEN 1 END) AS c_b10,
|
||||
COUNT(CASE WHEN lastapp = 'Busy' THEN 1 END) AS c_dnd,
|
||||
COUNT(CASE WHEN dst BETWEEN 502 AND 599 THEN 1 END) AS c_trans,
|
||||
COUNT(CASE WHEN disposition <> 'BUSY' AND dst BETWEEN 101 AND 105 THEN 1 END) AS ch_all
|
||||
COUNT(CASE WHEN dcontext = 'from-internal' AND disposition = 'ANSWERED' AND dst BETWEEN 101 AND 104 THEN 1 END) AS ok,
|
||||
COUNT(CASE WHEN dcontext = 'from-internal' AND disposition = 'NO ANSWER' AND dst BETWEEN 101 AND 104 AND duration > 14 THEN 1 END) AS nok,
|
||||
COUNT(CASE WHEN dcontext = 'from-internal' AND disposition = 'ANSWERED' AND dst BETWEEN 101 AND 104 AND billsec > 9 THEN 1 END) AS b10,
|
||||
COUNT(CASE WHEN lastapp = 'Busy' THEN 1 END) AS dnd,
|
||||
COUNT(CASE WHEN dst BETWEEN 502 AND 599 THEN 1 END) AS trans,
|
||||
COUNT(CASE WHEN disposition <> 'BUSY' AND dst BETWEEN 101 AND 105 THEN 1 END) AS all
|
||||
FROM asteriskcdrdb.cdr
|
||||
WHERE dst BETWEEN 101 AND 105 AND calldate BETWEEN ? AND ?
|
||||
WHERE dst BETWEEN 101 AND 105
|
||||
GROUP BY d, dst
|
||||
ORDER BY d, dst
|
||||
);
|
||||
@@ -127,24 +126,22 @@ class ReportService
|
||||
{
|
||||
$query = DB::table('asteriskcdrdb.cdr')
|
||||
->selectRaw("
|
||||
SELECT
|
||||
*
|
||||
(ch_all - (c_ok + c_nok)) AS c_fail
|
||||
(all - (ok + nok)) AS fail
|
||||
FROM (
|
||||
SELECT
|
||||
DATE(calldate) AS d,
|
||||
dst,
|
||||
COUNT(CASE WHEN dcontext = 'from-internal' AND disposition = 'ANSWERED' AND dst BETWEEN 101 AND 104 THEN 1 END) AS c_ok,
|
||||
COUNT(CASE WHEN dcontext = 'from-internal' AND disposition = 'NO ANSWER' AND dst BETWEEN 101 AND 104 AND duration > 14 THEN 1 END) AS c_nok,
|
||||
COUNT(CASE WHEN dcontext = 'from-internal' AND disposition = 'ANSWERED' AND dst BETWEEN 101 AND 104 AND billsec > 9 THEN 1 END) AS c_b10,
|
||||
COUNT(CASE WHEN lastapp = 'Busy' THEN 1 END) AS c_dnd,
|
||||
COUNT(CASE WHEN dst BETWEEN 502 AND 599 THEN 1 END) AS c_trans,
|
||||
COUNT(CASE WHEN disposition <> 'BUSY' AND dst BETWEEN 101 AND 105 THEN 1 END) AS ch_all
|
||||
COUNT(CASE WHEN dcontext = 'from-internal' AND disposition = 'ANSWERED' AND dst BETWEEN 101 AND 104 THEN 1 END) AS ok,
|
||||
COUNT(CASE WHEN dcontext = 'from-internal' AND disposition = 'NO ANSWER' AND dst BETWEEN 101 AND 104 AND duration > 14 THEN 1 END) AS nok,
|
||||
COUNT(CASE WHEN dcontext = 'from-internal' AND disposition = 'ANSWERED' AND dst BETWEEN 101 AND 104 AND billsec > 9 THEN 1 END) AS b10,
|
||||
COUNT(CASE WHEN lastapp = 'Busy' THEN 1 END) AS dnd,
|
||||
COUNT(CASE WHEN dst BETWEEN 502 AND 599 THEN 1 END) AS trans,
|
||||
COUNT(CASE WHEN disposition <> 'BUSY' AND dst BETWEEN 101 AND 105 THEN 1 END) AS all
|
||||
FROM asteriskcdrdb.cdr
|
||||
WHERE dst BETWEEN 101 AND 105 AND calldate BETWEEN ? AND ?
|
||||
GROUP dst
|
||||
ORDER dst
|
||||
);
|
||||
WHERE dst BETWEEN 101 AND 105
|
||||
GROUP BY dst
|
||||
ORDER BY dst);
|
||||
");
|
||||
|
||||
return DataTableFacade::run(
|
||||
|
||||
@@ -4,4 +4,5 @@ return [
|
||||
'TRUSTED_IP' => explode(',', env("TRUSTED_IP", '127.0.0.1')),
|
||||
'NOTIFICATION_SERVER_URL' => env('NOTIFICATION_SERVER_URL', '127.0.0.1'),
|
||||
'LOGIN_HASH_VALUE' => env('LOGIN_HASH_VALUE'),
|
||||
'SETAD_IP' => env('SETAD_IP'),
|
||||
];
|
||||
|
||||
@@ -150,6 +150,11 @@ return [
|
||||
'path' => storage_path('logs/send_system_message_stats_report.log'),
|
||||
'level' => 'debug',
|
||||
],
|
||||
],
|
||||
|
||||
'send_supervisor_check_stats_report' => [
|
||||
'driver' => 'single',
|
||||
'path' => storage_path('logs/send_supervisor_check_stats_report.log'),
|
||||
'level' => 'debug',
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
@@ -5,9 +5,9 @@ namespace Database\Factories;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\ExpertPerformance>
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\SupervisorPerformance>
|
||||
*/
|
||||
class ExpertPerformanceFactory extends Factory
|
||||
class SupervisorPerformanceFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
@@ -1,27 +0,0 @@
|
||||
<?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('expert_performances', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('expert_performances');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,34 @@
|
||||
<?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('supervisor_performances', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->date('date');
|
||||
$table->foreignId('province_id')->constrained('provinces');
|
||||
$table->string('province_name');
|
||||
$table->integer('calls');
|
||||
$table->integer('reviews');
|
||||
$table->integer('good');
|
||||
$table->integer('bad');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('supervisor_performances');
|
||||
}
|
||||
};
|
||||
@@ -5,7 +5,7 @@ namespace Database\Seeders;
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class ExpertPerformanceSeeder extends Seeder
|
||||
class SupervisorPerformanceSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
BIN
public/file_example_WAV_1MG.wav
Normal file
BIN
public/file_example_WAV_1MG.wav
Normal file
Binary file not shown.
@@ -3,11 +3,8 @@
|
||||
use Illuminate\Foundation\Inspiring;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
|
||||
Artisan::command('inspire', function () {
|
||||
$this->comment(Inspiring::quote());
|
||||
})->purpose('Display an inspiring quote');
|
||||
|
||||
Schedule::command('report:send-call-stats')->everyTwoMinutes();
|
||||
Schedule::command('report:send-system-message-stats')->everyThreeMinutes();
|
||||
Schedule::command('report:send-keypress-stats')->everyFourMinutes();
|
||||
Schedule::command('report:send-people-message-stats')->everyFiveMinutes();
|
||||
Schedule::command('report:send-supervisor-check-stats')->everyFiveMinutes();
|
||||
|
||||
@@ -13,7 +13,7 @@ use App\Http\Controllers\HeadquartersDashboard\CumulativeCentersStatsController;
|
||||
use App\Http\Controllers\HeadquartersDashboard\CumulativeKeypressStatsController;
|
||||
use App\Http\Controllers\HeadquartersDashboard\CumulativeMessageRatingStatsController;
|
||||
use App\Http\Controllers\HeadquartersDashboard\CumulativeVoiceRatingStatsController;
|
||||
use App\Http\Controllers\ProvinceDashboard\CheckSetadController;
|
||||
use App\Http\Controllers\ProvinceDashboard\VerifyAuthenticationController;
|
||||
use App\Http\Middleware\SuperAdminCheck;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
@@ -203,19 +203,20 @@ Route::prefix('server')->group(function () {
|
||||
Route::get('/{peopleMessage}', 'show')->name('show');
|
||||
});
|
||||
});
|
||||
Route::middleware(['auth', 'permission:setat_ip'])
|
||||
|
||||
Route::middleware(['auth', 'role:admin'])
|
||||
->prefix('login_to_province')
|
||||
->name('loginToProvince.')
|
||||
->controller(LoginToProvinceController::class)
|
||||
->group(function () {
|
||||
Route::post('/', 'loginToProvince')->name('loginToProvince');
|
||||
});
|
||||
Route::middleware('auth')
|
||||
->prefix('check_setad')
|
||||
->name('checkSetad.')
|
||||
->controller(CheckSetadController::class)
|
||||
->group(function () {
|
||||
Route::get('/', 'verifyToken')->name('verifyToken');
|
||||
Route::post('/', 'authenticate')->name('authenticate');
|
||||
});
|
||||
|
||||
Route::middleware(['auth', 'setadIp'])
|
||||
->prefix('verify_authentication')
|
||||
->name('verifyAuthentication.')
|
||||
->controller(VerifyAuthenticationController::class)
|
||||
->group(function () {
|
||||
Route::get('/', 'login')->name('login');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user