first commit

This commit is contained in:
kicap
2025-07-13 06:59:30 +08:00
commit 86d84de7e3
165 changed files with 7941 additions and 0 deletions

63
lib/model/ont_model.dart Normal file
View File

@ -0,0 +1,63 @@
import 'package:intl/intl.dart';
class OntModel {
int? id;
String? nama;
String? noInternet;
String? noHp;
String? alamat;
String? langganan;
String? download;
String? upload;
String? status;
DateTime? updated;
OntModel({
this.id,
this.nama,
this.noInternet,
this.noHp,
this.alamat,
this.langganan,
this.download,
this.upload,
this.status,
this.updated,
});
factory OntModel.fromJson(Map<String, dynamic> json) {
DateTime originalTime =
DateTime.parse(json['updated'].toString()).toUtc(); // Ensure UTC
DateTime utcPlus8 =
originalTime.add(const Duration(hours: 8)); // Convert to UTC+8
return OntModel(
id: json['id'] as int?,
nama: json['nama'] as String?,
noInternet: json['no_internet'] as String?,
noHp: json['no_hp'] as String?,
alamat: json['alamat'] as String?,
langganan: json['langganan'] as String?,
download: json['download'] as String?,
upload: json['upload'] as String?,
status: json['status'] as String?,
updated: utcPlus8,
);
}
String getFormattedDate() {
return DateFormat('yyyy-MM-dd HH:mm:ss').format(updated!);
}
Map<String, dynamic> toJson() => {
'id': id,
'nama': nama,
'no_internet': noInternet,
'no_hp': noHp,
'alamat': alamat,
'langganan': langganan,
'download': download,
'upload': upload,
'status': status,
'updated': updated?.toIso8601String(),
};
}