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/' url = 'http://192.168.20.45:3000/'
api_url = 'http://192.168.20.131: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/ migrate_working_dir/
.dart_tool .dart_tool
.idea .idea
/linux/
/macos/
/web/
/windows/
# IntelliJ related # IntelliJ related
*.iml *.iml
@ -48,3 +45,9 @@ app.*.map.json
/android/app/debug /android/app/debug
/android/app/profile /android/app/profile
/android/app/release /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"> <manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET"/>
<application <application
android:label="rfid_app" android:label="rfid_app"
android:name="${applicationName}" android:name="${applicationName}"

View File

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

View File

@ -43,54 +43,58 @@ class PenyewaLogView extends StatelessWidget {
), ),
child: model.logHistorySewaanList == null child: model.logHistorySewaanList == null
? const Center(child: CircularProgressIndicator()) ? const Center(child: CircularProgressIndicator())
: ListView.builder( : model.logHistorySewaanList!.isEmpty
padding: const EdgeInsets.symmetric( ? const Center(child: Text('Belum ada log'))
horizontal: 15, vertical: 10), : ListView.builder(
itemCount: model.logHistorySewaanList!.length, padding: const EdgeInsets.symmetric(
itemBuilder: (context, index) { horizontal: 15, vertical: 10),
// model.log itemCount: model.logHistorySewaanList!.length,
// .i(model.logHistorySewaanList![index].date); itemBuilder: (context, index) {
return GestureDetector( // model.log
onTap: () { // .i(model.logHistorySewaanList![index].date);
// model.log.i('clicked on index $index'); return GestureDetector(
model.checkKet( onTap: () {
model.logHistorySewaanList![index], // 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), borderRadius: BorderRadius.circular(10),
), ),
child: Column( child: model.detailPenyewaModel == null
mainAxisSize: MainAxisSize.min, ? const Center(child: CircularProgressIndicator())
crossAxisAlignment: CrossAxisAlignment.start, : Column(
mainAxisAlignment: MainAxisAlignment.start, mainAxisSize: MainAxisSize.min,
children: [ crossAxisAlignment: CrossAxisAlignment.start,
_RowChildren( mainAxisAlignment: MainAxisAlignment.start,
title: 'NIK', children: [
value: model.detailPenyewaModel!.nik ?? '...', _RowChildren(
), title: 'NIK',
const SizedBox(height: 5), value: model.detailPenyewaModel!.nik ?? '...',
_RowChildren( ),
title: 'Nama', const SizedBox(height: 5),
value: model.detailPenyewaModel!.nama ?? '...', _RowChildren(
), title: 'Nama',
const SizedBox(height: 5), value: model.detailPenyewaModel!.nama ?? '...',
_RowChildren( ),
title: 'Pulsa', const SizedBox(height: 5),
value: _RowChildren(
'Rp. ${model.otherFunction.commaFormat(model.detailPenyewaModel!.saldo ?? 0)}', title: 'Pulsa',
), value:
const SizedBox(height: 5), 'Rp. ${model.otherFunction.commaFormat(model.detailPenyewaModel!.saldo ?? 0)}',
_RowChildren( ),
title: 'Card ID', const SizedBox(height: 5),
value: model.detailPenyewaModel!.rfid ?? '...', _RowChildren(
), title: 'Card ID',
], value: model.detailPenyewaModel!.rfid ?? '...',
), ),
],
),
), ),
const SizedBox(height: 20), 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 { getData() async {
logHistorySewaanList = [];
try { try {
var response = await httpService.get('scan/log'); var response = await httpService.get('scan/log');
MyResponseModel myResponseModel = MyResponseModel.fromJson(response.data); MyResponseModel myResponseModel = MyResponseModel.fromJson(response.data);

View File

@ -37,64 +37,66 @@ class EditPenyewaDialogView extends StatelessWidget {
borderRadius: BorderRadius.circular(10), borderRadius: BorderRadius.circular(10),
color: backgroundColor, color: backgroundColor,
), ),
child: Column( child: SingleChildScrollView(
mainAxisSize: MainAxisSize.min, child: Column(
crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ mainAxisAlignment: MainAxisAlignment.start,
const Text("NIK"), children: [
MyTextFormField( const Text("NIK"),
controller: model.nikController, MyTextFormField(
hintText: 'Masukkan NIK Penyewa', controller: model.nikController,
keyboardType: TextInputType.number, hintText: 'Masukkan NIK Penyewa',
maxLength: 16, keyboardType: TextInputType.number,
validator: Validatorless.multiple( maxLength: 16,
[ validator: Validatorless.multiple(
Validatorless.required('NIK harus diisi'), [
Validatorless.min(16, 'NIK harus 16 digit'), Validatorless.required('NIK harus diisi'),
Validatorless.max(16, 'NIK harus 16 digit'), Validatorless.min(16, 'NIK harus 16 digit'),
], Validatorless.max(16, 'NIK harus 16 digit'),
],
),
), ),
), const SizedBox(height: 20),
const SizedBox(height: 20), const Text("Nama"),
const Text("Nama"), MyTextFormField(
MyTextFormField( controller: model.nameController,
controller: model.nameController, hintText: 'Masukkan Nama Penyewa',
hintText: 'Masukkan Nama Penyewa', validator: Validatorless.required('Nama harus diisi'),
validator: Validatorless.required('Nama harus diisi'), ),
), const SizedBox(height: 20),
const SizedBox(height: 20), MyButton(
MyButton( text: 'Update Data',
text: 'Update Data', onPressed: () {
onPressed: () { if (request.data!.nik == model.nikController.text &&
if (request.data!.nik == model.nikController.text && request.data!.nama == model.nameController.text) {
request.data!.nama == model.nameController.text) { model.snackbarService.showSnackbar(
model.snackbarService.showSnackbar( message: 'Tidak ada perubahan',
message: 'Tidak ada perubahan', );
); return;
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));
}
} }
});
}, 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 { socketIoClient.on('scan', (data) async {
log.i('data : $data');
var res = await dialogService.showCustomDialog( var res = await dialogService.showCustomDialog(
variant: DialogType.scanRfidDialogView, variant: DialogType.scanRfidDialogView,
title: 'Pembayaran Retribusi', title: 'Pembayaran Retribusi',

View File

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

View File

@ -37,7 +37,7 @@ class SplashScreenView extends StatelessWidget {
), ),
const SizedBox(height: 10), const SizedBox(height: 10),
Text( Text(
"Sistem Retribusi Pasar Enrekang", "Sistem Retribusi Pasar Lakessi",
style: boldTextStyle.copyWith( style: boldTextStyle.copyWith(
fontSize: 20, fontSize: 20,
), ),
@ -47,7 +47,7 @@ class SplashScreenView extends StatelessWidget {
), ),
), ),
const Text( 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, textAlign: TextAlign.center,
style: regularTextStyle, style: regularTextStyle,
), ),