chore: migrated legacy issues management, media monitoring
This commit is contained in:
parent
02ad2ae318
commit
7eaabd4408
@ -305,6 +305,9 @@ public function governmentAgency(Request $request){
|
|||||||
|
|
||||||
return DataTables::of($data)
|
return DataTables::of($data)
|
||||||
->addIndexColumn()
|
->addIndexColumn()
|
||||||
|
->addColumn('issues', function ($data) {
|
||||||
|
return $data->managementIssues->count();
|
||||||
|
})
|
||||||
->addColumn('action', function ($data) {
|
->addColumn('action', function ($data) {
|
||||||
$showUrl = route('dashboard.government.agencies.show', ['id' => encrypt_id($data->id)]);
|
$showUrl = route('dashboard.government.agencies.show', ['id' => encrypt_id($data->id)]);
|
||||||
|
|
||||||
@ -1592,7 +1595,7 @@ public function mediaMonitoring(Request $request){
|
|||||||
return DataTables::of($data)
|
return DataTables::of($data)
|
||||||
->addIndexColumn()
|
->addIndexColumn()
|
||||||
->addColumn('enhancer', function ($data) {
|
->addColumn('enhancer', function ($data) {
|
||||||
return $data->enhancer->name;
|
return $data->enhancer ? $data->enhancer->name : 'Undefined';
|
||||||
})
|
})
|
||||||
->addColumn('input_date', function ($data) {
|
->addColumn('input_date', function ($data) {
|
||||||
return idn_date($data->input_date, 'd F Y');
|
return idn_date($data->input_date, 'd F Y');
|
||||||
@ -1601,7 +1604,11 @@ public function mediaMonitoring(Request $request){
|
|||||||
return shorten_text($data->title, 40);
|
return shorten_text($data->title, 40);
|
||||||
})
|
})
|
||||||
->addColumn('link', function ($data) {
|
->addColumn('link', function ($data) {
|
||||||
return '<a href="'.$data->link.'" target="_blank">'.$data->link.'</a>';
|
if(filled($data->link)){
|
||||||
|
return '<a href="'.$data->link.'" target="_blank">'.$data->link.'</a>';
|
||||||
|
}else{
|
||||||
|
return '-';
|
||||||
|
}
|
||||||
})
|
})
|
||||||
->addColumn('issue_status', function ($data) {
|
->addColumn('issue_status', function ($data) {
|
||||||
if ($data->issue) {
|
if ($data->issue) {
|
||||||
@ -1659,9 +1666,6 @@ public function issueManagement(Request $request){
|
|||||||
|
|
||||||
return DataTables::of($data)
|
return DataTables::of($data)
|
||||||
->addIndexColumn()
|
->addIndexColumn()
|
||||||
->addColumn('enhancer', function ($data) {
|
|
||||||
return $data->enhancer->name;
|
|
||||||
})
|
|
||||||
->addColumn('code', function ($data) {
|
->addColumn('code', function ($data) {
|
||||||
return $data->mediaMonitoring->code;
|
return $data->mediaMonitoring->code;
|
||||||
})
|
})
|
||||||
|
|||||||
@ -3,14 +3,15 @@
|
|||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
|
||||||
class GovernmentAgency extends Model
|
class GovernmentAgency extends Model
|
||||||
{
|
{
|
||||||
|
|
||||||
protected $table = 'government_agencies';
|
protected $table = 'government_agencies';
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'name',
|
'name',
|
||||||
'slug',
|
|
||||||
'short_name',
|
'short_name',
|
||||||
'location',
|
'location',
|
||||||
'description',
|
'description',
|
||||||
|
|||||||
@ -4,9 +4,12 @@
|
|||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Model\Pivot;
|
use Illuminate\Database\Eloquent\Model\Pivot;
|
||||||
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
|
||||||
class IssueManagement extends Model
|
class IssueManagement extends Model
|
||||||
{
|
{
|
||||||
|
use SoftDeletes;
|
||||||
|
|
||||||
protected $table = 'issue_managements';
|
protected $table = 'issue_managements';
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
|
|||||||
12
app/Models/Legacy/OldGovernmentAgency.php
Normal file
12
app/Models/Legacy/OldGovernmentAgency.php
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models\Legacy;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class OldGovernmentAgency extends Model
|
||||||
|
{
|
||||||
|
protected $connection = 'legacy';
|
||||||
|
|
||||||
|
protected $table = 'agencies';
|
||||||
|
}
|
||||||
12
app/Models/Legacy/OldIssueManagement.php
Normal file
12
app/Models/Legacy/OldIssueManagement.php
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models\Legacy;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class OldIssueManagement extends Model
|
||||||
|
{
|
||||||
|
protected $connection = 'legacy';
|
||||||
|
|
||||||
|
protected $table = 'issue_management';
|
||||||
|
}
|
||||||
12
app/Models/Legacy/OldLocation.php
Normal file
12
app/Models/Legacy/OldLocation.php
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models\Legacy;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class OldLocation extends Model
|
||||||
|
{
|
||||||
|
protected $connection = 'legacy';
|
||||||
|
|
||||||
|
protected $table = 'locuses';
|
||||||
|
}
|
||||||
12
app/Models/Legacy/OldSubLocation.php
Normal file
12
app/Models/Legacy/OldSubLocation.php
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models\Legacy;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class OldSubLocation extends Model
|
||||||
|
{
|
||||||
|
protected $connection = 'legacy';
|
||||||
|
|
||||||
|
protected $table = 'sub_locuses';
|
||||||
|
}
|
||||||
@ -10,7 +10,6 @@ class Location extends Model
|
|||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'name',
|
'name',
|
||||||
'slug',
|
|
||||||
'status',
|
'status',
|
||||||
'description',
|
'description',
|
||||||
'enhancer_id'
|
'enhancer_id'
|
||||||
|
|||||||
@ -10,7 +10,6 @@ class SubLocation extends Model
|
|||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'name',
|
'name',
|
||||||
'slug',
|
|
||||||
'status',
|
'status',
|
||||||
'description',
|
'description',
|
||||||
'location_id',
|
'location_id',
|
||||||
|
|||||||
@ -14,7 +14,6 @@ public function up(): void
|
|||||||
Schema::create('government_agencies', function (Blueprint $table) {
|
Schema::create('government_agencies', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
$table->string('name');
|
$table->string('name');
|
||||||
$table->string('slug')->unique();;
|
|
||||||
$table->string('short_name')->nullable();
|
$table->string('short_name')->nullable();
|
||||||
$table->text('location')->nullable();
|
$table->text('location')->nullable();
|
||||||
$table->text('description')->nullable();
|
$table->text('description')->nullable();
|
||||||
|
|||||||
@ -14,7 +14,6 @@ public function up(): void
|
|||||||
Schema::create('locations', function (Blueprint $table) {
|
Schema::create('locations', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
$table->string('name');
|
$table->string('name');
|
||||||
$table->string('slug')->unique();;
|
|
||||||
$table->text('description')->nullable();
|
$table->text('description')->nullable();
|
||||||
$table->enum('status', ['0', '1'])->default('0');
|
$table->enum('status', ['0', '1'])->default('0');
|
||||||
$table->unsignedBigInteger('enhancer_id');
|
$table->unsignedBigInteger('enhancer_id');
|
||||||
|
|||||||
@ -14,7 +14,6 @@ public function up(): void
|
|||||||
Schema::create('sub_locations', function (Blueprint $table) {
|
Schema::create('sub_locations', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
$table->string('name');
|
$table->string('name');
|
||||||
$table->string('slug')->unique();;
|
|
||||||
$table->text('description')->nullable();
|
$table->text('description')->nullable();
|
||||||
$table->enum('status', ['0', '1'])->default('0');
|
$table->enum('status', ['0', '1'])->default('0');
|
||||||
$table->unsignedBigInteger('location_id');
|
$table->unsignedBigInteger('location_id');
|
||||||
|
|||||||
@ -25,10 +25,11 @@ public function up(): void
|
|||||||
$table->foreign('media_monitoring_id')->references('id')->on('media_monitorings');
|
$table->foreign('media_monitoring_id')->references('id')->on('media_monitorings');
|
||||||
$table->enum('issue', ['positif','negatif','netral','krisis']);
|
$table->enum('issue', ['positif','negatif','netral','krisis']);
|
||||||
$table->enum('response', ['positif','negatif','netral','krisis']);
|
$table->enum('response', ['positif','negatif','netral','krisis']);
|
||||||
$table->text('description');
|
$table->text('description')->nullable();
|
||||||
$table->unsignedBigInteger('enhancer_id');
|
$table->unsignedBigInteger('enhancer_id');
|
||||||
$table->foreign('enhancer_id')->references('id')->on('users');
|
$table->foreign('enhancer_id')->references('id')->on('users');
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
|
$table->softDeletes();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace Database\Seeders;
|
namespace Database\Seeders;
|
||||||
|
|
||||||
|
use App\Models\SubLocation;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||||
use Illuminate\Database\Seeder;
|
use Illuminate\Database\Seeder;
|
||||||
@ -17,10 +18,13 @@ public function run(): void
|
|||||||
$this->call(UserSeeder::class);
|
$this->call(UserSeeder::class);
|
||||||
$this->call(ClassificationSeeder::class);
|
$this->call(ClassificationSeeder::class);
|
||||||
$this->call(SubClassificationSeeder::class);
|
$this->call(SubClassificationSeeder::class);
|
||||||
|
$this->call(LocationSeeder::class);
|
||||||
|
$this->call(SubLocationSeeder::class);
|
||||||
$this->call(CompanySeeder::class);
|
$this->call(CompanySeeder::class);
|
||||||
$this->call(MediaSeeder::class);
|
$this->call(MediaSeeder::class);
|
||||||
$this->call(JournalistSeeder::class);
|
$this->call(JournalistSeeder::class);
|
||||||
$this->call(GovernmentAgencySeeder::class);
|
$this->call(GovernmentAgencySeeder::class);
|
||||||
$this->call(MediaMonitoringSeeder::class);
|
$this->call(MediaMonitoringSeeder::class);
|
||||||
|
$this->call(IssueManagementSeeder::class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,8 +3,10 @@
|
|||||||
namespace Database\Seeders;
|
namespace Database\Seeders;
|
||||||
|
|
||||||
use App\Models\GovernmentAgency;
|
use App\Models\GovernmentAgency;
|
||||||
|
use App\Models\Legacy\OldGovernmentAgency;
|
||||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||||
use Illuminate\Database\Seeder;
|
use Illuminate\Database\Seeder;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
class GovernmentAgencySeeder extends Seeder
|
class GovernmentAgencySeeder extends Seeder
|
||||||
{
|
{
|
||||||
@ -12,13 +14,31 @@ class GovernmentAgencySeeder extends Seeder
|
|||||||
* Run the database seeds.
|
* Run the database seeds.
|
||||||
*/
|
*/
|
||||||
public function run(): void
|
public function run(): void
|
||||||
{
|
{
|
||||||
GovernmentAgency::create([
|
$legacyGovernmentAgencies = OldGovernmentAgency::all();
|
||||||
'name' => 'Dinas Pendidikan',
|
|
||||||
'slug' => 'dinas-pendidikan',
|
foreach ($legacyGovernmentAgencies as $agency) {
|
||||||
'short_name' => 'Disdik',
|
$normalizedAgencyName = trim($agency->name); // Hapus spasi berlebih
|
||||||
'description' => 'Dinas yang menangani bidang pendidikan.',
|
|
||||||
'enhancer_id' => '1',
|
// Cari apakah sudah ada yang mirip dengan nama ini (tanpa memperhatikan huruf besar/kecil)
|
||||||
]);
|
$existingAgency = GovernmentAgency::whereRaw('LOWER(name) = ?', [strtolower($normalizedAgencyName)])->first();
|
||||||
|
|
||||||
|
if (!$existingAgency) {
|
||||||
|
GovernmentAgency::create([
|
||||||
|
'name' => $normalizedAgencyName, // Simpan dengan format aslinya
|
||||||
|
'created_at' => $agency->created_at,
|
||||||
|
'updated_at' => $agency->updated_at,
|
||||||
|
'enhancer_id' => $agency->user_id,
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Tambahkan "Lainnya" jika belum ada
|
||||||
|
GovernmentAgency::firstOrCreate(
|
||||||
|
['name' => 'Lainnya'],
|
||||||
|
['enhancer_id' => 1]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,8 +2,12 @@
|
|||||||
|
|
||||||
namespace Database\Seeders;
|
namespace Database\Seeders;
|
||||||
|
|
||||||
|
use App\Models\GovernmentAgency;
|
||||||
|
use App\Models\IssueManagement;
|
||||||
|
use App\Models\Legacy\OldIssueManagement;
|
||||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||||
use Illuminate\Database\Seeder;
|
use Illuminate\Database\Seeder;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
class IssueManagementSeeder extends Seeder
|
class IssueManagementSeeder extends Seeder
|
||||||
{
|
{
|
||||||
@ -12,6 +16,71 @@ class IssueManagementSeeder extends Seeder
|
|||||||
*/
|
*/
|
||||||
public function run(): void
|
public function run(): void
|
||||||
{
|
{
|
||||||
//
|
$legacyIssues = OldIssueManagement::all();
|
||||||
|
|
||||||
|
foreach ($legacyIssues as $legacyIssue) {
|
||||||
|
// Cek apakah ada koma (multiple agency) atau tidak
|
||||||
|
if (str_contains($legacyIssue->agency, ',')) {
|
||||||
|
// Jika multiple, pecah berdasarkan koma
|
||||||
|
$agencyNames = explode(',', $legacyIssue->agency);
|
||||||
|
} else {
|
||||||
|
// Jika single, tetap jadikan array agar bisa di-loop
|
||||||
|
$agencyNames = [$legacyIssue->agency];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hapus spasi pada nama agency
|
||||||
|
$agencyNames = array_map('trim', $agencyNames);
|
||||||
|
|
||||||
|
// Ambil semua agency yang ada di database yang sesuai dengan nama agency
|
||||||
|
// Opsi 1
|
||||||
|
// $agencies = GovernmentAgency::whereIn('name', $agencyNames)->get();
|
||||||
|
// $agencies = GovernmentAgency::whereIn('name', $agencyNames)->get();
|
||||||
|
// Opsi 2
|
||||||
|
$agencies = GovernmentAgency::where(function ($query) use ($agencyNames) {
|
||||||
|
foreach ($agencyNames as $name) {
|
||||||
|
$query->orWhere('name', 'LIKE', "%$name%");
|
||||||
|
}
|
||||||
|
})->get();
|
||||||
|
|
||||||
|
// Membuat array untuk menyimpan id agency yang ditemukan
|
||||||
|
$agencyIds = [];
|
||||||
|
|
||||||
|
// Loop untuk mencocokkan nama agency dengan id
|
||||||
|
foreach ($agencyNames as $name) {
|
||||||
|
// Cari agency yang cocok dengan nama ini
|
||||||
|
$agency = $agencies->firstWhere('name', $name);
|
||||||
|
|
||||||
|
if ($agency) {
|
||||||
|
$agencyIds[] = $agency->id;
|
||||||
|
}else{
|
||||||
|
$otherAgency = GovernmentAgency::where('name', 'Lainnya')->first();
|
||||||
|
|
||||||
|
Log::info("OPD yang tidak cocok: ". $name);
|
||||||
|
|
||||||
|
$agencyIds[] = $otherAgency->id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Membuat issue management baru dan mengaitkan dengan agency
|
||||||
|
$createdIssueManagement = IssueManagement::create([
|
||||||
|
'id' => $legacyIssue->id,
|
||||||
|
'location_id' => $legacyIssue->locus,
|
||||||
|
'sub_location_id' => $legacyIssue->sub_locus,
|
||||||
|
'classification_id' => $legacyIssue->classification,
|
||||||
|
'sub_classification_id' => $legacyIssue->sub_classification,
|
||||||
|
'issue' => $legacyIssue->issue,
|
||||||
|
'response' => $legacyIssue->response,
|
||||||
|
'description' => $legacyIssue->description,
|
||||||
|
'created_at' => $legacyIssue->created_at,
|
||||||
|
'updated_at' => $legacyIssue->updated_at,
|
||||||
|
'deleted_at' => $legacyIssue->deleted_at,
|
||||||
|
'enhancer_id' => in_array($legacyIssue->enhancer, [0, 3]) ? 1 : $legacyIssue->enhancer,
|
||||||
|
'media_monitoring_id' => $legacyIssue->media_monitoring,
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Attach agency IDs ke issue management
|
||||||
|
$createdIssueManagement->governmentAgencies()->attach($agencyIds);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,8 +2,11 @@
|
|||||||
|
|
||||||
namespace Database\Seeders;
|
namespace Database\Seeders;
|
||||||
|
|
||||||
|
use App\Models\Legacy\OldLocation;
|
||||||
|
use App\Models\Location;
|
||||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||||
use Illuminate\Database\Seeder;
|
use Illuminate\Database\Seeder;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
class LocationSeeder extends Seeder
|
class LocationSeeder extends Seeder
|
||||||
{
|
{
|
||||||
@ -12,6 +15,18 @@ class LocationSeeder extends Seeder
|
|||||||
*/
|
*/
|
||||||
public function run(): void
|
public function run(): void
|
||||||
{
|
{
|
||||||
//
|
$legacyLocations = OldLocation::all();
|
||||||
|
|
||||||
|
foreach($legacyLocations as $legacyLocation){
|
||||||
|
Location::create([
|
||||||
|
'id' => $legacyLocation->id,
|
||||||
|
'name' => $legacyLocation->name,
|
||||||
|
'description' => null,
|
||||||
|
'status' => $legacyLocation->status,
|
||||||
|
'enhancer_id' => $legacyLocation->enhancer,
|
||||||
|
'created_at' => $legacyLocation->created_at,
|
||||||
|
'updated_at' => $legacyLocation->updated_at,
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,8 +2,11 @@
|
|||||||
|
|
||||||
namespace Database\Seeders;
|
namespace Database\Seeders;
|
||||||
|
|
||||||
|
use App\Models\Legacy\OldSubLocation;
|
||||||
|
use App\Models\SubLocation;
|
||||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||||
use Illuminate\Database\Seeder;
|
use Illuminate\Database\Seeder;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
class SubLocationSeeder extends Seeder
|
class SubLocationSeeder extends Seeder
|
||||||
{
|
{
|
||||||
@ -12,6 +15,19 @@ class SubLocationSeeder extends Seeder
|
|||||||
*/
|
*/
|
||||||
public function run(): void
|
public function run(): void
|
||||||
{
|
{
|
||||||
//
|
$legacySubLocations = OldSubLocation::all();
|
||||||
|
|
||||||
|
foreach($legacySubLocations as $legacySubLocation){
|
||||||
|
SubLocation::create([
|
||||||
|
'id' => $legacySubLocation->id,
|
||||||
|
'name' => $legacySubLocation->name,
|
||||||
|
'description' => null,
|
||||||
|
'status' => $legacySubLocation->status,
|
||||||
|
'enhancer_id' => $legacySubLocation->enhancer,
|
||||||
|
'created_at' => $legacySubLocation->created_at,
|
||||||
|
'updated_at' => $legacySubLocation->updated_at,
|
||||||
|
'location_id' => $legacySubLocation->locus,
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -44,6 +44,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th style="width: 10% !important;">No</th>
|
<th style="width: 10% !important;">No</th>
|
||||||
<th>Nama</th>
|
<th>Nama</th>
|
||||||
|
<th>Isu</th>
|
||||||
<th style="width: 10% !important;"></th>
|
<th style="width: 10% !important;"></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|||||||
@ -141,6 +141,7 @@
|
|||||||
columns: [
|
columns: [
|
||||||
{ data: 'DT_RowIndex', name: 'DT_RowIndex', orderable: false, searchable: false },
|
{ data: 'DT_RowIndex', name: 'DT_RowIndex', orderable: false, searchable: false },
|
||||||
{ data: 'name', name: 'name' },
|
{ data: 'name', name: 'name' },
|
||||||
|
{ data: 'issues', name: 'issues' },
|
||||||
{ data: 'action', name: 'action', orderable: false, searchable: false },
|
{ data: 'action', name: 'action', orderable: false, searchable: false },
|
||||||
{ data: 'created_at', name: 'created_at', visible: false },
|
{ data: 'created_at', name: 'created_at', visible: false },
|
||||||
{ data: 'id', name: 'id', orderable: true, searchable: false, visible: false },
|
{ data: 'id', name: 'id', orderable: true, searchable: false, visible: false },
|
||||||
@ -745,9 +746,29 @@
|
|||||||
{ data: 'created_at', name: 'created_at', visible: false },
|
{ data: 'created_at', name: 'created_at', visible: false },
|
||||||
{ data: 'id', name: 'id', orderable: true, searchable: false, visible: false },
|
{ data: 'id', name: 'id', orderable: true, searchable: false, visible: false },
|
||||||
],
|
],
|
||||||
|
columnDefs: [
|
||||||
|
{ targets: 0, width: '10%' }, // Kolom No
|
||||||
|
{ targets: 1, width: '10%' }, // Kolom Kode
|
||||||
|
{ targets: 2, width: '10%' }, // Kolom Pengirim
|
||||||
|
{ targets: 3, width: '18%' }, // Kolom Tanggal
|
||||||
|
{ targets: 4, width: '5%' }, // Kolom aksi
|
||||||
|
|
||||||
|
// Menambahkan word wrap pada kolom location, sub_location, classification, sub_classification, response, dan government_agencies
|
||||||
|
{
|
||||||
|
targets: [4, 5, 6, 7, 9, 10], // Indeks kolom yang ingin diberi word wrap
|
||||||
|
createdCell: function(td, cellData, rowData, row, col) {
|
||||||
|
// Membungkus teks di kolom-kolom yang dipilih
|
||||||
|
$(td).css({
|
||||||
|
'word-wrap': 'break-word',
|
||||||
|
'white-space': 'normal',
|
||||||
|
'overflow-wrap': 'break-word'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
language: datatableLanguage,
|
language: datatableLanguage,
|
||||||
autoWidth: false,
|
autoWidth: false,
|
||||||
order: [[12, 'desc']],
|
order: [[3, 'desc']],
|
||||||
pagingType: "simple",
|
pagingType: "simple",
|
||||||
lengthMenu: [[10, 25, 50, 100, -1], ['Tampilkan 10 data', 'Tampilkan 25 data', 'Tampilkan 50 data', 'Tampilkan 100 data', 'Tampilkan semua']],
|
lengthMenu: [[10, 25, 50, 100, -1], ['Tampilkan 10 data', 'Tampilkan 25 data', 'Tampilkan 50 data', 'Tampilkan 100 data', 'Tampilkan semua']],
|
||||||
scrollX: true
|
scrollX: true
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user