diff --git a/resources/views/presisi/statistik/adat.blade.php b/resources/views/presisi/statistik/adat.blade.php
index ba60e562..d0765dad 100644
--- a/resources/views/presisi/statistik/adat.blade.php
+++ b/resources/views/presisi/statistik/adat.blade.php
@@ -5,7 +5,7 @@
@section('title', 'Data Statistik')
@section('content_header')
-
Data Statistik {{ $judul }}
+Data Statistik {{ $judul }}
@stop
@section('content')
@@ -35,8 +35,8 @@
@@ -107,7 +107,7 @@
let nama_desa = `{{ session('desa.nama_desa') }}`;
let kategori = `{{ strtolower($judul) }}`;
let default_id = null;
- document.addEventListener("DOMContentLoaded", function(event) {
+ document.addEventListener("DOMContentLoaded", function (event) {
const header = @include('layouts.components.header_bearer_api_gabungan');
@@ -119,21 +119,21 @@
url: urlKategoriStatistik.href,
headers: header,
method: 'get',
- success: function(response) {
+ success: function (response) {
var daftarKategoriStatistik = response.data[0]['attributes']
var html = ''
- Object.keys(daftarKategoriStatistik).forEach(function(index) {
+ Object.keys(daftarKategoriStatistik).forEach(function (index) {
var id = index;
var nama = daftarKategoriStatistik[index];
html += `
-
-
- ${nama}
-
-
- `
+
+
+ ${nama}
+
+
+ `
});
$('#daftar-statistik').html(html)
@@ -141,7 +141,7 @@
}
});
- $('#daftar-statistik').on('mouseenter', '.pilih-kategori > a', function() {
+ $('#daftar-statistik').on('mouseenter', '.pilih-kategori > a', function () {
$(this).css('cursor', 'pointer')
});
@@ -149,8 +149,8 @@
function createExportCaption(categoryName, options = {}) {
const {
includeDate = true,
- includeLocation = true,
- customTitle = null,
+ includeLocation = true,
+ customTitle = null,
} = options;
var caption = {
@@ -293,20 +293,20 @@ function exportToExcel() {
return result;
}
- $('#export-excel').on('click', function() {
+ $('#export-excel').on('click', function () {
console.log('Export button clicked');
exportToExcel();
});
- $('#btn-grafik').on('click', function() {
+ $('#btn-grafik').on('click', function () {
$("#pie-statistik").collapse('hide');
});
- $('#btn-pie').on('click', function() {
+ $('#btn-pie').on('click', function () {
$("#grafik-statistik").collapse('hide')
});
- $('#daftar-statistik').on('click', '.pilih-kategori > a', function() {
+ $('#daftar-statistik').on('click', '.pilih-kategori > a', function () {
var id = $(this).data('id')
$('.pilih-kategori > a').removeClass('active')
@@ -331,7 +331,10 @@ function exportToExcel() {
processing: true,
serverSide: true,
autoWidth: false,
- ordering: false,
+ ordering: true,
+ order: [
+ [2, 'desc']
+ ],
searching: false,
deferLoading: 0,
paging: false,
@@ -340,15 +343,18 @@ function exportToExcel() {
url: urlStatistik.href,
headers: header,
method: 'get',
- data: function(row) {
+ data: function (row) {
return {
-
+ "sort": (row.order[0]?.dir === "asc" ? "" : "-") + row.columns[row
+ .order[0]
+ ?.column]
+ ?.name
};
},
- dataSrc: function(json) {
+ dataSrc: function (json) {
if (json.data && json.data.length > 0) {
data_grafik = [];
- json.data.forEach(function(item, index) {
+ json.data.forEach(function (item, index) {
data_grafik.push({
nama: item.attributes.nilai,
jumlah: item.attributes.jumlah
@@ -364,21 +370,22 @@ function exportToExcel() {
},
},
columnDefs: [{
- targets: '_all',
- className: 'text-nowrap',
- },
- {
- targets: [2],
- className: 'dt-body-right',
- },
+ targets: '_all',
+ className: 'text-nowrap',
+ },
+ {
+ targets: [2],
+ className: 'dt-body-right',
+ },
],
columns: [{
data: null,
- render: function(data, type, row, meta) {
+ orderable: false,
+ render: function (data, type, row, meta) {
return meta.row + 1;
}
}, {
- data: function(data) {
+ data: function (data) {
const nilai = data.attributes?.nilai || data.id || '';
if (nilai !== 'JUMLAH' && nilai !== 'BELUM MENGISI' && nilai !==
@@ -397,8 +404,9 @@ className: 'dt-body-right',
return nilai;
},
+ orderable: false,
}, {
- data: function(data) {
+ data: function (data) {
const nilai = data.attributes?.nilai || data.id || '';
const jumlah = data.attributes?.jumlah || 0;
@@ -413,26 +421,28 @@ className: 'dt-body-right',
return jumlah;
},
+ orderable: true,
+ name: 'jumlah',
}]
});
- statistik.on('draw.dt', function() {
+ statistik.on('draw.dt', function () {
var dataTable = $('#tabel-data').DataTable();
var pageInfo = dataTable.page.info();
var recordsTotal = dataTable.data().count();
statistik.column(0, {
page: 'current'
- }).nodes().each(function(cell, i) {
+ }).nodes().each(function (cell, i) {
cell.innerHTML = i + 1 + pageInfo.start;
});
});
- $('#filter').on('click', function(e) {
+ $('#filter').on('click', function (e) {
statistik.draw();
});
- $(document).on('click', '#reset', function(e) {
+ $(document).on('click', '#reset', function (e) {
e.preventDefault();
statistik.ajax.reload();
});
@@ -464,4 +474,4 @@ className: 'dt-body-right',
color: blue;
}
-@endpush
+@endpush
\ No newline at end of file
diff --git a/resources/views/presisi/statistik/aktivitas-keagamaan.blade.php b/resources/views/presisi/statistik/aktivitas-keagamaan.blade.php
index 9d069ff5..6e1c0049 100644
--- a/resources/views/presisi/statistik/aktivitas-keagamaan.blade.php
+++ b/resources/views/presisi/statistik/aktivitas-keagamaan.blade.php
@@ -5,7 +5,7 @@
@section('title', 'Data Statistik')
@section('content_header')
-
Data Statistik {{ $judul }}
+
Data Statistik {{ $judul }}
@stop
@section('content')
@@ -35,8 +35,8 @@
@@ -107,7 +107,7 @@
let nama_desa = `{{ session('desa.nama_desa') }}`;
let kategori = `{{ strtolower($judul) }}`;
let default_id = null;
- document.addEventListener("DOMContentLoaded", function(event) {
+ document.addEventListener("DOMContentLoaded", function (event) {
const header = @include('layouts.components.header_bearer_api_gabungan');
@@ -119,21 +119,21 @@
url: urlKategoriStatistik.href,
headers: header,
method: 'get',
- success: function(response) {
+ success: function (response) {
var daftarKategoriStatistik = response.data[0]['attributes']
var html = ''
- Object.keys(daftarKategoriStatistik).forEach(function(index) {
+ Object.keys(daftarKategoriStatistik).forEach(function (index) {
var id = index;
var nama = daftarKategoriStatistik[index];
html += `
-
-
- ${nama}
-
-
- `
+
+
+ ${nama}
+
+
+ `
});
$('#daftar-statistik').html(html)
@@ -141,7 +141,7 @@
}
});
- $('#daftar-statistik').on('mouseenter', '.pilih-kategori > a', function() {
+ $('#daftar-statistik').on('mouseenter', '.pilih-kategori > a', function () {
$(this).css('cursor', 'pointer')
});
@@ -149,8 +149,8 @@
function createExportCaption(categoryName, options = {}) {
const {
includeDate = true,
- includeLocation = true,
- customTitle = null,
+ includeLocation = true,
+ customTitle = null,
} = options;
var caption = {
@@ -293,20 +293,20 @@ function exportToExcel() {
return result;
}
- $('#export-excel').on('click', function() {
+ $('#export-excel').on('click', function () {
console.log('Export button clicked');
exportToExcel();
});
- $('#btn-grafik').on('click', function() {
+ $('#btn-grafik').on('click', function () {
$("#pie-statistik").collapse('hide');
});
- $('#btn-pie').on('click', function() {
+ $('#btn-pie').on('click', function () {
$("#grafik-statistik").collapse('hide')
});
- $('#daftar-statistik').on('click', '.pilih-kategori > a', function() {
+ $('#daftar-statistik').on('click', '.pilih-kategori > a', function () {
var id = $(this).data('id')
$('.pilih-kategori > a').removeClass('active')
@@ -331,7 +331,10 @@ function exportToExcel() {
processing: true,
serverSide: true,
autoWidth: false,
- ordering: false,
+ ordering: true,
+ order: [
+ [2, 'desc']
+ ],
searching: false,
deferLoading: 0,
paging: false,
@@ -340,15 +343,18 @@ function exportToExcel() {
url: urlStatistik.href,
headers: header,
method: 'get',
- data: function(row) {
+ data: function (row) {
return {
-
+ "sort": (row.order[0]?.dir === "asc" ? "" : "-") + row.columns[row
+ .order[0]
+ ?.column]
+ ?.name
};
},
- dataSrc: function(json) {
+ dataSrc: function (json) {
if (json.data && json.data.length > 0) {
data_grafik = [];
- json.data.forEach(function(item, index) {
+ json.data.forEach(function (item, index) {
data_grafik.push({
nama: item.attributes.nilai,
jumlah: item.attributes.jumlah
@@ -364,21 +370,22 @@ function exportToExcel() {
},
},
columnDefs: [{
- targets: '_all',
- className: 'text-nowrap',
- },
- {
- targets: [2],
- className: 'dt-body-right',
- },
+ targets: '_all',
+ className: 'text-nowrap',
+ },
+ {
+ targets: [2],
+ className: 'dt-body-right',
+ },
],
columns: [{
data: null,
- render: function(data, type, row, meta) {
+ orderable: false,
+ render: function (data, type, row, meta) {
return meta.row + 1;
}
}, {
- data: function(data) {
+ data: function (data) {
const nilai = data.attributes?.nilai || data.id || '';
if (nilai !== 'JUMLAH' && nilai !== 'BELUM MENGISI' && nilai !==
@@ -397,8 +404,9 @@ className: 'dt-body-right',
return nilai;
},
+ orderable: false,
}, {
- data: function(data) {
+ data: function (data) {
const nilai = data.attributes?.nilai || data.id || '';
const jumlah = data.attributes?.jumlah || 0;
@@ -413,26 +421,28 @@ className: 'dt-body-right',
return jumlah;
},
+ orderable: true,
+ name: 'jumlah',
}]
});
- statistik.on('draw.dt', function() {
+ statistik.on('draw.dt', function () {
var dataTable = $('#tabel-data').DataTable();
var pageInfo = dataTable.page.info();
var recordsTotal = dataTable.data().count();
statistik.column(0, {
page: 'current'
- }).nodes().each(function(cell, i) {
+ }).nodes().each(function (cell, i) {
cell.innerHTML = i + 1 + pageInfo.start;
});
});
- $('#filter').on('click', function(e) {
+ $('#filter').on('click', function (e) {
statistik.draw();
});
- $(document).on('click', '#reset', function(e) {
+ $(document).on('click', '#reset', function (e) {
e.preventDefault();
statistik.ajax.reload();
});
@@ -464,4 +474,4 @@ className: 'dt-body-right',
color: blue;
}
-@endpush
+@endpush
\ No newline at end of file
diff --git a/resources/views/presisi/statistik/jaminan-sosial.blade.php b/resources/views/presisi/statistik/jaminan-sosial.blade.php
index 12cf7472..51dc95f8 100644
--- a/resources/views/presisi/statistik/jaminan-sosial.blade.php
+++ b/resources/views/presisi/statistik/jaminan-sosial.blade.php
@@ -5,7 +5,7 @@
@section('title', 'Data Statistik')
@section('content_header')
-
Data Statistik {{ $judul }}
+
Data Statistik {{ $judul }}
@stop
@section('content')
@@ -35,8 +35,8 @@
@@ -107,7 +107,7 @@
let nama_desa = `{{ session('desa.nama_desa') }}`;
let kategori = `{{ strtolower($judul) }}`;
let default_id = null;
- document.addEventListener("DOMContentLoaded", function(event) {
+ document.addEventListener("DOMContentLoaded", function (event) {
const header = @include('layouts.components.header_bearer_api_gabungan');
@@ -119,21 +119,21 @@
url: urlKategoriStatistik.href,
headers: header,
method: 'get',
- success: function(response) {
+ success: function (response) {
var daftarKategoriStatistik = response.data[0]['attributes']
var html = ''
- Object.keys(daftarKategoriStatistik).forEach(function(index) {
+ Object.keys(daftarKategoriStatistik).forEach(function (index) {
var id = index;
var nama = daftarKategoriStatistik[index];
html += `
-
-
- ${nama}
-
-
- `
+
+
+ ${nama}
+
+
+ `
});
$('#daftar-statistik').html(html)
@@ -141,7 +141,7 @@
}
});
- $('#daftar-statistik').on('mouseenter', '.pilih-kategori > a', function() {
+ $('#daftar-statistik').on('mouseenter', '.pilih-kategori > a', function () {
$(this).css('cursor', 'pointer')
});
@@ -149,8 +149,8 @@
function createExportCaption(categoryName, options = {}) {
const {
includeDate = true,
- includeLocation = true,
- customTitle = null,
+ includeLocation = true,
+ customTitle = null,
} = options;
var caption = {
@@ -293,20 +293,20 @@ function exportToExcel() {
return result;
}
- $('#export-excel').on('click', function() {
+ $('#export-excel').on('click', function () {
console.log('Export button clicked');
exportToExcel();
});
- $('#btn-grafik').on('click', function() {
+ $('#btn-grafik').on('click', function () {
$("#pie-statistik").collapse('hide');
});
- $('#btn-pie').on('click', function() {
+ $('#btn-pie').on('click', function () {
$("#grafik-statistik").collapse('hide')
});
- $('#daftar-statistik').on('click', '.pilih-kategori > a', function() {
+ $('#daftar-statistik').on('click', '.pilih-kategori > a', function () {
var id = $(this).data('id')
$('.pilih-kategori > a').removeClass('active')
@@ -331,7 +331,10 @@ function exportToExcel() {
processing: true,
serverSide: true,
autoWidth: false,
- ordering: false,
+ ordering: true,
+ order: [
+ [2, 'desc']
+ ],
searching: false,
deferLoading: 0,
paging: false,
@@ -340,15 +343,18 @@ function exportToExcel() {
url: urlStatistik.href,
headers: header,
method: 'get',
- data: function(row) {
+ data: function (row) {
return {
-
+ "sort": (row.order[0]?.dir === "asc" ? "" : "-") + row.columns[row
+ .order[0]
+ ?.column]
+ ?.name
};
},
- dataSrc: function(json) {
+ dataSrc: function (json) {
if (json.data && json.data.length > 0) {
data_grafik = [];
- json.data.forEach(function(item, index) {
+ json.data.forEach(function (item, index) {
data_grafik.push({
nama: item.attributes.nilai,
jumlah: item.attributes.jumlah
@@ -364,21 +370,22 @@ function exportToExcel() {
},
},
columnDefs: [{
- targets: '_all',
- className: 'text-nowrap',
- },
- {
- targets: [2],
- className: 'dt-body-right',
- },
+ targets: '_all',
+ className: 'text-nowrap',
+ },
+ {
+ targets: [2],
+ className: 'dt-body-right',
+ },
],
columns: [{
data: null,
- render: function(data, type, row, meta) {
+ orderable: false,
+ render: function (data, type, row, meta) {
return meta.row + 1;
}
}, {
- data: function(data) {
+ data: function (data) {
const nilai = data.attributes?.nilai || data.id || '';
if (nilai !== 'JUMLAH' && nilai !== 'BELUM MENGISI' && nilai !==
@@ -397,8 +404,9 @@ className: 'dt-body-right',
return nilai;
},
+ orderable: false,
}, {
- data: function(data) {
+ data: function (data) {
const nilai = data.attributes?.nilai || data.id || '';
const jumlah = data.attributes?.jumlah || 0;
@@ -413,26 +421,28 @@ className: 'dt-body-right',
return jumlah;
},
+ orderable: true,
+ name: 'jumlah',
}]
});
- statistik.on('draw.dt', function() {
+ statistik.on('draw.dt', function () {
var dataTable = $('#tabel-data').DataTable();
var pageInfo = dataTable.page.info();
var recordsTotal = dataTable.data().count();
statistik.column(0, {
page: 'current'
- }).nodes().each(function(cell, i) {
+ }).nodes().each(function (cell, i) {
cell.innerHTML = i + 1 + pageInfo.start;
});
});
- $('#filter').on('click', function(e) {
+ $('#filter').on('click', function (e) {
statistik.draw();
});
- $(document).on('click', '#reset', function(e) {
+ $(document).on('click', '#reset', function (e) {
e.preventDefault();
statistik.ajax.reload();
});
@@ -464,4 +474,4 @@ className: 'dt-body-right',
color: blue;
}
-@endpush
+@endpush
\ No newline at end of file
diff --git a/resources/views/presisi/statistik/kesehatan.blade.php b/resources/views/presisi/statistik/kesehatan.blade.php
index 098eae64..535d4d82 100644
--- a/resources/views/presisi/statistik/kesehatan.blade.php
+++ b/resources/views/presisi/statistik/kesehatan.blade.php
@@ -5,7 +5,7 @@
@section('title', 'Data Statistik')
@section('content_header')
-
Data Statistik {{ $judul }}
+
Data Statistik {{ $judul }}
@stop
@section('content')
@@ -35,8 +35,8 @@
@@ -107,7 +107,7 @@
let nama_desa = `{{ session('desa.nama_desa') }}`;
let kategori = `{{ strtolower($judul) }}`;
let default_id = null;
- document.addEventListener("DOMContentLoaded", function(event) {
+ document.addEventListener("DOMContentLoaded", function (event) {
const header = @include('layouts.components.header_bearer_api_gabungan');
@@ -119,21 +119,21 @@
url: urlKategoriStatistik.href,
headers: header,
method: 'get',
- success: function(response) {
+ success: function (response) {
var daftarKategoriStatistik = response.data[0]['attributes']
var html = ''
- Object.keys(daftarKategoriStatistik).forEach(function(index) {
+ Object.keys(daftarKategoriStatistik).forEach(function (index) {
var id = index;
var nama = daftarKategoriStatistik[index];
html += `
-
-
- ${nama}
-
-
- `
+
+
+ ${nama}
+
+
+ `
});
$('#daftar-statistik').html(html)
@@ -141,7 +141,7 @@
}
});
- $('#daftar-statistik').on('mouseenter', '.pilih-kategori > a', function() {
+ $('#daftar-statistik').on('mouseenter', '.pilih-kategori > a', function () {
$(this).css('cursor', 'pointer')
});
@@ -149,8 +149,8 @@
function createExportCaption(categoryName, options = {}) {
const {
includeDate = true,
- includeLocation = true,
- customTitle = null,
+ includeLocation = true,
+ customTitle = null,
} = options;
var caption = {
@@ -293,20 +293,20 @@ function exportToExcel() {
return result;
}
- $('#export-excel').on('click', function() {
+ $('#export-excel').on('click', function () {
console.log('Export button clicked');
exportToExcel();
});
- $('#btn-grafik').on('click', function() {
+ $('#btn-grafik').on('click', function () {
$("#pie-statistik").collapse('hide');
});
- $('#btn-pie').on('click', function() {
+ $('#btn-pie').on('click', function () {
$("#grafik-statistik").collapse('hide')
});
- $('#daftar-statistik').on('click', '.pilih-kategori > a', function() {
+ $('#daftar-statistik').on('click', '.pilih-kategori > a', function () {
var id = $(this).data('id')
$('.pilih-kategori > a').removeClass('active')
@@ -331,7 +331,10 @@ function exportToExcel() {
processing: true,
serverSide: true,
autoWidth: false,
- ordering: false,
+ ordering: true,
+ order: [
+ [2, 'desc']
+ ],
searching: false,
deferLoading: 0,
paging: false,
@@ -340,15 +343,18 @@ function exportToExcel() {
url: urlStatistik.href,
headers: header,
method: 'get',
- data: function(row) {
+ data: function (row) {
return {
-
+ "sort": (row.order[0]?.dir === "asc" ? "" : "-") + row.columns[row
+ .order[0]
+ ?.column]
+ ?.name
};
},
- dataSrc: function(json) {
+ dataSrc: function (json) {
if (json.data && json.data.length > 0) {
data_grafik = [];
- json.data.forEach(function(item, index) {
+ json.data.forEach(function (item, index) {
data_grafik.push({
nama: item.attributes.nilai,
jumlah: item.attributes.jumlah
@@ -364,21 +370,22 @@ function exportToExcel() {
},
},
columnDefs: [{
- targets: '_all',
- className: 'text-nowrap',
- },
- {
- targets: [2],
- className: 'dt-body-right',
- },
+ targets: '_all',
+ className: 'text-nowrap',
+ },
+ {
+ targets: [2],
+ className: 'dt-body-right',
+ },
],
columns: [{
data: null,
- render: function(data, type, row, meta) {
+ orderable: false,
+ render: function (data, type, row, meta) {
return meta.row + 1;
}
}, {
- data: function(data) {
+ data: function (data) {
const nilai = data.attributes?.nilai || data.id || '';
if (nilai !== 'JUMLAH' && nilai !== 'BELUM MENGISI' && nilai !==
@@ -397,8 +404,9 @@ className: 'dt-body-right',
return nilai;
},
+ orderable: false,
}, {
- data: function(data) {
+ data: function (data) {
const nilai = data.attributes?.nilai || data.id || '';
const jumlah = data.attributes?.jumlah || 0;
@@ -413,26 +421,28 @@ className: 'dt-body-right',
return jumlah;
},
+ orderable: true,
+ name: 'jumlah',
}]
});
- statistik.on('draw.dt', function() {
+ statistik.on('draw.dt', function () {
var dataTable = $('#tabel-data').DataTable();
var pageInfo = dataTable.page.info();
var recordsTotal = dataTable.data().count();
statistik.column(0, {
page: 'current'
- }).nodes().each(function(cell, i) {
+ }).nodes().each(function (cell, i) {
cell.innerHTML = i + 1 + pageInfo.start;
});
});
- $('#filter').on('click', function(e) {
+ $('#filter').on('click', function (e) {
statistik.draw();
});
- $(document).on('click', '#reset', function(e) {
+ $(document).on('click', '#reset', function (e) {
e.preventDefault();
statistik.ajax.reload();
});
@@ -464,4 +474,4 @@ className: 'dt-body-right',
color: blue;
}
-@endpush
+@endpush
\ No newline at end of file
diff --git a/resources/views/presisi/statistik/ketenagakerjaan.blade.php b/resources/views/presisi/statistik/ketenagakerjaan.blade.php
index 55dc3ea1..7cf9a887 100644
--- a/resources/views/presisi/statistik/ketenagakerjaan.blade.php
+++ b/resources/views/presisi/statistik/ketenagakerjaan.blade.php
@@ -5,7 +5,7 @@
@section('title', 'Data Statistik')
@section('content_header')
-
Data Statistik {{ $judul }}
+
Data Statistik {{ $judul }}
@stop
@section('content')
@@ -35,8 +35,8 @@
@@ -107,7 +107,7 @@
let nama_desa = `{{ session('desa.nama_desa') }}`;
let kategori = `{{ strtolower($judul) }}`;
let default_id = null;
- document.addEventListener("DOMContentLoaded", function(event) {
+ document.addEventListener("DOMContentLoaded", function (event) {
const header = @include('layouts.components.header_bearer_api_gabungan');
@@ -119,21 +119,21 @@
url: urlKategoriStatistik.href,
headers: header,
method: 'get',
- success: function(response) {
+ success: function (response) {
var daftarKategoriStatistik = response.data[0]['attributes']
var html = ''
- Object.keys(daftarKategoriStatistik).forEach(function(index) {
+ Object.keys(daftarKategoriStatistik).forEach(function (index) {
var id = index;
var nama = daftarKategoriStatistik[index];
html += `
-
-
- ${nama}
-
-
- `
+
+
+ ${nama}
+
+
+ `
});
$('#daftar-statistik').html(html)
@@ -141,7 +141,7 @@
}
});
- $('#daftar-statistik').on('mouseenter', '.pilih-kategori > a', function() {
+ $('#daftar-statistik').on('mouseenter', '.pilih-kategori > a', function () {
$(this).css('cursor', 'pointer')
});
@@ -149,8 +149,8 @@
function createExportCaption(categoryName, options = {}) {
const {
includeDate = true,
- includeLocation = true,
- customTitle = null,
+ includeLocation = true,
+ customTitle = null,
} = options;
var caption = {
@@ -293,20 +293,20 @@ function exportToExcel() {
return result;
}
- $('#export-excel').on('click', function() {
+ $('#export-excel').on('click', function () {
console.log('Export button clicked');
exportToExcel();
});
- $('#btn-grafik').on('click', function() {
+ $('#btn-grafik').on('click', function () {
$("#pie-statistik").collapse('hide');
});
- $('#btn-pie').on('click', function() {
+ $('#btn-pie').on('click', function () {
$("#grafik-statistik").collapse('hide')
});
- $('#daftar-statistik').on('click', '.pilih-kategori > a', function() {
+ $('#daftar-statistik').on('click', '.pilih-kategori > a', function () {
var id = $(this).data('id')
$('.pilih-kategori > a').removeClass('active')
@@ -331,7 +331,10 @@ function exportToExcel() {
processing: true,
serverSide: true,
autoWidth: false,
- ordering: false,
+ ordering: true,
+ order: [
+ [2, 'desc']
+ ],
searching: false,
deferLoading: 0,
paging: false,
@@ -340,15 +343,18 @@ function exportToExcel() {
url: urlStatistik.href,
headers: header,
method: 'get',
- data: function(row) {
+ data: function (row) {
return {
-
+ "sort": (row.order[0]?.dir === "asc" ? "" : "-") + row.columns[row
+ .order[0]
+ ?.column]
+ ?.name
};
},
- dataSrc: function(json) {
+ dataSrc: function (json) {
if (json.data && json.data.length > 0) {
data_grafik = [];
- json.data.forEach(function(item, index) {
+ json.data.forEach(function (item, index) {
data_grafik.push({
nama: item.attributes.nilai,
jumlah: item.attributes.jumlah
@@ -364,21 +370,22 @@ function exportToExcel() {
},
},
columnDefs: [{
- targets: '_all',
- className: 'text-nowrap',
- },
- {
- targets: [2],
- className: 'dt-body-right',
- },
+ targets: '_all',
+ className: 'text-nowrap',
+ },
+ {
+ targets: [2],
+ className: 'dt-body-right',
+ },
],
columns: [{
data: null,
- render: function(data, type, row, meta) {
+ orderable: false,
+ render: function (data, type, row, meta) {
return meta.row + 1;
}
}, {
- data: function(data) {
+ data: function (data) {
const nilai = data.attributes?.nilai || data.id || '';
if (nilai !== 'JUMLAH' && nilai !== 'BELUM MENGISI' && nilai !==
@@ -397,8 +404,9 @@ className: 'dt-body-right',
return nilai;
},
+ orderable: false,
}, {
- data: function(data) {
+ data: function (data) {
const nilai = data.attributes?.nilai || data.id || '';
const jumlah = data.attributes?.jumlah || 0;
@@ -413,26 +421,28 @@ className: 'dt-body-right',
return jumlah;
},
+ orderable: true,
+ name: 'jumlah',
}]
});
- statistik.on('draw.dt', function() {
+ statistik.on('draw.dt', function () {
var dataTable = $('#tabel-data').DataTable();
var pageInfo = dataTable.page.info();
var recordsTotal = dataTable.data().count();
statistik.column(0, {
page: 'current'
- }).nodes().each(function(cell, i) {
+ }).nodes().each(function (cell, i) {
cell.innerHTML = i + 1 + pageInfo.start;
});
});
- $('#filter').on('click', function(e) {
+ $('#filter').on('click', function (e) {
statistik.draw();
});
- $(document).on('click', '#reset', function(e) {
+ $(document).on('click', '#reset', function (e) {
e.preventDefault();
statistik.ajax.reload();
});
@@ -464,4 +474,4 @@ className: 'dt-body-right',
color: blue;
}
-@endpush
+@endpush
\ No newline at end of file
diff --git a/resources/views/presisi/statistik/pangan.blade.php b/resources/views/presisi/statistik/pangan.blade.php
index db8c577e..ebdb970d 100644
--- a/resources/views/presisi/statistik/pangan.blade.php
+++ b/resources/views/presisi/statistik/pangan.blade.php
@@ -5,7 +5,7 @@
@section('title', 'Data Statistik')
@section('content_header')
-
Data Statistik {{ $judul }}
+
Data Statistik {{ $judul }}
@stop
@section('content')
@@ -35,8 +35,8 @@
@@ -107,7 +107,7 @@
let nama_desa = `{{ session('desa.nama_desa') }}`;
let kategori = `{{ strtolower($judul) }}`;
let default_id = null;
- document.addEventListener("DOMContentLoaded", function(event) {
+ document.addEventListener("DOMContentLoaded", function (event) {
const header = @include('layouts.components.header_bearer_api_gabungan');
@@ -119,21 +119,21 @@
url: urlKategoriStatistik.href,
headers: header,
method: 'get',
- success: function(response) {
+ success: function (response) {
var daftarKategoriStatistik = response.data[0]['attributes']
var html = ''
- Object.keys(daftarKategoriStatistik).forEach(function(index) {
+ Object.keys(daftarKategoriStatistik).forEach(function (index) {
var id = index;
var nama = daftarKategoriStatistik[index];
html += `
-
-
- ${nama}
-
-
- `
+
+
+ ${nama}
+
+
+ `
});
$('#daftar-statistik').html(html)
@@ -141,7 +141,7 @@
}
});
- $('#daftar-statistik').on('mouseenter', '.pilih-kategori > a', function() {
+ $('#daftar-statistik').on('mouseenter', '.pilih-kategori > a', function () {
$(this).css('cursor', 'pointer')
});
@@ -149,8 +149,8 @@
function createExportCaption(categoryName, options = {}) {
const {
includeDate = true,
- includeLocation = true,
- customTitle = null,
+ includeLocation = true,
+ customTitle = null,
} = options;
var caption = {
@@ -293,20 +293,20 @@ function exportToExcel() {
return result;
}
- $('#export-excel').on('click', function() {
+ $('#export-excel').on('click', function () {
console.log('Export button clicked');
exportToExcel();
});
- $('#btn-grafik').on('click', function() {
+ $('#btn-grafik').on('click', function () {
$("#pie-statistik").collapse('hide');
});
- $('#btn-pie').on('click', function() {
+ $('#btn-pie').on('click', function () {
$("#grafik-statistik").collapse('hide')
});
- $('#daftar-statistik').on('click', '.pilih-kategori > a', function() {
+ $('#daftar-statistik').on('click', '.pilih-kategori > a', function () {
var id = $(this).data('id')
$('.pilih-kategori > a').removeClass('active')
@@ -331,7 +331,10 @@ function exportToExcel() {
processing: true,
serverSide: true,
autoWidth: false,
- ordering: false,
+ ordering: true,
+ order: [
+ [2, 'desc']
+ ],
searching: false,
deferLoading: 0,
paging: false,
@@ -340,15 +343,18 @@ function exportToExcel() {
url: urlStatistik.href,
headers: header,
method: 'get',
- data: function(row) {
+ data: function (row) {
return {
-
+ "sort": (row.order[0]?.dir === "asc" ? "" : "-") + row.columns[row
+ .order[0]
+ ?.column]
+ ?.name
};
},
- dataSrc: function(json) {
+ dataSrc: function (json) {
if (json.data && json.data.length > 0) {
data_grafik = [];
- json.data.forEach(function(item, index) {
+ json.data.forEach(function (item, index) {
data_grafik.push({
nama: item.attributes.nilai,
jumlah: item.attributes.jumlah
@@ -364,21 +370,22 @@ function exportToExcel() {
},
},
columnDefs: [{
- targets: '_all',
- className: 'text-nowrap',
- },
- {
- targets: [2],
- className: 'dt-body-right',
- },
+ targets: '_all',
+ className: 'text-nowrap',
+ },
+ {
+ targets: [2],
+ className: 'dt-body-right',
+ },
],
columns: [{
data: null,
- render: function(data, type, row, meta) {
+ orderable: false,
+ render: function (data, type, row, meta) {
return meta.row + 1;
}
}, {
- data: function(data) {
+ data: function (data) {
const nilai = data.attributes?.nilai || data.id || '';
if (nilai !== 'JUMLAH' && nilai !== 'BELUM MENGISI' && nilai !==
@@ -397,8 +404,9 @@ className: 'dt-body-right',
return nilai;
},
+ orderable: false,
}, {
- data: function(data) {
+ data: function (data) {
const nilai = data.attributes?.nilai || data.id || '';
const jumlah = data.attributes?.jumlah || 0;
@@ -413,26 +421,28 @@ className: 'dt-body-right',
return jumlah;
},
+ orderable: true,
+ name: 'jumlah',
}]
});
- statistik.on('draw.dt', function() {
+ statistik.on('draw.dt', function () {
var dataTable = $('#tabel-data').DataTable();
var pageInfo = dataTable.page.info();
var recordsTotal = dataTable.data().count();
statistik.column(0, {
page: 'current'
- }).nodes().each(function(cell, i) {
+ }).nodes().each(function (cell, i) {
cell.innerHTML = i + 1 + pageInfo.start;
});
});
- $('#filter').on('click', function(e) {
+ $('#filter').on('click', function (e) {
statistik.draw();
});
- $(document).on('click', '#reset', function(e) {
+ $(document).on('click', '#reset', function (e) {
e.preventDefault();
statistik.ajax.reload();
});
@@ -464,4 +474,4 @@ className: 'dt-body-right',
color: blue;
}
-@endpush
+@endpush
\ No newline at end of file
diff --git a/resources/views/presisi/statistik/papan.blade.php b/resources/views/presisi/statistik/papan.blade.php
index d4a45cf9..afe4e1c6 100644
--- a/resources/views/presisi/statistik/papan.blade.php
+++ b/resources/views/presisi/statistik/papan.blade.php
@@ -5,7 +5,7 @@
@section('title', 'Data Statistik')
@section('content_header')
-
Data Statistik {{ $judul }}
+
Data Statistik {{ $judul }}
@stop
@section('content')
@@ -35,12 +35,12 @@
-
+
@@ -107,33 +107,33 @@
let nama_desa = `{{ session('desa.nama_desa') }}`;
let kategori = `{{ strtolower($judul) }}`;
let default_id = null;
- document.addEventListener("DOMContentLoaded", function(event) {
+ document.addEventListener("DOMContentLoaded", function (event) {
const header = @include('layouts.components.header_bearer_api_gabungan');
var baseUrl = {!! json_encode(config('app.databaseGabunganUrl')) !!} + "/api/v1";
- var urlKategoriStatistik = new URL(`${baseUrl}/data-presisi/papan/kategori-statistik`);
+ var urlKategoriStatistik = new URL(`${baseUrl}/data-presisi/papan/kategori-statistik`);
$.ajax({
url: urlKategoriStatistik.href,
headers: header,
method: 'get',
- success: function(response) {
+ success: function (response) {
var daftarKategoriStatistik = response.data[0]['attributes']
- var html = ''
-
- Object.keys(daftarKategoriStatistik).forEach(function(index) {
+ var html = ''
+
+ Object.keys(daftarKategoriStatistik).forEach(function (index) {
var id = index;
- var nama = daftarKategoriStatistik[index];
+ var nama = daftarKategoriStatistik[index];
html += `
-
-
- ${nama}
-
-
- `
+
+
+ ${nama}
+
+
+ `
});
$('#daftar-statistik').html(html)
@@ -141,16 +141,16 @@
}
});
- $('#daftar-statistik').on('mouseenter', '.pilih-kategori > a', function() {
+ $('#daftar-statistik').on('mouseenter', '.pilih-kategori > a', function () {
$(this).css('cursor', 'pointer')
- });
+ });
// Helper function to create Excel export caption
function createExportCaption(categoryName, options = {}) {
const {
includeDate = true,
- includeLocation = true,
- customTitle = null,
+ includeLocation = true,
+ customTitle = null,
} = options;
var caption = {
@@ -159,7 +159,7 @@ function createExportCaption(categoryName, options = {}) {
date: '',
location: ''
};
-
+
// Add export date
if (includeDate) {
@@ -194,10 +194,10 @@ function exportToExcel() {
var activeCategory = $('#daftar-statistik .active');
var categoryName = activeCategory.data('nama') || 'Statistik';
var tahun = $("#tahun").val();
- var bulan = $("#bulan").val();
+ var bulan = $("#bulan").val();
// Generate dynamic filename
- var filename = `Statistik_${categoryName}_${nama_desa}`;
+ var filename = `Statistik_${categoryName}_${nama_desa}`;
// Clean filename - remove special characters
filename = filename.replace(/[^a-zA-Z0-9_-]/g, '_');
@@ -293,35 +293,35 @@ function exportToExcel() {
return result;
}
- $('#export-excel').on('click', function() {
+ $('#export-excel').on('click', function () {
console.log('Export button clicked');
exportToExcel();
});
- $('#btn-grafik').on('click', function() {
+ $('#btn-grafik').on('click', function () {
$("#pie-statistik").collapse('hide');
});
- $('#btn-pie').on('click', function() {
+ $('#btn-pie').on('click', function () {
$("#grafik-statistik").collapse('hide')
});
- $('#daftar-statistik').on('click', '.pilih-kategori > a', function() {
- var id = $(this).data('id')
+ $('#daftar-statistik').on('click', '.pilih-kategori > a', function () {
+ var id = $(this).data('id')
$('.pilih-kategori > a').removeClass('active')
- $(this).addClass('active')
+ $(this).addClass('active')
$('#title-block').html($(this).text())
urlStatistik.searchParams.set('kategori', id);
statistik.ajax.url(urlStatistik.href, {
headers: header,
- }).load();
+ }).load();
});
const urlDetailLink = `{{ $detailLink }}?kategori=${kategori}`;
var urlStatistik = new URL(`${baseUrl}/data-presisi/papan/statistik`);
urlStatistik.searchParams.set('kategori', default_id);
- urlStatistik.searchParams.set("kode_kabupaten", "{{ session('kabupaten.kode_kabupaten') ?? '' }}");
+ urlStatistik.searchParams.set("kode_kabupaten", "{{ session('kabupaten.kode_kabupaten') ?? '' }}");
urlStatistik.searchParams.set("kode_kecamatan", "{{ session('kecamatan.kode_kecamatan') ?? '' }}");
const desaId = parseInt("{{ session('desa.id') ?? '0' }}", 10);
@@ -331,7 +331,10 @@ function exportToExcel() {
processing: true,
serverSide: true,
autoWidth: false,
- ordering: false,
+ ordering: true,
+ order: [
+ [2, 'desc']
+ ],
searching: false,
deferLoading: 0,
paging: false,
@@ -340,15 +343,18 @@ function exportToExcel() {
url: urlStatistik.href,
headers: header,
method: 'get',
- data: function(row) {
+ data: function (row) {
return {
-
+ "sort": (row.order[0]?.dir === "asc" ? "" : "-") + row.columns[row
+ .order[0]
+ ?.column]
+ ?.name
};
},
- dataSrc: function(json) {
+ dataSrc: function (json) {
if (json.data && json.data.length > 0) {
data_grafik = [];
- json.data.forEach(function(item, index) {
+ json.data.forEach(function (item, index) {
data_grafik.push({
nama: item.attributes.nilai,
jumlah: item.attributes.jumlah
@@ -364,23 +370,24 @@ function exportToExcel() {
},
},
columnDefs: [{
- targets: '_all',
- className: 'text-nowrap',
- },
- {
- targets: [2],
- className: 'dt-body-right',
- },
+ targets: '_all',
+ className: 'text-nowrap',
+ },
+ {
+ targets: [2],
+ className: 'dt-body-right',
+ },
],
columns: [{
data: null,
- render: function(data, type, row, meta) {
+ orderable: false,
+ render: function (data, type, row, meta) {
return meta.row + 1;
}
}, {
- data: function(data) {
+ data: function (data) {
const nilai = data.attributes?.nilai || data.id || '';
-
+
if (nilai !== 'JUMLAH' && nilai !== 'BELUM MENGISI' && nilai !== 'TOTAL') {
let judul = $('.pilih-kategori > a.active').text() + ' : ' + nilai;
let urlDetail = new URL(urlDetailLink);
@@ -395,11 +402,12 @@ className: 'dt-body-right',
return nilai;
},
+ orderable: false,
}, {
- data: function(data) {
+ data: function (data) {
const nilai = data.attributes?.nilai || data.id || '';
const jumlah = data.attributes?.jumlah || 0;
-
+
if (nilai !== 'JUMLAH' && nilai !== 'BELUM MENGISI' && nilai !== 'TOTAL') {
let judul = $('.pilih-kategori > a.active').text() + ' : ' + nilai;
let urlDetail = new URL(urlDetailLink);
@@ -407,32 +415,34 @@ className: 'dt-body-right',
urlDetail.searchParams.set('judul', judul);
return `
${jumlah}`
}
-
+
return jumlah;
},
+ orderable: true,
+ name: 'jumlah',
}]
});
- statistik.on('draw.dt', function() {
+ statistik.on('draw.dt', function () {
var dataTable = $('#tabel-data').DataTable();
var pageInfo = dataTable.page.info();
var recordsTotal = dataTable.data().count();
statistik.column(0, {
page: 'current'
- }).nodes().each(function(cell, i) {
+ }).nodes().each(function (cell, i) {
cell.innerHTML = i + 1 + pageInfo.start;
});
});
- $('#filter').on('click', function(e) {
+ $('#filter').on('click', function (e) {
statistik.draw();
});
- $(document).on('click', '#reset', function(e) {
- e.preventDefault();
+ $(document).on('click', '#reset', function (e) {
+ e.preventDefault();
statistik.ajax.reload();
- });
+ });
});
@endsection
@@ -461,4 +471,4 @@ className: 'dt-body-right',
color: blue;
}
-@endpush
+@endpush
\ No newline at end of file
diff --git a/resources/views/presisi/statistik/pendidikan.blade.php b/resources/views/presisi/statistik/pendidikan.blade.php
index 4f2140ad..9162f875 100644
--- a/resources/views/presisi/statistik/pendidikan.blade.php
+++ b/resources/views/presisi/statistik/pendidikan.blade.php
@@ -5,7 +5,7 @@
@section('title', 'Data Statistik')
@section('content_header')
-
Data Statistik {{ $judul }}
+
Data Statistik {{ $judul }}
@stop
@section('content')
@@ -35,8 +35,8 @@
@@ -107,7 +107,7 @@
let nama_desa = `{{ session('desa.nama_desa') }}`;
let kategori = `{{ strtolower($judul) }}`;
let default_id = null;
- document.addEventListener("DOMContentLoaded", function(event) {
+ document.addEventListener("DOMContentLoaded", function (event) {
const header = @include('layouts.components.header_bearer_api_gabungan');
@@ -119,21 +119,21 @@
url: urlKategoriStatistik.href,
headers: header,
method: 'get',
- success: function(response) {
+ success: function (response) {
var daftarKategoriStatistik = response.data[0]['attributes']
var html = ''
- Object.keys(daftarKategoriStatistik).forEach(function(index) {
+ Object.keys(daftarKategoriStatistik).forEach(function (index) {
var id = index;
var nama = daftarKategoriStatistik[index];
html += `
-
-
- ${nama}
-
-
- `
+
+
+ ${nama}
+
+
+ `
});
$('#daftar-statistik').html(html)
@@ -141,7 +141,7 @@
}
});
- $('#daftar-statistik').on('mouseenter', '.pilih-kategori > a', function() {
+ $('#daftar-statistik').on('mouseenter', '.pilih-kategori > a', function () {
$(this).css('cursor', 'pointer')
});
@@ -149,8 +149,8 @@
function createExportCaption(categoryName, options = {}) {
const {
includeDate = true,
- includeLocation = true,
- customTitle = null,
+ includeLocation = true,
+ customTitle = null,
} = options;
var caption = {
@@ -293,20 +293,20 @@ function exportToExcel() {
return result;
}
- $('#export-excel').on('click', function() {
+ $('#export-excel').on('click', function () {
console.log('Export button clicked');
exportToExcel();
});
- $('#btn-grafik').on('click', function() {
+ $('#btn-grafik').on('click', function () {
$("#pie-statistik").collapse('hide');
});
- $('#btn-pie').on('click', function() {
+ $('#btn-pie').on('click', function () {
$("#grafik-statistik").collapse('hide')
});
- $('#daftar-statistik').on('click', '.pilih-kategori > a', function() {
+ $('#daftar-statistik').on('click', '.pilih-kategori > a', function () {
var id = $(this).data('id')
$('.pilih-kategori > a').removeClass('active')
@@ -331,7 +331,10 @@ function exportToExcel() {
processing: true,
serverSide: true,
autoWidth: false,
- ordering: false,
+ ordering: true,
+ order: [
+ [2, 'desc']
+ ],
searching: false,
deferLoading: 0,
paging: false,
@@ -340,15 +343,18 @@ function exportToExcel() {
url: urlStatistik.href,
headers: header,
method: 'get',
- data: function(row) {
+ data: function (row) {
return {
-
+ "sort": (row.order[0]?.dir === "asc" ? "" : "-") + row.columns[row
+ .order[0]
+ ?.column]
+ ?.name
};
},
- dataSrc: function(json) {
+ dataSrc: function (json) {
if (json.data && json.data.length > 0) {
data_grafik = [];
- json.data.forEach(function(item, index) {
+ json.data.forEach(function (item, index) {
data_grafik.push({
nama: item.attributes.nilai,
jumlah: item.attributes.jumlah
@@ -364,21 +370,22 @@ function exportToExcel() {
},
},
columnDefs: [{
- targets: '_all',
- className: 'text-nowrap',
- },
- {
- targets: [2],
- className: 'dt-body-right',
- },
+ targets: '_all',
+ className: 'text-nowrap',
+ },
+ {
+ targets: [2],
+ className: 'dt-body-right',
+ },
],
columns: [{
data: null,
- render: function(data, type, row, meta) {
+ orderable: false,
+ render: function (data, type, row, meta) {
return meta.row + 1;
}
}, {
- data: function(data) {
+ data: function (data) {
const nilai = data.attributes?.nilai || data.id || '';
if (nilai !== 'JUMLAH' && nilai !== 'BELUM MENGISI' && nilai !==
@@ -397,8 +404,9 @@ className: 'dt-body-right',
return nilai;
},
+ orderable: false,
}, {
- data: function(data) {
+ data: function (data) {
const nilai = data.attributes?.nilai || data.id || '';
const jumlah = data.attributes?.jumlah || 0;
@@ -413,26 +421,28 @@ className: 'dt-body-right',
return jumlah;
},
+ orderable: true,
+ name: 'jumlah',
}]
});
- statistik.on('draw.dt', function() {
+ statistik.on('draw.dt', function () {
var dataTable = $('#tabel-data').DataTable();
var pageInfo = dataTable.page.info();
var recordsTotal = dataTable.data().count();
statistik.column(0, {
page: 'current'
- }).nodes().each(function(cell, i) {
+ }).nodes().each(function (cell, i) {
cell.innerHTML = i + 1 + pageInfo.start;
});
});
- $('#filter').on('click', function(e) {
+ $('#filter').on('click', function (e) {
statistik.draw();
});
- $(document).on('click', '#reset', function(e) {
+ $(document).on('click', '#reset', function (e) {
e.preventDefault();
statistik.ajax.reload();
});
@@ -464,4 +474,4 @@ className: 'dt-body-right',
color: blue;
}
-@endpush
+@endpush
\ No newline at end of file
diff --git a/resources/views/presisi/statistik/sandang.blade.php b/resources/views/presisi/statistik/sandang.blade.php
index 18dc0612..354f6350 100644
--- a/resources/views/presisi/statistik/sandang.blade.php
+++ b/resources/views/presisi/statistik/sandang.blade.php
@@ -5,7 +5,7 @@
@section('title', 'Data Statistik')
@section('content_header')
-
Data Statistik {{ $judul }}
+
Data Statistik {{ $judul }}
@stop
@section('content')
@@ -35,12 +35,12 @@
-
+
@@ -107,33 +107,33 @@
let nama_desa = `{{ session('desa.nama_desa') }}`;
let kategori = `{{ strtolower($judul) }}`;
let default_id = null;
- document.addEventListener("DOMContentLoaded", function(event) {
+ document.addEventListener("DOMContentLoaded", function (event) {
const header = @include('layouts.components.header_bearer_api_gabungan');
var baseUrl = {!! json_encode(config('app.databaseGabunganUrl')) !!} + "/api/v1";
- var urlKategoriStatistik = new URL(`${baseUrl}/data-presisi/sandang/kategori-statistik`);
+ var urlKategoriStatistik = new URL(`${baseUrl}/data-presisi/sandang/kategori-statistik`);
$.ajax({
url: urlKategoriStatistik.href,
headers: header,
method: 'get',
- success: function(response) {
+ success: function (response) {
var daftarKategoriStatistik = response.data[0]['attributes']
- var html = ''
-
- Object.keys(daftarKategoriStatistik).forEach(function(index) {
+ var html = ''
+
+ Object.keys(daftarKategoriStatistik).forEach(function (index) {
var id = index;
- var nama = daftarKategoriStatistik[index];
+ var nama = daftarKategoriStatistik[index];
html += `
-
-
- ${nama}
-
-
- `
+
+
+ ${nama}
+
+
+ `
});
$('#daftar-statistik').html(html)
@@ -141,16 +141,16 @@
}
});
- $('#daftar-statistik').on('mouseenter', '.pilih-kategori > a', function() {
+ $('#daftar-statistik').on('mouseenter', '.pilih-kategori > a', function () {
$(this).css('cursor', 'pointer')
- });
+ });
// Helper function to create Excel export caption
function createExportCaption(categoryName, options = {}) {
const {
includeDate = true,
- includeLocation = true,
- customTitle = null,
+ includeLocation = true,
+ customTitle = null,
} = options;
var caption = {
@@ -159,7 +159,7 @@ function createExportCaption(categoryName, options = {}) {
date: '',
location: ''
};
-
+
// Add export date
if (includeDate) {
@@ -194,10 +194,10 @@ function exportToExcel() {
var activeCategory = $('#daftar-statistik .active');
var categoryName = activeCategory.data('nama') || 'Statistik';
var tahun = $("#tahun").val();
- var bulan = $("#bulan").val();
+ var bulan = $("#bulan").val();
// Generate dynamic filename
- var filename = `Statistik_${categoryName}_${nama_desa}`;
+ var filename = `Statistik_${categoryName}_${nama_desa}`;
// Clean filename - remove special characters
filename = filename.replace(/[^a-zA-Z0-9_-]/g, '_');
@@ -293,35 +293,35 @@ function exportToExcel() {
return result;
}
- $('#export-excel').on('click', function() {
+ $('#export-excel').on('click', function () {
console.log('Export button clicked');
exportToExcel();
});
- $('#btn-grafik').on('click', function() {
+ $('#btn-grafik').on('click', function () {
$("#pie-statistik").collapse('hide');
});
- $('#btn-pie').on('click', function() {
+ $('#btn-pie').on('click', function () {
$("#grafik-statistik").collapse('hide')
});
- $('#daftar-statistik').on('click', '.pilih-kategori > a', function() {
- var id = $(this).data('id')
+ $('#daftar-statistik').on('click', '.pilih-kategori > a', function () {
+ var id = $(this).data('id')
$('.pilih-kategori > a').removeClass('active')
- $(this).addClass('active')
+ $(this).addClass('active')
$('#title-block').html($(this).text())
urlStatistik.searchParams.set('kategori', id);
statistik.ajax.url(urlStatistik.href, {
headers: header,
- }).load();
+ }).load();
});
const urlDetailLink = `{{ $detailLink }}?kategori=${kategori}`;
var urlStatistik = new URL(`${baseUrl}/data-presisi/sandang/statistik`);
urlStatistik.searchParams.set('kategori', default_id);
- urlStatistik.searchParams.set("kode_kabupaten", "{{ session('kabupaten.kode_kabupaten') ?? '' }}");
+ urlStatistik.searchParams.set("kode_kabupaten", "{{ session('kabupaten.kode_kabupaten') ?? '' }}");
urlStatistik.searchParams.set("kode_kecamatan", "{{ session('kecamatan.kode_kecamatan') ?? '' }}");
const desaId = parseInt("{{ session('desa.id') ?? '0' }}", 10);
@@ -331,7 +331,10 @@ function exportToExcel() {
processing: true,
serverSide: true,
autoWidth: false,
- ordering: false,
+ ordering: true,
+ order: [
+ [2, 'desc']
+ ],
searching: false,
deferLoading: 0,
paging: false,
@@ -340,15 +343,18 @@ function exportToExcel() {
url: urlStatistik.href,
headers: header,
method: 'get',
- data: function(row) {
+ data: function (row) {
return {
-
+ "sort": (row.order[0]?.dir === "asc" ? "" : "-") + row.columns[row
+ .order[0]
+ ?.column]
+ ?.name
};
},
- dataSrc: function(json) {
+ dataSrc: function (json) {
if (json.data && json.data.length > 0) {
data_grafik = [];
- json.data.forEach(function(item, index) {
+ json.data.forEach(function (item, index) {
data_grafik.push({
nama: item.attributes.nilai,
jumlah: item.attributes.jumlah
@@ -364,23 +370,24 @@ function exportToExcel() {
},
},
columnDefs: [{
- targets: '_all',
- className: 'text-nowrap',
- },
- {
- targets: [2],
- className: 'dt-body-right',
- },
+ targets: '_all',
+ className: 'text-nowrap',
+ },
+ {
+ targets: [2],
+ className: 'dt-body-right',
+ },
],
columns: [{
data: null,
- render: function(data, type, row, meta) {
+ orderable: false,
+ render: function (data, type, row, meta) {
return meta.row + 1;
}
}, {
- data: function(data) {
+ data: function (data) {
const nilai = data.attributes?.nilai || data.id || '';
-
+
if (nilai !== 'JUMLAH' && nilai !== 'BELUM MENGISI' && nilai !== 'TOTAL') {
let judul = $('.pilih-kategori > a.active').text() + ' : ' + nilai;
let urlDetail = new URL(urlDetailLink);
@@ -395,11 +402,12 @@ className: 'dt-body-right',
return nilai;
},
+ orderable: false,
}, {
- data: function(data) {
+ data: function (data) {
const nilai = data.attributes?.nilai || data.id || '';
const jumlah = data.attributes?.jumlah || 0;
-
+
if (nilai !== 'JUMLAH' && nilai !== 'BELUM MENGISI' && nilai !== 'TOTAL') {
let judul = $('.pilih-kategori > a.active').text() + ' : ' + nilai;
let urlDetail = new URL(urlDetailLink);
@@ -407,32 +415,34 @@ className: 'dt-body-right',
urlDetail.searchParams.set('judul', judul);
return `
${jumlah}`
}
-
+
return jumlah;
},
+ orderable: true,
+ name: 'jumlah',
}]
});
- statistik.on('draw.dt', function() {
+ statistik.on('draw.dt', function () {
var dataTable = $('#tabel-data').DataTable();
var pageInfo = dataTable.page.info();
var recordsTotal = dataTable.data().count();
statistik.column(0, {
page: 'current'
- }).nodes().each(function(cell, i) {
+ }).nodes().each(function (cell, i) {
cell.innerHTML = i + 1 + pageInfo.start;
});
});
- $('#filter').on('click', function(e) {
+ $('#filter').on('click', function (e) {
statistik.draw();
});
- $(document).on('click', '#reset', function(e) {
- e.preventDefault();
+ $(document).on('click', '#reset', function (e) {
+ e.preventDefault();
statistik.ajax.reload();
- });
+ });
});
@endsection
@@ -461,4 +471,4 @@ className: 'dt-body-right',
color: blue;
}
-@endpush
+@endpush
\ No newline at end of file
diff --git a/resources/views/presisi/statistik/senibudaya.blade.php b/resources/views/presisi/statistik/senibudaya.blade.php
index 50e0e0f5..8e102556 100644
--- a/resources/views/presisi/statistik/senibudaya.blade.php
+++ b/resources/views/presisi/statistik/senibudaya.blade.php
@@ -5,7 +5,7 @@
@section('title', 'Data Statistik')
@section('content_header')
-
Data Statistik Seni Budaya
+
Data Statistik Seni Budaya
@stop
@section('content')
@@ -35,12 +35,12 @@
-
+
@@ -107,33 +107,33 @@
let nama_desa = `{{ session('desa.nama_desa') }}`;
let kategori = `{{ strtolower($judul) }}`;
let default_id = null;
- document.addEventListener("DOMContentLoaded", function(event) {
+ document.addEventListener("DOMContentLoaded", function (event) {
const header = @include('layouts.components.header_bearer_api_gabungan');
var baseUrl = {!! json_encode(config('app.databaseGabunganUrl')) !!} + "/api/v1";
- var urlKategoriStatistik = new URL(`${baseUrl}/data-presisi/seni-budaya/kategori-statistik`);
+ var urlKategoriStatistik = new URL(`${baseUrl}/data-presisi/seni-budaya/kategori-statistik`);
$.ajax({
url: urlKategoriStatistik.href,
headers: header,
method: 'get',
- success: function(response) {
+ success: function (response) {
var daftarKategoriStatistik = response.data[0]['attributes']
- var html = ''
-
- Object.keys(daftarKategoriStatistik).forEach(function(index) {
+ var html = ''
+
+ Object.keys(daftarKategoriStatistik).forEach(function (index) {
var id = index;
- var nama = daftarKategoriStatistik[index];
+ var nama = daftarKategoriStatistik[index];
html += `
-
-
- ${nama}
-
-
- `
+
+
+ ${nama}
+
+
+ `
});
$('#daftar-statistik').html(html)
@@ -141,16 +141,16 @@
}
});
- $('#daftar-statistik').on('mouseenter', '.pilih-kategori > a', function() {
+ $('#daftar-statistik').on('mouseenter', '.pilih-kategori > a', function () {
$(this).css('cursor', 'pointer')
- });
+ });
// Helper function to create Excel export caption
function createExportCaption(categoryName, options = {}) {
const {
includeDate = true,
- includeLocation = true,
- customTitle = null,
+ includeLocation = true,
+ customTitle = null,
} = options;
var caption = {
@@ -159,7 +159,7 @@ function createExportCaption(categoryName, options = {}) {
date: '',
location: ''
};
-
+
// Add export date
if (includeDate) {
@@ -194,10 +194,10 @@ function exportToExcel() {
var activeCategory = $('#daftar-statistik .active');
var categoryName = activeCategory.data('nama') || 'Statistik';
var tahun = $("#tahun").val();
- var bulan = $("#bulan").val();
+ var bulan = $("#bulan").val();
// Generate dynamic filename
- var filename = `Statistik_${categoryName}_${nama_desa}`;
+ var filename = `Statistik_${categoryName}_${nama_desa}`;
// Clean filename - remove special characters
filename = filename.replace(/[^a-zA-Z0-9_-]/g, '_');
@@ -293,35 +293,35 @@ function exportToExcel() {
return result;
}
- $('#export-excel').on('click', function() {
+ $('#export-excel').on('click', function () {
console.log('Export button clicked');
exportToExcel();
});
- $('#btn-grafik').on('click', function() {
+ $('#btn-grafik').on('click', function () {
$("#pie-statistik").collapse('hide');
});
- $('#btn-pie').on('click', function() {
+ $('#btn-pie').on('click', function () {
$("#grafik-statistik").collapse('hide')
});
- $('#daftar-statistik').on('click', '.pilih-kategori > a', function() {
- var id = $(this).data('id')
+ $('#daftar-statistik').on('click', '.pilih-kategori > a', function () {
+ var id = $(this).data('id')
$('.pilih-kategori > a').removeClass('active')
- $(this).addClass('active')
+ $(this).addClass('active')
$('#title-block').html($(this).text())
urlStatistik.searchParams.set('kategori', id);
statistik.ajax.url(urlStatistik.href, {
headers: header,
- }).load();
+ }).load();
});
const urlDetailLink = `{{ $detailLink }}?kategori=${kategori}`;
var urlStatistik = new URL(`${baseUrl}/data-presisi/seni-budaya/statistik`);
urlStatistik.searchParams.set('kategori', default_id);
- urlStatistik.searchParams.set("kode_kabupaten", "{{ session('kabupaten.kode_kabupaten') ?? '' }}");
+ urlStatistik.searchParams.set("kode_kabupaten", "{{ session('kabupaten.kode_kabupaten') ?? '' }}");
urlStatistik.searchParams.set("kode_kecamatan", "{{ session('kecamatan.kode_kecamatan') ?? '' }}");
const desaId = parseInt("{{ session('desa.id') ?? '0' }}", 10);
@@ -331,7 +331,10 @@ function exportToExcel() {
processing: true,
serverSide: true,
autoWidth: false,
- ordering: false,
+ ordering: true,
+ order: [
+ [2, 'desc']
+ ],
searching: false,
deferLoading: 0,
paging: false,
@@ -340,15 +343,18 @@ function exportToExcel() {
url: urlStatistik.href,
headers: header,
method: 'get',
- data: function(row) {
+ data: function (row) {
return {
-
+ "sort": (row.order[0]?.dir === "asc" ? "" : "-") + row.columns[row
+ .order[0]
+ ?.column]
+ ?.name
};
},
- dataSrc: function(json) {
+ dataSrc: function (json) {
if (json.data && json.data.length > 0) {
data_grafik = [];
- json.data.forEach(function(item, index) {
+ json.data.forEach(function (item, index) {
data_grafik.push({
nama: item.attributes.nilai,
jumlah: item.attributes.jumlah
@@ -364,23 +370,24 @@ function exportToExcel() {
},
},
columnDefs: [{
- targets: '_all',
- className: 'text-nowrap',
- },
- {
- targets: [2],
- className: 'dt-body-right',
- },
+ targets: '_all',
+ className: 'text-nowrap',
+ },
+ {
+ targets: [2],
+ className: 'dt-body-right',
+ },
],
columns: [{
data: null,
- render: function(data, type, row, meta) {
+ orderable: false,
+ render: function (data, type, row, meta) {
return meta.row + 1;
}
}, {
- data: function(data) {
+ data: function (data) {
const nilai = data.attributes?.nilai || data.id || '';
-
+
if (nilai !== 'JUMLAH' && nilai !== 'BELUM MENGISI' && nilai !== 'TOTAL') {
let judul = $('.pilih-kategori > a.active').text() + ' : ' + nilai;
let urlDetail = new URL(urlDetailLink);
@@ -395,11 +402,12 @@ className: 'dt-body-right',
return nilai;
},
+ orderable: false,
}, {
- data: function(data) {
+ data: function (data) {
const nilai = data.attributes?.nilai || data.id || '';
const jumlah = data.attributes?.jumlah || 0;
-
+
if (nilai !== 'JUMLAH' && nilai !== 'BELUM MENGISI' && nilai !== 'TOTAL') {
let judul = $('.pilih-kategori > a.active').text() + ' : ' + nilai;
let urlDetail = new URL(urlDetailLink);
@@ -407,32 +415,34 @@ className: 'dt-body-right',
urlDetail.searchParams.set('judul', judul);
return `
${jumlah}`
}
-
+
return jumlah;
},
+ orderable: true,
+ name: 'jumlah',
}]
});
- statistik.on('draw.dt', function() {
+ statistik.on('draw.dt', function () {
var dataTable = $('#tabel-data').DataTable();
var pageInfo = dataTable.page.info();
var recordsTotal = dataTable.data().count();
statistik.column(0, {
page: 'current'
- }).nodes().each(function(cell, i) {
+ }).nodes().each(function (cell, i) {
cell.innerHTML = i + 1 + pageInfo.start;
});
});
- $('#filter').on('click', function(e) {
+ $('#filter').on('click', function (e) {
statistik.draw();
});
- $(document).on('click', '#reset', function(e) {
- e.preventDefault();
+ $(document).on('click', '#reset', function (e) {
+ e.preventDefault();
statistik.ajax.reload();
- });
+ });
});
@endsection
@@ -461,4 +471,4 @@ className: 'dt-body-right',
color: blue;
}
-@endpush
+@endpush
\ No newline at end of file
diff --git a/resources/views/statistik/index.blade.php b/resources/views/statistik/index.blade.php
index 6156e0ac..b0f36593 100644
--- a/resources/views/statistik/index.blade.php
+++ b/resources/views/statistik/index.blade.php
@@ -464,7 +464,10 @@ function exportToExcel() {
processing: true,
serverSide: true,
autoWidth: false,
- ordering: false,
+ ordering: true,
+ order: [
+ [2, 'desc']
+ ],
searching: false,
paging: false,
info: false,
@@ -476,6 +479,10 @@ function exportToExcel() {
return {
"filter[bulan]": $("#bulan").val(),
"filter[tahun]": $("#tahun").val(),
+ "sort": (row.order[0]?.dir === "asc" ? "" : "-") + row.columns[row
+ .order[0]
+ ?.column]
+ ?.name
};
},
dataSrc: function(json) {
@@ -504,6 +511,7 @@ className: 'dt-body-right',
],
columns: [{
data: null,
+ orderable: false,
}, {
data: function(data) {
@@ -531,6 +539,7 @@ className: 'dt-body-right',
return data.attributes.nama;
},
+ orderable: false,
}, {
data: function(data) {
let kriteria = new URLSearchParams(JSON.parse(data.attributes
@@ -542,10 +551,13 @@ className: 'dt-body-right',
urlDetail.searchParams.set('judul', judul);
return `
${data.attributes.jumlah}`
},
+ orderable: true,
+ name: 'jumlah',
}, {
data: function(data) {
return data.attributes.persentase_jumlah;
},
+ orderable: false,
}, {
data: function(data) {
let kriteria = new URLSearchParams(JSON.parse(data.attributes
@@ -559,10 +571,12 @@ className: 'dt-body-right',
urlDetail.searchParams.set('judul', judul);
return `
${data.attributes.laki_laki}`
},
+ orderable: false,
}, {
data: function(data) {
return data.attributes.persentase_laki_laki;
},
+ orderable: false,
}, {
data: function(data) {
let kriteria = new URLSearchParams(JSON.parse(data.attributes
@@ -576,10 +590,12 @@ className: 'dt-body-right',
urlDetail.searchParams.set('judul', judul);
return `
${data.attributes.perempuan}`
},
+ orderable: false,
}, {
data: function(data) {
return data.attributes.persentase_perempuan;
},
+ orderable: false,
}]
});