@hmcts/ccpay-web-component 5.0.1-beta94 → 5.0.1-beta98

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.
@@ -5893,25 +5893,56 @@ class AddRemissionComponent {
5893
5893
  /** @type {?} */
5894
5894
  const remissionctrls = this.remissionForm.controls;
5895
5895
  remissionctrls['refundDDReason'].setValue('Select a different reason', { onlySelf: true });
5896
- if (this.fees && this.viewCompStatus === 'issuerefund') {
5897
- /** @type {?} */
5898
- const creds = (/** @type {?} */ (this.remissionForm.controls.feesList));
5899
- for (var i = 0; i < this.fees.length; i++) {
5900
- creds.push(this.formBuilder.group({
5901
- id: this.fees[i].id,
5902
- code: this.fees[i].code,
5903
- volume: this.fees[i].volume,
5904
- calculated_amount: this.fees[i].calculated_amount,
5905
- apportion_amount: this.fees[i].apportion_amount,
5906
- ccd_case_number: this.fees[i].ccd_case_number,
5907
- description: this.fees[i].description,
5908
- net_amount: this.fees[i].net_amount,
5909
- version: this.fees[i].version,
5910
- amounttorefund: [''],
5911
- selected: ['']
5896
+ if (this.isFromServiceRequestPage) {
5897
+ this.paymentViewService.getApportionPaymentDetails(this.paymentLibComponent.paymentReference).subscribe((/**
5898
+ * @param {?} paymentGroup
5899
+ * @return {?}
5900
+ */
5901
+ paymentGroup => {
5902
+ /** @type {?} */
5903
+ let fees = [];
5904
+ paymentGroup.fees.forEach((/**
5905
+ * @param {?} fee
5906
+ * @return {?}
5907
+ */
5908
+ fee => {
5909
+ this.isRemissionsMatch = false;
5910
+ paymentGroup.remissions.forEach((/**
5911
+ * @param {?} rem
5912
+ * @return {?}
5913
+ */
5914
+ rem => {
5915
+ if (rem.fee_code === fee.code) {
5916
+ this.isRemissionsMatch = true;
5917
+ fee['remissions'] = rem;
5918
+ fees.push(fee);
5919
+ }
5920
+ }));
5921
+ if (!this.isRemissionsMatch) {
5922
+ fees.push(fee);
5923
+ }
5912
5924
  }));
5913
- }
5914
- this.cd.detectChanges();
5925
+ paymentGroup.fees = fees;
5926
+ this.paymentFees = fees;
5927
+ this.fees = fees;
5928
+ this.paymentGroup = paymentGroup;
5929
+ this.paymentGroup.payments = this.paymentGroup.payments.filter((/**
5930
+ * @param {?} paymentGroupObj
5931
+ * @return {?}
5932
+ */
5933
+ paymentGroupObj => paymentGroupObj['reference'].includes(this.paymentLibComponent.paymentReference)));
5934
+ /** @type {?} */
5935
+ const paymentAllocation = this.paymentGroup.payments[0].payment_allocation;
5936
+ this.isStatusAllocated = paymentAllocation.length > 0 && paymentAllocation[0].allocation_status === 'Allocated' || paymentAllocation.length === 0;
5937
+ this.refundFeesList();
5938
+ }), (/**
5939
+ * @param {?} error
5940
+ * @return {?}
5941
+ */
5942
+ (error) => this.errorMessage = error));
5943
+ }
5944
+ if (this.fees && this.viewCompStatus === 'issuerefund') {
5945
+ this.refundFeesList();
5915
5946
  }
5916
5947
  if (this.viewCompStatus === '') {
5917
5948
  this.viewStatus = 'main';
@@ -5955,13 +5986,35 @@ class AddRemissionComponent {
5955
5986
  this.paymentReference = this.orderDetail[0].payments[0].reference;
5956
5987
  }
5957
5988
  }
5989
+ /**
5990
+ * @return {?}
5991
+ */
5992
+ refundFeesList() {
5993
+ /** @type {?} */
5994
+ const creds = (/** @type {?} */ (this.remissionForm.controls.feesList));
5995
+ for (var i = 0; i < this.fees.length; i++) {
5996
+ creds.push(this.formBuilder.group({
5997
+ id: this.fees[i].id,
5998
+ code: this.fees[i].code,
5999
+ volume: this.fees[i].volume,
6000
+ calculated_amount: this.fees[i].calculated_amount,
6001
+ apportion_amount: this.fees[i].apportion_amount,
6002
+ ccd_case_number: this.fees[i].ccd_case_number,
6003
+ description: this.fees[i].description,
6004
+ net_amount: this.fees[i].net_amount,
6005
+ version: this.fees[i].version,
6006
+ amounttorefund: [''],
6007
+ selected: ['']
6008
+ }));
6009
+ }
6010
+ this.cd.detectChanges();
6011
+ }
5958
6012
  /**
5959
6013
  * @return {?}
5960
6014
  */
5961
6015
  get feesList() {
5962
6016
  /** @type {?} */
5963
6017
  const dd = (/** @type {?} */ (this.remissionForm.get('feesList')));
5964
- console.log(this.remissionForm.get('feesList'));
5965
6018
  return (/** @type {?} */ (this.remissionForm.get('feesList')));
5966
6019
  }
5967
6020
  /**
@@ -5988,9 +6041,6 @@ class AddRemissionComponent {
5988
6041
  */
5989
6042
  item => item.get('selected').value === true));
5990
6043
  }
5991
- // validateRow(i){
5992
- // return this.remissionForm.get('feesList').parent.controls['feesList'].controls[1].value['selected']
5993
- // }
5994
6044
  /**
5995
6045
  * @param {?} v1
5996
6046
  * @return {?}
@@ -6000,11 +6050,15 @@ class AddRemissionComponent {
6000
6050
  const ele = (/** @type {?} */ (document.getElementById(v1)));
6001
6051
  if (ele.checked) {
6002
6052
  document.getElementById('feeAmount_' + v1).removeAttribute("disabled");
6003
- document.getElementById('feeVolumeUpdated_' + v1).removeAttribute("disabled");
6053
+ if (document.getElementById('feeVolumeUpdated_' + v1) !== null) {
6054
+ document.getElementById('feeVolumeUpdated_' + v1).removeAttribute("disabled");
6055
+ }
6004
6056
  }
6005
6057
  else {
6006
6058
  document.getElementById('feeAmount_' + v1).setAttribute("disabled", "true");
6007
- document.getElementById('feeVolumeUpdated_' + v1).removeAttribute("disabled");
6059
+ if (document.getElementById('feeVolumeUpdated_' + v1) !== null) {
6060
+ document.getElementById('feeVolumeUpdated_' + v1).removeAttribute("disabled");
6061
+ }
6008
6062
  }
6009
6063
  }
6010
6064
  /**