Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
7cdfc18
Removed unused Health Metrics js
jlamanskygitt Jan 22, 2026
a7d765c
Merge branch 'DiscipleTools:develop' into develop
jlamanskygitt Feb 9, 2026
80b8f75
Merge branch 'DiscipleTools:develop' into develop
jlamanskygitt Feb 18, 2026
6303cfd
Updated link to new multi-text-groups
jlamanskygitt Feb 23, 2026
ba6f686
Added passing groups to link component
jlamanskygitt Mar 4, 2026
ade427a
Removed unused link-input code
jlamanskygitt Mar 9, 2026
52dc720
Merge branch 'DiscipleTools:develop' into develop
jlamanskygitt Mar 25, 2026
cef4f54
Merge remote-tracking branch 'upstream/develop' into multi-text-groups
jlamanskygitt Mar 26, 2026
a256d91
Implemented link field merging
jlamanskygitt Apr 6, 2026
c38c92f
Merge branch 'DiscipleTools:develop' into develop
jlamanskygitt Apr 6, 2026
88b8f81
Merge branch 'develop' of https://github.com/jlamanskygitt/disciple-t…
jlamanskygitt Apr 6, 2026
2290ead
Ran prettier
jlamanskygitt Apr 6, 2026
47f7ab6
Fixed merge logic with removing archived values & adding new values
jlamanskygitt Apr 8, 2026
22083e1
Merge branch 'dt-develop' into multi-text-groups
cairocoder01 Apr 9, 2026
98fb2e6
Merge branch 'DiscipleTools:develop' into multi-text-groups
jlamanskygitt Apr 10, 2026
ffcb933
Merge remote-tracking branch 'jlamanskygitt/multi-text-groups' into m…
cairocoder01 Apr 14, 2026
6fa1674
Merge remote-tracking branch 'origin/develop' into multi-text-groups
cairocoder01 Apr 14, 2026
b94c40b
components v0.8.11
cairocoder01 Apr 14, 2026
5ec809b
Resolved bug with removing archived values
jlamanskygitt Apr 14, 2026
d71c902
Merge branch 'multi-text-groups' of https://github.com/jlamanskygitt/…
jlamanskygitt Apr 14, 2026
abcba66
Refactored remove logic
jlamanskygitt Apr 14, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 15 additions & 14 deletions dt-assets/build/components/index.es.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { E as e, C as s, x as D, B as o, D as l, a as i, b as n, d as r, e as c, f as p, u, w as C, A as M, g as T, h as m, i as x, j as S, y as d, k as g, t as B, r as h, l as v, m as A, n as b, o as F, p as L, z as f, q as y, c as U, v as j } from "./index-DpLFOrwQ.js";
import { F as e, E as s, y as D, C as o, D as l, a as i, b as n, d as r, e as c, f as u, w as p, x as M, B as T, g as x, h as C, i as m, j as S, z as d, k as g, u as B, r as h, t as v, l as A, m as F, n as b, o as L, p as f, A as y, q as G, c as U, v as j } from "./index-CGwyMuNJ.js";
export {
e as ApiService,
s as ComponentService,
Expand All @@ -9,25 +9,26 @@ export {
n as DtConnection,
r as DtCopyText,
c as DtDate,
p as DtDatetime,
u as DtFileUpload,
C as DtFormBase,
M as DtIcon,
T as DtLabel,
m as DtLocation,
x as DtLocationMap,
u as DtDatetime,
p as DtFileUpload,
M as DtFormBase,
T as DtIcon,
x as DtLabel,
C as DtLocation,
m as DtLocationMap,
S as DtMapModal,
d as DtModal,
g as DtMultiSelect,
B as DtMultiSelectButtonGroup,
h as DtMultiText,
v as DtNumberField,
A as DtSingleSelect,
v as DtMultiTextGroups,
A as DtNumberField,
F as DtSingleSelect,
b as DtTags,
F as DtText,
L as DtTextArea,
f as DtTile,
y as DtToggle,
L as DtText,
f as DtTextArea,
y as DtTile,
G as DtToggle,
U as DtUsersConnection,
j as version
};
775 changes: 500 additions & 275 deletions dt-assets/build/components/index.js

Large diffs are not rendered by default.

775 changes: 500 additions & 275 deletions dt-assets/build/components/index.umd.cjs

Large diffs are not rendered by default.

47 changes: 0 additions & 47 deletions dt-assets/js/details.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,53 +82,6 @@ jQuery(document).ready(function ($) {
};
}

/* field type: link */
$('input.link-input').change(function () {
const link_input = $(this);
const fieldKey = $(link_input).data('field-key');
const type = $(link_input).data('type');
const meta_id = $(link_input).data('meta-id');
const value = $(link_input).val();

if ($(link_input).prop('required') && value === '') {
return;
}

const fieldValues = {
values: [
{
value,
type,
meta_id,
},
],
};
$(`#${fieldKey}-spinner`).addClass('active');
rest_api
.update_post(post_type, post_id, { [fieldKey]: fieldValues })
.then((newPost) => {
$(`#${fieldKey}-spinner`).removeClass('active');
post = newPost;

// Make sure a key exists for the new link field.
if (post && post[fieldKey] && post[fieldKey].length > 0) {
let updated_values = post[fieldKey].filter((option) => {
return option['type'] === type && option['value'] === value;
});

// This ensures any immediate updates, are assigned to correct link input and not to a new/duplicated input field.
if (
updated_values &&
updated_values[0] &&
updated_values[0]['meta_id']
) {
$(link_input).data('meta-id', updated_values[0]['meta_id']);
}
}
})
.catch(window.handleAjaxError);
});

/* field type: datetime */
$('.dt_date_time_group').each(function setTimePickers() {
const timestamp = this.dataset.timestamp;
Expand Down
218 changes: 60 additions & 158 deletions dt-assets/js/merge-post-details.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,11 @@ jQuery(function ($) {
return typeahead && !window.lodash.isEmpty(typeahead.items);
}

case 'link':
case 'link': {
return !window.lodash.isEmpty(
$(td_field_input).find('input.link-input').not('[value=""]'),
$(td_field_input).find('dt-multi-text-groups').not('[value=""]'),
);
}

case 'communication_channel':
return !window.lodash.isEmpty(
Expand Down Expand Up @@ -314,54 +315,13 @@ jQuery(function ($) {
case 'communication_channel':
case 'location_meta':
case 'location':
case 'link':
// Disable field accordingly, based on read-only flag
$(td)
.find('#' + field_id)
.prop('disabled', read_only);
break;

case 'link': {
// Disable/Display field accordingly, based on read-only flag
$(td).find('input.link-input').prop('disabled', read_only);
$(td).find('button.link-delete-button').prop('disabled', read_only);

// Ensure add link functionality is suppressed.
$(td).find('div.add-link-dropdown').remove();

if (!read_only) {
$(td)
.find('input.link-input')
.each(function (idx, input) {
if (window.lodash.isEmpty($(input).val())) {
$(input).parent().hide();
}
});

/**
* Remove
*/

$(document).on('click', '.link-delete-button', (evt) => {
const delete_but = $(evt.currentTarget);

// Keep a record of deleted meta_ids.
let meta_id = $(delete_but).data('meta-id');
let deleted_items = $(field_meta).val()
? JSON.parse($(field_meta).val())
: [];
if (!window.lodash.includes(deleted_items, meta_id)) {
deleted_items.push(meta_id);
$(field_meta).val(JSON.stringify(deleted_items));
}

// Finally, remove from parent.
$(delete_but).parent().parent().remove();
});
}

break;
}

case 'user_select': {
let user_select_typeahead_field_input = '.js-typeahead-' + field_id;

Expand Down Expand Up @@ -562,73 +522,70 @@ jQuery(function ($) {
}

case 'link': {
// Determine selector source field link inputs to be processed.
let source_field_link_inputs = [];
let tr = $(selector).parent().parent();
$(tr)
.find('.td-field-input input.link-input')
.each(function (idx, input) {
if ($(input).val()) {
source_field_link_inputs.push(input);
}
});
// Determine if we are adding values from the merge contact or the primary contact
let baseURI = selector.prop('baseURI');
let mergeFieldID = selector.prop('dataset').merge_field_id;
let currentID = mergeFieldID.substring(0, mergeFieldID.indexOf('_'));
let dupeID = baseURI.substring(
baseURI.indexOf('dupeid=') + 'dupeid='.length,
);
let mergeContact = currentID === dupeID;

// Delete/Add updated post record, based on identified source field inputs.
let main_updated_fields_div = $('#main_updated_fields_div');
let link_field_meta_input = $(main_updated_fields_div)
.find(`.link-list-${update_field_id}`)
.parent()
.parent()
.find('#field_meta');
let deleted_items = $(link_field_meta_input).val()
? JSON.parse($(link_field_meta_input).val())
: [];

// Locate by link field values.
$.each(source_field_link_inputs, function (idx, input) {
let link_list_section_div = $(main_updated_fields_div).find(
`.link-list-${update_field_id} .link-section--${$(input).data('type')}`,
);
let matched_input = $(link_list_section_div).find(
`.input-group input[value="${$(input).val()}"].link-input`,
);
// Determine values to be updated
const sourceValue = sourceField.val() || [];
let mergedValue = mergedField.val() || [];

// Handle accordingly, based on incoming selected state.
// Update values accordingly
for (const sourceItem of sourceValue) {
const valIdx = mergedValue.findIndex(
(x) => x.meta_id === sourceItem.meta_id,
);
if (is_selected) {
// Add new updated link fields.
if (matched_input.length === 0) {
$(link_list_section_div).append(`
<div class="input-group">
<input type="text" class="link-input input-group-field" value="${window.SHAREDFUNCTIONS.escapeHTML($(input).val())}" data-meta-id="${window.SHAREDFUNCTIONS.escapeHTML($(input).data('meta-id'))}" data-field-key="${window.SHAREDFUNCTIONS.escapeHTML(update_field_id)}" data-type="${window.SHAREDFUNCTIONS.escapeHTML($(input).data('type'))}">
<div class="input-group-button">
<button class="button alert delete-button-style input-height link-delete-button delete-button" data-meta-id="${window.SHAREDFUNCTIONS.escapeHTML($(input).data('meta-id'))}" data-field-key="${window.SHAREDFUNCTIONS.escapeHTML(update_field_id)}">&times;</button>
</div>
</div>`);

// Remove any previously deleted entries.
window.lodash.remove(deleted_items, function (meta_id) {
return meta_id === $(input).data('meta-id');
});
$(link_field_meta_input).val(JSON.stringify(deleted_items));
if (mergeContact) {
if (sourceItem.meta_id != null) {
sourceItem.tempKey = sourceItem.meta_id;
sourceItem.meta_id = null;
}
mergedValue.push(sourceItem);
} else {
if (valIdx < 0) {
mergedValue.push(sourceItem);
} else {
// set delete to false IF source item has delete as false
if (!sourceItem.delete) {
mergedValue[valIdx].delete = false;
}
}
}
} else {
// Remove new updated link fields.
if (matched_input.length > 0) {
$(matched_input).parent().remove();

// Keep a record of deleted meta_ids.
if (
!window.lodash.includes(
deleted_items,
$(matched_input).data('meta-id'),
)
) {
deleted_items.push($(matched_input).data('meta-id'));
$(link_field_meta_input).val(JSON.stringify(deleted_items));
// Remove, if present and not still selected anywhere else!
if (
!is_field_value_still_selected(
update_field_id,
field_type,
sourceItem,
)
) {
if (valIdx >= 0) {
if (mergeContact) {
mergedValue.splice(valIdx, 1);
} else {
// set delete to true
mergedValue[valIdx].delete = true;
}
}
}
}
});
}

// if there is an empty value, remove it
const emptyIdx = mergedValue.findIndex((x) => !x.value && x.tempKey);
if (mergedValue.length > 1 && emptyIdx > -1) {
mergedValue.splice(emptyIdx, 1);
}

// set value attribute of element
mergedField.attr('value', JSON.stringify(mergedValue));

break;
}
Expand Down Expand Up @@ -1400,61 +1357,6 @@ jQuery(function ($) {
break;
}

case 'link': {
// Determine values to be processed
let link_entries = [];
let link_deletions = field_meta.val()
? JSON.parse(field_meta.val())
: [];

// Package values and any deletions
$(td)
.find('.input-group input.link-input')
.each(function (idx, input) {
let link_type = $(input).data('type');
let link_meta_id = $(input).data('meta-id');
let link_val = $(input).val();

let has_value = is_link_field_value_already_in_primary(
post_field_id,
link_type,
link_meta_id,
link_val,
true,
);
let matched_meta_id = is_link_field_value_already_in_primary(
post_field_id,
link_type,
link_meta_id,
link_val,
false,
);

if (link_val && !has_value) {
link_entries.push({
value: link_val,
type: link_type,
meta_id: matched_meta_id ? link_meta_id : '',
});
}
});

$.each(link_deletions, function (idx, deleted_meta_id) {
link_entries.push({
meta_id: deleted_meta_id,
delete: true,
});
});

// If present, capture entries
if (link_entries) {
values[post_field_id] = {
values: link_entries,
};
}
break;
}

case 'user_select': {
let user_select_typeahead =
window.Typeahead['.js-typeahead-' + field_id];
Expand Down
13 changes: 0 additions & 13 deletions dt-assets/js/new-bulk-record.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,19 +117,6 @@ jQuery(function ($) {
new_post[$(entry).attr('id')] = $(entry).val();
}
});
$('.link-input').each((index, entry) => {
let fieldKey = $(entry).data('field-key');
let type = $(entry).data('type');
if ($(entry).val()) {
if (!Object.prototype.hasOwnProperty.call(new_post, fieldKey)) {
new_post[fieldKey] = { values: [] };
}
new_post[fieldKey].values.push({
value: $(entry).val(),
type: type,
});
}
});
$('.dt_textarea').each((index, entry) => {
if ($(entry).val()) {
new_post[$(entry).attr('id')] = $(entry).val();
Expand Down
Loading
Loading