Skip to content
This repository has been archived by the owner on Sep 13, 2024. It is now read-only.

Commit

Permalink
Added confirmation of the action and the ability to copy values (#17272)
Browse files Browse the repository at this point in the history
* Added confirmation of the action and the ability to copy values

* Added improvement

* Reversed the change

* Removed redundant variable

* Reversed the change
  • Loading branch information
areksolek authored Sep 8, 2023
1 parent b127ed2 commit 3e21356
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 35 deletions.
2 changes: 2 additions & 0 deletions languages/en-US/_Base.json
Original file line number Diff line number Diff line change
Expand Up @@ -1674,6 +1674,8 @@
"JS_YOU_ARE_IN_PAGE_NUMBER": "You are in page number",
"JS_YOU_CAN_SELECT_ONLY": "You can select only",
"LBL_DELETE_CONFIRMATION": "Are you sure you want to delete?",
"JS_SEND_MAIL_CONFIRMATION": "Are you sure to send the email?",
"JS_DIAL_NUMBER_CONFIRMATION": "Are you sure you want to dial the number?",
"JS_CHANGE_VALUE_CONFIRMATION": "Do you want to set this value?",
"JS_CHANGE_CONFIRMATION": "Are you sure you want to make changes?",
"JS_DELETE_CONFIRMATION": "Are you sure you want to delete the relation with this module? Only the relation will be removed, to remove the record you have to go to the record and press delete",
Expand Down
5 changes: 3 additions & 2 deletions modules/Vtiger/uitypes/Email.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,12 @@ public function getDisplayValue($value, $record = false, $recordModel = false, $
$rawValue = $value;
$value = \App\Purifier::encodeHtml(App\TextUtils::textTruncate($value, $length));
$data = 'title="' . \App\Language::translate('LBL_SEND_EMAIL') . '" ' . \App\Mail::getComposeAttr($rawValue, $record, 'Detail', 'new');
$icon = '';
$icon = $button = '';
if ('Base' !== \App\Mail::getMailComposer()) {
$icon = '<span class="fa-solid fa-envelope" aria-hidden="true"></span> ';
$button = "<button type=\"button\" class=\"btn btn-primary btn-xs ml-1 clipboard\" data-copy-attribute=\"clipboard-text\" data-clipboard-text=\"{$value}\" title=\"" . \App\Language::translate('BTN_COPY_TO_CLIPBOARD', $recordModel->getModuleName()) . '"><span class="fa-regular fa-copy"></span></button>';
}
return "<a class=\"u-cursor-pointer js-email-compose\" {$data} data-js=\"click|container\">{$icon}{$value}</a>";
return "<a class=\"u-cursor-pointer js-email-compose \" {$data} data-js=\"click|container\">{$icon}{$value}</a>$button";
}
$value = $value ? \App\Purifier::encodeHtml($value) : '';
return $length ? App\TextUtils::textTruncate($value, $length) : $value;
Expand Down
3 changes: 2 additions & 1 deletion modules/Vtiger/uitypes/Phone.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,13 @@ public function getDisplayValue($value, $record = false, $recordModel = false, $
if (!\App\Integrations\Pbx::isActive()) {
return '<a href="' . $href . '" class="js-popover-tooltip" title="' . $label . ' ' . trim($title) . '">' . $international . '</a>' . $extra;
}
$button = "<button type=\"button\" class=\"btn btn-primary btn-xs ml-1 clipboard\" data-copy-attribute=\"clipboard-text\" data-clipboard-text=\"{$international}\" title=\"" . \App\Language::translate('BTN_COPY_TO_CLIPBOARD', $recordModel->getModuleName()) . '"><span class="fa-regular fa-copy"></span></button>';
$data = 'data-phone="' . preg_replace('/(?<!^)\+|[^\d+]+/', '', $international) . '"';
if ($record) {
$data .= ' data-record="' . $record . '"';
}
$data .= ' title="' . $label . ' ' . trim($title) . '"';
return '<a class="u-cursor-pointer js-phone-perform-call js-popover-tooltip" ' . $data . ' data-js="click|container"><span class="fas fa-phone" aria-hidden="true"></span> ' . $label . '</a>';
return '<a class="u-cursor-pointer js-phone-perform-call js-popover-tooltip" ' . $data . ' data-js="click|container"><span class="fas fa-phone" aria-hidden="true"></span> ' . $label . '</a>' . $button;
}

/** {@inheritdoc} */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2836,6 +2836,7 @@ jQuery.Class(
// Not detail view page
return;
}
App.Fields.Text.registerCopyClipboard(detailViewContainer);
this.registerWidgetProductAndServices();
this.registerSetReadRecord(detailViewContainer);
this.getForm().validationEngine(app.validationEngineOptionsForRecord);
Expand Down
1 change: 1 addition & 0 deletions public_html/layouts/basic/modules/Vtiger/resources/List.js
Original file line number Diff line number Diff line change
Expand Up @@ -2112,6 +2112,7 @@ $.Class(
if (typeof CustomView !== 'undefined') {
CustomView.registerCustomViewAdvCondEvents(this.getListViewContainer());
}
App.Fields.Text.registerCopyClipboard(this.getListViewContainer());
this.registerMassActionsBtnEvents();
Vtiger_Helper_Js.showHorizontalTopScrollBar();
this.registerUrlFieldClickEvent();
Expand Down
14 changes: 12 additions & 2 deletions public_html/layouts/basic/styles/_Style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1569,7 +1569,16 @@ td.listViewEntryValue .row input {
padding: 0;
margin-bottom: 0;
}

@media only screen and (min-width: 1200px) {
.listViewEntries .listViewEntryValue .clipboard,
.detailViewTable .fieldValue .clipboard {
display: none;
}
.listViewEntries .listViewEntryValue:hover .clipboard,
.detailViewTable .fieldValue:hover .clipboard {
display: inline-block;
}
}
.listViewContentDiv {
position: relative;
}
Expand Down Expand Up @@ -3401,7 +3410,8 @@ select {
min-width: 400px;
}

.table tr.inventoryRow td,.table tr.inventoryRowGroup td {
.table tr.inventoryRow td,
.table tr.inventoryRowGroup td {
padding: 4px;
}

Expand Down
64 changes: 35 additions & 29 deletions public_html/layouts/resources/integrations/mail/GenesysWdeWhirly.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,36 +13,42 @@ window.Integrations_Mail_InternalClient = class Integrations_Mail_InternalClient
attr['crmModule'] = app.getModuleName();
attr['crmRecord'] = app.getRecordId();
}
AppConnector.request({
dataType: 'json',
data: {
module: 'AppComponents',
action: 'Mail',
mode: 'sendMail',
...attr
}
}).done((response) => {
if (response.result.status) {
$.ajax({ url: response.result.url, headers: { 'Token-Api': response.result.token } })
.done((ajax) => {
this.log('|◄| sendMail', ajax);
if (ajax['data']['status'] == 1) {
app.showNotify({ title: ajax['data']['description'], type: 'success' });
} else {
app.showError({
title: app.vtranslate('JS_UNEXPECTED_ERROR'),
text: ajax['data']['description']

app.showConfirmModal({
text: app.vtranslate('JS_SEND_MAIL_CONFIRMATION'),
confirmedCallback: () => {
AppConnector.request({
dataType: 'json',
data: {
module: 'AppComponents',
action: 'Mail',
mode: 'sendMail',
...attr
}
}).done((response) => {
if (response.result.status) {
$.ajax({ url: response.result.url, headers: { 'Token-Api': response.result.token } })
.done((ajax) => {
this.log('|◄| sendMail', ajax);
if (ajax['data']['status'] == 1) {
app.showNotify({ title: ajax['data']['description'], type: 'success' });
} else {
app.showError({
title: app.vtranslate('JS_UNEXPECTED_ERROR'),
text: ajax['data']['description']
});
}
})
.fail((_jqXHR, textStatus) => {
app.showError({
title: app.vtranslate('JS_UNEXPECTED_ERROR'),
text: textStatus
});
});
}
})
.fail((_jqXHR, textStatus) => {
app.showError({
title: app.vtranslate('JS_UNEXPECTED_ERROR'),
text: textStatus
});
});
} else {
app.showError({ title: app.vtranslate('JS_UNEXPECTED_ERROR'), text: response.result.text });
} else {
app.showError({ title: app.vtranslate('JS_UNEXPECTED_ERROR'), text: response.result.text });
}
});
}
});
}
Expand Down
7 changes: 6 additions & 1 deletion public_html/layouts/resources/integrations/pbx/Base.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ window.Integrations_Pbx_Base = class Integrations_Pbx_Base {
*/
registerEvents() {
this.container.on('click', '.js-phone-perform-call', (e) => {
this.performCall($(e.currentTarget).data(), e);
app.showConfirmModal({
text: app.vtranslate('JS_DIAL_NUMBER_CONFIRMATION'),
confirmedCallback: () => {
this.performCall($(e.currentTarget).data(), e);
}
});
});
}
/**
Expand Down

0 comments on commit 3e21356

Please sign in to comment.