import 'package:flutter/material.dart'; import 'package:healthcare_pharmacy/settings.dart'; class PrescriptionPicture { late String id; late String url; PrescriptionPicture({ required this.id, required this.url, }); factory PrescriptionPicture.fromJson(Map json) { return PrescriptionPicture( id: json['_id'], url: json['url'], ); } } class BiddingRequestsModel { String? customerId = ''; String? pharmacyId = ''; String? amount = ''; String? bookingId = ''; String? profilePicture = ''; String? firstName = ''; String? address = ''; String orderStatus = ''; String status = ''; List PrescriptionPictures = []; Color cardColor = Colors.white; Color textColor = Colors.black; BiddingRequestsModel(); factory BiddingRequestsModel.fromJson(Map json) { BiddingRequestsModel rtvm = BiddingRequestsModel(); rtvm.customerId = json['customerId'].toString() ?? ''; rtvm.pharmacyId = json['pharmacyId'].toString() ?? ''; rtvm.amount = json['biddingAmount'].toString() ?? ''; rtvm.bookingId = json['bookingId'].toString() ?? ''; rtvm.profilePicture = json['profilePicture'] ?? ''; rtvm.firstName = json['customerDetails']["firstName"].toString() ?? ''; rtvm.address = json['customerDetails']["address1"].toString() ?? ''; rtvm.status = json['status']; if (json['PrescriptionPictures'] != null) { var pictures = json['PrescriptionPictures'] as List; rtvm.PrescriptionPictures = pictures.map((picture) => PrescriptionPicture.fromJson(picture)).toList(); } if (rtvm.status.toString().toLowerCase() == 'accepted') { rtvm.textColor = Colors.green; } else if (rtvm.status.toString().toLowerCase() == 'rejected') { rtvm.textColor = Colors.red; } else { rtvm.textColor = primaryColor; } return rtvm; } }