feat: implement submit inspection functionality in poultry science feature, including new data source methods, repository updates, and UI enhancements for image uploads and inspection submission
This commit is contained in:
@@ -0,0 +1,396 @@
|
||||
class SubmitInspectionResponse {
|
||||
SubmitInspectionResponse({
|
||||
this.lat,
|
||||
this.log,
|
||||
this.poultryHatchingId,
|
||||
this.role,
|
||||
this.generalConditionHall,
|
||||
this.casualties,
|
||||
this.technicalOfficer,
|
||||
this.inputStatus,
|
||||
this.infrastructureEnergy,
|
||||
this.hr,
|
||||
this.facilities,
|
||||
this.inspectionStatus,
|
||||
this.inspectionNotes,
|
||||
});
|
||||
|
||||
String? lat;
|
||||
String? log;
|
||||
int? poultryHatchingId;
|
||||
String? role;
|
||||
GeneralConditionHall? generalConditionHall;
|
||||
Casualties? casualties;
|
||||
TechnicalOfficer? technicalOfficer;
|
||||
InputStatus? inputStatus;
|
||||
InfrastructureEnergy? infrastructureEnergy;
|
||||
Hr? hr;
|
||||
Facilities? facilities;
|
||||
String? inspectionStatus;
|
||||
String? inspectionNotes;
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'lat': lat,
|
||||
'log': log,
|
||||
'hatching_id': poultryHatchingId,
|
||||
'role': role,
|
||||
'report_information': {
|
||||
'general_condition_hall': generalConditionHall?.toJson(),
|
||||
'casualties': casualties?.toJson(),
|
||||
'technical_officer': technicalOfficer?.toJson(),
|
||||
'input_status': inputStatus?.toJson(),
|
||||
'infrastructure_energy': infrastructureEnergy?.toJson(),
|
||||
'hr': hr?.toJson(),
|
||||
'facilities': facilities?.toJson(),
|
||||
'inspection_status': inspectionStatus,
|
||||
'inspection_notes': inspectionNotes,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
factory SubmitInspectionResponse.fromJson(Map<String, dynamic> json) {
|
||||
return SubmitInspectionResponse(
|
||||
lat: json['lat'].toString(),
|
||||
log: json['log'].toString(),
|
||||
poultryHatchingId: json['poultry_hatching_id'] as int?,
|
||||
role: json['role'] as String?,
|
||||
generalConditionHall: json['general_condition_hall'] != null
|
||||
? GeneralConditionHall.fromJson(
|
||||
json['general_condition_hall'] as Map<String, dynamic>,
|
||||
)
|
||||
: null,
|
||||
casualties: json['casualties'] != null
|
||||
? Casualties.fromJson(json['casualties'] as Map<String, dynamic>)
|
||||
: null,
|
||||
technicalOfficer: json['technical_officer'] != null
|
||||
? TechnicalOfficer.fromJson(
|
||||
json['technical_officer'] as Map<String, dynamic>,
|
||||
)
|
||||
: null,
|
||||
inputStatus: json['input_status'] != null
|
||||
? InputStatus.fromJson(json['input_status'] as Map<String, dynamic>)
|
||||
: null,
|
||||
infrastructureEnergy: json['infrastructure_energy'] != null
|
||||
? InfrastructureEnergy.fromJson(
|
||||
json['infrastructure_energy'] as Map<String, dynamic>,
|
||||
)
|
||||
: null,
|
||||
hr: json['hr'] != null
|
||||
? Hr.fromJson(json['hr'] as Map<String, dynamic>)
|
||||
: null,
|
||||
facilities: json['facilities'] != null
|
||||
? Facilities.fromJson(json['facilities'] as Map<String, dynamic>)
|
||||
: null,
|
||||
inspectionStatus: json['inspection_status'] as String?,
|
||||
inspectionNotes: json['inspection_notes'] as String?,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class GeneralConditionHall {
|
||||
GeneralConditionHall({
|
||||
this.images,
|
||||
this.healthStatus,
|
||||
this.ventilationStatus,
|
||||
this.bedCondition,
|
||||
this.temperature,
|
||||
this.drinkingWaterSource,
|
||||
this.drinkingWaterQuality,
|
||||
});
|
||||
|
||||
List<String>? images;
|
||||
String? healthStatus;
|
||||
String? ventilationStatus;
|
||||
String? bedCondition;
|
||||
String? temperature;
|
||||
String? drinkingWaterSource;
|
||||
String? drinkingWaterQuality;
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'images': images,
|
||||
'health_status': healthStatus,
|
||||
'ventilation_status': ventilationStatus,
|
||||
'bed_condition': bedCondition,
|
||||
'temperature': temperature,
|
||||
'drinking_water_source': drinkingWaterSource,
|
||||
'drinking_water_quality': drinkingWaterQuality,
|
||||
};
|
||||
}
|
||||
|
||||
factory GeneralConditionHall.fromJson(Map<String, dynamic> json) {
|
||||
return GeneralConditionHall(
|
||||
images: json['images'] != null
|
||||
? List<String>.from(json['images'] as List)
|
||||
: null,
|
||||
healthStatus: json['health_status'] as String?,
|
||||
ventilationStatus: json['ventilation_status'] as String?,
|
||||
bedCondition: json['bed_condition'] as String?,
|
||||
temperature: json['temperature'] as String?,
|
||||
drinkingWaterSource: json['drinking_water_source'] as String?,
|
||||
drinkingWaterQuality: json['drinking_water_quality'] as String?,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class Casualties {
|
||||
Casualties({
|
||||
this.normalLosses,
|
||||
this.abnormalLosses,
|
||||
this.sourceOfHatching,
|
||||
this.causeAbnormalLosses,
|
||||
this.typeDisease,
|
||||
this.samplingDone,
|
||||
this.typeSampling,
|
||||
this.images,
|
||||
});
|
||||
|
||||
int? normalLosses;
|
||||
int? abnormalLosses;
|
||||
String? sourceOfHatching;
|
||||
String? causeAbnormalLosses;
|
||||
String? typeDisease;
|
||||
bool? samplingDone;
|
||||
String? typeSampling;
|
||||
List<String>? images;
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'normal_losses': normalLosses,
|
||||
'abnormal_losses': abnormalLosses,
|
||||
'source_of_hatching': sourceOfHatching,
|
||||
'cause_abnormal_losses': causeAbnormalLosses,
|
||||
'type_disease': typeDisease,
|
||||
'sampling_done': samplingDone,
|
||||
'type_sampling': typeSampling,
|
||||
'images': images,
|
||||
};
|
||||
}
|
||||
|
||||
factory Casualties.fromJson(Map<String, dynamic> json) {
|
||||
return Casualties(
|
||||
normalLosses: json['normal_losses'] as int?,
|
||||
abnormalLosses: json['abnormal_losses'] as int?,
|
||||
sourceOfHatching: json['source_of_hatching'] as String?,
|
||||
causeAbnormalLosses: json['cause_abnormal_losses'] as String?,
|
||||
typeDisease: json['type_disease'] as String?,
|
||||
samplingDone: json['sampling_done'] as bool?,
|
||||
typeSampling: json['type_sampling'] as String?,
|
||||
images: json['images'] != null
|
||||
? List<String>.from(json['images'] as List)
|
||||
: null,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class TechnicalOfficer {
|
||||
TechnicalOfficer({
|
||||
this.technicalHealthOfficer,
|
||||
this.technicalEngineeringOfficer,
|
||||
});
|
||||
|
||||
String? technicalHealthOfficer;
|
||||
String? technicalEngineeringOfficer;
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'technical_health_officer': technicalHealthOfficer,
|
||||
'technical_engineering_officer': technicalEngineeringOfficer,
|
||||
};
|
||||
}
|
||||
|
||||
factory TechnicalOfficer.fromJson(Map<String, dynamic> json) {
|
||||
return TechnicalOfficer(
|
||||
technicalHealthOfficer: json['technical_health_officer'] as String?,
|
||||
technicalEngineeringOfficer:
|
||||
json['technical_engineering_officer'] as String?,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class InputStatus {
|
||||
InputStatus({
|
||||
this.inputStatus,
|
||||
this.companyName,
|
||||
this.trackingCode,
|
||||
this.typeOfGrain,
|
||||
this.inventoryInWarehouse,
|
||||
this.inventoryUntilVisit,
|
||||
this.gradeGrain,
|
||||
this.images,
|
||||
});
|
||||
|
||||
String? inputStatus;
|
||||
String? companyName;
|
||||
String? trackingCode;
|
||||
String? typeOfGrain;
|
||||
String? inventoryInWarehouse;
|
||||
String? inventoryUntilVisit;
|
||||
String? gradeGrain;
|
||||
List<String>? images;
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'input_status': inputStatus,
|
||||
'company_name': companyName,
|
||||
'tracking_code': trackingCode,
|
||||
'type_of_grain': typeOfGrain,
|
||||
'inventory_in_warehouse': inventoryInWarehouse,
|
||||
'inventory_until_visit': inventoryUntilVisit,
|
||||
'grade_grain': gradeGrain,
|
||||
'images': images,
|
||||
};
|
||||
}
|
||||
|
||||
factory InputStatus.fromJson(Map<String, dynamic> json) {
|
||||
return InputStatus(
|
||||
inputStatus: json['input_status'] as String?,
|
||||
companyName: json['company_name'] as String?,
|
||||
trackingCode: json['tracking_code'] as String?,
|
||||
typeOfGrain: json['type_of_grain'] as String?,
|
||||
inventoryInWarehouse: json['inventory_in_warehouse'] as String?,
|
||||
inventoryUntilVisit: json['inventory_until_visit'] as String?,
|
||||
gradeGrain: json['grade_grain'] as String?,
|
||||
images: json['images'] != null
|
||||
? List<String>.from(json['images'] as List)
|
||||
: null,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class InfrastructureEnergy {
|
||||
InfrastructureEnergy({
|
||||
this.generatorType,
|
||||
this.generatorModel,
|
||||
this.generatorCount,
|
||||
this.generatorCapacity,
|
||||
this.fuelType,
|
||||
this.generatorPerformance,
|
||||
this.emergencyFuelInventory,
|
||||
this.hasPowerCutHistory,
|
||||
this.powerCutDuration,
|
||||
this.powerCutHour,
|
||||
this.additionalNotes,
|
||||
});
|
||||
|
||||
String? generatorType;
|
||||
String? generatorModel;
|
||||
String? generatorCount;
|
||||
String? generatorCapacity;
|
||||
String? fuelType;
|
||||
String? generatorPerformance;
|
||||
String? emergencyFuelInventory;
|
||||
bool? hasPowerCutHistory;
|
||||
String? powerCutDuration;
|
||||
String? powerCutHour;
|
||||
String? additionalNotes;
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'generator_type': generatorType,
|
||||
'generator_model': generatorModel,
|
||||
'generator_count': generatorCount,
|
||||
'generator_capacity': generatorCapacity,
|
||||
'fuel_type': fuelType,
|
||||
'generator_performance': generatorPerformance,
|
||||
'emergency_fuel_inventory': emergencyFuelInventory,
|
||||
'has_power_cut_history': hasPowerCutHistory,
|
||||
'power_cut_duration': powerCutDuration,
|
||||
'power_cut_hour': powerCutHour,
|
||||
'additional_notes': additionalNotes,
|
||||
};
|
||||
}
|
||||
|
||||
factory InfrastructureEnergy.fromJson(Map<String, dynamic> json) {
|
||||
return InfrastructureEnergy(
|
||||
generatorType: json['generator_type'] as String?,
|
||||
generatorModel: json['generator_model'] as String?,
|
||||
generatorCount: json['generator_count'] as String?,
|
||||
generatorCapacity: json['generator_capacity'] as String?,
|
||||
fuelType: json['fuel_type'] as String?,
|
||||
generatorPerformance: json['generator_performance'] as String?,
|
||||
emergencyFuelInventory: json['emergency_fuel_inventory'] as String?,
|
||||
hasPowerCutHistory: json['has_power_cut_history'] as bool?,
|
||||
powerCutDuration: json['power_cut_duration'] as String?,
|
||||
powerCutHour: json['power_cut_hour'] as String?,
|
||||
additionalNotes: json['additional_notes'] as String?,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class Hr {
|
||||
Hr({
|
||||
this.numberEmployed,
|
||||
this.numberIndigenous,
|
||||
this.numberNonIndigenous,
|
||||
this.contractStatus,
|
||||
this.trained,
|
||||
});
|
||||
|
||||
int? numberEmployed;
|
||||
int? numberIndigenous;
|
||||
int? numberNonIndigenous;
|
||||
String? contractStatus;
|
||||
bool? trained;
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'number_employed': numberEmployed,
|
||||
'number_indigenous': numberIndigenous,
|
||||
'number_non_indigenous': numberNonIndigenous,
|
||||
'contract_status': contractStatus,
|
||||
'trained': trained,
|
||||
};
|
||||
}
|
||||
|
||||
factory Hr.fromJson(Map<String, dynamic> json) {
|
||||
return Hr(
|
||||
numberEmployed: json['number_employed'] as int?,
|
||||
numberIndigenous: json['number_indigenous'] as int?,
|
||||
numberNonIndigenous: json['number_non_indigenous'] as int?,
|
||||
contractStatus: json['contract_status'] as String?,
|
||||
trained: json['trained'] as bool?,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class Facilities {
|
||||
Facilities({
|
||||
this.hasFacilities,
|
||||
this.typeOfFacility,
|
||||
this.amount,
|
||||
this.date,
|
||||
this.repaymentStatus,
|
||||
this.requestFacilities,
|
||||
});
|
||||
|
||||
bool? hasFacilities;
|
||||
String? typeOfFacility;
|
||||
int? amount;
|
||||
String? date;
|
||||
String? repaymentStatus;
|
||||
String? requestFacilities;
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'has_facilities': hasFacilities,
|
||||
'type_of_facility': typeOfFacility,
|
||||
'amount': amount,
|
||||
'date': date,
|
||||
'repayment_status': repaymentStatus,
|
||||
'request_facilities': requestFacilities,
|
||||
};
|
||||
}
|
||||
|
||||
factory Facilities.fromJson(Map<String, dynamic> json) {
|
||||
return Facilities(
|
||||
hasFacilities: json['has_facilities'] as bool?,
|
||||
typeOfFacility: json['type_of_facility'] as String?,
|
||||
amount: json['amount'] as int?,
|
||||
date: json['date'] as String?,
|
||||
repaymentStatus: json['repayment_status'] as String?,
|
||||
requestFacilities: json['request_facilities'] as String?,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user