Merge branch 'feature/ProvinceDashboard' into 'develop'
Feature/province dashboard See merge request witel-back-end/crm!15
This commit is contained in:
10
.env.example
10
.env.example
@@ -20,19 +20,13 @@ LOG_STACK=single
|
||||
LOG_DEPRECATIONS_CHANNEL=null
|
||||
LOG_LEVEL=debug
|
||||
|
||||
DB_CONNECTION=pgsql
|
||||
DB_CONNECTION=mysql
|
||||
DB_HOST=127.0.0.1
|
||||
DB_PORT=5432
|
||||
DB_PORT=3306
|
||||
DB_DATABASE=laravel
|
||||
DB_USERNAME=root
|
||||
DB_PASSWORD=
|
||||
|
||||
ASTERISK_DB_HOST=
|
||||
ASTERISK_DB_PORT=
|
||||
ASTERISK_DB_DATABASE=
|
||||
ASTERISK_DB_USERNAME=
|
||||
ASTERISK_DB_PASSWORD=
|
||||
|
||||
SESSION_DRIVER=database
|
||||
SESSION_LIFETIME=120
|
||||
SESSION_ENCRYPT=false
|
||||
|
||||
24
Dockerfile
24
Dockerfile
@@ -1,6 +1,6 @@
|
||||
FROM docker.arvancloud.ir/php:8.3-fpm-alpine3.21
|
||||
FROM docker.arvancloud.ir/php:8.3-fpm-alpine3.21
|
||||
|
||||
# Install common php extension dependencies
|
||||
# Install common PHP extension dependencies
|
||||
RUN apk update && apk add --no-cache \
|
||||
bash \
|
||||
nano \
|
||||
@@ -8,13 +8,14 @@ RUN apk update && apk add --no-cache \
|
||||
libpng \
|
||||
libpng-dev \
|
||||
libjpeg-turbo-dev \
|
||||
libwebp \
|
||||
freetype-dev \
|
||||
libwebp-dev \
|
||||
libxml2-dev \
|
||||
unzip \
|
||||
libzip-dev \
|
||||
libpq-dev \
|
||||
&& docker-php-ext-install pdo_pgsql
|
||||
&& docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp \
|
||||
&& docker-php-ext-install pdo_pgsql gd zip
|
||||
|
||||
# Set the working directory
|
||||
WORKDIR /var/www/laravel
|
||||
@@ -22,13 +23,12 @@ COPY . .
|
||||
|
||||
RUN chmod -R 777 /var/www/laravel/storage /var/www/laravel/bootstrap/cache
|
||||
|
||||
|
||||
# install composer
|
||||
# Install Composer
|
||||
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
|
||||
|
||||
# Set the default command to run php-fpm
|
||||
CMD composer install;\
|
||||
php artisan key:generate;\
|
||||
php artisan migrate ;\
|
||||
php artisan db:seed;\
|
||||
php-fpm
|
||||
# Default command
|
||||
CMD composer install \
|
||||
&& php artisan key:generate \
|
||||
&& php artisan migrate \
|
||||
&& php artisan db:seed \
|
||||
&& php-fpm
|
||||
|
||||
23
app/Enums/PeopleMessageActions.php
Normal file
23
app/Enums/PeopleMessageActions.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Enums;
|
||||
|
||||
enum PeopleMessageActions: int
|
||||
{
|
||||
case x = 1;
|
||||
case y = 2;
|
||||
case z = 3;
|
||||
|
||||
public static function name(int $state): string
|
||||
{
|
||||
$mapArray = [
|
||||
1 => 'عدم نیاز به ثبت (مشکل راه)',
|
||||
2 => 'عدم نیاز به ثبت (مشکل حمل و نقلی)',
|
||||
3 => 'عدم نیاز به ثبت (مشکل عوارضی)',
|
||||
4 => 'ثبت سوانح (مشکل راه)',
|
||||
5 => 'ثبت سوانح (مشکل حمل و نقلی)',
|
||||
];
|
||||
|
||||
return $mapArray[$state];
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,6 @@ namespace App\Http\Controllers\HeadquartersDashboard;
|
||||
|
||||
use App\Facades\DataTable\DataTableFacade;
|
||||
use App\Http\Controllers\Controller;
|
||||
use app\Http\Traits\ApiResponse;
|
||||
use App\Models\CountryCallsReport;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -12,12 +11,10 @@ use Illuminate\Support\Facades\DB;
|
||||
|
||||
class CumulativeCentersStatsController extends Controller
|
||||
{
|
||||
use ApiResponse;
|
||||
|
||||
public function index(Request $request): JsonResponse
|
||||
{
|
||||
$data = DB::select("
|
||||
SELECT
|
||||
$query = DB::table('country_calls_reports')
|
||||
->selectRaw("
|
||||
province_id,
|
||||
province_name,
|
||||
SUM(total) as total,
|
||||
@@ -33,30 +30,35 @@ class CumulativeCentersStatsController extends Controller
|
||||
SUM(talked_to_operator) as talked_to_operator,
|
||||
AVG(average_calls_time) as average_calls_time,
|
||||
SUM(fails) as fails
|
||||
FROM country_calls_reports
|
||||
GROUP BY province_id, province_name
|
||||
")
|
||||
->groupBy('province_id', 'province_name')
|
||||
->unionAll(
|
||||
DB::table('country_calls_reports')
|
||||
->selectRaw("
|
||||
0 as province_id,
|
||||
'کشوری' as province_name,
|
||||
SUM(total),
|
||||
SUM(route_to_teh4),
|
||||
SUM(route_to_teh5),
|
||||
SUM(route_to_os4),
|
||||
SUM(route_to_os5),
|
||||
SUM(answered),
|
||||
SUM(answered_over10),
|
||||
SUM(missed),
|
||||
SUM(dnd),
|
||||
SUM(transferred),
|
||||
SUM(talked_to_operator),
|
||||
AVG(average_calls_time),
|
||||
SUM(fails)
|
||||
")
|
||||
);
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
0 as province_id,
|
||||
'کشور' as province_name,
|
||||
SUM(total),
|
||||
SUM(route_to_teh4),
|
||||
SUM(route_to_teh5),
|
||||
SUM(route_to_os4),
|
||||
SUM(route_to_os5),
|
||||
SUM(answered),
|
||||
SUM(answered_over10),
|
||||
SUM(missed),
|
||||
SUM(dnd),
|
||||
SUM(transferred),
|
||||
SUM(talked_to_operator),
|
||||
AVG(average_calls_time),
|
||||
SUM(fails)
|
||||
FROM country_calls_reports
|
||||
");
|
||||
|
||||
return $this->successResponse($data);
|
||||
return response()->json(
|
||||
DataTableFacade::run(
|
||||
$query,
|
||||
$request,
|
||||
allowedFilters: ['*'],
|
||||
allowedSortings: ['*'])
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,20 +4,15 @@ namespace App\Http\Controllers\HeadquartersDashboard;
|
||||
|
||||
use App\Facades\DataTable\DataTableFacade;
|
||||
use App\Http\Controllers\Controller;
|
||||
use app\Http\Traits\ApiResponse;
|
||||
use App\Models\CountryKeypressReport;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class CumulativeKeypressStatsController extends Controller
|
||||
{
|
||||
use ApiResponse;
|
||||
|
||||
public function index(Request $request): JsonResponse
|
||||
{
|
||||
$data = DB::select("
|
||||
SELECT
|
||||
$query = DB::table('country_keypress_reports')->selectRaw("
|
||||
province_id,
|
||||
province_name,
|
||||
SUM(total) as total,
|
||||
@@ -35,32 +30,34 @@ class CumulativeKeypressStatsController extends Controller
|
||||
SUM(key2_1) as key2_1,
|
||||
SUM(key2_2) as key2_2,
|
||||
SUM(key2_3) as key2_3
|
||||
FROM country_keypress_reports
|
||||
GROUP BY province_id, province_name
|
||||
")
|
||||
->groupBy('province_id', 'province_name')
|
||||
->unionAll(DB::table('country_keypress_reports')->selectRaw("
|
||||
0 as province_id,
|
||||
'کشوری' as province_name,
|
||||
SUM(total),
|
||||
SUM(key1),
|
||||
SUM(key2),
|
||||
SUM(key3),
|
||||
SUM(key4),
|
||||
SUM(key5),
|
||||
SUM(key6),
|
||||
SUM(key9),
|
||||
SUM(key4_1),
|
||||
SUM(key4_2),
|
||||
SUM(key5_1),
|
||||
SUM(key5_2),
|
||||
SUM(key2_1),
|
||||
SUM(key2_2),
|
||||
SUM(key2_3)
|
||||
"));
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
0 as province_id,
|
||||
'کشوری' as province_name,
|
||||
SUM(total),
|
||||
SUM(key1),
|
||||
SUM(key2),
|
||||
SUM(key3),
|
||||
SUM(key4),
|
||||
SUM(key5),
|
||||
SUM(key6),
|
||||
SUM(key9),
|
||||
SUM(key4_1),
|
||||
SUM(key4_2),
|
||||
SUM(key5_1),
|
||||
SUM(key5_2),
|
||||
SUM(key2_1),
|
||||
SUM(key2_2),
|
||||
SUM(key2_3)
|
||||
FROM country_keypress_reports
|
||||
");
|
||||
|
||||
return $this->successResponse($data);
|
||||
return response()->json(
|
||||
DataTableFacade::run(
|
||||
$query,
|
||||
$request,
|
||||
allowedFilters: ['*'],
|
||||
allowedSortings: ['*'])
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,19 +2,18 @@
|
||||
|
||||
namespace App\Http\Controllers\HeadquartersDashboard;
|
||||
|
||||
use App\Facades\DataTable\DataTableFacade;
|
||||
use App\Http\Controllers\Controller;
|
||||
use app\Http\Traits\ApiResponse;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class CumulativeMessageRatingStatsController extends Controller
|
||||
{
|
||||
use ApiResponse;
|
||||
|
||||
public function index(): JsonResponse
|
||||
public function index(Request $request): JsonResponse
|
||||
{
|
||||
$data = DB::select("
|
||||
SELECT
|
||||
$query = DB::table('country_message_rating_reports')->selectRaw("
|
||||
province_id,
|
||||
province_name,
|
||||
SUM(total) as total,
|
||||
@@ -26,12 +25,9 @@ class CumulativeMessageRatingStatsController extends Controller
|
||||
SUM(action3) as action3,
|
||||
SUM(action4) as action4,
|
||||
SUM(action5) as action5
|
||||
FROM country_message_rating_reports
|
||||
GROUP BY province_id, province_name
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
")
|
||||
->groupBy('province_id', 'province_name')
|
||||
->unionAll(DB::table('country_message_rating_reports')->selectRaw("
|
||||
0 as province_id,
|
||||
'کشوری' as province_name,
|
||||
SUM(total),
|
||||
@@ -43,9 +39,14 @@ class CumulativeMessageRatingStatsController extends Controller
|
||||
SUM(action3),
|
||||
SUM(action4),
|
||||
SUM(action5)
|
||||
FROM country_message_rating_reports
|
||||
");
|
||||
"));
|
||||
|
||||
return $this->successResponse($data);
|
||||
return response()->json(
|
||||
DataTableFacade::run(
|
||||
$query,
|
||||
$request,
|
||||
allowedFilters: ['*'],
|
||||
allowedSortings: ['*'])
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,41 +4,38 @@ namespace App\Http\Controllers\HeadquartersDashboard;
|
||||
|
||||
use App\Facades\DataTable\DataTableFacade;
|
||||
use App\Http\Controllers\Controller;
|
||||
use app\Http\Traits\ApiResponse;
|
||||
use App\Models\CountryVoiceRatingReport;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class CumulativeVoiceRatingStatsController extends Controller
|
||||
{
|
||||
use ApiResponse;
|
||||
|
||||
public function index(Request $request): JsonResponse
|
||||
{
|
||||
$data = DB::select("
|
||||
SELECT
|
||||
$query = DB::table('country_voice_rating_reports')->selectRaw("
|
||||
province_id,
|
||||
province_name,
|
||||
SUM(message_quality_ok) as message_quality_ok,
|
||||
SUM(message_format_ok) as message_format_ok,
|
||||
SUM(message_quality_nok) as message_quality_nok,
|
||||
SUM(message_format_nok) as message_format_nok
|
||||
FROM country_voice_rating_reports
|
||||
GROUP BY province_id, province_name
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
")
|
||||
->groupBy('province_id', 'province_name')
|
||||
->unionAll(DB::table('country_voice_rating_reports')->selectRaw("
|
||||
0 as province_id,
|
||||
'کشوری' as province_name,
|
||||
SUM(message_quality_ok),
|
||||
SUM(message_format_ok),
|
||||
SUM(message_quality_nok),
|
||||
SUM(message_format_nok)
|
||||
FROM country_voice_rating_reports
|
||||
");
|
||||
"));
|
||||
|
||||
return $this->successResponse($data);
|
||||
return response()->json(
|
||||
DataTableFacade::run(
|
||||
$query,
|
||||
$request,
|
||||
allowedFilters: ['*'],
|
||||
allowedSortings: ['*'])
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ use App\Http\Requests\Profile\ChangeAvatarRequest;
|
||||
use App\Http\Requests\Profile\ChangePasswordRequest;
|
||||
use App\Http\Resources\Admin\UserResource;
|
||||
use App\Http\Traits\ApiResponse;
|
||||
use App\Models\Session;
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -59,10 +58,7 @@ class ProfileController extends Controller
|
||||
public function offline(Request $request): JsonResponse
|
||||
{
|
||||
$user= User::query()->where('telephone_id', '=', $request->telephone_id)->first();
|
||||
$user->update([
|
||||
'is_online' => false,
|
||||
]);
|
||||
Session::query()->where('user_id','=',$user->id)->delete();
|
||||
$user->update(['is_online' => false]);
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\ProvinceDashboard\PeopleMessages;
|
||||
|
||||
use App\Enums\PeopleMessageActions;
|
||||
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;
|
||||
|
||||
class OperatorController extends Controller
|
||||
{
|
||||
use ApiResponse;
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index(Request $request, DataTableService $dataTableService): JsonResponse
|
||||
{
|
||||
return response()->json($dataTableService->index($request));
|
||||
}
|
||||
|
||||
public function excel()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function handle(Request $request, PeopleMessage $peopleMessage): JsonResponse
|
||||
{
|
||||
$peopleMessage->update([
|
||||
'listen_at' => now(),
|
||||
'is_listen' => true,
|
||||
'action_id' => $request->action_id,
|
||||
'action_name' => PeopleMessageActions::name($request->action_id),
|
||||
'description' => $request->description,
|
||||
'savaneh_id' => $request->savaneh_id,
|
||||
]);
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*/
|
||||
public function show(PeopleMessage $peopleMessage): JsonResponse
|
||||
{
|
||||
return $this->successResponse($peopleMessage);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\ProvinceDashboard\PeopleMessages;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class SupervisorController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*/
|
||||
public function show(string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit(string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy(string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\ProvinceDashboard\SystemMessages;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use app\Http\Traits\ApiResponse;
|
||||
use App\Models\SystemMessage;
|
||||
use App\Services\Dashboard\Province\SystemMessages\OperatorService;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class OperatorController extends Controller
|
||||
{
|
||||
use ApiResponse;
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index(Request $request, OperatorService $operatorService): JsonResponse
|
||||
{
|
||||
return response()->json($operatorService->datatable($request));
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*/
|
||||
public function show(SystemMessage $systemMessage): JsonResponse
|
||||
{
|
||||
return $this->successResponse($systemMessage->only(['id','duration','date', 'voice']));
|
||||
}
|
||||
|
||||
public function download(string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function excel()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\ProvinceDashboard\SystemMessages;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\ProvinceDashboard\SystemMessages\RateRequest;
|
||||
use app\Http\Traits\ApiResponse;
|
||||
use App\Models\SystemMessage;
|
||||
use App\Services\Dashboard\Province\SystemMessages\SupervisorService;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class SupervisorController extends Controller
|
||||
{
|
||||
use ApiResponse;
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index(Request $request, SupervisorService $supervisorService): JsonResponse
|
||||
{
|
||||
return response()->json($supervisorService->datatable($request));
|
||||
}
|
||||
|
||||
public function excel()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function rate(RateRequest $request, SystemMessage $systemMessage): JsonResponse
|
||||
{
|
||||
$systemMessage->update([
|
||||
'message_quality' => $request->message_quality,
|
||||
'format_quality' => $request->format_quality,
|
||||
]);
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*/
|
||||
public function show(SystemMessage $systemMessage): JsonResponse
|
||||
{
|
||||
return $this->successResponse($systemMessage);
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,7 @@ class StoreRequest extends FormRequest
|
||||
'full_name' => 'required|max:255|string',
|
||||
'username' => 'required|unique:users,username|string',
|
||||
'position' => 'required',
|
||||
'gender' => 'required|in:1,2',
|
||||
'gender' => 'required|in:male,female',
|
||||
'national_id' => 'required|digits:10|unique:users,national_id',
|
||||
'phone_number' => 'required|numeric|digits:11|unique:users,phone_number|regex:/^09\d{9}$/',
|
||||
'province_id' => 'required|exists:provinces,id',
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\ProvinceDashboard\SystemMessages;
|
||||
|
||||
use Illuminate\Contracts\Validation\ValidationRule;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class RateRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, ValidationRule|array|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'message_quality' => 'required|in:0,1',
|
||||
'format_quality' => 'required|in:0,1',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,5 @@ use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Cdr extends Model
|
||||
{
|
||||
protected $connection = 'asterisk';
|
||||
protected $table = 'cdr';
|
||||
}
|
||||
|
||||
15
app/Models/OperatorDialogueRating.php
Normal file
15
app/Models/OperatorDialogueRating.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Database\Factories\OperatorDialogueRatingFactory;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class OperatorDialogueRating extends Model
|
||||
{
|
||||
/** @use HasFactory<OperatorDialogueRatingFactory> */
|
||||
use HasFactory;
|
||||
|
||||
protected $guarded = [];
|
||||
}
|
||||
14
app/Models/PeopleMessage.php
Normal file
14
app/Models/PeopleMessage.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class PeopleMessage extends Model
|
||||
{
|
||||
/** @use HasFactory<\Database\Factories\PeopleMessageFactory> */
|
||||
use HasFactory;
|
||||
|
||||
protected $guarded = [];
|
||||
}
|
||||
14
app/Models/PeopleMessageAction.php
Normal file
14
app/Models/PeopleMessageAction.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class PeopleMessageAction extends Model
|
||||
{
|
||||
/** @use HasFactory<\Database\Factories\PeopleMessageActionFactory> */
|
||||
use HasFactory;
|
||||
|
||||
protected $guarded = [];
|
||||
}
|
||||
14
app/Models/SystemMessage.php
Normal file
14
app/Models/SystemMessage.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class SystemMessage extends Model
|
||||
{
|
||||
/** @use HasFactory<\Database\Factories\SystemMessageFactory> */
|
||||
use HasFactory;
|
||||
|
||||
protected $guarded = [];
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Dashboard\Province\PeopleMessages;
|
||||
|
||||
use App\Facades\DataTable\DataTableFacade;
|
||||
use App\Models\PeopleMessage;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class DataTableService
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$user = auth()->user();
|
||||
|
||||
$query = PeopleMessage::query()->where('edare_shahri_id', '=', $user->edarate_shahri_id);
|
||||
|
||||
return DataTableFacade::run(
|
||||
$query,
|
||||
$request,
|
||||
allowedFilters: ['*'],
|
||||
allowedSortings: ['*'],
|
||||
allowedSelects: [
|
||||
'id','caller_phone_number','date', 'voice', 'listen_at', 'review_duration',
|
||||
'is_listen', 'action_id', 'action_name', 'description', 'savaneh_id'
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Dashboard\Province\SystemMessages;
|
||||
|
||||
use App\Facades\DataTable\DataTableFacade;
|
||||
use App\Models\SystemMessage;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class OperatorService
|
||||
{
|
||||
public function dataTable(Request $request)
|
||||
{
|
||||
$user = auth()->user();
|
||||
|
||||
$query = SystemMessage::query()->where('edare_shahri_id', '=', $user->edarate_shahri_id);
|
||||
|
||||
return DataTableFacade::run(
|
||||
$query,
|
||||
$request,
|
||||
allowedFilters: ['*'],
|
||||
allowedSortings: ['*'],
|
||||
allowedSelects: ['id','duration','date', 'voice', 'type_id', 'type_name']
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Dashboard\Province\SystemMessages;
|
||||
|
||||
use App\Facades\DataTable\DataTableFacade;
|
||||
use App\Models\SystemMessage;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class SupervisorService
|
||||
{
|
||||
public function dataTable(Request $request)
|
||||
{
|
||||
$query = SystemMessage::query();
|
||||
|
||||
return DataTableFacade::run(
|
||||
$query,
|
||||
$request,
|
||||
allowedFilters: ['*'],
|
||||
allowedSortings: ['*'],
|
||||
allowedSelects: ['id','duration','date', 'voice', 'message_quality', 'format_quality', 'type_id', 'type_name']
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -111,26 +111,6 @@ return [
|
||||
// 'encrypt' => env('DB_ENCRYPT', 'yes'),
|
||||
// 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'),
|
||||
],
|
||||
|
||||
'asterisk' => [
|
||||
'driver' => 'mysql',
|
||||
'url' => env('DB_URL'),
|
||||
'host' => env('ASTERISK_DB_HOST', '127.0.0.1'),
|
||||
'port' => env('ASTERISK_DB_PORT', '3306'),
|
||||
'database' => env('ASTERISK_DB_DATABASE', 'laravel'),
|
||||
'username' => env('ASTERISK_DB_USERNAME', 'root'),
|
||||
'password' => env('ASTERISK_DB_PASSWORD', ''),
|
||||
'unix_socket' => env('DB_SOCKET', ''),
|
||||
'charset' => env('DB_CHARSET', 'utf8mb4'),
|
||||
'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'),
|
||||
'prefix' => '',
|
||||
'prefix_indexes' => true,
|
||||
'strict' => true,
|
||||
'engine' => null,
|
||||
'options' => extension_loaded('pdo_mysql') ? array_filter([
|
||||
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
|
||||
]) : [],
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|
||||
23
database/factories/OperatorDialogueRatingFactory.php
Normal file
23
database/factories/OperatorDialogueRatingFactory.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\OperatorDialogueRating>
|
||||
*/
|
||||
class OperatorDialogueRatingFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
||||
23
database/factories/PeopleMessageActionFactory.php
Normal file
23
database/factories/PeopleMessageActionFactory.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\PeopleMessageAction>
|
||||
*/
|
||||
class PeopleMessageActionFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
||||
23
database/factories/PeopleMessageFactory.php
Normal file
23
database/factories/PeopleMessageFactory.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\PeopleMessage>
|
||||
*/
|
||||
class PeopleMessageFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
||||
23
database/factories/SystemMessageFactory.php
Normal file
23
database/factories/SystemMessageFactory.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\SystemMessage>
|
||||
*/
|
||||
class SystemMessageFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?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('people_message_actions', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('people_message_actions');
|
||||
}
|
||||
};
|
||||
@@ -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('system_messages', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->integer('duration');
|
||||
$table->dateTime('date');
|
||||
$table->string('voice');
|
||||
$table->integer('message_quality');
|
||||
$table->integer('format_quality');
|
||||
$table->integer('type_id');
|
||||
$table->string('type_name');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('system_messages');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,33 @@
|
||||
<?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('operator_dialogue_ratings', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('cdr_unique_id');
|
||||
$table->dateTime('date');
|
||||
$table->foreignId('expert_id')->constrained('users');
|
||||
$table->boolean('is_listen')->default(false);
|
||||
$table->boolean('is_good');
|
||||
$table->string('description')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('operator_dialogue_ratings');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,37 @@
|
||||
<?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('people_messages', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('caller_phone_number');
|
||||
$table->dateTime('date');
|
||||
$table->string('voice');
|
||||
$table->integer('review_duration')->nullable();
|
||||
$table->dateTime('listen_at')->nullable();
|
||||
$table->boolean('is_listen')->default(false);
|
||||
$table->foreignId('action_id')->nullable()->constrained();
|
||||
$table->string('action_name')->nullable();
|
||||
$table->string('description')->nullable();
|
||||
$table->unsignedBigInteger('savaneh_id')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('people_messages');
|
||||
}
|
||||
};
|
||||
17
database/seeders/OperatorDialogueRatingSeeder.php
Normal file
17
database/seeders/OperatorDialogueRatingSeeder.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class OperatorDialogueRatingSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
17
database/seeders/PeopleMessageActionSeeder.php
Normal file
17
database/seeders/PeopleMessageActionSeeder.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class PeopleMessageActionSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
17
database/seeders/PeopleMessageSeeder.php
Normal file
17
database/seeders/PeopleMessageSeeder.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class PeopleMessageSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
17
database/seeders/SystemMessageSeeder.php
Normal file
17
database/seeders/SystemMessageSeeder.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class SystemMessageSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user