sf-i-reporting 1.0.76 → 1.0.78
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.
- package/dev/index.html +2 -2
- package/package.json +1 -1
- package/sf-i-reporting.d.ts +3 -2
- package/sf-i-reporting.d.ts.map +1 -1
- package/sf-i-reporting.js +192 -58
- package/sf-i-reporting.js.map +1 -1
- package/src/sf-i-reporting.ts +204 -62
package/dev/index.html
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
import {LitElement, html, css} from 'https://esm.run/lit-element/lit-element.js';
|
|
19
19
|
import {SfIElasticText} from 'https://esm.run/sf-i-elastic-text@1.0.17/sf-i-elastic-text.js';
|
|
20
20
|
import {SfIForm} from 'https://esm.run/sf-i-form@1.0.183/sf-i-form.js';
|
|
21
|
-
import {SfIBricks} from 'https://esm.run/sf-i-bricks@1.0.
|
|
21
|
+
import {SfIBricks} from 'https://esm.run/sf-i-bricks@1.0.11/sf-i-bricks.js';
|
|
22
22
|
import {SfIUploader} from 'https://esm.run/sf-i-uploader@1.0.103/sf-i-uploader.js';
|
|
23
23
|
import {SfISelect} from 'https://esm.run/sf-i-select@1.0.93/sf-i-select.js';
|
|
24
24
|
import {SfChecklist} from 'https://esm.run/sf-checklist@1.0.7/dist/sf-checklist.js';
|
|
@@ -335,7 +335,7 @@
|
|
|
335
335
|
</div>
|
|
336
336
|
</sf-i-reporting> -->
|
|
337
337
|
<!-- <div class="mb-20"></div>
|
|
338
|
-
<sf-i-reporting apiid="
|
|
338
|
+
<sf-i-reporting apiid="on26pnwtkfoifejudm5bcez4my0zasvq.lambda-url.us-east-1.on.aws" mode="downloader" name="Downloader">
|
|
339
339
|
</sf-i-reporting>
|
|
340
340
|
<div class="mb-20"></div> -->
|
|
341
341
|
|
package/package.json
CHANGED
package/sf-i-reporting.d.ts
CHANGED
|
@@ -95,7 +95,7 @@ export declare class SfIReporting extends LitElement {
|
|
|
95
95
|
populateDataModel: () => void;
|
|
96
96
|
populateView: (scrollTopTarget?: number) => Promise<void>;
|
|
97
97
|
populateHistory: () => void;
|
|
98
|
-
prepopulateValues: () => void;
|
|
98
|
+
prepopulateValues: (showView?: boolean) => void;
|
|
99
99
|
evalShowProgress: () => void;
|
|
100
100
|
evalTimeout: any;
|
|
101
101
|
initInputListeners: () => void;
|
|
@@ -108,6 +108,7 @@ export declare class SfIReporting extends LitElement {
|
|
|
108
108
|
renderElement: (dataObj: DataObject) => string;
|
|
109
109
|
populateViewShort: () => void;
|
|
110
110
|
populateList: () => void;
|
|
111
|
+
csvToJson: (file: File) => Promise<any>;
|
|
111
112
|
loadMode: () => Promise<void>;
|
|
112
113
|
prepareXhrPresignedGet: (url: string, loaderElement: any, loaderText?: string) => Promise<unknown>;
|
|
113
114
|
prepareXhrPresignedDelete: (url: string, loaderElement: any, loaderText?: string) => Promise<unknown>;
|
|
@@ -121,7 +122,7 @@ export declare class SfIReporting extends LitElement {
|
|
|
121
122
|
fetchSchema: () => Promise<void>;
|
|
122
123
|
fetchList: () => Promise<void>;
|
|
123
124
|
fetchDetails: () => Promise<void>;
|
|
124
|
-
submitNew: () => Promise<void>;
|
|
125
|
+
submitNew: (obj?: any) => Promise<void>;
|
|
125
126
|
submitEdit: () => Promise<void>;
|
|
126
127
|
submitDelete: () => Promise<void>;
|
|
127
128
|
submitPublish: () => Promise<void>;
|
package/sf-i-reporting.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sf-i-reporting.d.ts","sourceRoot":"","sources":["src/sf-i-reporting.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAa,gBAAgB,EAAE,MAAM,KAAK,CAAC;AAO9D,OAAO,EAAE,UAAU,EAAE,eAAe,EAA8D,MAAM,eAAe,CAAC;AAcxH;;;;;;;;;;GAUG;AACH,qBACa,YAAa,SAAQ,UAAU;IAE1C,KAAK,EAAE,MAAM,CAAM;IAGnB,aAAa,EAAE,MA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C,kBAAkB,EAAE,gBAAgB,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,WAAW,EAAE,OAAO,CAAC,GAAG,IAAI;IAMnG,iBAAiB;IAIjB,MAAM;CAyKhB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,gBAAgB,EAAE,YAAY,CAAC;KAChC;CACF"}
|
package/sf-i-reporting.js
CHANGED
|
@@ -49,7 +49,6 @@ let SfIReporting = class SfIReporting extends LitElement {
|
|
|
49
49
|
// 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\"}]";
|
|
50
50
|
this.configjson = "[{\"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\"}]";
|
|
51
51
|
this.getConfigJson = () => {
|
|
52
|
-
console.log('configjson', this.configjson);
|
|
53
52
|
return JSON.parse(this.configjson);
|
|
54
53
|
};
|
|
55
54
|
this.prepopulateValJson = "[]";
|
|
@@ -436,9 +435,13 @@ let SfIReporting = class SfIReporting extends LitElement {
|
|
|
436
435
|
` : (this.flow == "details" ? `
|
|
437
436
|
<span class="mrl-5" part="span-icon${this.published ? '-light' : ''}" id="span-submit-publish">${this.published ? 'Published' : 'Unpublished'}</span>
|
|
438
437
|
<button id="button-edit" part="button-icon" class="mrl-5 material-icons button-icon-click">edit</button>
|
|
439
|
-
<button
|
|
438
|
+
<button part="button-icon" class="mrl-5 material-symbols-outlined button-icon-click button-reopen hide" id="button-reopen">reopen_window</button>
|
|
439
|
+
<button id="button-delete" part="button-icon" class="mrl-5 material-icons button-icon-click hide">delete</button>
|
|
440
440
|
<button id="button-delete-cancel" part="button-icon-light" class="mrl-5 material-icons button-icon-click hide">close</button>
|
|
441
441
|
<button id="button-delete-confirm" part="button-icon" class="mrl-5 button-icon-click hide"><span class="material-icons">delete</span><span class="material-icons">done</span></button>
|
|
442
|
+
<button part="button-icon" class="mrl-5 material-symbols-outlined button-icon-click button-more" id="button-more">more_vert</button>
|
|
443
|
+
<button part="button-icon" class="mrl-5 material-symbols-outlined button-icon-click hide" id="button-more-close">close</button>
|
|
444
|
+
|
|
442
445
|
` : `
|
|
443
446
|
<button class="mrl-5" part="button-icon${this.published ? '-light' : ''}" id="button-submit-publish">${this.published ? 'Unpublish' : 'Publish'}</button>
|
|
444
447
|
<button id="button-edit-cancel" part="button-icon-light" class="mrl-5 material-icons button-icon-click">edit_off</button>
|
|
@@ -528,7 +531,7 @@ let SfIReporting = class SfIReporting extends LitElement {
|
|
|
528
531
|
this._SfReportingButtonSubmitCancel.style.display = 'none';
|
|
529
532
|
}
|
|
530
533
|
}
|
|
531
|
-
for (let element of this.dataModel) {
|
|
534
|
+
for (let [i, element] of this.dataModel.entries()) {
|
|
532
535
|
if (element.type == "sf-i-form") {
|
|
533
536
|
let form = this._SfReportingContainer.querySelector('#' + element.id);
|
|
534
537
|
if (this.mode == "view" || this.flow == "details") {
|
|
@@ -551,11 +554,20 @@ let SfIReporting = class SfIReporting extends LitElement {
|
|
|
551
554
|
}
|
|
552
555
|
}
|
|
553
556
|
let values = this.getBricksValues(element, selectedDependedValues);
|
|
554
|
-
console.log('bricks selecteddependantvalues', element.id, selectedDependedValues, values[1]);
|
|
557
|
+
console.log('bricks selecteddependantvalues', element.id, element.value, selectedDependedValues, values[0], values[1]);
|
|
555
558
|
bricks.namesjson = JSON.stringify(values[0]);
|
|
556
559
|
bricks.idsjson = JSON.stringify(values[1]);
|
|
557
560
|
if (element.value != '') {
|
|
558
|
-
|
|
561
|
+
let arr = [];
|
|
562
|
+
for (let tempVal of element.value) {
|
|
563
|
+
console.log('bricks selecteddependantvalues tempVal', tempVal, values[0].indexOf(tempVal.split(';')[0]), values[1][(values[1].indexOf(tempVal.split(';')[0]))]);
|
|
564
|
+
if (values[1][(values[0].indexOf(tempVal.split(';')[0]))] == tempVal.split(';')[1]) {
|
|
565
|
+
arr.push(tempVal);
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
console.log('bricks selecteddependantvalues value', arr, element.value, element.id);
|
|
569
|
+
bricks.prepopulateValJson = JSON.stringify(arr);
|
|
570
|
+
this.dataModel[i].value = arr;
|
|
559
571
|
}
|
|
560
572
|
else {
|
|
561
573
|
bricks.prepopulateValJson = JSON.stringify([]);
|
|
@@ -676,7 +688,7 @@ let SfIReporting = class SfIReporting extends LitElement {
|
|
|
676
688
|
await customElements.whenDefined('sf-checklist');
|
|
677
689
|
let checklist = this._SfReportingContainer.querySelector('#' + element.id);
|
|
678
690
|
checklist.listelements = JSON.parse(element.elementsjson);
|
|
679
|
-
checklist.listselection = element.value;
|
|
691
|
+
checklist.listselection = element.value != '' ? element.value : {};
|
|
680
692
|
checklist.readonly = (this.mode == "view" || this.flow == "details");
|
|
681
693
|
console.log('sf-checklist', checklist, checklist.listelements, checklist.listselection, element.value);
|
|
682
694
|
setTimeout(() => {
|
|
@@ -736,6 +748,71 @@ let SfIReporting = class SfIReporting extends LitElement {
|
|
|
736
748
|
});
|
|
737
749
|
let buttonEdit = this._SfReportingContainer.querySelector('#button-edit');
|
|
738
750
|
buttonEdit === null || buttonEdit === void 0 ? void 0 : buttonEdit.addEventListener('click', this.editClick);
|
|
751
|
+
let buttonMore = this._SfReportingContainer.querySelector('#button-more');
|
|
752
|
+
buttonMore === null || buttonMore === void 0 ? void 0 : buttonMore.addEventListener('click', () => {
|
|
753
|
+
buttonMore.style.display = 'none';
|
|
754
|
+
let buttonReopen = this._SfReportingContainer.querySelector('#button-reopen');
|
|
755
|
+
if (buttonReopen != null) {
|
|
756
|
+
buttonReopen.style.display = 'block';
|
|
757
|
+
buttonReopen.addEventListener('click', async () => {
|
|
758
|
+
var _a;
|
|
759
|
+
this.reopenedItem = this.getPrepopulateJson();
|
|
760
|
+
let oldObj = this.reopenedItem;
|
|
761
|
+
this.showLoader();
|
|
762
|
+
console.log('item selected', this.reopenedItem);
|
|
763
|
+
await this.fetchSchema();
|
|
764
|
+
this.published = (_a = this.published) !== null && _a !== void 0 ? _a : false;
|
|
765
|
+
let copyVals = {};
|
|
766
|
+
for (let obj of this.dataModel) {
|
|
767
|
+
if (obj.copytoreopen) {
|
|
768
|
+
console.log('copyVals copying', obj.id, obj.type, oldObj[obj.id]);
|
|
769
|
+
if (obj.type == "sf-i-bricks" && obj.savenameseparate == "yes") {
|
|
770
|
+
copyVals[obj.id + 'id'] = oldObj[obj.id + 'id'];
|
|
771
|
+
copyVals[obj.id + 'name'] = oldObj[obj.id + 'name'];
|
|
772
|
+
}
|
|
773
|
+
else {
|
|
774
|
+
copyVals[obj.id] = oldObj[obj.id];
|
|
775
|
+
}
|
|
776
|
+
console.log('copyVals copied', copyVals);
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
console.log('copyVals', JSON.parse(JSON.stringify(copyVals)));
|
|
780
|
+
this.prepopulateValJson = JSON.stringify(copyVals);
|
|
781
|
+
this.flow = "edit";
|
|
782
|
+
this.loadMode();
|
|
783
|
+
});
|
|
784
|
+
}
|
|
785
|
+
let buttonDelete = this._SfReportingContainer.querySelector('#button-delete');
|
|
786
|
+
if (buttonDelete != null) {
|
|
787
|
+
buttonDelete.style.display = 'block';
|
|
788
|
+
buttonDelete === null || buttonDelete === void 0 ? void 0 : buttonDelete.addEventListener('click', this.deleteClick);
|
|
789
|
+
}
|
|
790
|
+
let buttonMoreClose = this._SfReportingContainer.querySelector('#button-more-close');
|
|
791
|
+
buttonMoreClose.style.display = 'block';
|
|
792
|
+
buttonMoreClose === null || buttonMoreClose === void 0 ? void 0 : buttonMoreClose.addEventListener('click', () => {
|
|
793
|
+
let buttonMore = this._SfReportingContainer.querySelector('#button-more');
|
|
794
|
+
if (buttonMore != null) {
|
|
795
|
+
buttonMore.style.display = 'block';
|
|
796
|
+
}
|
|
797
|
+
buttonMoreClose.style.display = 'none';
|
|
798
|
+
let buttonReopen = this._SfReportingContainer.querySelector('#button-reopen');
|
|
799
|
+
if (buttonReopen != null) {
|
|
800
|
+
buttonReopen.style.display = 'none';
|
|
801
|
+
}
|
|
802
|
+
let buttonDelete = this._SfReportingContainer.querySelector('#button-delete');
|
|
803
|
+
if (buttonDelete != null) {
|
|
804
|
+
buttonDelete.style.display = 'none';
|
|
805
|
+
}
|
|
806
|
+
let buttonDeleteCancel = this._SfReportingContainer.querySelector('#button-delete-cancel');
|
|
807
|
+
if (buttonDeleteCancel != null) {
|
|
808
|
+
buttonDeleteCancel.style.display = 'none';
|
|
809
|
+
}
|
|
810
|
+
let buttonDeleteConfirm = this._SfReportingContainer.querySelector('#button-delete-confirm');
|
|
811
|
+
if (buttonDeleteConfirm != null) {
|
|
812
|
+
buttonDeleteConfirm.style.display = 'none';
|
|
813
|
+
}
|
|
814
|
+
});
|
|
815
|
+
});
|
|
739
816
|
let buttonDelete = this._SfReportingContainer.querySelector('#button-delete');
|
|
740
817
|
buttonDelete === null || buttonDelete === void 0 ? void 0 : buttonDelete.addEventListener('click', this.deleteClick);
|
|
741
818
|
let buttonDeleteCancel = this._SfReportingContainer.querySelector('#button-delete-cancel');
|
|
@@ -887,8 +964,8 @@ let SfIReporting = class SfIReporting extends LitElement {
|
|
|
887
964
|
}
|
|
888
965
|
}
|
|
889
966
|
};
|
|
890
|
-
this.prepopulateValues = () => {
|
|
891
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
967
|
+
this.prepopulateValues = (showView = true) => {
|
|
968
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
892
969
|
console.log('prepopulating', this.getPrepopulateJson());
|
|
893
970
|
for (let [i, element] of this.dataModel.entries()) {
|
|
894
971
|
if (isAddButtonObject(element)) {
|
|
@@ -955,7 +1032,7 @@ let SfIReporting = class SfIReporting extends LitElement {
|
|
|
955
1032
|
}
|
|
956
1033
|
}
|
|
957
1034
|
else if (element.type == "sf-checklist") {
|
|
958
|
-
this.dataModel[i].value = this.getPrepopulateJson()[element.id];
|
|
1035
|
+
this.dataModel[i].value = (_h = this.getPrepopulateJson()[element.id]) !== null && _h !== void 0 ? _h : {};
|
|
959
1036
|
}
|
|
960
1037
|
else if (element.type == "sf-i-select") {
|
|
961
1038
|
this.dataModel[i].value = [this.getPrepopulateJson()[element.id + 'name'] + ';' + this.getPrepopulateJson()[element.id + 'id']];
|
|
@@ -967,13 +1044,15 @@ let SfIReporting = class SfIReporting extends LitElement {
|
|
|
967
1044
|
}
|
|
968
1045
|
}
|
|
969
1046
|
}
|
|
970
|
-
if (
|
|
971
|
-
|
|
1047
|
+
if (showView) {
|
|
1048
|
+
if (this.evalTimeout != null) {
|
|
1049
|
+
clearTimeout(this.evalTimeout);
|
|
1050
|
+
}
|
|
1051
|
+
this.evalTimeout = setTimeout(() => {
|
|
1052
|
+
this.evalShowProgress();
|
|
1053
|
+
}, 2000);
|
|
1054
|
+
this.populateView();
|
|
972
1055
|
}
|
|
973
|
-
this.evalTimeout = setTimeout(() => {
|
|
974
|
-
this.evalShowProgress();
|
|
975
|
-
}, 2000);
|
|
976
|
-
this.populateView();
|
|
977
1056
|
};
|
|
978
1057
|
this.evalShowProgress = () => {
|
|
979
1058
|
let total = 0;
|
|
@@ -1032,9 +1111,12 @@ let SfIReporting = class SfIReporting extends LitElement {
|
|
|
1032
1111
|
}
|
|
1033
1112
|
else if (element.type == "sf-i-form") {
|
|
1034
1113
|
console.log('evalshowprogress sf-i-form value', element.value, element.value.length, element.mandatory, element.mandatory != null);
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1114
|
+
let form = this._SfReportingContainer.querySelector('#' + element.id);
|
|
1115
|
+
if (form != null && form.selectedValues().length > 0) {
|
|
1116
|
+
if (element.value.length > 0) {
|
|
1117
|
+
filled++;
|
|
1118
|
+
sectionChildFilledCount++;
|
|
1119
|
+
}
|
|
1038
1120
|
}
|
|
1039
1121
|
}
|
|
1040
1122
|
else if (element.type == "sf-i-form-select") {
|
|
@@ -1069,14 +1151,13 @@ let SfIReporting = class SfIReporting extends LitElement {
|
|
|
1069
1151
|
}
|
|
1070
1152
|
}
|
|
1071
1153
|
else if (element.type == "sf-i-uploader") {
|
|
1072
|
-
|
|
1073
|
-
if (element.value.length > 0) {
|
|
1154
|
+
if (element.value != null && element.value.length > 0) {
|
|
1074
1155
|
filled++;
|
|
1075
1156
|
sectionChildFilledCount++;
|
|
1076
1157
|
}
|
|
1077
1158
|
}
|
|
1078
1159
|
if (element.mandatory != null && flagEval) {
|
|
1079
|
-
if (element.value == "" || element.value.length < 1) {
|
|
1160
|
+
if (element.value == "" || element.value == null || element.value.length < 1) {
|
|
1080
1161
|
flagEval = false;
|
|
1081
1162
|
}
|
|
1082
1163
|
}
|
|
@@ -1719,6 +1800,8 @@ let SfIReporting = class SfIReporting extends LitElement {
|
|
|
1719
1800
|
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> 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> Next update on \n" + (new Date(parseInt(this.nextCalendarScheduled)).toLocaleDateString('en-IN') + " - " + new Date(parseInt(this.nextCalendarScheduled)).toLocaleTimeString('en-IN'))) + '</div>'}</div>`;
|
|
1720
1801
|
html += `<div class="d-flex justify-end flex-grow">`;
|
|
1721
1802
|
// html += `<button id="button-publish" part="button-icon" class="material-icons hide">campaign</button>`
|
|
1803
|
+
html += `<input class="hide" id="input-import" type="file" accept=".csv" />`;
|
|
1804
|
+
html += `<label id="button-upload" part="button-icon" for="input-import" class="material-icons label-button ml-10">upload</label>`;
|
|
1722
1805
|
html += `<button id="button-new" part="button-icon" class="material-icons button-icon-click ml-10">add</button>`;
|
|
1723
1806
|
html += `</div>`;
|
|
1724
1807
|
html += `</div>`;
|
|
@@ -1727,7 +1810,7 @@ let SfIReporting = class SfIReporting extends LitElement {
|
|
|
1727
1810
|
html += '<tr class="tablerow">';
|
|
1728
1811
|
let bgClass = i % 2 == 0 ? 'td-light' : 'td-dark';
|
|
1729
1812
|
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>`;
|
|
1730
|
-
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
|
|
1813
|
+
// 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>`
|
|
1731
1814
|
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>`;
|
|
1732
1815
|
for (let property of Object.keys(item)) {
|
|
1733
1816
|
if (this.getIgnoreProjections().indexOf(property) < 0) {
|
|
@@ -1744,38 +1827,36 @@ let SfIReporting = class SfIReporting extends LitElement {
|
|
|
1744
1827
|
html += '</table>';
|
|
1745
1828
|
this._SfReportingContainer.innerHTML = html;
|
|
1746
1829
|
this._SfReportingContainer.style.display = 'block';
|
|
1747
|
-
let reopenButtons = this._SfReportingContainer.querySelectorAll('.button-reopen')
|
|
1748
|
-
for (let reopenButton of reopenButtons) {
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
});
|
|
1778
|
-
}
|
|
1830
|
+
// let reopenButtons = (this._SfReportingContainer as HTMLDivElement).querySelectorAll('.button-reopen') as NodeListOf<HTMLButtonElement>
|
|
1831
|
+
// for (let reopenButton of reopenButtons) {
|
|
1832
|
+
// reopenButton.addEventListener('click', async (ev: any) => {
|
|
1833
|
+
// let target = ev.target
|
|
1834
|
+
// let index = target.id.split('-')[2]
|
|
1835
|
+
// this.reopenedItem = this.list[index]
|
|
1836
|
+
// let oldObj = this.reopenedItem
|
|
1837
|
+
// this.showLoader();
|
|
1838
|
+
// console.log('item selected', this.reopenedItem);
|
|
1839
|
+
// await this.fetchSchema();
|
|
1840
|
+
// this.published = this.list[index].published ?? false
|
|
1841
|
+
// let copyVals: any = {}
|
|
1842
|
+
// for (let obj of this.dataModel) {
|
|
1843
|
+
// if (obj.copytoreopen) {
|
|
1844
|
+
// console.log('copyVals copying', obj.id, obj.type, oldObj[obj.id]);
|
|
1845
|
+
// if (obj.type == "sf-i-bricks" && obj.savenameseparate == "yes") {
|
|
1846
|
+
// copyVals[obj.id + 'id'] = oldObj[obj.id + 'id'];
|
|
1847
|
+
// copyVals[obj.id + 'name'] = oldObj[obj.id + 'name'];
|
|
1848
|
+
// } else {
|
|
1849
|
+
// copyVals[obj.id] = oldObj[obj.id];
|
|
1850
|
+
// }
|
|
1851
|
+
// console.log('copyVals copied', copyVals)
|
|
1852
|
+
// }
|
|
1853
|
+
// }
|
|
1854
|
+
// console.log('copyVals', JSON.parse(JSON.stringify(copyVals)))
|
|
1855
|
+
// this.prepopulateValJson = JSON.stringify(copyVals)
|
|
1856
|
+
// this.flow = "edit"
|
|
1857
|
+
// this.loadMode();
|
|
1858
|
+
// })
|
|
1859
|
+
// }
|
|
1779
1860
|
let detailsButtons = this._SfReportingContainer.querySelectorAll('.button-details');
|
|
1780
1861
|
for (let detailsButton of detailsButtons) {
|
|
1781
1862
|
detailsButton.addEventListener('click', (ev) => {
|
|
@@ -1795,10 +1876,58 @@ let SfIReporting = class SfIReporting extends LitElement {
|
|
|
1795
1876
|
this.showLoader();
|
|
1796
1877
|
this.newClick();
|
|
1797
1878
|
});
|
|
1879
|
+
let inputImport = this._SfReportingContainer.querySelector('#input-import');
|
|
1880
|
+
inputImport.addEventListener('change', async (ev) => {
|
|
1881
|
+
let target = ev.target;
|
|
1882
|
+
console.log('file selected', target.files);
|
|
1883
|
+
if (target.files != null && target.files.length > 0) {
|
|
1884
|
+
let file = target.files[0];
|
|
1885
|
+
console.log('file selected', file);
|
|
1886
|
+
this.showLoader();
|
|
1887
|
+
let jsonData = await this.csvToJson(file);
|
|
1888
|
+
console.log('jsonData', jsonData);
|
|
1889
|
+
for (let element of jsonData) {
|
|
1890
|
+
this.published = false;
|
|
1891
|
+
// this.prepopulateValJson = JSON.stringify(element)
|
|
1892
|
+
// this.populateDataModel()
|
|
1893
|
+
// this.prepopulateValues(false)
|
|
1894
|
+
// console.log('dataModel', this.dataModel);
|
|
1895
|
+
await this.submitNew(element);
|
|
1896
|
+
}
|
|
1897
|
+
this.hideLoader();
|
|
1898
|
+
// this.dataModel = jsonData;
|
|
1899
|
+
// this.populateView();
|
|
1900
|
+
}
|
|
1901
|
+
});
|
|
1798
1902
|
let customEvent = new CustomEvent('valueChanged');
|
|
1799
1903
|
this.dispatchEvent(customEvent);
|
|
1800
1904
|
this.hideLoader();
|
|
1801
1905
|
};
|
|
1906
|
+
this.csvToJson = async (file) => {
|
|
1907
|
+
const text = await file.text();
|
|
1908
|
+
const lines = text.split(/\r?\n/).filter(line => line.trim() !== "");
|
|
1909
|
+
const headers = lines[0].split(",");
|
|
1910
|
+
return lines.slice(1).map((line) => {
|
|
1911
|
+
const values = line.split(",");
|
|
1912
|
+
const obj = {};
|
|
1913
|
+
headers.forEach((header, i) => {
|
|
1914
|
+
let value = values[i];
|
|
1915
|
+
// Clean up wrapped quotes ("" to "), and trim outer quotes
|
|
1916
|
+
if ((value === null || value === void 0 ? void 0 : value.startsWith('"')) && (value === null || value === void 0 ? void 0 : value.endsWith('"'))) {
|
|
1917
|
+
value = value.slice(1, -1).replace(/""/g, '"');
|
|
1918
|
+
}
|
|
1919
|
+
// Try to parse array-like fields (if it's valid JSON after cleaning)
|
|
1920
|
+
try {
|
|
1921
|
+
const parsed = JSON.parse(value);
|
|
1922
|
+
obj[header] = parsed;
|
|
1923
|
+
}
|
|
1924
|
+
catch {
|
|
1925
|
+
obj[header] = value;
|
|
1926
|
+
}
|
|
1927
|
+
});
|
|
1928
|
+
return obj;
|
|
1929
|
+
});
|
|
1930
|
+
};
|
|
1802
1931
|
this.loadMode = async () => {
|
|
1803
1932
|
console.log('loadmode', this.mode, this.flow);
|
|
1804
1933
|
if (this.mode == "view") {
|
|
@@ -1983,11 +2112,11 @@ let SfIReporting = class SfIReporting extends LitElement {
|
|
|
1983
2112
|
this.setError(jsonRespose.error);
|
|
1984
2113
|
}
|
|
1985
2114
|
};
|
|
1986
|
-
this.submitNew = async () => {
|
|
1987
|
-
console.log('adding',
|
|
2115
|
+
this.submitNew = async (obj = this.selectedValues()) => {
|
|
2116
|
+
console.log('adding', obj);
|
|
1988
2117
|
let url = "https://" + this.apiId + "/add";
|
|
1989
|
-
let body = { projectid: this.projectid, object:
|
|
1990
|
-
|
|
2118
|
+
let body = { projectid: this.projectid, object: obj, schema: this.getConfigJson(), published: this.published };
|
|
2119
|
+
console.log('adding', body, url);
|
|
1991
2120
|
const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
|
|
1992
2121
|
const xhr = (await this.prepareXhr(body, url, this._SfLoader, authorization));
|
|
1993
2122
|
this._SfLoader.innerHTML = '';
|
|
@@ -2721,6 +2850,11 @@ SfIReporting.styles = css `
|
|
|
2721
2850
|
margin-right: auto;
|
|
2722
2851
|
width: fit-content;
|
|
2723
2852
|
}
|
|
2853
|
+
|
|
2854
|
+
.label-button {
|
|
2855
|
+
padding-inline: 6px;
|
|
2856
|
+
padding-block: 1px;
|
|
2857
|
+
}
|
|
2724
2858
|
`;
|
|
2725
2859
|
__decorate([
|
|
2726
2860
|
property()
|