(self["webpackChunkapp"] = self["webpackChunkapp"] || []).push([["src_app_pages_inpatient-care-treatment_inpatient-care-treatment_module_ts"],{

/***/ 487:
/*!*******************************************************************************************!*\
  !*** ./src/app/pages/inpatient-care-treatment/inpatient-care-treatment-routing.module.ts ***!
  \*******************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   InpatientCareTreatmentPageRoutingModule: () => (/* binding */ InpatientCareTreatmentPageRoutingModule)
/* harmony export */ });
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! tslib */ 24398);
/* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @angular/core */ 37580);
/* harmony import */ var _angular_router__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @angular/router */ 95072);
/* harmony import */ var _inpatient_care_treatment_page__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./inpatient-care-treatment.page */ 64937);




const routes = [{
  path: '',
  component: _inpatient_care_treatment_page__WEBPACK_IMPORTED_MODULE_0__.InpatientCareTreatmentPage
}];
let InpatientCareTreatmentPageRoutingModule = class InpatientCareTreatmentPageRoutingModule {};
InpatientCareTreatmentPageRoutingModule = (0,tslib__WEBPACK_IMPORTED_MODULE_1__.__decorate)([(0,_angular_core__WEBPACK_IMPORTED_MODULE_2__.NgModule)({
  imports: [_angular_router__WEBPACK_IMPORTED_MODULE_3__.RouterModule.forChild(routes)],
  exports: [_angular_router__WEBPACK_IMPORTED_MODULE_3__.RouterModule]
})], InpatientCareTreatmentPageRoutingModule);


/***/ }),

/***/ 60630:
/*!***********************************************************************************!*\
  !*** ./src/app/pages/inpatient-care-treatment/inpatient-care-treatment.module.ts ***!
  \***********************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   InpatientCareTreatmentPageModule: () => (/* binding */ InpatientCareTreatmentPageModule)
/* harmony export */ });
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! tslib */ 24398);
/* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @angular/core */ 37580);
/* harmony import */ var _angular_common__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @angular/common */ 60316);
/* harmony import */ var _angular_forms__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @angular/forms */ 34456);
/* harmony import */ var _ionic_angular__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @ionic/angular */ 21507);
/* harmony import */ var _ngx_formly_core__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @ngx-formly/core */ 10535);
/* harmony import */ var _inpatient_care_treatment_routing_module__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./inpatient-care-treatment-routing.module */ 487);
/* harmony import */ var _inpatient_care_treatment_page__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./inpatient-care-treatment.page */ 64937);
/* harmony import */ var _survey_form_survey_form_module__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../survey-form/survey-form.module */ 87550);








// Import custom formly components from survey-form module

let InpatientCareTreatmentPageModule = class InpatientCareTreatmentPageModule {};
InpatientCareTreatmentPageModule = (0,tslib__WEBPACK_IMPORTED_MODULE_3__.__decorate)([(0,_angular_core__WEBPACK_IMPORTED_MODULE_4__.NgModule)({
  imports: [_angular_common__WEBPACK_IMPORTED_MODULE_5__.CommonModule, _angular_forms__WEBPACK_IMPORTED_MODULE_6__.FormsModule, _ionic_angular__WEBPACK_IMPORTED_MODULE_7__.IonicModule, _inpatient_care_treatment_routing_module__WEBPACK_IMPORTED_MODULE_0__.InpatientCareTreatmentPageRoutingModule, _angular_forms__WEBPACK_IMPORTED_MODULE_6__.ReactiveFormsModule, _ngx_formly_core__WEBPACK_IMPORTED_MODULE_8__.FormlyModule.forRoot({
    types: [{
      name: 'input',
      component: _survey_form_survey_form_module__WEBPACK_IMPORTED_MODULE_2__.FormlyFieldIonicInput
    }, {
      name: 'radio',
      component: _survey_form_survey_form_module__WEBPACK_IMPORTED_MODULE_2__.FormlyFieldIonicRadio
    }, {
      name: 'template',
      component: _survey_form_survey_form_module__WEBPACK_IMPORTED_MODULE_2__.FormlyFieldTemplate
    }, {
      name: 'textarea',
      component: _survey_form_survey_form_module__WEBPACK_IMPORTED_MODULE_2__.FormlyFieldIonicTextarea
    }, {
      name: 'checkbox',
      component: _survey_form_survey_form_module__WEBPACK_IMPORTED_MODULE_2__.FormlyFieldIonicCheckbox
    }, {
      name: 'multicheckbox',
      component: _survey_form_survey_form_module__WEBPACK_IMPORTED_MODULE_2__.FormlyFieldIonicMulticheckbox
    }, {
      name: 'select',
      component: _survey_form_survey_form_module__WEBPACK_IMPORTED_MODULE_2__.FormlyFieldIonicSelect
    }, {
      name: 'repeat',
      component: _survey_form_survey_form_module__WEBPACK_IMPORTED_MODULE_2__.FormlyFieldIonicRepeat
    }]
  })],
  declarations: [_inpatient_care_treatment_page__WEBPACK_IMPORTED_MODULE_1__.InpatientCareTreatmentPage]
})], InpatientCareTreatmentPageModule);


/***/ }),

/***/ 64937:
/*!*********************************************************************************!*\
  !*** ./src/app/pages/inpatient-care-treatment/inpatient-care-treatment.page.ts ***!
  \*********************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   InpatientCareTreatmentPage: () => (/* binding */ InpatientCareTreatmentPage)
/* harmony export */ });
/* harmony import */ var _workdir_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js */ 89204);
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! tslib */ 24398);
/* harmony import */ var _inpatient_care_treatment_page_html_ngResource__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./inpatient-care-treatment.page.html?ngResource */ 14123);
/* harmony import */ var _inpatient_care_treatment_page_scss_ngResource__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./inpatient-care-treatment.page.scss?ngResource */ 34483);
/* harmony import */ var _inpatient_care_treatment_page_scss_ngResource__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_inpatient_care_treatment_page_scss_ngResource__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! @angular/core */ 37580);
/* harmony import */ var _angular_forms__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @angular/forms */ 34456);
/* harmony import */ var _angular_common__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @angular/common */ 60316);
/* harmony import */ var _angular_router__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @angular/router */ 95072);
/* harmony import */ var src_app_services_survey_form_validation_service__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! src/app/services/survey-form-validation.service */ 92091);
/* harmony import */ var src_app_services_survey_form_field_processor_service__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! src/app/services/survey-form-field-processor.service */ 15385);
/* harmony import */ var src_app_services_inpatient_care_treatment_api_service__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! src/app/services/inpatient_care_treatment_api.service */ 62446);
/* harmony import */ var src_app_util_baseHelper__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! src/app/util/baseHelper */ 76434);
/* harmony import */ var _app_constants_icons_constants__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @app/constants/icons.constants */ 35997);

var _InpatientCareTreatmentPage;












let InpatientCareTreatmentPage = (_InpatientCareTreatmentPage = class InpatientCareTreatmentPage {
  constructor(b, location, router, activatedRoute, validationService, fieldProcessorService, api) {
    this.b = b;
    this.location = location;
    this.router = router;
    this.activatedRoute = activatedRoute;
    this.validationService = validationService;
    this.fieldProcessorService = fieldProcessorService;
    this.api = api;
    this.form = new _angular_forms__WEBPACK_IMPORTED_MODULE_8__.FormGroup({});
    this.model = {};
    this.fields = [];
    this.schema = []; // Form schema from backend
    this.title = 'Inpatient Care Treatment Form';
    this.formDescription = '';
    this.showValidationErrors = false;
    this.prefillData = {};
    this.status = 'admitted'; // Default status
    this.edit_mode = false;
    this.icons = _app_constants_icons_constants__WEBPACK_IMPORTED_MODULE_7__.ICONS;
  }
  ngOnInit() {
    this.initializeFromNavigation();
    this.id = this.activatedRoute.snapshot.paramMap.get('id');
    this.load();
  }
  /**
   * Initialize component state from navigation parameters
   */
  initializeFromNavigation() {
    var _nav$extras, _nav$extras2, _nav$extras3, _nav$extras4, _nav$extras5;
    const nav = this.router.getCurrentNavigation();
    this.beneficiary_id = (nav === null || nav === void 0 || (_nav$extras = nav.extras) === null || _nav$extras === void 0 || (_nav$extras = _nav$extras.state) === null || _nav$extras === void 0 ? void 0 : _nav$extras['beneficiary_id']) || null;
    this.from_inf_id = (nav === null || nav === void 0 || (_nav$extras2 = nav.extras) === null || _nav$extras2 === void 0 || (_nav$extras2 = _nav$extras2.state) === null || _nav$extras2 === void 0 ? void 0 : _nav$extras2['from_inf_id']) || null;
    this.action_inf_id = (nav === null || nav === void 0 || (_nav$extras3 = nav.extras) === null || _nav$extras3 === void 0 || (_nav$extras3 = _nav$extras3.state) === null || _nav$extras3 === void 0 ? void 0 : _nav$extras3['action_inf_id']) || null;
    this.status = (nav === null || nav === void 0 || (_nav$extras4 = nav.extras) === null || _nav$extras4 === void 0 || (_nav$extras4 = _nav$extras4.state) === null || _nav$extras4 === void 0 ? void 0 : _nav$extras4['status']) || 'admitted';
    this.edit_mode = (nav === null || nav === void 0 || (_nav$extras5 = nav.extras) === null || _nav$extras5 === void 0 || (_nav$extras5 = _nav$extras5.state) === null || _nav$extras5 === void 0 ? void 0 : _nav$extras5['edit_mode']) || false;
  }
  /**
   * Load form schema and initialize model
   */
  load() {
    var _this = this;
    return (0,_workdir_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_0__["default"])(function* () {
      try {
        if (_this.edit_mode && _this.id) {
          yield _this.loadEditModeData();
        } else {
          yield _this.loadFormSchemaAndPrefill();
        }
        // Process form schema
        _this.processFormSchema();
      } catch (error) {
        _this.b.errorToast('Failed to load form');
      }
    })();
  }
  /**
   * Load form schema and prefill data from backend
   * Gets schema from SurveyForm with type='inpatient-care-treatment'
   * Gets prefill data based on authenticated user's default SC INF
   */
  loadFormSchemaAndPrefill() {
    var _this2 = this;
    return (0,_workdir_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_0__["default"])(function* () {
      try {
        const response = yield _this2.api.getFormSchemaAndPrefill();
        if (response.data) {
          var _response$data$prefil;
          // Load schema from backend
          _this2.schema = response.data.schema || [];
          _this2.title = response.data.title || 'Inpatient Care Treatment';
          _this2.formDescription = response.data.description || '';
          _this2.prefillData = response.data.prefillData || {};
          // Store action_inf_id for submission (current SC facility)
          _this2.action_inf_id = (_response$data$prefil = response.data.prefillData) === null || _response$data$prefil === void 0 ? void 0 : _response$data$prefil.action_inf_id;
        }
      } catch (error) {
        yield _this2.b.errorToast('Failed to load inpatient care treatment form');
        _this2.model = {
          admission_date: new Date().toISOString().split('T')[0]
        };
      }
    })();
  }
  /**
   * Load existing treatment data for edit mode
   */
  loadEditModeData() {
    var _this3 = this;
    return (0,_workdir_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_0__["default"])(function* () {
      try {
        // First load the schema
        const schemaResponse = yield _this3.api.getFormSchemaAndPrefill();
        if (schemaResponse.data) {
          _this3.schema = schemaResponse.data.schema || [];
          _this3.title = schemaResponse.data.title || 'Inpatient Care Treatment';
          _this3.formDescription = schemaResponse.data.description || '';
        }
        // Then load the existing treatment data
        const response = yield _this3.api.getTreatment(_this3.id);
        if (response.data) {
          _this3.model = response.data.sc_response || {};
          _this3.beneficiary_id = response.data.beneficiary_id;
          _this3.from_inf_id = response.data.from_inf_id;
          _this3.action_inf_id = response.data.action_inf_id;
          _this3.status = response.data.status;
        }
      } catch (error) {
        _this3.b.errorToast('Failed to load treatment data');
      }
    })();
  }
  /**
   * Process form schema
   */
  processFormSchema() {
    // Get auth headers for API calls
    const authHeaders = this.api.headers;
    // Process fields using the field processor service (same as survey-form)
    this.fields = this.fieldProcessorService.processFields(this.schema, null,
    // assessmentMode
    this.edit_mode, this.model, this.prefillData, false,
    // offlineMode
    authHeaders);
    // Apply prefill data to model
    if (this.prefillData && Object.keys(this.prefillData).length > 0) {
      this.model = {
        ...this.model,
        ...this.prefillData
      };
    }
  }
  /**
   * Submit form
   */
  submit() {
    var _this4 = this;
    return (0,_workdir_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_0__["default"])(function* () {
      // Validate form (same validation as survey-form)
      const isFormValid = _this4.form.valid && _this4.validationService.validateRepeatFields(_this4.fields, _this4.model);
      if (isFormValid) {
        _this4.showValidationErrors = false;
        // Save to backend
        yield _this4.submitFormData();
      } else {
        _this4.showValidationErrors = true;
        _this4.validationService.markAllFieldsAsTouched(_this4.form);
        _this4.scrollToValidationCard();
        _this4.b.errorToast('Please fill in all required fields');
      }
    })();
  }
  /**
   * Submit form data to backend
   */
  submitFormData() {
    var _this5 = this;
    return (0,_workdir_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_0__["default"])(function* () {
      const body = {
        sc_response: _this5.model
      };
      // Include optional fields if provided
      if (_this5.beneficiary_id) {
        body.beneficiary_id = _this5.beneficiary_id;
      }
      if (_this5.from_inf_id) {
        body.from_inf_id = _this5.from_inf_id;
      }
      if (_this5.status) {
        body.status = _this5.status;
      }
      if (_this5.edit_mode && _this5.id) {
        // Update existing treatment
        const result = yield _this5.api.updateTreatment(_this5.id, body);
        yield _this5.b.responseToast(result);
        if (result.success) {
          _this5.navigateBack();
        }
      } else {
        // Create new treatment
        const result = yield _this5.api.storeTreatment(body);
        yield _this5.b.responseToast(result);
        if (result.success) {
          _this5.navigateBack();
        }
      }
    })();
  }
  /**
   * Navigate back
   */
  navigateBack() {
    this.location.back();
  }
  /**
   * Scroll to validation card
   */
  scrollToValidationCard() {
    setTimeout(() => {
      const validationCard = document.querySelector('.validation-card');
      if (validationCard) {
        validationCard.scrollIntoView({
          behavior: 'smooth',
          block: 'center'
        });
      }
    }, 100);
  }
  /**
   * Get invalid fields with keys (for template)
   */
  getInvalidFieldsWithKeys() {
    return this.validationService.getInvalidFieldsWithKeys(this.form, this.fields, this.model);
  }
  /**
   * Track by function for ngFor
   */
  trackByField(index, item) {
    return item.key;
  }
  /**
   * Scroll to specific field (supports repeat fields)
   */
  scrollToField(fieldKey) {
    let fieldElement = null;
    // Check if this is a repeat field key (format: fieldKey[index].subFieldKey)
    const repeatFieldMatch = fieldKey.match(/^(.+?)\[(\d+)\]\.(.+)$/);
    if (repeatFieldMatch) {
      const [, repeatKey, indexStr, subFieldKey] = repeatFieldMatch;
      const index = parseInt(indexStr, 10);
      // Try to find the repeat section first
      const repeatSelectors = [`formly-field[data-key="${repeatKey}"]`, `[data-field-key="${repeatKey}"]`, `.formly-field-repeat[data-key="${repeatKey}"]`];
      for (const selector of repeatSelectors) {
        const repeatElement = document.querySelector(selector);
        if (repeatElement) {
          // Look for the specific repeat item by index
          const repeatItems = repeatElement.querySelectorAll('formly-group, .formly-repeat-section');
          if (repeatItems[index]) {
            // Try to find the subfield within this repeat item
            const subFieldSelectors = [`[formcontrolname="${subFieldKey}"]`, `[ng-reflect-name="${subFieldKey}"]`, `[data-field-key="${subFieldKey}"]`];
            for (const subSelector of subFieldSelectors) {
              fieldElement = repeatItems[index].querySelector(subSelector);
              if (fieldElement) break;
            }
            // If we couldn't find the exact subfield, scroll to the repeat item
            if (!fieldElement) {
              fieldElement = repeatItems[index];
            }
            break;
          }
        }
      }
    } else {
      // Regular field (not a repeat field)
      const selectors = [`[data-field-key="${fieldKey}"]`, `[formcontrolname="${fieldKey}"]`, `[ng-reflect-name="${fieldKey}"]`, `formly-field[data-key="${fieldKey}"]`, `#${fieldKey}`, `.field-${fieldKey}`];
      for (const selector of selectors) {
        fieldElement = document.querySelector(selector);
        if (fieldElement) break;
      }
      if (!fieldElement) {
        var _field$templateOption;
        const field = this.fields.find(f => f.key === fieldKey);
        if (field !== null && field !== void 0 && (_field$templateOption = field.templateOptions) !== null && _field$templateOption !== void 0 && _field$templateOption.label) {
          const labels = document.querySelectorAll('ion-label, label');
          for (let i = 0; i < labels.length; i++) {
            var _label$textContent;
            const label = labels[i];
            if ((_label$textContent = label.textContent) !== null && _label$textContent !== void 0 && _label$textContent.includes(field.templateOptions.label)) {
              fieldElement = label.closest('ion-item, formly-field, .form-field') || label;
              break;
            }
          }
        }
      }
    }
    if (fieldElement) {
      fieldElement.scrollIntoView({
        behavior: 'smooth',
        block: 'center'
      });
      const input = fieldElement.querySelector('input, select, textarea, ion-input, ion-select, ion-textarea');
      if (input && typeof input.setFocus === 'function') {
        setTimeout(() => input.setFocus(), 300);
      }
    } else {}
  }
  /**
   * Validate repeat fields (for template)
   */
  validateRepeatFields() {
    return this.validationService.validateRepeatFields(this.fields, this.model);
  }
  /**
   * Refresh data
   */
  refresh(event) {
    this.load();
    if (event) {
      setTimeout(() => {
        event.target.complete();
      }, 1000);
    }
  }
  /**
   * Reset form
   */
  reset() {
    this.b.loadAlert('Reset Form', 'Are you sure you want to reset the form? All entered data will be lost.', () => {
      this.load();
      this.b.toast('Form reset successfully');
    });
  }
  /**
   * Update status
   * Can be called from template or externally to change treatment status
   */
  updateStatus(newStatus) {
    this.status = newStatus;
  }
}, _InpatientCareTreatmentPage.ctorParameters = () => [{
  type: src_app_util_baseHelper__WEBPACK_IMPORTED_MODULE_6__.BaseHelper
}, {
  type: _angular_common__WEBPACK_IMPORTED_MODULE_9__.Location
}, {
  type: _angular_router__WEBPACK_IMPORTED_MODULE_10__.Router
}, {
  type: _angular_router__WEBPACK_IMPORTED_MODULE_10__.ActivatedRoute
}, {
  type: src_app_services_survey_form_validation_service__WEBPACK_IMPORTED_MODULE_3__.SurveyFormValidationService
}, {
  type: src_app_services_survey_form_field_processor_service__WEBPACK_IMPORTED_MODULE_4__.SurveyFormFieldProcessorService
}, {
  type: src_app_services_inpatient_care_treatment_api_service__WEBPACK_IMPORTED_MODULE_5__.InpatientCareTreatmentAPIService
}], _InpatientCareTreatmentPage);
InpatientCareTreatmentPage = (0,tslib__WEBPACK_IMPORTED_MODULE_11__.__decorate)([(0,_angular_core__WEBPACK_IMPORTED_MODULE_12__.Component)({
  selector: 'app-inpatient-care-treatment',
  template: _inpatient_care_treatment_page_html_ngResource__WEBPACK_IMPORTED_MODULE_1__,
  styles: [(_inpatient_care_treatment_page_scss_ngResource__WEBPACK_IMPORTED_MODULE_2___default())]
})], InpatientCareTreatmentPage);


/***/ }),

/***/ 34483:
/*!**********************************************************************************************!*\
  !*** ./src/app/pages/inpatient-care-treatment/inpatient-care-treatment.page.scss?ngResource ***!
  \**********************************************************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

// Imports
var ___CSS_LOADER_API_SOURCEMAP_IMPORT___ = __webpack_require__(/*! ../../../../node_modules/css-loader/dist/runtime/sourceMaps.js */ 53142);
var ___CSS_LOADER_API_IMPORT___ = __webpack_require__(/*! ../../../../node_modules/css-loader/dist/runtime/api.js */ 35950);
var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_SOURCEMAP_IMPORT___);
// Module
___CSS_LOADER_EXPORT___.push([module.id, `.form-container {
  max-width: 900px;
  margin: 0 auto;
  padding-bottom: 20px;
}

.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
}
.loading-container ion-spinner {
  margin-bottom: 16px;
}
.loading-container p {
  color: var(--ion-color-medium);
  margin: 0;
}

.validation-card {
  margin: 20px 0;
  border-left: 4px solid var(--ion-color-danger);
}
.validation-card ion-card-header {
  background: rgba(var(--ion-color-danger-rgb), 0.05);
}
.validation-card ion-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
}
.validation-card ion-list {
  margin: 16px 0;
  border-radius: 8px;
  overflow: hidden;
}
.validation-card ion-item {
  --border-radius: 0;
  --padding-start: 12px;
  --padding-end: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.validation-card ion-item:hover {
  --background: rgba(var(--ion-color-danger-rgb), 0.08);
}
.validation-card small {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ion-color-medium);
  margin-top: 12px;
}
.validation-card small ion-icon {
  font-size: 14px;
}

:host ::ng-deep .template-content h3 {
  color: var(--ion-color-primary);
  margin-top: 24px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--ion-color-primary);
  font-size: 18px;
  font-weight: 600;
}
:host ::ng-deep .template-content h4 {
  color: var(--ion-color-dark);
  margin-top: 20px;
  margin-bottom: 12px;
  font-size: 16px;
  font-weight: 600;
}
:host ::ng-deep .template-content hr {
  margin: 24px 0;
  border: none;
  border-top: 1px solid var(--ion-color-light);
}
:host ::ng-deep .template-content p {
  margin: 8px 0;
  color: var(--ion-color-medium);
  font-size: 14px;
}
:host ::ng-deep .template-content p strong {
  color: var(--ion-color-dark);
}
:host ::ng-deep formly-field .custom-ion-item.readonly {
  --background: rgba(45, 211, 111, 0.05);
  --border-color: rgba(45, 211, 111, 0.3);
  margin-bottom: 20px;
}
:host ::ng-deep formly-field .custom-ion-item.readonly .custom-label {
  color: var(--ion-color-success) !important;
  font-weight: 600 !important;
}
:host ::ng-deep formly-field .custom-ion-item.readonly .custom-input {
  --color: var(--ion-color-success-shade);
  font-weight: 600;
  font-size: 15px;
}
:host ::ng-deep formly-field[data-key\$=_score] .custom-ion-item {
  --background: rgba(73, 144, 226, 0.08);
  --border-color: rgba(73, 144, 226, 0.4);
  --border-width: 2px;
}
:host ::ng-deep formly-field[data-key\$=_score] .custom-ion-item .custom-label {
  color: var(--ion-color-primary) !important;
  font-weight: 700 !important;
  font-size: 15px !important;
}
:host ::ng-deep formly-field[data-key\$=_score] .custom-ion-item .custom-input {
  --color: var(--ion-color-primary-shade);
  font-weight: 700;
  font-size: 16px;
}
:host ::ng-deep formly-field[data-key=overall_total_score] .custom-ion-item {
  --background: linear-gradient(135deg, rgba(73, 144, 226, 0.15) 0%, rgba(45, 211, 111, 0.15) 100%);
  --border-color: var(--ion-color-primary);
  --border-width: 3px;
  padding: 8px 0;
}
:host ::ng-deep formly-field[data-key=overall_total_score] .custom-ion-item .custom-label {
  color: var(--ion-color-primary) !important;
  font-weight: 800 !important;
  font-size: 17px !important;
}
:host ::ng-deep formly-field[data-key=overall_total_score] .custom-ion-item .custom-input {
  --color: var(--ion-color-primary);
  font-weight: 800;
  font-size: 18px;
}`, "",{"version":3,"sources":["webpack://./src/app/pages/inpatient-care-treatment/inpatient-care-treatment.page.scss"],"names":[],"mappings":"AAAA;EACE,gBAAA;EACA,cAAA;EACA,oBAAA;AACF;;AAEA;EACE,aAAA;EACA,sBAAA;EACA,mBAAA;EACA,uBAAA;EACA,kBAAA;EACA,kBAAA;AACF;AACE;EACE,mBAAA;AACJ;AAEE;EACE,8BAAA;EACA,SAAA;AAAJ;;AAIA;EACE,cAAA;EACA,8CAAA;AADF;AAGE;EACE,mDAAA;AADJ;AAIE;EACE,aAAA;EACA,mBAAA;EACA,QAAA;EACA,eAAA;EACA,gBAAA;AAFJ;AAKE;EACE,cAAA;EACA,kBAAA;EACA,gBAAA;AAHJ;AAME;EACE,kBAAA;EACA,qBAAA;EACA,mBAAA;EACA,eAAA;EACA,yBAAA;AAJJ;AAMI;EACE,qDAAA;AAJN;AAQE;EACE,aAAA;EACA,mBAAA;EACA,QAAA;EACA,8BAAA;EACA,gBAAA;AANJ;AAQI;EACE,eAAA;AANN;;AAcE;EACE,+BAAA;EACA,gBAAA;EACA,mBAAA;EACA,mBAAA;EACA,iDAAA;EACA,eAAA;EACA,gBAAA;AAXJ;AAcE;EACE,4BAAA;EACA,gBAAA;EACA,mBAAA;EACA,eAAA;EACA,gBAAA;AAZJ;AAeE;EACE,cAAA;EACA,YAAA;EACA,4CAAA;AAbJ;AAgBE;EACE,aAAA;EACA,8BAAA;EACA,eAAA;AAdJ;AAgBI;EACE,4BAAA;AAdN;AAoBI;EACE,sCAAA;EACA,uCAAA;EACA,mBAAA;AAlBN;AAoBM;EACE,0CAAA;EACA,2BAAA;AAlBR;AAqBM;EACE,uCAAA;EACA,gBAAA;EACA,eAAA;AAnBR;AA0BI;EACE,sCAAA;EACA,uCAAA;EACA,mBAAA;AAxBN;AA0BM;EACE,0CAAA;EACA,2BAAA;EACA,0BAAA;AAxBR;AA2BM;EACE,uCAAA;EACA,gBAAA;EACA,eAAA;AAzBR;AAgCI;EACE,iGAAA;EACA,wCAAA;EACA,mBAAA;EACA,cAAA;AA9BN;AAgCM;EACE,0CAAA;EACA,2BAAA;EACA,0BAAA;AA9BR;AAiCM;EACE,iCAAA;EACA,gBAAA;EACA,eAAA;AA/BR","sourcesContent":[".form-container {\n  max-width: 900px;\n  margin: 0 auto;\n  padding-bottom: 20px;\n}\n\n.loading-container {\n  display: flex;\n  flex-direction: column;\n  align-items: center;\n  justify-content: center;\n  padding: 40px 20px;\n  text-align: center;\n\n  ion-spinner {\n    margin-bottom: 16px;\n  }\n\n  p {\n    color: var(--ion-color-medium);\n    margin: 0;\n  }\n}\n\n.validation-card {\n  margin: 20px 0;\n  border-left: 4px solid var(--ion-color-danger);\n\n  ion-card-header {\n    background: rgba(var(--ion-color-danger-rgb), 0.05);\n  }\n\n  ion-card-title {\n    display: flex;\n    align-items: center;\n    gap: 8px;\n    font-size: 16px;\n    font-weight: 600;\n  }\n\n  ion-list {\n    margin: 16px 0;\n    border-radius: 8px;\n    overflow: hidden;\n  }\n\n  ion-item {\n    --border-radius: 0;\n    --padding-start: 12px;\n    --padding-end: 12px;\n    cursor: pointer;\n    transition: all 0.2s ease;\n\n    &:hover {\n      --background: rgba(var(--ion-color-danger-rgb), 0.08);\n    }\n  }\n\n  small {\n    display: flex;\n    align-items: center;\n    gap: 6px;\n    color: var(--ion-color-medium);\n    margin-top: 12px;\n\n    ion-icon {\n      font-size: 14px;\n    }\n  }\n}\n\n// Formly field styling enhancements for inpatient care treatment form\n:host ::ng-deep {\n  // Section headers\n  .template-content h3 {\n    color: var(--ion-color-primary);\n    margin-top: 24px;\n    margin-bottom: 16px;\n    padding-bottom: 8px;\n    border-bottom: 2px solid var(--ion-color-primary);\n    font-size: 18px;\n    font-weight: 600;\n  }\n\n  .template-content h4 {\n    color: var(--ion-color-dark);\n    margin-top: 20px;\n    margin-bottom: 12px;\n    font-size: 16px;\n    font-weight: 600;\n  }\n\n  .template-content hr {\n    margin: 24px 0;\n    border: none;\n    border-top: 1px solid var(--ion-color-light);\n  }\n\n  .template-content p {\n    margin: 8px 0;\n    color: var(--ion-color-medium);\n    font-size: 14px;\n\n    strong {\n      color: var(--ion-color-dark);\n    }\n  }\n\n  // Calculated/readonly fields styling\n  formly-field {\n    .custom-ion-item.readonly {\n      --background: rgba(45, 211, 111, 0.05);\n      --border-color: rgba(45, 211, 111, 0.3);\n      margin-bottom: 20px;\n\n      .custom-label {\n        color: var(--ion-color-success) !important;\n        font-weight: 600 !important;\n      }\n\n      .custom-input {\n        --color: var(--ion-color-success-shade);\n        font-weight: 600;\n        font-size: 15px;\n      }\n    }\n  }\n\n  // Score display fields (works for any field ending with _score)\n  formly-field[data-key$=\"_score\"] {\n    .custom-ion-item {\n      --background: rgba(73, 144, 226, 0.08);\n      --border-color: rgba(73, 144, 226, 0.4);\n      --border-width: 2px;\n\n      .custom-label {\n        color: var(--ion-color-primary) !important;\n        font-weight: 700 !important;\n        font-size: 15px !important;\n      }\n\n      .custom-input {\n        --color: var(--ion-color-primary-shade);\n        font-weight: 700;\n        font-size: 16px;\n      }\n    }\n  }\n\n  // Overall score field (works for both supervision and treatment)\n  formly-field[data-key=\"overall_total_score\"] {\n    .custom-ion-item {\n      --background: linear-gradient(135deg, rgba(73, 144, 226, 0.15) 0%, rgba(45, 211, 111, 0.15) 100%);\n      --border-color: var(--ion-color-primary);\n      --border-width: 3px;\n      padding: 8px 0;\n\n      .custom-label {\n        color: var(--ion-color-primary) !important;\n        font-weight: 800 !important;\n        font-size: 17px !important;\n      }\n\n      .custom-input {\n        --color: var(--ion-color-primary);\n        font-weight: 800;\n        font-size: 18px;\n      }\n    }\n  }\n}\n"],"sourceRoot":""}]);
// Exports
module.exports = ___CSS_LOADER_EXPORT___.toString();


/***/ }),

/***/ 14123:
/*!**********************************************************************************************!*\
  !*** ./src/app/pages/inpatient-care-treatment/inpatient-care-treatment.page.html?ngResource ***!
  \**********************************************************************************************/
/***/ ((module) => {

"use strict";
module.exports = "<ion-header>\n  <ion-toolbar>\n    <ion-buttons slot=\"start\">\n      <ion-back-button defaultHref=\"/home\"></ion-back-button>\n    </ion-buttons>\n    <ion-title>{{ title }}</ion-title>\n    <ion-buttons slot=\"end\">\n      <ion-button (click)=\"reset()\">\n        <ion-icon slot=\"icon-only\" [name]=\"icons.REFRESH\"></ion-icon>\n      </ion-button>\n    </ion-buttons>\n  </ion-toolbar>\n</ion-header>\n\n<ion-content class=\"ion-padding\">\n  <!-- Form Container -->\n  <ng-container *ngIf=\"fields.length > 0; else loading\">\n    <form [formGroup]=\"form\" (ngSubmit)=\"submit()\">\n      <div class=\"form-container\">\n        <!-- Formly Form -->\n        <formly-form [form]=\"form\" [fields]=\"fields\" [model]=\"model\"></formly-form>\n\n        <!-- Validation Status Card -->\n        <ion-card *ngIf=\"showValidationErrors && getInvalidFieldsWithKeys().length > 0\" class=\"validation-card\">\n          <ion-card-header>\n            <ion-card-title color=\"danger\">\n              <ion-icon [name]=\"icons.ALERT_CIRCLE\" slot=\"start\"></ion-icon>\n              Form Validation Errors\n            </ion-card-title>\n          </ion-card-header>\n          <ion-card-content>\n            <p><strong>Please fix the following fields:</strong></p>\n            <ion-list>\n              <ion-item\n                *ngFor=\"let fieldInfo of getInvalidFieldsWithKeys(); trackBy: trackByField\"\n                color=\"light\"\n                button\n                (click)=\"scrollToField(fieldInfo.key)\">\n                <ion-icon [name]=\"icons.CLOSE_CIRCLE\" color=\"danger\" slot=\"start\"></ion-icon>\n                <ion-label class=\"ion-text-wrap\">{{ fieldInfo.label }}</ion-label>\n                <ion-icon [name]=\"icons.CHEVRON_FORWARD\" slot=\"end\" color=\"medium\"></ion-icon>\n              </ion-item>\n            </ion-list>\n            <p><small><ion-icon [name]=\"icons.INFORMATION_CIRCLE\" color=\"medium\"></ion-icon> Tap on any field above to scroll to it</small></p>\n          </ion-card-content>\n        </ion-card>\n\n        <!-- Submit Button -->\n        <ion-button expand=\"block\" type=\"submit\" color=\"primary\" style=\"margin-top: 20px; margin-bottom: 12px;\">\n          <ion-icon [name]=\"icons.CHECKMARK_CIRCLE\" slot=\"start\"></ion-icon>\n          {{ edit_mode ? 'Update Treatment' : 'Submit Treatment' }}\n        </ion-button>\n      </div>\n    </form>\n  </ng-container>\n\n  <ng-template #loading>\n    <div class=\"loading-container\">\n      <ion-spinner name=\"crescent\"></ion-spinner>\n      <p>Loading form...</p>\n    </div>\n  </ng-template>\n\n  <!-- Pull to Refresh -->\n  <ion-refresher slot=\"fixed\" (ionRefresh)=\"refresh($event)\">\n    <ion-refresher-content></ion-refresher-content>\n  </ion-refresher>\n</ion-content>\n";

/***/ })

}]);
//# sourceMappingURL=src_app_pages_inpatient-care-treatment_inpatient-care-treatment_module_ts.js.map