|
|
|
@ -78,7 +78,7 @@ abstract class AbstractReportFragment : DataManagerFragment() { |
|
|
|
val dialog = builder.create() |
|
|
|
val dialog = builder.create() |
|
|
|
dialog.setOnShowListener { |
|
|
|
dialog.setOnShowListener { |
|
|
|
nameEditText.requestFocus() |
|
|
|
nameEditText.requestFocus() |
|
|
|
dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE) |
|
|
|
dialog.getWindow()?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
dialog.show() |
|
|
|
dialog.show() |
|
|
|
@ -94,30 +94,34 @@ abstract class AbstractReportFragment : DataManagerFragment() { |
|
|
|
getRealm().executeTransaction { realm -> |
|
|
|
getRealm().executeTransaction { realm -> |
|
|
|
|
|
|
|
|
|
|
|
val rs = this.item as ReportSetup |
|
|
|
val rs = this.item as ReportSetup |
|
|
|
|
|
|
|
val firstSave = (this.primaryKey == null) |
|
|
|
val options = this._selectedReport.options |
|
|
|
if (firstSave) { |
|
|
|
rs.name = name |
|
|
|
val options = this._selectedReport.options |
|
|
|
rs.display = options.display.ordinal |
|
|
|
rs.name = name |
|
|
|
options.stats.forEach { |
|
|
|
rs.display = options.display.ordinal |
|
|
|
rs.statIds.add(it.uniqueIdentifier) |
|
|
|
options.stats.forEach { |
|
|
|
} |
|
|
|
rs.statIds.add(it.uniqueIdentifier) |
|
|
|
options.criterias.forEach { criteria -> |
|
|
|
} |
|
|
|
when (criteria) { |
|
|
|
options.criterias.forEach { criteria -> |
|
|
|
is CustomFieldCriteria -> rs.criteriaCustomFieldIds.add(criteria.customFieldId) |
|
|
|
when (criteria) { |
|
|
|
else -> rs.criteriaIds.add(criteria.uniqueIdentifier) |
|
|
|
is CustomFieldCriteria -> rs.criteriaCustomFieldIds.add(criteria.customFieldId) |
|
|
|
|
|
|
|
else -> rs.criteriaIds.add(criteria.uniqueIdentifier) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
options.filterId?.let { id -> |
|
|
|
options.filterId?.let { id -> |
|
|
|
String |
|
|
|
rs.filter = realm.findById(id) |
|
|
|
rs.filter = realm.findById(id) |
|
|
|
} |
|
|
|
|
|
|
|
realm.copyToRealmOrUpdate(rs) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
rs.name = name |
|
|
|
|
|
|
|
realm.insertOrUpdate(rs) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.item = rs |
|
|
|
this.primaryKey = rs.id |
|
|
|
|
|
|
|
|
|
|
|
this.deleteButtonShouldAppear = true |
|
|
|
this.deleteButtonShouldAppear = true |
|
|
|
toolbar.title = name |
|
|
|
toolbar.title = name |
|
|
|
realm.copyToRealmOrUpdate(rs) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|