first commit
This commit is contained in:
65
lib/screen/surat_jalan/cancel_surat_jalan_provider.dart
Normal file
65
lib/screen/surat_jalan/cancel_surat_jalan_provider.dart
Normal file
@@ -0,0 +1,65 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
import 'package:mitra_corporate/repository/surat_jalan_repository.dart';
|
||||
|
||||
import '../../provider/dio_provider.dart';
|
||||
import '../../repository/base_repository.dart';
|
||||
|
||||
abstract class CancelSuratJalanState extends Equatable {
|
||||
final DateTime date;
|
||||
const CancelSuratJalanState(this.date);
|
||||
@override
|
||||
List<Object?> get props => [date];
|
||||
}
|
||||
|
||||
class CancelSuratJalanStateInit extends CancelSuratJalanState {
|
||||
CancelSuratJalanStateInit() : super(DateTime.now());
|
||||
}
|
||||
|
||||
class CancelSuratJalanStateLoading extends CancelSuratJalanState {
|
||||
CancelSuratJalanStateLoading() : super(DateTime.now());
|
||||
}
|
||||
|
||||
class CancelSuratJalanStateError extends CancelSuratJalanState {
|
||||
final String message;
|
||||
CancelSuratJalanStateError({
|
||||
required this.message,
|
||||
}) : super(DateTime.now());
|
||||
}
|
||||
|
||||
class CancelSuratJalanStateDone extends CancelSuratJalanState {
|
||||
final String number;
|
||||
CancelSuratJalanStateDone({
|
||||
required this.number,
|
||||
}) : super(DateTime.now());
|
||||
}
|
||||
|
||||
//notifier
|
||||
class CancelSuratJalanNotifier extends StateNotifier<CancelSuratJalanState> {
|
||||
final Ref ref;
|
||||
CancelSuratJalanNotifier({
|
||||
required this.ref,
|
||||
}) : super(CancelSuratJalanStateInit());
|
||||
|
||||
void cancel({required String token, required String deliveryID}) async {
|
||||
try {
|
||||
state = CancelSuratJalanStateLoading();
|
||||
final dio = ref.read(dioProvider);
|
||||
final resp = await SuratJalanRepository(dio: dio)
|
||||
.cancelSuratJalan(token: token, deliveryID: deliveryID);
|
||||
state = CancelSuratJalanStateDone(number: resp);
|
||||
} catch (e) {
|
||||
if (e is BaseRepositoryException) {
|
||||
state = CancelSuratJalanStateError(message: e.message.toString());
|
||||
} else {
|
||||
state = CancelSuratJalanStateError(message: e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//provider
|
||||
final CancelSuratJalanProvider =
|
||||
StateNotifierProvider<CancelSuratJalanNotifier, CancelSuratJalanState>(
|
||||
(ref) => CancelSuratJalanNotifier(ref: ref));
|
||||
65
lib/screen/surat_jalan/create_surat_jalan_provider.dart
Normal file
65
lib/screen/surat_jalan/create_surat_jalan_provider.dart
Normal file
@@ -0,0 +1,65 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:mitra_corporate/model/create_surat_jalan_model.dart';
|
||||
import 'package:mitra_corporate/repository/surat_jalan_repository.dart';
|
||||
|
||||
import '../../provider/dio_provider.dart';
|
||||
import '../../repository/base_repository.dart';
|
||||
|
||||
abstract class CreateSuratJalanState extends Equatable {
|
||||
final DateTime date;
|
||||
const CreateSuratJalanState(this.date);
|
||||
@override
|
||||
List<Object?> get props => [date];
|
||||
}
|
||||
|
||||
class CreateSuratJalanStateInit extends CreateSuratJalanState {
|
||||
CreateSuratJalanStateInit() : super(DateTime.now());
|
||||
}
|
||||
|
||||
class CreateSuratJalanStateLoading extends CreateSuratJalanState {
|
||||
CreateSuratJalanStateLoading() : super(DateTime.now());
|
||||
}
|
||||
|
||||
class CreateSuratJalanStateError extends CreateSuratJalanState {
|
||||
final String message;
|
||||
CreateSuratJalanStateError({
|
||||
required this.message,
|
||||
}) : super(DateTime.now());
|
||||
}
|
||||
|
||||
class CreateSuratJalanStateDone extends CreateSuratJalanState {
|
||||
final String number;
|
||||
CreateSuratJalanStateDone({
|
||||
required this.number,
|
||||
}) : super(DateTime.now());
|
||||
}
|
||||
|
||||
//notifier
|
||||
class CreateSuratJalanNotifier extends StateNotifier<CreateSuratJalanState> {
|
||||
final Ref ref;
|
||||
CreateSuratJalanNotifier({
|
||||
required this.ref,
|
||||
}) : super(CreateSuratJalanStateInit());
|
||||
|
||||
void addOrder({required CreateSuratJalanModel prm}) async {
|
||||
try {
|
||||
state = CreateSuratJalanStateLoading();
|
||||
final dio = ref.read(dioProvider);
|
||||
final resp =
|
||||
await SuratJalanRepository(dio: dio).createSuratJalan(prm: prm);
|
||||
state = CreateSuratJalanStateDone(number: resp);
|
||||
} catch (e) {
|
||||
if (e is BaseRepositoryException) {
|
||||
state = CreateSuratJalanStateError(message: e.message.toString());
|
||||
} else {
|
||||
state = CreateSuratJalanStateError(message: e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//provider
|
||||
final CreateSuratJalanProvider =
|
||||
StateNotifierProvider<CreateSuratJalanNotifier, CreateSuratJalanState>(
|
||||
(ref) => CreateSuratJalanNotifier(ref: ref));
|
||||
182
lib/screen/surat_jalan/dialog_cancel.dart
Normal file
182
lib/screen/surat_jalan/dialog_cancel.dart
Normal file
@@ -0,0 +1,182 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:loading_animation_widget/loading_animation_widget.dart';
|
||||
|
||||
import '../../app/constant.dart';
|
||||
|
||||
class DialogCancelSuratJalan extends StatelessWidget {
|
||||
const DialogCancelSuratJalan(
|
||||
{super.key,
|
||||
required this.date,
|
||||
required this.deliveryNumber,
|
||||
required this.cancel,
|
||||
required this.deliveryID,
|
||||
required this.loading,
|
||||
required this.pic});
|
||||
final String date;
|
||||
final String pic;
|
||||
final String deliveryNumber;
|
||||
final Function cancel;
|
||||
final String deliveryID;
|
||||
final bool loading;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AlertDialog(
|
||||
titlePadding: EdgeInsets.symmetric(
|
||||
horizontal: Constant.getActualX(context: context, x: 24),
|
||||
vertical: Constant.getActualY(context: context, y: 24)),
|
||||
actionsPadding: EdgeInsets.symmetric(
|
||||
horizontal: Constant.getActualX(context: context, x: 24),
|
||||
vertical: Constant.getActualY(context: context, y: 24)),
|
||||
contentPadding: EdgeInsets.symmetric(
|
||||
horizontal: Constant.getActualX(context: context, x: 24),
|
||||
vertical: Constant.getActualY(context: context, y: 24)),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(8))),
|
||||
title: Text(
|
||||
'Konfirmasi Pembatalan',
|
||||
style: Constant.h4_600(context: context),
|
||||
),
|
||||
content: Container(
|
||||
constraints: BoxConstraints(
|
||||
minHeight: Constant.getActualY(context: context, y: 100),
|
||||
maxHeight: Constant.getActualY(context: context, y: 362),
|
||||
),
|
||||
height: Constant.getActualY(context: context, y: 240),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
'Anda yakin membatalkan surat jalan berikut ?',
|
||||
style: Constant.body1_600(context: context),
|
||||
),
|
||||
SizedBox(
|
||||
height: Constant.getActualY(context: context, y: 24),
|
||||
),
|
||||
SizedBox(
|
||||
width: Constant.getActualX(context: context, x: 416),
|
||||
child: Card(
|
||||
elevation: 1,
|
||||
shape: RoundedRectangleBorder(
|
||||
side: BorderSide(color: Constant.grey_200),
|
||||
borderRadius: BorderRadius.circular(12)),
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal:
|
||||
Constant.getActualX(context: context, x: 24),
|
||||
vertical:
|
||||
Constant.getActualY(context: context, y: 24)),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 5,
|
||||
child: Text(
|
||||
"Tanggal",
|
||||
style: Constant.body3_600(context: context)
|
||||
.copyWith(color: Constant.textGrey),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 7,
|
||||
child: Text(
|
||||
date,
|
||||
style: Constant.body3_600(context: context)
|
||||
.copyWith(color: Constant.textBlack),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height:
|
||||
Constant.getActualY(context: context, y: 12),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 5,
|
||||
child: Text(
|
||||
"Nomor Surat Jalan",
|
||||
style: Constant.body3_600(context: context)
|
||||
.copyWith(color: Constant.textGrey),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 7,
|
||||
child: Text(
|
||||
deliveryNumber,
|
||||
style: Constant.body3_600(context: context)
|
||||
.copyWith(color: Constant.textBlack),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height:
|
||||
Constant.getActualY(context: context, y: 12),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 5,
|
||||
child: Text(
|
||||
"Staff PIC",
|
||||
style: Constant.body3_600(context: context)
|
||||
.copyWith(color: Constant.textGrey),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 7,
|
||||
child: Text(
|
||||
pic,
|
||||
style: Constant.body3_600(context: context)
|
||||
.copyWith(color: Constant.textBlack),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
)),
|
||||
),
|
||||
)
|
||||
],
|
||||
)),
|
||||
actions: <Widget>[
|
||||
OutlinedButton(
|
||||
style: OutlinedButton.styleFrom(
|
||||
surfaceTintColor: Constant.primaryBlue,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8))),
|
||||
onPressed: !loading ? () => Navigator.pop(context, 'Batal') : null,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
child: loading
|
||||
? LoadingAnimationWidget.staggeredDotsWave(
|
||||
color: Constant.primaryBlue, size: 20)
|
||||
: Text('Batal',
|
||||
style: Constant.button_medium(context: context)
|
||||
.copyWith(color: Constant.textBlack)),
|
||||
),
|
||||
),
|
||||
ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Colors.red,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8))),
|
||||
onPressed: !loading ? () => cancel(deliveryID) : null,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
child: loading
|
||||
? LoadingAnimationWidget.staggeredDotsWave(
|
||||
color: Colors.white, size: 20)
|
||||
: Text(
|
||||
'Yakin',
|
||||
style: Constant.button_medium(context: context)
|
||||
.copyWith(color: Colors.white),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
182
lib/screen/surat_jalan/dialog_send.dart
Normal file
182
lib/screen/surat_jalan/dialog_send.dart
Normal file
@@ -0,0 +1,182 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:loading_animation_widget/loading_animation_widget.dart';
|
||||
|
||||
import '../../app/constant.dart';
|
||||
|
||||
class DialogConfirmSuratJalan extends StatelessWidget {
|
||||
const DialogConfirmSuratJalan(
|
||||
{super.key,
|
||||
required this.date,
|
||||
required this.deliveryNumber,
|
||||
required this.sendFunction,
|
||||
required this.deliveryID,
|
||||
required this.loading,
|
||||
required this.pic});
|
||||
final String date;
|
||||
final String pic;
|
||||
final String deliveryNumber;
|
||||
final Function sendFunction;
|
||||
final String deliveryID;
|
||||
final bool loading;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AlertDialog(
|
||||
titlePadding: EdgeInsets.symmetric(
|
||||
horizontal: Constant.getActualX(context: context, x: 24),
|
||||
vertical: Constant.getActualY(context: context, y: 24)),
|
||||
actionsPadding: EdgeInsets.symmetric(
|
||||
horizontal: Constant.getActualX(context: context, x: 24),
|
||||
vertical: Constant.getActualY(context: context, y: 24)),
|
||||
contentPadding: EdgeInsets.symmetric(
|
||||
horizontal: Constant.getActualX(context: context, x: 24),
|
||||
vertical: Constant.getActualY(context: context, y: 24)),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(8))),
|
||||
title: Text(
|
||||
'Konfirmasi Surat Jalan',
|
||||
style: Constant.h4_600(context: context),
|
||||
),
|
||||
content: Container(
|
||||
constraints: BoxConstraints(
|
||||
minHeight: Constant.getActualY(context: context, y: 100),
|
||||
maxHeight: Constant.getActualY(context: context, y: 362),
|
||||
),
|
||||
height: Constant.getActualY(context: context, y: 240),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
'Anda yakin mengirimkan surat jalan berikut ?',
|
||||
style: Constant.body1_600(context: context),
|
||||
),
|
||||
SizedBox(
|
||||
height: Constant.getActualY(context: context, y: 24),
|
||||
),
|
||||
SizedBox(
|
||||
width: Constant.getActualX(context: context, x: 416),
|
||||
child: Card(
|
||||
elevation: 1,
|
||||
shape: RoundedRectangleBorder(
|
||||
side: BorderSide(color: Constant.grey_200),
|
||||
borderRadius: BorderRadius.circular(12)),
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal:
|
||||
Constant.getActualX(context: context, x: 24),
|
||||
vertical:
|
||||
Constant.getActualY(context: context, y: 24)),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 5,
|
||||
child: Text(
|
||||
"Tanggal",
|
||||
style: Constant.body3_600(context: context)
|
||||
.copyWith(color: Constant.textGrey),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 7,
|
||||
child: Text(
|
||||
date,
|
||||
style: Constant.body3_600(context: context)
|
||||
.copyWith(color: Constant.textBlack),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height:
|
||||
Constant.getActualY(context: context, y: 12),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 5,
|
||||
child: Text(
|
||||
"Nomor Surat Jalan",
|
||||
style: Constant.body3_600(context: context)
|
||||
.copyWith(color: Constant.textGrey),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 7,
|
||||
child: Text(
|
||||
deliveryNumber,
|
||||
style: Constant.body3_600(context: context)
|
||||
.copyWith(color: Constant.textBlack),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height:
|
||||
Constant.getActualY(context: context, y: 12),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 5,
|
||||
child: Text(
|
||||
"Staff PIC",
|
||||
style: Constant.body3_600(context: context)
|
||||
.copyWith(color: Constant.textGrey),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 7,
|
||||
child: Text(
|
||||
pic,
|
||||
style: Constant.body3_600(context: context)
|
||||
.copyWith(color: Constant.textBlack),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
)),
|
||||
),
|
||||
)
|
||||
],
|
||||
)),
|
||||
actions: <Widget>[
|
||||
OutlinedButton(
|
||||
style: OutlinedButton.styleFrom(
|
||||
surfaceTintColor: Constant.primaryBlue,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8))),
|
||||
onPressed: !loading ? () => Navigator.pop(context, 'Batal') : null,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
child: loading
|
||||
? LoadingAnimationWidget.staggeredDotsWave(
|
||||
color: Colors.white, size: 20)
|
||||
: Text('Batal',
|
||||
style: Constant.button_medium(context: context)
|
||||
.copyWith(color: Constant.textBlack)),
|
||||
),
|
||||
),
|
||||
ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Constant.green,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8))),
|
||||
onPressed: !loading ? () => sendFunction(deliveryID) : null,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
child: loading
|
||||
? LoadingAnimationWidget.staggeredDotsWave(
|
||||
color: Colors.white, size: 20)
|
||||
: Text(
|
||||
'Yakin',
|
||||
style: Constant.button_medium(context: context)
|
||||
.copyWith(color: Colors.white),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
209
lib/screen/surat_jalan/dialog_send_qr.dart
Normal file
209
lib/screen/surat_jalan/dialog_send_qr.dart
Normal file
@@ -0,0 +1,209 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:mitra_corporate/provider/auth_provider.dart';
|
||||
import 'package:mitra_corporate/screen/surat_jalan/send_qr_code_provider.dart';
|
||||
|
||||
import '../../app/constant.dart';
|
||||
import '../../widgets/custom_snackbar_widget.dart';
|
||||
|
||||
class DialogSendQr extends HookConsumerWidget {
|
||||
const DialogSendQr(
|
||||
{super.key, required this.arrOrderID, required this.orderNumber});
|
||||
final List<String> arrOrderID;
|
||||
final String orderNumber;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final auth = ref.watch(authProvider);
|
||||
|
||||
final rb = useState("Y");
|
||||
|
||||
sendQrCode() {
|
||||
ref
|
||||
.read(SendQrCodeProvider.notifier)
|
||||
.senQrCode(token: auth?.token ?? "", arrOrderID: arrOrderID);
|
||||
}
|
||||
|
||||
ref.listen(
|
||||
SendQrCodeProvider,
|
||||
(pref, next) {
|
||||
if (next is SendQrCodeStateInit) {
|
||||
} else if (next is SendQrCodeStateLoading) {
|
||||
} else if (next is SendQrCodeStateError) {
|
||||
SanckbarWidget(
|
||||
context,
|
||||
"Gagal Menyimpan Data${jsonEncode(next.message)}",
|
||||
snackbarType.error);
|
||||
Constant.autoLogout(context: context, msg: next.message);
|
||||
} else if (next is SendQrCodeStateDone) {
|
||||
Navigator.pop(context);
|
||||
// print(jsonEncode(next.model));
|
||||
|
||||
if (next.model != 'OK') {
|
||||
SanckbarWidget(context, "Gagal Menyimpan Data", snackbarType.error);
|
||||
} else {
|
||||
SanckbarWidget(
|
||||
context,
|
||||
"Berhasil Menyimpan Data, Qr Code Akan Dikirimkan",
|
||||
snackbarType.success);
|
||||
}
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
return AlertDialog(
|
||||
contentPadding: EdgeInsets.symmetric(
|
||||
horizontal: Constant.getActualX(context: context, x: 24),
|
||||
vertical: Constant.getActualY(context: context, y: 24)),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(12))),
|
||||
title: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'Kirim QR Code',
|
||||
textAlign: TextAlign.center,
|
||||
style: Constant.h4_600(context: context)
|
||||
.copyWith(fontWeight: FontWeight.w700),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
icon: Icon(Icons.close_rounded))
|
||||
],
|
||||
),
|
||||
content: Container(
|
||||
constraints: BoxConstraints(
|
||||
minHeight: Constant.getActualY(context: context, y: 100),
|
||||
maxHeight: Constant.getActualY(context: context, y: 362),
|
||||
),
|
||||
height: Constant.getActualY(context: context, y: 320),
|
||||
child: Column(
|
||||
// crossAxisAlignment: CrossAxisAlignment.center,
|
||||
// mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: Constant.getActualY(context: context, y: 30),
|
||||
),
|
||||
Text(
|
||||
"Surat Jalan Berhasil Dibuat",
|
||||
style: Constant.body1_600(context: context)
|
||||
.copyWith(fontWeight: FontWeight.w600),
|
||||
),
|
||||
SizedBox(
|
||||
height: Constant.getActualY(context: context, y: 12),
|
||||
),
|
||||
Container(
|
||||
width: Constant.getActualX(context: context, x: 263),
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: Constant.getActualX(context: context, x: 24),
|
||||
vertical: Constant.getActualY(context: context, y: 12)),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(color: Colors.grey.shade300)),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
"Nomor Surat Jalan",
|
||||
style: Constant.body3_500(context: context)
|
||||
.copyWith(color: Constant.textGrey),
|
||||
),
|
||||
Text(
|
||||
orderNumber,
|
||||
style: Constant.body3_500(context: context)
|
||||
.copyWith(fontWeight: FontWeight.w600),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: Constant.getActualY(context: context, y: 12),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
// width: Constant.getActualX(context: context, x: 48),
|
||||
child: RadioMenuButton<String>(
|
||||
style: ButtonStyle(
|
||||
backgroundColor: WidgetStateColor.resolveWith(
|
||||
(states) => Colors.white,
|
||||
),
|
||||
shadowColor: WidgetStateColor.resolveWith(
|
||||
(states) => Colors.white),
|
||||
overlayColor: WidgetStateColor.resolveWith(
|
||||
(states) => Colors.white)),
|
||||
value: 'Y',
|
||||
groupValue: rb.value,
|
||||
onChanged: (value) {
|
||||
if (rb.value == value) {
|
||||
rb.value = 'N';
|
||||
} else {
|
||||
rb.value = value!;
|
||||
}
|
||||
},
|
||||
child: Text(
|
||||
"Kirim Whatsapp QR Code",
|
||||
style: Constant.body3_400(context: context),
|
||||
)),
|
||||
),
|
||||
// Text(
|
||||
// "Kirim Whatsapp QR Code",
|
||||
// style: Constant.body3_400(context: context),
|
||||
// )
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: Constant.getActualY(context: context, y: 37),
|
||||
),
|
||||
ElevatedButton(
|
||||
onPressed: rb.value == 'Y'
|
||||
? () {
|
||||
sendQrCode();
|
||||
}
|
||||
: null,
|
||||
style: ElevatedButton.styleFrom(
|
||||
minimumSize: Size(
|
||||
Constant.getActualX(context: context, x: 328),
|
||||
Constant.getActualY(context: context, y: 64)),
|
||||
elevation: 5,
|
||||
backgroundColor: Constant.primaryRed,
|
||||
shadowColor: Constant.primaryRed,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8))),
|
||||
child: Container(
|
||||
margin: EdgeInsets.symmetric(
|
||||
vertical: Constant.getActualY(context: context, y: 11)),
|
||||
child: Text(
|
||||
"Kirim QR Code",
|
||||
style: Constant.button_large(context: context)
|
||||
.copyWith(color: Colors.white),
|
||||
),
|
||||
)),
|
||||
// SizedBox(
|
||||
// height: Constant.getActualY(context: context, y: 12),
|
||||
// ),
|
||||
// Row(
|
||||
// children: [
|
||||
// Text(
|
||||
// "Belum menerima QR Code ?",
|
||||
// style: Constant.caption1_600(context: context)
|
||||
// .copyWith(color: Constant.textGrey),
|
||||
// ),
|
||||
// TextButton(
|
||||
// onPressed: rb.value == 'Y' ? () {} : null,
|
||||
// child: Text("Kirim Ulang",
|
||||
// style: Constant.caption1_600(context: context)
|
||||
// .copyWith()))
|
||||
// ],
|
||||
// )
|
||||
],
|
||||
)),
|
||||
);
|
||||
}
|
||||
}
|
||||
52
lib/screen/surat_jalan/dialog_surat_jalan.dart
Normal file
52
lib/screen/surat_jalan/dialog_surat_jalan.dart
Normal file
@@ -0,0 +1,52 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:mitra_corporate/provider/surat_jalan_provider.dart';
|
||||
import 'package:mitra_corporate/screen/surat_jalan/form_surat_jalan.dart';
|
||||
import 'package:mitra_corporate/screen/surat_jalan/surat_jalan_confirmation.dart';
|
||||
|
||||
import '../../app/constant.dart';
|
||||
|
||||
class DialogSuratJalan extends HookConsumerWidget {
|
||||
const DialogSuratJalan({super.key});
|
||||
|
||||
// const DialogSuratJalan({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final bacaSuratJalanProvider = ref.watch(suratJalanProvider);
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 40),
|
||||
child: SimpleDialog(
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(12))),
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.fromLTRB(40, 20, 40, 20),
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: Constant.getActualX(context: context, x: 1332),
|
||||
height: Constant.getActualY(context: context, y: 62),
|
||||
child: Text(
|
||||
bacaSuratJalanProvider == 1
|
||||
? 'Pengiriman Order Baru'
|
||||
: "Konfirmasi",
|
||||
style: Constant.h2_600(context: context)
|
||||
.copyWith(color: Constant.textBlack)),
|
||||
),
|
||||
SizedBox(
|
||||
height: Constant.getActualY(context: context, y: 10)),
|
||||
|
||||
///
|
||||
if (bacaSuratJalanProvider == 1) FormSuratJalan(),
|
||||
if (bacaSuratJalanProvider == 2) SuratJalanConfirmation(),
|
||||
|
||||
///
|
||||
],
|
||||
),
|
||||
),
|
||||
]),
|
||||
);
|
||||
}
|
||||
}
|
||||
529
lib/screen/surat_jalan/form_surat_jalan.dart
Normal file
529
lib/screen/surat_jalan/form_surat_jalan.dart
Normal file
@@ -0,0 +1,529 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:eva_icons_flutter/eva_icons_flutter.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:mitra_corporate/model/create_surat_jalan_model.dart';
|
||||
import 'package:mitra_corporate/model/delivery_type_model.dart';
|
||||
import 'package:mitra_corporate/model/destination_model.dart';
|
||||
import 'package:mitra_corporate/model/order_model.dart';
|
||||
import 'package:mitra_corporate/model/registration_filter_model.dart';
|
||||
import 'package:mitra_corporate/provider/auth_provider.dart';
|
||||
import 'package:mitra_corporate/screen/surat_jalan/get_order_list_provider.dart';
|
||||
import 'package:mitra_corporate/screen/surat_jalan/get_regional_provider.dart';
|
||||
import 'package:mitra_corporate/screen/surat_jalan/list_pasien_terpilih.dart';
|
||||
import 'package:mitra_corporate/screen/surat_jalan/table_list_pasien.dart';
|
||||
import 'package:loading_animation_widget/loading_animation_widget.dart';
|
||||
|
||||
import '../../app/constant.dart';
|
||||
import '../../provider/surat_jalan_provider.dart';
|
||||
import '../../widgets/custom_snackbar_widget.dart';
|
||||
import '../../widgets/custom_text_field.dart';
|
||||
|
||||
class FormSuratJalan extends HookConsumerWidget {
|
||||
const FormSuratJalan({
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final tempSuratJalan = ref.watch(createSuratJalanProvider);
|
||||
final auth = ref.watch(authProvider);
|
||||
final picCtr = useTextEditingController(text: auth?.mUserUsername ?? "");
|
||||
final noRefCtr =
|
||||
useTextEditingController(text: tempSuratJalan.order?.noRef);
|
||||
final suhuBoxCtr =
|
||||
useTextEditingController(text: tempSuratJalan.order?.temperature);
|
||||
final noResiCtr =
|
||||
useTextEditingController(text: tempSuratJalan.order?.noResi);
|
||||
final noteCtr = useTextEditingController(text: tempSuratJalan.order?.note);
|
||||
final searchPatient = useTextEditingController(text: "");
|
||||
final deliveryTypeLoading = useState(false);
|
||||
final selectedDeliveryType =
|
||||
useState<DeliveryTypeModel>(DeliveryTypeModel());
|
||||
final deliveryTypeList = useState<List<DeliveryTypeModel>>(List.empty());
|
||||
final deliveryTypeKey = useState(1);
|
||||
final deliveryDate = useTextEditingController(
|
||||
text: DateFormat('dd-MM-yyyy').format(DateTime.parse(
|
||||
tempSuratJalan.order?.date ?? DateTime.now().toString())));
|
||||
final deliveryState = useState(DateTime.parse(
|
||||
tempSuratJalan.order?.date ?? DateTime.now().toString()));
|
||||
final getOrderLoading = useState(false);
|
||||
final orderList = useState<List<OrderModel>>(List.empty());
|
||||
final fullOrderList = useState<List<OrderModel>>(List.empty());
|
||||
final selectedOrder = useState<List<OrderModel>>(List.empty());
|
||||
final destinationList = useState<List<DestinationModel>>(List.empty());
|
||||
final selectedDestination = useState<DestinationModel>(DestinationModel());
|
||||
final regionalList = useState<List<RegionalModel>>(List.empty());
|
||||
final selectedRegional = useState(RegionalModel());
|
||||
|
||||
final destinationLoading = useState(false);
|
||||
final regionalLoading = useState(false);
|
||||
final destinationKey = useState(1000);
|
||||
final regionalKey = useState(5000);
|
||||
final branchKey = useState(10000);
|
||||
|
||||
useEffect(() {
|
||||
WidgetsBinding.instance.addPostFrameCallback((timeStamp) async {
|
||||
// deliveryState.value = DateTime.parse(tempSuratJalan.order?.date ?? '');
|
||||
// ref
|
||||
// .read(GetDeliveryTypeProvider.notifier)
|
||||
// .getData(token: auth?.token ?? "");
|
||||
ref.read(GetOrderListProvider.notifier).getData(
|
||||
token: auth?.token ?? "",
|
||||
company_id: auth?.mUserMCompanyID ?? "",
|
||||
regional_id: auth?.MUserSRegionalID ?? "0");
|
||||
ref
|
||||
.read(GetRegionalProvider.notifier)
|
||||
.getRegional(token: auth?.token ?? "");
|
||||
});
|
||||
return () {};
|
||||
}, []);
|
||||
|
||||
// ref.listen(
|
||||
// GetDeliveryTypeProvider,
|
||||
// (previous, next) {
|
||||
// if (next is GetDeliveryTypeStateInit) {
|
||||
// deliveryTypeLoading.value = true;
|
||||
// } else if (next is GetDeliveryTypeStateLoading) {
|
||||
// deliveryTypeLoading.value = true;
|
||||
// } else if (next is GetDeliveryTypeStateError) {
|
||||
// SanckbarWidget(context, next.message, snackbarType.error);
|
||||
// deliveryTypeLoading.value = false;
|
||||
// } else if (next is GetDeliveryTypeStateDone) {
|
||||
// // print(jsonEncode(next.model));
|
||||
// deliveryTypeList.value = next.model;
|
||||
// next.model.forEach((element) {
|
||||
// if (element.id == tempSuratJalan.order?.typeId) {
|
||||
// selectedDeliveryType.value = element;
|
||||
// }
|
||||
// });
|
||||
// deliveryTypeKey.value = deliveryTypeKey.value + 1;
|
||||
|
||||
// deliveryTypeLoading.value = false;
|
||||
// }
|
||||
// },
|
||||
// );
|
||||
ref.listen(
|
||||
GetOrderListProvider,
|
||||
(previous, next) {
|
||||
if (next is GetOrderListStateInit) {
|
||||
getOrderLoading.value = true;
|
||||
} else if (next is GetOrderListStateLoading) {
|
||||
getOrderLoading.value = true;
|
||||
} else if (next is GetOrderListStateError) {
|
||||
SanckbarWidget(context, next.message, snackbarType.error);
|
||||
getOrderLoading.value = false;
|
||||
Constant.autoLogout(context: context, msg: next.message);
|
||||
} else if (next is GetOrderListStateDone) {
|
||||
// print(jsonEncode(next.model));
|
||||
var a = next.model;
|
||||
selectedOrder.value = tempSuratJalan.orderDetail ?? [];
|
||||
for (var element in selectedOrder.value) {
|
||||
a.removeWhere((i) => element.orderId == i.orderId);
|
||||
}
|
||||
orderList.value = a;
|
||||
fullOrderList.value = a;
|
||||
|
||||
getOrderLoading.value = false;
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
ref.listen(
|
||||
GetRegionalProvider,
|
||||
(previous, next) {
|
||||
if (next is GetRegionalStateInit) {
|
||||
regionalLoading.value = true;
|
||||
} else if (next is GetRegionalStateLoading) {
|
||||
regionalLoading.value = true;
|
||||
} else if (next is GetRegionalStateError) {
|
||||
SanckbarWidget(context, next.message, snackbarType.error);
|
||||
regionalLoading.value = false;
|
||||
Constant.autoLogout(context: context, msg: next.message);
|
||||
} else if (next is GetRegionalStateDone) {
|
||||
// print(jsonEncode(next.model));
|
||||
regionalList.value = next.model;
|
||||
for (var element in next.model) {
|
||||
if (element.regionalId == tempSuratJalan.order?.regionalId) {
|
||||
selectedRegional.value = element;
|
||||
destinationList.value = element.branch ?? [];
|
||||
element.branch?.forEach((i) {
|
||||
if (i.branchId == tempSuratJalan.order?.destinationId) {
|
||||
selectedDestination.value = i;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
regionalKey.value = regionalKey.value + 1;
|
||||
branchKey.value = branchKey.value + 1;
|
||||
destinationKey.value = destinationKey.value + 1;
|
||||
|
||||
regionalLoading.value = false;
|
||||
}
|
||||
},
|
||||
);
|
||||
selectOrder(OrderModel e) {
|
||||
List<OrderModel> temp = orderList.value;
|
||||
List<OrderModel> fullTemp = fullOrderList.value;
|
||||
List<OrderModel> tempSlct = selectedOrder.value.toList(growable: true);
|
||||
temp.removeWhere((element) => element.orderId == e.orderId);
|
||||
fullTemp.removeWhere((element) => element.orderId == e.orderId);
|
||||
tempSlct.add(e);
|
||||
|
||||
orderList.value = temp;
|
||||
fullOrderList.value = fullTemp;
|
||||
selectedOrder.value = tempSlct;
|
||||
}
|
||||
|
||||
unSelectOrder(OrderModel e) {
|
||||
List<OrderModel> temp = orderList.value.toList(growable: true);
|
||||
List<OrderModel> tempSlct = selectedOrder.value.toList(growable: true);
|
||||
List<OrderModel> fullTemp = fullOrderList.value;
|
||||
tempSlct.removeWhere((element) => element.orderId == e.orderId);
|
||||
temp.add(e);
|
||||
fullTemp.add(e);
|
||||
|
||||
orderList.value = temp;
|
||||
fullOrderList.value = fullTemp;
|
||||
selectedOrder.value = tempSlct;
|
||||
}
|
||||
|
||||
return Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
// Container(
|
||||
// width: Constant.getActualX(context: context, x: 382),
|
||||
// // height: Constant.getActualY(context: context, y: 56),
|
||||
// child: DropdownMenu<RegionalModel>(
|
||||
// menuHeight: Constant.getActualY(context: context, y: 300),
|
||||
// key: ValueKey(regionalKey.value),
|
||||
// initialSelection: selectedRegional.value,
|
||||
// trailingIcon: regionalLoading.value
|
||||
// ? LoadingAnimationWidget.discreteCircle(
|
||||
// color: Constant.primaryRed, size: 20)
|
||||
// : null,
|
||||
// width: Constant.getActualX(context: context, x: 382),
|
||||
// hintText: "Regional",
|
||||
// textStyle: Constant.body2_400(context: context),
|
||||
// inputDecorationTheme: InputDecorationTheme(
|
||||
// border: OutlineInputBorder(
|
||||
// borderSide: BorderSide(color: Constant.primaryRed),
|
||||
// borderRadius: BorderRadius.circular(8),
|
||||
// )),
|
||||
// label: const Text(
|
||||
// "Regional",
|
||||
// maxLines: 1,
|
||||
// overflow: TextOverflow.ellipsis,
|
||||
// ),
|
||||
// onSelected: (value) {
|
||||
// // onSelectSaluation(value!);
|
||||
// if (value!.regionalId !=
|
||||
// selectedRegional.value.regionalId) {
|
||||
// print("change");
|
||||
// selectedRegional.value = value;
|
||||
// selectedDestination.value = DestinationModel();
|
||||
// destinationList.value = value.branch ?? [];
|
||||
// }
|
||||
// branchKey.value = branchKey.value + 1;
|
||||
// },
|
||||
// dropdownMenuEntries: regionalList.value
|
||||
// .map<DropdownMenuEntry<RegionalModel>>((e) =>
|
||||
// DropdownMenuEntry(
|
||||
// value: e, label: e.regionalName ?? ""))
|
||||
// .toList()),
|
||||
// ),
|
||||
// SizedBox(
|
||||
// width: Constant.getActualX(context: context, x: 24),
|
||||
// ),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: Constant.getActualY(context: context, y: 24),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: Constant.getActualX(context: context, x: 318),
|
||||
// height: Constant.getActualY(context: context, y: 56),
|
||||
child: DropdownMenu<DestinationModel>(
|
||||
menuHeight: Constant.getActualY(context: context, y: 300),
|
||||
key: ValueKey(branchKey.value),
|
||||
initialSelection: selectedDestination.value,
|
||||
trailingIcon: regionalLoading.value
|
||||
? LoadingAnimationWidget.discreteCircle(
|
||||
color: Constant.primaryRed, size: 20)
|
||||
: null,
|
||||
width: Constant.getActualX(context: context, x: 318),
|
||||
hintText: "Cabang",
|
||||
textStyle: Constant.body2_400(context: context),
|
||||
inputDecorationTheme: InputDecorationTheme(
|
||||
border: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Constant.primaryRed),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
)),
|
||||
label: const Text(
|
||||
"Cabang",
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
onSelected: (value) {
|
||||
// onSelectSaluation(value!);
|
||||
selectedDestination.value = value!;
|
||||
},
|
||||
dropdownMenuEntries: destinationList.value
|
||||
.map<DropdownMenuEntry<DestinationModel>>((e) =>
|
||||
DropdownMenuEntry(
|
||||
value: e, label: e.branchName ?? ""))
|
||||
.toList()),
|
||||
),
|
||||
SizedBox(
|
||||
width: Constant.getActualX(context: context, x: 24),
|
||||
),
|
||||
SizedBox(
|
||||
width: Constant.getActualX(context: context, x: 318),
|
||||
// height: Constant.getActualY(context: context, y: 56),
|
||||
child: CustomTextField(
|
||||
controller: picCtr,
|
||||
hintText: 'Staf PIC',
|
||||
labelText: "Staf PIC",
|
||||
disable: false,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: Constant.getActualX(context: context, x: 24),
|
||||
),
|
||||
SizedBox(
|
||||
width: Constant.getActualX(context: context, x: 318),
|
||||
// height: Constant.getActualY(context: context, y: 56),
|
||||
child: CustomTextField(
|
||||
controller: noRefCtr,
|
||||
hintText: 'Nomor Referensi Surat',
|
||||
labelText: "Nomor Referensi Surat"),
|
||||
),
|
||||
SizedBox(
|
||||
width: Constant.getActualX(context: context, x: 24),
|
||||
),
|
||||
SizedBox(
|
||||
width: Constant.getActualX(context: context, x: 165),
|
||||
// height: Constant.getActualY(context: context, y: 56),
|
||||
child: TextField(
|
||||
controller: deliveryDate,
|
||||
style: Constant.body2_400(context: context),
|
||||
decoration: InputDecoration(
|
||||
suffixIcon: Icon(EvaIcons.calendarOutline),
|
||||
border: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Constant.primaryBlue),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
labelText: "Tanggal Kedatangan" //label text of field
|
||||
),
|
||||
readOnly: true,
|
||||
onTap: () async {
|
||||
DateTime? pickedDate = await showDatePicker(
|
||||
// locale: Locale("ID"),
|
||||
cancelText: "Batal",
|
||||
confirmText: "Simpan",
|
||||
context: context,
|
||||
initialDate: deliveryState.value,
|
||||
firstDate: DateTime(1800),
|
||||
initialEntryMode: DatePickerEntryMode.calendarOnly,
|
||||
|
||||
//DateTime.now() - not to allow to choose before today.
|
||||
lastDate: DateTime(2100));
|
||||
|
||||
if (pickedDate != null) {
|
||||
print(
|
||||
pickedDate); //pickedDate output format => 2021-03-10 00:00:00.000
|
||||
String formattedDate =
|
||||
DateFormat('dd-MM-yyyy').format(pickedDate);
|
||||
print(
|
||||
formattedDate); //formatted date output using intl package => 2021-03-16
|
||||
deliveryDate.text =
|
||||
formattedDate; //set output date to TextField value.
|
||||
deliveryState.value = pickedDate;
|
||||
} else {}
|
||||
},
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: Constant.getActualX(context: context, x: 24),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: Constant.getActualY(context: context, y: 24),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: Constant.getActualX(context: context, x: 1194),
|
||||
// height: Constant.getActualY(context: context, y: 56),
|
||||
child: CustomTextField(
|
||||
controller: noteCtr,
|
||||
hintText: 'Catatan',
|
||||
labelText: 'Catatan'),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: Constant.getActualY(context: context, y: 24),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: Constant.getActualX(context: context, x: 585),
|
||||
// height: Constant.getActualY(context: context, y: 56),
|
||||
child: CustomTextField(
|
||||
onChange: (value) {
|
||||
List<OrderModel> temp = fullOrderList.value.toSet().toList();
|
||||
|
||||
// List<OrderModel> fullOrderList = orderList.value.toSet().toList();
|
||||
var searched = temp.where((element) =>
|
||||
element.patientName!
|
||||
.toLowerCase()
|
||||
.contains(value.toString().toLowerCase()) ||
|
||||
element.orderNumber!
|
||||
.toLowerCase()
|
||||
.contains(value.toString().toLowerCase()));
|
||||
if (value.isNotEmpty) {
|
||||
orderList.value = searched.toList();
|
||||
} else {
|
||||
orderList.value = temp;
|
||||
}
|
||||
// jsonEncode(searched.toString());
|
||||
},
|
||||
controller: searchPatient,
|
||||
hintText: 'Nama Pasien, Nomor Registrasi',
|
||||
labelText: 'Nama Pasien, Nomor Registrasi',
|
||||
suffixIcon: Icon(EvaIcons.search),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: Constant.getActualX(context: context, x: 24),
|
||||
),
|
||||
Container(
|
||||
width: Constant.getActualX(context: context, x: 585),
|
||||
// height: Constant.getActualY(context: context, y: 56),
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text('List Pasien Terpilih',
|
||||
style: Constant.h4_600(context: context)
|
||||
.copyWith(color: Constant.textBlack)),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: Constant.getActualY(context: context, y: 12),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
TableListPasien(
|
||||
orders: orderList.value,
|
||||
loading: getOrderLoading.value,
|
||||
selected: selectOrder,
|
||||
),
|
||||
SizedBox(
|
||||
width: Constant.getActualX(context: context, x: 24),
|
||||
),
|
||||
ListPasienTerpilih(
|
||||
orders: selectedOrder.value,
|
||||
loading: getOrderLoading.value,
|
||||
unselect: unSelectOrder,
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: Constant.getActualY(context: context, y: 12),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: Constant.getActualY(context: context, y: 45),
|
||||
child: OutlinedButton(
|
||||
style: OutlinedButton.styleFrom(
|
||||
backgroundColor: Colors.white,
|
||||
side: BorderSide(color: Colors.grey, width: 2),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8))),
|
||||
onPressed: () {
|
||||
ref.read(createSuratJalanProvider.notifier).state =
|
||||
CreateSuratJalanModel();
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: Text('Batal',
|
||||
style: Constant.body3_600(context: context)
|
||||
.copyWith(color: Constant.textBlack))),
|
||||
),
|
||||
SizedBox(width: Constant.getActualX(context: context, x: 24)),
|
||||
Container(
|
||||
height: Constant.getActualY(context: context, y: 45),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
color: Constant.green),
|
||||
child: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Constant.green,
|
||||
side: BorderSide(color: Constant.green, width: 2),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
),
|
||||
onPressed: () {
|
||||
if (selectedOrder.value.isEmpty) {
|
||||
SanckbarWidget(context, "Pilih salah satu order",
|
||||
snackbarType.warning);
|
||||
return;
|
||||
}
|
||||
|
||||
if (selectedDestination.value.branchId == null) {
|
||||
SanckbarWidget(context, "Pilih salah satu tujuan",
|
||||
snackbarType.warning);
|
||||
return;
|
||||
}
|
||||
if (selectedRegional.value.regionalId == null) {
|
||||
SanckbarWidget(context, "Pilih salah satu regional",
|
||||
snackbarType.warning);
|
||||
return;
|
||||
}
|
||||
ref.read(createSuratJalanProvider.notifier).state =
|
||||
CreateSuratJalanModel(
|
||||
order: Order(
|
||||
branchCode:
|
||||
selectedDestination.value.branchCode,
|
||||
companyId: auth?.mUserMCompanyID,
|
||||
date: deliveryState.value.toString(),
|
||||
regionalId: selectedRegional.value.regionalId,
|
||||
regionalName:
|
||||
selectedRegional.value.regionalName,
|
||||
destinationName:
|
||||
selectedDestination.value.branchName,
|
||||
destinationId:
|
||||
selectedDestination.value.branchId,
|
||||
noRef: noRefCtr.text,
|
||||
noResi: noResiCtr.text,
|
||||
note: noteCtr.text,
|
||||
staffId: auth?.mUserID,
|
||||
typeName: selectedDeliveryType.value.name,
|
||||
temperature: suhuBoxCtr.text,
|
||||
typeId: selectedDeliveryType.value.id),
|
||||
orderDetail: selectedOrder.value,
|
||||
token: auth?.token);
|
||||
ref.read(suratJalanProvider.state).update((state) => 2);
|
||||
print(jsonEncode(tempSuratJalan));
|
||||
// kamu liat ntar value nya jadi berapa
|
||||
// print();
|
||||
},
|
||||
child: Text('Selanjutnya',
|
||||
style: Constant.body3_600(context: context)
|
||||
.copyWith(color: Constant.textWhite))),
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
65
lib/screen/surat_jalan/get_delivery_type_provider.dart
Normal file
65
lib/screen/surat_jalan/get_delivery_type_provider.dart
Normal file
@@ -0,0 +1,65 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:mitra_corporate/model/delivery_type_model.dart';
|
||||
import 'package:mitra_corporate/repository/surat_jalan_repository.dart';
|
||||
|
||||
import '../../provider/dio_provider.dart';
|
||||
import '../../repository/base_repository.dart';
|
||||
|
||||
abstract class GetDeliveryTypeState extends Equatable {
|
||||
final DateTime date;
|
||||
const GetDeliveryTypeState(this.date);
|
||||
@override
|
||||
List<Object?> get props => [date];
|
||||
}
|
||||
|
||||
class GetDeliveryTypeStateInit extends GetDeliveryTypeState {
|
||||
GetDeliveryTypeStateInit() : super(DateTime.now());
|
||||
}
|
||||
|
||||
class GetDeliveryTypeStateLoading extends GetDeliveryTypeState {
|
||||
GetDeliveryTypeStateLoading() : super(DateTime.now());
|
||||
}
|
||||
|
||||
class GetDeliveryTypeStateError extends GetDeliveryTypeState {
|
||||
final String message;
|
||||
GetDeliveryTypeStateError({
|
||||
required this.message,
|
||||
}) : super(DateTime.now());
|
||||
}
|
||||
|
||||
class GetDeliveryTypeStateDone extends GetDeliveryTypeState {
|
||||
final List<DeliveryTypeModel> model;
|
||||
GetDeliveryTypeStateDone({
|
||||
required this.model,
|
||||
}) : super(DateTime.now());
|
||||
}
|
||||
|
||||
//notifier
|
||||
class GetDeliveryTypeNotifier extends StateNotifier<GetDeliveryTypeState> {
|
||||
final Ref ref;
|
||||
GetDeliveryTypeNotifier({
|
||||
required this.ref,
|
||||
}) : super(GetDeliveryTypeStateInit());
|
||||
|
||||
void getData({required String token}) async {
|
||||
try {
|
||||
state = GetDeliveryTypeStateLoading();
|
||||
final dio = ref.read(dioProvider);
|
||||
final resp =
|
||||
await SuratJalanRepository(dio: dio).getDeliveryType(token: token);
|
||||
state = GetDeliveryTypeStateDone(model: resp);
|
||||
} catch (e) {
|
||||
if (e is BaseRepositoryException) {
|
||||
state = GetDeliveryTypeStateError(message: e.message.toString());
|
||||
} else {
|
||||
state = GetDeliveryTypeStateError(message: e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//provider
|
||||
final GetDeliveryTypeProvider =
|
||||
StateNotifierProvider<GetDeliveryTypeNotifier, GetDeliveryTypeState>(
|
||||
(ref) => GetDeliveryTypeNotifier(ref: ref));
|
||||
65
lib/screen/surat_jalan/get_destination_provider.dart
Normal file
65
lib/screen/surat_jalan/get_destination_provider.dart
Normal file
@@ -0,0 +1,65 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:mitra_corporate/repository/surat_jalan_repository.dart';
|
||||
|
||||
import '../../model/destination_model.dart';
|
||||
import '../../provider/dio_provider.dart';
|
||||
import '../../repository/base_repository.dart';
|
||||
|
||||
abstract class GetDestinationState extends Equatable {
|
||||
final DateTime date;
|
||||
const GetDestinationState(this.date);
|
||||
@override
|
||||
List<Object?> get props => [date];
|
||||
}
|
||||
|
||||
class GetDestinationStateInit extends GetDestinationState {
|
||||
GetDestinationStateInit() : super(DateTime.now());
|
||||
}
|
||||
|
||||
class GetDestinationStateLoading extends GetDestinationState {
|
||||
GetDestinationStateLoading() : super(DateTime.now());
|
||||
}
|
||||
|
||||
class GetDestinationStateError extends GetDestinationState {
|
||||
final String message;
|
||||
GetDestinationStateError({
|
||||
required this.message,
|
||||
}) : super(DateTime.now());
|
||||
}
|
||||
|
||||
class GetDestinationStateDone extends GetDestinationState {
|
||||
final List<DestinationModel> model;
|
||||
GetDestinationStateDone({
|
||||
required this.model,
|
||||
}) : super(DateTime.now());
|
||||
}
|
||||
|
||||
//notifier
|
||||
class GetDestinationNotifier extends StateNotifier<GetDestinationState> {
|
||||
final Ref ref;
|
||||
GetDestinationNotifier({
|
||||
required this.ref,
|
||||
}) : super(GetDestinationStateInit());
|
||||
|
||||
void getData({required String token}) async {
|
||||
try {
|
||||
state = GetDestinationStateLoading();
|
||||
final dio = ref.read(dioProvider);
|
||||
final resp =
|
||||
await SuratJalanRepository(dio: dio).getDestination(token: token);
|
||||
state = GetDestinationStateDone(model: resp);
|
||||
} catch (e) {
|
||||
if (e is BaseRepositoryException) {
|
||||
state = GetDestinationStateError(message: e.message.toString());
|
||||
} else {
|
||||
state = GetDestinationStateError(message: e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//provider
|
||||
final GetDestinationProvider =
|
||||
StateNotifierProvider<GetDestinationNotifier, GetDestinationState>(
|
||||
(ref) => GetDestinationNotifier(ref: ref));
|
||||
68
lib/screen/surat_jalan/get_order_list_provider.dart
Normal file
68
lib/screen/surat_jalan/get_order_list_provider.dart
Normal file
@@ -0,0 +1,68 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:mitra_corporate/model/order_model.dart';
|
||||
import 'package:mitra_corporate/repository/surat_jalan_repository.dart';
|
||||
|
||||
import '../../provider/dio_provider.dart';
|
||||
import '../../repository/base_repository.dart';
|
||||
|
||||
abstract class GetOrderListState extends Equatable {
|
||||
final DateTime date;
|
||||
const GetOrderListState(this.date);
|
||||
@override
|
||||
List<Object?> get props => [date];
|
||||
}
|
||||
|
||||
class GetOrderListStateInit extends GetOrderListState {
|
||||
GetOrderListStateInit() : super(DateTime.now());
|
||||
}
|
||||
|
||||
class GetOrderListStateLoading extends GetOrderListState {
|
||||
GetOrderListStateLoading() : super(DateTime.now());
|
||||
}
|
||||
|
||||
class GetOrderListStateError extends GetOrderListState {
|
||||
final String message;
|
||||
GetOrderListStateError({
|
||||
required this.message,
|
||||
}) : super(DateTime.now());
|
||||
}
|
||||
|
||||
class GetOrderListStateDone extends GetOrderListState {
|
||||
final List<OrderModel> model;
|
||||
GetOrderListStateDone({
|
||||
required this.model,
|
||||
}) : super(DateTime.now());
|
||||
}
|
||||
|
||||
//notifier
|
||||
class GetOrderListNotifier extends StateNotifier<GetOrderListState> {
|
||||
final Ref ref;
|
||||
GetOrderListNotifier({
|
||||
required this.ref,
|
||||
}) : super(GetOrderListStateInit());
|
||||
|
||||
void getData(
|
||||
{required String token,
|
||||
required String company_id,
|
||||
required String regional_id}) async {
|
||||
try {
|
||||
state = GetOrderListStateLoading();
|
||||
final dio = ref.read(dioProvider);
|
||||
final resp = await SuratJalanRepository(dio: dio).getOrder(
|
||||
token: token, company_id: company_id, regional_id: regional_id);
|
||||
state = GetOrderListStateDone(model: resp);
|
||||
} catch (e) {
|
||||
if (e is BaseRepositoryException) {
|
||||
state = GetOrderListStateError(message: e.message.toString());
|
||||
} else {
|
||||
state = GetOrderListStateError(message: e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//provider
|
||||
final GetOrderListProvider =
|
||||
StateNotifierProvider<GetOrderListNotifier, GetOrderListState>(
|
||||
(ref) => GetOrderListNotifier(ref: ref));
|
||||
66
lib/screen/surat_jalan/get_regional_provider.dart
Normal file
66
lib/screen/surat_jalan/get_regional_provider.dart
Normal file
@@ -0,0 +1,66 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:mitra_corporate/model/registration_filter_model.dart';
|
||||
|
||||
import 'package:mitra_corporate/repository/surat_jalan_repository.dart';
|
||||
|
||||
import '../../provider/dio_provider.dart';
|
||||
import '../../repository/base_repository.dart';
|
||||
|
||||
abstract class GetRegionalState extends Equatable {
|
||||
final DateTime date;
|
||||
const GetRegionalState(this.date);
|
||||
@override
|
||||
List<Object?> get props => [date];
|
||||
}
|
||||
|
||||
class GetRegionalStateInit extends GetRegionalState {
|
||||
GetRegionalStateInit() : super(DateTime.now());
|
||||
}
|
||||
|
||||
class GetRegionalStateLoading extends GetRegionalState {
|
||||
GetRegionalStateLoading() : super(DateTime.now());
|
||||
}
|
||||
|
||||
class GetRegionalStateError extends GetRegionalState {
|
||||
final String message;
|
||||
GetRegionalStateError({
|
||||
required this.message,
|
||||
}) : super(DateTime.now());
|
||||
}
|
||||
|
||||
class GetRegionalStateDone extends GetRegionalState {
|
||||
final List<RegionalModel> model;
|
||||
GetRegionalStateDone({
|
||||
required this.model,
|
||||
}) : super(DateTime.now());
|
||||
}
|
||||
|
||||
//notifier
|
||||
class GetRegionalNotifier extends StateNotifier<GetRegionalState> {
|
||||
final Ref ref;
|
||||
GetRegionalNotifier({
|
||||
required this.ref,
|
||||
}) : super(GetRegionalStateInit());
|
||||
|
||||
void getRegional({required String token}) async {
|
||||
try {
|
||||
state = GetRegionalStateLoading();
|
||||
final dio = ref.read(dioProvider);
|
||||
final resp =
|
||||
await SuratJalanRepository(dio: dio).getRegional(token: token);
|
||||
state = GetRegionalStateDone(model: resp);
|
||||
} catch (e) {
|
||||
if (e is BaseRepositoryException) {
|
||||
state = GetRegionalStateError(message: e.message.toString());
|
||||
} else {
|
||||
state = GetRegionalStateError(message: e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//provider
|
||||
final GetRegionalProvider =
|
||||
StateNotifierProvider<GetRegionalNotifier, GetRegionalState>(
|
||||
(ref) => GetRegionalNotifier(ref: ref));
|
||||
66
lib/screen/surat_jalan/get_surat_jalan_detail_provider.dart
Normal file
66
lib/screen/surat_jalan/get_surat_jalan_detail_provider.dart
Normal file
@@ -0,0 +1,66 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:mitra_corporate/model/surat_jalan_detail_model.dart';
|
||||
import 'package:mitra_corporate/repository/surat_jalan_repository.dart';
|
||||
|
||||
import '../../provider/dio_provider.dart';
|
||||
import '../../repository/base_repository.dart';
|
||||
|
||||
abstract class GetSuratJalanDetailState extends Equatable {
|
||||
final DateTime date;
|
||||
const GetSuratJalanDetailState(this.date);
|
||||
@override
|
||||
List<Object?> get props => [date];
|
||||
}
|
||||
|
||||
class GetSuratJalanDetailStateInit extends GetSuratJalanDetailState {
|
||||
GetSuratJalanDetailStateInit() : super(DateTime.now());
|
||||
}
|
||||
|
||||
class GetSuratJalanDetailStateLoading extends GetSuratJalanDetailState {
|
||||
GetSuratJalanDetailStateLoading() : super(DateTime.now());
|
||||
}
|
||||
|
||||
class GetSuratJalanDetailStateError extends GetSuratJalanDetailState {
|
||||
final String message;
|
||||
GetSuratJalanDetailStateError({
|
||||
required this.message,
|
||||
}) : super(DateTime.now());
|
||||
}
|
||||
|
||||
class GetSuratJalanDetailStateDone extends GetSuratJalanDetailState {
|
||||
final List<SuratJalanDetailModel> model;
|
||||
GetSuratJalanDetailStateDone({
|
||||
required this.model,
|
||||
}) : super(DateTime.now());
|
||||
}
|
||||
|
||||
//notifier
|
||||
class GetSuratJalanDetailNotifier
|
||||
extends StateNotifier<GetSuratJalanDetailState> {
|
||||
final Ref ref;
|
||||
GetSuratJalanDetailNotifier({
|
||||
required this.ref,
|
||||
}) : super(GetSuratJalanDetailStateInit());
|
||||
|
||||
void getData({required String token, required String deliveryID}) async {
|
||||
try {
|
||||
state = GetSuratJalanDetailStateLoading();
|
||||
final dio = ref.read(dioProvider);
|
||||
final resp = await SuratJalanRepository(dio: dio)
|
||||
.getSuratJalanSetail(token: token, deliveryID: deliveryID);
|
||||
state = GetSuratJalanDetailStateDone(model: resp);
|
||||
} catch (e) {
|
||||
if (e is BaseRepositoryException) {
|
||||
state = GetSuratJalanDetailStateError(message: e.message.toString());
|
||||
} else {
|
||||
state = GetSuratJalanDetailStateError(message: e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//provider
|
||||
final GetSuratJalanDetailProvider = StateNotifierProvider<
|
||||
GetSuratJalanDetailNotifier,
|
||||
GetSuratJalanDetailState>((ref) => GetSuratJalanDetailNotifier(ref: ref));
|
||||
81
lib/screen/surat_jalan/get_surat_jalan_list_provider.dart
Normal file
81
lib/screen/surat_jalan/get_surat_jalan_list_provider.dart
Normal file
@@ -0,0 +1,81 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:mitra_corporate/model/surat_jalan_model.dart';
|
||||
import 'package:mitra_corporate/repository/surat_jalan_repository.dart';
|
||||
|
||||
import '../../provider/dio_provider.dart';
|
||||
import '../../repository/base_repository.dart';
|
||||
|
||||
abstract class GetSuratJalanListState extends Equatable {
|
||||
final DateTime date;
|
||||
const GetSuratJalanListState(this.date);
|
||||
@override
|
||||
List<Object?> get props => [date];
|
||||
}
|
||||
|
||||
class GetSuratJalanListStateInit extends GetSuratJalanListState {
|
||||
GetSuratJalanListStateInit() : super(DateTime.now());
|
||||
}
|
||||
|
||||
class GetSuratJalanListStateLoading extends GetSuratJalanListState {
|
||||
GetSuratJalanListStateLoading() : super(DateTime.now());
|
||||
}
|
||||
|
||||
class GetSuratJalanListStateError extends GetSuratJalanListState {
|
||||
final String message;
|
||||
GetSuratJalanListStateError({
|
||||
required this.message,
|
||||
}) : super(DateTime.now());
|
||||
}
|
||||
|
||||
class GetSuratJalanListStateDone extends GetSuratJalanListState {
|
||||
final SearchSuratJalanModel model;
|
||||
GetSuratJalanListStateDone({
|
||||
required this.model,
|
||||
}) : super(DateTime.now());
|
||||
}
|
||||
|
||||
//notifier
|
||||
class GetSuratJalanListNotifier extends StateNotifier<GetSuratJalanListState> {
|
||||
final Ref ref;
|
||||
GetSuratJalanListNotifier({
|
||||
required this.ref,
|
||||
}) : super(GetSuratJalanListStateInit());
|
||||
|
||||
void getData({
|
||||
required String token,
|
||||
required String company_id,
|
||||
required String rpp,
|
||||
required String keyword,
|
||||
required String page,
|
||||
required String sd,
|
||||
required String ed,
|
||||
required String dateType,
|
||||
}) async {
|
||||
try {
|
||||
state = GetSuratJalanListStateLoading();
|
||||
final dio = ref.read(dioProvider);
|
||||
final resp = await SuratJalanRepository(dio: dio).getSuratJalan(
|
||||
token: token,
|
||||
company_id: company_id,
|
||||
endDate: ed,
|
||||
startDate: sd,
|
||||
rpp: rpp,
|
||||
keyword: keyword,
|
||||
dateType: dateType,
|
||||
page: page);
|
||||
state = GetSuratJalanListStateDone(model: resp);
|
||||
} catch (e) {
|
||||
if (e is BaseRepositoryException) {
|
||||
state = GetSuratJalanListStateError(message: e.message.toString());
|
||||
} else {
|
||||
state = GetSuratJalanListStateError(message: e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//provider
|
||||
final GetSuratJalanListProvider =
|
||||
StateNotifierProvider<GetSuratJalanListNotifier, GetSuratJalanListState>(
|
||||
(ref) => GetSuratJalanListNotifier(ref: ref));
|
||||
247
lib/screen/surat_jalan/list_pasien_terpilih.dart
Normal file
247
lib/screen/surat_jalan/list_pasien_terpilih.dart
Normal file
@@ -0,0 +1,247 @@
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:eva_icons_flutter/eva_icons_flutter.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:mitra_corporate/model/order_model.dart';
|
||||
import 'package:loading_animation_widget/loading_animation_widget.dart';
|
||||
|
||||
import '../../app/constant.dart';
|
||||
|
||||
class ListPasienTerpilih extends HookConsumerWidget {
|
||||
const ListPasienTerpilih(
|
||||
{super.key,
|
||||
required this.orders,
|
||||
required this.loading,
|
||||
required this.unselect});
|
||||
final List<OrderModel> orders;
|
||||
final bool loading;
|
||||
final Function unselect;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final scrollCtr = useScrollController();
|
||||
return Material(
|
||||
child: Container(
|
||||
width: Constant.getActualX(context: context, x: 585),
|
||||
height: Constant.getActualY(context: context, y: 410),
|
||||
color: Colors.white,
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.only(
|
||||
left: Constant.getActualX(context: context, x: 12)),
|
||||
alignment: Alignment.centerLeft,
|
||||
width: Constant.getActualX(context: context, x: 180),
|
||||
height: Constant.getActualY(context: context, y: 64),
|
||||
color: Constant.grey_200,
|
||||
child: Text('No Registrasi / Nama',
|
||||
style: Constant.body3_600(context: context)
|
||||
.copyWith(color: Constant.textGrey)),
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.only(
|
||||
left: Constant.getActualX(context: context, x: 12)),
|
||||
alignment: Alignment.centerLeft,
|
||||
width: Constant.getActualX(context: context, x: 325),
|
||||
height: Constant.getActualY(context: context, y: 64),
|
||||
color: Constant.grey_200,
|
||||
child: Text('Pemeriksaan',
|
||||
style: Constant.body3_600(context: context)
|
||||
.copyWith(color: Constant.textGrey)),
|
||||
),
|
||||
// Container(
|
||||
// padding: EdgeInsets.only(
|
||||
// left: Constant.getActualX(context: context, x: 12)),
|
||||
// alignment: Alignment.centerLeft,
|
||||
// width: Constant.getActualX(context: context, x: 200),
|
||||
// height: Constant.getActualY(context: context, y: 64),
|
||||
// color: Constant.grey_200,
|
||||
// child: Text('Jenis Specimen',
|
||||
// style: Constant.body3_600(context: context)
|
||||
// .copyWith(color: Constant.textGrey)),
|
||||
// ),
|
||||
Container(
|
||||
padding: EdgeInsets.only(
|
||||
left: Constant.getActualX(context: context, x: 12)),
|
||||
alignment: Alignment.centerLeft,
|
||||
width: Constant.getActualX(context: context, x: 80),
|
||||
height: Constant.getActualY(context: context, y: 64),
|
||||
color: Constant.grey_200,
|
||||
child: Text('Aksi',
|
||||
style: Constant.body3_600(context: context)
|
||||
.copyWith(color: Constant.textGrey)),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: Constant.getActualY(context: context, y: 340),
|
||||
// color: Colors.red,
|
||||
child: loading
|
||||
? Center(
|
||||
child: LoadingAnimationWidget.discreteCircle(
|
||||
color: Constant.primaryBlue, size: 40),
|
||||
)
|
||||
: Scrollbar(
|
||||
thickness: 5,
|
||||
interactive: true,
|
||||
thumbVisibility: true,
|
||||
trackVisibility: true,
|
||||
scrollbarOrientation: ScrollbarOrientation.right,
|
||||
controller: scrollCtr,
|
||||
child: ScrollConfiguration(
|
||||
behavior: ScrollConfiguration.of(context)
|
||||
.copyWith(dragDevices: {
|
||||
PointerDeviceKind.mouse,
|
||||
PointerDeviceKind.touch,
|
||||
PointerDeviceKind.trackpad,
|
||||
PointerDeviceKind.stylus,
|
||||
PointerDeviceKind.unknown
|
||||
}),
|
||||
child: ListView(
|
||||
controller: scrollCtr,
|
||||
scrollDirection: Axis.vertical,
|
||||
children: orders
|
||||
.asMap()
|
||||
.entries
|
||||
.map(
|
||||
(e) => Container(
|
||||
padding: EdgeInsets.only(
|
||||
top: Constant.getActualY(
|
||||
context: context, y: 10),
|
||||
bottom: Constant.getActualY(
|
||||
context: context, y: 10)),
|
||||
color: e.key.isOdd
|
||||
? Constant.primaryBlue
|
||||
.withOpacity(0.05)
|
||||
: Colors.white,
|
||||
margin: EdgeInsets.only(
|
||||
top: Constant.getActualY(
|
||||
context: context, y: 5),
|
||||
bottom: Constant.getActualY(
|
||||
context: context, y: 5)),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.only(
|
||||
left: Constant.getActualX(
|
||||
context: context, x: 12)),
|
||||
alignment: Alignment.centerLeft,
|
||||
width: Constant.getActualX(
|
||||
context: context, x: 180),
|
||||
height: Constant.getActualY(
|
||||
context: context, y: 64),
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(e.value.orderNumber ?? "",
|
||||
style: Constant.body3_600(
|
||||
context: context)
|
||||
.copyWith(
|
||||
color: Constant
|
||||
.textBlack)),
|
||||
Text(e.value.patientName ?? "",
|
||||
style: Constant.body3_600(
|
||||
context: context)
|
||||
.copyWith(
|
||||
color: Constant
|
||||
.textBlack))
|
||||
],
|
||||
),
|
||||
),
|
||||
// Container(
|
||||
// padding: EdgeInsets.only(
|
||||
// left: Constant.getActualX(
|
||||
// context: context, x: 12)),
|
||||
// alignment: Alignment.centerLeft,
|
||||
// width: Constant.getActualX(
|
||||
// context: context, x: 195),
|
||||
// height: Constant.getActualY(
|
||||
// context: context, y: 64),
|
||||
// color: Colors.white,
|
||||
// child: Text(e.patientName ?? "",
|
||||
// style: Constant.body3_600(
|
||||
// context: context)
|
||||
// .copyWith(
|
||||
// color: Constant
|
||||
// .textBlack)),
|
||||
// ),
|
||||
SizedBox(
|
||||
width: Constant.getActualX(
|
||||
context: context, x: 325),
|
||||
child: Wrap(
|
||||
alignment: WrapAlignment.start,
|
||||
spacing: 10,
|
||||
children: [
|
||||
if (e.value.tests!.isNotEmpty)
|
||||
...e.value.tests!
|
||||
.map((k) => Container(
|
||||
margin: EdgeInsets.only(
|
||||
bottom: Constant
|
||||
.getActualX(
|
||||
context:
|
||||
context,
|
||||
x: 10)),
|
||||
child: Chip(
|
||||
shape:
|
||||
RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius
|
||||
.all(Radius
|
||||
.circular(
|
||||
6)),
|
||||
),
|
||||
// backgroundColor:
|
||||
// Constant
|
||||
// .blue_016,
|
||||
label: Text(
|
||||
'$k '.replaceAll(
|
||||
' ',
|
||||
'\u00A0'),
|
||||
overflow:
|
||||
TextOverflow
|
||||
.ellipsis,
|
||||
style: Constant.caption2_600(
|
||||
context:
|
||||
context)
|
||||
.copyWith(
|
||||
color:
|
||||
Constant.textBlack)),
|
||||
),
|
||||
))
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
width: Constant.getActualX(
|
||||
context: context, x: 80),
|
||||
child: IconButton(
|
||||
onPressed: () {
|
||||
// print(e.orderNumber);
|
||||
unselect(e.value);
|
||||
},
|
||||
icon: Icon(
|
||||
EvaIcons.arrowCircleLeft,
|
||||
size: 24,
|
||||
color:
|
||||
Constant.primaryRed)),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
//
|
||||
));
|
||||
}
|
||||
}
|
||||
65
lib/screen/surat_jalan/send_qr_code_provider.dart
Normal file
65
lib/screen/surat_jalan/send_qr_code_provider.dart
Normal file
@@ -0,0 +1,65 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:mitra_corporate/repository/surat_jalan_repository.dart';
|
||||
|
||||
import '../../provider/dio_provider.dart';
|
||||
import '../../repository/base_repository.dart';
|
||||
|
||||
abstract class SendQrCodeState extends Equatable {
|
||||
final DateTime date;
|
||||
const SendQrCodeState(this.date);
|
||||
@override
|
||||
List<Object?> get props => [date];
|
||||
}
|
||||
|
||||
class SendQrCodeStateInit extends SendQrCodeState {
|
||||
SendQrCodeStateInit() : super(DateTime.now());
|
||||
}
|
||||
|
||||
class SendQrCodeStateLoading extends SendQrCodeState {
|
||||
SendQrCodeStateLoading() : super(DateTime.now());
|
||||
}
|
||||
|
||||
class SendQrCodeStateError extends SendQrCodeState {
|
||||
final String message;
|
||||
SendQrCodeStateError({
|
||||
required this.message,
|
||||
}) : super(DateTime.now());
|
||||
}
|
||||
|
||||
class SendQrCodeStateDone extends SendQrCodeState {
|
||||
final String model;
|
||||
SendQrCodeStateDone({
|
||||
required this.model,
|
||||
}) : super(DateTime.now());
|
||||
}
|
||||
|
||||
//notifier
|
||||
class SendQrCodeNotifier extends StateNotifier<SendQrCodeState> {
|
||||
final Ref ref;
|
||||
SendQrCodeNotifier({
|
||||
required this.ref,
|
||||
}) : super(SendQrCodeStateInit());
|
||||
|
||||
void senQrCode(
|
||||
{required String token, required List<String> arrOrderID}) async {
|
||||
try {
|
||||
state = SendQrCodeStateLoading();
|
||||
final dio = ref.read(dioProvider);
|
||||
final resp = await SuratJalanRepository(dio: dio)
|
||||
.sendQrCode(token: token, arrOrderID: arrOrderID);
|
||||
state = SendQrCodeStateDone(model: resp);
|
||||
} catch (e) {
|
||||
if (e is BaseRepositoryException) {
|
||||
state = SendQrCodeStateError(message: e.message.toString());
|
||||
} else {
|
||||
state = SendQrCodeStateError(message: e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//provider
|
||||
final SendQrCodeProvider =
|
||||
StateNotifierProvider<SendQrCodeNotifier, SendQrCodeState>(
|
||||
(ref) => SendQrCodeNotifier(ref: ref));
|
||||
65
lib/screen/surat_jalan/send_surat_jalan_provider.dart
Normal file
65
lib/screen/surat_jalan/send_surat_jalan_provider.dart
Normal file
@@ -0,0 +1,65 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
import 'package:mitra_corporate/repository/surat_jalan_repository.dart';
|
||||
|
||||
import '../../provider/dio_provider.dart';
|
||||
import '../../repository/base_repository.dart';
|
||||
|
||||
abstract class SendSuratJalanState extends Equatable {
|
||||
final DateTime date;
|
||||
const SendSuratJalanState(this.date);
|
||||
@override
|
||||
List<Object?> get props => [date];
|
||||
}
|
||||
|
||||
class SendSuratJalanStateInit extends SendSuratJalanState {
|
||||
SendSuratJalanStateInit() : super(DateTime.now());
|
||||
}
|
||||
|
||||
class SendSuratJalanStateLoading extends SendSuratJalanState {
|
||||
SendSuratJalanStateLoading() : super(DateTime.now());
|
||||
}
|
||||
|
||||
class SendSuratJalanStateError extends SendSuratJalanState {
|
||||
final String message;
|
||||
SendSuratJalanStateError({
|
||||
required this.message,
|
||||
}) : super(DateTime.now());
|
||||
}
|
||||
|
||||
class SendSuratJalanStateDone extends SendSuratJalanState {
|
||||
final String number;
|
||||
SendSuratJalanStateDone({
|
||||
required this.number,
|
||||
}) : super(DateTime.now());
|
||||
}
|
||||
|
||||
//notifier
|
||||
class SendSuratJalanNotifier extends StateNotifier<SendSuratJalanState> {
|
||||
final Ref ref;
|
||||
SendSuratJalanNotifier({
|
||||
required this.ref,
|
||||
}) : super(SendSuratJalanStateInit());
|
||||
|
||||
void Send({required String token, required String deliveryID}) async {
|
||||
try {
|
||||
state = SendSuratJalanStateLoading();
|
||||
final dio = ref.read(dioProvider);
|
||||
final resp = await SuratJalanRepository(dio: dio)
|
||||
.sendSuratJalan(token: token, deliveryID: deliveryID);
|
||||
state = SendSuratJalanStateDone(number: resp);
|
||||
} catch (e) {
|
||||
if (e is BaseRepositoryException) {
|
||||
state = SendSuratJalanStateError(message: e.message.toString());
|
||||
} else {
|
||||
state = SendSuratJalanStateError(message: e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//provider
|
||||
final SendSuratJalanProvider =
|
||||
StateNotifierProvider<SendSuratJalanNotifier, SendSuratJalanState>(
|
||||
(ref) => SendSuratJalanNotifier(ref: ref));
|
||||
421
lib/screen/surat_jalan/surat_jalan_confirmation.dart
Normal file
421
lib/screen/surat_jalan/surat_jalan_confirmation.dart
Normal file
@@ -0,0 +1,421 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:intl/date_symbol_data_local.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:mitra_corporate/app/constant.dart';
|
||||
import 'package:mitra_corporate/model/create_surat_jalan_model.dart';
|
||||
import 'package:mitra_corporate/provider/auth_provider.dart';
|
||||
import 'package:mitra_corporate/provider/surat_jalan_provider.dart';
|
||||
import 'package:mitra_corporate/screen/surat_jalan/create_surat_jalan_provider.dart';
|
||||
import 'package:mitra_corporate/screen/surat_jalan/dialog_send_qr.dart';
|
||||
import 'package:loading_animation_widget/loading_animation_widget.dart';
|
||||
|
||||
import '../../widgets/custom_snackbar_widget.dart';
|
||||
|
||||
class SuratJalanConfirmation extends HookConsumerWidget {
|
||||
const SuratJalanConfirmation({super.key});
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final tempSuratjalan = ref.watch(createSuratJalanProvider);
|
||||
final auth = ref.watch(authProvider);
|
||||
final date = useState("");
|
||||
final loading = useState(false);
|
||||
final number = useState("");
|
||||
|
||||
useEffect(() {
|
||||
WidgetsBinding.instance.addPostFrameCallback((timeStamp) async {
|
||||
DateTime now = DateTime.parse(tempSuratjalan.order!.date!);
|
||||
// DateTime now = DateTime.now();
|
||||
initializeDateFormatting('id', '').then((_) {
|
||||
date.value = DateFormat('EEEE, d MMMM yyyy', "id").format(now);
|
||||
print(DateFormat('EEEE, d MMMM yyyy', "id").format(now));
|
||||
});
|
||||
});
|
||||
return () {};
|
||||
}, []);
|
||||
|
||||
addOrder() {
|
||||
// print(jsonEncode(tempSuratjalan));
|
||||
// return;
|
||||
|
||||
ref.read(CreateSuratJalanProvider.notifier).addOrder(prm: tempSuratjalan);
|
||||
}
|
||||
|
||||
ref.listen(
|
||||
CreateSuratJalanProvider,
|
||||
(previous, next) {
|
||||
if (next is CreateSuratJalanStateInit) {
|
||||
loading.value = true;
|
||||
} else if (next is CreateSuratJalanStateLoading) {
|
||||
loading.value = true;
|
||||
} else if (next is CreateSuratJalanStateError) {
|
||||
SanckbarWidget(context, next.message, snackbarType.error);
|
||||
loading.value = false;
|
||||
Constant.autoLogout(context: context, msg: next.message);
|
||||
} else if (next is CreateSuratJalanStateDone) {
|
||||
// print(jsonEncode(next.model));
|
||||
number.value = next.number;
|
||||
SanckbarWidget(
|
||||
context,
|
||||
"Pengiriman order berhasil di buat ${next.number}",
|
||||
snackbarType.success);
|
||||
List<String> arrOrderID = List.empty(growable: true);
|
||||
for (var element in tempSuratjalan.orderDetail!) {
|
||||
arrOrderID.add(element.orderId!);
|
||||
}
|
||||
Navigator.pop(context);
|
||||
ref.read(createSuratJalanProvider.notifier).state =
|
||||
CreateSuratJalanModel();
|
||||
ref.read(suratJalanProvider.state).update((state) => 1);
|
||||
|
||||
showDialog<String>(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
builder: (BuildContext context) => DialogSendQr(
|
||||
arrOrderID: arrOrderID,
|
||||
orderNumber: next.number,
|
||||
),
|
||||
);
|
||||
|
||||
loading.value = false;
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
"Anda yakin dengan pengiriman order berikut ?",
|
||||
style: Constant.h4_600(context: context),
|
||||
),
|
||||
SizedBox(
|
||||
height: Constant.getActualY(context: context, y: 28),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(
|
||||
left: Constant.getActualX(context: context, x: 24)),
|
||||
child: Text(
|
||||
"Regional",
|
||||
style: Constant.body1_600(context: context)
|
||||
.copyWith(color: Constant.textGrey),
|
||||
),
|
||||
)),
|
||||
Expanded(
|
||||
flex: 9,
|
||||
child: Text(
|
||||
tempSuratjalan.order?.regionalName ?? "",
|
||||
style: Constant.body1_600(context: context),
|
||||
))
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: Constant.getActualY(context: context, y: 20),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(
|
||||
left: Constant.getActualX(context: context, x: 24)),
|
||||
child: Text(
|
||||
"Cabang",
|
||||
style: Constant.body1_600(context: context)
|
||||
.copyWith(color: Constant.textGrey),
|
||||
),
|
||||
)),
|
||||
Expanded(
|
||||
flex: 9,
|
||||
child: Text(
|
||||
tempSuratjalan.order?.destinationName ?? "",
|
||||
style: Constant.body1_600(context: context),
|
||||
))
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: Constant.getActualY(context: context, y: 20),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(
|
||||
left: Constant.getActualX(context: context, x: 24)),
|
||||
child: Text(
|
||||
"Staff PIC",
|
||||
style: Constant.body1_600(context: context)
|
||||
.copyWith(color: Constant.textGrey),
|
||||
),
|
||||
)),
|
||||
Expanded(
|
||||
flex: 9,
|
||||
child: Text(
|
||||
auth?.mUserUsername ?? "",
|
||||
style: Constant.body1_600(context: context),
|
||||
))
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: Constant.getActualY(context: context, y: 20),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(
|
||||
left: Constant.getActualX(context: context, x: 24)),
|
||||
child: Text(
|
||||
"Nomor Referensi",
|
||||
style: Constant.body1_600(context: context)
|
||||
.copyWith(color: Constant.textGrey),
|
||||
),
|
||||
)),
|
||||
Expanded(
|
||||
flex: 9,
|
||||
child: Text(
|
||||
tempSuratjalan.order?.noRef ?? "",
|
||||
style: Constant.body1_600(context: context),
|
||||
))
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: Constant.getActualY(context: context, y: 20),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(
|
||||
left: Constant.getActualX(context: context, x: 24)),
|
||||
child: Text(
|
||||
"Tanggal Kirim Order",
|
||||
style: Constant.body1_600(context: context)
|
||||
.copyWith(color: Constant.textGrey),
|
||||
),
|
||||
)),
|
||||
Expanded(
|
||||
flex: 9,
|
||||
child: Text(
|
||||
date.value,
|
||||
style: Constant.body1_600(context: context),
|
||||
))
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: Constant.getActualY(context: context, y: 20),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(
|
||||
left: Constant.getActualX(context: context, x: 24)),
|
||||
child: Text(
|
||||
"Catatan",
|
||||
style: Constant.body1_600(context: context)
|
||||
.copyWith(color: Constant.textGrey),
|
||||
),
|
||||
)),
|
||||
Expanded(
|
||||
flex: 9,
|
||||
child: Text(
|
||||
tempSuratjalan.order?.note ?? "",
|
||||
style: Constant.body1_600(context: context),
|
||||
))
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: Constant.getActualY(context: context, y: 28),
|
||||
),
|
||||
SizedBox(
|
||||
height: Constant.getActualY(context: context, y: 64),
|
||||
child: Text(
|
||||
"List Pasien Terpilih",
|
||||
style: Constant.h4_600(context: context),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
height: Constant.getActualY(context: context, y: 64),
|
||||
decoration: BoxDecoration(
|
||||
color: Constant.grey_200, borderRadius: BorderRadius.circular(8)),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(
|
||||
left: Constant.getActualX(context: context, x: 24)),
|
||||
child: Text(
|
||||
"Nomor Registrasi",
|
||||
style: Constant.body3_600(context: context)
|
||||
.copyWith(color: Constant.textGrey),
|
||||
),
|
||||
)),
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(
|
||||
left: Constant.getActualX(context: context, x: 24)),
|
||||
child: Text(
|
||||
"Nama Pasien",
|
||||
style: Constant.body3_600(context: context)
|
||||
.copyWith(color: Constant.textGrey),
|
||||
),
|
||||
)),
|
||||
Expanded(
|
||||
flex: 6,
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(
|
||||
left: Constant.getActualX(context: context, x: 24)),
|
||||
child: Text(
|
||||
"Pemeriksaan",
|
||||
style: Constant.body3_600(context: context)
|
||||
.copyWith(color: Constant.textGrey),
|
||||
),
|
||||
)),
|
||||
],
|
||||
),
|
||||
),
|
||||
...tempSuratjalan.orderDetail!.map((e) => Container(
|
||||
constraints: BoxConstraints(
|
||||
minHeight: Constant.getActualX(context: context, x: 64)),
|
||||
margin: EdgeInsets.only(
|
||||
bottom: Constant.getActualX(context: context, x: 10)),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(
|
||||
left: Constant.getActualX(context: context, x: 24)),
|
||||
child: Text(
|
||||
e.orderNumber ?? "",
|
||||
style: Constant.body3_600(context: context),
|
||||
),
|
||||
)),
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(
|
||||
left: Constant.getActualX(context: context, x: 24)),
|
||||
child: Text(
|
||||
e.patientName ?? "",
|
||||
style: Constant.body3_600(context: context),
|
||||
),
|
||||
)),
|
||||
Expanded(
|
||||
flex: 6,
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(
|
||||
left: Constant.getActualX(context: context, x: 24)),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Wrap(
|
||||
children: [
|
||||
...e.tests!.map((i) => Container(
|
||||
margin: EdgeInsets.only(
|
||||
top: Constant.getActualX(
|
||||
context: context, x: 10),
|
||||
right: Constant.getActualX(
|
||||
context: context, x: 10),
|
||||
bottom: Constant.getActualX(
|
||||
context: context, x: 10)),
|
||||
child: Chip(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(6)),
|
||||
),
|
||||
// backgroundColor:
|
||||
// Constant.grey_200,
|
||||
label: Text(
|
||||
'$i '.replaceAll(' ', '\u00A0'),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: Constant.caption1_600(
|
||||
context: context)
|
||||
.copyWith(
|
||||
color: Constant.textBlack)),
|
||||
),
|
||||
)),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
)),
|
||||
],
|
||||
),
|
||||
)),
|
||||
SizedBox(
|
||||
height: Constant.getActualY(context: context, y: 12),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: Constant.getActualY(context: context, y: 45),
|
||||
child: OutlinedButton(
|
||||
style: OutlinedButton.styleFrom(
|
||||
backgroundColor: Colors.white,
|
||||
side: BorderSide(color: Colors.grey, width: 2),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8))),
|
||||
onPressed: !loading.value
|
||||
? () {
|
||||
// ref.read(createSuratJalanProvider.notifier).state =
|
||||
// CreateSuratJalanModel();
|
||||
ref
|
||||
.read(suratJalanProvider.state)
|
||||
.update((state) => 1);
|
||||
|
||||
// Navigator.pop(context);
|
||||
}
|
||||
: null,
|
||||
child: loading.value
|
||||
? LoadingAnimationWidget.staggeredDotsWave(
|
||||
color: Constant.green, size: 20)
|
||||
: Text('Batal',
|
||||
style: Constant.body3_600(context: context)
|
||||
.copyWith(color: Constant.textBlack))),
|
||||
),
|
||||
SizedBox(width: Constant.getActualX(context: context, x: 24)),
|
||||
Container(
|
||||
height: Constant.getActualY(context: context, y: 45),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
color: Constant.green),
|
||||
child: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Constant.green,
|
||||
side: BorderSide(color: Constant.green, width: 2),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
),
|
||||
onPressed: !loading.value
|
||||
? () {
|
||||
addOrder();
|
||||
}
|
||||
: null,
|
||||
child: loading.value
|
||||
? LoadingAnimationWidget.staggeredDotsWave(
|
||||
color: Colors.white, size: 20)
|
||||
: Text('Simpan',
|
||||
style: Constant.body3_600(context: context)
|
||||
.copyWith(color: Constant.textWhite))),
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
83
lib/screen/surat_jalan/surat_jalan_detail_screen.dart
Normal file
83
lib/screen/surat_jalan/surat_jalan_detail_screen.dart
Normal file
@@ -0,0 +1,83 @@
|
||||
import 'package:eva_icons_flutter/eva_icons_flutter.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:mitra_corporate/provider/menu_provider.dart';
|
||||
import 'package:mitra_corporate/screen/surat_jalan/table_detail_surat_jalan.dart';
|
||||
|
||||
import 'package:mitra_corporate/widgets/header.dart';
|
||||
|
||||
import '../../app/constant.dart';
|
||||
import '../../provider/surat_jalan_provider.dart';
|
||||
|
||||
class SuratJalanDetailScreen extends HookConsumerWidget {
|
||||
const SuratJalanDetailScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final sjNumber = ref.watch(suratJalanNumber);
|
||||
|
||||
return Material(
|
||||
child: Column(
|
||||
children: [
|
||||
Header(),
|
||||
Container(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(32.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
ref.read(currentMenuProvider.notifier).state = 3;
|
||||
},
|
||||
icon: Icon(EvaIcons.arrowBackOutline)),
|
||||
Text('Detail Surat Jalan',
|
||||
style: Constant.h4_600(context: context)
|
||||
.copyWith(color: Constant.textBlack)),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: Constant.getActualY(context: context, y: 40),
|
||||
),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
color: Colors.white,
|
||||
),
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal:
|
||||
Constant.getActualY(context: context, y: 24),
|
||||
vertical: Constant.getActualY(context: context, y: 24)),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(children: [
|
||||
Text('Nomor Surat Jalan',
|
||||
style: Constant.body1_600(context: context)
|
||||
.copyWith(color: Constant.textBlack)),
|
||||
SizedBox(
|
||||
width:
|
||||
Constant.getActualX(context: context, x: 8)),
|
||||
Text(sjNumber,
|
||||
style: Constant.body1_600(context: context)
|
||||
.copyWith(color: Constant.primaryRed)),
|
||||
]),
|
||||
SizedBox(
|
||||
height:
|
||||
Constant.getActualY(context: context, y: 24)),
|
||||
// SizedBox(
|
||||
// height: Constant.getActualY(context: context, y: 24)),
|
||||
TableDetailSuratJalan()
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
280
lib/screen/surat_jalan/surat_jalan_screen.dart
Normal file
280
lib/screen/surat_jalan/surat_jalan_screen.dart
Normal file
@@ -0,0 +1,280 @@
|
||||
import 'package:mitra_corporate/model/surat_jalan_model.dart';
|
||||
import 'package:eva_icons_flutter/eva_icons_flutter.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:mitra_corporate/model/create_surat_jalan_model.dart';
|
||||
import 'package:mitra_corporate/provider/auth_provider.dart';
|
||||
import 'package:mitra_corporate/provider/surat_jalan_provider.dart';
|
||||
|
||||
import 'package:mitra_corporate/screen/surat_jalan/dialog_surat_jalan.dart';
|
||||
import 'package:mitra_corporate/screen/surat_jalan/table_surat_jalan.dart';
|
||||
import 'package:mitra_corporate/widgets/header.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
import '../../app/constant.dart';
|
||||
import '../../provider/menu_provider.dart';
|
||||
import '../../widgets/custom_text_field.dart';
|
||||
|
||||
class SuratJalanScreen extends HookConsumerWidget {
|
||||
const SuratJalanScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final auth = ref.watch(authProvider);
|
||||
final selectedDateType = ref.watch(sjDateType);
|
||||
final isExpand = ref.watch(sideBarExpandProvider);
|
||||
final searchCtr = useTextEditingController(text: "");
|
||||
final startDateCtr = useTextEditingController(
|
||||
text: DateFormat('dd-MM-yyyy').format(ref.watch(sjStartDateProvider)));
|
||||
final startDateState = useState(ref.watch(sjStartDateProvider));
|
||||
final endDateCtr = useTextEditingController(
|
||||
text: DateFormat('dd-MM-yyyy').format(ref.watch(sjEndDateProvider)));
|
||||
final endDateState = useState(ref.watch(sjEndDateProvider));
|
||||
|
||||
final dateFilterKey = useState(1);
|
||||
|
||||
final selectedDateFilter = useState(selectedDateType);
|
||||
useEffect(() {
|
||||
// ref.read(sjDateType.notifier).state = dateFilter.first;
|
||||
selectedDateFilter.value = selectedDateType;
|
||||
dateFilterKey.value = dateFilterKey.value + 1;
|
||||
return null;
|
||||
}, [isExpand]);
|
||||
// useEffect(() {
|
||||
// selectedDateFilter.value = selectedDateType;
|
||||
// print(selectedDateType.name);
|
||||
// }, [selectedDateType]);
|
||||
|
||||
return Material(
|
||||
child: Column(
|
||||
children: [
|
||||
Header(),
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: Constant.getActualX(context: context, x: 32),
|
||||
vertical: Constant.getActualY(context: context, y: 32)),
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
// width: Constant.getActualX(context: context, x: 1079),
|
||||
height: Constant.getActualY(context: context, y: 40),
|
||||
child: Text('Kirim Order',
|
||||
style: Constant.h3_400(context: context)
|
||||
.copyWith(color: Constant.textBlack)),
|
||||
),
|
||||
SizedBox(height: Constant.getActualY(context: context, y: 42)),
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: Constant.getActualX(context: context, x: 24),
|
||||
vertical: Constant.getActualY(context: context, y: 32)),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
color: Colors.white),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(child: LayoutBuilder(builder:
|
||||
(BuildContext context,
|
||||
BoxConstraints constraints) {
|
||||
return DropdownMenu<dateFilterModel>(
|
||||
key: ValueKey(dateFilterKey.value),
|
||||
hintText: "Tipe Tanggal",
|
||||
inputDecorationTheme: InputDecorationTheme(
|
||||
border: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Constant.primaryRed),
|
||||
borderRadius: BorderRadius.circular(8))),
|
||||
menuHeight:
|
||||
Constant.getActualY(context: context, y: 300),
|
||||
// width: Constant.getActualX(context: context, x: 150),
|
||||
width: constraints.maxWidth,
|
||||
textStyle: Constant.body2_400(context: context),
|
||||
label: const Text(
|
||||
"Tipe Tanggal",
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
initialSelection: selectedDateFilter.value,
|
||||
|
||||
onSelected: (dateFilterModel? value) {
|
||||
// This is called when the user selects an item.
|
||||
// print(value!.name);
|
||||
ref.read(sjDateType.notifier).state = value!;
|
||||
selectedDateFilter.value = value;
|
||||
},
|
||||
dropdownMenuEntries: Constant.dateFilter
|
||||
.map<DropdownMenuEntry<dateFilterModel>>(
|
||||
(dateFilterModel value) {
|
||||
return DropdownMenuEntry<dateFilterModel>(
|
||||
value: value, label: value.name);
|
||||
}).toList(),
|
||||
);
|
||||
})),
|
||||
SizedBox(
|
||||
width: Constant.getActualX(context: context, x: 24),
|
||||
),
|
||||
Expanded(
|
||||
child: TextField(
|
||||
style: Constant.body1_600(context: context),
|
||||
controller: startDateCtr,
|
||||
decoration: InputDecoration(
|
||||
suffixIcon: Icon(EvaIcons.calendar),
|
||||
border: OutlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(color: Constant.primaryBlue),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
labelStyle:
|
||||
Constant.body1_600(context: context),
|
||||
labelText: "Tanggal Awal" //label text of field
|
||||
),
|
||||
readOnly: true,
|
||||
onTap: () async {
|
||||
DateTime? pickedDate = await showDatePicker(
|
||||
// locale: Locale("id"),
|
||||
confirmText: "OK",
|
||||
cancelText: "Batal",
|
||||
context: context,
|
||||
initialDate: startDateState.value,
|
||||
firstDate: DateTime(1800),
|
||||
initialEntryMode:
|
||||
DatePickerEntryMode.calendarOnly,
|
||||
|
||||
//DateTime.now() - not to allow to choose before today.
|
||||
lastDate: DateTime(2100));
|
||||
|
||||
if (pickedDate != null) {
|
||||
print(
|
||||
pickedDate); //pickedDate output format => 2021-03-10 00:00:00.000
|
||||
String formattedDate =
|
||||
DateFormat('dd-MM-yyyy').format(pickedDate);
|
||||
print(
|
||||
formattedDate); //formatted date output using intl package => 2021-03-16
|
||||
startDateCtr.text =
|
||||
formattedDate; //set output date to TextField value.
|
||||
startDateState.value = pickedDate;
|
||||
ref.read(sjStartDateProvider.notifier).state =
|
||||
pickedDate;
|
||||
} else {}
|
||||
},
|
||||
)),
|
||||
SizedBox(
|
||||
width: Constant.getActualX(context: context, x: 24),
|
||||
),
|
||||
Expanded(
|
||||
child: TextField(
|
||||
style: Constant.body1_600(context: context),
|
||||
controller: endDateCtr,
|
||||
decoration: InputDecoration(
|
||||
suffixIcon: Icon(EvaIcons.calendar),
|
||||
border: OutlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(color: Constant.primaryBlue),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
labelStyle:
|
||||
Constant.body1_600(context: context),
|
||||
labelText: "Tanggal Akhir" //label text of field
|
||||
),
|
||||
readOnly: true,
|
||||
onTap: () async {
|
||||
DateTime? pickedDate = await showDatePicker(
|
||||
// locale: Locale("id"),
|
||||
confirmText: "OK",
|
||||
cancelText: "Batal",
|
||||
context: context,
|
||||
initialDate: endDateState.value,
|
||||
firstDate: DateTime(1800),
|
||||
initialEntryMode:
|
||||
DatePickerEntryMode.calendarOnly,
|
||||
|
||||
//DateTime.now() - not to allow to choose before today.
|
||||
lastDate: DateTime(2100));
|
||||
|
||||
if (pickedDate != null) {
|
||||
print(
|
||||
pickedDate); //pickedDate output format => 2021-03-10 00:00:00.000
|
||||
String formattedDate =
|
||||
DateFormat('dd-MM-yyyy').format(pickedDate);
|
||||
print(
|
||||
formattedDate); //formatted date output using intl package => 2021-03-16
|
||||
endDateCtr.text =
|
||||
formattedDate; //set output date to TextField value.
|
||||
endDateState.value = pickedDate;
|
||||
ref.read(sjEndDateProvider.notifier).state =
|
||||
pickedDate;
|
||||
} else {}
|
||||
},
|
||||
)),
|
||||
SizedBox(
|
||||
width: Constant.getActualX(context: context, x: 24),
|
||||
),
|
||||
Expanded(
|
||||
// width: Constant.getActualX(context: context, x: 408),
|
||||
// height: Constant.getActualY(context: context, y: 56),
|
||||
child: CustomTextField(
|
||||
onChange: (value) {
|
||||
ref
|
||||
.read(suratJalankeywordProvider.notifier)
|
||||
.state = value;
|
||||
},
|
||||
controller: searchCtr,
|
||||
isPassword: false,
|
||||
hintText: "Cari No/Tujuan/Staff PIC",
|
||||
labelText: "Cari No/Tujuan/Staff PIC",
|
||||
suffixIcon: Icon(EvaIcons.search),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: Constant.getActualX(context: context, x: 24),
|
||||
),
|
||||
Container(
|
||||
// width: Constant.getActualX(context: context, x: 171),
|
||||
height:
|
||||
Constant.getActualY(context: context, y: 56),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
color: Constant.primaryRed),
|
||||
child: ElevatedButton.icon(
|
||||
label: Text('Kirim order Baru',
|
||||
style: Constant.button_large(context: context)
|
||||
.copyWith(color: Constant.textWhite)),
|
||||
icon: Icon(EvaIcons.plus,
|
||||
color: Colors.white, size: 20.0),
|
||||
onPressed: () {
|
||||
ref
|
||||
.read(createSuratJalanProvider.notifier)
|
||||
.state =
|
||||
CreateSuratJalanModel(
|
||||
order: Order(
|
||||
regionalId:
|
||||
auth?.MUserSRegionalID ?? ""));
|
||||
showDialog(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
builder: ((context) => DialogSuratJalan()));
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
shadowColor: Colors.transparent),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: Constant.getActualY(context: context, y: 24)),
|
||||
TableSuratJalan()
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
587
lib/screen/surat_jalan/table_detail_surat_jalan.dart
Normal file
587
lib/screen/surat_jalan/table_detail_surat_jalan.dart
Normal file
@@ -0,0 +1,587 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:mitra_corporate/model/surat_jalan_detail_model.dart';
|
||||
import 'package:mitra_corporate/provider/auth_provider.dart';
|
||||
import 'package:mitra_corporate/screen/surat_jalan/get_surat_jalan_detail_provider.dart';
|
||||
import 'package:loading_animation_widget/loading_animation_widget.dart';
|
||||
|
||||
import '../../app/constant.dart';
|
||||
import '../../provider/surat_jalan_provider.dart';
|
||||
import '../../widgets/custom_snackbar_widget.dart';
|
||||
|
||||
class TableDetailSuratJalan extends HookConsumerWidget {
|
||||
const TableDetailSuratJalan({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final id = ref.watch(suratJalanID);
|
||||
final auth = ref.watch(authProvider);
|
||||
final loading = useState(false);
|
||||
final data = useState<List<SuratJalanDetailModel>>(List.empty());
|
||||
useEffect(() {
|
||||
WidgetsBinding.instance.addPostFrameCallback((timeStamp) async {
|
||||
ref
|
||||
.read(GetSuratJalanDetailProvider.notifier)
|
||||
.getData(token: auth?.token ?? "", deliveryID: id);
|
||||
});
|
||||
return () {};
|
||||
}, [id]);
|
||||
ref.listen(
|
||||
GetSuratJalanDetailProvider,
|
||||
(pref, next) {
|
||||
if (next is GetSuratJalanDetailStateInit) {
|
||||
loading.value = true;
|
||||
} else if (next is GetSuratJalanDetailStateLoading) {
|
||||
loading.value = true;
|
||||
} else if (next is GetSuratJalanDetailStateError) {
|
||||
loading.value = false;
|
||||
SanckbarWidget(context, next.message, snackbarType.error);
|
||||
Constant.autoLogout(context: context, msg: next.message);
|
||||
} else if (next is GetSuratJalanDetailStateDone) {
|
||||
// print(jsonEncode(next.model));
|
||||
data.value = next.model;
|
||||
|
||||
loading.value = false;
|
||||
}
|
||||
},
|
||||
);
|
||||
return Material(
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
height: Constant.getActualY(context: context, y: 64),
|
||||
decoration: BoxDecoration(
|
||||
color: Constant.grey_200,
|
||||
border: Border(bottom: BorderSide(color: Colors.grey))),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
// width: Constant.getActualX(context: context, x: 100),
|
||||
height: Constant.getActualY(context: context, y: 64),
|
||||
color: Constant.grey_200,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 12, bottom: 12, left: 20, right: 20),
|
||||
child: Text('Tanggal',
|
||||
style: Constant.body3_600(context: context)
|
||||
.copyWith(color: Constant.textGrey)),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
// width: Constant.getActualX(context: context, x: 115),
|
||||
height: Constant.getActualY(context: context, y: 64),
|
||||
color: Constant.grey_200,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 12, bottom: 12, left: 20, right: 20),
|
||||
child: Text('No Lab',
|
||||
style: Constant.body3_600(context: context)
|
||||
.copyWith(color: Constant.textGrey)),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
// width: Constant.getActualX(context: context, x: 196),
|
||||
height: Constant.getActualY(context: context, y: 64),
|
||||
color: Constant.grey_200,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 12, bottom: 12, left: 20, right: 20),
|
||||
child: Text('Nama Pasien',
|
||||
style: Constant.body3_600(context: context)
|
||||
.copyWith(color: Constant.textGrey)),
|
||||
),
|
||||
),
|
||||
),
|
||||
// Expanded(
|
||||
// flex: 1,
|
||||
// child: Container(
|
||||
// alignment: Alignment.centerLeft,
|
||||
// // width: Constant.getActualX(context: context, x: 100),
|
||||
// height: Constant.getActualY(context: context, y: 64),
|
||||
// color: Constant.grey_200,
|
||||
// child: Padding(
|
||||
// padding: const EdgeInsets.only(
|
||||
// top: 12, bottom: 12, left: 20, right: 20),
|
||||
// child: Text('Dikirim',
|
||||
// overflow: TextOverflow.ellipsis,
|
||||
// style: Constant.body3_600(context: context)
|
||||
// .copyWith(color: Constant.textGrey)),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// Expanded(
|
||||
// flex: 1,
|
||||
// child: Container(
|
||||
// alignment: Alignment.centerLeft,
|
||||
// // width: Constant.getActualX(context: context, x: 100),
|
||||
// height: Constant.getActualY(context: context, y: 64),
|
||||
// color: Constant.grey_200,
|
||||
// child: Padding(
|
||||
// padding: const EdgeInsets.only(
|
||||
// top: 12, bottom: 12, left: 20, right: 20),
|
||||
// child: Text('Diterima',
|
||||
// overflow: TextOverflow.ellipsis,
|
||||
// style: Constant.body3_600(context: context)
|
||||
// .copyWith(color: Constant.textGrey)),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// Expanded(
|
||||
// flex: 1,
|
||||
// child: Container(
|
||||
// alignment: Alignment.centerLeft,
|
||||
// // width: Constant.getActualX(context: context, x: 100),
|
||||
// height: Constant.getActualY(context: context, y: 64),
|
||||
// color: Constant.grey_200,
|
||||
// child: Padding(
|
||||
// padding: const EdgeInsets.only(
|
||||
// top: 12, bottom: 12, left: 20, right: 20),
|
||||
// child: Text('Ditolak',
|
||||
// overflow: TextOverflow.ellipsis,
|
||||
// style: Constant.body3_600(context: context)
|
||||
// .copyWith(color: Constant.textGrey)),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// Expanded(
|
||||
// flex: 1,
|
||||
// child: Container(
|
||||
// alignment: Alignment.centerLeft,
|
||||
// // width: Constant.getActualX(context: context, x: 100),
|
||||
// height: Constant.getActualY(context: context, y: 64),
|
||||
// color: Constant.grey_200,
|
||||
// child: Padding(
|
||||
// padding: const EdgeInsets.only(
|
||||
// top: 12, bottom: 12, left: 20, right: 20),
|
||||
// child: Text('Proses',
|
||||
// overflow: TextOverflow.ellipsis,
|
||||
// style: Constant.body3_600(context: context)
|
||||
// .copyWith(color: Constant.textGrey)),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// Expanded(
|
||||
// flex: 1,
|
||||
// child: Container(
|
||||
// alignment: Alignment.centerLeft,
|
||||
// // width: Constant.getActualX(context: context, x: 100),
|
||||
// height: Constant.getActualY(context: context, y: 64),
|
||||
// color: Constant.grey_200,
|
||||
// child: Padding(
|
||||
// padding: const EdgeInsets.only(
|
||||
// top: 12, bottom: 12, left: 20, right: 20),
|
||||
// child: Text('Selesai',
|
||||
// overflow: TextOverflow.ellipsis,
|
||||
// style: Constant.body3_600(context: context)
|
||||
// .copyWith(color: Constant.textGrey)),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// Expanded(
|
||||
// flex: 1,
|
||||
// child: Container(
|
||||
// alignment: Alignment.centerLeft,
|
||||
// // width: Constant.getActualX(context: context, x: 80),
|
||||
// height: Constant.getActualY(context: context, y: 64),
|
||||
// color: Constant.grey_200,
|
||||
// child: Padding(
|
||||
// padding: const EdgeInsets.only(
|
||||
// top: 12, bottom: 12, left: 20, right: 20),
|
||||
// child: Text('Aksi',
|
||||
// overflow: TextOverflow.ellipsis,
|
||||
// style: Constant.body3_600(context: context)
|
||||
// .copyWith(color: Constant.textGrey)),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
height: Constant.getActualY(context: context, y: 580),
|
||||
color: Colors.white,
|
||||
child: loading.value
|
||||
? Center(
|
||||
child: LoadingAnimationWidget.discreteCircle(
|
||||
color: Constant.primaryBlue, size: 40),
|
||||
)
|
||||
: ListView(
|
||||
children: data.value
|
||||
.map(
|
||||
(e) => Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
// width: Constant.getActualX(context: context, x: 100),
|
||||
height: Constant.getActualY(
|
||||
context: context, y: 64),
|
||||
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 12,
|
||||
bottom: 12,
|
||||
left: 20,
|
||||
right: 20),
|
||||
child: Text(e.date ?? "",
|
||||
style:
|
||||
Constant.body3_600(context: context)
|
||||
.copyWith(
|
||||
color: Constant.textBlack)),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
width: Constant.getActualX(
|
||||
context: context, x: 115),
|
||||
height: Constant.getActualY(
|
||||
context: context, y: 64),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 12,
|
||||
bottom: 12,
|
||||
left: 20,
|
||||
right: 20),
|
||||
child: Text(e.orderNumber ?? "",
|
||||
style:
|
||||
Constant.body3_600(context: context)
|
||||
.copyWith(
|
||||
color: Constant.textBlack)),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
width: Constant.getActualX(
|
||||
context: context, x: 196),
|
||||
height: Constant.getActualY(
|
||||
context: context, y: 64),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 12,
|
||||
bottom: 12,
|
||||
left: 20,
|
||||
right: 20),
|
||||
child: Text(e.patientName ?? "",
|
||||
style:
|
||||
Constant.body3_600(context: context)
|
||||
.copyWith(
|
||||
color: Constant.textBlack)),
|
||||
),
|
||||
),
|
||||
),
|
||||
// Expanded(
|
||||
// flex: 1,
|
||||
// child: Container(
|
||||
// alignment: Alignment.centerLeft,
|
||||
// width: Constant.getActualX(
|
||||
// context: context, x: 100),
|
||||
// height: Constant.getActualY(
|
||||
// context: context, y: 64),
|
||||
// child: Padding(
|
||||
// padding: const EdgeInsets.only(
|
||||
// top: 12,
|
||||
// bottom: 12,
|
||||
// left: 20,
|
||||
// right: 20),
|
||||
// child: e.status == "S" ||
|
||||
// e.status == "R" ||
|
||||
// e.status == "T" ||
|
||||
// e.status == "X" ||
|
||||
// e.status == "P" ||
|
||||
// e.status == "Q" ||
|
||||
// e.status == "D"
|
||||
// ? Icon(
|
||||
// EvaIcons.checkmarkCircle2,
|
||||
// size: 24,
|
||||
// color: Constant.green,
|
||||
// )
|
||||
// : null),
|
||||
// ),
|
||||
// ),
|
||||
// Expanded(
|
||||
// flex: 1,
|
||||
// child: Container(
|
||||
// alignment: Alignment.centerLeft,
|
||||
// width: Constant.getActualX(
|
||||
// context: context, x: 100),
|
||||
// height: Constant.getActualY(
|
||||
// context: context, y: 64),
|
||||
// child: Padding(
|
||||
// padding: const EdgeInsets.only(
|
||||
// top: 12,
|
||||
// bottom: 12,
|
||||
// left: 20,
|
||||
// right: 20),
|
||||
// child: e.status == "R" ||
|
||||
// e.status == "T" ||
|
||||
// e.status == "P" ||
|
||||
// e.status == "Q" ||
|
||||
// e.status == "D"
|
||||
// ? JustTheTooltip(
|
||||
// preferredDirection:
|
||||
// AxisDirection.up,
|
||||
// backgroundColor:
|
||||
// Constant.textGrey,
|
||||
// elevation: 10,
|
||||
// content: Padding(
|
||||
// padding: EdgeInsets.all(10),
|
||||
// child:
|
||||
// Builder(builder: (context) {
|
||||
// List<Map<String, String>>
|
||||
// accepted = List.empty(
|
||||
// growable: true);
|
||||
// if (e.acceptedSample !=
|
||||
// null) {
|
||||
// var splt = e.acceptedSample
|
||||
// ?.split('|');
|
||||
// if (splt!.length > 0) {
|
||||
// splt.forEach((element) {
|
||||
// var splitted =
|
||||
// element.split('@');
|
||||
// accepted.add({
|
||||
// "name": splitted[0],
|
||||
// "type": splitted[1]
|
||||
// });
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
// return Wrap(
|
||||
// spacing: 10,
|
||||
// runSpacing: 10,
|
||||
// children: accepted
|
||||
// .map((e) => Chip(
|
||||
// backgroundColor: e[
|
||||
// 'type'] ==
|
||||
// "S"
|
||||
// ? Constant
|
||||
// .yellow_016
|
||||
// : Constant
|
||||
// .blue_016,
|
||||
// label: Text(
|
||||
// e['name'] ?? "",
|
||||
// style: Constant
|
||||
// .caption2_600(
|
||||
// context:
|
||||
// context)
|
||||
// .copyWith(
|
||||
// color: e['type'] ==
|
||||
// "S"
|
||||
// ? Constant
|
||||
// .textYellow
|
||||
// : Constant
|
||||
// .textBlue),
|
||||
// )))
|
||||
// .toList(),
|
||||
// );
|
||||
// }),
|
||||
// ),
|
||||
// child: Icon(
|
||||
// EvaIcons.checkmarkCircle2,
|
||||
// size: 24,
|
||||
// color: Constant.green,
|
||||
// ),
|
||||
// )
|
||||
// : null),
|
||||
// ),
|
||||
// ),
|
||||
// Expanded(
|
||||
// flex: 1,
|
||||
// child: Container(
|
||||
// alignment: Alignment.centerLeft,
|
||||
// width: Constant.getActualX(
|
||||
// context: context, x: 100),
|
||||
// height: Constant.getActualY(
|
||||
// context: context, y: 64),
|
||||
// child: Padding(
|
||||
// padding: const EdgeInsets.only(
|
||||
// top: 12,
|
||||
// bottom: 12,
|
||||
// left: 20,
|
||||
// right: 20),
|
||||
// child: e.status == "T" || e.status == "X"
|
||||
// ? JustTheTooltip(
|
||||
// preferredDirection:
|
||||
// AxisDirection.up,
|
||||
// backgroundColor: Constant.textGrey,
|
||||
// elevation: 10,
|
||||
// content: Padding(
|
||||
// padding: EdgeInsets.all(10),
|
||||
// child:
|
||||
// Builder(builder: (context) {
|
||||
// List<Map<String, String>>
|
||||
// rejected =
|
||||
// List.empty(growable: true);
|
||||
// if (e.rejectedSample != null) {
|
||||
// var splt = e.rejectedSample
|
||||
// ?.split('|');
|
||||
// if (splt!.length > 0) {
|
||||
// splt.forEach((element) {
|
||||
// var splitted =
|
||||
// element.split('@');
|
||||
// rejected.add({
|
||||
// "name": splitted[0],
|
||||
// "type": splitted[1]
|
||||
// });
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
// return Wrap(
|
||||
// spacing: 10,
|
||||
// runSpacing: 10,
|
||||
// children: rejected
|
||||
// .map((e) => Chip(
|
||||
// backgroundColor: e[
|
||||
// 'type'] ==
|
||||
// "S"
|
||||
// ? Constant
|
||||
// .yellow_016
|
||||
// : Constant
|
||||
// .blue_016,
|
||||
// label: Text(
|
||||
// e['name'] ?? "",
|
||||
// style: Constant
|
||||
// .caption2_600(
|
||||
// context:
|
||||
// context)
|
||||
// .copyWith(
|
||||
// color: e[
|
||||
// 'type'] ==
|
||||
// "S"
|
||||
// ? Constant
|
||||
// .textYellow
|
||||
// : Constant
|
||||
// .textBlue),
|
||||
// )))
|
||||
// .toList(),
|
||||
// );
|
||||
// }),
|
||||
// ),
|
||||
// child: Icon(
|
||||
// EvaIcons.checkmarkCircle2,
|
||||
// size: 24,
|
||||
// color: Constant.green,
|
||||
// ),
|
||||
// )
|
||||
// : null,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// Expanded(
|
||||
// flex: 1,
|
||||
// child: Container(
|
||||
// alignment: Alignment.centerLeft,
|
||||
// width: Constant.getActualX(
|
||||
// context: context, x: 100),
|
||||
// height: Constant.getActualY(
|
||||
// context: context, y: 64),
|
||||
// child: Padding(
|
||||
// padding: const EdgeInsets.only(
|
||||
// top: 12,
|
||||
// bottom: 12,
|
||||
// left: 20,
|
||||
// right: 20),
|
||||
// child: e.status == "Q" ||
|
||||
// e.status == "P" ||
|
||||
// e.status == "D"
|
||||
// ? Icon(
|
||||
// EvaIcons.checkmarkCircle2,
|
||||
// size: 24,
|
||||
// color: Constant.green,
|
||||
// )
|
||||
// : null),
|
||||
// ),
|
||||
// ),
|
||||
// Expanded(
|
||||
// flex: 1,
|
||||
// child: Container(
|
||||
// alignment: Alignment.centerLeft,
|
||||
// width: Constant.getActualX(
|
||||
// context: context, x: 100),
|
||||
// height: Constant.getActualY(
|
||||
// context: context, y: 64),
|
||||
// child: Padding(
|
||||
// padding: const EdgeInsets.only(
|
||||
// top: 12,
|
||||
// bottom: 12,
|
||||
// left: 20,
|
||||
// right: 20),
|
||||
// child: e.status == "D"
|
||||
// ? Icon(
|
||||
// EvaIcons.checkmarkCircle2,
|
||||
// size: 24,
|
||||
// color: Constant.green,
|
||||
// )
|
||||
// : null),
|
||||
// ),
|
||||
// ),
|
||||
// Expanded(
|
||||
// flex: 1,
|
||||
// child: Container(
|
||||
// alignment: Alignment.centerLeft,
|
||||
// width: Constant.getActualX(
|
||||
// context: context, x: 80),
|
||||
// height: Constant.getActualY(
|
||||
// context: context, y: 64),
|
||||
// child: Padding(
|
||||
// padding: const EdgeInsets.only(
|
||||
// top: 12,
|
||||
// bottom: 12,
|
||||
// left: 20,
|
||||
// right: 20),
|
||||
// child: InkWell(
|
||||
// onTap: e.status == "D"
|
||||
// ? () {
|
||||
// showDialog(
|
||||
// context: context,
|
||||
// // barrierDismissible: false,
|
||||
// builder: ((context) =>
|
||||
// Container(
|
||||
// child: DialogPrint(
|
||||
// url:
|
||||
// "http://devone.aplikasi.web.id/birt/run?__report=report/one/lab/rpt_fo_001.rptdesign&__format=pdf&username=ADMIN&PID=131868?t=1696927533769"),
|
||||
// )));
|
||||
// }
|
||||
// : null,
|
||||
// child: Tooltip(
|
||||
// message: "Cetak laporan",
|
||||
// child: Icon(
|
||||
// EvaIcons.printer,
|
||||
// size: 24,
|
||||
// color: e.status == "D"
|
||||
// ? Constant.primaryBlue
|
||||
// : Colors.grey,
|
||||
// ),
|
||||
// ),
|
||||
// )),
|
||||
// ),
|
||||
// ),
|
||||
],
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
246
lib/screen/surat_jalan/table_list_pasien.dart
Normal file
246
lib/screen/surat_jalan/table_list_pasien.dart
Normal file
@@ -0,0 +1,246 @@
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:eva_icons_flutter/eva_icons_flutter.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:mitra_corporate/model/order_model.dart';
|
||||
import 'package:loading_animation_widget/loading_animation_widget.dart';
|
||||
|
||||
import '../../app/constant.dart';
|
||||
|
||||
class TableListPasien extends HookConsumerWidget {
|
||||
const TableListPasien(
|
||||
{super.key,
|
||||
required this.orders,
|
||||
required this.loading,
|
||||
required this.selected});
|
||||
final List<OrderModel> orders;
|
||||
final bool loading;
|
||||
final Function selected;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final scrollCtr = useScrollController();
|
||||
return Material(
|
||||
child: Container(
|
||||
width: Constant.getActualX(context: context, x: 585),
|
||||
height: Constant.getActualY(context: context, y: 410),
|
||||
color: Colors.white,
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.only(
|
||||
left: Constant.getActualX(context: context, x: 12)),
|
||||
alignment: Alignment.centerLeft,
|
||||
width: Constant.getActualX(context: context, x: 180),
|
||||
height: Constant.getActualY(context: context, y: 64),
|
||||
color: Constant.grey_200,
|
||||
child: Text('No Registrasi / Nama',
|
||||
style: Constant.body3_600(context: context)
|
||||
.copyWith(color: Constant.textGrey)),
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.only(
|
||||
left: Constant.getActualX(context: context, x: 12)),
|
||||
alignment: Alignment.centerLeft,
|
||||
width: Constant.getActualX(context: context, x: 325),
|
||||
height: Constant.getActualY(context: context, y: 64),
|
||||
color: Constant.grey_200,
|
||||
child: Text('Pemeriksaan',
|
||||
style: Constant.body3_600(context: context)
|
||||
.copyWith(color: Constant.textGrey)),
|
||||
),
|
||||
// Container(
|
||||
// padding: EdgeInsets.only(
|
||||
// left: Constant.getActualX(context: context, x: 12)),
|
||||
// alignment: Alignment.centerLeft,
|
||||
// width: Constant.getActualX(context: context, x: 200),
|
||||
// height: Constant.getActualY(context: context, y: 64),
|
||||
// color: Constant.grey_200,
|
||||
// child: Text('Jenis Specimen',
|
||||
// style: Constant.body3_600(context: context)
|
||||
// .copyWith(color: Constant.textGrey)),
|
||||
// ),
|
||||
Container(
|
||||
padding: EdgeInsets.only(
|
||||
left: Constant.getActualX(context: context, x: 12)),
|
||||
alignment: Alignment.centerLeft,
|
||||
width: Constant.getActualX(context: context, x: 80),
|
||||
height: Constant.getActualY(context: context, y: 64),
|
||||
color: Constant.grey_200,
|
||||
child: Text('Aksi',
|
||||
style: Constant.body3_600(context: context)
|
||||
.copyWith(color: Constant.textGrey)),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: Constant.getActualY(context: context, y: 340),
|
||||
// color: Colors.red,
|
||||
child: loading
|
||||
? Center(
|
||||
child: LoadingAnimationWidget.discreteCircle(
|
||||
color: Constant.primaryBlue, size: 40),
|
||||
)
|
||||
: Scrollbar(
|
||||
thickness: 5,
|
||||
interactive: true,
|
||||
thumbVisibility: true,
|
||||
trackVisibility: true,
|
||||
scrollbarOrientation: ScrollbarOrientation.right,
|
||||
controller: scrollCtr,
|
||||
child: ScrollConfiguration(
|
||||
behavior: ScrollConfiguration.of(context)
|
||||
.copyWith(dragDevices: {
|
||||
PointerDeviceKind.mouse,
|
||||
PointerDeviceKind.touch,
|
||||
PointerDeviceKind.trackpad,
|
||||
PointerDeviceKind.stylus,
|
||||
PointerDeviceKind.unknown
|
||||
}),
|
||||
child: ListView(
|
||||
controller: scrollCtr,
|
||||
scrollDirection: Axis.vertical,
|
||||
children: orders
|
||||
.asMap()
|
||||
.entries
|
||||
.map(
|
||||
(e) => Container(
|
||||
padding: EdgeInsets.only(
|
||||
top: Constant.getActualY(
|
||||
context: context, y: 10),
|
||||
bottom: Constant.getActualY(
|
||||
context: context, y: 10)),
|
||||
color: e.key.isOdd
|
||||
? Constant.primaryBlue
|
||||
.withOpacity(0.05)
|
||||
: Colors.white,
|
||||
margin: EdgeInsets.only(
|
||||
top: Constant.getActualY(
|
||||
context: context, y: 5),
|
||||
bottom: Constant.getActualY(
|
||||
context: context, y: 5)),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.only(
|
||||
left: Constant.getActualX(
|
||||
context: context, x: 12)),
|
||||
alignment: Alignment.centerLeft,
|
||||
width: Constant.getActualX(
|
||||
context: context, x: 180),
|
||||
height: Constant.getActualY(
|
||||
context: context, y: 64),
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(e.value.orderNumber ?? "",
|
||||
style: Constant.body3_600(
|
||||
context: context)
|
||||
.copyWith(
|
||||
color: Constant
|
||||
.textBlack)),
|
||||
Text(e.value.patientName ?? "",
|
||||
style: Constant.body3_600(
|
||||
context: context)
|
||||
.copyWith(
|
||||
color: Constant
|
||||
.textBlack))
|
||||
],
|
||||
),
|
||||
),
|
||||
// Container(
|
||||
// padding: EdgeInsets.only(
|
||||
// left: Constant.getActualX(
|
||||
// context: context, x: 12)),
|
||||
// alignment: Alignment.centerLeft,
|
||||
// width: Constant.getActualX(
|
||||
// context: context, x: 195),
|
||||
// height: Constant.getActualY(
|
||||
// context: context, y: 64),
|
||||
// color: Colors.white,
|
||||
// child: Text(e.patientName ?? "",
|
||||
// style: Constant.body3_600(
|
||||
// context: context)
|
||||
// .copyWith(
|
||||
// color: Constant.textBlack)),
|
||||
// ),
|
||||
SizedBox(
|
||||
// color: Colors.red,
|
||||
width: Constant.getActualX(
|
||||
context: context, x: 325),
|
||||
child: Wrap(
|
||||
alignment: WrapAlignment.start,
|
||||
spacing: 10,
|
||||
children: [
|
||||
if (e.value.tests!.isNotEmpty)
|
||||
...e.value.tests!
|
||||
.map((k) => Container(
|
||||
margin: EdgeInsets.only(
|
||||
bottom: Constant
|
||||
.getActualX(
|
||||
context:
|
||||
context,
|
||||
x: 10)),
|
||||
child: Chip(
|
||||
shape:
|
||||
RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius
|
||||
.all(Radius
|
||||
.circular(
|
||||
6)),
|
||||
),
|
||||
// backgroundColor:
|
||||
// Constant
|
||||
// .blue_016,
|
||||
label: Text(
|
||||
'$k '.replaceAll(
|
||||
' ',
|
||||
'\u00A0'),
|
||||
overflow:
|
||||
TextOverflow
|
||||
.ellipsis,
|
||||
style: Constant.caption2_600(
|
||||
context:
|
||||
context)
|
||||
.copyWith(
|
||||
color:
|
||||
Constant.textBlack)),
|
||||
),
|
||||
))
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
width: Constant.getActualX(
|
||||
context: context, x: 80),
|
||||
child: IconButton(
|
||||
onPressed: () {
|
||||
// print(e.orderNumber);
|
||||
selected(e.value);
|
||||
},
|
||||
icon: Icon(
|
||||
EvaIcons.arrowCircleRight,
|
||||
size: 24,
|
||||
color: Constant.green)),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
//
|
||||
));
|
||||
}
|
||||
}
|
||||
669
lib/screen/surat_jalan/table_surat_jalan.dart
Normal file
669
lib/screen/surat_jalan/table_surat_jalan.dart
Normal file
@@ -0,0 +1,669 @@
|
||||
import 'package:eva_icons_flutter/eva_icons_flutter.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:mitra_corporate/model/surat_jalan_model.dart';
|
||||
import 'package:mitra_corporate/provider/auth_provider.dart';
|
||||
import 'package:mitra_corporate/provider/surat_jalan_provider.dart';
|
||||
import 'package:mitra_corporate/screen/surat_jalan/cancel_surat_jalan_provider.dart';
|
||||
import 'package:mitra_corporate/screen/surat_jalan/get_surat_jalan_list_provider.dart';
|
||||
import 'package:mitra_corporate/screen/surat_jalan/send_surat_jalan_provider.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:loading_animation_widget/loading_animation_widget.dart';
|
||||
|
||||
import '../../app/constant.dart';
|
||||
import '../../provider/menu_provider.dart';
|
||||
import '../../widgets/custom_snackbar_widget.dart';
|
||||
import '../registrasi/table_pasien.dart';
|
||||
import 'dialog_cancel.dart';
|
||||
import 'dialog_send.dart';
|
||||
|
||||
class TableSuratJalan extends HookConsumerWidget {
|
||||
const TableSuratJalan({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
// final isExpand = ref.watch(sideBarExpandProvider);
|
||||
final keyword = ref.watch(suratJalankeywordProvider);
|
||||
final startDate = ref.watch(sjStartDateProvider);
|
||||
final endDate = ref.watch(sjEndDateProvider);
|
||||
final sjdateType = ref.watch(sjDateType);
|
||||
final auth = ref.watch(authProvider);
|
||||
final suratJalanTab = ref.watch(suratJalanProvider);
|
||||
final rowsPerPage = useState(10);
|
||||
final searchLoading = useState(false);
|
||||
final dataStart = useState(1);
|
||||
final dataEnd = useState(1);
|
||||
final currPage = useState(1);
|
||||
final sjList = useState<SearchSuratJalanModel>(
|
||||
SearchSuratJalanModel(suratJalan: [], total: "0", totalPage: 0));
|
||||
final cancelLoading = useState(false);
|
||||
final sendLoading = useState(false);
|
||||
onRefresh() {
|
||||
var ed = DateFormat('yyyy-MM-dd').format(endDate).toString();
|
||||
var sd = DateFormat('yyyy-MM-dd').format(startDate).toString();
|
||||
ref.read(GetSuratJalanListProvider.notifier).getData(
|
||||
ed: ed,
|
||||
sd: sd,
|
||||
token: auth?.token ?? "",
|
||||
page: currPage.value.toString(),
|
||||
keyword: keyword,
|
||||
rpp: rowsPerPage.value.toString(),
|
||||
dateType: sjdateType.id,
|
||||
company_id: auth?.mUserMCompanyID ?? "");
|
||||
}
|
||||
|
||||
useEffect(() {
|
||||
WidgetsBinding.instance.addPostFrameCallback((timeStamp) async {
|
||||
final debouncer = Debouncer(milliseconds: 100);
|
||||
debouncer.run(() {
|
||||
onRefresh();
|
||||
});
|
||||
});
|
||||
return () {};
|
||||
}, [currPage.value, suratJalanTab]);
|
||||
|
||||
useEffect(() {
|
||||
WidgetsBinding.instance.addPostFrameCallback((timeStamp) async {
|
||||
final debouncer = Debouncer(milliseconds: 100);
|
||||
currPage.value = 1;
|
||||
debouncer.run(() {
|
||||
var ed = DateFormat('yyyy-MM-dd').format(endDate).toString();
|
||||
var sd = DateFormat('yyyy-MM-dd').format(startDate).toString();
|
||||
ref.read(GetSuratJalanListProvider.notifier).getData(
|
||||
ed: ed,
|
||||
sd: sd,
|
||||
token: auth?.token ?? "",
|
||||
page: "1",
|
||||
keyword: keyword,
|
||||
dateType: sjdateType.id,
|
||||
rpp: rowsPerPage.value.toString(),
|
||||
company_id: auth?.mUserMCompanyID ?? "");
|
||||
});
|
||||
});
|
||||
return () {};
|
||||
}, [
|
||||
keyword,
|
||||
startDate,
|
||||
endDate,
|
||||
sjdateType,
|
||||
rowsPerPage.value,
|
||||
]);
|
||||
|
||||
ref.listen(
|
||||
GetSuratJalanListProvider,
|
||||
(pref, next) {
|
||||
if (next is GetSuratJalanListStateInit) {
|
||||
searchLoading.value = true;
|
||||
} else if (next is GetSuratJalanListStateLoading) {
|
||||
searchLoading.value = true;
|
||||
} else if (next is GetSuratJalanListStateError) {
|
||||
searchLoading.value = false;
|
||||
SanckbarWidget(context, next.message, snackbarType.error);
|
||||
Constant.autoLogout(context: context, msg: next.message);
|
||||
} else if (next is GetSuratJalanListStateDone) {
|
||||
sjList.value = next.model;
|
||||
// print(jsonEncode(next.model));
|
||||
|
||||
dataStart.value =
|
||||
(currPage.value * rowsPerPage.value) - rowsPerPage.value + 1;
|
||||
dataEnd.value = currPage.value == next.model.totalPage
|
||||
? int.parse(next.model.total ?? "0")
|
||||
: dataStart.value + rowsPerPage.value - 1;
|
||||
|
||||
searchLoading.value = false;
|
||||
}
|
||||
},
|
||||
);
|
||||
cancelSuratJalan(String deliveryID) {
|
||||
ref
|
||||
.read(CancelSuratJalanProvider.notifier)
|
||||
.cancel(token: auth?.token ?? "", deliveryID: deliveryID);
|
||||
}
|
||||
|
||||
ref.listen(
|
||||
CancelSuratJalanProvider,
|
||||
(pref, next) {
|
||||
if (next is CancelSuratJalanStateInit) {
|
||||
cancelLoading.value = true;
|
||||
} else if (next is CancelSuratJalanStateLoading) {
|
||||
cancelLoading.value = true;
|
||||
} else if (next is CancelSuratJalanStateError) {
|
||||
cancelLoading.value = false;
|
||||
SanckbarWidget(context, next.message, snackbarType.error);
|
||||
Constant.autoLogout(context: context, msg: next.message);
|
||||
} else if (next is CancelSuratJalanStateDone) {
|
||||
var ed = DateFormat('yyyy-MM-dd').format(endDate).toString();
|
||||
var sd = DateFormat('yyyy-MM-dd').format(startDate).toString();
|
||||
ref.read(GetSuratJalanListProvider.notifier).getData(
|
||||
dateType: sjdateType.id,
|
||||
ed: ed,
|
||||
sd: sd,
|
||||
token: auth?.token ?? "",
|
||||
page: currPage.value.toString(),
|
||||
keyword: keyword,
|
||||
rpp: rowsPerPage.value.toString(),
|
||||
company_id: auth?.mUserMCompanyID ?? "");
|
||||
Navigator.pop(context);
|
||||
// print(jsonEncode(next.model));
|
||||
SanckbarWidget(context, "Berhasil Membatalkan pengiriman order",
|
||||
snackbarType.success);
|
||||
|
||||
cancelLoading.value = false;
|
||||
}
|
||||
},
|
||||
);
|
||||
sendSuratJalan(String deliveryID) {
|
||||
ref
|
||||
.read(SendSuratJalanProvider.notifier)
|
||||
.Send(token: auth?.token ?? "", deliveryID: deliveryID);
|
||||
}
|
||||
|
||||
ref.listen(
|
||||
SendSuratJalanProvider,
|
||||
(pref, next) {
|
||||
if (next is SendSuratJalanStateInit) {
|
||||
sendLoading.value = true;
|
||||
} else if (next is SendSuratJalanStateLoading) {
|
||||
sendLoading.value = true;
|
||||
} else if (next is SendSuratJalanStateError) {
|
||||
sendLoading.value = false;
|
||||
SanckbarWidget(context, next.message, snackbarType.error);
|
||||
Constant.autoLogout(context: context, msg: next.message);
|
||||
} else if (next is SendSuratJalanStateDone) {
|
||||
var ed = DateFormat('yyyy-MM-dd').format(endDate).toString();
|
||||
var sd = DateFormat('yyyy-MM-dd').format(startDate).toString();
|
||||
ref.read(GetSuratJalanListProvider.notifier).getData(
|
||||
dateType: sjdateType.id,
|
||||
ed: ed,
|
||||
sd: sd,
|
||||
token: auth?.token ?? "",
|
||||
page: currPage.value.toString(),
|
||||
keyword: keyword,
|
||||
rpp: rowsPerPage.value.toString(),
|
||||
company_id: auth?.mUserMCompanyID ?? "");
|
||||
Navigator.pop(context);
|
||||
// print(jsonEncode(next.model));
|
||||
SanckbarWidget(context, "Berhasil", snackbarType.success);
|
||||
|
||||
sendLoading.value = false;
|
||||
}
|
||||
},
|
||||
);
|
||||
return Material(
|
||||
borderRadius: BorderRadius.all(Radius.circular(8)),
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
// height: Constant.getActualY(context: context, y: 64),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.all(Radius.circular(8)),
|
||||
color: Constant.grey_200,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
// width: Constant.getActualX(context: context, x: 115),
|
||||
// height: Constant.getActualY(context: context, y: 64),
|
||||
// color: Constant.grey_200,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 12, bottom: 12, left: 24, right: 6),
|
||||
child: Text('Tanggal Surat Jalan',
|
||||
style: Constant.body3_600(context: context)
|
||||
.copyWith(color: Constant.textGrey)),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
// width: Constant.getActualX(context: context, x: 115),
|
||||
// height: Constant.getActualY(context: context, y: 64),
|
||||
// color: Constant.grey_200,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 12, bottom: 12, left: 6, right: 6),
|
||||
child: Text('Tanggal Kedatangan',
|
||||
style: Constant.body3_600(context: context)
|
||||
.copyWith(color: Constant.textGrey)),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
// width: Constant.getActualX(context: context, x: 171),
|
||||
// height: Constant.getActualY(context: context, y: 64),
|
||||
// color: Constant.grey_200,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 12, bottom: 12, left: 24, right: 24),
|
||||
child: Text('Nomor Pengiriman',
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: Constant.body3_600(context: context)
|
||||
.copyWith(color: Constant.textGrey)),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
// width: Constant.getActualX(context: context, x: 337),
|
||||
// height: Constant.getActualY(context: context, y: 64),
|
||||
// color: Constant.grey_200,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 12, bottom: 12, left: 24, right: 24),
|
||||
child: Text('Staf PIC',
|
||||
style: Constant.body3_600(context: context)
|
||||
.copyWith(color: Constant.textGrey)),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
// width: Constant.getActualX(context: context, x: 175),
|
||||
// height: Constant.getActualY(context: context, y: 64),
|
||||
// color: Constant.grey_200,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 12, bottom: 12, left: 24, right: 24),
|
||||
child: Text('Tujuan',
|
||||
style: Constant.body3_600(context: context)
|
||||
.copyWith(color: Constant.textGrey)),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
// width: Constant.getActualX(context: context, x: 106),
|
||||
// height: Constant.getActualY(context: context, y: 64),
|
||||
// color: Constant.grey_200,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 12, bottom: 12, left: 24, right: 24),
|
||||
child: Text('Aksi',
|
||||
style: Constant.body3_600(context: context)
|
||||
.copyWith(color: Constant.textGrey)),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
// width: Constant.getActualX(context: context, x: 1080),
|
||||
color: Colors.white,
|
||||
height: Constant.getActualY(context: context, y: 466),
|
||||
child: searchLoading.value
|
||||
? Center(
|
||||
child: LoadingAnimationWidget.discreteCircle(
|
||||
color: Constant.primaryBlue, size: 40))
|
||||
: ListView(
|
||||
children: sjList.value.suratJalan!
|
||||
.map((e) => Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Container(
|
||||
// width: Constant.getActualX(context: context, x: 115),
|
||||
height: Constant.getActualY(
|
||||
context: context, y: 64),
|
||||
color: Colors.white,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 12,
|
||||
bottom: 12,
|
||||
left: 24,
|
||||
right: 6),
|
||||
child: Text(e.dateSj ?? "",
|
||||
style: Constant.body3_600(
|
||||
context: context)
|
||||
.copyWith(
|
||||
color:
|
||||
Constant.textBlack)),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Container(
|
||||
// width: Constant.getActualX(context: context, x: 115),
|
||||
height: Constant.getActualY(
|
||||
context: context, y: 64),
|
||||
color: Colors.white,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 12,
|
||||
bottom: 12,
|
||||
left: 6,
|
||||
right: 6),
|
||||
child: Text(e.date ?? "",
|
||||
style: Constant.body3_600(
|
||||
context: context)
|
||||
.copyWith(
|
||||
color:
|
||||
Constant.textBlack)),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
// width: Constant.getActualX(context: context, x: 171),
|
||||
height: Constant.getActualY(
|
||||
context: context, y: 64),
|
||||
color: Colors.white,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 12,
|
||||
bottom: 12,
|
||||
left: 24,
|
||||
right: 24),
|
||||
child: Text(e.orderNumber ?? "",
|
||||
style: Constant.body3_600(
|
||||
context: context)
|
||||
.copyWith(
|
||||
color:
|
||||
Constant.textBlack)),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
// width: Constant.getActualX(context: context, x: 337),
|
||||
height: Constant.getActualY(
|
||||
context: context, y: 64),
|
||||
color: Colors.white,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 12,
|
||||
bottom: 12,
|
||||
left: 24,
|
||||
right: 24),
|
||||
child: Text(e.pic ?? "",
|
||||
style: Constant.body3_600(
|
||||
context: context)
|
||||
.copyWith(
|
||||
color:
|
||||
Constant.textBlack)),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
// width: Constant.getActualX(context: context, x: 175),
|
||||
height: Constant.getActualY(
|
||||
context: context, y: 64),
|
||||
color: Colors.white,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 12,
|
||||
bottom: 12,
|
||||
left: 24,
|
||||
right: 24),
|
||||
child: Text(e.destination ?? '',
|
||||
style: Constant.body3_600(
|
||||
context: context)
|
||||
.copyWith(
|
||||
color:
|
||||
Constant.textBlack)),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
// width: Constant.getActualX(context: context, x: 105),
|
||||
height: Constant.getActualY(
|
||||
context: context, y: 64),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 12,
|
||||
bottom: 12,
|
||||
left: 24,
|
||||
right: 0),
|
||||
child: Wrap(
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: () {
|
||||
ref
|
||||
.read(
|
||||
suratJalanID.notifier)
|
||||
.state = e.id.toString();
|
||||
ref
|
||||
.read(suratJalanNumber
|
||||
.notifier)
|
||||
.state =
|
||||
e.orderNumber.toString();
|
||||
ref
|
||||
.read(currentMenuProvider
|
||||
.notifier)
|
||||
.state = 5;
|
||||
},
|
||||
child: Tooltip(
|
||||
message: "Detail Pengiriman",
|
||||
child: Icon(EvaIcons.maximize,
|
||||
size: 24,
|
||||
color: Constant.green),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: Constant.getActualX(
|
||||
context: context, x: 10)),
|
||||
// InkWell(
|
||||
// onTap: () {
|
||||
// // html.window.open(
|
||||
// // 'http://devone.aplikasi.web.id/birt/run?__report=report/one/lab/rpt_fo_001.rptdesign&__format=pdf&username=ADMIN&PID=131868?t=1696927533769',
|
||||
// // "_blank");
|
||||
// showDialog(
|
||||
// context: context,
|
||||
// // barrierDismissible: false,
|
||||
// builder: ((context) =>
|
||||
// Container(
|
||||
// child: DialogPrint(
|
||||
// url:
|
||||
// "http://devkedungdororaya.aplikasi.web.id/birt/run?__report=report/one/regional/rpt_mt_001.rptdesign&PID=${e.id}&username=${auth?.mUserUsername}&__format=pdf"),
|
||||
// )));
|
||||
// },
|
||||
// child: Tooltip(
|
||||
// message: "Cetak Surat Jalan ",
|
||||
// child: Icon(EvaIcons.printer,
|
||||
// size: 24,
|
||||
// color: Constant.green),
|
||||
// ),
|
||||
// ),
|
||||
// SizedBox(
|
||||
// width: Constant.getActualX(
|
||||
// context: context, x: 10)),
|
||||
if (e.status == 'N')
|
||||
InkWell(
|
||||
onTap: () {
|
||||
showDialog<String>(
|
||||
context: context,
|
||||
barrierDismissible:
|
||||
!sendLoading.value,
|
||||
builder: (BuildContext
|
||||
context) =>
|
||||
DialogConfirmSuratJalan(
|
||||
sendFunction:
|
||||
sendSuratJalan,
|
||||
deliveryID:
|
||||
e.id ?? "0",
|
||||
loading:
|
||||
cancelLoading
|
||||
.value,
|
||||
date:
|
||||
e.date ?? "",
|
||||
deliveryNumber:
|
||||
e.orderNumber ??
|
||||
"",
|
||||
pic: e.pic ?? ""),
|
||||
);
|
||||
},
|
||||
child: Tooltip(
|
||||
message: "Kirim",
|
||||
child: Icon(
|
||||
Icons.task_rounded,
|
||||
size: 24,
|
||||
color: Constant.green),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: Constant.getActualX(
|
||||
context: context, x: 10)),
|
||||
if (e.status == 'N')
|
||||
InkWell(
|
||||
onTap: () {
|
||||
showDialog<String>(
|
||||
context: context,
|
||||
barrierDismissible:
|
||||
!cancelLoading.value,
|
||||
builder: (BuildContext
|
||||
context) =>
|
||||
DialogCancelSuratJalan(
|
||||
cancel:
|
||||
cancelSuratJalan,
|
||||
deliveryID:
|
||||
e.id ?? "0",
|
||||
loading:
|
||||
cancelLoading
|
||||
.value,
|
||||
date:
|
||||
e.date ?? "",
|
||||
deliveryNumber:
|
||||
e.orderNumber ??
|
||||
"",
|
||||
pic: e.pic ?? ""),
|
||||
).whenComplete(() {
|
||||
onRefresh();
|
||||
});
|
||||
},
|
||||
child: Tooltip(
|
||||
message: "Batalkan",
|
||||
child: Icon(
|
||||
EvaIcons.closeCircle,
|
||||
size: 24,
|
||||
color: Constant.green),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
))
|
||||
.toList(),
|
||||
)),
|
||||
Divider(),
|
||||
Container(
|
||||
color: Colors.white,
|
||||
height: Constant.getActualY(context: context, y: 52),
|
||||
child: Row(
|
||||
children: [
|
||||
Spacer(),
|
||||
Text(
|
||||
"Rows per page :",
|
||||
style: Constant.body3_400(context: context),
|
||||
),
|
||||
SizedBox(
|
||||
width: Constant.getActualX(context: context, x: 24),
|
||||
),
|
||||
DropdownButton<int>(
|
||||
value: rowsPerPage.value,
|
||||
dropdownColor: Colors.white,
|
||||
elevation: 0,
|
||||
style: Constant.body3_400(context: context)
|
||||
.copyWith(color: Colors.black),
|
||||
underline: Container(),
|
||||
icon: Icon(Icons.keyboard_arrow_down_rounded),
|
||||
focusColor: Colors.white,
|
||||
items: [
|
||||
DropdownMenuItem(
|
||||
value: 10,
|
||||
child: Text("10"),
|
||||
),
|
||||
DropdownMenuItem(
|
||||
value: 15,
|
||||
child: Text("15"),
|
||||
),
|
||||
DropdownMenuItem(
|
||||
value: 20,
|
||||
child: Text("20"),
|
||||
),
|
||||
DropdownMenuItem(
|
||||
value: 30,
|
||||
child: Text("30"),
|
||||
),
|
||||
DropdownMenuItem(
|
||||
value: 40,
|
||||
child: Text("40"),
|
||||
),
|
||||
DropdownMenuItem(
|
||||
value: 50,
|
||||
child: Text("50"),
|
||||
),
|
||||
],
|
||||
onChanged: (value) {
|
||||
rowsPerPage.value = value!;
|
||||
}),
|
||||
SizedBox(
|
||||
width: Constant.getActualX(context: context, x: 24),
|
||||
),
|
||||
Text(
|
||||
"${dataStart.value} - ${dataEnd.value} of ${sjList.value.total}",
|
||||
style: Constant.body3_400(context: context),
|
||||
),
|
||||
SizedBox(
|
||||
width: Constant.getActualX(context: context, x: 24),
|
||||
),
|
||||
IconButton(
|
||||
iconSize: 20,
|
||||
onPressed: currPage.value > 1
|
||||
? () {
|
||||
currPage.value = currPage.value - 1;
|
||||
}
|
||||
: null,
|
||||
icon: Icon(Icons.arrow_back_ios_new_rounded)),
|
||||
SizedBox(
|
||||
width: Constant.getActualX(context: context, x: 10),
|
||||
),
|
||||
IconButton(
|
||||
iconSize: 20,
|
||||
onPressed:
|
||||
currPage.value < sjList.value.totalPage!.toInt()
|
||||
? () {
|
||||
currPage.value = currPage.value + 1;
|
||||
}
|
||||
: null,
|
||||
icon: Icon(Icons.arrow_forward_ios_outlined)),
|
||||
SizedBox(
|
||||
width: Constant.getActualX(context: context, x: 24),
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user