fist commit ftc staff app clone

This commit is contained in:
2024-08-01 13:46:46 +05:30
commit bf9064a9c9
515 changed files with 42796 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
class ABCFormHtmlRequest {
final String antecedentEvents;
final String behaviour;
final String consequenceEvents;
ABCFormHtmlRequest({
required this.antecedentEvents,
required this.behaviour,
required this.consequenceEvents,
});
String toHtml() {
return """
<div className="col-md-12">
<p><strong>Antecedent Events: </strong><span id="antecedentEventsData">$antecedentEvents</span></p>
</div>
<div className="col-md-12">
<p><strong>Behaviour: </strong><span id="behaviourData">$behaviour</span></p>
</div>
<div className="col-md-12">
<p><strong>Consequence Events: </strong><span id="consequenceEventsData">$consequenceEvents</span></p>
</div>
""";
}
}

View File

@@ -0,0 +1,12 @@
import 'package:get/get_rx/get_rx.dart';
class HtmlTableOption {
String id;
String requirements;
final RxBool isChecked = false.obs;
HtmlTableOption({
required this.id,
required this.requirements,
});
}

View File

@@ -0,0 +1,313 @@
import 'package:html/parser.dart' as htmlparser;
import 'package:html/dom.dart' as dom;
import 'HtmlTableOption.dart';
class ConsentCapacityHtmlRequest {
final String comments;
final String isMCARequired;
final String mentalCapacityAssessmentDetail;
final String specificDecisionDetail;
final String personUndertakingName;
final String personUndertakingRole;
final String organisation;
final String address;
final String tel;
final String email;
final String dateAndTimeOfAssessment;
final String lackCapacityToMakeParticularDecisionDetail;
final String recordYourEvidenceDescribe;
final String viableOptionsConsidered;
final String explainWhyTickedBox;
final List<HtmlTableOption> canDecisionBeDelayedOptions;
final String selectedImpairmentOption;
final String impairmentDescribe;
final String selectedCanPersonDecisionInfoOption;
final String describeCanPersonDecisionInfo;
final String selectedCanTheyRetainOption;
final String describeCanTheyRetain;
final String selectedCanTheyUseOption;
final String describeCanTheyUse;
final String selectedCanTheyCommunicateOption;
final String describeCanTheyCommunicate;
final List<HtmlTableOption> causativeNexusOptions;
final String evidence;
final String selectedDoYouHaveConcernOption;
final String whatIsYourEvidence;
final String seekingManagementDescribe;
final String recordInterviewDescribe;
final String section9DontHaveDecisionNameData;
final String section9DontHaveDecisionDateData;
final String section9HaveDecisionNameData;
final String section9HaveDecisionDateData;
final String isIMCARequired;
final String giveWhyIMCARequiredReason;
final String whyIMCARequiredDateTime;
final String section9AssessorsName;
final String assessorsDesignation;
final String assessorsBaseAddress;
final String assessorsContactDetailsData;
ConsentCapacityHtmlRequest({
required this.comments,
required this.isMCARequired,
required this.mentalCapacityAssessmentDetail,
required this.specificDecisionDetail,
required this.personUndertakingName,
required this.personUndertakingRole,
required this.organisation,
required this.address,
required this.tel,
required this.email,
required this.dateAndTimeOfAssessment,
required this.lackCapacityToMakeParticularDecisionDetail,
required this.recordYourEvidenceDescribe,
required this.viableOptionsConsidered,
required this.explainWhyTickedBox,
required this.canDecisionBeDelayedOptions,
required this.selectedImpairmentOption,
required this.impairmentDescribe,
required this.selectedCanPersonDecisionInfoOption,
required this.describeCanPersonDecisionInfo,
required this.selectedCanTheyRetainOption,
required this.describeCanTheyRetain,
required this.selectedCanTheyUseOption,
required this.describeCanTheyUse,
required this.selectedCanTheyCommunicateOption,
required this.describeCanTheyCommunicate,
required this.causativeNexusOptions,
required this.evidence,
required this.selectedDoYouHaveConcernOption,
required this.whatIsYourEvidence,
required this.seekingManagementDescribe,
required this.recordInterviewDescribe,
required this.section9DontHaveDecisionNameData,
required this.section9DontHaveDecisionDateData,
required this.section9HaveDecisionNameData,
required this.section9HaveDecisionDateData,
required this.isIMCARequired,
required this.giveWhyIMCARequiredReason,
required this.whyIMCARequiredDateTime,
required this.section9AssessorsName,
required this.assessorsDesignation,
required this.assessorsBaseAddress,
required this.assessorsContactDetailsData,
});
String toHtml(String htmlString) {
// Process the HTML string as needed
dom.Document document = htmlparser.parse(htmlString);
_addTextToElementId(
id: 'isMCARequiredData', value: isMCARequired, document: document);
_addTextToElementId(
id: 'commentsData', value: comments, document: document);
final myElement = document.getElementById("ifMcaRequiredContentDiv");
if (isMCARequired == "No") {
myElement?.attributes['style'] = 'display: none;';
} else {
myElement?.attributes['style'] = 'display: block;';
_addTextToElementId(
id: 'mentalCapacityAssessmentDetail',
value: mentalCapacityAssessmentDetail,
document: document);
_addTextToElementId(
id: 'specificDecisionDetail',
value: specificDecisionDetail,
document: document);
_addTextToElementId(
id: 'personUndertakingName',
value: personUndertakingName,
document: document);
_addTextToElementId(
id: 'personUndertakingRole',
value: personUndertakingRole,
document: document);
_addTextToElementId(
id: 'organisation', value: organisation, document: document);
_addTextToElementId(id: 'address', value: address, document: document);
_addTextToElementId(id: 'tel', value: tel, document: document);
_addTextToElementId(id: 'email', value: email, document: document);
_addTextToElementId(
id: 'dateAndTimeOfAssessment',
value: dateAndTimeOfAssessment,
document: document);
_addTextToElementId(
id: 'lackCapacityToMakeParticularDecisionDetail',
value: lackCapacityToMakeParticularDecisionDetail,
document: document);
_addTextToElementId(
id: 'recordYourEvidenceDescribe',
value: recordYourEvidenceDescribe,
document: document);
_addTextToElementId(
id: 'viableOptionsConsidered',
value: viableOptionsConsidered,
document: document);
//canDecisionBeDelayedTable
final String generatedHtml1 =
generateHtmlRows(canDecisionBeDelayedOptions);
print("table1: $generatedHtml1");
final tableBody1 = document.getElementById('canDecisionBeDelayedTable');
// document.querySelector('.canDecisionBeDelayedTable tbody');
print("is tableBody1 null: ${tableBody1 == null}");
tableBody1?.innerHtml = generatedHtml1;
_addTextToElementId(
id: 'explainWhyTickedBox',
value: explainWhyTickedBox,
document: document);
_addTextToElementId(
id: 'selectedImpairmentOption',
value: selectedImpairmentOption,
document: document);
_addTextToElementId(
id: 'impairmentDescribe',
value: impairmentDescribe,
document: document);
_addTextToElementId(
id: 'selectedCanPersonDecisionInfoOption',
value: selectedCanPersonDecisionInfoOption,
document: document);
_addTextToElementId(
id: 'describeCanPersonDecisionInfo',
value: describeCanPersonDecisionInfo,
document: document);
_addTextToElementId(
id: 'selectedCanTheyRetainOption',
value: selectedCanTheyRetainOption,
document: document);
_addTextToElementId(
id: 'describeCanTheyRetain',
value: describeCanTheyRetain,
document: document);
_addTextToElementId(
id: 'selectedCanTheyUseOption',
value: selectedCanTheyUseOption,
document: document);
_addTextToElementId(
id: 'describeCanTheyUse',
value: describeCanTheyUse,
document: document);
_addTextToElementId(
id: 'selectedCanTheyCommunicateOption',
value: selectedCanTheyCommunicateOption,
document: document);
_addTextToElementId(
id: 'describeCanTheyCommunicate',
value: describeCanTheyCommunicate,
document: document);
final String generatedHtml2 = generateHtmlRows(causativeNexusOptions);
print("table2: $generatedHtml2");
final tableBody2 = document.getElementById('causativeNexusOptions');
// final tableBody2 = document.querySelector('.causativeNexusOptions tbody');
print("is table2 null: ${tableBody2 == null}");
tableBody2?.innerHtml = generatedHtml2;
_addTextToElementId(id: 'evidence', value: evidence, document: document);
_addTextToElementId(
id: 'selectedDoYouHaveConcernOption',
value: selectedDoYouHaveConcernOption,
document: document);
_addTextToElementId(
id: 'whatIsYourEvidence',
value: whatIsYourEvidence,
document: document);
_addTextToElementId(
id: 'seekingManagementDescribe',
value: seekingManagementDescribe,
document: document);
_addTextToElementId(
id: 'recordInterviewDescribe',
value: recordInterviewDescribe,
document: document);
_addTextToElementId(
id: 'section9DontHaveDecisionNameData',
value: section9DontHaveDecisionNameData,
document: document);
_addTextToElementId(
id: 'section9DontHaveDecisionDateData',
value: section9DontHaveDecisionDateData,
document: document);
_addTextToElementId(
id: 'section9HaveDecisionNameData',
value: section9HaveDecisionNameData,
document: document);
_addTextToElementId(
id: 'section9HaveDecisionDateData',
value: section9HaveDecisionDateData,
document: document);
_addTextToElementId(
id: 'isIMCARequired', value: isIMCARequired, document: document);
_addTextToElementId(
id: 'giveWhyIMCARequiredReason',
value: giveWhyIMCARequiredReason,
document: document);
_addTextToElementId(
id: 'whyIMCARequiredDateTime',
value: whyIMCARequiredDateTime,
document: document);
_addTextToElementId(
id: 'section9AssessorsName',
value: section9AssessorsName,
document: document);
_addTextToElementId(
id: 'assessorsDesignation',
value: assessorsDesignation,
document: document);
_addTextToElementId(
id: 'assessorsBaseAddress',
value: assessorsBaseAddress,
document: document);
_addTextToElementId(
id: 'assessorsContactDetailsData',
value: assessorsContactDetailsData,
document: document);
}
return document.outerHtml;
}
_addTextToElementId({
required String id,
required String value,
required dom.Document document,
}) {
final myElement = document.getElementById(id);
if (myElement != null) {
myElement.text = value;
}
}
String generateHtmlRows(List<HtmlTableOption> options) {
final StringBuffer htmlBuffer = StringBuffer();
for (final option in options) {
final String rowHtml = '''<tr>
<td>${option.requirements}</td>
<td>
<img src="${option.isChecked.value ? 'http://16.171.242.62/actionButtonTick.464cd329d1d7b49fd28f9f4d8c486b63.svg' : 'http://16.171.242.62/actionButtonDel.7fcdf165cc653aa57ec7b2167ef2f3cc.svg'}"
alt="${option.isChecked.value ? 'Tick' : 'Close'}"
width="24"
height="24">
</td>
</tr>
''';
htmlBuffer.write(rowHtml);
}
return htmlBuffer.toString();
}
}

View File

@@ -0,0 +1,23 @@
class HealthAppointmentsFormHtmlRequest {
final String appointmentWith;
final String reason;
final String comments;
HealthAppointmentsFormHtmlRequest({
required this.appointmentWith,
required this.reason,
required this.comments,
});
String toHtml() {
return """<div className="col-md-6">
<p><strong>Appointment with: </strong><span id="appointmentWithData">$appointmentWith </span></p>
</div>
<div className="col-md-6">
<p><strong>Reason for appointment: </strong><span id="reasonForAppointmentData">$reason</span></p>
</div>
<div className="col-md-12">
<p><strong>Comments: </strong><span id="commentsData">$comments</span></p>
</div>""";
}
}

View File

@@ -0,0 +1,35 @@
class NutritionHydrationFormHtmlRequest {
final String nutritionHydrationType;
final String foodFluidType;
final String foodFluidAmount;
final String comments;
NutritionHydrationFormHtmlRequest({
required this.nutritionHydrationType,
required this.foodFluidType,
required this.foodFluidAmount,
required this.comments,
});
String toHtml() {
return """<div className="col-md-12">
<p className="text-left"><strong>Type: </strong><span id="nutritionHydrationTypeData">$nutritionHydrationType</span>
</p>
</div>
<div className="col-md-6">
<p className="text-left"><strong>${nutritionHydrationType == "Food" ? "Meal Type: (Breakfast, Lunch, Dinner, Snack etc)" : nutritionHydrationType == "Fluid" ? "Drink Type" : ""}: </strong><span
id="foodFluidTypeData">$foodFluidType</span></p>
</div>
<div className="col-md-6">
<p className="text-left"><strong>${nutritionHydrationType == "Food" ? "Amount Eaten" : nutritionHydrationType == "Fluid" ? "Amount (ML)" : ""}: </strong><span
id="foodFluidAmountData">$foodFluidAmount</span></p>
</div>
<div className="col-md-12">
<p><strong>Comments: </strong><span id="commentsData">${comments.isNotEmpty ? comments : "No assistance required"}</span>
</p>
</div>
<div className="col-md-12">
${(nutritionHydrationType == "Food") ? """<img className="observationImg" src="http://16.171.242.62/Plat.png" alt="Plat" width="100%"/>""" : nutritionHydrationType == "Fluid" ? """<img className="observationImg" src="http://16.171.242.62/Glass.png" alt="Glass" width="100%"/>""" : ""}</div>
""";
}
}

View File

@@ -0,0 +1,48 @@
class ObservationsFormHtmlReq {
final String heartRate;
final String bloodPressure;
final String respiratoryRate;
final String oxygen;
final String temperature;
final String bloodSugar;
ObservationsFormHtmlReq({
required this.heartRate,
required this.bloodPressure,
required this.respiratoryRate,
required this.oxygen,
required this.temperature,
required this.bloodSugar,
});
String toHtml() {
return """<div className="col-md-6">
<p><strong>Heart Rate (BPM): </strong><span
id="heartRateData">$heartRate</span></p>
</div>
<div className="col-md-6">
<p><strong>Blood Pressure (/MMHG): </strong><span id="bloodPressureData">$bloodPressure</span>
</p>
</div>
<div className="col-md-6">
<p><strong>Respiratory Rate: </strong><span id="respiratoryRateData">$respiratoryRate </span>
</p>
</div>
<div className="col-md-6">
<p><strong>Oxygen (%): </strong><span id="oxygenData">$oxygen</span>
</p>
</div>
<div className="col-md-6">
<p><strong>Temperature (˚C): </strong><span id="temperatureData">$temperature </span>
</p>
</div>
<div className="col-md-6">
<p><strong>Blood Sugar (MMOL/L): </strong><span id="bloodSugarData">$bloodSugar</span>
</p>
</div>
<div className="col-md-12">
<img className="observationImg" src="http://16.171.242.62/Observation.png" alt="Observation"
width="100%"/>
</div>""";
}
}

View File

@@ -0,0 +1,150 @@
import 'HtmlTableOption.dart';
class PhysicalInterventionFormHtmlRequest {
final String durationOfIncidents;
final String staffDebriefFormNumber;
final String nameOfWitnesses;
final String placeOfIncident;
final String priorToIntervention;
final String pbsFollowed;
final String reasonForPhysicalIntervention;
final String staffInvolvedInPI;
final String conditionOfSU;
final String howSuCalmed;
final List<HtmlTableOption> useOfForceNecessary;
final String pleaseExplain;
final String isParentContacted;
final String nameOfParentContacted;
final String parentContactedTime;
final String howParentContacted;
final String parentCarersComments;
final String howFormWasShared;
PhysicalInterventionFormHtmlRequest({
required this.durationOfIncidents,
required this.staffDebriefFormNumber,
required this.nameOfWitnesses,
required this.placeOfIncident,
required this.priorToIntervention,
required this.pbsFollowed,
required this.reasonForPhysicalIntervention,
required this.staffInvolvedInPI,
required this.conditionOfSU,
required this.howSuCalmed,
required this.useOfForceNecessary,
required this.pleaseExplain,
required this.isParentContacted,
required this.nameOfParentContacted,
required this.parentContactedTime,
required this.howParentContacted,
required this.parentCarersComments,
required this.howFormWasShared,
});
String toHtml() {
String ifParentContactedHtml = (isParentContacted == "Yes")
? """<div className="col-md-6">
<p><strong>Name of Parent Contacted</strong>
<span id="nameOfParentContactedData">$nameOfParentContacted</span></p>
</div>
<div className="col-md-6">
<p><strong>Contact time</strong>
<span id="parentContactedTimeData">$parentContactedTime</span></p>
</div>
<div className="col-md-12">
<p><strong>How parent was contacted</strong>
<span id="howParentContactedData">$howParentContacted</span></p>
</div>"""
: "";
return """<div className="col-md-6">
<p><strong>Duration of incident (Mins)</strong>
<span id="durationOfIncidentsData">$durationOfIncidents</span></p>
</div>
<div className="col-md-6">
<p><strong>Staff Debrief Form Number</strong>
<span id="staffDebriefFormNumberData">$staffDebriefFormNumber</span></p>
</div>
<div className="col-md-6">
<p><strong>Name of witnesses/adults present</strong>
<span id="nameOfWitnessesData">$nameOfWitnesses</span></p>
</div>
<div className="col-md-6">
<p><strong>Place incident occurred</strong>
<span id="placeOfIncidentData">$placeOfIncident</span></p>
</div>
<div className="col-md-6">
<p><strong>What was used prior to intervention to defuse/deescalate the situation?</strong>
<span id="priorToInterventionData">$priorToIntervention</span></p>
</div>
<div className="col-md-6">
<p><strong>Was the PBS followed and was it sufficient enough to manage this incident?</strong>
<span id="pbsFollowedData">$pbsFollowed</span></p>
</div>
<div className="col-md-6">
<p><strong>Reason for physical intervention</strong>
<span id="reasonForPhysicalInterventionData">$reasonForPhysicalIntervention</span></p>
</div>
<div className="col-md-6">
<p><strong>Staff involved in the physical intervention</strong>
<span id="staffInvolvedInPIData">$staffInvolvedInPI</span></p>
</div>
<div className="col-md-6">
<p><strong>Condition of service user following the incident, including breathing monitoring</strong>
<span id="conditionOfSUData">$conditionOfSU</span></p>
</div>
<div className="col-md-6">
<p><strong>How was the service user calmed?</strong>
<span id="howSuCalmedData">$howSuCalmed</span></p>
</div>
<div className="col-md-12">
<p><strong>Why was the use of force necessary?</strong></p>
<div className="keyChecksWrapper">
<div className="keyPoints">
<div className="table-responsive">
<Table striped bordered hover className='dynamicRows'>
<tbody>
<!-- Use of force necessary details -->
${useOfForceNecessary.map((row) {
return """<tr key=${row.id}>
<td>${row.requirements}</td>
<td>
${row.isChecked() ? """
<img
src="http://16.171.242.62/actionButtonTick.464cd329d1d7b49fd28f9f4d8c486b63.svg"
alt="Tick"
width="24"
height="24"
/>""" : """<img
src="http://16.171.242.62/actionButtonDel.7fcdf165cc653aa57ec7b2167ef2f3cc.svg"
alt="Close"
width="24"
height="24"
/> """}
</td>
</tr>""";
}).join()}
</tbody>
</Table>
</div>
</div>
</div>
<p><strong>If ticked "Other" please explain</strong>
<span id="pleaseExplainData">$pleaseExplain</span></p>
</div>
<div className="col-md-12 mb-3">
<p><strong>Parent Contacted</strong>
<span id="isParentContactedData">$isParentContacted</span></p>
</div>
<!-- Parent contact details -->
$ifParentContactedHtml
<div className="col-md-12 mt-5">
<p><strong>Parent/carers comments</strong>
<span id="parentCarersCommentsData">$parentCarersComments</span></p>
</div>
<div className="col-md-12 mb-3">
<p><strong>How was this form shared with parents/carers?</strong>
<span id="howFormWasSharedData">$howFormWasShared</span></p>
</div>""";
}
}

View File

@@ -0,0 +1,59 @@
class SafeguardingFormHtmlRequest {
final String concernsAboutServiceUser;
final String voiceOfTheServiceUser;
final String areThereAnyImmediateRisks;
final String whatActionDoYouFeel;
final String comments;
final String yourName;
final String anyWitnesses;
final String dateTimeReporting;
final String yourNameDslDdsl;
final String actionTaken;
SafeguardingFormHtmlRequest({
required this.concernsAboutServiceUser,
required this.voiceOfTheServiceUser,
required this.areThereAnyImmediateRisks,
required this.whatActionDoYouFeel,
required this.comments,
required this.yourName,
required this.anyWitnesses,
required this.dateTimeReporting,
required this.yourNameDslDdsl,
required this.actionTaken,
});
String toHtml() {
return """<div className="col-md-12">
<p><strong>Concerns about the service user: </strong><span id="concernsAboutServiceUserData">$concernsAboutServiceUser</span></p>
</div>
<div className="col-md-12">
<p><strong>Voice of the service user: </strong><span id="voiceOfTheServiceUserData">$voiceOfTheServiceUser </span></p>
</div>
<div className="col-md-12">
<p><strong>Are there any immediate risks: </strong><span id="areThereAnyImmediateRisksData">$areThereAnyImmediateRisks</span></p>
</div>
<div className="col-md-12">
<p><strong>What action do you feel should be taken?: </strong><span id="whatActionDoYouFeelData">$whatActionDoYouFeel</span></p>
</div>
<div className="col-md-12">
<p><strong>Comments: </strong><span id="commentsData">$comments</span></p>
</div>
<div className="col-md-4">
<p><strong>Your Name: </strong><span id="yourNameData">$yourName</span></p>
</div>
<div className="col-md-4">
<p><strong>Any witnesses: </strong><span id="anyWitnessesData">$anyWitnesses</span></p>
</div>
<div className="col-md-4">
<p><strong>Date and time of reporting</strong>
<span id="dateTimeReportingData">$dateTimeReporting</span></p>
</div>
<div className="col-md-6">
<p>To be completed by DSL/DDSL<br /><strong>Your Name: </strong><span id="yourNameDslDdslData">$yourNameDslDdsl</span></p>
</div>
<div className="col-md-6">
<p><br /><strong>Action taken: </strong><span id="actionTakenData">$actionTaken</span></p>
</div>""";
}
}

View File

@@ -0,0 +1,20 @@
class ShoweringAndBathFormHtmlRequest {
final String showeringBathType;
final String comments;
ShoweringAndBathFormHtmlRequest({
required this.showeringBathType,
required this.comments,
});
String toHtml() {
return """
<div className="col-md-12">
<p><strong>Type: </strong><span id="showeringBathTypeData">$showeringBathType</span></p>
</div>
<div className="col-md-12">
<p><strong>Comments: </strong><span id="commentsData">${comments.isNotEmpty ? comments : "No assistance required"}</span></p>
</div>
""";
}
}

View File

@@ -0,0 +1,25 @@
class ToiletingFormHtmlRequest {
final bool assistanceRequired;
final String assistanceType;
final String comments;
ToiletingFormHtmlRequest({
required this.assistanceRequired,
required this.assistanceType,
required this.comments,
});
String toHtml() {
return """
<div className="col-md-12">
<p className="text-left"><strong>Was assistance required with toileting? </strong><span id="assistanceRequiredData" className="${assistanceRequired ? "text-success" : "text-danger"}">${assistanceRequired ? "Yes" : "No"}</span></p>
</div>
<div className="col-md-12">
<p><strong>Assistance type: </strong><span id="assistanceTypeData">${assistanceType.isNotEmpty ? assistanceType : "Handled alone"}</span></p>
</div>
<div className="col-md-12">
<p><strong>Comments: </strong><span id="commentsData">${comments.isNotEmpty ? comments : "No assistance required"}</span></p>
</div>
""";
}
}