Feat: done database migration
This commit is contained in:
parent
4e3d4b5d33
commit
c3c0f41269
|
@ -2,7 +2,7 @@ plugins {
|
|||
id "com.android.application"
|
||||
id "kotlin-android"
|
||||
id "dev.flutter.flutter-gradle-plugin"
|
||||
id 'com.google.gms.google-services'
|
||||
id 'com.google.gms.google-services' // firebase
|
||||
}
|
||||
|
||||
def localProperties = new Properties()
|
||||
|
@ -56,6 +56,8 @@ flutter {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
implementation platform('com.google.firebase:firebase-bom:33.9.0')
|
||||
// Firebase
|
||||
// implementation platform('com.google.firebase:firebase-bom:33.9.0')
|
||||
implementation(platform("com.google.firebase:firebase-bom:33.11.0"))
|
||||
implementation 'com.google.firebase:firebase-analytics'
|
||||
}
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
{
|
||||
"project_info": {
|
||||
"project_number": "500904629253",
|
||||
"project_id": "e-porter-95934",
|
||||
"storage_bucket": "e-porter-95934.firebasestorage.app"
|
||||
"project_number": "263537612753",
|
||||
"firebase_url": "https://tomatify-b02d2-default-rtdb.asia-southeast1.firebasedatabase.app",
|
||||
"project_id": "tomatify-b02d2",
|
||||
"storage_bucket": "tomatify-b02d2.appspot.com"
|
||||
},
|
||||
"client": [
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:500904629253:android:605ea4c7c68257ee0ab86c",
|
||||
"mobilesdk_app_id": "1:263537612753:android:55032afbca267c984f72f0",
|
||||
"android_client_info": {
|
||||
"package_name": "com.example.e_porter"
|
||||
}
|
||||
|
@ -15,7 +16,26 @@
|
|||
"oauth_client": [],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyC0wuDunsKoDmB8H8dCX6ZDmvGH93rlwYE"
|
||||
"current_key": "AIzaSyAIY5iiaWO08YrhxFoxkQHYUOUKrl7kZRs"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"appinvite_service": {
|
||||
"other_platform_oauth_client": []
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:263537612753:android:ff16ddcf74fc8dd34f72f0",
|
||||
"android_client_info": {
|
||||
"package_name": "com.example.tomato"
|
||||
}
|
||||
},
|
||||
"oauth_client": [],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyAIY5iiaWO08YrhxFoxkQHYUOUKrl7kZRs"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
|
|
|
@ -7,7 +7,7 @@ buildscript {
|
|||
|
||||
dependencies {
|
||||
classpath "com.android.tools.build:gradle:8.2.0"
|
||||
classpath 'com.google.gms:google-services:4.4.2'
|
||||
classpath 'com.google.gms:google-services:4.4.2' // firebase
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,15 +1,12 @@
|
|||
// data/repositories/porter_service_repository_impl.dart
|
||||
|
||||
import 'package:cloud_firestore/cloud_firestore.dart';
|
||||
import '../../domain/models/porter_service_model.dart';
|
||||
import '../../domain/repositories/porter_service_repository.dart';
|
||||
|
||||
class PorterServiceRepositoryImpl implements PorterServiceRepository {
|
||||
final FirebaseFirestore _firestore;
|
||||
final String _collectionName = 'PorterServices';
|
||||
final String _collectionName = 'porterServices';
|
||||
|
||||
PorterServiceRepositoryImpl({FirebaseFirestore? firestore})
|
||||
: _firestore = firestore ?? FirebaseFirestore.instance;
|
||||
PorterServiceRepositoryImpl({FirebaseFirestore? firestore}) : _firestore = firestore ?? FirebaseFirestore.instance;
|
||||
|
||||
@override
|
||||
Future<List<PorterServiceModel>> getAllServices() async {
|
||||
|
@ -28,11 +25,8 @@ class PorterServiceRepositoryImpl implements PorterServiceRepository {
|
|||
@override
|
||||
Future<List<PorterServiceModel>> getServicesByType(String type) async {
|
||||
try {
|
||||
final snapshot = await _firestore
|
||||
.collection(_collectionName)
|
||||
.where('availableFor', arrayContains: type)
|
||||
.orderBy('sort')
|
||||
.get();
|
||||
final snapshot =
|
||||
await _firestore.collection(_collectionName).where('availableFor', arrayContains: type).orderBy('sort').get();
|
||||
|
||||
return snapshot.docs.map((doc) {
|
||||
final data = doc.data() as Map<String, dynamic>;
|
||||
|
|
|
@ -138,7 +138,6 @@ class _SearchTicketsScreenState extends State<SearchTicketsScreen> {
|
|||
"ticketDate": ticketDate,
|
||||
"passenger": passengerCount,
|
||||
};
|
||||
// logger.d('ID Ticket: $ticketId \nID Flight: $flightId \nTicket Date: $ticketDate \nPassenger: $passengerCount');
|
||||
Get.toNamed(Routes.TICKETBOOKINGSTEP1, arguments: argument);
|
||||
},
|
||||
),
|
||||
|
|
|
@ -183,14 +183,6 @@ class _TicketBookingStep3ScreenState extends State<TicketBookingStep3Screen> {
|
|||
});
|
||||
}
|
||||
|
||||
List<String> _getSelectedServices() {
|
||||
List<String> selectedServices = [];
|
||||
if (_isChecked1) selectedServices.add("Keberangkatan: Fast Track");
|
||||
if (_isChecked2) selectedServices.add("Kedatangan: Porter VIP");
|
||||
if (_isChecked3) selectedServices.add("Transit: Transit");
|
||||
return selectedServices;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
totalPrice = calculateTotalPrice(flightData?.price.toDouble() ?? 0.0, passenger);
|
||||
|
|
|
@ -36,6 +36,7 @@ class _TicketBookingStep4ScreenState extends State<TicketBookingStep4Screen> {
|
|||
|
||||
double? totalPrice;
|
||||
double? grandTotal;
|
||||
final double serviceCharge = 10000.0;
|
||||
|
||||
final TicketController ticketController = Get.find<TicketController>();
|
||||
FlightModel? flightData;
|
||||
|
@ -109,6 +110,10 @@ class _TicketBookingStep4ScreenState extends State<TicketBookingStep4Screen> {
|
|||
return '0';
|
||||
}
|
||||
|
||||
double totalAll() {
|
||||
return (grandTotal ?? 0.0) + serviceCharge;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final hasDeparturePorter =
|
||||
|
@ -187,8 +192,11 @@ class _TicketBookingStep4ScreenState extends State<TicketBookingStep4Screen> {
|
|||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
SizedBox(width: 8.w),
|
||||
TypographyStyles.small("x ${passenger}",
|
||||
color: GrayColors.gray600, fontWeight: FontWeight.w400)
|
||||
TypographyStyles.small(
|
||||
"x ${passenger}",
|
||||
color: GrayColors.gray600,
|
||||
fontWeight: FontWeight.w400,
|
||||
)
|
||||
],
|
||||
),
|
||||
Padding(
|
||||
|
@ -213,7 +221,11 @@ class _TicketBookingStep4ScreenState extends State<TicketBookingStep4Screen> {
|
|||
SizedBox(height: 2.h),
|
||||
_buildTextService(),
|
||||
SizedBox(height: 2.h),
|
||||
_buildRowText(context, text: "Biaya layanan", valueText: "10.000"),
|
||||
_buildRowText(
|
||||
context,
|
||||
text: "Biaya layanan",
|
||||
valueText: "Rp ${NumberFormat.decimalPattern('id_ID').format(serviceCharge)}",
|
||||
),
|
||||
],
|
||||
))
|
||||
],
|
||||
|
@ -222,11 +234,23 @@ class _TicketBookingStep4ScreenState extends State<TicketBookingStep4Screen> {
|
|||
)),
|
||||
bottomNavigationBar: FooterPrice(
|
||||
labelText: "Pembayaran",
|
||||
price: "Rp ${NumberFormat.decimalPattern('id_ID').format(grandTotal)}",
|
||||
price: "Rp ${NumberFormat.decimalPattern('id_ID').format(totalAll())}",
|
||||
labelButton: "Buat Pesanan",
|
||||
iconButton: CustomeIcons.ProtectOutline(color: Colors.white),
|
||||
onTap: () {
|
||||
Get.toNamed(Routes.PAYMENT);
|
||||
final argument = {
|
||||
'ticketId': ticketId,
|
||||
'flightId': flightId,
|
||||
'date': ticketDate,
|
||||
'passenger': passenger,
|
||||
'selectedPassenger': selectedPassengers,
|
||||
'numberSeat': numberSeat,
|
||||
'totalPrice': totalPrice,
|
||||
'grandTotal': grandTotal,
|
||||
'selectedServiceLabels': selectedServiceLabels,
|
||||
'selectedPorterServices': selectedPorterServices,
|
||||
};
|
||||
Get.toNamed(Routes.PAYMENT, arguments: argument);
|
||||
},
|
||||
));
|
||||
}
|
||||
|
@ -323,7 +347,7 @@ class _TicketBookingStep4ScreenState extends State<TicketBookingStep4Screen> {
|
|||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
TypographyStyles.caption(
|
||||
"Rp ${valueText}",
|
||||
valueText,
|
||||
color: GrayColors.gray600,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
|
|
Loading…
Reference in New Issue