From 3e21356166cbb654b3c6dae6eca756712496f69d Mon Sep 17 00:00:00 2001 From: Arek Solek Date: Fri, 8 Sep 2023 17:04:56 +0200 Subject: [PATCH] Added confirmation of the action and the ability to copy values (#17272) * Added confirmation of the action and the ability to copy values * Added improvement * Reversed the change * Removed redundant variable * Reversed the change --- languages/en-US/_Base.json | 2 + modules/Vtiger/uitypes/Email.php | 5 +- modules/Vtiger/uitypes/Phone.php | 3 +- .../basic/modules/Vtiger/resources/Detail.js | 1 + .../basic/modules/Vtiger/resources/List.js | 1 + public_html/layouts/basic/styles/_Style.scss | 14 +++- .../integrations/mail/GenesysWdeWhirly.js | 64 ++++++++++--------- .../resources/integrations/pbx/Base.js | 7 +- 8 files changed, 62 insertions(+), 35 deletions(-) diff --git a/languages/en-US/_Base.json b/languages/en-US/_Base.json index 046dbbfaa4aa..d7984e79870d 100644 --- a/languages/en-US/_Base.json +++ b/languages/en-US/_Base.json @@ -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", diff --git a/modules/Vtiger/uitypes/Email.php b/modules/Vtiger/uitypes/Email.php index c26dc7b87a00..9349a00fa88a 100644 --- a/modules/Vtiger/uitypes/Email.php +++ b/modules/Vtiger/uitypes/Email.php @@ -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 = ' '; + $button = "'; } - return "{$icon}{$value}"; + return "{$icon}{$value}$button"; } $value = $value ? \App\Purifier::encodeHtml($value) : ''; return $length ? App\TextUtils::textTruncate($value, $length) : $value; diff --git a/modules/Vtiger/uitypes/Phone.php b/modules/Vtiger/uitypes/Phone.php index 9dfa301ba164..f8d0f03a9d00 100644 --- a/modules/Vtiger/uitypes/Phone.php +++ b/modules/Vtiger/uitypes/Phone.php @@ -86,12 +86,13 @@ public function getDisplayValue($value, $record = false, $recordModel = false, $ if (!\App\Integrations\Pbx::isActive()) { return '' . $international . '' . $extra; } + $button = "'; $data = 'data-phone="' . preg_replace('/(? ' . $label . ''; + return ' ' . $label . '' . $button; } /** {@inheritdoc} */ diff --git a/public_html/layouts/basic/modules/Vtiger/resources/Detail.js b/public_html/layouts/basic/modules/Vtiger/resources/Detail.js index ea1043ef5424..8df26ea29ddd 100644 --- a/public_html/layouts/basic/modules/Vtiger/resources/Detail.js +++ b/public_html/layouts/basic/modules/Vtiger/resources/Detail.js @@ -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); diff --git a/public_html/layouts/basic/modules/Vtiger/resources/List.js b/public_html/layouts/basic/modules/Vtiger/resources/List.js index 50e0f1aba86b..acc49d969244 100644 --- a/public_html/layouts/basic/modules/Vtiger/resources/List.js +++ b/public_html/layouts/basic/modules/Vtiger/resources/List.js @@ -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(); diff --git a/public_html/layouts/basic/styles/_Style.scss b/public_html/layouts/basic/styles/_Style.scss index 3b85b491880f..ff7cd7e60ac8 100644 --- a/public_html/layouts/basic/styles/_Style.scss +++ b/public_html/layouts/basic/styles/_Style.scss @@ -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; } @@ -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; } diff --git a/public_html/layouts/resources/integrations/mail/GenesysWdeWhirly.js b/public_html/layouts/resources/integrations/mail/GenesysWdeWhirly.js index cbda370d452c..d8a5a6a0f002 100644 --- a/public_html/layouts/resources/integrations/mail/GenesysWdeWhirly.js +++ b/public_html/layouts/resources/integrations/mail/GenesysWdeWhirly.js @@ -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 }); + } + }); } }); } diff --git a/public_html/layouts/resources/integrations/pbx/Base.js b/public_html/layouts/resources/integrations/pbx/Base.js index 1ad5c692759d..ee28a982201f 100644 --- a/public_html/layouts/resources/integrations/pbx/Base.js +++ b/public_html/layouts/resources/integrations/pbx/Base.js @@ -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); + } + }); }); } /**