first commit

This commit is contained in:
kicap 2024-04-05 01:16:29 +08:00
parent 09c19f74d0
commit 001676348e
11 changed files with 159 additions and 140 deletions

6
.env
View File

@ -1,2 +1,4 @@
url = 'http://192.168.20.131:3000/'
api_url = 'http://192.168.20.131:3000/'
url = 'http://192.168.20.45:3000/'
api_url = 'http://192.168.20.45:3000/'
# url = 'http://rfid-server1.kicap-karan.com/'
# api_url = 'http://rfid-server1.kicap-karan.com/'

11
.gitignore vendored
View File

@ -11,10 +11,7 @@
migrate_working_dir/
.dart_tool
.idea
/linux/
/macos/
/web/
/windows/
# IntelliJ related
*.iml
@ -48,3 +45,9 @@ app.*.map.json
/android/app/debug
/android/app/profile
/android/app/release
#others os
linux*
macos*
web*
windows*

View File

@ -1,4 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:label="rfid_app"
android:name="${applicationName}"

View File

@ -29,13 +29,14 @@ class LoginScreenViewModel extends CustomBaseViewModel {
navigationService.navigateTo(Routes.retributorIndexView);
return;
}
easyLoading.customLoading('Login...');
try {
var formData =
FormData.fromMap({'username': username, 'password': password});
var response = await httpService.postWithFormData('login', formData);
MyResponseModel myResponseModel = MyResponseModel.fromJson(response.data);
// log.i(myResponseModel.status);
// log.i(myResponseModel);
if (myResponseModel.status == true) {
// mySharedPrefs.clear();
// log.i('pindah');
@ -56,6 +57,8 @@ class LoginScreenViewModel extends CustomBaseViewModel {
} catch (e) {
log.e(e);
// snackbarService.showSnackbar(message: 'Error: $e');
} finally {
easyLoading.dismiss();
}
}
}

View File

@ -43,54 +43,58 @@ class PenyewaLogView extends StatelessWidget {
),
child: model.logHistorySewaanList == null
? const Center(child: CircularProgressIndicator())
: ListView.builder(
padding: const EdgeInsets.symmetric(
horizontal: 15, vertical: 10),
itemCount: model.logHistorySewaanList!.length,
itemBuilder: (context, index) {
// model.log
// .i(model.logHistorySewaanList![index].date);
return GestureDetector(
onTap: () {
// model.log.i('clicked on index $index');
model.checkKet(
model.logHistorySewaanList![index],
: model.logHistorySewaanList!.isEmpty
? const Center(child: Text('Belum ada log'))
: ListView.builder(
padding: const EdgeInsets.symmetric(
horizontal: 15, vertical: 10),
itemCount: model.logHistorySewaanList!.length,
itemBuilder: (context, index) {
// model.log
// .i(model.logHistorySewaanList![index].date);
return GestureDetector(
onTap: () {
// model.log.i('clicked on index $index');
model.checkKet(
model.logHistorySewaanList![index],
);
},
child: Card(
child: ListTile(
title: Text(
model.logHistorySewaanList![index]
.jenis!,
style: boldTextStyle.copyWith(
fontSize: 15),
),
subtitle: const Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
// Text(
// 'Tempat : ${model.logHistorySewaanList![index].}',
// style: regularTextStyle,
// ),
// Text(
// model.logHistorySewaanList![index]
// .jenis!,
// style: italicTextStyle,
// ),
],
),
// dummy date and time
trailing: Text(
model.otherFunction.formatDateString(
model.logHistorySewaanList![index]
.date!),
style: regularTextStyle,
),
),
),
);
},
child: Card(
child: ListTile(
title: Text(
model.logHistorySewaanList![index].jenis!,
style:
boldTextStyle.copyWith(fontSize: 15),
),
subtitle: const Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
// Text(
// 'Tempat : ${model.logHistorySewaanList![index].}',
// style: regularTextStyle,
// ),
// Text(
// model.logHistorySewaanList![index]
// .jenis!,
// style: italicTextStyle,
// ),
],
),
// dummy date and time
trailing: Text(
model.otherFunction.formatDateString(model
.logHistorySewaanList![index].date!),
style: regularTextStyle,
),
),
),
);
},
),
),
),
)
],

View File

@ -33,36 +33,38 @@ class PulsaDetailView extends StatelessWidget {
),
borderRadius: BorderRadius.circular(10),
),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
_RowChildren(
title: 'NIK',
value: model.detailPenyewaModel!.nik ?? '...',
),
const SizedBox(height: 5),
_RowChildren(
title: 'Nama',
value: model.detailPenyewaModel!.nama ?? '...',
),
const SizedBox(height: 5),
_RowChildren(
title: 'Pulsa',
value:
'Rp. ${model.otherFunction.commaFormat(model.detailPenyewaModel!.saldo ?? 0)}',
),
const SizedBox(height: 5),
_RowChildren(
title: 'Card ID',
value: model.detailPenyewaModel!.rfid ?? '...',
),
],
),
child: model.detailPenyewaModel == null
? const Center(child: CircularProgressIndicator())
: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
_RowChildren(
title: 'NIK',
value: model.detailPenyewaModel!.nik ?? '...',
),
const SizedBox(height: 5),
_RowChildren(
title: 'Nama',
value: model.detailPenyewaModel!.nama ?? '...',
),
const SizedBox(height: 5),
_RowChildren(
title: 'Pulsa',
value:
'Rp. ${model.otherFunction.commaFormat(model.detailPenyewaModel!.saldo ?? 0)}',
),
const SizedBox(height: 5),
_RowChildren(
title: 'Card ID',
value: model.detailPenyewaModel!.rfid ?? '...',
),
],
),
),
const SizedBox(height: 20),
MyButton(text: 'Ganti Password')
const MyButton(text: 'Ganti Password')
],
),
);

View File

@ -14,6 +14,7 @@ class LogHistorySewaanViewModel extends CustomBaseViewModel {
}
getData() async {
logHistorySewaanList = [];
try {
var response = await httpService.get('scan/log');
MyResponseModel myResponseModel = MyResponseModel.fromJson(response.data);

View File

@ -37,64 +37,66 @@ class EditPenyewaDialogView extends StatelessWidget {
borderRadius: BorderRadius.circular(10),
color: backgroundColor,
),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
const Text("NIK"),
MyTextFormField(
controller: model.nikController,
hintText: 'Masukkan NIK Penyewa',
keyboardType: TextInputType.number,
maxLength: 16,
validator: Validatorless.multiple(
[
Validatorless.required('NIK harus diisi'),
Validatorless.min(16, 'NIK harus 16 digit'),
Validatorless.max(16, 'NIK harus 16 digit'),
],
child: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
const Text("NIK"),
MyTextFormField(
controller: model.nikController,
hintText: 'Masukkan NIK Penyewa',
keyboardType: TextInputType.number,
maxLength: 16,
validator: Validatorless.multiple(
[
Validatorless.required('NIK harus diisi'),
Validatorless.min(16, 'NIK harus 16 digit'),
Validatorless.max(16, 'NIK harus 16 digit'),
],
),
),
),
const SizedBox(height: 20),
const Text("Nama"),
MyTextFormField(
controller: model.nameController,
hintText: 'Masukkan Nama Penyewa',
validator: Validatorless.required('Nama harus diisi'),
),
const SizedBox(height: 20),
MyButton(
text: 'Update Data',
onPressed: () {
if (request.data!.nik == model.nikController.text &&
request.data!.nama == model.nameController.text) {
model.snackbarService.showSnackbar(
message: 'Tidak ada perubahan',
);
return;
}
model.dialogService
.showDialog(
title: 'Konfirmasi',
description: 'Apakah anda yakin ingin mengupdate data?',
cancelTitle: 'Batal',
buttonTitle: 'Update',
// confirmationTitle: 'Update',
)
.then((value) async {
if (value!.confirmed) {
bool res = await model.updateData(request.data!.nik);
// model.log.i("ini res: $res");
if (res) {
completer(DialogResponse(confirmed: true));
}
const SizedBox(height: 20),
const Text("Nama"),
MyTextFormField(
controller: model.nameController,
hintText: 'Masukkan Nama Penyewa',
validator: Validatorless.required('Nama harus diisi'),
),
const SizedBox(height: 20),
MyButton(
text: 'Update Data',
onPressed: () {
if (request.data!.nik == model.nikController.text &&
request.data!.nama == model.nameController.text) {
model.snackbarService.showSnackbar(
message: 'Tidak ada perubahan',
);
return;
}
});
},
),
],
model.dialogService
.showDialog(
title: 'Konfirmasi',
description: 'Apakah anda yakin ingin mengupdate data?',
cancelTitle: 'Batal',
buttonTitle: 'Update',
// confirmationTitle: 'Update',
)
.then((value) async {
if (value!.confirmed) {
bool res = await model.updateData(request.data!.nik);
// model.log.i("ini res: $res");
if (res) {
completer(DialogResponse(confirmed: true));
}
}
});
},
),
],
),
),
),
);

View File

@ -59,6 +59,7 @@ class RetributorIndexViewModel extends IndexTrackingViewModel {
}
socketIoClient.on('scan', (data) async {
log.i('data : $data');
var res = await dialogService.showCustomDialog(
variant: DialogType.scanRfidDialogView,
title: 'Pembayaran Retribusi',

View File

@ -16,7 +16,7 @@ class ScanRfidDialogViewModel extends CustomBaseViewModel {
Future<void> init(data) async {
log.d('init');
log.d(data);
getData(data);
}

View File

@ -37,7 +37,7 @@ class SplashScreenView extends StatelessWidget {
),
const SizedBox(height: 10),
Text(
"Sistem Retribusi Pasar Enrekang",
"Sistem Retribusi Pasar Lakessi",
style: boldTextStyle.copyWith(
fontSize: 20,
),
@ -47,7 +47,7 @@ class SplashScreenView extends StatelessWidget {
),
),
const Text(
"Jln Panti Asuhan No. 3 Ujung Lare, Kec. Soreang, Kota Parepare, Sulawesi Selatan 91133",
"Pasar Lakessi, Kota Parepare, Sulawesi Selatan 91133",
textAlign: TextAlign.center,
style: regularTextStyle,
),