create setad report tables
This commit is contained in:
@@ -27,6 +27,12 @@ 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
|
||||
|
||||
@@ -4,20 +4,59 @@ namespace App\Http\Controllers\Setad;
|
||||
|
||||
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;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class CumulativeCentersStatsController extends Controller
|
||||
{
|
||||
use ApiResponse;
|
||||
|
||||
public function index(Request $request): JsonResponse
|
||||
{
|
||||
$data = DataTableFacade::run(
|
||||
CountryCallsReport::query(),
|
||||
$request,
|
||||
allowedFilters: ['*'],
|
||||
allowedSortings: ['*'],
|
||||
);
|
||||
return response()->json($data);
|
||||
$data = DB::select("
|
||||
SELECT
|
||||
province_id,
|
||||
province_name,
|
||||
SUM(total) as total,
|
||||
SUM(route_to_teh4) as route_to_teh4,
|
||||
SUM(route_to_teh5) as route_to_teh5,
|
||||
SUM(route_to_os4) as route_to_os4,
|
||||
SUM(route_to_os5) as route_to_os5,
|
||||
SUM(answered) as answered,
|
||||
SUM(answered_over10) as answered_over10,
|
||||
SUM(missed) as missed,
|
||||
SUM(dnd) as dnd,
|
||||
SUM(transferred) as transferred,
|
||||
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
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,20 +4,63 @@ namespace App\Http\Controllers\Setad;
|
||||
|
||||
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 = DataTableFacade::run(
|
||||
CountryKeypressReport::query(),
|
||||
$request,
|
||||
allowedFilters: ['*'],
|
||||
allowedSortings: ['*'],
|
||||
);
|
||||
return response()->json($data);
|
||||
$data = DB::select("
|
||||
SELECT
|
||||
province_id,
|
||||
province_name,
|
||||
SUM(total) as total,
|
||||
SUM(key1) as key1,
|
||||
SUM(key2) as key2,
|
||||
SUM(key3) as key3,
|
||||
SUM(key4) as key4,
|
||||
SUM(key5) as key5,
|
||||
SUM(key6) as key6,
|
||||
SUM(key9) as key9,
|
||||
SUM(key4_1) as key4_1,
|
||||
SUM(key4_2) as key4_2,
|
||||
SUM(key5_1) as key5_1,
|
||||
SUM(key5_2) as key5_2,
|
||||
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
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Setad;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use app\Http\Traits\ApiResponse;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class CumulativeMessageRatingStatsController extends Controller
|
||||
{
|
||||
use ApiResponse;
|
||||
|
||||
public function index(): JsonResponse
|
||||
{
|
||||
$data = DB::select("
|
||||
SELECT
|
||||
province_id,
|
||||
province_name,
|
||||
SUM(total) as total,
|
||||
SUM(listens) as listens,
|
||||
SUM(not_listens) as not_listens,
|
||||
AVG(review_average) as review_average,
|
||||
SUM(action1) as action1,
|
||||
SUM(action2) as action2,
|
||||
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
|
||||
0 as province_id,
|
||||
'کشوری' as province_name,
|
||||
SUM(total),
|
||||
SUM(listens),
|
||||
SUM(not_listens),
|
||||
AVG(review_average),
|
||||
SUM(action1),
|
||||
SUM(action2),
|
||||
SUM(action3),
|
||||
SUM(action4),
|
||||
SUM(action5)
|
||||
FROM country_message_rating_reports
|
||||
");
|
||||
|
||||
return $this->successResponse($data);
|
||||
}
|
||||
}
|
||||
@@ -4,20 +4,41 @@ namespace App\Http\Controllers\Setad;
|
||||
|
||||
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 = DataTableFacade::run(
|
||||
CountryVoiceRatingReport::query(),
|
||||
$request,
|
||||
allowedFilters: ['*'],
|
||||
allowedSortings: ['*'],
|
||||
);
|
||||
return response()->json($data);
|
||||
$data = DB::select("
|
||||
SELECT
|
||||
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
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
10
app/Models/Cdr.php
Normal file
10
app/Models/Cdr.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Cdr extends Model
|
||||
{
|
||||
protected $connection = 'asterisk';
|
||||
}
|
||||
@@ -112,6 +112,25 @@ return [
|
||||
// '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'),
|
||||
]) : [],
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|
||||
@@ -24,12 +24,15 @@ class CountryMessageRatingReportFactory extends Factory
|
||||
return Province::query()->find($attributes['province_id'])->name;
|
||||
},
|
||||
'date' => $this->faker->date(),
|
||||
'very_good' => $this->faker->numberBetween(10, 100),
|
||||
'good' => $this->faker->numberBetween(10, 100),
|
||||
'average' => $this->faker->numberBetween(10, 100),
|
||||
'bad' => $this->faker->numberBetween(10, 100),
|
||||
'very_bad' => $this->faker->numberBetween(10, 100),
|
||||
'wrong_code' => $this->faker->numberBetween(10, 100),
|
||||
'total' => $this->faker->numberBetween(100, 1000),
|
||||
'listens' => $this->faker->numberBetween(10, 100),
|
||||
'not_listens' => $this->faker->numberBetween(10, 100),
|
||||
'review_average' => $this->faker->numberBetween(10, 100),
|
||||
'action1' => $this->faker->numberBetween(10, 100),
|
||||
'action2' => $this->faker->numberBetween(10, 100),
|
||||
'action3' => $this->faker->numberBetween(10, 100),
|
||||
'action4' => $this->faker->numberBetween(10, 100),
|
||||
'action5' => $this->faker->numberBetween(10, 100),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,12 +24,10 @@ class CountryVoiceRatingReportFactory extends Factory
|
||||
return Province::query()->find($attributes['province_id'])->name;
|
||||
},
|
||||
'date' => $this->faker->date(),
|
||||
'voice_quality_ok' => $this->faker->numberBetween(10, 100),
|
||||
'message_quality_ok' => $this->faker->numberBetween(10, 100),
|
||||
'voice_format_ok' => $this->faker->numberBetween(10, 100),
|
||||
'voice_quality_nok' => $this->faker->numberBetween(10, 100),
|
||||
'message_format_ok' => $this->faker->numberBetween(10, 100),
|
||||
'message_quality_nok' => $this->faker->numberBetween(10, 100),
|
||||
'voice_format_nok' => $this->faker->numberBetween(10, 100),
|
||||
'message_format_nok' => $this->faker->numberBetween(10, 100),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,12 +16,10 @@ return new class extends Migration
|
||||
$table->foreignId('province_id')->constrained('provinces');
|
||||
$table->string('province_name');
|
||||
$table->date('date');
|
||||
$table->integer('voice_quality_ok');
|
||||
$table->integer('message_quality_ok');
|
||||
$table->integer('voice_format_ok');
|
||||
$table->integer('voice_quality_nok');
|
||||
$table->integer('message_format_ok');
|
||||
$table->integer('message_quality_nok');
|
||||
$table->integer('voice_format_nok');
|
||||
$table->integer('message_format_nok');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -16,12 +16,15 @@ return new class extends Migration
|
||||
$table->foreignId('province_id')->constrained('provinces');
|
||||
$table->string('province_name');
|
||||
$table->date('date');
|
||||
$table->integer('very_good');
|
||||
$table->integer('good');
|
||||
$table->integer('average');
|
||||
$table->integer('bad');
|
||||
$table->integer('very_bad');
|
||||
$table->integer('wrong_code');
|
||||
$table->integer('total');
|
||||
$table->integer('listens');
|
||||
$table->integer('not_listens');
|
||||
$table->float('review_average');
|
||||
$table->integer('action1');
|
||||
$table->integer('action2');
|
||||
$table->integer('action3');
|
||||
$table->integer('action4');
|
||||
$table->integer('action5');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ use App\Http\Controllers\ProfileController;
|
||||
use App\Http\Controllers\ProvinceController;
|
||||
use App\Http\Controllers\Setad\CumulativeCentersStatsController;
|
||||
use App\Http\Controllers\Setad\CumulativeKeypressStatsController;
|
||||
use App\Http\Controllers\Setad\CumulativeMessageRatingStatsController;
|
||||
use App\Http\Controllers\Setad\CumulativeVoiceRatingStatsController;
|
||||
use App\Http\Middleware\SuperAdminCheck;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
@@ -119,4 +120,12 @@ Route::prefix('server')->group(function () {
|
||||
->group(function () {
|
||||
Route::get('/', 'index')->name('index');
|
||||
});
|
||||
|
||||
Route::middleware('auth')
|
||||
->prefix('cumulative_message_ratings')
|
||||
->name('cumulativeMessageRatings.')
|
||||
->controller(CumulativeMessageRatingStatsController::class)
|
||||
->group(function () {
|
||||
Route::get('/', 'index')->name('index');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user