sf-i-reporting 1.0.74 → 1.0.76

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,17 +4,19 @@
4
4
  * SPDX-License-Identifier: MIT
5
5
  */
6
6
 
7
- import {LitElement, html, css, PropertyValueMap} from 'lit';
7
+ import { LitElement, html, css, PropertyValueMap } from 'lit';
8
8
  // import {customElement, query, queryAssignedElements, property} from 'lit/decorators.js';
9
- import {customElement, query, property} from 'lit/decorators.js';
9
+ import { customElement, query, property } from 'lit/decorators.js';
10
10
  // import {customElement, query, property} from 'lit/decorators.js';
11
11
  import Util from './util';
12
12
  // import {LitElement, html, css} from 'lit';
13
13
  // import {customElement} from 'lit/decorators.js';
14
- import {DataObject, AddButtonObject, createDataObject, createAddButtonObject, isAddButtonObject} from './dataObjects';
14
+ import { DataObject, AddButtonObject, createDataObject, createAddButtonObject, isAddButtonObject } from './dataObjects';
15
15
  import { SfIForm } from 'sf-i-form';
16
16
  import { SfIBricks } from 'sf-i-bricks';
17
17
  import { SfIUploader } from 'sf-i-uploader';
18
+ import { SfChecklist } from 'sf-checklist';
19
+ import { SfISelect } from 'sf-i-select';
18
20
 
19
21
  /*
20
22
 
@@ -49,12 +51,13 @@ export class SfIReporting extends LitElement {
49
51
  projectname: string = "";
50
52
 
51
53
  @property()
52
- configjson: string = "[]";
54
+ // configjson: string = "[]";
53
55
  // configjson: string = "[{\"type\":\"sf-i-form\",\"size\":\"large\",\"label\":\"Tags\",\"hint\":\"Tags applied to notice\",\"id\":\"tags\",\"mode\":\"multiselect-dropdown\",\"apiid\":\"dnytrdlrmxgsy.cloudfront.net/tagging\",\"searchstring\":\"Tag\",\"selectprojection\":\"name\",\"ignoredprojections\":\"["updatetype","project","tagtype","shortid"]\",\"maxselect\":\"100\",\"mandatory\":\"\"}]";
54
56
  // configjson: string = "[{\"type\":\"textarea\",\"name\":\"\",\"size\":\"large\",\"label\":\"Prepared by\",\"hint\":\"Mention the names of people who participated in preparing this document\",\"id\":\"preparedby\",\"value\":\"prepared by test\",\"collapse\":\"true\"},{\"type\":\"textarea\",\"name\":\"\",\"size\":\"large\",\"label\":\"Approved by\",\"hint\":\"Mention the names of people who participated in reviewing this document\",\"id\":\"approvedby\",\"value\":\"test approved by\",\"collapse\":\"true\"},{\"type\":\"textarea\",\"name\":\"\",\"size\":\"large\",\"label\":\"Purpose\",\"hint\":\"This is a checklist for reporting the statutory internal audit results of the infection control program\",\"id\":\"purpose\",\"value\":\"test purpose\",\"collapse\":\"true\"},{\"type\":\"section\",\"name\":\"Compliance with Biomedical Waste Management Rules, 2016\",\"size\":\"\",\"label\":\"\",\"hint\":\"\",\"id\":\"section-0\",\"value\":\"\",\"collapse\":\"false\"},{\"type\":\"yesno+textarea\",\"name\":\"\",\"size\":\"large\",\"label\":\"Is the hospital registered with the State Pollution Control Board (SPCB) for biomedical waste management?\",\"hint\":\"\",\"id\":\"bmwspcb\",\"value\":[\"No\",\"\"],\"collapse\":\"true\"},{\"type\":\"yesno+textarea\",\"name\":\"\",\"size\":\"large\",\"label\":\"Are biomedical waste segregation protocols (color-coded bins) in place and followed as per rules?\",\"hint\":\"\",\"id\":\"bmwcolorcoding\",\"value\":[\"Yes\",\"\"],\"collapse\":\"true\"},{\"type\":\"yesno+textarea\",\"name\":\"\",\"size\":\"large\",\"label\":\"Are disposal records for biomedical waste maintained as required by law?\",\"hint\":\"\",\"id\":\"bmwdisposal\",\"value\":\"\",\"collapse\":\"true\"},{\"type\":\"yesno+textarea\",\"name\":\"\",\"size\":\"large\",\"label\":\"Is there a valid agreement with an authorized biomedical waste disposal vendor?\",\"hint\":\"\",\"id\":\"bmwvendoragreement\",\"value\":\"\",\"collapse\":\"true\"},{\"type\":\"yesno+textarea\",\"name\":\"\",\"size\":\"large\",\"label\":\"Are healthcare staff trained in biomedical waste segregation and disposal protocols?\",\"hint\":\"\",\"id\":\"bmwtraining\",\"value\":\"\",\"collapse\":\"true\"},{\"type\":\"section\",\"name\":\"Compliance with The Drugs and Cosmetics Act, 1940 (Infection Control Equipment and Materials)\",\"size\":\"\",\"label\":\"\",\"hint\":\"\",\"id\":\"section-1\",\"value\":\"\",\"collapse\":\"false\"},{\"type\":\"yesno+textarea\",\"options\":[\"option1\",\"option2\",\"option3\"],\"name\":\"\",\"size\":\"large\",\"label\":\"Are hand hygiene products (e.g., alcohol-based hand rubs) procured from licensed vendors as per statutory regulations?\",\"hint\":\"\",\"id\":\"hhvendors\",\"value\":[\"option2\",\"\"],\"collapse\":\"true\"},{\"type\":\"yesno+textarea\",\"name\":\"\",\"size\":\"large\",\"label\":\"Are disinfectants, sterilants, and antiseptics used in the hospital in compliance with the Drugs and Cosmetics Act?\",\"hint\":\"\",\"id\":\"disinfectantsdca\",\"value\":\"\",\"collapse\":\"true\"},{\"type\":\"yesno+textarea\",\"name\":\"\",\"size\":\"large\",\"label\":\"Is there a regular check on the expiration dates and quality standards of infection control materials?\",\"hint\":\"\",\"id\":\"expirycheck\",\"value\":\"\",\"collapse\":\"true\"},{\"type\":\"section\",\"name\":\"Compliance with The Indian Epidemic Diseases Act, 1897 (Outbreak Management)\",\"size\":\"\",\"label\":\"\",\"hint\":\"\",\"id\":\"section-2\",\"value\":\"\",\"collapse\":\"false\"},{\"type\":\"yesno+textarea\",\"name\":\"\",\"size\":\"large\",\"label\":\"Is there a policy in place for managing infectious disease outbreaks in compliance with the Indian Epidemic Diseases Act?\",\"hint\":\"\",\"id\":\"outbreakpolicy\",\"value\":\"\",\"collapse\":\"true\"},{\"type\":\"yesno+textarea\",\"name\":\"\",\"size\":\"large\",\"label\":\"Are protocols in place for isolation, patient segregation, and reporting of notifiable diseases as per government directives?\",\"hint\":\"\",\"id\":\"diseasereporting\",\"value\":\"\",\"collapse\":\"true\"},{\"type\":\"yesno+textarea\",\"name\":\"\",\"size\":\"large\",\"label\":\"Are outbreak reports documented and communicated to relevant authorities (local health departments, as per law)?\",\"hint\":\"\",\"id\":\"outbreakreporting\",\"value\":\"\",\"collapse\":\"true\"},{\"type\":\"section\",\"name\":\"Compliance with The Water (Prevention and Control of Pollution) Act, 1974 (Water Quality Monitoring)\",\"size\":\"\",\"label\":\"\",\"hint\":\"\",\"id\":\"section-3\",\"value\":\"\",\"collapse\":\"false\"},{\"type\":\"yesno+textarea\",\"name\":\"\",\"size\":\"large\",\"label\":\"Is the hospital water supply tested regularly for microbiological contaminants?\",\"hint\":\"\",\"id\":\"watertesting\",\"value\":\"\",\"collapse\":\"true\"},{\"type\":\"yesno+textarea\",\"name\":\"\",\"size\":\"large\",\"label\":\"Are there documented records of water quality reports, and are they in compliance with prescribed standards?\",\"hint\":\"\",\"id\":\"waterqualityreporting\",\"value\":\"\",\"collapse\":\"true\"},{\"type\":\"yesno+textarea\",\"name\":\"\",\"size\":\"large\",\"label\":\"Is there an arrangement for safe water storage and waste-water disposal in line with statutory requirements?\",\"hint\":\"\",\"id\":\"waterstorage\",\"value\":\"\",\"collapse\":\"true\"},{\"type\":\"section\",\"name\":\"Compliance with The Air (Prevention and Control of Pollution) Act, 1981 (Air Quality Management)\",\"size\":\"\",\"label\":\"\",\"hint\":\"\",\"id\":\"section-4\",\"value\":\"\",\"collapse\":\"false\"},{\"type\":\"yesno+textarea\",\"name\":\"\",\"size\":\"large\",\"label\":\"Are air conditioning and ventilation systems in place that comply with regulatory standards, especially in critical areas like OTs and ICUs?\",\"hint\":\"\",\"id\":\"acinplace\",\"value\":\"\",\"collapse\":\"true\"},{\"type\":\"yesno+textarea\",\"name\":\"\",\"size\":\"large\",\"label\":\"Are air filters in the hospital HVAC systems cleaned or replaced as per environmental laws and infection control guidelines?\",\"hint\":\"\",\"id\":\"airfilters\",\"value\":\"\",\"collapse\":\"true\"},{\"type\":\"yesno+textarea\",\"name\":\"\",\"size\":\"large\",\"label\":\"Are regular air quality audits conducted, and are reports maintained?\",\"hint\":\"\",\"id\":\"airqualityaudits\",\"value\":\"\",\"collapse\":\"true\"},{\"type\":\"section\",\"name\":\"Compliance with The Public Health Act (Surveillance and Reporting)\",\"size\":\"\",\"label\":\"\",\"hint\":\"\",\"id\":\"section-5\",\"value\":\"\",\"collapse\":\"false\"},{\"type\":\"yesno+textarea\",\"name\":\"\",\"size\":\"large\",\"label\":\"Is there a surveillance system for monitoring hospital-acquired infections (HAIs)?\",\"hint\":\"\",\"id\":\"haisurveillance\",\"value\":\"\",\"collapse\":\"true\"},{\"type\":\"yesno+textarea\",\"name\":\"\",\"size\":\"large\",\"label\":\"Are notifiable infections reported to local health authorities as per the law?\",\"hint\":\"\",\"id\":\"infectionreporting\",\"value\":\"\",\"collapse\":\"true\"},{\"type\":\"yesno+textarea\",\"name\":\"\",\"size\":\"large\",\"label\":\"Are infection surveillance records maintained, and are they in compliance with public health laws?\",\"hint\":\"\",\"id\":\"infectionsurveillance\",\"value\":\"\",\"collapse\":\"true\"},{\"type\":\"section\",\"name\":\"Compliance with The Occupational Safety and Health Act (Workplace Safety)\",\"size\":\"\",\"label\":\"\",\"hint\":\"\",\"id\":\"section-6\",\"value\":\"\",\"collapse\":\"false\"},{\"type\":\"yesno+textarea\",\"name\":\"\",\"size\":\"large\",\"label\":\"Are healthcare workers provided with adequate personal protective equipment (PPE) in line with statutory safety regulations?\",\"hint\":\"\",\"id\":\"ppeallocation\",\"value\":\"\",\"collapse\":\"true\"},{\"type\":\"yesno+textarea\",\"name\":\"\",\"size\":\"large\",\"label\":\"Is there a needle stick and sharps injury prevention policy in place, and is it compliant with the OSHA guidelines?\",\"hint\":\"\",\"id\":\"safeipolicy\",\"value\":\"\",\"collapse\":\"true\"},{\"type\":\"yesno+textarea\",\"name\":\"\",\"size\":\"large\",\"label\":\"Are protocols for staff vaccination (e.g., Hepatitis B, Influenza) and post-exposure prophylaxis (PEP) established?\",\"hint\":\"\",\"id\":\"prophylaxis\",\"value\":\"\",\"collapse\":\"true\"},{\"type\":\"section\",\"name\":\"Compliance with The Clinical Establishments (Registration and Regulation) Act, 2010 (General Infection Control Requirements)\",\"size\":\"\",\"label\":\"\",\"hint\":\"\",\"id\":\"section-7\",\"value\":\"\",\"collapse\":\"false\"},{\"type\":\"yesno+textarea\",\"name\":\"\",\"size\":\"large\",\"label\":\"Is the hospital registered under the Clinical Establishments Act, and does it meet the infection control standards prescribed?\",\"hint\":\"\",\"id\":\"registration\",\"value\":\"\",\"collapse\":\"true\"},{\"type\":\"yesno+textarea\",\"name\":\"\",\"size\":\"large\",\"label\":\"Are infection control protocols updated and audited regularly, as required by the Act?\",\"hint\":\"\",\"id\":\"hicprotocolsupdated\",\"value\":\"\",\"collapse\":\"true\"},{\"type\":\"yesno+textarea\",\"name\":\"\",\"size\":\"large\",\"label\":\"Are records of infection control compliance maintained and available for inspection by regulatory authorities?\",\"hint\":\"\",\"id\":\"compliancerecords\",\"value\":\"\",\"collapse\":\"true\"},{\"type\":\"section\",\"name\":\"Compliance with Fire Safety Regulations (Infection Control During Emergency Evacuations)\",\"size\":\"\",\"label\":\"\",\"hint\":\"\",\"id\":\"section-8\",\"value\":\"\",\"collapse\":\"false\"},{\"type\":\"yesno+textarea\",\"name\":\"\",\"size\":\"large\",\"label\":\"Are fire safety protocols in place that ensure infection control measures (e.g., patient isolation) during evacuations?\",\"hint\":\"\",\"id\":\"firesafetyprotocols\",\"value\":\"\",\"collapse\":\"true\"},{\"type\":\"yesno+textarea\",\"name\":\"\",\"size\":\"large\",\"label\":\"Are infection control materials (e.g., masks, gloves) readily available for use during fire drills or actual emergencies?\",\"hint\":\"\",\"id\":\"hicmaterials\",\"value\":\"\",\"collapse\":\"true\"},{\"type\":\"section\",\"name\":\"Compliance with The National Health Mission Guidelines (Sanitation and Hygiene)\",\"size\":\"\",\"label\":\"\",\"hint\":\"\",\"id\":\"section-9\",\"value\":\"\",\"collapse\":\"false\"},{\"type\":\"yesno+textarea\",\"name\":\"\",\"size\":\"large\",\"label\":\"Are the hospital’s sanitation practices in compliance with National Health Mission standards for hospital cleanliness and hygiene?\",\"hint\":\"\",\"id\":\"sanitizationpractices\",\"value\":\"\",\"collapse\":\"true\"},{\"type\":\"yesno+textarea\",\"name\":\"\",\"size\":\"large\",\"label\":\"Are there dedicated housekeeping protocols for the cleaning and disinfection of patient care areas as per government guidelines?\",\"hint\":\"\",\"id\":\"housekeepingprotocols\",\"value\":\"\",\"collapse\":\"true\"},{\"type\":\"yesno+textarea\",\"name\":\"\",\"size\":\"large\",\"label\":\"Are sanitation records maintained, and are they available for regulatory review?\",\"hint\":\"\",\"id\":\"sanitiziationrecords\",\"value\":\"\",\"collapse\":\"true\"},{\"type\":\"section\",\"name\":\"Compliance with The Indian Council of Medical Research (ICMR) Guidelines (Antibiotic Stewardship)\",\"size\":\"\",\"label\":\"\",\"hint\":\"\",\"id\":\"section-10\",\"value\":\"\",\"collapse\":\"false\"},{\"type\":\"yesno+textarea\",\"name\":\"\",\"size\":\"large\",\"label\":\"Is the hospital following ICMR guidelines for antibiotic stewardship to prevent the development of antimicrobial resistance (AMR)?\",\"hint\":\"\",\"id\":\"icmramsguidelines\",\"value\":\"\",\"collapse\":\"true\"},{\"type\":\"yesno+textarea\",\"name\":\"\",\"size\":\"large\",\"label\":\"Are antibiotic use patterns monitored, and are they compliant with ICMR’s antimicrobial stewardship guidelines?\",\"hint\":\"\",\"id\":\"patternsmonitoring\",\"value\":\"\",\"collapse\":\"true\"},{\"type\":\"yesno+textarea\",\"name\":\"\",\"size\":\"large\",\"label\":\"Are periodic audits conducted to assess adherence to guidelines, and are the audit reports documented?\",\"hint\":\"\",\"id\":\"amsaudits\",\"value\":\"\",\"collapse\":\"true\"},{\"type\":\"section\",\"name\":\"Compliance with The Indian Medical Council (Professional Conduct, Etiquette, and Ethics) Regulations, 2002\",\"size\":\"\",\"label\":\"\",\"hint\":\"\",\"id\":\"section-11\",\"value\":\"\",\"collapse\":\"false\"},{\"type\":\"yesno+textarea\",\"name\":\"\",\"size\":\"large\",\"label\":\"Are healthcare workers adhering to professional conduct and ethical guidelines for infection prevention as prescribed by the Medical Council of India?\",\"hint\":\"\",\"id\":\"professionalconduct\",\"value\":\"\",\"collapse\":\"true\"},{\"type\":\"yesno+textarea\",\"name\":\"\",\"size\":\"large\",\"label\":\"Are there protocols in place to report unethical or unsafe infection control practices?\",\"hint\":\"\",\"id\":\"unethicalreporting\",\"value\":\"\",\"collapse\":\"true\"},{\"type\":\"section\",\"name\":\"Compliance with Employee State Insurance (ESI) Act, 1948 (Healthcare Worker Safety)\",\"size\":\"\",\"label\":\"\",\"hint\":\"\",\"id\":\"section-12\",\"value\":\"\",\"collapse\":\"false\"},{\"type\":\"yesno+textarea\",\"name\":\"\",\"size\":\"large\",\"label\":\"Are healthcare workers insured under the ESI scheme, particularly those involved in high-risk infection control activities?\",\"hint\":\"\",\"id\":\"esiinsured\",\"value\":\"\",\"collapse\":\"true\"},{\"type\":\"yesno+textarea\",\"name\":\"\",\"size\":\"large\",\"label\":\"Are there protocols for compensation in case of occupational hazards (e.g., infections contracted at work)?\",\"hint\":\"\",\"id\":\"compensationprotocols\",\"value\":\"\",\"collapse\":\"true\"}]";
55
57
  // configjson: string = "[{\"type\":\"textarea\",\"size\":\"large\",\"label\":\"Prepared by\",\"hint\":\"Mention the names of people who participated in preparing this document\",\"id\":\"preparedby\"},{\"type\":\"textarea\",\"size\":\"large\",\"label\":\"Approved by\",\"hint\":\"Mention the names of people who participated in reviewing this document\",\"id\":\"approvedby\"},[{\"type\":\"itemname\",\"name\":\"External Reporting Agency\"},{\"type\":\"textarea\",\"size\":\"small\",\"label\":\"Name\",\"hint\":\"State the name of the agency\",\"id\":\"name{iter}\"},{\"type\":\"textarea\",\"size\":\"small\",\"label\":\"Type\",\"hint\":\"State the type of the agency such as government (local, state, nationa), private, educational institute, etc.\",\"id\":\"type{iter}\"},{\"type\":\"textarea\",\"size\":\"small\",\"label\":\"Contact Person\",\"hint\":\"Name of the contact person\",\"id\":\"contact-person{iter}\"},{\"type\":\"textarea\",\"size\":\"small\",\"label\":\"Phone Number\",\"hint\":\"Phone number of the contact person\",\"id\":\"contact-phone{iter}\"},{\"type\":\"textarea\",\"size\":\"small\",\"label\":\"Email\",\"hint\":\"Email address of the contact person\",\"id\":\"contact-email{iter}\"},{\"type\":\"textarea\",\"size\":\"small\",\"label\":\"Reporting Method\",\"hint\":\"Method of reporting such as online/email/phone/fax, etc.\",\"id\":\"reporting-method{iter}\"},{\"type\":\"textarea\",\"size\":\"large\",\"label\":\"Role\",\"hint\":\"When to report for e.g. report local outbreak and infection trends, national reporting of infection control and outbreaks, global disease surveillance, response coordination, state-level outbreak and epidemic reporting\",\"id\":\"role{iter}\"}]]";
56
58
  // configjson: string = "[{\"type\":\"textarea\",\"size\":\"large\",\"label\":\"Prepared by\",\"hint\":\"Mention the names of people who participated in preparing this document\",\"id\":\"preparedby\"},{\"type\":\"textarea\",\"size\":\"large\",\"label\":\"Approved by\",\"hint\":\"Mention the names of people who participated in reviewing this document\",\"id\":\"approvedby\"},{\"type\":\"section\",\"name\":\"Program Structure\"},{\"type\":\"subsection\",\"name\":\"Infection Control Committee\"},{\"type\":\"textarea\",\"size\":\"large\",\"label\":\"Responsibilities\",\"hint\":\"Briefly outline the responsibilities of the infection control committee\",\"id\":\"iccresponsibilities\"},[{\"type\":\"committeemember\",\"name\":\"Committee Member\"},{\"type\":\"textarea\",\"size\":\"large\",\"label\":\"Role\",\"hint\":\"Infection Control Officer (ICO), Infection Control Nurses (ICN), Microbiologist, Nursing heads, Representatives from key departments (Surgery, Medicine, Housekeeping, CSSD, etc.)\",\"id\":\"iccstructurerole{iter}\"},{\"type\":\"textarea\",\"size\":\"large\",\"label\":\"Responsibilities\",\"hint\":\"Oversee all infection control activities, review infection surveillance data and action plans, ensure compliance, etc.\",\"id\":\"iccstructureresponsibilities{iter}\"}],{\"type\":\"textarea\",\"size\":\"large\",\"label\":\"Meetings\",\"hint\":\"Meeting frequency, minimum quorum requirements, agenda\",\"id\":\"iccmeetings\"},{\"type\":\"subsection\",\"name\":\"Infection Control Team\"},{\"type\":\"textarea\",\"size\":\"large\",\"label\":\"Responsibilities\",\"hint\":\"Briefly outline the responsibilities of the infection control team\",\"id\":\"ictresponsibilities\"},[{\"type\":\"teammember\",\"name\":\"Team Member\",\"direction\":\"row\"},{\"type\":\"textarea\",\"size\":\"large\",\"label\":\"Role\",\"hint\":\"Infection Control Officer (ICO), Infection Control Nurses (ICN), Microbiologist, Admin Rep., Housekeeping Rep., CSSD Rep., Pharmacist, Engineering Rep., IT Rep.\",\"id\":\"ictstructurerole{iter}\"},{\"type\":\"textarea\",\"size\":\"large\",\"label\":\"Responsibilities\",\"hint\":\"Day-to-day monitoring of infection control practices, ensure compliance with guidelines for high-risk areas (e.g., ICUs, OTs), coordinate with the ICC for feedback and updates, etc.\",\"id\":\"ictstructureresponsibilities{iter}\"}],{\"type\":\"textarea\",\"size\":\"large\",\"label\":\"Meetings\",\"hint\":\"Meeting frequency, minimum quorum requirements, agenda\",\"id\":\"ictmeetings\"},{\"type\":\"section\",\"name\":\"Aims & Objectives\"},{\"type\":\"subsection\",\"name\":\"Aims\"},{\"type\":\"textarea\",\"size\":\"large\",\"label\":\"Aims\",\"hint\":\"Briefly outline the aims of the infection control programme\",\"id\":\"aims\"},{\"type\":\"textarea\",\"size\":\"large\",\"label\":\"Objectives\",\"hint\":\"Precisely define the objectives including quantified targets wherever possible. For e.g. target to reduce HAIs by 20% annually, achieve 95% compliance with hand hygiene protocols across all departments.\",\"id\":\"aims\"},{\"type\":\"section\",\"name\":\"Infection Control Processes\"},{\"type\":\"subsection\",\"name\":\"Hand Hygiene\"},{\"type\":\"textarea\",\"size\":\"large\",\"label\":\"Hand Hygiene Policies\",\"hint\":\"Summarize and reference the policies that are defined for hand hygiene\",\"id\":\"hhpolicies\"},{\"type\":\"textarea\",\"size\":\"large\",\"label\":\"Hand Hygiene SOPs\",\"hint\":\"Summarize and reference the SOPs that are developed, maintained and released for hand hygiene\",\"id\":\"hhsops\"},{\"type\":\"textarea\",\"size\":\"large\",\"label\":\"Hand Hygiene Monitoring\",\"hint\":\"Outline data parameters, methods and quality indicators for monitoring hand hygiene\",\"id\":\"hhmonitoring\"},{\"type\":\"subsection\",\"name\":\"Personal Protective Equipment (PPE)\"},{\"type\":\"textarea\",\"size\":\"large\",\"label\":\"PPE Usage Policies\",\"hint\":\"Summarize and reference the policies that are defined for the indications and usage of PPE for transmission-based precautions\",\"id\":\"ppepolicies\"},{\"type\":\"textarea\",\"size\":\"large\",\"label\":\"PPE Usage SOPs\",\"hint\":\"Summarize and reference the SOPs that are developed, maintained and released for the appropriate usage of PPE in various situations\",\"id\":\"ppesops\"},{\"type\":\"textarea\",\"size\":\"large\",\"label\":\"PPE Usage Monitoring\",\"hint\":\"Outline data parameters, methods and quality indicators for monitoring the usage of PPE\",\"id\":\"ppemonitoring\"},{\"type\":\"subsection\",\"name\":\"Housekeeping\"},{\"type\":\"textarea\",\"size\":\"large\",\"label\":\"Cleaning Protocols\",\"hint\":\"Summarize the cleaning protocols for various areas such as OTs, wards, public areas including toilets, corridors including environment, fixtures, fomites, furniture, furnishings, equipments, etc. Protocols should be appropriately designed for high-touch and low-touch areas.\",\"id\":\"hkcleaning\"},{\"type\":\"textarea\",\"size\":\"large\",\"label\":\"Dilution Protocols\",\"hint\":\"Summarize the cleaning protocols for approved disinfectants for cleaning in various areas such as OTs, wards, public areas including toilets, corridors including environment, fixtures, fomites, furniture, furnishings, equipments, etc. Protocols should be appropriately designed for high-touch and low-touch areas.\",\"id\":\"hkdilution\"},{\"type\":\"textarea\",\"size\":\"large\",\"label\":\"Housekeeping Monitoring\",\"hint\":\"Outline data parameters, methods and quality indicators for monitoring the housekeeping activities in various areas such as OTs, wards, public areas including toilets, corridors including environment, fixtures, fomites, furniture, furnishings, equipments, etc. Include regular checks for surface cleanliness, air quality, water quality, etc.\",\"id\":\"hkmonitoring\"},{\"type\":\"subsection\",\"name\":\"CSSD\"},{\"type\":\"textarea\",\"size\":\"large\",\"label\":\"CSSD Design\",\"hint\":\"Summarise the CSSD design requirements including space requirements, location requirements, layouting and unidirectional flow zoning requirements, separate areas for receiving, washing, cleaning, packing, sterilization, sterile storage & issue and the separation of clean and dirty areas\",\"id\":\"cssddesign\"},{\"type\":\"textarea\",\"size\":\"large\",\"label\":\"CSSD Procedures\",\"hint\":\"Summarise and reference the procedures for cleaning, packing, disinfection and sterilization. Also include the use of flash sterilization and the usage of Spaulding's classification\",\"id\":\"cssdprocedures\"},{\"type\":\"textarea\",\"size\":\"large\",\"label\":\"CSSD Validation Tests\",\"hint\":\"Summarise and reference the usage, frequency and methodologies of validation tests including physical, chemical, biological and engineering tests for sterilization effectiveness\",\"id\":\"cssdvalidation\"},{\"type\":\"textarea\",\"size\":\"large\",\"label\":\"Reuse and recall\",\"hint\":\"Summarise the indications, guidelines and procedures for instrument reuse including the policy of patient intimation. Also include the summary of recall procedures post breakdown for non-functional equipments/devices.\",\"id\":\"cssdreuserecall\"},{\"type\":\"subsection\",\"name\":\"Biomedical Waste Management\"},{\"type\":\"textarea\",\"size\":\"large\",\"label\":\"Segregation & Transfer Procedures\",\"hint\":\"Summarise and reference the procedures for segregation, collection, storage, handling and the use of color codings. Also include the procedure for handover and transfer of biomedical waste to the approved vendor for disposal.\",\"id\":\"bmwsegregation\"},{\"type\":\"textarea\",\"size\":\"large\",\"label\":\"Statutory Provisions\",\"hint\":\"Summarize the statutory provisions of biomedical waste management that are applicable to your hospital\",\"id\":\"bmwstatutory\"},{\"type\":\"subsection\",\"name\":\"Staff Infections Prevention\"},{\"type\":\"textarea\",\"size\":\"large\",\"label\":\"Statutory Requirements\",\"hint\":\"Summarize the statutory requirements for staff immunization including the hospital policies.\",\"id\":\"staffstatutory\"},{\"type\":\"textarea\",\"size\":\"large\",\"label\":\"Staff Infections Reporting\",\"hint\":\"Identify transmissible infections important for staff to report (such as acute conjunctivitis, chickenpox, acute respiratory infections, smear-positive tuberculosis, etc.) and summarize the reporting procedure.\",\"id\":\"staffinfectionreporting\"},{\"type\":\"textarea\",\"size\":\"large\",\"label\":\"Work Restrictions\",\"hint\":\"Summarize the guidelines for work restrictions (limiting roles & responsibilities) for infected staff\",\"id\":\"staffworkrestrictions\"},{\"type\":\"textarea\",\"size\":\"large\",\"label\":\"Prophylaxis\",\"hint\":\"Summarize the indications and procedures for giving pre and post exposure prophylaxis to staff\",\"id\":\"staffprophylaxis\"},{\"type\":\"subsection\",\"name\":\"Safe Injection & Infusion Practices\"},{\"type\":\"textarea\",\"size\":\"large\",\"label\":\"Medication Practices\",\"hint\":\"Summarize the policies and procedures for safe medication practices including single-dose vials, multi-dose vials\",\"id\":\"safeimedication\"},{\"type\":\"textarea\",\"size\":\"large\",\"label\":\"Injection Practices\",\"hint\":\"Summarize the policies and procedures for safe injection practices including preparation, labeling and administration practices\",\"id\":\"safeiinjection\"},{\"type\":\"textarea\",\"size\":\"large\",\"label\":\"Sharps Injury Prevention\",\"hint\":\"Summarize the policies and procedures for sharps injury prevention\",\"id\":\"safeiinjuryprevention\"},{\"type\":\"subsection\",\"name\":\"Antimicrobial Stewardship\"},{\"type\":\"textarea\",\"size\":\"large\",\"label\":\"Clinical Conditions Identification\",\"hint\":\"Summarize the identified clinical conditions for using antimicrobials including antifungals, antibiotics, antivirals and antiparasites from the pov of antimicrobial agent, monotherapy vs combination therapy, escalaction & de-escalation of therapy and dose & duration of therapy\",\"id\":\"amsclinicalconditions\"},{\"type\":\"textarea\",\"size\":\"large\",\"label\":\"Susceptibility Monitoring\",\"hint\":\"Summarize the identified system of monitoring antimicrobial susceptibility\",\"id\":\"amssusceptibility\"},{\"type\":\"textarea\",\"size\":\"large\",\"label\":\"Antimicrobial Usage Policy\",\"hint\":\"Summarize the animicrobial usage policy including the frequency of reviewing this policy\",\"id\":\"amsusagepolicy\"},{\"type\":\"textarea\",\"size\":\"large\",\"label\":\"Antimicrobial Stewardship Committee\",\"hint\":\"Outline the structure, roles and responsibilities of the antimicrobial stewardship committee structure\",\"id\":\"amsstewardshipcommittee\"},{\"type\":\"textarea\",\"size\":\"large\",\"label\":\"Antimicrobial Workflows\",\"hint\":\"Summarize the procedures for antimicrobial workflows such ordering, prescriptions and usages\",\"id\":\"amsworkflows\"},{\"type\":\"subsection\",\"name\":\"Renovation & New Construction\"},{\"type\":\"textarea\",\"size\":\"large\",\"label\":\"Risk Assessment\",\"hint\":\"Summarize the risk assessment methodology and the tool for conducting risk assessment of infection control during renovation & new construction\",\"id\":\"rncriskassessment\"},{\"type\":\"textarea\",\"size\":\"large\",\"label\":\"Inclusion From Design\",\"hint\":\"Summarize the policy of including infection control and the involvement of infection control team since the design stages of any renovation & new construction project\",\"id\":\"rncriskassessment\"},{\"type\":\"subsection\",\"name\":\"Healthcare Associated Infections\"},{\"type\":\"textarea\",\"size\":\"large\",\"label\":\"Care Bundles\",\"hint\":\"Summarize the care bundles developed for prevent CAUTIs, VAPs, SSI, CLABSIs\",\"id\":\"haicarebundles\"},{\"type\":\"textarea\",\"size\":\"large\",\"label\":\"Monitoring\",\"hint\":\"Summarize the monitoring frequencies and methdologies for HAIs\",\"id\":\"haimonitoring\"},{\"type\":\"subsection\",\"name\":\"Dietary Services & Kitchen\"},{\"type\":\"textarea\",\"size\":\"large\",\"label\":\"Statutory Requirements\",\"hint\":\"Summarize the statutory requirements for kitchen & dietary services\",\"id\":\"dskstatutory\"},{\"type\":\"textarea\",\"size\":\"large\",\"label\":\"Design Requirements\",\"hint\":\"Summarize the design requirements of kitchen & dietary services including layout, traffic-flow, prevention of criss-cross traffic, sequence of activities. Also include separate dedicated food preparation areas\",\"id\":\"dskriskassessment\"},{\"type\":\"textarea\",\"size\":\"large\",\"label\":\"Workers Screening\",\"hint\":\"Summarize the policies & procedures for screening kitchen workers and food handlers\",\"id\":\"dskscreening\"},{\"type\":\"textarea\",\"size\":\"large\",\"label\":\"Hygienic Preparation, Storage & Distribution of Food\",\"hint\":\"Summarize the policies & procedures for hygiene measures such as storage of food off the floor, separation in storage of cleaning supplies and food, separate dedicated food preparation areas, identification of measures to prevent flies & insects to come in contact with prepared/stored food. Also include safe preparation, handling, storage & distribution procedures encompassing the temperatures for food distribution as well\",\"id\":\"dskhygiene\"},{\"type\":\"subsection\",\"name\":\"Laundry & Linen Management\"},{\"type\":\"textarea\",\"size\":\"large\",\"label\":\"Procedures\",\"hint\":\"Summarize the policies & procedures for linen change, handling (patient-care, transport to laundry, inside laundry), storage of clean linen, separation of clean & dirty linen, distribution of clean linen. Also include controls to ensure infection prevention & control when laundry management is outsourced\",\"id\":\"llmprocedures\"},{\"type\":\"section\",\"name\":\"Surveillance\"},{\"type\":\"textarea\",\"size\":\"large\",\"label\":\"Infection Surveillance\",\"hint\":\"Include surveillance of hospital-acquired infections (VAP, CLABSI, CAUTI, SSIs), define frequency and methodology for collecting infection data from different units (ICU, OT, general wards), surveillance tools and weekly and monthly review of infection trends and risk factors.\",\"id\":\"surveillanceinfections\"},{\"type\":\"textarea\",\"size\":\"large\",\"label\":\"Antimicrobial Surveillance\",\"hint\":\"Include regular audits of antimicrobial prescriptions and usage, surveillance of resistance patterns in the hospital, frequency of reports to the Antimicrobial Stewardship Committee.\",\"id\":\"surveillanceantimicrobial\"},{\"type\":\"textarea\",\"size\":\"large\",\"label\":\"Environmental Surveillance\",\"hint\":\"Include surface sampling such as regular swabs and testing of high-touch surfaces (ICUs, OT, isolation rooms), air quality monitoring of air handling units and conducting air sampling in critical care areas, water quality testing of RO water in dialysis units for endotoxin levels.\",\"id\":\"surveillanceenvironment\"},{\"type\":\"section\",\"name\":\"Inventory Management\"},{\"type\":\"textarea\",\"size\":\"large\",\"label\":\"Inventory Policies\",\"hint\":\"Summarize and reference the policies that define the expected stock levels of various equipments, devices & materials used in the infection control program for hand hygiene, PPE, biomedical waste management, CSSD, pre & post exposure prophylaxis, safe injection & infusions, isolation & barrier nursing, housekeeping, etc.\",\"id\":\"inventorypolicy\"},{\"type\":\"textarea\",\"size\":\"large\",\"label\":\"Availability Policies\",\"hint\":\"Summarize and reference the policies that define the distribution and expected availability levels across different hospital zones for various equipments, devices & materials used in the infection control program for hand hygiene, PPE, biomedical waste management, CSSD, pre & post exposure prophylaxis, safe injection & infusions, isolation & barrier nursing, housekeeping, etc.\",\"id\":\"availabilitypolicy\"},{\"type\":\"section\",\"name\":\"Trainings\"},{\"type\":\"textarea\",\"size\":\"large\",\"label\":\"Training Policies\",\"hint\":\"Summarize and reference the staff training policies for standard precautions, hand hygiene, PPE usage, antimicrobial stewardship, safe injection & infusion practices, housekeeping, laundry & linen management, biomedical waste management, care bundles for HAI preventions, CSSD operations, reuse and recalls, etc.\",\"id\":\"trainingpolicy\"},{\"type\":\"section\",\"name\":\"Audits\"},{\"type\":\"textarea\",\"size\":\"large\",\"label\":\"Audit Policies\",\"hint\":\"Summarize and reference the audit policies for standard precautions, hand hygiene, PPE usage, antimicrobial stewardship, safe injection & infusion practices, housekeeping, laundry & linen management, biomedical waste management, care bundles for HAI preventions, CSSD operations, reuse and recalls, etc. Include the methodology, frequency, etc.\",\"id\":\"auditpolicy\"},{\"type\":\"section\",\"name\":\"Quality\"},{\"type\":\"textarea\",\"size\":\"large\",\"label\":\"Quality Policies\",\"hint\":\"Summarize and reference the quality policies for material, equipments and devices used in the infection control program, including the expected standards and benchmarks. For PPE, hand hygiene, isolation & barrier nursing, safe injection & infusion, air-conditioning, water supply, housekeeping, biomedical waste, linen management, kitchen & dietary services, CSSD, etc.\",\"id\":\"qualitypolicy\"},{\"type\":\"section\",\"name\":\"Vendor Selection\"},{\"type\":\"textarea\",\"size\":\"large\",\"label\":\"Vendor Selection Policies\",\"hint\":\"Summarize and reference the vendor selection policies for material, equipments and devices used in the infection control program, including the qualification criteria, delivery schedules and agreement clauses. For PPE, hand hygiene, isolation & barrier nursing, safe injection & infusion, air-conditioning, water supply, housekeeping, biomedical waste management, linen management, kitchen & dietary services, CSSD, etc.\",\"id\":\"vendorselectionpolicy\"},{\"type\":\"section\",\"name\":\"Maintenance\"},{\"type\":\"textarea\",\"size\":\"large\",\"label\":\"Maintenance Policies\",\"hint\":\"Summarize and reference the maintenance policies for equipments and facilities used in the infection control program, including the routine, contractual and breakdown maintenance activities. For PPE, hand hygiene, isolation & barrier nursing, safe injection & infusion, air-conditioning, water supply, housekeeping, biomedical waste, linen management, kitchen & dietary services, CSSD, etc.\",\"id\":\"maintenancepolicy\"}]";
57
59
  // configjson: string = "[{\"type\":\"textarea\",\"size\":\"large\",\"label\":\"Prepared by\",\"hint\":\"Mention the names of people who participated in preparing this document\",\"id\":\"preparedby\"},{\"type\":\"textarea\",\"size\":\"large\",\"label\":\"Approved by\",\"hint\":\"Mention the names of people who participated in reviewing this document\",\"id\":\"approvedby\"},{\"type\":\"textarea\",\"size\":\"large\",\"label\":\"Purpose\",\"hint\":\"This is a checklist for reporting the statutory internal audit results of the infection control program\",\"id\":\"purpose\"},{\"type\":\"section\",\"name\":\"Compliance with Biomedical Waste Management Rules, 2016\"},{\"type\":\"yesno+textarea\",\"size\":\"small\",\"label\":\"Is the hospital registered with the State Pollution Control Board (SPCB) for biomedical waste management?\",\"hint\":\"\",\"id\":\"bmwspcb\"},{\"type\":\"yesno+textarea\",\"size\":\"small\",\"label\":\"Are biomedical waste segregation protocols (color-coded bins) in place and followed as per rules?\",\"hint\":\"\",\"id\":\"bmwcolorcoding\"},{\"type\":\"yesno+textarea\",\"size\":\"small\",\"label\":\"Are disposal records for biomedical waste maintained as required by law?\",\"hint\":\"\",\"id\":\"bmwdisposal\"},{\"type\":\"yesno+textarea\",\"size\":\"small\",\"label\":\"Is there a valid agreement with an authorized biomedical waste disposal vendor?\",\"hint\":\"\",\"id\":\"bmwvendoragreement\"},{\"type\":\"yesno+textarea\",\"size\":\"small\",\"label\":\"Are healthcare staff trained in biomedical waste segregation and disposal protocols?\",\"hint\":\"\",\"id\":\"bmwtraining\"},{\"type\":\"section\",\"name\":\"Compliance with The Drugs and Cosmetics Act, 1940 (Infection Control Equipment and Materials)\"},{\"type\":\"yesno+textarea\",\"size\":\"small\",\"label\":\"Are hand hygiene products (e.g., alcohol-based hand rubs) procured from licensed vendors as per statutory regulations?\",\"hint\":\"\",\"id\":\"hhvendors\"},{\"type\":\"yesno+textarea\",\"size\":\"small\",\"label\":\"Are disinfectants, sterilants, and antiseptics used in the hospital in compliance with the Drugs and Cosmetics Act?\",\"hint\":\"\",\"id\":\"disinfectantsdca\"},{\"type\":\"yesno+textarea\",\"size\":\"small\",\"label\":\"Is there a regular check on the expiration dates and quality standards of infection control materials?\",\"hint\":\"\",\"id\":\"expirycheck\"},{\"type\":\"section\",\"name\":\"Compliance with The Indian Epidemic Diseases Act, 1897 (Outbreak Management)\"},{\"type\":\"yesno+textarea\",\"size\":\"small\",\"label\":\"Is there a policy in place for managing infectious disease outbreaks in compliance with the Indian Epidemic Diseases Act?\",\"hint\":\"\",\"id\":\"outbreakpolicy\"},{\"type\":\"yesno+textarea\",\"size\":\"small\",\"label\":\"Are protocols in place for isolation, patient segregation, and reporting of notifiable diseases as per government directives?\",\"hint\":\"\",\"id\":\"diseasereporting\"},{\"type\":\"yesno+textarea\",\"size\":\"small\",\"label\":\"Are outbreak reports documented and communicated to relevant authorities (local health departments, as per law)?\",\"hint\":\"\",\"id\":\"outbreakreporting\"},{\"type\":\"section\",\"name\":\"Compliance with The Water (Prevention and Control of Pollution) Act, 1974 (Water Quality Monitoring)\"},{\"type\":\"yesno+textarea\",\"size\":\"small\",\"label\":\"Is the hospital water supply tested regularly for microbiological contaminants?\",\"hint\":\"\",\"id\":\"watertesting\"},{\"type\":\"yesno+textarea\",\"size\":\"small\",\"label\":\"Are there documented records of water quality reports, and are they in compliance with prescribed standards?\",\"hint\":\"\",\"id\":\"waterqualityreporting\"},{\"type\":\"yesno+textarea\",\"size\":\"small\",\"label\":\"Is there an arrangement for safe water storage and waste-water disposal in line with statutory requirements?\",\"hint\":\"\",\"id\":\"waterstorage\"},{\"type\":\"section\",\"name\":\"Compliance with The Air (Prevention and Control of Pollution) Act, 1981 (Air Quality Management)\"},{\"type\":\"yesno+textarea\",\"size\":\"small\",\"label\":\"Are air conditioning and ventilation systems in place that comply with regulatory standards, especially in critical areas like OTs and ICUs?\",\"hint\":\"\",\"id\":\"acinplace\"},{\"type\":\"yesno+textarea\",\"size\":\"small\",\"label\":\"Are air filters in the hospital HVAC systems cleaned or replaced as per environmental laws and infection control guidelines?\",\"hint\":\"\",\"id\":\"airfilters\"},{\"type\":\"yesno+textarea\",\"size\":\"small\",\"label\":\"Are regular air quality audits conducted, and are reports maintained?\",\"hint\":\"\",\"id\":\"airqualityaudits\"},{\"type\":\"section\",\"name\":\"Compliance with The Public Health Act (Surveillance and Reporting)\"},{\"type\":\"yesno+textarea\",\"size\":\"small\",\"label\":\"Is there a surveillance system for monitoring hospital-acquired infections (HAIs)?\",\"hint\":\"\",\"id\":\"haisurveillance\"},{\"type\":\"yesno+textarea\",\"size\":\"small\",\"label\":\"Are notifiable infections reported to local health authorities as per the law?\",\"hint\":\"\",\"id\":\"infectionreporting\"},{\"type\":\"yesno+textarea\",\"size\":\"small\",\"label\":\"Are infection surveillance records maintained, and are they in compliance with public health laws?\",\"hint\":\"\",\"id\":\"infectionsurveillance\"},{\"type\":\"section\",\"name\":\"Compliance with The Occupational Safety and Health Act (Workplace Safety)\"},{\"type\":\"yesno+textarea\",\"size\":\"small\",\"label\":\"Are healthcare workers provided with adequate personal protective equipment (PPE) in line with statutory safety regulations?\",\"hint\":\"\",\"id\":\"ppeallocation\"},{\"type\":\"yesno+textarea\",\"size\":\"small\",\"label\":\"Is there a needle stick and sharps injury prevention policy in place, and is it compliant with the OSHA guidelines?\",\"hint\":\"\",\"id\":\"safeipolicy\"},{\"type\":\"yesno+textarea\",\"size\":\"small\",\"label\":\"Are protocols for staff vaccination (e.g., Hepatitis B, Influenza) and post-exposure prophylaxis (PEP) established?\",\"hint\":\"\",\"id\":\"prophylaxis\"},{\"type\":\"section\",\"name\":\"Compliance with The Clinical Establishments (Registration and Regulation) Act, 2010 (General Infection Control Requirements)\"},{\"type\":\"yesno+textarea\",\"size\":\"small\",\"label\":\"Is the hospital registered under the Clinical Establishments Act, and does it meet the infection control standards prescribed?\",\"hint\":\"\",\"id\":\"registration\"},{\"type\":\"yesno+textarea\",\"size\":\"small\",\"label\":\"Are infection control protocols updated and audited regularly, as required by the Act?\",\"hint\":\"\",\"id\":\"hicprotocolsupdated\"},{\"type\":\"yesno+textarea\",\"size\":\"small\",\"label\":\"Are records of infection control compliance maintained and available for inspection by regulatory authorities?\",\"hint\":\"\",\"id\":\"compliancerecords\"},{\"type\":\"section\",\"name\":\"Compliance with Fire Safety Regulations (Infection Control During Emergency Evacuations)\"},{\"type\":\"yesno+textarea\",\"size\":\"small\",\"label\":\"Are fire safety protocols in place that ensure infection control measures (e.g., patient isolation) during evacuations?\",\"hint\":\"\",\"id\":\"firesafetyprotocols\"},{\"type\":\"yesno+textarea\",\"size\":\"small\",\"label\":\"Are infection control materials (e.g., masks, gloves) readily available for use during fire drills or actual emergencies?\",\"hint\":\"\",\"id\":\"hicmaterials\"},{\"type\":\"section\",\"name\":\"Compliance with The National Health Mission Guidelines (Sanitation and Hygiene)\"},{\"type\":\"yesno+textarea\",\"size\":\"small\",\"label\":\"Are the hospital’s sanitation practices in compliance with National Health Mission standards for hospital cleanliness and hygiene?\",\"hint\":\"\",\"id\":\"sanitizationpractices\"},{\"type\":\"yesno+textarea\",\"size\":\"small\",\"label\":\"Are there dedicated housekeeping protocols for the cleaning and disinfection of patient care areas as per government guidelines?\",\"hint\":\"\",\"id\":\"housekeepingprotocols\"},{\"type\":\"yesno+textarea\",\"size\":\"small\",\"label\":\"Are sanitation records maintained, and are they available for regulatory review?\",\"hint\":\"\",\"id\":\"sanitiziationrecords\"},{\"type\":\"section\",\"name\":\"Compliance with The Indian Council of Medical Research (ICMR) Guidelines (Antibiotic Stewardship)\"},{\"type\":\"yesno+textarea\",\"size\":\"small\",\"label\":\"Is the hospital following ICMR guidelines for antibiotic stewardship to prevent the development of antimicrobial resistance (AMR)?\",\"hint\":\"\",\"id\":\"icmramsguidelines\"},{\"type\":\"yesno+textarea\",\"size\":\"small\",\"label\":\"Are antibiotic use patterns monitored, and are they compliant with ICMR’s antimicrobial stewardship guidelines?\",\"hint\":\"\",\"id\":\"patternsmonitoring\"},{\"type\":\"yesno+textarea\",\"size\":\"small\",\"label\":\"Are periodic audits conducted to assess adherence to guidelines, and are the audit reports documented?\",\"hint\":\"\",\"id\":\"amsaudits\"},{\"type\":\"section\",\"name\":\"Compliance with The Indian Medical Council (Professional Conduct, Etiquette, and Ethics) Regulations, 2002\"},{\"type\":\"yesno+textarea\",\"size\":\"small\",\"label\":\"Are healthcare workers adhering to professional conduct and ethical guidelines for infection prevention as prescribed by the Medical Council of India?\",\"hint\":\"\",\"id\":\"professionalconduct\"},{\"type\":\"yesno+textarea\",\"size\":\"small\",\"label\":\"Are there protocols in place to report unethical or unsafe infection control practices?\",\"hint\":\"\",\"id\":\"unethicalreporting\"},{\"type\":\"section\",\"name\":\"Compliance with Employee State Insurance (ESI) Act, 1948 (Healthcare Worker Safety)\"},{\"type\":\"yesno+textarea\",\"size\":\"small\",\"label\":\"Are healthcare workers insured under the ESI scheme, particularly those involved in high-risk infection control activities?\",\"hint\":\"\",\"id\":\"esiinsured\"},{\"type\":\"yesno+textarea\",\"size\":\"small\",\"label\":\"Are there protocols for compensation in case of occupational hazards (e.g., infections contracted at work)?\",\"hint\":\"\",\"id\":\"compensationprotocols\"}]";
60
+ configjson: string = "[{\"type\":\"sf-i-uploader\",\"size\":\"large\",\"label\":\"Contract Document *\",\"hint\":\"Document of the contract\",\"id\":\"contractdocuments\",\"mode\":\"multiselect-dropdown\",\"apiid\":\"1peg5170d3\",\"allowedextensions\":\"["jpg","png","pdf","xls","xlsx","doc","docx"]\",\"extract\":\"yes\",\"maxselect\":\"1\",\"maxsize\":\"5242880\",\"allowdownload\":\"yes\",\"mandatory\":\"\",\"displayinhistory\":\"yes\"},{\"type\":\"textarea\",\"size\":\"small\",\"label\":\"Contract Reference No. *\",\"hint\":\"Contract reference number\",\"id\":\"refno\",\"mandatory\":\"\",\"copytoreopen\":\"yes\",\"displayinhistory\":\"yes\"},{\"type\":\"date\",\"size\":\"large\",\"label\":\"Date of Execution *\",\"hint\":\"The date of execution of the contract\",\"id\":\"dateofexecution\",\"mandatory\":\"\",\"copytoreopen\":\"yes\",\"displayinhistory\":\"yes\"},{\"type\":\"date\",\"size\":\"large\",\"label\":\"Date of Expiry *\",\"hint\":\"The date on which the contract expires.\",\"id\":\"dateofexpiry\",\"mandatory\":\"\",\"copytoreopen\":\"yes\",\"displayinhistory\":\"yes\"},{\"type\":\"date\",\"size\":\"large\",\"label\":\"Date of Renewal *\",\"hint\":\"The date on which the contract renews.\",\"id\":\"dateofrenewal\",\"mandatory\":\"\",\"copytoreopen\":\"yes\",\"displayinhistory\":\"yes\"},{\"type\":\"date\",\"size\":\"large\",\"label\":\"Due Date *\",\"hint\":\"The due date for the contract.\",\"id\":\"duedate\",\"mandatory\":\"\",\"copytoreopen\":\"yes\",\"displayinhistory\":\"yes\"},{\"type\":\"textarea\",\"size\":\"small\",\"label\":\"Contract Term *\",\"hint\":\"Term / Tenure of the contract\",\"id\":\"tenure\",\"mandatory\":\"\",\"copytoreopen\":\"yes\",\"displayinhistory\":\"yes\"},{\"type\":\"textarea\",\"size\":\"small\",\"label\":\"Party - 1 *\",\"hint\":\"Name of the Party - 1\",\"id\":\"party1\",\"mandatory\":\"\",\"copytoreopen\":\"yes\",\"displayinhistory\":\"yes\"},{\"type\":\"textarea\",\"size\":\"small\",\"label\":\"Party - 2 *\",\"hint\":\"Name of the Party - 2\",\"id\":\"party2\",\"mandatory\":\"\",\"copytoreopen\":\"yes\",\"displayinhistory\":\"yes\"},{\"type\":\"textarea\",\"size\":\"small\",\"label\":\"Party - 3\",\"hint\":\"Name of the Party - 3\",\"id\":\"party3\",\"copytoreopen\":\"yes\",\"displayinhistory\":\"yes\"},{\"type\":\"sf-i-bricks\",\"size\":\"large\",\"label\":\"Country *\",\"hint\":\"Country for contract\",\"id\":\"country\",\"mode\":\"select\",\"savenameseparate\":\"yes\",\"maxselect\":\"1\",\"mandatory\":\"\",\"copytoreopen\":\"yes\",\"displayinhistory\":\"yes\"},{\"type\":\"sf-i-bricks\",\"size\":\"large\",\"label\":\"Entity *\",\"hint\":\"Entity for contract\",\"id\":\"entity\",\"dependencies\":[\"country\"],\"mode\":\"select\",\"savenameseparate\":\"yes\",\"maxselect\":\"1\",\"mandatory\":\"\",\"copytoreopen\":\"yes\"},{\"type\":\"sf-i-bricks\",\"size\":\"large\",\"label\":\"Locations *\",\"hint\":\"Locations for contract\",\"id\":\"locations\",\"dependencies\":[\"country\",\"entity\"],\"mode\":\"multiselect\",\"mandatory\":\"\",\"copytoreopen\":\"yes\"},{\"type\":\"sf-i-bricks\",\"size\":\"large\",\"label\":\"Tags *\",\"hint\":\"Tags applied to contract\",\"id\":\"tags\",\"mode\":\"multiselect\",\"dependencies\":[\"country\",\"entity\",\"locations\"],\"searchstring\":\"-Tags\",\"mandatory\":\"\",\"copytoreopen\":\"yes\"},{\"type\":\"sf-i-form\",\"size\":\"large\",\"label\":\"Reporter *\",\"hint\":\"Reporter for the contract\",\"id\":\"reporters\",\"mode\":\"multiselect-dropdown\",\"apiid\":\"dnytrdlrmxgsy.cloudfront.net/userprofile\",\"searchstring\":\"\",\"selectprojection\":\"name\",\"ignoredprojections\":\"["usermap","designation","project","updatetype","userid","shortid","kra","role","trainingstatute","shortnumid","lastmodifiedby","lastmodifiedtime"]\",\"maxselect\":\"1\",\"mandatory\":\"\",\"copytoreopen\":\"yes\",\"displayinhistory\":\"yes\"},{\"type\":\"sf-i-form\",\"size\":\"large\",\"label\":\"Approver *\",\"hint\":\"Approver for the contract\",\"id\":\"approvers\",\"mode\":\"multiselect-dropdown\",\"apiid\":\"dnytrdlrmxgsy.cloudfront.net/userprofile\",\"searchstring\":\"\",\"selectprojection\":\"name\",\"ignoredprojections\":\"["usermap","designation","project","updatetype","userid","shortid","kra","role","trainingstatute","shortnumid","lastmodifiedby","lastmodifiedtime"]\",\"maxselect\":\"1\",\"mandatory\":\"\",\"copytoreopen\":\"yes\",\"displayinhistory\":\"yes\"},{\"type\":\"sf-i-form\",\"size\":\"large\",\"label\":\"Function head *\",\"hint\":\"Function head for the Contract\",\"id\":\"functionheads\",\"mode\":\"multiselect-dropdown\",\"apiid\":\"dnytrdlrmxgsy.cloudfront.net/userprofile\",\"searchstring\":\"\",\"selectprojection\":\"name\",\"ignoredprojections\":\"["usermap","designation","project","updatetype","userid","shortid","kra","role","trainingstatute","shortnumid","lastmodifiedby","lastmodifiedtime"]\",\"maxselect\":\"1\",\"mandatory\":\"\",\"copytoreopen\":\"yes\",\"displayinhistory\":\"yes\"},{\"type\":\"sf-i-form\",\"size\":\"large\",\"label\":\"Auditor *\",\"hint\":\"Auditor for the Contract\",\"id\":\"auditors\",\"mode\":\"multiselect-dropdown\",\"apiid\":\"dnytrdlrmxgsy.cloudfront.net/userprofile\",\"searchstring\":\"\",\"selectprojection\":\"name\",\"ignoredprojections\":\"["usermap","designation","project","updatetype","userid","shortid","kra","role","trainingstatute","shortnumid","lastmodifiedby","lastmodifiedtime"]\",\"maxselect\":\"1\",\"mandatory\":\"\",\"copytoreopen\":\"yes\",\"displayinhistory\":\"yes\"},{\"type\":\"sf-i-form\",\"size\":\"large\",\"label\":\"Viewer *\",\"hint\":\"Viewer for the contract\",\"id\":\"viewers\",\"mode\":\"multiselect-dropdown\",\"apiid\":\"dnytrdlrmxgsy.cloudfront.net/userprofile\",\"searchstring\":\"\",\"selectprojection\":\"name\",\"ignoredprojections\":\"["usermap","designation","project","updatetype","userid","shortid","kra","role","trainingstatute","shortnumid","lastmodifiedby","lastmodifiedtime"]\",\"maxselect\":\"1\",\"mandatory\":\"\",\"copytoreopen\":\"yes\",\"displayinhistory\":\"yes\"},{\"type\":\"sf-i-select\",\"size\":\"large\",\"label\":\"Contract Type *\",\"apiid\":\"dwqyez2puoxmu.cloudfront.net/contracttype\",\"hint\":\"Type of the Contract\",\"id\":\"contracttype\",\"mandatory\":\"\",\"copytoreopen\":\"yes\",\"displayinhistory\":\"yes\"},{\"type\":\"textarea\",\"size\":\"small\",\"label\":\"Context\",\"hint\":\"Context of the contract\",\"id\":\"context\",\"copytoreopen\":\"yes\",\"displayinhistory\":\"yes\"},{\"type\":\"textarea\",\"size\":\"small\",\"label\":\"Remarks\",\"hint\":\"Remarks on the contract\",\"id\":\"remarks\",\"copytoreopen\":\"yes\",\"displayinhistory\":\"yes\"},{\"type\":\"sf-checklist\",\"size\":\"small\",\"label\":\"Terms *\",\"hint\":\"Terms in the contract\",\"elementsjson\":\"[{\\\"name\\\":\\\"Term1\\\"},{\\\"name\\\":\\\"Term2\\\"},{\\\"name\\\":\\\"Term3\\\"},{\\\"name\\\":\\\"Term4\\\"}]\",\"id\":\"terms\",\"mandatory\":\"\",\"copytoreopen\":\"yes\",\"displayinhistory\":\"yes\"}]"
58
61
 
59
62
  getConfigJson = () => {
60
63
  console.log('configjson', this.configjson);
@@ -106,8 +109,8 @@ export class SfIReporting extends LitElement {
106
109
 
107
110
  lastCalendarGenerated: string = ""
108
111
  nextCalendarScheduled: string = ""
109
- // selectedItem: any = {};
110
- selectedItem: any = {id:"2b1d4da9-7cfe-4861-91f2-1727d0cc70b4"};
112
+ selectedItem: any = {};
113
+ // selectedItem: any = { id: "2b1d4da9-7cfe-4861-91f2-1727d0cc70b4" };
111
114
 
112
115
  selectedItemIds: any = [];
113
116
 
@@ -115,10 +118,6 @@ export class SfIReporting extends LitElement {
115
118
 
116
119
  static override styles = css`
117
120
 
118
-
119
- .SfIReportingC {
120
- }
121
-
122
121
  .SfIReportingCCopy {
123
122
  width: 100%;
124
123
  height: 100%;
@@ -155,7 +154,6 @@ export class SfIReporting extends LitElement {
155
154
  .mt-10{
156
155
  margin-top: 10px
157
156
  }
158
- }
159
157
  .ml-10{
160
158
  margin-left: 10px
161
159
  }
@@ -200,10 +198,6 @@ export class SfIReporting extends LitElement {
200
198
  text-transform: capitalize;
201
199
  }
202
200
 
203
- .td-body {
204
-
205
- }
206
-
207
201
  .td-dark {
208
202
  background-color: #e9e9e9;
209
203
  }
@@ -588,46 +582,50 @@ export class SfIReporting extends LitElement {
588
582
  super();
589
583
  }
590
584
 
591
- truncate = ( str: string, n: number, useWordBoundary: boolean ) => {
585
+ truncate = (str: string, n: number, useWordBoundary: boolean) => {
592
586
  if (str.length <= n) { return str; }
593
- const subString = str.slice(0, n-1); // the original check
594
- return (useWordBoundary
595
- ? subString.slice(0, subString.lastIndexOf(" "))
587
+ const subString = str.slice(0, n - 1); // the original check
588
+ return (useWordBoundary
589
+ ? subString.slice(0, subString.lastIndexOf(" "))
596
590
  : subString) + "&hellip;";
597
591
  };
598
592
 
599
593
  selectedValues = () => {
600
- let valueObj: {[key:string] : any} = {};
601
- for(let element of this.dataModel){
602
- if(isAddButtonObject(element)){
594
+ let valueObj: { [key: string]: any } = {};
595
+ for (let element of this.dataModel) {
596
+ if (isAddButtonObject(element)) {
603
597
  let sectionObj = []
604
- for(let subrecord of element.children){
605
- let subrecordObj: {[key:string] : any} = {}
606
- for(let subElement of subrecord){
607
- if(subElement.id !== ""){
608
- if(subElement.type == "sf-i-form"){
609
- let form: SfIForm = (this._SfReportingContainer as HTMLDivElement).querySelector('#'+subElement.id) as SfIForm;
610
- if(subElement.savenameseparate == "yes"){
598
+ for (let subrecord of element.children) {
599
+ let subrecordObj: { [key: string]: any } = {}
600
+ for (let subElement of subrecord) {
601
+ if (subElement.id !== "") {
602
+ if (subElement.type == "sf-i-form") {
603
+ let form: SfIForm = (this._SfReportingContainer as HTMLDivElement).querySelector('#' + subElement.id) as SfIForm;
604
+ if (subElement.savenameseparate == "yes") {
611
605
  subrecordObj[subElement.id + 'id'] = form.selectedValues()[0] ?? "";
612
606
  subrecordObj[subElement.id + 'name'] = form.selectedTexts()[0] ?? "";
613
- }else if((parseInt(subElement.maxselect) ?? 0 )> 0){
607
+ } else if ((parseInt(subElement.maxselect) ?? 0) > 0) {
614
608
  let tempArr = []
615
- for(let [i, val] of form.selectedValues().entries()){
609
+ for (let [i, val] of form.selectedValues().entries()) {
616
610
  tempArr.push(form.selectedTexts()[i] + ';' + val)
617
611
  }
618
612
  subrecordObj[subElement.id] = tempArr
619
- }else{
613
+ } else {
620
614
  subrecordObj[subElement.id] = form.selectedTexts();
621
615
  }
622
- }else if(subElement.type == "sf-i-bricks"){
623
- let bricks: SfIBricks = (this._SfReportingContainer as HTMLDivElement).querySelector('#'+subElement.id) as SfIBricks;
624
- if(subElement.savenameseparate == "yes"){
616
+ } else if (subElement.type == "sf-i-bricks") {
617
+ let bricks: SfIBricks = (this._SfReportingContainer as HTMLDivElement).querySelector('#' + subElement.id) as SfIBricks;
618
+ if (subElement.savenameseparate == "yes") {
625
619
  subrecordObj[subElement.id + 'id'] = bricks.selectedValues()[0] ?? "";
626
620
  subrecordObj[subElement.id + 'name'] = bricks.selectedTexts()[0] ?? "";
627
- }else{
621
+ } else {
628
622
  subrecordObj[subElement.id] = bricks.selectedValueTexts()
629
623
  }
630
- }else{
624
+ } else if (subElement.type == "sf-i-select") {
625
+ let select: SfISelect = (this._SfReportingContainer as HTMLDivElement).querySelector('#' + subElement.id) as SfISelect;
626
+ subrecordObj[subElement.id + 'id'] = select.selectedValues()[0] ?? "";
627
+ subrecordObj[subElement.id + 'name'] = select.selectedTexts()[0] ?? "";
628
+ } else {
631
629
  subrecordObj[subElement.id] = subElement.value;
632
630
  }
633
631
  }
@@ -635,42 +633,47 @@ export class SfIReporting extends LitElement {
635
633
  sectionObj.push(subrecordObj)
636
634
  }
637
635
  valueObj[element.label] = sectionObj
638
- }else{
639
- if(element.id != "" && element.type != "section"){
640
- if(element.type == "sf-i-form"){
641
- let form: SfIForm = (this._SfReportingContainer as HTMLDivElement).querySelector('#'+element.id) as SfIForm;
642
- if(element.savenameseparate == "yes"){
636
+ } else {
637
+ if (element.id != "" && element.type != "section") {
638
+ if (element.type == "sf-i-form") {
639
+ let form: SfIForm = (this._SfReportingContainer as HTMLDivElement).querySelector('#' + element.id) as SfIForm;
640
+ if (element.savenameseparate == "yes") {
643
641
  valueObj[element.id + 'id'] = form.selectedValues()[0] ?? "";
644
642
  valueObj[element.id + 'name'] = form.selectedTexts()[0] ?? "";
645
- }else if((parseInt(element.maxselect) ?? 0 )> 0){
643
+ } else if ((parseInt(element.maxselect) ?? 0) > 0) {
646
644
  let tempArr = []
647
- for(let [i, val] of form.selectedValues().entries()){
645
+ for (let [i, val] of form.selectedValues().entries()) {
648
646
  tempArr.push(form.selectedTexts()[i] + ';' + val)
649
647
  }
650
648
  valueObj[element.id] = tempArr
651
- }else{
649
+ } else {
652
650
  valueObj[element.id] = form.selectedTexts();
653
651
  }
654
652
  console.log('selected values form', form.selectedValues(), form.selectedTexts());
655
- }else if(element.type == "sf-i-form-select"){
653
+ } else if (element.type == "sf-i-form-select") {
656
654
  valueObj[element.id] = element.value
657
- if(element.savenameseparate == "yes"){
655
+ if (element.savenameseparate == "yes") {
658
656
  valueObj[element.id] = element.value
659
- }else{
660
- for(let field of element.selectfields){
657
+ } else {
658
+ for (let field of element.selectfields) {
661
659
  valueObj[field] = element.value[field]
662
660
  }
663
661
  }
664
- }else if(element.type == "sf-i-bricks"){
665
- let bricks: SfIBricks = (this._SfReportingContainer as HTMLDivElement).querySelector('#'+element.id) as SfIBricks;
662
+ } else if (element.type == "sf-i-bricks") {
663
+ let bricks: SfIBricks = (this._SfReportingContainer as HTMLDivElement).querySelector('#' + element.id) as SfIBricks;
666
664
  console.log('sf-i-bricks id', element.id);
667
- if(element.savenameseparate == "yes"){
665
+ if (element.savenameseparate == "yes") {
668
666
  valueObj[element.id + 'id'] = bricks.selectedValues()[0] ?? "";
669
667
  valueObj[element.id + 'name'] = bricks.selectedTexts()[0] ?? "";
670
- }else{
668
+ } else {
671
669
  valueObj[element.id] = bricks.selectedValueTexts()
672
670
  }
673
- }else{
671
+ } else if (element.type == "sf-i-select") {
672
+ let select: SfISelect = (this._SfReportingContainer as HTMLDivElement).querySelector('#' + element.id) as SfISelect;
673
+ valueObj[element.id + 'id'] = select.selectedValues()[0] ?? "";
674
+ valueObj[element.id + 'name'] = select.selectedTexts()[0] ?? "";
675
+
676
+ } else {
674
677
  valueObj[element.id] = element.value;
675
678
  }
676
679
  }
@@ -691,9 +694,9 @@ export class SfIReporting extends LitElement {
691
694
  }
692
695
  submitConfirmClick = () => {
693
696
  console.log('submit confired', this.selectedValues());
694
- if(this.flow == "new"){
697
+ if (this.flow == "new") {
695
698
  this.submitNew();
696
- }else{
699
+ } else {
697
700
  this.submitEdit();
698
701
  }
699
702
  }
@@ -742,45 +745,46 @@ export class SfIReporting extends LitElement {
742
745
  this.submitDelete()
743
746
  }
744
747
 
745
- getBricksValues = (element: DataObject, selectedValues:string[] = []) => {
748
+ getBricksValues = (element: DataObject, selectedValues: string[] = []) => {
746
749
  let names = [];
747
750
  let ids = []
748
- if(element.id == "country"){
749
- for(let country of Object.keys(this.getUserMap())){
750
- if(country == "roles"){
751
+ if (element.id == "country") {
752
+ console.log('getting usermap', this.getUserMap());
753
+ for (let country of Object.keys(this.getUserMap())) {
754
+ if (country == "roles") {
751
755
  continue;
752
756
  }
753
- if(names.indexOf(country.split(';')[0]) < 0){
757
+ if (names.indexOf(country.split(';')[0]) < 0) {
754
758
  names.push(country.split(';')[0])
755
759
  ids.push(country.split(';')[1])
756
760
  }
757
761
  }
758
- }else if(element.id == "entity"){
759
- for(let country of Object.keys(this.getUserMap())){
760
- if(country == "roles"){
762
+ } else if (element.id == "entity") {
763
+ for (let country of Object.keys(this.getUserMap())) {
764
+ if (country == "roles") {
761
765
  continue;
762
766
  }
763
- if(selectedValues.length > 0 && country == selectedValues[0]){
764
- for(let entity of Object.keys(this.getUserMap()[country])){
767
+ if (selectedValues.length > 0 && country == selectedValues[0]) {
768
+ for (let entity of Object.keys(this.getUserMap()[country])) {
765
769
  console.log('bricks entity', entity, selectedValues);
766
- if(names.indexOf(entity.split(';')[0]) < 0){
770
+ if (names.indexOf(entity.split(';')[0]) < 0) {
767
771
  names.push(entity.split(';')[0])
768
772
  ids.push(entity.split(';')[1])
769
773
  }
770
774
  }
771
775
  }
772
776
  }
773
- }else if(element.id == "locations"){
774
- for(let country of Object.keys(this.getUserMap())){
775
- if(country == "roles"){
777
+ } else if (element.id == "locations") {
778
+ for (let country of Object.keys(this.getUserMap())) {
779
+ if (country == "roles") {
776
780
  continue;
777
781
  }
778
- if(selectedValues.length > 0 && country == selectedValues[0]){
779
- for(let entity of Object.keys(this.getUserMap()[country])){
780
- if(selectedValues.length > 1 && entity == selectedValues[1]){
781
- for(let location of Object.keys(this.getUserMap()[country][entity])){
782
+ if (selectedValues.length > 0 && country == selectedValues[0]) {
783
+ for (let entity of Object.keys(this.getUserMap()[country])) {
784
+ if (selectedValues.length > 1 && entity == selectedValues[1]) {
785
+ for (let location of Object.keys(this.getUserMap()[country][entity])) {
782
786
  console.log('bricks location', location, selectedValues);
783
- if(names.indexOf(location.split(';')[0]) < 0){
787
+ if (names.indexOf(location.split(';')[0]) < 0) {
784
788
  names.push(location.split(';')[0])
785
789
  ids.push(location.split(';')[1])
786
790
  }
@@ -789,20 +793,20 @@ export class SfIReporting extends LitElement {
789
793
  }
790
794
  }
791
795
  }
792
- }else if(element.id == "tags"){
793
- for(let country of Object.keys(this.getUserMap())){
794
- if(country == "roles"){
796
+ } else if (element.id == "tags") {
797
+ for (let country of Object.keys(this.getUserMap())) {
798
+ if (country == "roles") {
795
799
  continue;
796
800
  }
797
- if(selectedValues.length > 0 && country == selectedValues[0]){
798
- for(let entity of Object.keys(this.getUserMap()[country])){
799
- if(selectedValues.length > 1 && entity == selectedValues[1]){
800
- for(let location of Object.keys(this.getUserMap()[country][entity])){
801
- if(selectedValues.length > 2 && selectedValues[2].indexOf(location) >= 0){
802
- for(let tag of this.getUserMap()[country][entity][location]['tags']){
801
+ if (selectedValues.length > 0 && country == selectedValues[0]) {
802
+ for (let entity of Object.keys(this.getUserMap()[country])) {
803
+ if (selectedValues.length > 1 && entity == selectedValues[1]) {
804
+ for (let location of Object.keys(this.getUserMap()[country][entity])) {
805
+ if (selectedValues.length > 2 && selectedValues[2].indexOf(location) >= 0) {
806
+ for (let tag of this.getUserMap()[country][entity][location]['tags']) {
803
807
  console.log('bricks tag', tag, selectedValues);
804
- if(tag.indexOf(element.searchstring) >= 0){
805
- if(names.indexOf(tag.split(';')[0]) < 0){
808
+ if (tag.indexOf(element.searchstring) >= 0) {
809
+ if (names.indexOf(tag.split(';')[0]) < 0) {
806
810
  names.push(tag.split(';')[0])
807
811
  ids.push(tag.split(';')[1])
808
812
  }
@@ -815,7 +819,6 @@ export class SfIReporting extends LitElement {
815
819
  }
816
820
  }
817
821
  }
818
-
819
822
  return [names, ids]
820
823
  }
821
824
 
@@ -845,13 +848,13 @@ export class SfIReporting extends LitElement {
845
848
  (this._SfReportingButtonBack as HTMLButtonElement)?.addEventListener('click', this.backClick);
846
849
  }
847
850
  initDetailsListeners = () => {
848
- if(this.editdisable == "true"){
851
+ if (this.editdisable == "true") {
849
852
  (this._SfReportingButtonBack as HTMLButtonElement).style.display = 'none';
850
853
  (this._SfReportingButtonEdit as HTMLButtonElement).style.display = 'none';
851
854
  (this._SfReportingButtonDelete as HTMLButtonElement).style.display = 'none';
852
855
  (this._SfReportingButtonDeleteCancel as HTMLButtonElement).style.display = 'none';
853
856
  (this._SfReportingButtonDeleteConfirm as HTMLButtonElement).style.display = 'none';
854
- }else{
857
+ } else {
855
858
  (this._SfReportingButtonBack as HTMLButtonElement)?.removeEventListener('click', this.backClick);
856
859
  (this._SfReportingButtonBack as HTMLButtonElement)?.addEventListener('click', this.backClick);
857
860
  (this._SfReportingButtonEdit as HTMLButtonElement)?.removeEventListener('click', this.editClick);
@@ -863,7 +866,7 @@ export class SfIReporting extends LitElement {
863
866
  (this._SfReportingButtonDeleteConfirm as HTMLButtonElement)?.removeEventListener('click', this.deleteConfirmClick);
864
867
  (this._SfReportingButtonDeleteConfirm as HTMLButtonElement)?.addEventListener('click', this.deleteConfirmClick);
865
868
  }
866
-
869
+
867
870
  }
868
871
  initEditListeners = () => {
869
872
  (this._SfReportingButtonBack as HTMLButtonElement)?.removeEventListener('click', this.backClick);
@@ -873,33 +876,34 @@ export class SfIReporting extends LitElement {
873
876
  }
874
877
 
875
878
  populateDataModel = () => {
879
+ console.log('populating data model')
876
880
  let sectionCount = 0
877
881
  this.dataModel = [];
878
882
  console.log('getconfigjson', this.getConfigJson());
879
- for(let element of this.getConfigJson()){
880
- if(Array.isArray(element)){
881
- let addElement = element[0];
882
- let schemaElement = element.splice(1, element.length - 1)
883
- let addObject: AddButtonObject = createAddButtonObject({id: addElement.type, label: addElement.name, schema: JSON.stringify(schemaElement), direction: addElement.direction});
884
- this.dataModel.push(addObject);
885
- }else{
886
- if(element.type == "section"){
887
- let dataObj: DataObject = createDataObject({id: 'section-' + sectionCount, name: element.name, type: element.type})
888
- if(this.editdisable == "true" || this.flow == "details"){
889
- dataObj.collapse = "true"
890
- }
891
- this.dataModel.push(dataObj)
892
- sectionCount ++;
893
- }else{
894
- let dataObj: DataObject = createDataObject(element)
895
- this.dataModel.push(dataObj)
883
+ for (let element of this.getConfigJson()) {
884
+ if (Array.isArray(element)) {
885
+ let addElement = element[0];
886
+ let schemaElement = element.splice(1, element.length - 1)
887
+ let addObject: AddButtonObject = createAddButtonObject({ id: addElement.type, label: addElement.name, schema: JSON.stringify(schemaElement), direction: addElement.direction });
888
+ this.dataModel.push(addObject);
889
+ } else {
890
+ if (element.type == "section") {
891
+ let dataObj: DataObject = createDataObject({ id: 'section-' + sectionCount, name: element.name, type: element.type })
892
+ if (this.editdisable == "true" || this.flow == "details") {
893
+ dataObj.collapse = "true"
896
894
  }
895
+ this.dataModel.push(dataObj)
896
+ sectionCount++;
897
+ } else {
898
+ let dataObj: DataObject = createDataObject(element)
899
+ this.dataModel.push(dataObj)
897
900
  }
901
+ }
898
902
  }
899
903
  console.log('dataModel', this.dataModel);
900
904
  }
901
905
 
902
- populateView = (scrollTopTarget: number = 0) => {
906
+ populateView = async (scrollTopTarget: number = 0) => {
903
907
  console.log('populating view');
904
908
  let html = "";
905
909
  // html += `<div class="d-flex justify-between m-20">
@@ -911,9 +915,9 @@ export class SfIReporting extends LitElement {
911
915
  <div class="d-flex w-100-m-0 justify-between align-center">
912
916
  ${this.editdisable != "true" ? `
913
917
  <button id="button-back" part="button-icon" class="button-icon-click"><span class="material-icons">keyboard_backspace</span></button>` : ''}
914
- ${this.editdisable != "true" ? `<h3 part="results-title" class="m-0">${this.name}</h3>`: ''}
918
+ ${this.editdisable != "true" ? `<h3 part="results-title" class="m-0">${this.name}</h3>` : ''}
915
919
  ${this.editdisable != "true" ? (`
916
- <div class="d-flex justify-center align-center">${ this.flow == "new" ? `
920
+ <div class="d-flex justify-center align-center">${this.flow == "new" ? `
917
921
  <button class="mrl-5 material-icons invisible" part="button-icon" id="button-submit" disabled>upload</button>
918
922
  <button class="mrl-5 material-icons hide" part="button-icon-light" id="button-submit-cancel">close</button>
919
923
  <button class="mrl-5 material-icons hide" part="button-icon" id="button-submit-confirm">check save</button>
@@ -929,8 +933,8 @@ export class SfIReporting extends LitElement {
929
933
  <button class="mrl-5 material-icons hide" part="button-icon" id="button-submit" disabled>upload</button>
930
934
  <button class="mrl-5 material-icons hide" part="button-icon-light" id="button-submit-cancel">close</button>
931
935
  <button class="mrl-5 material-icons hide" part="button-icon" id="button-submit-confirm">check save</button>
932
- `)
933
- }
936
+ `)
937
+ }
934
938
  </div>`) : ''}
935
939
  </div>
936
940
  <div class="progress-bar w-100-m-0 d-flex flex-wrap" part="progress-bar">
@@ -942,37 +946,37 @@ export class SfIReporting extends LitElement {
942
946
  <div class="d-flex ${this.formviewclass} form-container align-stretch p-10" part="${this.published ? "form-container-published" : "form-container"}">`
943
947
 
944
948
  let firstFlag = true
945
- for(let element of this.dataModel){
946
- if(isAddButtonObject(element)){
949
+ for (let element of this.dataModel) {
950
+ if (isAddButtonObject(element)) {
947
951
  let addButtonObject = element as AddButtonObject;
948
952
  for (let i = 0; i < addButtonObject.children.length; i++) {
949
953
  html += this.renderAddSection(addButtonObject, (i + 1))
950
954
  html += this.renderSectionContainer(addButtonObject);
951
- for(let childElement of addButtonObject.children[i]){
955
+ for (let childElement of addButtonObject.children[i]) {
952
956
  html += this.renderElement(childElement);
953
957
  }
954
- if(addButtonObject.direction == "row"){
958
+ if (addButtonObject.direction == "row") {
955
959
  html += '</div>'
956
960
  }
957
961
  }
958
- if(this.mode != "view"){
962
+ if (this.mode != "view") {
959
963
  html += this.renderAddButton(addButtonObject);
960
964
  }
961
- }else{
962
- if(element.type == "section"){
963
- if(firstFlag){
965
+ } else {
966
+ if (element.type == "section") {
967
+ if (firstFlag) {
964
968
  firstFlag = false;
965
- }else{
969
+ } else {
966
970
  html += '</div></div>'
967
971
  }
968
972
  }
969
973
  html += this.renderElement(element)
970
974
  }
971
975
  }
972
-
976
+
973
977
  html += "</div></div>";
974
- if(this.flow == "new"){
975
-
978
+ if (this.flow == "new") {
979
+
976
980
  html += `
977
981
  <div part="published-container" class="d-flex flex-col flex-grow">
978
982
 
@@ -982,7 +986,7 @@ export class SfIReporting extends LitElement {
982
986
  </div>
983
987
  </div>`
984
988
  }
985
- if(this.flow != "details"){
989
+ if (this.flow != "details") {
986
990
  html += `
987
991
  <div class="sf-i-form-modal-container d-flex flex-col align-stretch hide" part="sf-i-form-modal-container" id="sf-i-form-modal-container">
988
992
  <div class="sf-i-form-modal-button-container d-flex justify-between align-center p-10" part="sf-i-form-modal-button-container">
@@ -993,20 +997,20 @@ export class SfIReporting extends LitElement {
993
997
  </div>
994
998
  `;
995
999
  }
996
-
1000
+
997
1001
  (this._SfReportingContainer as HTMLDivElement).innerHTML = html;
998
1002
  (this._SfReportingContainer as HTMLDivElement).style.display = 'block';
999
1003
  this.initSectionListeners();
1000
1004
  this.initListeners();
1001
1005
  // (this._SfReportingButtonContainer as HTMLDivElement).style.display = 'flex';
1002
- if(this.mode == "view"){
1003
- // (this._SfReportingButtonEdit as HTMLButtonElement).style.display = 'flex';
1004
- // (this._SfReportingButtonSubmit as HTMLButtonElement).style.display = 'none';
1005
- // (this._SfReportingButtonSubmitConfirm as HTMLButtonElement).style.display = 'none';
1006
- // (this._SfReportingButtonSubmitCancel as HTMLButtonElement).style.display = 'none';
1007
- }else{
1006
+ if (this.mode == "view") {
1007
+ // (this._SfReportingButtonEdit as HTMLButtonElement).style.display = 'flex';
1008
+ // (this._SfReportingButtonSubmit as HTMLButtonElement).style.display = 'none';
1009
+ // (this._SfReportingButtonSubmitConfirm as HTMLButtonElement).style.display = 'none';
1010
+ // (this._SfReportingButtonSubmitCancel as HTMLButtonElement).style.display = 'none';
1011
+ } else {
1008
1012
  this.initInputListeners();
1009
- if(this.mode == "admin" && this.flow != "details"){
1013
+ if (this.mode == "admin" && this.flow != "details") {
1010
1014
  // (this._SfReportingButtonEdit as HTMLButtonElement).style.display = 'none';
1011
1015
  (this._SfReportingButtonSubmit as HTMLButtonElement).style.display = 'flex';
1012
1016
  (this._SfReportingButtonSubmit as HTMLButtonElement).disabled = this.flow == "view";
@@ -1014,50 +1018,57 @@ export class SfIReporting extends LitElement {
1014
1018
  (this._SfReportingButtonSubmitCancel as HTMLButtonElement).style.display = 'none';
1015
1019
  }
1016
1020
  }
1017
- for(let element of this.dataModel){
1018
- if(element.type == "sf-i-form"){
1019
- let form: SfIForm = (this._SfReportingContainer as HTMLDivElement).querySelector('#'+element.id) as SfIForm;
1020
- if(this.mode == "view" || this.flow == "details"){
1021
+ for (let element of this.dataModel) {
1022
+ if (element.type == "sf-i-form") {
1023
+ let form: SfIForm = (this._SfReportingContainer as HTMLDivElement).querySelector('#' + element.id) as SfIForm;
1024
+ if (this.mode == "view" || this.flow == "details") {
1021
1025
  form.flow = "read"
1022
1026
  }
1023
- if(element.value != ''){
1027
+ if (element.value != '') {
1024
1028
  form.selectedSearchId = element.value
1025
1029
  }
1026
-
1030
+
1027
1031
  // setTimeout(() => {form.loadMode();},1000)
1028
- }else if(element.type == "sf-i-bricks"){
1032
+ } else if (element.type == "sf-i-bricks") {
1029
1033
  console.log('bricks element value', element.value, element.id);
1030
- let bricks: SfIBricks = (this._SfReportingContainer as HTMLDivElement).querySelector('#'+element.id) as SfIBricks
1034
+ let bricks: SfIBricks = (this._SfReportingContainer as HTMLDivElement).querySelector('#' + element.id) as SfIBricks
1031
1035
  let selectedDependedValues = []
1032
- for(let dependency of element.dependencies){
1033
- for(let tempElement of this.dataModel){
1034
- if(tempElement.id == dependency){
1036
+ for (let dependency of element.dependencies) {
1037
+ for (let tempElement of this.dataModel) {
1038
+ if (tempElement.id == dependency) {
1035
1039
  selectedDependedValues.push(tempElement.value)
1036
1040
  }
1037
1041
  }
1038
1042
  }
1039
1043
  let values = this.getBricksValues(element, selectedDependedValues);
1040
- console.log('bricks selecteddependantvalues', selectedDependedValues, element.value, values[1]);
1044
+ console.log('bricks selecteddependantvalues', element.id, selectedDependedValues, values[1]);
1041
1045
  bricks.namesjson = JSON.stringify(values[0])
1042
1046
  bricks.idsjson = JSON.stringify(values[1])
1043
- if(element.value != ''){
1047
+ if (element.value != '') {
1044
1048
  bricks.prepopulateValJson = JSON.stringify(element.value)
1045
- }else{
1049
+ } else {
1046
1050
  bricks.prepopulateValJson = JSON.stringify([])
1047
1051
  }
1048
- console.log('bricks element values', bricks.prepopulateValJson, element.id);
1049
- if(this.mode == "view" || this.flow == "details"){
1052
+ console.log('bricks element values', bricks.prepopulateValJson, bricks.namesjson, bricks.idsjson, element.id);
1053
+ if (this.mode == "view" || this.flow == "details") {
1050
1054
  bricks.flow = "view"
1051
- }else{
1055
+ } else {
1052
1056
  bricks.flow = "edit"
1053
1057
  }
1054
- }else if(element.type == "sf-i-uploader"){
1055
- let uploader: SfIUploader = (this._SfReportingContainer as HTMLDivElement).querySelector('#'+element.id) as SfIUploader
1058
+ bricks.loadMode()
1059
+ } else if (element.type == "sf-i-uploader") {
1060
+ await customElements.whenDefined('sf-i-uploader');
1061
+ let uploader: SfIUploader = (this._SfReportingContainer as HTMLDivElement).querySelector('#' + element.id) as SfIUploader
1056
1062
  uploader.prepopulatedInputArr = JSON.stringify(element.value ?? []);
1057
1063
  uploader.readOnly = (this.mode == "view" || this.flow == "details")
1058
- uploader.loadMode()
1059
- }else if(element.type == "sf-i-form-select"){
1060
- let buttonEditForm = (this._SfReportingContainer as HTMLDivElement).querySelector('#button-edit-form-'+element.id) as HTMLButtonElement
1064
+ console.log('uploader', uploader, uploader.prepopulatedInputArr, element.value);
1065
+ if (uploader != null) {
1066
+ setTimeout(() => {
1067
+ uploader.loadMode()
1068
+ },500)
1069
+ }
1070
+ } else if (element.type == "sf-i-form-select") {
1071
+ let buttonEditForm = (this._SfReportingContainer as HTMLDivElement).querySelector('#button-edit-form-' + element.id) as HTMLButtonElement
1061
1072
  buttonEditForm?.addEventListener('click', () => {
1062
1073
  let formHtml = `
1063
1074
  <div part="date-container" class="d-flex flex-col flex-grow mt-20">
@@ -1066,7 +1077,7 @@ export class SfIReporting extends LitElement {
1066
1077
  <sf-i-form exportparts="td-action:form-td-action, td-body" id="${element.id}" class="reporting-sf-i-form" part="input-sf-i-form" name="${element.name}" label="" apiId="${element.apiid}" mode="${element.mode}" searchPhrase="${((element.mode == "multiselect-dropdown" || element.searchstring != "") ? (this.projectname + "&") : "") + element.searchstring}" selectProjection="${element.selectprojection}" ignoreProjections="${element.ignoredprojections}" ${parseInt(element.maxselect) == 0 ? "" : `maxselect="${element.maxselect}"`} ${element.mandatory != null ? "mandatory=\"\"" : ""}></sf-i-form>
1067
1078
  </div>
1068
1079
  `
1069
-
1080
+
1070
1081
  let formContainer = (this._SfReportingContainer as HTMLDivElement).querySelector('#sf-i-form-container') as HTMLDivElement
1071
1082
  formContainer.innerHTML = formHtml
1072
1083
  let formModalContainer = (this._SfReportingContainer as HTMLDivElement).querySelector('#sf-i-form-modal-container') as HTMLDivElement
@@ -1082,17 +1093,17 @@ export class SfIReporting extends LitElement {
1082
1093
  // formObj.loadMode();
1083
1094
  // }
1084
1095
  console.log('selectedsearchid', element.value)
1085
- if((element.value.id ?? '') != ''){
1096
+ if ((element.value.id ?? '') != '') {
1086
1097
  formObj.selectedSearchId = element.value.id
1087
1098
  console.log('form selectedsearchid', formObj.selectedSearchId)
1088
1099
  formSaveButton.style.visibility = 'visible';
1089
- }else{
1100
+ } else {
1090
1101
  formSaveButton.style.visibility = 'hidden';
1091
1102
  }
1092
- formObj.addEventListener('valueChanged',() => {
1093
- if(formObj.selectedEntireValues() != null && Object.keys(formObj.selectedEntireValues()).length > 0){
1103
+ formObj.addEventListener('valueChanged', () => {
1104
+ if (formObj.selectedEntireValues() != null && Object.keys(formObj.selectedEntireValues()).length > 0) {
1094
1105
  formSaveButton.style.visibility = 'visible';
1095
- }else{
1106
+ } else {
1096
1107
  formSaveButton.style.visibility = 'hidden';
1097
1108
  }
1098
1109
  })
@@ -1101,87 +1112,109 @@ export class SfIReporting extends LitElement {
1101
1112
  formModalContainer.style.display = 'none'
1102
1113
  let formObj = formContainer.querySelector('#' + element.id) as SfIForm
1103
1114
  console.log("selected", formObj, element.id)
1104
- for(let dataElement of this.dataModel){
1105
- if(dataElement.id == element.id){
1106
- let valObj:any = {}
1115
+ for (let dataElement of this.dataModel) {
1116
+ if (dataElement.id == element.id) {
1117
+ let valObj: any = {}
1107
1118
  let selectedObj = formObj.selectedEntireValues()
1108
1119
  valObj.id = selectedObj.id
1109
1120
  let cols = JSON.parse(selectedObj.fields?.cols ?? '[]')
1110
1121
  let data = JSON.parse(selectedObj.fields?.data ?? '[]')
1111
- for(let [i, col] of cols.entries()){
1122
+ for (let [i, col] of cols.entries()) {
1112
1123
  valObj[col] = data[i]
1113
1124
  }
1114
- if(dataElement.savenameseparate == "yes"){
1125
+ if (dataElement.savenameseparate == "yes") {
1115
1126
  console.log('populating dataelement', valObj)
1116
1127
  dataElement.value = [valObj.name + ';' + valObj.id];
1117
- }else{
1128
+ } else {
1118
1129
  dataElement.value = valObj
1119
1130
  }
1120
1131
  }
1121
1132
  }
1122
1133
  let reportingFormContainer = (this._SfReportingContainer as HTMLDivElement).querySelector('.form-container') as HTMLDivElement
1123
- if(reportingFormContainer != null){
1134
+ if (reportingFormContainer != null) {
1124
1135
  console.log('scrolling', reportingFormContainer.scrollTop)
1125
1136
  this.populateView(reportingFormContainer.scrollTop);
1126
1137
  }
1127
1138
  })
1128
- if(element.dependencies != null && element.dependencies.length > 0){
1139
+ if (element.dependencies != null && element.dependencies.length > 0) {
1129
1140
  this.updateShortlistedSearchPhrases(element.id);
1130
1141
  }
1131
1142
  })
1143
+ } else if (element.type == "sf-i-select") {
1144
+ console.log('rendering sf-i-select', element.id)
1145
+ await customElements.whenDefined('sf-i-select');
1146
+ let select: SfISelect = (this._SfReportingContainer as HTMLDivElement).querySelector('#' + element.id) as SfISelect
1147
+ select.flow = (this.mode == "view" || this.flow == "details") ? "read" : ""
1148
+ if (element.value != '') {
1149
+ let valArr = [element.value[0].split(';')[1]]
1150
+ select.selectedId = valArr
1151
+ }
1152
+ select.loadMode()
1153
+ console.log('sf-i-select', select, select.selectedId, element.id);
1154
+ } else if (element.type == "sf-checklist") {
1155
+ console.log('rendering sf-checklist', element.id, JSON.stringify(element.value));
1156
+ await customElements.whenDefined('sf-checklist');
1157
+ let checklist: SfChecklist = (this._SfReportingContainer as HTMLDivElement).querySelector('#' + element.id) as SfChecklist
1158
+ checklist.listelements = JSON.parse(element.elementsjson)
1159
+ checklist.listselection = element.value
1160
+ checklist.readonly = (this.mode == "view" || this.flow == "details")
1161
+ console.log('sf-checklist', checklist, checklist.listelements, checklist.listselection, element.value);
1162
+ setTimeout(() => {
1163
+ checklist.loadMode()
1164
+ },200)
1132
1165
  }
1133
1166
  }
1134
- if(this.mode != "view" && this.flow != 'details'){
1167
+ if (this.mode != "view" && this.flow != 'details') {
1135
1168
  let selectedOptions = (this._SfReportingContainer as HTMLDivElement).querySelectorAll('.selected-option') as NodeListOf<HTMLDivElement>
1136
- for(let selectedOption of selectedOptions){
1137
- selectedOption?.addEventListener('click',async (ev: any) => {
1169
+ for (let selectedOption of selectedOptions) {
1170
+ selectedOption?.addEventListener('click', async (ev: any) => {
1138
1171
  await this.showLoader();
1139
1172
  let target = ev.target
1140
1173
  let elementId = target.id
1141
1174
  let id = elementId.split('-')[2]
1142
- for(let [i, dataObj] of this.dataModel.entries()){
1143
- if(dataObj.id == id){
1175
+ for (let [i, dataObj] of this.dataModel.entries()) {
1176
+ if (dataObj.id == id) {
1144
1177
  this.dataModel[i].value = ''
1145
1178
  }
1146
1179
  }
1147
1180
  let formContainer = (this._SfReportingContainer.querySelector('.form-container') as HTMLElement)
1148
- if(formContainer != null){
1181
+ if (formContainer != null) {
1149
1182
  this.populateView(formContainer.scrollTop);
1150
1183
  }
1151
1184
  })
1152
1185
  }
1153
1186
  }
1154
1187
  let checkboxPublish = (this._SfReportingContainer as HTMLDivElement).querySelector('#input-publish-checkbox') as HTMLInputElement
1155
- checkboxPublish?.addEventListener('click',(ev:any) => {
1156
- let target = ev.target as HTMLInputElement
1157
- this.published = target.checked
1158
- let publishedContainer = (this._SfReportingContainer as HTMLDivElement).querySelector('#published-container') as HTMLDivElement
1159
- publishedContainer.setAttribute('part', this.published ? "published-container-published" : "published-container-unpublished")
1160
- let formContainer = this._SfReportingContainer.querySelector('.form-container') as HTMLDivElement
1161
- formContainer.setAttribute('part',this.published ? "form-container-published" : "form-container")
1162
- console.log('publish checked', this.published);
1163
- }
1164
- )
1188
+ checkboxPublish?.addEventListener('click', (ev: any) => {
1189
+ let target = ev.target as HTMLInputElement
1190
+ this.published = target.checked
1191
+ let publishedContainer = (this._SfReportingContainer as HTMLDivElement).querySelector('#published-container') as HTMLDivElement
1192
+ publishedContainer.setAttribute('part', this.published ? "published-container-published" : "published-container-unpublished")
1193
+ let formContainer = this._SfReportingContainer.querySelector('.form-container') as HTMLDivElement
1194
+ formContainer.setAttribute('part', this.published ? "form-container-published" : "form-container")
1195
+ console.log('publish checked', this.published);
1196
+ }
1197
+ )
1165
1198
  let checkboxPublishLabel = (this._SfReportingContainer as HTMLDivElement).querySelector('#input-publish-checkbox-label') as HTMLLabelElement
1166
- checkboxPublishLabel?.addEventListener('click',() => {
1199
+ checkboxPublishLabel?.addEventListener('click', () => {
1167
1200
  checkboxPublish.click()
1168
- })
1201
+ })
1169
1202
 
1170
1203
  let buttonBack = (this._SfReportingContainer as HTMLDivElement).querySelector('#button-back') as HTMLButtonElement
1171
- buttonBack?.addEventListener('click',this.backClick);
1204
+ buttonBack?.addEventListener('click', this.backClick);
1172
1205
 
1173
1206
  let buttonSubmit = (this._SfReportingContainer as HTMLDivElement).querySelector('#button-submit') as HTMLButtonElement
1174
- if(this.flow == "new"){
1207
+ if (this.flow == "new") {
1175
1208
  buttonSubmit.style.visibility = 'visible'
1176
1209
  }
1177
1210
  buttonSubmit?.addEventListener('click', this.submitClick);
1178
1211
  let buttonSubmitConfirm = (this._SfReportingContainer as HTMLDivElement).querySelector('#button-submit-confirm') as HTMLButtonElement
1179
- buttonSubmitConfirm?.addEventListener('click',this.submitConfirmClick)
1212
+ buttonSubmitConfirm?.addEventListener('click', this.submitConfirmClick)
1180
1213
  let buttonSubmitCancel = (this._SfReportingContainer as HTMLDivElement).querySelector('#button-submit-cancel') as HTMLButtonElement
1181
1214
  buttonSubmitCancel?.addEventListener('click', this.submitCancelClick)
1182
1215
 
1183
1216
  let buttonPublish = ((this._SfReportingContainer as HTMLDivElement).querySelector('#button-submit-publish') as HTMLButtonElement)
1184
- buttonPublish?.addEventListener('click',()=>{
1217
+ buttonPublish?.addEventListener('click', () => {
1185
1218
  console.log('publish clicked', this.published);
1186
1219
  this.publishClick();
1187
1220
  })
@@ -1194,88 +1227,88 @@ export class SfIReporting extends LitElement {
1194
1227
  buttonDeleteCancel?.addEventListener('click', this.deleteCancelClick)
1195
1228
  let buttonDeleteConfirm = (this._SfReportingContainer as HTMLDivElement).querySelector('#button-delete-confirm') as HTMLButtonElement
1196
1229
  buttonDeleteConfirm?.addEventListener('click', this.submitDelete)
1197
-
1230
+
1198
1231
  let buttonEditCancel = (this._SfReportingContainer as HTMLDivElement).querySelector('#button-edit-cancel') as HTMLButtonElement
1199
1232
  buttonEditCancel?.addEventListener('click', this.editCancelClick)
1200
1233
 
1201
- setTimeout(()=>{
1234
+ setTimeout(() => {
1202
1235
  this.evalShowProgress();
1203
- (this._SfReportingContainer.querySelector('.form-container') as HTMLDivElement).scrollTo({top: scrollTopTarget, left:0});
1236
+ (this._SfReportingContainer.querySelector('.form-container') as HTMLDivElement).scrollTo({ top: scrollTopTarget, left: 0 });
1204
1237
  this.hideLoader();
1205
1238
  let customEvent = new CustomEvent('valueChanged');
1206
1239
  this.dispatchEvent(customEvent);
1207
- },500)
1208
- if(this.getPrepopulateJson().history != null && Object.keys(this.getPrepopulateJson().history).length > 0){
1240
+ }, 500)
1241
+ if (this.getPrepopulateJson().history != null && Object.keys(this.getPrepopulateJson().history).length > 0) {
1209
1242
  this.populateHistory()
1210
1243
  }
1211
1244
  }
1212
1245
 
1213
1246
  populateHistory = () => {
1214
1247
  let formContainer = (this._SfReportingContainer.querySelector('.form-container') as HTMLElement)
1215
- if(formContainer != null){
1248
+ if (formContainer != null) {
1216
1249
  let html = ''
1217
1250
  html += `
1218
1251
  <div class="d-flex flex-col" part="section-container"><div id="history" class="section-head d-flex align-center justify-between" part="section-head-collapsed"><h3 part="section-title-collapsed" id="section-history-title">History</h3><div class="material-icons" id="section-history-icon">keyboard_arrow_down</div></div><div id="section-history-body" class="section-body d-flex ${this.formviewclass} hide" part="section-body">
1219
1252
  `
1220
- for(let [indexDate, historyDate] of Object.keys(this.getPrepopulateJson().history).entries()){
1253
+ for (let [indexDate, historyDate] of Object.keys(this.getPrepopulateJson().history).entries()) {
1221
1254
  console.log('history', historyDate);
1222
1255
  html += `
1223
1256
  <div class="d-flex flex-col" part="section-container"><div id="history-date-${indexDate}" class="history-section-head section-head d-flex align-center justify-between" part="section-head-collapsed"><h3 part="section-title-collapsed" class="section-history-title" id="section-history-title-${indexDate}">${historyDate}</h3><div class="section-history-icon material-icons" id="section-history-icon-${indexDate}">keyboard_arrow_down</div></div><div id="section-history-body-${indexDate}" class="section-history-body section-body d-flex ${this.formviewclass} hide" part="section-body">
1224
1257
  `
1225
- for(let [index,historyItem] of this.getPrepopulateJson().history[historyDate].entries()){
1226
- html += `<sf-i-reporting name="" id="history-reporting-${historyDate}-${index}" class="history-reporting" exportparts="uploader-extracted-text:reporting-uploader-extracted-text, uploader-sf-upload-message:reporting-uploader-sf-upload-message, uploader-sf-upload-submessage:reporting-uploader-sf-upload-submessage, uploader-extracted-text-chip:reporting-uploader-extracted-text-chip, uploader-extracted-text-chip-failed:reporting-uploader-extracted-text-chip-failed, uploader-doctype-verify-badge:reporting-uploader-doctype-verify-badge,span-submit-published:reporting-span-submit-published, span-submit-unpublished:reporting-span-submit-unpublished, reporting-container:reporting-reporting-container, button-icon:reporting-button-icon, uploader-button-icon:reporting-uploader-button-icon, sf-i-form-modal-container:reporting-sf-i-form-modal-container, next-calendar-date:reporting-next-calendar-date, last-calendar-date:reporting-last-calendar-date, input-publish-checkbox:reporting-input-publish-checkbox, button-icon-light:reporting-button-icon-light, button-icon-small:reporting-button-icon-small, uploader-input-label:reporting-uploader-input-label, input-radio:reporting-input-radio, radio-label:reporting-radio-label, input-textarea:reporting-input-textarea, input-date:reporting-input-date, input-select-single:reporting-input-select-single, textarea-container:reporting-textarea-container, section-body:reporting-section-body, section-container:reporting-section-container, date-container:reporting-date-container, input-sf-i-uploader:reporting-input-sf-i-uploader, published-container:reporting-published-container, selected-option:reporting-selected-option, input-select-multi-option:reporting-input-select-multi-option, select-option-label:reporting-select-option-label, input-sf-i-form:reporting-input-sf-i-form, input-sf-i-bricks:reporting-input-sf-i-bricks, uploader-input:reporting-uploader-input, form-container:reporting-form-container, published-container:reporting-published-container, form-container-published:reporting-form-container-published, subsection:reporting-subsection, results-title:reporting-results-title, td-head:reporting-td-head, td-action:reporting-td-action, td-body:reporting-td-body, td-body-2:reporting-td-body-2, add-button:reporting-add-button, uploader-button:reporting-uploader-button, section-head-collapsed:reporting-section-head-collapsed, section-title-expanded:reporting-section-title-expanded, section-title-collapsed:reporting-section-title-collapsed, section-head-expanded:reporting-section-head-expanded, progress-bar-finished:reporting-progress-bar-finished, progress-bar-complete:reporting-progress-bar-complete, progress-bar-incomplete:reporting-progress-bar-incomplete, section-success-icon:reporting-section-success-icon, section-body:reporting-section-body, title-section:reporting-title-section, button-lg:reporting-button-lg, uploader-detail-container:reporting-uploader-detail-container, textarea-label:reporting-textarea-label, date-label:reporting-date-label, commentbox:reporting-commentbox, comment-username:reporting-comment-username, detail-head:reporting-detail-head" name="Notice Details" mode="view" editdisable="true" formviewclass="flex-wrap" configjson="${JSON.stringify(historyItem.schema)}" prepopulatevaljson="${JSON.stringify(historyItem.object).replace(/"/g,'&quot;')}"></sf-i-reporting>`
1258
+ for (let [index, historyItem] of this.getPrepopulateJson().history[historyDate].entries()) {
1259
+ html += `<sf-i-reporting name="" id="history-reporting-${historyDate}-${index}" class="history-reporting" exportparts="uploader-extracted-text:reporting-uploader-extracted-text, uploader-sf-upload-message:reporting-uploader-sf-upload-message, uploader-sf-upload-submessage:reporting-uploader-sf-upload-submessage, uploader-extracted-text-chip:reporting-uploader-extracted-text-chip, uploader-extracted-text-chip-failed:reporting-uploader-extracted-text-chip-failed, uploader-doctype-verify-badge:reporting-uploader-doctype-verify-badge,span-submit-published:reporting-span-submit-published, span-submit-unpublished:reporting-span-submit-unpublished, reporting-container:reporting-reporting-container, button-icon:reporting-button-icon, uploader-button-icon:reporting-uploader-button-icon, sf-i-form-modal-container:reporting-sf-i-form-modal-container, next-calendar-date:reporting-next-calendar-date, last-calendar-date:reporting-last-calendar-date, input-publish-checkbox:reporting-input-publish-checkbox, button-icon-light:reporting-button-icon-light, button-icon-small:reporting-button-icon-small, uploader-input-label:reporting-uploader-input-label, input-radio:reporting-input-radio, radio-label:reporting-radio-label, input-textarea:reporting-input-textarea, input-date:reporting-input-date, input-select-single:reporting-input-select-single, textarea-container:reporting-textarea-container, section-body:reporting-section-body, section-container:reporting-section-container, date-container:reporting-date-container, input-sf-i-uploader:reporting-input-sf-i-uploader, published-container:reporting-published-container, selected-option:reporting-selected-option, input-select-multi-option:reporting-input-select-multi-option, select-option-label:reporting-select-option-label, input-sf-i-form:reporting-input-sf-i-form, input-sf-i-bricks:reporting-input-sf-i-bricks, uploader-input:reporting-uploader-input, form-container:reporting-form-container, published-container:reporting-published-container, form-container-published:reporting-form-container-published, subsection:reporting-subsection, results-title:reporting-results-title, td-head:reporting-td-head, td-action:reporting-td-action, td-body:reporting-td-body, td-body-2:reporting-td-body-2, add-button:reporting-add-button, uploader-button:reporting-uploader-button, section-head-collapsed:reporting-section-head-collapsed, section-title-expanded:reporting-section-title-expanded, section-title-collapsed:reporting-section-title-collapsed, section-head-expanded:reporting-section-head-expanded, progress-bar-finished:reporting-progress-bar-finished, progress-bar-complete:reporting-progress-bar-complete, progress-bar-incomplete:reporting-progress-bar-incomplete, section-success-icon:reporting-section-success-icon, section-body:reporting-section-body, title-section:reporting-title-section, button-lg:reporting-button-lg, uploader-detail-container:reporting-uploader-detail-container, textarea-label:reporting-textarea-label, date-label:reporting-date-label, commentbox:reporting-commentbox, comment-username:reporting-comment-username, detail-head:reporting-detail-head" name="Object Details" mode="view" editdisable="true" formviewclass="flex-wrap" configjson="${JSON.stringify(historyItem.schema)}" prepopulatevaljson="${JSON.stringify(historyItem.object).replace(/"/g, '&quot;')}"></sf-i-reporting>`
1227
1260
  let comments = historyItem.object.comments ?? []
1228
- if(historyItem.object.documents != null && historyItem.object.documents.length > 0){
1261
+ if (historyItem.object.documents != null && historyItem.object.documents.length > 0) {
1229
1262
  html += '<div class="d-flex justify-between mb-20">';
1230
1263
  html += '<h3 part="history-docs-title" class="m-0"><br />Documents</h3>';
1231
1264
  html += '</div>';
1232
1265
  html += `
1233
- <sf-i-uploader prepopulatedInputArr="${JSON.stringify(historyItem.object.documents).replace(/"/g,'&quot;')}" exportparts="detail-container:uploader-detail-container, errmsg:uploader-errmsg, successmsg:uploader-successmsg, sf-upload-message:uploader-sf-upload-message, sf-upload-submessage: uploader-sf-upload-submessage, doctype-verify-badge: uploader-doctype-verify-badge, details-controls-container: uploader-details-controls-container, button-icon: uploader-button-icon, pdf-controls-container: uploader-pdf-controls-container, pdf-pages: uploader-pdf-pages, pdf-page-num: uploader-pdf-page-num, pdf-page-count: uploader-pdf-page-count, pdf-canvas: uploader-pdf-canvas, image-container: uploader-image-container, image-component: uploader-image-component, pdf-thumbnail-container: uploader-pdf-thumbnail-container, pdf-canvas-thumbnail: uploader-pdf-canvas-thumbnail, sf-uploader-download-message: uploader-sf-uploader-download-message, input: uploader-input, upload-buttons-container: uploader-upload-buttons-container, doctype-badge: uploader-doctype-badge, upload-status: uploader-upload-status, ext-badge:uploader-ext-badge, extracted-meta: uploader-extracted-meta, extracted-text-chip: uploader-extracted-text-chip, extracted-text-chip-parsed: uploader-extracted-text-chip-parsed, extracted-text-chip-failed: uploader-extracted-text-chip-failed, matches-title: uploader-matches-title, matches:uploader-matches, extracted-title: uploader-extracted-title, extracted-text: uploader-extracted-text, disclaimer-message-container: uploader-disclaimer-message-container, message-container: uploader-message-container, button: uploader-button" class="reporting-sf-i-uploader" part="input-sf-i-uploader" id="history-doc-uploader-${index}" maximize="yes" max="${historyItem.object.documents.length}" apiid="${this.apiIdUploader}" projectid="${this.projectid}" mode="view"></sf-i-uploader>
1266
+ <sf-i-uploader prepopulatedInputArr="${JSON.stringify(historyItem.object.documents).replace(/"/g, '&quot;')}" exportparts="detail-container:uploader-detail-container, errmsg:uploader-errmsg, successmsg:uploader-successmsg, sf-upload-message:uploader-sf-upload-message, sf-upload-submessage: uploader-sf-upload-submessage, doctype-verify-badge: uploader-doctype-verify-badge, details-controls-container: uploader-details-controls-container, button-icon: uploader-button-icon, pdf-controls-container: uploader-pdf-controls-container, pdf-pages: uploader-pdf-pages, pdf-page-num: uploader-pdf-page-num, pdf-page-count: uploader-pdf-page-count, pdf-canvas: uploader-pdf-canvas, image-container: uploader-image-container, image-component: uploader-image-component, pdf-thumbnail-container: uploader-pdf-thumbnail-container, pdf-canvas-thumbnail: uploader-pdf-canvas-thumbnail, sf-uploader-download-message: uploader-sf-uploader-download-message, input: uploader-input, upload-buttons-container: uploader-upload-buttons-container, doctype-badge: uploader-doctype-badge, upload-status: uploader-upload-status, ext-badge:uploader-ext-badge, extracted-meta: uploader-extracted-meta, extracted-text-chip: uploader-extracted-text-chip, extracted-text-chip-parsed: uploader-extracted-text-chip-parsed, extracted-text-chip-failed: uploader-extracted-text-chip-failed, matches-title: uploader-matches-title, matches:uploader-matches, extracted-title: uploader-extracted-title, extracted-text: uploader-extracted-text, disclaimer-message-container: uploader-disclaimer-message-container, message-container: uploader-message-container, button: uploader-button" class="reporting-sf-i-uploader" part="input-sf-i-uploader" id="history-doc-uploader-${index}" maximize="yes" max="${historyItem.object.documents.length}" apiid="${this.apiIdUploader}" projectid="${this.projectid}" mode="view"></sf-i-uploader>
1234
1267
  `
1235
1268
  }
1236
1269
  html += '<div class="d-flex justify-between mb-20">';
1237
1270
  html += '<h3 part="history-comments-title" class="m-0"><br />Comments</h3>';
1238
1271
  html += '</div>';
1239
-
1272
+
1240
1273
  html += '<div class="m-20">';
1241
1274
 
1242
- html += '<div class="d-flex flex-col">';
1275
+ html += '<div class="d-flex flex-col">';
1243
1276
 
1244
- for(var i = 0; i < comments.length; i++) {
1245
- html += '<div part="commentbox" class="d-flex commentbox '+(comments[i].author + "").toLowerCase()+'box">';
1246
- html += '<div class="mr-20 d-flex flex-col align-end"><span part="comment-username">'+(comments[i].username != null ? comments[i].username : '')+'</span><span part="td-head">'+comments[i].author+'</span></div>';
1247
-
1248
- const onlyCommentText = (comments[i].comment + "").replace(/ *\([^)]*\) */g, "").trim();
1249
- try {
1250
-
1251
- const jsonComments = JSON.parse(onlyCommentText);
1252
-
1253
- if(Util.isInteger(jsonComments)) {
1254
- html += '<div class="">'+comments[i].comment+'<br /><small><span class="muted">'+comments[i].timestamp+'</span></small></div>';
1255
- } else {
1256
- //console.log('json comments', jsonComments);
1257
- var htmlTable = '';
1258
- for(var j = 0; j < Object.keys(jsonComments).length; j++) {
1259
- htmlTable += '<div class="mb-20">';
1260
- htmlTable += ('<div part="detail-head">' + Object.keys(jsonComments)[j] + '</div>');
1261
- htmlTable += ('<sf-i-elastic-text text="'+jsonComments[Object.keys(jsonComments)[j]]+'" minLength="20"></sf-i-elastic-text>');
1262
- htmlTable += '</div>';
1263
- }
1264
- html += '<div class="">'+htmlTable+'<small><span class="muted">'+comments[i].timestamp+'</span></small></div>';
1265
- }
1266
-
1267
- } catch (e: any) {
1268
- //console.log('json comments exception', comments[i]);
1269
- html += '<div class="">'+comments[i].comment+'<br /><small><span class="muted">'+comments[i].timestamp+'</span></small></div>';
1277
+ for (var i = 0; i < comments.length; i++) {
1278
+ html += '<div part="commentbox" class="d-flex commentbox ' + (comments[i].author + "").toLowerCase() + 'box">';
1279
+ html += '<div class="mr-20 d-flex flex-col align-end"><span part="comment-username">' + (comments[i].username != null ? comments[i].username : '') + '</span><span part="td-head">' + comments[i].author + '</span></div>';
1280
+
1281
+ const onlyCommentText = (comments[i].comment + "").replace(/ *\([^)]*\) */g, "").trim();
1282
+ try {
1283
+
1284
+ const jsonComments = JSON.parse(onlyCommentText);
1285
+
1286
+ if (Util.isInteger(jsonComments)) {
1287
+ html += '<div class="">' + comments[i].comment + '<br /><small><span class="muted">' + comments[i].timestamp + '</span></small></div>';
1288
+ } else {
1289
+ //console.log('json comments', jsonComments);
1290
+ var htmlTable = '';
1291
+ for (var j = 0; j < Object.keys(jsonComments).length; j++) {
1292
+ htmlTable += '<div class="mb-20">';
1293
+ htmlTable += ('<div part="detail-head">' + Object.keys(jsonComments)[j] + '</div>');
1294
+ htmlTable += ('<sf-i-elastic-text text="' + jsonComments[Object.keys(jsonComments)[j]] + '" minLength="20"></sf-i-elastic-text>');
1295
+ htmlTable += '</div>';
1270
1296
  }
1271
-
1272
- html += '</div>';
1273
- }
1274
- if(comments.length === 0) {
1275
- html += '<div><strong>No comments!</strong></div>';
1297
+ html += '<div class="">' + htmlTable + '<small><span class="muted">' + comments[i].timestamp + '</span></small></div>';
1276
1298
  }
1277
1299
 
1300
+ } catch (e: any) {
1301
+ //console.log('json comments exception', comments[i]);
1302
+ html += '<div class="">' + comments[i].comment + '<br /><small><span class="muted">' + comments[i].timestamp + '</span></small></div>';
1303
+ }
1304
+
1278
1305
  html += '</div>';
1306
+ }
1307
+ if (comments.length === 0) {
1308
+ html += '<div><strong>No comments!</strong></div>';
1309
+ }
1310
+
1311
+ html += '</div>';
1279
1312
 
1280
1313
  html += '</div>';
1281
1314
  }
@@ -1283,27 +1316,27 @@ export class SfIReporting extends LitElement {
1283
1316
  }
1284
1317
  html += `<div part="history-status" class="d-flex history-status p-5 hide">History Status</div>`
1285
1318
  html += '</div>'
1286
- formContainer.insertAdjacentHTML('beforeend',html);
1319
+ formContainer.insertAdjacentHTML('beforeend', html);
1287
1320
  let sectionHistory = formContainer.querySelector('#history') as HTMLDivElement
1288
- sectionHistory.addEventListener('click',() => {
1321
+ sectionHistory.addEventListener('click', () => {
1289
1322
  let sectionHistoryBody = formContainer.querySelector('#section-history-body') as HTMLDivElement
1290
1323
  let sectionHistoryTitle = formContainer.querySelector('#section-history-title') as HTMLHeadingElement
1291
1324
  let sectionHistoryIcon = formContainer.querySelector('#section-history-icon') as HTMLHeadingElement
1292
- if(sectionHistoryBody.style.display == 'block'){
1293
- sectionHistory.setAttribute('part','section-head-collapsed')
1325
+ if (sectionHistoryBody.style.display == 'block') {
1326
+ sectionHistory.setAttribute('part', 'section-head-collapsed')
1294
1327
  sectionHistoryBody.style.display = 'none'
1295
- sectionHistoryTitle.setAttribute('part','section-title-collapsed')
1328
+ sectionHistoryTitle.setAttribute('part', 'section-title-collapsed')
1296
1329
  sectionHistoryIcon.innerHTML = 'keyboard_arrow_down'
1297
- }else{
1298
- sectionHistory.setAttribute('part','section-head-expanded')
1330
+ } else {
1331
+ sectionHistory.setAttribute('part', 'section-head-expanded')
1299
1332
  sectionHistoryBody.style.display = 'block'
1300
- sectionHistoryTitle.setAttribute('part','section-title-expanded')
1333
+ sectionHistoryTitle.setAttribute('part', 'section-title-expanded')
1301
1334
  sectionHistoryIcon.innerHTML = 'keyboard_arrow_up'
1302
1335
  }
1303
1336
  })
1304
1337
  let sectionHistoryDates = formContainer.querySelectorAll('.history-section-head') as NodeListOf<HTMLDivElement>
1305
- for(let sectionHistoryDate of sectionHistoryDates){
1306
- sectionHistoryDate.addEventListener('click',() => {
1338
+ for (let sectionHistoryDate of sectionHistoryDates) {
1339
+ sectionHistoryDate.addEventListener('click', () => {
1307
1340
  let id = sectionHistoryDate.id
1308
1341
  let dateIndex = id.split('-')[2]
1309
1342
  let sectionHistoryDateBodies = formContainer.querySelectorAll('.section-history-body') as NodeListOf<HTMLDivElement>
@@ -1311,33 +1344,33 @@ export class SfIReporting extends LitElement {
1311
1344
  let sectionHistoryDateTitles = formContainer.querySelectorAll('.section-history-title') as NodeListOf<HTMLHeadingElement>
1312
1345
  let sectionHistoryDateIcons = formContainer.querySelectorAll('.section-history-icon') as NodeListOf<HTMLHeadingElement>
1313
1346
  let historyStatus = formContainer.querySelector('.history-status') as HTMLDivElement
1314
- for(let [i, sectionHistoryDateBody] of sectionHistoryDateBodies.entries()){
1315
- if(sectionHistoryDateBody.id == ("section-history-body-" + dateIndex)){
1316
- if(sectionHistoryDateBody.style.display == 'block'){
1347
+ for (let [i, sectionHistoryDateBody] of sectionHistoryDateBodies.entries()) {
1348
+ if (sectionHistoryDateBody.id == ("section-history-body-" + dateIndex)) {
1349
+ if (sectionHistoryDateBody.style.display == 'block') {
1317
1350
  historyStatus.style.display = 'none'
1318
- sectionHistoryDate.setAttribute('part','section-head-collapsed')
1351
+ sectionHistoryDate.setAttribute('part', 'section-head-collapsed')
1319
1352
  sectionHistoryDateBody.style.display = 'none'
1320
- sectionHistoryDateTitles[i].setAttribute('part','section-title-collapsed')
1353
+ sectionHistoryDateTitles[i].setAttribute('part', 'section-title-collapsed')
1321
1354
  sectionHistoryDateIcons[i].innerHTML = 'keyboard_arrow_down'
1322
- }else{
1355
+ } else {
1323
1356
  historyStatus.innerHTML = "History : " + sectionHistoryDateTitles[i].innerHTML
1324
1357
  historyStatus.style.display = 'flex'
1325
- sectionHistoryDate.setAttribute('part','section-head-expanded')
1358
+ sectionHistoryDate.setAttribute('part', 'section-head-expanded')
1326
1359
  sectionHistoryDateBody.style.display = 'block'
1327
- sectionHistoryDateTitles[i].setAttribute('part','section-title-expanded')
1360
+ sectionHistoryDateTitles[i].setAttribute('part', 'section-title-expanded')
1328
1361
  sectionHistoryDateIcons[i].innerHTML = 'keyboard_arrow_up'
1329
1362
  }
1330
- }else{
1331
- sectionHistoryDate.setAttribute('part','section-head-collapsed')
1363
+ } else {
1364
+ sectionHistoryDate.setAttribute('part', 'section-head-collapsed')
1332
1365
  sectionHistoryDateBody.style.display = 'none'
1333
- sectionHistoryDateTitles[i].setAttribute('part','section-title-collapsed')
1366
+ sectionHistoryDateTitles[i].setAttribute('part', 'section-title-collapsed')
1334
1367
  sectionHistoryDateIcons[i].innerHTML = 'keyboard_arrow_down'
1335
1368
  }
1336
1369
  }
1337
1370
  })
1338
1371
  }
1339
1372
  let historyReportings = formContainer.querySelectorAll('.history-reporting') as NodeListOf<SfIReporting>
1340
- for(let historyReporting of historyReportings){
1373
+ for (let historyReporting of historyReportings) {
1341
1374
  let id = historyReporting.id;
1342
1375
  let date = id.split('-')[2]
1343
1376
  let index = id.split('-')[3]
@@ -1350,13 +1383,13 @@ export class SfIReporting extends LitElement {
1350
1383
 
1351
1384
  prepopulateValues = () => {
1352
1385
  console.log('prepopulating', this.getPrepopulateJson());
1353
- for(let [i, element] of this.dataModel.entries()){
1354
- if(isAddButtonObject(element)){
1355
- if(this.getPrepopulateJson()[element.label] != null && Array.isArray(this.getPrepopulateJson()[element.label])){
1356
- for(let valArr of this.getPrepopulateJson()[element.label]){
1386
+ for (let [i, element] of this.dataModel.entries()) {
1387
+ if (isAddButtonObject(element)) {
1388
+ if (this.getPrepopulateJson()[element.label] != null && Array.isArray(this.getPrepopulateJson()[element.label])) {
1389
+ for (let valArr of this.getPrepopulateJson()[element.label]) {
1357
1390
  let schemaArr = JSON.parse(element.schema)
1358
1391
  let childElementArr = []
1359
- for(let schemaElement of schemaArr){
1392
+ for (let schemaElement of schemaArr) {
1360
1393
  let childDataObj = createDataObject(schemaElement, this.dataModel[i].children.length)
1361
1394
  childDataObj.value = valArr[childDataObj.id]
1362
1395
  childElementArr.push(childDataObj);
@@ -1364,57 +1397,62 @@ export class SfIReporting extends LitElement {
1364
1397
  this.dataModel[i].children.push(childElementArr)
1365
1398
  }
1366
1399
  }
1367
- }else{
1368
- if(element.type == "section" && this.editdisable != "true" && this.flow != "details"){
1400
+ } else {
1401
+ if (element.type == "section" && this.editdisable != "true" && this.flow != "details") {
1369
1402
  this.dataModel[i].collapse = "false"
1370
- }else{
1371
- if(this.dataModel[i].type == "textarea"){
1403
+ } else {
1404
+ if (this.dataModel[i].type == "textarea") {
1372
1405
  this.dataModel[i].value = this.getPrepopulateJson()[element.id] ?? ""
1373
- }else if(element.type == "yesno+textarea"){
1374
- this.dataModel[i].value = this.getPrepopulateJson()[element.id] ?? ['','']
1375
- }else if(element.type == "date"){
1406
+ } else if (element.type == "yesno+textarea") {
1407
+ this.dataModel[i].value = this.getPrepopulateJson()[element.id] ?? ['', '']
1408
+ } else if (element.type == "date") {
1376
1409
  this.dataModel[i].value = this.getPrepopulateJson()[element.id] ?? ''
1377
- }else if(element.type == "sf-i-form-select"){
1410
+ } else if (element.type == "sf-i-form-select") {
1378
1411
  // if(element.savenameseparate == "yes"){
1379
1412
  // console.log('prepopulating sf-i-form-select', this.getPrepopulateJson()[element.id])
1380
1413
  // this.dataModel[i].value = this.getPrepopulateJson()[element.id] ?? ''
1381
1414
  // }else{
1382
- this.dataModel[i].value = this.getPrepopulateJson()[element.id] ?? ''
1415
+ this.dataModel[i].value = this.getPrepopulateJson()[element.id] ?? ''
1383
1416
  // }
1384
- }else if(element.type == "sf-i-form"){
1385
- if(element.savenameseparate == "yes"){
1417
+ } else if (element.type == "sf-i-form") {
1418
+ if (element.savenameseparate == "yes") {
1386
1419
  this.dataModel[i].value = [this.getPrepopulateJson()[element.id + 'id']]
1387
1420
  // this.dataModel[i].value = (this.getPrepopulateJson()[element.id + 'name'].trim() ?? '') + ';' + (this.getPrepopulateJson()[element.id + 'id'] ?? '')
1388
- }else if((parseInt(element.maxselect) ?? 0 )>= 1){
1389
- if(this.getPrepopulateJson()[element.id + 'id'] != null){
1421
+ } else if ((parseInt(element.maxselect) ?? 0) >= 1) {
1422
+ if (this.getPrepopulateJson()[element.id + 'id'] != null) {
1390
1423
  this.dataModel[i].value = [this.getPrepopulateJson()[element.id + 'id'] ?? '']
1391
- }else{
1424
+ } else {
1392
1425
  let tempArr: any[] = []
1393
- for(let val of this.getPrepopulateJson()[element.id]){
1426
+ for (let val of this.getPrepopulateJson()[element.id]) {
1394
1427
  tempArr.push(val.split(';')[1] ?? '');
1395
1428
  }
1396
1429
  this.dataModel[i].value = tempArr
1397
1430
  }
1398
1431
  }
1399
1432
  console.log('setting form value', this.dataModel[i], this.getPrepopulateJson()[element.id + 'id'], element.mode);
1400
- }else if(element.type == "sf-i-bricks"){
1401
- if(element.savenameseparate == "yes"){
1433
+ } else if (element.type == "sf-i-bricks") {
1434
+ if (element.savenameseparate == "yes") {
1402
1435
  this.dataModel[i].value = [this.getPrepopulateJson()[element.id + 'name'] + ';' + this.getPrepopulateJson()[element.id + 'id']]
1403
- }else{
1436
+ } else {
1404
1437
  this.dataModel[i].value = this.getPrepopulateJson()[element.id]
1405
1438
  }
1406
- }else if(element.type == "sf-i-uploader"){
1439
+ } else if (element.type == "sf-checklist") {
1440
+ this.dataModel[i].value = this.getPrepopulateJson()[element.id]
1441
+ } else if (element.type == "sf-i-select") {
1442
+ this.dataModel[i].value = [this.getPrepopulateJson()[element.id + 'name'] + ';' + this.getPrepopulateJson()[element.id + 'id']]
1443
+ } else if (element.type == "sf-i-uploader") {
1407
1444
  this.dataModel[i].value = this.getPrepopulateJson()[element.id]
1445
+ console.log('setting uploader value', JSON.stringify(this.dataModel[i]), this.getPrepopulateJson()[element.id]);
1408
1446
  }
1409
1447
  }
1410
1448
  }
1411
1449
  }
1412
- if(this.evalTimeout != null){
1450
+ if (this.evalTimeout != null) {
1413
1451
  clearTimeout(this.evalTimeout)
1414
1452
  }
1415
1453
  this.evalTimeout = setTimeout(() => {
1416
1454
  this.evalShowProgress()
1417
- },2000)
1455
+ }, 2000)
1418
1456
  this.populateView();
1419
1457
  }
1420
1458
 
@@ -1425,102 +1463,120 @@ export class SfIReporting extends LitElement {
1425
1463
  let sectionChildFilledCount = 0;
1426
1464
  let sectionId = "";
1427
1465
  let flagEval = true
1428
- for(let element of this.dataModel){
1429
- if(isAddButtonObject(element)){
1430
- for(let childElementsArr of element.children){
1431
- for(let childElement of childElementsArr){
1432
- total ++;
1433
- if(childElement.value != "" && childElement.value.length > 0){
1434
- filled ++;
1466
+ for (let element of this.dataModel) {
1467
+ if(element.type == "sf-checklist") {
1468
+ console.log('sf-checklist', element, element.id);
1469
+ }
1470
+ if (isAddButtonObject(element)) {
1471
+ for (let childElementsArr of element.children) {
1472
+ for (let childElement of childElementsArr) {
1473
+ total++;
1474
+ if (childElement.value != "" && childElement.value.length > 0) {
1475
+ filled++;
1435
1476
  }
1436
- if(childElement.mandatory != null && flagEval){
1437
- if(childElement.value == "" || childElement.value.length < 1){
1477
+ if (childElement.mandatory != null && flagEval) {
1478
+ if (childElement.value == "" || childElement.value.length < 1) {
1438
1479
  flagEval = false
1439
- }
1480
+ }
1440
1481
  }
1441
1482
  }
1442
1483
  }
1443
- }else{
1444
- if(element.type == "section"){
1445
- if(sectionChildCount != 0 && sectionId !== ""){
1446
- if(sectionChildCount == sectionChildFilledCount){
1484
+ } else {
1485
+ if (element.type == "section") {
1486
+ if (sectionChildCount != 0 && sectionId !== "") {
1487
+ if (sectionChildCount == sectionChildFilledCount) {
1447
1488
  ((this._SfReportingContainer as HTMLDivElement).querySelector('#' + sectionId + "-success") as HTMLDivElement).style.display = 'flex'
1448
- }else{
1489
+ } else {
1449
1490
  ((this._SfReportingContainer as HTMLDivElement).querySelector('#' + sectionId + "-success") as HTMLDivElement).style.display = 'none'
1450
1491
  }
1451
1492
  }
1452
1493
  sectionChildCount = 0;
1453
1494
  sectionChildFilledCount = 0;
1454
1495
  sectionId = element.id;
1455
- }else if(element.type != "section" && element.type != "subsection" && element.mandatory != null){
1456
- total ++;
1457
- sectionChildCount ++;
1458
- if(element.type == "textarea" || element.type == "date"){
1459
- if(element.value != "" && element.value.length > 0){
1460
- filled ++;
1461
- sectionChildFilledCount ++;
1496
+ } else if (element.type != "section" && element.type != "subsection" && element.mandatory != null) {
1497
+ total++;
1498
+ sectionChildCount++;
1499
+ if (element.type == "textarea" || element.type == "date") {
1500
+ if (element.value != "" && element.value.length > 0) {
1501
+ filled++;
1502
+ sectionChildFilledCount++;
1462
1503
  }
1463
- }else if(element.type == "yesno+textarea"){
1464
- if(element.value.length == 2 && element.value[0].length > 0 && element.value[1].length > 0){
1465
- filled ++;
1466
- sectionChildFilledCount ++;
1504
+ } else if (element.type == "yesno+textarea") {
1505
+ if (element.value.length == 2 && element.value[0].length > 0 && element.value[1].length > 0) {
1506
+ filled++;
1507
+ sectionChildFilledCount++;
1467
1508
  }
1468
- }else if(element.type == "sf-i-form"){
1509
+ } else if (element.type == "sf-i-form") {
1469
1510
  console.log('evalshowprogress sf-i-form value', element.value, element.value.length, element.mandatory, element.mandatory != null);
1470
- if(element.value.length > 0){
1471
- filled ++;
1472
- sectionChildFilledCount ++;
1511
+ if (element.value.length > 0) {
1512
+ filled++;
1513
+ sectionChildFilledCount++;
1473
1514
  }
1474
- }else if(element.type == "sf-i-form-select"){
1515
+ } else if (element.type == "sf-i-form-select") {
1475
1516
  console.log('evalshowprogress sf-i-form-select value', element.value, Object.keys(element.value).length, element.mandatory);
1476
- if(Object.keys(element.value).length > 0){
1477
- filled ++;
1478
- sectionChildFilledCount ++;
1517
+ if (Object.keys(element.value).length > 0) {
1518
+ filled++;
1519
+ sectionChildFilledCount++;
1479
1520
  }
1480
- }else if(element.type == "sf-i-bricks"){
1521
+ } else if (element.type == "sf-i-bricks") {
1481
1522
  console.log('evalshowprogress sf-i-bricks value', element.value, element.value.length, element.mandatory, element.mandatory != null);
1482
- if(element.value.length > 0){
1483
- filled ++;
1484
- sectionChildFilledCount ++;
1523
+ if (element.value.length > 0) {
1524
+ filled++;
1525
+ sectionChildFilledCount++;
1526
+ }
1527
+ } else if (element.type == "sf-i-select") {
1528
+ console.log('evalshowprogress sf-i-select value', element.value, element.value.length, element.mandatory, element.mandatory != null);
1529
+ if (element.value.length > 0) {
1530
+ filled++;
1531
+ sectionChildFilledCount++;
1485
1532
  }
1486
- }else if(element.type == "sf-i-uploader"){
1533
+ } else if (element.type == "sf-checklist") {
1534
+ console.log('evalshowprogress sf-checklist value', element.value, Object.keys(element.value).length, element.mandatory, element.mandatory != null);
1535
+ for(let val of Object.keys(element.value)) {
1536
+ if(element.value[val] == true) {
1537
+ filled++;
1538
+ sectionChildFilledCount++;
1539
+ break;
1540
+ }
1541
+ }
1542
+ } else if (element.type == "sf-i-uploader") {
1487
1543
  console.log('evalshowprogress sf-i-uploader value', element.value, element.value.length, element.mandatory, element.mandatory != null);
1488
- if(element.value.length > 0){
1489
- filled ++;
1490
- sectionChildFilledCount ++;
1544
+ if (element.value.length > 0) {
1545
+ filled++;
1546
+ sectionChildFilledCount++;
1491
1547
  }
1492
- }
1493
- if(element.mandatory != null && flagEval){
1494
- if(element.value == "" || element.value.length < 1){
1548
+ }
1549
+ if (element.mandatory != null && flagEval) {
1550
+ if (element.value == "" || element.value.length < 1) {
1495
1551
  flagEval = false
1496
- }
1552
+ }
1497
1553
  }
1498
1554
  }
1499
1555
  }
1500
1556
  }
1501
- if(sectionChildCount != 0 && sectionId !== ""){
1502
- if(sectionChildCount == sectionChildFilledCount){
1557
+ if (sectionChildCount != 0 && sectionId !== "") {
1558
+ if (sectionChildCount == sectionChildFilledCount) {
1503
1559
  ((this._SfReportingContainer as HTMLDivElement).querySelector('#' + sectionId + "-success") as HTMLDivElement).style.display = 'flex'
1504
- }else{
1560
+ } else {
1505
1561
  ((this._SfReportingContainer as HTMLDivElement).querySelector('#' + sectionId + "-success") as HTMLDivElement).style.display = 'none'
1506
1562
  }
1507
1563
  }
1508
- console.log('evalshowprogress',filled, total)
1509
- if(this.editdisable == "true"){
1564
+ console.log('evalshowprogress', filled, total)
1565
+ if (this.editdisable == "true") {
1510
1566
  ((this._SfReportingContainer as HTMLDivElement).querySelector('.progress-bar') as HTMLDivElement).style.display = 'none'
1511
- }else if(((this._SfReportingContainer as HTMLDivElement).querySelector('.progress-bar') as HTMLDivElement) != null){
1567
+ } else if (((this._SfReportingContainer as HTMLDivElement).querySelector('.progress-bar') as HTMLDivElement) != null) {
1512
1568
  ((this._SfReportingContainer as HTMLDivElement).querySelector('.progress-bar') as HTMLDivElement).style.display = 'flex'
1513
1569
  let progress = Math.floor((filled / total) * 100);
1514
- if(progress == 100){
1515
- ((this._SfReportingContainer as HTMLDivElement).querySelector('.progress-bar-complete') as HTMLDivElement).style.width = "0%";
1516
- ((this._SfReportingContainer as HTMLDivElement).querySelector('.progress-bar-finished') as HTMLDivElement).style.width = "100%";
1517
- }else{
1518
- ((this._SfReportingContainer as HTMLDivElement).querySelector('.progress-bar-complete') as HTMLDivElement).style.width = progress + "%";
1519
- ((this._SfReportingContainer as HTMLDivElement).querySelector('.progress-bar-finished') as HTMLDivElement).style.width = "0%";
1570
+ if (progress == 100) {
1571
+ ((this._SfReportingContainer as HTMLDivElement).querySelector('.progress-bar-complete') as HTMLDivElement).style.width = "0%";
1572
+ ((this._SfReportingContainer as HTMLDivElement).querySelector('.progress-bar-finished') as HTMLDivElement).style.width = "100%";
1573
+ } else {
1574
+ ((this._SfReportingContainer as HTMLDivElement).querySelector('.progress-bar-complete') as HTMLDivElement).style.width = progress + "%";
1575
+ ((this._SfReportingContainer as HTMLDivElement).querySelector('.progress-bar-finished') as HTMLDivElement).style.width = "0%";
1520
1576
  }
1521
- ((this._SfReportingContainer as HTMLDivElement).querySelector('.progress-bar-incomplete') as HTMLDivElement).style.width = (100 - progress) + "%";
1577
+ ((this._SfReportingContainer as HTMLDivElement).querySelector('.progress-bar-incomplete') as HTMLDivElement).style.width = (100 - progress) + "%";
1522
1578
  console.log('buttonsubmit', this._SfReportingButtonSubmit);
1523
- if((this._SfReportingButtonSubmit as HTMLButtonElement) != null){
1579
+ if ((this._SfReportingButtonSubmit as HTMLButtonElement) != null) {
1524
1580
  (this._SfReportingButtonSubmit as HTMLButtonElement).disabled = !flagEval;
1525
1581
  }
1526
1582
  }
@@ -1530,16 +1586,16 @@ export class SfIReporting extends LitElement {
1530
1586
  evalTimeout: any;
1531
1587
  initInputListeners = () => {
1532
1588
  let addButtons = (this._SfReportingContainer as HTMLDivElement).querySelectorAll('.add-button') as NodeListOf<HTMLButtonElement>
1533
- for(let addButton of addButtons){
1534
- addButton.addEventListener('click', async (ev: any)=>{
1589
+ for (let addButton of addButtons) {
1590
+ addButton.addEventListener('click', async (ev: any) => {
1535
1591
  await this.showLoader();
1536
1592
  let target = ev.target;
1537
- for(let [i,element] of this.dataModel.entries()){
1538
- if(isAddButtonObject(element)){
1539
- if(element.id == target.id){
1593
+ for (let [i, element] of this.dataModel.entries()) {
1594
+ if (isAddButtonObject(element)) {
1595
+ if (element.id == target.id) {
1540
1596
  let schemaArr = JSON.parse(this.dataModel[i].schema)
1541
1597
  let childElementArr = []
1542
- for(let schemaElement of schemaArr){
1598
+ for (let schemaElement of schemaArr) {
1543
1599
  childElementArr.push(createDataObject(schemaElement, this.dataModel[i].children.length));
1544
1600
  }
1545
1601
  this.dataModel[i].children.push(childElementArr)
@@ -1547,80 +1603,80 @@ export class SfIReporting extends LitElement {
1547
1603
  }
1548
1604
  }
1549
1605
  }
1550
- if(this.evalTimeout != null){
1606
+ if (this.evalTimeout != null) {
1551
1607
  clearTimeout(this.evalTimeout)
1552
1608
  }
1553
1609
  this.evalTimeout = setTimeout(() => {
1554
1610
  this.evalShowProgress()
1555
- },2000)
1611
+ }, 2000)
1556
1612
  let formContainer = (this._SfReportingContainer.querySelector('.form-container') as HTMLElement)
1557
- if(formContainer != null){
1613
+ if (formContainer != null) {
1558
1614
  this.populateView(formContainer.scrollTop);
1559
1615
  }
1560
1616
  })
1561
1617
  }
1562
1618
 
1563
1619
  let removeButtons = (this._SfReportingContainer as HTMLDivElement).querySelectorAll('.remove-child-button') as NodeListOf<HTMLButtonElement>
1564
- for(let removeButton of removeButtons){
1565
- removeButton.addEventListener('click', async (ev: any)=>{
1620
+ for (let removeButton of removeButtons) {
1621
+ removeButton.addEventListener('click', async (ev: any) => {
1566
1622
  await this.showLoader();
1567
1623
  let target = ev.target;
1568
1624
  console.log(target)
1569
1625
  let addId = target.id.split("-")[0]
1570
1626
  let iter = parseInt(target.id.split("-")[target.id.split("-").length - 1]) - 1
1571
- for(let [i,element] of this.dataModel.entries()){
1572
- if(isAddButtonObject(element)){
1573
- if(element.id == addId){
1574
-
1575
- this.dataModel[i].children.splice(iter,1);
1627
+ for (let [i, element] of this.dataModel.entries()) {
1628
+ if (isAddButtonObject(element)) {
1629
+ if (element.id == addId) {
1630
+
1631
+ this.dataModel[i].children.splice(iter, 1);
1576
1632
  break;
1577
1633
  }
1578
1634
  }
1579
1635
  }
1580
- if(this.evalTimeout != null){
1636
+ if (this.evalTimeout != null) {
1581
1637
  clearTimeout(this.evalTimeout);
1582
1638
  }
1583
1639
  this.evalTimeout = setTimeout(() => {
1584
1640
  this.evalShowProgress()
1585
- },2000)
1641
+ }, 2000)
1586
1642
  let formContainer = (this._SfReportingContainer.querySelector('.form-container') as HTMLElement)
1587
- if(formContainer != null){
1643
+ if (formContainer != null) {
1588
1644
  this.populateView(formContainer.scrollTop);
1589
1645
  }
1590
1646
  })
1591
1647
  }
1592
1648
 
1593
1649
  let textAreas = (this._SfReportingContainer as HTMLDivElement).querySelectorAll('.reporting-textarea') as NodeListOf<HTMLTextAreaElement>
1594
- for(let textArea of textAreas){
1595
- textArea.addEventListener('keyup',(e: any) => {
1650
+ for (let textArea of textAreas) {
1651
+ textArea.addEventListener('keyup', (e: any) => {
1596
1652
  let target = e.target;
1597
1653
  let genId = target.id.slice(0, target.id.lastIndexOf('-'));
1598
- for(let [i,element] of this.dataModel.entries()){
1599
- if(!isAddButtonObject(element)){
1600
- if(element.type == "textarea"){
1601
- if(element.id == target.id){
1654
+ for (let [i, element] of this.dataModel.entries()) {
1655
+ if (!isAddButtonObject(element)) {
1656
+ if (element.type == "textarea") {
1657
+ if (element.id == target.id) {
1602
1658
  this.dataModel[i].value = target.value
1603
1659
  }
1604
- }else if(element.type == "yesno+textarea"){
1605
- if((element.id + "-textarea") == target.id){
1606
- if(this.dataModel[i].value == null || this.dataModel[i].value.length != 2){
1607
- this.dataModel[i].value = ['','']
1660
+ } else if (element.type == "yesno+textarea") {
1661
+ if ((element.id + "-textarea") == target.id) {
1662
+ if (this.dataModel[i].value == null || this.dataModel[i].value.length != 2) {
1663
+ this.dataModel[i].value = ['', '']
1608
1664
  }
1609
1665
  this.dataModel[i].value[1] = target.value
1610
1666
  }
1611
1667
  }
1612
- }else{
1613
- if(element.schema.indexOf(genId) >= 0){
1614
- for(let [j,childElementArr] of element.children.entries()){
1615
- for(let [k, childElement] of childElementArr.entries()){
1616
- if(childElement.type == "textarea"){
1617
- if(childElement.id == target.id){
1668
+ } else {
1669
+ if (element.schema.indexOf(genId) >= 0) {
1670
+ for (let [j, childElementArr] of element.children.entries()) {
1671
+ for (let [k, childElement] of childElementArr.entries()) {
1672
+ if (childElement.type == "textarea") {
1673
+ if (childElement.id == target.id) {
1618
1674
  this.dataModel[i].children[j][k].value = target.value
1619
1675
  }
1620
- }else if(childElement.type == "yesno+textarea"){
1621
- if((childElement.id + "-textarea") == target.id){
1622
- if(this.dataModel[i].children[j][k].value == null || this.dataModel[i].children[j][k].value.length != 2){
1623
- this.dataModel[i].children[j][k].value = ['','']
1676
+ } else if (childElement.type == "yesno+textarea") {
1677
+ if ((childElement.id + "-textarea") == target.id) {
1678
+ if (this.dataModel[i].children[j][k].value == null || this.dataModel[i].children[j][k].value.length != 2) {
1679
+ this.dataModel[i].children[j][k].value = ['', '']
1624
1680
  }
1625
1681
  this.dataModel[i].children[j][k].value[1] = target.value
1626
1682
  }
@@ -1630,39 +1686,39 @@ export class SfIReporting extends LitElement {
1630
1686
  }
1631
1687
  }
1632
1688
  }
1633
- if(this.evalTimeout != null){
1689
+ if (this.evalTimeout != null) {
1634
1690
  clearTimeout(this.evalTimeout)
1635
1691
  }
1636
1692
  this.evalTimeout = setTimeout(() => {
1637
1693
  this.evalShowProgress()
1638
- },2000)
1694
+ }, 2000)
1639
1695
  })
1640
1696
  }
1641
1697
 
1642
1698
  let radioButtons = (this._SfReportingContainer as HTMLDivElement).querySelectorAll('.reporting-radio') as NodeListOf<HTMLInputElement>
1643
- for(let radioButton of radioButtons){
1644
- radioButton.addEventListener('change',(e:any) => {
1699
+ for (let radioButton of radioButtons) {
1700
+ radioButton.addEventListener('change', (e: any) => {
1645
1701
  let target = e.target;
1646
1702
  console.log('radio changed', target.id)
1647
1703
  let genId = target.id.slice(0, target.id.lastIndexOf('-'));
1648
- for(let [i,element] of this.dataModel.entries()){
1649
- if(!isAddButtonObject(element)){
1650
- if(element.type == "yesno+textarea"){
1651
- if(element.id == genId){
1652
- if(this.dataModel[i].value == null || this.dataModel[i].value.length != 2){
1653
- this.dataModel[i].value = ['','']
1704
+ for (let [i, element] of this.dataModel.entries()) {
1705
+ if (!isAddButtonObject(element)) {
1706
+ if (element.type == "yesno+textarea") {
1707
+ if (element.id == genId) {
1708
+ if (this.dataModel[i].value == null || this.dataModel[i].value.length != 2) {
1709
+ this.dataModel[i].value = ['', '']
1654
1710
  }
1655
1711
  this.dataModel[i].value[0] = target.value
1656
1712
  }
1657
1713
  }
1658
- }else{
1659
- if(element.schema.indexOf(genId) >= 0){
1660
- for(let [j,childElementArr] of element.children.entries()){
1661
- for(let [k, childElement] of childElementArr.entries()){
1662
- if(childElement.type == "yesno+textarea"){
1663
- if(childElement.id == genId){
1664
- if(this.dataModel[i].children[j][k].value == null || this.dataModel[i].children[j][k].value.length != 2){
1665
- this.dataModel[i].children[j][k].value = ['','']
1714
+ } else {
1715
+ if (element.schema.indexOf(genId) >= 0) {
1716
+ for (let [j, childElementArr] of element.children.entries()) {
1717
+ for (let [k, childElement] of childElementArr.entries()) {
1718
+ if (childElement.type == "yesno+textarea") {
1719
+ if (childElement.id == genId) {
1720
+ if (this.dataModel[i].children[j][k].value == null || this.dataModel[i].children[j][k].value.length != 2) {
1721
+ this.dataModel[i].children[j][k].value = ['', '']
1666
1722
  }
1667
1723
  this.dataModel[i].children[j][k].value[0] = target.value
1668
1724
  }
@@ -1672,30 +1728,30 @@ export class SfIReporting extends LitElement {
1672
1728
  }
1673
1729
  }
1674
1730
  }
1675
- if(this.evalTimeout != null){
1731
+ if (this.evalTimeout != null) {
1676
1732
  clearTimeout(this.evalTimeout)
1677
1733
  }
1678
1734
  this.evalTimeout = setTimeout(() => {
1679
1735
  this.evalShowProgress()
1680
- },2000)
1736
+ }, 2000)
1681
1737
  })
1682
- }
1738
+ }
1683
1739
  let forms = (this._SfReportingContainer as HTMLDivElement).querySelectorAll('.reporting-sf-i-form') as NodeListOf<SfIForm>
1684
- for(let form of forms){
1685
- form.addEventListener('valueChanged', (ev: any)=>{
1740
+ for (let form of forms) {
1741
+ form.addEventListener('valueChanged', (ev: any) => {
1686
1742
  let target = ev.target as SfIForm;
1687
1743
  console.log(target)
1688
1744
  let genId = target.id.slice(0, target.id.lastIndexOf('-'));
1689
- for(let [i,element] of this.dataModel.entries()){
1690
- if(!isAddButtonObject(element)){
1691
- if(element.id == target.id){
1692
- this.dataModel[i].value = target.selectedValues()
1693
- }
1694
- }else{
1695
- if(element.schema.indexOf(genId) >= 0){
1696
- for(let [j,childElementArr] of element.children.entries()){
1697
- for(let [k, childElement] of childElementArr.entries()){
1698
- if(childElement.id == target.id){
1745
+ for (let [i, element] of this.dataModel.entries()) {
1746
+ if (!isAddButtonObject(element)) {
1747
+ if (element.id == target.id) {
1748
+ this.dataModel[i].value = target.selectedValues()
1749
+ }
1750
+ } else {
1751
+ if (element.schema.indexOf(genId) >= 0) {
1752
+ for (let [j, childElementArr] of element.children.entries()) {
1753
+ for (let [k, childElement] of childElementArr.entries()) {
1754
+ if (childElement.id == target.id) {
1699
1755
  this.dataModel[i].children[j][k].value = target.selectedValues()
1700
1756
  }
1701
1757
  }
@@ -1704,31 +1760,31 @@ export class SfIReporting extends LitElement {
1704
1760
  }
1705
1761
  }
1706
1762
  this.checkDependencies(target.id)
1707
- if(this.evalTimeout != null){
1763
+ if (this.evalTimeout != null) {
1708
1764
  clearTimeout(this.evalTimeout);
1709
1765
  }
1710
1766
  this.evalTimeout = setTimeout(() => {
1711
1767
  this.evalShowProgress()
1712
- },2000)
1768
+ }, 2000)
1713
1769
  // this.populateView((this._SfReportingContainer.querySelector('.form-container') as HTMLElement).scrollTop);
1714
1770
  })
1715
1771
  }
1716
1772
  let dateInputs = (this._SfReportingContainer as HTMLDivElement).querySelectorAll('.reporting-date') as NodeListOf<HTMLInputElement>
1717
- for(let dateInput of dateInputs){
1718
- dateInput.addEventListener('change', (ev: any)=>{
1773
+ for (let dateInput of dateInputs) {
1774
+ dateInput.addEventListener('change', (ev: any) => {
1719
1775
  let target = ev.target as HTMLInputElement;
1720
1776
  console.log(target)
1721
1777
  let genId = target.id.slice(0, target.id.lastIndexOf('-'));
1722
- for(let [i,element] of this.dataModel.entries()){
1723
- if(!isAddButtonObject(element)){
1724
- if(element.id == target.id){
1725
- this.dataModel[i].value = target.value
1726
- }
1727
- }else{
1728
- if(element.schema.indexOf(genId) >= 0){
1729
- for(let [j,childElementArr] of element.children.entries()){
1730
- for(let [k, childElement] of childElementArr.entries()){
1731
- if(childElement.id == target.id){
1778
+ for (let [i, element] of this.dataModel.entries()) {
1779
+ if (!isAddButtonObject(element)) {
1780
+ if (element.id == target.id) {
1781
+ this.dataModel[i].value = target.value
1782
+ }
1783
+ } else {
1784
+ if (element.schema.indexOf(genId) >= 0) {
1785
+ for (let [j, childElementArr] of element.children.entries()) {
1786
+ for (let [k, childElement] of childElementArr.entries()) {
1787
+ if (childElement.id == target.id) {
1732
1788
  this.dataModel[i].children[j][k].value = target.value
1733
1789
  }
1734
1790
  }
@@ -1736,32 +1792,32 @@ export class SfIReporting extends LitElement {
1736
1792
  }
1737
1793
  }
1738
1794
  }
1739
- if(this.evalTimeout != null){
1795
+ if (this.evalTimeout != null) {
1740
1796
  clearTimeout(this.evalTimeout);
1741
1797
  }
1742
1798
  this.evalTimeout = setTimeout(() => {
1743
1799
  this.evalShowProgress()
1744
- },2000)
1800
+ }, 2000)
1745
1801
  // this.populateView((this._SfReportingContainer.querySelector('.form-container') as HTMLElement).scrollTop);
1746
1802
  })
1747
1803
  }
1748
1804
  let bricksArr = (this._SfReportingContainer as HTMLDivElement).querySelectorAll('.reporting-sf-i-bricks') as NodeListOf<SfIBricks>
1749
- for(let bricks of bricksArr){
1750
- bricks.addEventListener('valueChanged', async (ev: any)=>{
1751
-
1805
+ for (let bricks of bricksArr) {
1806
+ bricks.addEventListener('valueChanged', async (ev: any) => {
1807
+
1752
1808
  let target = ev.target as SfIBricks;
1753
1809
  let genId = target.id.slice(0, target.id.lastIndexOf('-'));
1754
1810
  console.log('bricks value changed', target.id)
1755
- for(let [i,element] of this.dataModel.entries()){
1756
- if(!isAddButtonObject(element)){
1757
- if(element.id == target.id){
1811
+ for (let [i, element] of this.dataModel.entries()) {
1812
+ if (!isAddButtonObject(element)) {
1813
+ if (element.id == target.id) {
1758
1814
  this.dataModel[i].value = target.selectedValueTexts()
1759
1815
  }
1760
- }else{
1761
- if(element.schema.indexOf(genId) >= 0){
1762
- for(let [j,childElementArr] of element.children.entries()){
1763
- for(let [k, childElement] of childElementArr.entries()){
1764
- if(childElement.id == target.id){
1816
+ } else {
1817
+ if (element.schema.indexOf(genId) >= 0) {
1818
+ for (let [j, childElementArr] of element.children.entries()) {
1819
+ for (let [k, childElement] of childElementArr.entries()) {
1820
+ if (childElement.id == target.id) {
1765
1821
  this.dataModel[i].children[j][k].value = target.selectedValueTexts()
1766
1822
  }
1767
1823
  }
@@ -1769,35 +1825,69 @@ export class SfIReporting extends LitElement {
1769
1825
  }
1770
1826
  }
1771
1827
  }
1772
-
1828
+
1773
1829
  this.checkDependencies(target.id)
1774
1830
 
1775
- if(this.evalTimeout != null){
1831
+ if (this.evalTimeout != null) {
1776
1832
  clearTimeout(this.evalTimeout);
1777
1833
  }
1778
1834
  this.evalTimeout = setTimeout(() => {
1779
1835
  this.evalShowProgress()
1780
- },2000)
1836
+ }, 2000)
1781
1837
  })
1782
1838
  }
1783
1839
 
1784
1840
  let uploaders = (this._SfReportingContainer as HTMLDivElement).querySelectorAll('.reporting-sf-i-uploader') as NodeListOf<SfIUploader>
1785
- for(let uploader of uploaders){
1786
- uploader.addEventListener('uploadValid', async (ev: any)=>{
1787
-
1841
+ for (let uploader of uploaders) {
1842
+ uploader.addEventListener('uploadValid', async (ev: any) => {
1843
+
1788
1844
  let target = ev.target as SfIUploader;
1789
1845
  let genId = target.id.slice(0, target.id.lastIndexOf('-'));
1790
- console.log('bricks value changed', target.id)
1791
- for(let [i,element] of this.dataModel.entries()){
1792
- if(!isAddButtonObject(element)){
1793
- if(element.id == target.id){
1846
+ console.log('uploader value changed', target.id, target.selectedValues(), this.mode)
1847
+ for (let [i, element] of this.dataModel.entries()) {
1848
+ if (!isAddButtonObject(element)) {
1849
+ if (element.id == target.id && target.selectedValues().length > 0) {
1850
+ this.dataModel[i].value = target.selectedValues()
1851
+ }
1852
+ } else {
1853
+ if (element.schema.indexOf(genId) >= 0) {
1854
+ for (let [j, childElementArr] of element.children.entries()) {
1855
+ for (let [k, childElement] of childElementArr.entries()) {
1856
+ if (childElement.id == target.id) {
1857
+ this.dataModel[i].children[j][k].value = target.selectedValues()
1858
+ }
1859
+ }
1860
+ }
1861
+ }
1862
+ }
1863
+ }
1864
+
1865
+ if (this.evalTimeout != null) {
1866
+ clearTimeout(this.evalTimeout);
1867
+ }
1868
+ this.evalTimeout = setTimeout(() => {
1869
+ this.evalShowProgress()
1870
+ }, 2000)
1871
+ })
1872
+ }
1873
+
1874
+ let selects = (this._SfReportingContainer as HTMLDivElement).querySelectorAll('.reporting-sf-i-select') as NodeListOf<SfISelect>
1875
+ for (let select of selects) {
1876
+ select.addEventListener('valueChanged', async (ev: any) => {
1877
+
1878
+ let target = ev.target as SfISelect;
1879
+ let genId = target.id.slice(0, target.id.lastIndexOf('-'));
1880
+ console.log('sf-i-select value changed', target.id)
1881
+ for (let [i, element] of this.dataModel.entries()) {
1882
+ if (!isAddButtonObject(element)) {
1883
+ if (element.id == target.id) {
1794
1884
  this.dataModel[i].value = target.selectedValues()
1795
1885
  }
1796
- }else{
1797
- if(element.schema.indexOf(genId) >= 0){
1798
- for(let [j,childElementArr] of element.children.entries()){
1799
- for(let [k, childElement] of childElementArr.entries()){
1800
- if(childElement.id == target.id){
1886
+ } else {
1887
+ if (element.schema.indexOf(genId) >= 0) {
1888
+ for (let [j, childElementArr] of element.children.entries()) {
1889
+ for (let [k, childElement] of childElementArr.entries()) {
1890
+ if (childElement.id == target.id) {
1801
1891
  this.dataModel[i].children[j][k].value = target.selectedValues()
1802
1892
  }
1803
1893
  }
@@ -1805,49 +1895,83 @@ export class SfIReporting extends LitElement {
1805
1895
  }
1806
1896
  }
1807
1897
  }
1808
-
1809
- if(this.evalTimeout != null){
1898
+
1899
+ if (this.evalTimeout != null) {
1810
1900
  clearTimeout(this.evalTimeout);
1811
1901
  }
1812
1902
  this.evalTimeout = setTimeout(() => {
1813
1903
  this.evalShowProgress()
1814
- },2000)
1904
+ }, 2000)
1905
+ })
1906
+ }
1907
+
1908
+ let checklists = (this._SfReportingContainer as HTMLDivElement).querySelectorAll('.reporting-sf-checklist') as NodeListOf<SfChecklist>
1909
+ for (let checklist of checklists) {
1910
+ checklist.addEventListener('valueChanged', async (ev: any) => {
1911
+
1912
+ let target = ev.target as SfChecklist;
1913
+ let genId = target.id.slice(0, target.id.lastIndexOf('-'));
1914
+ console.log('sf-checklist value changed', target.id)
1915
+ for (let [i, element] of this.dataModel.entries()) {
1916
+ if (!isAddButtonObject(element)) {
1917
+ if (element.id == target.id && Object.keys(target.selectedValues()).length > 0) {
1918
+ this.dataModel[i].value = target.selectedValues()
1919
+ }
1920
+ } else {
1921
+ if (element.schema.indexOf(genId) >= 0) {
1922
+ for (let [j, childElementArr] of element.children.entries()) {
1923
+ for (let [k, childElement] of childElementArr.entries()) {
1924
+ if (childElement.id == target.id) {
1925
+ this.dataModel[i].children[j][k].value = target.selectedValues()
1926
+ }
1927
+ }
1928
+ }
1929
+ }
1930
+ }
1931
+ }
1932
+
1933
+ if (this.evalTimeout != null) {
1934
+ clearTimeout(this.evalTimeout);
1935
+ }
1936
+ this.evalTimeout = setTimeout(() => {
1937
+ this.evalShowProgress()
1938
+ }, 2000)
1815
1939
  })
1816
1940
  }
1817
1941
  }
1818
1942
 
1819
1943
  checkDependencies = async (id: string) => {
1820
- for(let element of this.dataModel){
1821
- if(element.dependencies.indexOf(id) >= 0){
1944
+ for (let element of this.dataModel) {
1945
+ if (element.dependencies.indexOf(id) >= 0) {
1822
1946
  let dependantElement = (this._SfReportingContainer as HTMLDivElement).querySelector('#' + element.id)
1823
1947
  console.log('dependant element', dependantElement?.tagName, dependantElement?.id, id);
1824
- if(dependantElement?.tagName.toLowerCase() == "sf-i-bricks"){
1948
+ if (dependantElement?.tagName.toLowerCase() == "sf-i-bricks") {
1825
1949
  let dependantBricks = dependantElement as SfIBricks
1826
1950
  let selectedDependedValues = []
1827
- for(let dependency of element.dependencies){
1951
+ for (let dependency of element.dependencies) {
1828
1952
  let dependedBricks = (this._SfReportingContainer as HTMLDivElement).querySelector('#' + dependency) as SfIBricks
1829
1953
  selectedDependedValues.push(dependedBricks.selectedValueTexts()[0])
1830
1954
  }
1831
1955
  let values = this.getBricksValues(element, selectedDependedValues)
1832
1956
  console.log('bricks selecteddependantvalues', selectedDependedValues, element.value.length, values[1], element.id);
1833
- dependantBricks.namesjson = JSON.stringify(values[0])
1957
+ dependantBricks.namesjson = JSON.stringify(values[0])
1834
1958
  dependantBricks.idsjson = JSON.stringify(values[1])
1835
- if(element.value != '' && element.value.length > 0){
1959
+ if (element.value != '' && element.value.length > 0) {
1836
1960
  dependantBricks.prepopulateValJson = JSON.stringify(element.value)
1837
- }else{
1961
+ } else {
1838
1962
  dependantBricks.prepopulateValJson = JSON.stringify([])
1839
1963
  }
1840
1964
  dependantBricks.loadMode()
1841
1965
  await Util.delay(500)
1842
- }else if(dependantElement?.tagName.toLowerCase() == "sf-i-form"){
1966
+ } else if (dependantElement?.tagName.toLowerCase() == "sf-i-form") {
1843
1967
  let dependantForm = dependantElement as SfIForm
1844
- if(dependantForm.mode == "select"){
1968
+ if (dependantForm.mode == "select") {
1845
1969
  this.updateShortlistedSearchPhrases(dependantForm.id);
1846
1970
  dependantForm.loadMode()
1847
1971
  }
1848
- }else if(dependantElement?.tagName.toLowerCase() == "sf-i-form-select"){
1972
+ } else if (dependantElement?.tagName.toLowerCase() == "sf-i-form-select") {
1849
1973
  let dependantForm = dependantElement as SfIForm
1850
- if(dependantForm.mode == "select"){
1974
+ if (dependantForm.mode == "select") {
1851
1975
  this.updateShortlistedSearchPhrases(dependantForm.id);
1852
1976
  dependantForm.loadMode()
1853
1977
  }
@@ -1857,34 +1981,34 @@ export class SfIReporting extends LitElement {
1857
1981
  }
1858
1982
 
1859
1983
  updateShortlistedSearchPhrases = (id: string) => {
1860
- for(let dataObj of this.dataModel){
1861
- if (dataObj.id == id){
1984
+ for (let dataObj of this.dataModel) {
1985
+ if (dataObj.id == id) {
1862
1986
  let element = dataObj as DataObject
1863
1987
  let elementForm = (this._SfReportingContainer as HTMLDivElement).querySelector('#' + element.id) as SfIForm;
1864
1988
  let tempSearchPhrases = []
1865
- for(let dependency of element.dependencies){
1989
+ for (let dependency of element.dependencies) {
1866
1990
  console.log('checking dependency', dependency)
1867
1991
  let dependencyElement = (this._SfReportingContainer as HTMLDivElement).querySelector('#' + dependency)
1868
- if(dependencyElement?.tagName.toLowerCase() == "sf-i-bricks"){
1992
+ if (dependencyElement?.tagName.toLowerCase() == "sf-i-bricks") {
1869
1993
  console.log('dependencyelement', dependencyElement.id, (dependencyElement as SfIBricks).selectedTexts());
1870
- for(let selectedText of (dependencyElement as SfIBricks).selectedTexts()){
1871
- if(selectedText == ''){
1994
+ for (let selectedText of (dependencyElement as SfIBricks).selectedTexts()) {
1995
+ if (selectedText == '') {
1872
1996
  continue;
1873
1997
  }
1874
1998
  tempSearchPhrases.push(selectedText.replace(/ *\([^)]*\) */g, ""))
1875
1999
  }
1876
- }else if(dependencyElement?.tagName.toLowerCase() == "sf-i-form"){
2000
+ } else if (dependencyElement?.tagName.toLowerCase() == "sf-i-form") {
1877
2001
  console.log('dependencyelement', dependencyElement.id, (dependencyElement as SfIForm).selectedTexts());
1878
- for(let selectedText of (dependencyElement as SfIForm).selectedTexts()){
1879
- if(selectedText == ''){
2002
+ for (let selectedText of (dependencyElement as SfIForm).selectedTexts()) {
2003
+ if (selectedText == '') {
1880
2004
  continue;
1881
2005
  }
1882
2006
  tempSearchPhrases.push(selectedText.replace(/ *\([^)]*\) */g, ""))
1883
2007
  }
1884
- }else if(dependencyElement?.tagName.toLowerCase() == "sf-i-form-select"){
2008
+ } else if (dependencyElement?.tagName.toLowerCase() == "sf-i-form-select") {
1885
2009
  console.log('dependencyelement', dependencyElement.id, (dependencyElement as SfIForm).selectedTexts());
1886
- for(let selectedText of (dependencyElement as SfIForm).selectedTexts()){
1887
- if(selectedText == ''){
2010
+ for (let selectedText of (dependencyElement as SfIForm).selectedTexts()) {
2011
+ if (selectedText == '') {
1888
2012
  continue;
1889
2013
  }
1890
2014
  tempSearchPhrases.push(selectedText.replace(/ *\([^)]*\) */g, ""))
@@ -1899,24 +2023,24 @@ export class SfIReporting extends LitElement {
1899
2023
 
1900
2024
  initSectionListeners = () => {
1901
2025
  let sectionHeads = (this._SfReportingContainer.querySelectorAll('.section-head')) as NodeListOf<HTMLDivElement>
1902
- for(let sectionHead of sectionHeads){
2026
+ for (let sectionHead of sectionHeads) {
1903
2027
  sectionHead.addEventListener('click', async () => {
1904
2028
  await this.showLoader();
1905
- console.log('scroll position',(this._SfReportingContainer.querySelector('.form-container') as HTMLElement).scrollTop)
1906
- for(let dataObj of this.dataModel){
1907
- if(dataObj.id == sectionHead.id){
2029
+ console.log('scroll position', (this._SfReportingContainer.querySelector('.form-container') as HTMLElement).scrollTop)
2030
+ for (let dataObj of this.dataModel) {
2031
+ if (dataObj.id == sectionHead.id) {
1908
2032
  dataObj.collapse = dataObj.collapse == "false" ? "true" : "false"
1909
- }
2033
+ }
1910
2034
  }
1911
- if(this.evalTimeout != null){
2035
+ if (this.evalTimeout != null) {
1912
2036
  clearTimeout(this.evalTimeout)
1913
2037
  }
1914
2038
  this.evalTimeout = setTimeout(() => {
1915
2039
  this.evalShowProgress()
1916
- },2000)
1917
-
2040
+ }, 2000)
2041
+
1918
2042
  let formContainer = (this._SfReportingContainer.querySelector('.form-container') as HTMLElement)
1919
- if(formContainer != null){
2043
+ if (formContainer != null) {
1920
2044
  this.populateView(formContainer.scrollTop);
1921
2045
  }
1922
2046
  })
@@ -1939,54 +2063,54 @@ export class SfIReporting extends LitElement {
1939
2063
  }
1940
2064
  renderElement = (dataObj: DataObject) => {
1941
2065
  let elementHtml = ""
1942
- console.log('rendering obj',dataObj.type)
2066
+ console.log('rendering obj', dataObj.type)
1943
2067
  let elementLabel = dataObj.label ?? ""
1944
- if(this.editdisable == "true"){
1945
- elementLabel = elementLabel.replace(/ */g,'')
2068
+ if (this.editdisable == "true") {
2069
+ elementLabel = elementLabel.replace(/ */g, '')
1946
2070
  }
1947
- if(dataObj.type == "section"){
2071
+ if (dataObj.type == "section") {
1948
2072
  console.log('renderingSection', dataObj)
1949
2073
  elementHtml += `<div class="d-flex flex-col" part="section-container"><div id="${dataObj.id}" class="section-head d-flex align-center justify-between" part="${dataObj.collapse == "true" ? 'section-head-collapsed' : 'section-head-expanded'}"><h3 part="${dataObj.collapse == "true" ? 'section-title-collapsed' : 'section-title-expanded'}">${dataObj.name}</h3><div id="${dataObj.id}-success" part="section-success-icon"><div class="material-icons">${dataObj.collapse == "true" ? "keyboard_arrow_down" : "keyboard_arrow_up"}</div></div></div><div class="section-body d-flex ${this.formviewclass} ${dataObj.collapse == "true" ? 'hide' : ''}" part="section-body"> `
1950
- }else if(dataObj.type == "subsection"){
2074
+ } else if (dataObj.type == "subsection") {
1951
2075
  elementHtml += `<div class="d-flex align-center" part="subsection-container"><h4 part="subsection">${dataObj.name}</h4></div>`
1952
- }else if(dataObj.type == "textarea"){
2076
+ } else if (dataObj.type == "textarea") {
1953
2077
  elementHtml += `<div part="textarea-container" class="d-flex flex-col flex-grow">
1954
2078
  <label id="${dataObj.id}-label" part="textarea-label">${elementLabel}</label>
1955
2079
  <div part="td-body-2"><sf-i-elastic-text text="${dataObj.hint}" minLength="50"></sf-i-elastic-text></div>
1956
- <${this.editdisable == "true" ? 'div' : 'textarea'} rows="${dataObj.size == "small" ? "4" : ( dataObj.size == "smallest" ? "1" : "10")}" id="${dataObj.id}" type="text" class=" reporting-textarea" part="input-textarea" ${this.mode == "view" || this.flow == "details" ? "readonly" : ""}>${dataObj.value}</${this.editdisable == "true" ? 'div' : 'textarea'}>
2080
+ <${this.editdisable == "true" ? 'div' : 'textarea'} rows="${dataObj.size == "small" ? "4" : (dataObj.size == "smallest" ? "1" : "10")}" id="${dataObj.id}" type="text" class=" reporting-textarea" part="input-textarea" ${this.mode == "view" || this.flow == "details" ? "readonly" : ""}>${dataObj.value}</${this.editdisable == "true" ? 'div' : 'textarea'}>
1957
2081
  </div>`
1958
- }else if(dataObj.type == "yesno+textarea"){
2082
+ } else if (dataObj.type == "yesno+textarea") {
1959
2083
  elementHtml += `<div part="textarea-container" class="d-flex flex-col flex-grow">
1960
2084
  <label id="${dataObj.id}-label" part="textarea-label">${elementLabel}</label>
1961
2085
  <div part="td-body-2"><sf-i-elastic-text text="${dataObj.hint}" minLength="50"></sf-i-elastic-text></div>
1962
2086
  <div class="d-flex">`
1963
- for(let option of dataObj.options){
1964
- elementHtml += `<input type="radio" id="${dataObj.id}-${option.toLowerCase().replace(/ /g,'_')}" name="${dataObj.id}" class="reporting-radio" part="input-radio" value="${option}" ${this.mode == "view" || this.flow == "details" ? "disabled" : ""} ${dataObj.value[0] == option ? "checked" : ""}><label id="${dataObj.id}-${option.toLowerCase().replace(/ /g,'_')}-label" part="radio-label">${option}</label>`
1965
- }
2087
+ for (let option of dataObj.options) {
2088
+ elementHtml += `<input type="radio" id="${dataObj.id}-${option.toLowerCase().replace(/ /g, '_')}" name="${dataObj.id}" class="reporting-radio" part="input-radio" value="${option}" ${this.mode == "view" || this.flow == "details" ? "disabled" : ""} ${dataObj.value[0] == option ? "checked" : ""}><label id="${dataObj.id}-${option.toLowerCase().replace(/ /g, '_')}-label" part="radio-label">${option}</label>`
2089
+ }
1966
2090
  elementHtml += `</div>
1967
2091
  <${this.editdisable == "true" ? 'div' : 'textarea'} rows="${dataObj.size == "small" ? "4" : "10"}" id="${dataObj.id}-textarea" type="text" class="reporting-textarea" part="input-textarea" ${this.mode == "view" || this.flow == "details" ? "readonly" : ""}>${dataObj.value[1] ?? ""}</${this.editdisable == "true" ? 'div' : 'textarea'}>
1968
2092
  </div>`
1969
- }else if(dataObj.type == "date"){
2093
+ } else if (dataObj.type == "date") {
1970
2094
  elementHtml += `<div part="date-container" class="d-flex flex-col flex-grow">
1971
2095
  <label id="${dataObj.id}-label" part="date-label">${elementLabel}</label>
1972
2096
  <div part="td-body-2"><sf-i-elastic-text text="${dataObj.hint}" minLength="50"></sf-i-elastic-text></div>
1973
2097
  <input class="reporting-date" id="${dataObj.id}" part="input-date" type="date" ${this.mode == "view" || this.flow == "details" ? "readonly" : ""} value="${dataObj.value}"/>
1974
2098
  </div>`
1975
- }else if(dataObj.type == "sf-i-form"){
2099
+ } else if (dataObj.type == "sf-i-form") {
1976
2100
  elementHtml += `<div part="date-container" class="d-flex flex-col flex-grow">
1977
2101
  <label id="${dataObj.id}-label" part="date-label">${elementLabel}</label>
1978
2102
  <div part="td-body-2"><sf-i-elastic-text text="${dataObj.hint}" minLength="50"></sf-i-elastic-text></div>
1979
2103
  <sf-i-form exportparts="td-action:form-td-action, td-body" id="${dataObj.id}" class="reporting-sf-i-form" part="input-sf-i-form" name="${dataObj.name}" label="" apiId="${dataObj.apiid}" mode="${dataObj.mode}" searchPhrase="${(dataObj.mode == "multiselect-dropdown" ? (this.projectname + "&") : "") + dataObj.searchstring}" selectProjection="${dataObj.selectprojection}" ignoreProjections="${dataObj.ignoredprojections}" ${parseInt(dataObj.maxselect) == 0 ? "" : `maxselect="${dataObj.maxselect}"`} ${dataObj.mandatory != null ? "mandatory=\"\"" : ""}></sf-i-form>
1980
2104
  </div>`
1981
- }else if(dataObj.type == "sf-i-form-select"){
2105
+ } else if (dataObj.type == "sf-i-form-select") {
1982
2106
  let valToBeShown = ""
1983
- if(dataObj.savenameseparate == "yes"){
1984
- if(dataObj.value[0] != null && dataObj.value[0].split(';').length > 0){
2107
+ if (dataObj.savenameseparate == "yes") {
2108
+ if (dataObj.value[0] != null && dataObj.value[0].split(';').length > 0) {
1985
2109
  valToBeShown = dataObj.value[0].split(';')[0]
1986
2110
  }
1987
- }else if(dataObj.value.name != null){
2111
+ } else if (dataObj.value.name != null) {
1988
2112
  valToBeShown = dataObj.value.name
1989
- }else{
2113
+ } else {
1990
2114
  valToBeShown = dataObj.value.reference
1991
2115
  }
1992
2116
  elementHtml += `<div part="date-container" class="d-flex flex-col flex-grow">
@@ -1998,23 +2122,35 @@ export class SfIReporting extends LitElement {
1998
2122
  <div class="selected-option d-flex justtify-center align-center" part="selected-option" id="selected-option-${dataObj.id}">
1999
2123
  ${this.mode == "view" || this.flow == "details" ? '' : '<span class="material-icons selected-option-icon mr-10">cancel</span>'}
2000
2124
  <label class="selected-option-label" part="selected-option-label">${valToBeShown}</label>
2001
- </div>`): (`
2002
- ${(this.mode == "view" || this.flow == "details" ) ? '' :
2003
- `<button id="button-edit-form-${dataObj.id}" part="button-icon" class="material-icons button-edit-form button-icon-click">edit</button>`
2004
- }
2125
+ </div>`) : (`
2126
+ ${(this.mode == "view" || this.flow == "details") ? '' :
2127
+ `<button id="button-edit-form-${dataObj.id}" part="button-icon" class="material-icons button-edit-form button-icon-click">edit</button>`
2128
+ }
2005
2129
  `)
2006
- }
2130
+ }
2007
2131
  </div>
2008
2132
  </div>
2009
2133
  </div>`
2010
- }else if(dataObj.type == "sf-i-bricks"){
2134
+ } else if (dataObj.type == "sf-i-bricks") {
2011
2135
  elementHtml += `<div part="date-container" class="d-flex flex-col flex-grow">
2012
2136
  <label id="${dataObj.id}-label" part="date-label">${elementLabel}</label>
2013
2137
  <div part="td-body-2"><sf-i-elastic-text text="${dataObj.hint}" minLength="50"></sf-i-elastic-text></div>
2014
2138
  <sf-i-bricks exportparts="input-select-single, selected-container, selected-option, input-select-multi-option, select-option-label, selected-option-label" id="${dataObj.id}" mode="${dataObj.mode}"
2015
2139
  ${this.mode == "view" || this.flow == 'details' ? 'flow="view"' : ''} class="reporting-sf-i-bricks" part="input-sf-i-bricks" name="${dataObj.name}" ${parseInt(dataObj.maxselect) == 0 ? "" : `maxselect="${dataObj.maxselect}"`} ${dataObj.mandatory != null ? "mandatory=\"\"" : ""}></sf-i-bricks>
2016
2140
  </div>`
2017
- }else if(dataObj.type == "sf-i-uploader"){
2141
+ } else if (dataObj.type == "sf-i-select") {
2142
+ elementHtml += `<div part="date-container" class="d-flex flex-col flex-grow">
2143
+ <label id="${dataObj.id}-label" part="date-label">${elementLabel}</label>
2144
+ <div part="td-body-2"><sf-i-elastic-text text="${dataObj.hint}" minLength="50"></sf-i-elastic-text></div>
2145
+ <sf-i-select class="reporting-sf-i-select" exportparts="input-select:select-input-select" id="${dataObj.id}" part="input-sf-i-select" label="" apiId="${dataObj.apiid}" ${dataObj.mandatory != null ? "mandatory=\"\"" : ""}></sf-i-select>
2146
+ </div>`
2147
+ } else if (dataObj.type == "sf-checklist") {
2148
+ elementHtml += `<div part="date-container" class="d-flex flex-col flex-grow">
2149
+ <label id="${dataObj.id}-label" part="date-label">${elementLabel}</label>
2150
+ <div part="td-body-2"><sf-i-elastic-text text="${dataObj.hint}" minLength="50"></sf-i-elastic-text></div>
2151
+ <sf-checklist class="reporting-sf-checklist" exportparts="checklist-container, checklist-title, checklist-list, checklist-item, checklist-checkbox, checklist-checkbox-label" id="${dataObj.id}" part="input-sf-checklist" ${dataObj.mandatory != null ? "mandatory=\"\"" : ""}></sf-checklist>
2152
+ </div>`
2153
+ } else if (dataObj.type == "sf-i-uploader") {
2018
2154
  elementHtml += `<div part="uploader-container" class="d-flex flex-col flex-grow">
2019
2155
  <label id="${dataObj.id}-label" part="date-label">${elementLabel}</label>
2020
2156
  <div part="td-body-2"><sf-i-elastic-text text="${dataObj.hint}" minLength="50"></sf-i-elastic-text></div>
@@ -2027,21 +2163,21 @@ export class SfIReporting extends LitElement {
2027
2163
 
2028
2164
  populateViewShort = () => {
2029
2165
  let html = "";
2030
- if(this.mode == "short-new"){
2166
+ if (this.mode == "short-new") {
2031
2167
  html += `<button part="button-lg" id="button-short-new">Submit Form</button>`
2032
- }else if(this.mode == "short-view"){
2168
+ } else if (this.mode == "short-view") {
2033
2169
  html += `<button part="button-lg" id="button-short-view">Update From</button>`
2034
2170
  }
2035
2171
 
2036
2172
  (this._SfReportingContainerShort as HTMLDivElement).innerHTML = html;
2037
2173
  (this._SfReportingContainer as HTMLDivElement).style.display = 'none';
2038
2174
  // (this._SfReportingButtonContainer as HTMLDivElement).style.display = 'none';
2039
- (this._SfReportingContainerShort.querySelector('#button-short-new') as HTMLButtonElement)?.addEventListener('click',() => {
2175
+ (this._SfReportingContainerShort.querySelector('#button-short-new') as HTMLButtonElement)?.addEventListener('click', () => {
2040
2176
  this.mode = "new";
2041
2177
  this.loadMode();
2042
2178
  });
2043
2179
 
2044
- (this._SfReportingContainerShort.querySelector('#button-short-view') as HTMLButtonElement)?.addEventListener('click',() => {
2180
+ (this._SfReportingContainerShort.querySelector('#button-short-view') as HTMLButtonElement)?.addEventListener('click', () => {
2045
2181
  this.mode = "view";
2046
2182
  this.loadMode();
2047
2183
  })
@@ -2049,28 +2185,28 @@ export class SfIReporting extends LitElement {
2049
2185
 
2050
2186
  populateList = () => {
2051
2187
  let html = ''
2052
- html += `<div class="d-flex justify-between align-start p-7">`
2053
- html += `<div part="calendar-date-container" class="d-flex flex-col align-start justify-center">${this.lastCalendarGenerated == "" ? "" : ("<div class=\"d-flex align-center justify-center\" part=\"last-calendar-date\" id=\"last-calendar-date\"><span class=\"material-symbols-outlined\">update</span>&nbsp;&nbsp;Calendar synced on \n" + (new Date(parseInt(this.lastCalendarGenerated)).toLocaleDateString('en-IN') + " - " + new Date(parseInt(this.lastCalendarGenerated)).toLocaleTimeString('en-IN'))) + '</div>'}${this.nextCalendarScheduled == "" ? "" : ("<div class=\"d-flex align-center justify-center\" part=\"next-calendar-date\" id=\"next-calendar-date\"><span class=\"material-symbols-outlined\">hourglass</span>&nbsp;&nbsp;Next update on \n" + (new Date(parseInt(this.nextCalendarScheduled)).toLocaleDateString('en-IN') + " - " + new Date(parseInt(this.nextCalendarScheduled)).toLocaleTimeString('en-IN'))) + '</div>'}</div>`
2054
- html += `<div class="d-flex justify-end flex-grow">`
2055
- // html += `<button id="button-publish" part="button-icon" class="material-icons hide">campaign</button>`
2056
- html += `<button id="button-new" part="button-icon" class="material-icons button-icon-click ml-10">add</button>`
2057
- html += `</div>`
2188
+ html += `<div class="d-flex left-sticky justify-between align-start p-7">`
2189
+ html += `<div part="calendar-date-container" class="d-flex flex-col align-start justify-center">${this.lastCalendarGenerated == "" ? "" : ("<div class=\"d-flex align-center justify-center\" part=\"last-calendar-date\" id=\"last-calendar-date\"><span class=\"material-symbols-outlined\">update</span>&nbsp;&nbsp;Calendar synced on \n" + (new Date(parseInt(this.lastCalendarGenerated)).toLocaleDateString('en-IN') + " - " + new Date(parseInt(this.lastCalendarGenerated)).toLocaleTimeString('en-IN'))) + '</div>'}${this.nextCalendarScheduled == "" ? "" : ("<div class=\"d-flex align-center justify-center\" part=\"next-calendar-date\" id=\"next-calendar-date\"><span class=\"material-symbols-outlined\">hourglass</span>&nbsp;&nbsp;Next update on \n" + (new Date(parseInt(this.nextCalendarScheduled)).toLocaleDateString('en-IN') + " - " + new Date(parseInt(this.nextCalendarScheduled)).toLocaleTimeString('en-IN'))) + '</div>'}</div>`
2190
+ html += `<div class="d-flex justify-end flex-grow">`
2191
+ // html += `<button id="button-publish" part="button-icon" class="material-icons hide">campaign</button>`
2192
+ html += `<button id="button-new" part="button-icon" class="material-icons button-icon-click ml-10">add</button>`
2193
+ html += `</div>`
2058
2194
  html += `</div>`
2059
2195
  html += '<table id="select-list-table" class="w-100-m-0">';
2060
- for(let [i,item] of this.list.entries()){
2196
+ for (let [i, item] of this.list.entries()) {
2061
2197
  html += '<tr class="tablerow">'
2062
2198
  let bgClass = i % 2 == 0 ? 'td-light' : 'td-dark'
2063
2199
  html += `<td part="td-body" class="td-body"><span class="mrl-5 material-icons" part="span-submit-${item.published ? 'published' : 'unpublished'}" >${item.published ? 'radio_button_checked' : 'edit_note'}</span></td>`
2064
2200
  html += `<td part="td-action" class="td-action"><button part="button-icon" class="material-symbols-outlined button-reopen" id="button-reopen-${i}">reopen_window</button></td>`
2065
2201
  html += `<td part="td-action" class="td-action"><button part="button-icon" class="material-icons button-details" id="button-details-${i}">open_in_new</button></td>`
2066
- for(let property of Object.keys(item)){
2067
- if(this.getIgnoreProjections().indexOf(property) < 0){
2202
+ for (let property of Object.keys(item)) {
2203
+ if (this.getIgnoreProjections().indexOf(property) < 0) {
2068
2204
  let displayValue = item[property]
2069
2205
  console.log('displaying property', property)
2070
- if(property == "lastModifiedTime"){
2206
+ if (property == "lastModifiedTime") {
2071
2207
  displayValue = Util.timeSince(parseInt(item[property]));
2072
2208
  }
2073
- html +=`<td part="td-body" class="td-body ${bgClass}"><div class="d-flex flex-col align-start flex-wrap"><div part="td-head" class="pl-0-imp w-100 d-flex align-center">${property}</div><div><sf-i-elastic-text text="${displayValue}" minLength="20"></sf-i-elastic-text></div></div></td>`
2209
+ html += `<td part="td-body" class="td-body ${bgClass}"><div class="d-flex flex-col align-start flex-wrap"><div part="td-head" class="pl-0-imp w-100 d-flex align-center">${property}</div><div><sf-i-elastic-text text="${displayValue}" minLength="10"></sf-i-elastic-text></div></div></td>`
2074
2210
  }
2075
2211
  }
2076
2212
  html += '</tr>'
@@ -2081,7 +2217,7 @@ export class SfIReporting extends LitElement {
2081
2217
  (this._SfReportingContainer as HTMLDivElement).style.display = 'block';
2082
2218
 
2083
2219
  let reopenButtons = (this._SfReportingContainer as HTMLDivElement).querySelectorAll('.button-reopen') as NodeListOf<HTMLButtonElement>
2084
- for(let reopenButton of reopenButtons){
2220
+ for (let reopenButton of reopenButtons) {
2085
2221
  reopenButton.addEventListener('click', async (ev: any) => {
2086
2222
  let target = ev.target
2087
2223
  let index = target.id.split('-')[2]
@@ -2092,16 +2228,16 @@ export class SfIReporting extends LitElement {
2092
2228
  await this.fetchSchema();
2093
2229
  this.published = this.list[index].published ?? false
2094
2230
  let copyVals: any = {}
2095
- for(let obj of this.dataModel){
2096
- if(obj.copytoreopen){
2231
+ for (let obj of this.dataModel) {
2232
+ if (obj.copytoreopen) {
2097
2233
  console.log('copyVals copying', obj.id, obj.type, oldObj[obj.id]);
2098
- if(obj.type == "sf-i-bricks" && obj.savenameseparate == "yes"){
2099
- copyVals[obj.id + 'id'] = oldObj[obj.id + 'id'];
2100
- copyVals[obj.id + 'name'] = oldObj[obj.id + 'name'];
2101
- }else{
2234
+ if (obj.type == "sf-i-bricks" && obj.savenameseparate == "yes") {
2235
+ copyVals[obj.id + 'id'] = oldObj[obj.id + 'id'];
2236
+ copyVals[obj.id + 'name'] = oldObj[obj.id + 'name'];
2237
+ } else {
2102
2238
  copyVals[obj.id] = oldObj[obj.id];
2103
2239
  }
2104
- console.log('copyVals copied',copyVals)
2240
+ console.log('copyVals copied', copyVals)
2105
2241
  }
2106
2242
  }
2107
2243
  console.log('copyVals', JSON.parse(JSON.stringify(copyVals)))
@@ -2111,23 +2247,23 @@ export class SfIReporting extends LitElement {
2111
2247
  })
2112
2248
  }
2113
2249
  let detailsButtons = (this._SfReportingContainer as HTMLDivElement).querySelectorAll('.button-details') as NodeListOf<HTMLButtonElement>
2114
- for(let detailsButton of detailsButtons){
2115
- detailsButton.addEventListener('click',(ev: any) => {
2250
+ for (let detailsButton of detailsButtons) {
2251
+ detailsButton.addEventListener('click', (ev: any) => {
2116
2252
  let target = ev.target
2117
2253
  let index = target.id.split('-')[2]
2118
2254
  this.selectedItem = this.list[index]
2119
2255
  this.showLoader();
2120
2256
  console.log('item selected', this.selectedItem);
2121
- setTimeout(()=>{
2257
+ setTimeout(() => {
2122
2258
  this.flow = "details"
2123
- this.loadMode();
2124
- },3000)
2125
-
2259
+ this.loadMode();
2260
+ }, 3000)
2261
+
2126
2262
  })
2127
2263
  }
2128
-
2264
+
2129
2265
  let buttonNew = ((this._SfReportingContainer as HTMLDivElement).querySelector('#button-new') as HTMLButtonElement)
2130
- buttonNew.addEventListener('click',()=>{
2266
+ buttonNew.addEventListener('click', () => {
2131
2267
  this.showLoader();
2132
2268
  this.newClick()
2133
2269
  })
@@ -2138,65 +2274,65 @@ export class SfIReporting extends LitElement {
2138
2274
 
2139
2275
  loadMode = async () => {
2140
2276
  console.log('loadmode', this.mode, this.flow);
2141
- if(this.mode == "view"){
2277
+ if (this.mode == "view") {
2142
2278
  this.populateDataModel();
2143
2279
  this.prepopulateValues()
2144
- }else if(this.mode == "edit"){
2280
+ } else if (this.mode == "edit") {
2145
2281
  this.populateDataModel();
2146
2282
  this.prepopulateValues()
2147
- }else if(this.mode == "new"){
2283
+ } else if (this.mode == "new") {
2148
2284
  this.published = false;
2149
2285
  this.populateDataModel();
2150
2286
  this.populateView();
2151
- }else if(this.mode == "downloader"){
2152
- setTimeout(()=>{
2287
+ } else if (this.mode == "downloader") {
2288
+ setTimeout(() => {
2153
2289
  this.initDecryptView();
2154
2290
  }, 1000)
2155
- }else if(this.mode == "admin"){
2156
- if(this.flow == "new"){
2291
+ } else if (this.mode == "admin") {
2292
+ if (this.flow == "new") {
2157
2293
  setTimeout(() => {
2158
- this.initNewListeners();
2294
+ this.initNewListeners();
2159
2295
  }, 500);
2160
2296
  this.fetchSchema();
2161
- }else if(this.flow == "edit"){
2297
+ } else if (this.flow == "edit") {
2162
2298
  setTimeout(() => {
2163
2299
  this.initEditListeners();
2164
2300
  this.populateDataModel();
2165
- this.prepopulateValues();
2301
+ this.prepopulateValues();
2166
2302
  }, 500);
2167
- }else if(this.flow == "details"){
2303
+ } else if (this.flow == "details") {
2168
2304
  setTimeout(() => {
2169
- this.initDetailsListeners();
2305
+ this.initDetailsListeners();
2170
2306
  }, 500);
2171
2307
  this.fetchDetails();
2172
- }else if(this.flow == "list"){
2308
+ } else if (this.flow == "list") {
2173
2309
  setTimeout(() => {
2174
- this.initListListeners();
2310
+ this.initListListeners();
2175
2311
  }, 500);
2176
2312
  this.fetchList();
2177
2313
  }
2178
- }else{
2314
+ } else {
2179
2315
  this.populateViewShort();
2180
2316
  }
2181
2317
  }
2182
2318
 
2183
2319
  prepareXhrPresignedGet = async (url: string, loaderElement: any, loaderText: string = '') => {
2184
2320
 
2185
-
2186
- if(loaderElement != null) {
2321
+
2322
+ if (loaderElement != null) {
2187
2323
  loaderElement.innerHTML = '<div class="lds-dual-ring"></div>';
2188
- loaderElement.innerHTML += ('<div class="lds-text"><div class="lds-text-c">'+loaderText+'</div></div>');
2324
+ loaderElement.innerHTML += ('<div class="lds-text"><div class="lds-text-c">' + loaderText + '</div></div>');
2189
2325
  }
2190
2326
  return await Util.callApiPresignedGet(url);
2191
2327
 
2192
2328
  }
2193
-
2329
+
2194
2330
  prepareXhrPresignedDelete = async (url: string, loaderElement: any, loaderText: string = '') => {
2195
2331
 
2196
-
2197
- if(loaderElement != null) {
2332
+
2333
+ if (loaderElement != null) {
2198
2334
  loaderElement.innerHTML = '<div class="lds-dual-ring"></div>';
2199
- loaderElement.innerHTML += ('<div class="lds-text"><div class="lds-text-c">'+loaderText+'</div></div>');
2335
+ loaderElement.innerHTML += ('<div class="lds-text"><div class="lds-text-c">' + loaderText + '</div></div>');
2200
2336
  }
2201
2337
  return await Util.callApiPresignedDelete(url);
2202
2338
 
@@ -2204,8 +2340,8 @@ export class SfIReporting extends LitElement {
2204
2340
 
2205
2341
  prepareXhr = async (data: any, url: string, loaderElement: any, authorization: any) => {
2206
2342
 
2207
-
2208
- if(loaderElement != null) {
2343
+
2344
+ if (loaderElement != null) {
2209
2345
  loaderElement.innerHTML = '<div class="lds-dual-ring"></div>';
2210
2346
  }
2211
2347
  return await Util.callApi(url, data, authorization);
@@ -2213,9 +2349,9 @@ export class SfIReporting extends LitElement {
2213
2349
  }
2214
2350
 
2215
2351
  fetchPresignedUrl = async (url: string) => {
2216
- const xhr : any = (await this.prepareXhrPresignedGet(url, this._SfLoader, 'Downloading')) as any;
2352
+ const xhr: any = (await this.prepareXhrPresignedGet(url, this._SfLoader, 'Downloading')) as any;
2217
2353
  this._SfLoader.innerHTML = '';
2218
- if(xhr.status == 200) {
2354
+ if (xhr.status == 200) {
2219
2355
  const jsRespose = JSON.parse(xhr.responseText);
2220
2356
  console.log('jsRespose', jsRespose);
2221
2357
  return jsRespose;
@@ -2223,9 +2359,9 @@ export class SfIReporting extends LitElement {
2223
2359
  }
2224
2360
 
2225
2361
  fetchPresignedUrlDelete = async (url: string) => {
2226
- const xhr : any = (await this.prepareXhrPresignedDelete(url, this._SfLoader)) as any;
2362
+ const xhr: any = (await this.prepareXhrPresignedDelete(url, this._SfLoader)) as any;
2227
2363
  this._SfLoader.innerHTML = '';
2228
- if(xhr.status == 200) {
2364
+ if (xhr.status == 200) {
2229
2365
  const jsRespose = JSON.parse(xhr.responseText);
2230
2366
  console.log('jsRespose', jsRespose);
2231
2367
  return jsRespose;
@@ -2267,18 +2403,18 @@ export class SfIReporting extends LitElement {
2267
2403
  }
2268
2404
 
2269
2405
  fetchSchema = async () => {
2270
- let url = "https://"+this.apiId+"/getschema";
2406
+ let url = "https://" + this.apiId + "/getschema";
2271
2407
 
2272
2408
  const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
2273
- const xhr : any = (await this.prepareXhr({}, url, this._SfLoader, authorization)) as any;
2409
+ const xhr: any = (await this.prepareXhr({}, url, this._SfLoader, authorization)) as any;
2274
2410
  this._SfLoader.innerHTML = '';
2275
2411
  console.log(xhr)
2276
- if(xhr.status == 200) {
2412
+ if (xhr.status == 200) {
2277
2413
  const jsonRespose = JSON.parse(xhr.responseText);
2278
2414
  this.configjson = JSON.stringify(jsonRespose.schema);
2279
2415
  // if(this.flow == "new"){
2280
- this.populateDataModel();
2281
- this.populateView();
2416
+ this.populateDataModel();
2417
+ this.populateView();
2282
2418
  // }
2283
2419
  } else {
2284
2420
  const jsonRespose = JSON.parse(xhr.responseText);
@@ -2287,13 +2423,13 @@ export class SfIReporting extends LitElement {
2287
2423
  }
2288
2424
 
2289
2425
  fetchList = async () => {
2290
- let url = "https://"+this.apiId+"/list";
2291
- let body = {projectid: this.projectid}
2426
+ let url = "https://" + this.apiId + "/list";
2427
+ let body = { projectid: this.projectid }
2292
2428
  const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
2293
- const xhr : any = (await this.prepareXhr(body, url, this._SfLoader, authorization)) as any;
2429
+ const xhr: any = (await this.prepareXhr(body, url, this._SfLoader, authorization)) as any;
2294
2430
  this._SfLoader.innerHTML = '';
2295
2431
  console.log(xhr)
2296
- if(xhr.status == 200) {
2432
+ if (xhr.status == 200) {
2297
2433
  const jsonRespose = JSON.parse(xhr.responseText);
2298
2434
  console.log('list response', jsonRespose)
2299
2435
  console.log('list response', jsonRespose.lastCalendarGenerated)
@@ -2309,13 +2445,13 @@ export class SfIReporting extends LitElement {
2309
2445
  }
2310
2446
 
2311
2447
  fetchDetails = async () => {
2312
- let url = "https://"+this.apiId+"/details";
2313
- let body = {projectid: this.projectid, noticeid: this.selectedItem.id}
2448
+ let url = "https://" + this.apiId + "/details";
2449
+ let body = { projectid: this.projectid, objectid: this.selectedItem.id }
2314
2450
  const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
2315
- const xhr : any = (await this.prepareXhr(body, url, this._SfLoader, authorization)) as any;
2451
+ const xhr: any = (await this.prepareXhr(body, url, this._SfLoader, authorization)) as any;
2316
2452
  this._SfLoader.innerHTML = '';
2317
2453
  console.log(xhr)
2318
- if(xhr.status == 200) {
2454
+ if (xhr.status == 200) {
2319
2455
  const jsonRespose = JSON.parse(xhr.responseText);
2320
2456
  console.log('details response', jsonRespose)
2321
2457
  let resultObject = jsonRespose.object
@@ -2332,16 +2468,16 @@ export class SfIReporting extends LitElement {
2332
2468
 
2333
2469
  submitNew = async () => {
2334
2470
  console.log('adding', this.selectedValues());
2335
- let url = "https://"+this.apiId+"/add";
2336
-
2337
- let body:any = {projectid: this.projectid, object: this.selectedValues(), schema: this.getConfigJson(), published: this.published}
2338
-
2471
+ let url = "https://" + this.apiId + "/add";
2472
+
2473
+ let body: any = { projectid: this.projectid, object: this.selectedValues(), schema: this.getConfigJson(), published: this.published }
2474
+
2339
2475
  // console.log('adding', body, url);
2340
2476
  const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
2341
- const xhr : any = (await this.prepareXhr(body, url, this._SfLoader, authorization)) as any;
2477
+ const xhr: any = (await this.prepareXhr(body, url, this._SfLoader, authorization)) as any;
2342
2478
  this._SfLoader.innerHTML = '';
2343
2479
  console.log(xhr)
2344
- if(xhr.status == 200) {
2480
+ if (xhr.status == 200) {
2345
2481
  const jsonRespose = JSON.parse(xhr.responseText);
2346
2482
  console.log('add response', jsonRespose)
2347
2483
  // this.configjson = JSON.stringify(jsonRespose.schema);
@@ -2355,18 +2491,18 @@ export class SfIReporting extends LitElement {
2355
2491
  }
2356
2492
 
2357
2493
  submitEdit = async () => {
2358
- let url = "https://"+this.apiId+"/update";
2359
- let body = {projectid: this.projectid, noticeid: this.selectedItem.id, object: this.selectedValues(), schema: this.getConfigJson(), published: this.published}
2360
- if(Object.keys(this.reopenedItem).length > 0){
2361
- url = "https://"+this.apiId+"/reopen"
2362
- body = {projectid: this.projectid, object: this.selectedValues(), schema: this.getConfigJson(), noticeid: this.reopenedItem.id, published: this.published}
2494
+ let url = "https://" + this.apiId + "/update";
2495
+ let body = { projectid: this.projectid, objectid: this.selectedItem.id, object: this.selectedValues(), schema: this.getConfigJson(), published: this.published }
2496
+ if (Object.keys(this.reopenedItem).length > 0) {
2497
+ url = "https://" + this.apiId + "/reopen"
2498
+ body = { projectid: this.projectid, object: this.selectedValues(), schema: this.getConfigJson(), objectid: this.reopenedItem.id, published: this.published }
2363
2499
  }
2364
2500
  console.log('updating', body, url)
2365
2501
  const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
2366
- const xhr : any = (await this.prepareXhr(body, url, this._SfLoader, authorization)) as any;
2502
+ const xhr: any = (await this.prepareXhr(body, url, this._SfLoader, authorization)) as any;
2367
2503
  this._SfLoader.innerHTML = '';
2368
2504
  console.log(xhr)
2369
- if(xhr.status == 200) {
2505
+ if (xhr.status == 200) {
2370
2506
  const jsonRespose = JSON.parse(xhr.responseText);
2371
2507
  console.log('update response', jsonRespose)
2372
2508
  // this.configjson = JSON.stringify(jsonRespose.schema);
@@ -2380,13 +2516,13 @@ export class SfIReporting extends LitElement {
2380
2516
  }
2381
2517
 
2382
2518
  submitDelete = async () => {
2383
- let url = "https://"+this.apiId+"/delete";
2384
- let body = {projectid: this.projectid, noticeid: this.selectedItem.id}
2519
+ let url = "https://" + this.apiId + "/delete";
2520
+ let body = { projectid: this.projectid, objectid: this.selectedItem.id }
2385
2521
  const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
2386
- const xhr : any = (await this.prepareXhr(body, url, this._SfLoader, authorization)) as any;
2522
+ const xhr: any = (await this.prepareXhr(body, url, this._SfLoader, authorization)) as any;
2387
2523
  this._SfLoader.innerHTML = '';
2388
2524
  console.log(xhr)
2389
- if(xhr.status == 200) {
2525
+ if (xhr.status == 200) {
2390
2526
  const jsonRespose = JSON.parse(xhr.responseText);
2391
2527
  console.log('delete response', jsonRespose)
2392
2528
  // this.configjson = JSON.stringify(jsonRespose.schema);
@@ -2400,13 +2536,13 @@ export class SfIReporting extends LitElement {
2400
2536
  }
2401
2537
 
2402
2538
  submitPublish = async () => {
2403
- let url = "https://"+this.apiId+"/publish";
2404
- let body = {projectid: this.projectid, noticeids: this.selectedItemIds}
2539
+ let url = "https://" + this.apiId + "/publish";
2540
+ let body = { projectid: this.projectid, objectids: this.selectedItemIds }
2405
2541
  const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
2406
- const xhr : any = (await this.prepareXhr(body, url, this._SfLoader, authorization)) as any;
2542
+ const xhr: any = (await this.prepareXhr(body, url, this._SfLoader, authorization)) as any;
2407
2543
  this._SfLoader.innerHTML = '';
2408
2544
  console.log(xhr)
2409
- if(xhr.status == 200) {
2545
+ if (xhr.status == 200) {
2410
2546
  const jsonRespose = JSON.parse(xhr.responseText);
2411
2547
  console.log('publish response', jsonRespose)
2412
2548
  // this.configjson = JSON.stringify(jsonRespose.schema);
@@ -2416,7 +2552,7 @@ export class SfIReporting extends LitElement {
2416
2552
  this.setSuccess("Calendar will be updated in a while.")
2417
2553
  setTimeout(() => {
2418
2554
  this.clearMessages();
2419
- },3000)
2555
+ }, 3000)
2420
2556
  } else {
2421
2557
  const jsonRespose = JSON.parse(xhr.responseText);
2422
2558
  this.setError(jsonRespose.error);
@@ -2425,20 +2561,20 @@ export class SfIReporting extends LitElement {
2425
2561
 
2426
2562
  initDecryptView = () => {
2427
2563
  let divsArr = this._SfDecryptContainer.querySelectorAll("#decrypt-container > div")
2428
- console.log('decrypt divs',divsArr);
2429
- for(let divElement of divsArr){
2564
+ console.log('decrypt divs', divsArr);
2565
+ for (let divElement of divsArr) {
2430
2566
  (divElement as HTMLElement).classList.remove('hide');
2431
2567
  }
2432
2568
  this.initDecryptListeners()
2433
2569
  }
2434
2570
 
2435
2571
  initDecryptListeners = () => {
2436
- (this._SfDecryptProjectInput as SfIForm).addEventListener('valueChanged',() => {
2572
+ (this._SfDecryptProjectInput as SfIForm).addEventListener('valueChanged', () => {
2437
2573
  let projectId = (this._SfDecryptProjectInput as SfIForm).selectedValues()[0]
2438
2574
  this.decryptProjectId = projectId.split(';')[projectId.split(';').length - 1];
2439
2575
  this.evalDecrypt()
2440
2576
  });
2441
- (this._SfDecryptFileInput as HTMLInputElement).addEventListener('keyup',() => {
2577
+ (this._SfDecryptFileInput as HTMLInputElement).addEventListener('keyup', () => {
2442
2578
  console.log('keyup called');
2443
2579
  this.decryptFileName = (this._SfDecryptFileInput as HTMLInputElement).value;
2444
2580
  this.evalDecrypt()
@@ -2453,9 +2589,9 @@ export class SfIReporting extends LitElement {
2453
2589
  evalDecrypt = () => {
2454
2590
  console.log((this._SfDecryptFileInput as HTMLInputElement))
2455
2591
  console.log('evalDecrypt', this.decryptProjectId, this.decryptFileName)
2456
- if(this.decryptProjectId != null && this.decryptProjectId != "" && this.decryptFileName != null && this.decryptFileName.length > 3){
2592
+ if (this.decryptProjectId != null && this.decryptProjectId != "" && this.decryptFileName != null && this.decryptFileName.length > 3) {
2457
2593
  (this._SfDecryptContainer?.querySelector('#button-decrypt') as HTMLButtonElement).removeAttribute('disabled');
2458
- }else{
2594
+ } else {
2459
2595
  (this._SfDecryptContainer?.querySelector('#button-decrypt') as HTMLButtonElement).setAttribute('disabled', 'true');
2460
2596
  }
2461
2597
  }
@@ -2467,18 +2603,18 @@ export class SfIReporting extends LitElement {
2467
2603
  console.log('submitDecrypt called');
2468
2604
 
2469
2605
  const body: any = {};
2470
- let url = "https://"+this.apiId+"/getdecryptedjson";
2606
+ let url = "https://" + this.apiId + "/getdecryptedjson";
2471
2607
 
2472
- body["projectid"] = this.decryptProjectId;
2473
- body["key"] = this.decryptFileName + ".json";
2608
+ body["projectid"] = this.decryptProjectId;
2609
+ body["key"] = this.decryptFileName + ".json";
2474
2610
 
2475
2611
  console.log(body);
2476
2612
  console.log(JSON.stringify(body));
2477
2613
 
2478
2614
  const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
2479
- const xhr : any = (await this.prepareXhr(body, url, this._SfLoader, authorization)) as any;
2615
+ const xhr: any = (await this.prepareXhr(body, url, this._SfLoader, authorization)) as any;
2480
2616
  this._SfLoader.innerHTML = '';
2481
- if(xhr.status == 200) {
2617
+ if (xhr.status == 200) {
2482
2618
  const jsonRespose = JSON.parse(xhr.responseText);
2483
2619
  let data = await this.fetchPresignedUrl(jsonRespose.signedUrlGet);
2484
2620
  await this.fetchPresignedUrlDelete(jsonRespose.signedUrlDelete)
@@ -2490,12 +2626,12 @@ export class SfIReporting extends LitElement {
2490
2626
  a.download = this.decryptFileName + ".json";
2491
2627
  document.body.appendChild(a);
2492
2628
  a.click();
2493
- document.body.removeChild(a);
2629
+ document.body.removeChild(a);
2494
2630
 
2495
2631
  setTimeout(() => {
2496
2632
  this.clearMessages();
2497
2633
  }, 2000);
2498
-
2634
+
2499
2635
  } else {
2500
2636
  const jsonRespose = JSON.parse(xhr.responseText);
2501
2637
  this.setError(jsonRespose.error);
@@ -2507,7 +2643,7 @@ export class SfIReporting extends LitElement {
2507
2643
  }
2508
2644
 
2509
2645
  showLoader = async () => {
2510
- if(this._SfIReportingCCopy != null){
2646
+ if (this._SfIReportingCCopy != null) {
2511
2647
  let loaderContainer = this._SfIReportingCCopy as HTMLDivElement
2512
2648
  loaderContainer.style.backgroundColor = "#efefef"
2513
2649
  loaderContainer.style.display = 'flex'
@@ -2516,7 +2652,7 @@ export class SfIReporting extends LitElement {
2516
2652
  }
2517
2653
 
2518
2654
  hideLoader = async () => {
2519
- if(this._SfIReportingCCopy != null){
2655
+ if (this._SfIReportingCCopy != null) {
2520
2656
  let loaderContainer = this._SfIReportingCCopy as HTMLDivElement
2521
2657
  loaderContainer.style.display = 'none'
2522
2658
  console.log('hiding loader', loaderContainer.style.display)
@@ -2528,13 +2664,13 @@ export class SfIReporting extends LitElement {
2528
2664
  this.loadMode();
2529
2665
 
2530
2666
  }
2531
-
2667
+
2532
2668
  override connectedCallback() {
2533
2669
  super.connectedCallback()
2534
2670
  }
2535
-
2671
+
2536
2672
  override render() {
2537
- if(this.mode == "downloader"){
2673
+ if (this.mode == "downloader") {
2538
2674
  return html`
2539
2675
  <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
2540
2676
  <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@48,400,0,0" />
@@ -2583,7 +2719,7 @@ export class SfIReporting extends LitElement {
2583
2719
  </div>
2584
2720
  `
2585
2721
  }
2586
- if(this.mode == "admin" && this.flow == "new"){
2722
+ if (this.mode == "admin" && this.flow == "new") {
2587
2723
  return html`
2588
2724
  <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
2589
2725
  <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@48,400,0,0" />
@@ -2610,7 +2746,7 @@ export class SfIReporting extends LitElement {
2610
2746
  </div>
2611
2747
  </div>
2612
2748
  `
2613
- }else if(this.mode == "admin" && this.flow == "details"){
2749
+ } else if (this.mode == "admin" && this.flow == "details") {
2614
2750
  return html`
2615
2751
  <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
2616
2752
  <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@48,400,0,0" />
@@ -2637,7 +2773,7 @@ export class SfIReporting extends LitElement {
2637
2773
  </div>
2638
2774
  </div>
2639
2775
  `
2640
- }else if(this.mode == "admin" && this.flow == "edit"){
2776
+ } else if (this.mode == "admin" && this.flow == "edit") {
2641
2777
  return html`
2642
2778
  <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
2643
2779
  <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@48,400,0,0" />
@@ -2664,7 +2800,7 @@ export class SfIReporting extends LitElement {
2664
2800
  </div>
2665
2801
  </div>
2666
2802
  `
2667
- }else if(this.mode == "admin" && this.flow == "list"){
2803
+ } else if (this.mode == "admin" && this.flow == "list") {
2668
2804
  return html`
2669
2805
  <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
2670
2806
  <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@48,400,0..1,0" />