Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion frontend/layouts/sidebar.html
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ <h5 class="menu-title">
<lang class="lang_module_themes">Themes</lang>
</a>
</li>
<li id="manage_li_ai">
<li id="manage_li_ai" style="display:none">
<a data-module="branch" data-access="write" href="#/settings/ai"
class="manage-settings-entry" id="manage_sec_ai">
<img src="static/images/svg-icon/advanced.svg" class="img-fluid" alt="ai assistance" loading="lazy" decoding="async">
Expand Down
25 changes: 7 additions & 18 deletions frontend/modules/settings_write.html
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ <h4 class="page-title mb-0" id="settings_page_title"><lang class="lang_generalse
<lang class="lang_module_themes">Themes</lang>
</a>
<a class="nav-link mb-2" data-module="branch" data-access="write"
id="v-pills-ai-tab" data-toggle="pill" href="#v-pills-ai" role="tab"
id="v-pills-ai-tab" style="display:none" data-toggle="pill" href="#v-pills-ai" role="tab"
aria-controls="v-pills-ai" aria-selected="false"><i
class="feather icon-zap mr-2"></i>
<lang class="lang_ask_posnic">Ask Posnic</lang>
Expand Down Expand Up @@ -1260,11 +1260,7 @@ <h5 class="card-title mb-0"><lang class="lang_taxsystem_title">Tax System</lang>
</div>
</div>
<div class="text-right">
<button type="button" class="btn btn-outline-primary btn-sm"
onclick="PosnicPro.settings.taxSystemSave();"><i
class="feather icon-save mr-1"></i>
<lang class="lang_save_title">Save</lang>
</button>

</div>
</div>
</div>
Expand Down Expand Up @@ -1292,7 +1288,7 @@ <h5 class="card-title mb-0"><lang class="lang_taxdefaults_title">Tax Defaults</l
</div>
<div class="text-right">
<button type="button" class="btn btn-outline-primary btn-sm"
onclick="PosnicPro.settings.updateCommonSetting('Tax defaults saved');"><i
onclick="PosnicPro.settings.taxSystemSave(function () { PosnicPro.settings.updateCommonSetting('Tax settings saved'); });"><i
class="feather icon-save mr-1"></i>
<lang class="lang_save_title">Save</lang>
</button>
Expand Down Expand Up @@ -3798,7 +3794,7 @@ <h6 class="mb-1"><lang class="lang_ai_title">Let the software write and read for
<small class="form-text text-muted"><lang class="lang_ai_spent_note">Estimated from what each call reported, at list prices, in your currency at a rounded rate. Live voice is counted by the minute of open line while the call is on. Your provider's dashboard is the final word on the bill.</lang></small>
</div>

<button type="button" class="btn btn-primary" id="ai_save"><lang class="lang_ai_save">Save</lang></button>

</div>
</div>
<h6><lang class="lang_search_by_meaning_with_my_openai_key">Search by meaning with my OpenAI key</lang></h6><div class="form-row"><div class="form-group col-md-8"><div class="custom-control custom-switch"><input class="custom-control-input" type="checkbox" id="ask_pref_own_semantic" form="ask_posnic_preferences_form"><label class="custom-control-label" for="ask_pref_own_semantic"><lang class="lang_search_by_meaning_with_my_openai_key">Search by meaning with my OpenAI key</lang></label></div><small class="text-muted"><lang class="lang_optional_for_own_key_accounts_sends_publis">Optional for own-key accounts. Sends published knowledge and help questions to OpenAI for embeddings, billed to your key. Vectors stay in this installation. Supports up to 5,000 published passages. Cloud managed search uses your managed allowance.</lang></small></div>
Expand Down Expand Up @@ -4931,10 +4927,7 @@ <h5 class="card-title mb-0">
</div>
</div>
<div class="d-flex align-items-center" style="gap:10px;">
<button type="button" class="btn btn-sm btn-primary" id="sharing_save_btn"
onclick="PosnicPro.settings.saveSharing();">
<i class="feather icon-save mr-2"></i><lang class="lang_save_sharing">Save sharing</lang>
</button>

<small class="text-muted" id="sharing_status"></small>
</div>
</fieldset>
Expand Down Expand Up @@ -5253,11 +5246,7 @@ <h5 class="card-title mb-0">
a &#8377;200 bill paid as &#8377;100 UPI + &#8377;100 cash.</lang></small>
</div>
<div class="text-right">
<button type="button" class="btn btn-outline-primary btn-sm"
onclick="PosnicPro.settings.updateCommonSetting('Payment settings saved');"><i
class="feather icon-save mr-1"></i>
<lang class="lang_save_title">Save</lang>
</button>

</div>
</div>
<div class="tab-pane fade" id="pay-sub-modes" role="tabpanel">
Expand Down Expand Up @@ -5580,7 +5569,7 @@ <h6 class="mb-0"><a data-module="branch" data-access="write"
<section class="print-settings-panel">
<h5><lang class="lang_rd_printing_options">Printing options</lang></h5>
<div id="receipt-print-behaviour"></div>
<button type="button" class="btn btn-primary btn-sm" id="save-print-behaviour"><lang class="lang_save_printing_options">Save printing options</lang></button>
<button type="button" class="btn btn-primary btn-sm" id="save-print-behaviour"><lang class="lang_save_title">Save</lang></button>
<span class="small ml-2" id="print-behaviour-status" role="status"></span>
</section>
</div>
Expand Down
2 changes: 1 addition & 1 deletion frontend/static/script/js/core/PosnicPro.js
Original file line number Diff line number Diff line change
Expand Up @@ -2955,7 +2955,7 @@ PosnicPro = {
$('#manage_li_deliverypartners').toggle(on('module_delivery_partners_enable'));
$('#manage_li_webshop').toggle(on('module_webshop_enable'));
$('#manage_li_theme').toggle(on('module_themes_enable'));
$('#manage_li_ai').toggle(on('ai_enabled') || s.ask_posnic_enabled === true);
$('#manage_li_ai').toggle(s.ask_posnic_enabled === true);
$('[data-ask-entry]').toggle(s.ask_posnic_enabled === true);
if (PosnicPro.askposnic) PosnicPro.askposnic.setEnabled(s.ask_posnic_enabled === true);
$('#manage_li_recyclebin').toggle(on('module_recyclebin_enable'));
Expand Down
5 changes: 3 additions & 2 deletions frontend/static/script/js/core/print-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
state.sales.map(function (v, i) { return row('sales', v, i); }).join('') + row('invoice', state.invoice) + row('quotation', state.quotation) +
'</tbody></table></div>' + languageSettings() + '<div class="d-flex align-items-center flex-wrap mb-2"><button type="button" class="btn btn-outline-primary btn-sm mr-2" data-print-refresh>' + esc(PosnicPro.i18n.t('lang_print_refresh_printers', 'Refresh printers')) + '</button>' +
(desktop() ? '<button type="button" class="btn btn-outline-primary btn-sm mr-2" data-print-add>' + esc(PosnicPro.i18n.t('lang_print_add_sales_printer', 'Add sales printer')) + '</button>' : '') +
'<button type="button" class="btn btn-primary btn-sm" data-print-save>' + esc(PosnicPro.i18n.t('lang_print_save_settings', 'Save print settings')) + '</button><span class="small ml-2" role="status" data-print-status></span></div></section>');
'<span class="small ml-2" role="status" data-print-status></span></div></section>');
features(featureState);
}
function collect() {
Expand Down Expand Up @@ -109,7 +109,8 @@
}
mirror(next);
host.find('[data-print-status]').text(PosnicPro.i18n.t('lang_print_settings_saved', 'Print settings saved.'));
} catch (error) { host.find('[data-print-status]').text(error.message); }
return true;
} catch (error) { host.find('[data-print-status]').text(error.message); return false; }
finally { button.prop('disabled', false); }
}
async function mount(data) {
Expand Down
8 changes: 5 additions & 3 deletions frontend/static/script/js/modules/js/ask_posnic.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ PosnicPro.askposnic = {
this.loadStatus();
},
settingsTab: function (key, focus) {
if (!this.admin || ['general', 'knowledge', 'access', 'usage', 'schedules'].indexOf(key) === -1) return;
if (!this.enabled || !this.admin || ['general', 'knowledge', 'access', 'usage', 'schedules'].indexOf(key) === -1) return;
this.activeSettingsTab = key;
$('[data-ask-tab]').each(function () {
var active = $(this).attr('data-ask-tab') === key;
Expand Down Expand Up @@ -576,10 +576,12 @@ PosnicPro.askposnic = {
});
$('#ask_posnic_preferences_form').on('submit', function (event) {
event.preventDefault();
PosnicPro.request({ url: 'ask-posnic/preferences', method: 'PUT', data: JSON.stringify({ own_key_semantic: $('#ask_pref_own_semantic').is(':checked'), own_key_semantic_budget: Number($('#ask_pref_embedding_budget').val()), help_enabled: $('#ask_pref_help').is(':checked'), insights_enabled: $('#ask_pref_insights').is(':checked'), actions_enabled: $('#ask_pref_actions').is(':checked'), store_conversations: $('#ask_pref_history').is(':checked'), retention_days: Number($('#ask_pref_retention').val()), default_period: $('#ask_pref_period').val(), response_language: $('#ask_pref_language').val(), help_instructions: $('#ask_help_instructions').val(), roles: { help: $('#ask_pref_help_roles').val() || [], insights: $('#ask_pref_insight_roles').val() || [], actions: $('#ask_pref_action_roles').val() || [] }, allowed_actions: $('.ask-allowed-action:checked').map(function () { return this.value; }).get() }) }, function (response) {
function savePreferences() { PosnicPro.request({ url: 'ask-posnic/preferences', method: 'PUT', data: JSON.stringify({ own_key_semantic: $('#ask_pref_own_semantic').is(':checked'), own_key_semantic_budget: Number($('#ask_pref_embedding_budget').val()), help_enabled: $('#ask_pref_help').is(':checked'), insights_enabled: $('#ask_pref_insights').is(':checked'), actions_enabled: $('#ask_pref_actions').is(':checked'), store_conversations: $('#ask_pref_history').is(':checked'), retention_days: Number($('#ask_pref_retention').val()), default_period: $('#ask_pref_period').val(), response_language: $('#ask_pref_language').val(), help_instructions: $('#ask_help_instructions').val(), roles: { help: $('#ask_pref_help_roles').val() || [], insights: $('#ask_pref_insight_roles').val() || [], actions: $('#ask_pref_action_roles').val() || [] }, allowed_actions: $('.ask-allowed-action:checked').map(function () { return this.value; }).get() }) }, function (response) {
if (response && response.type === 'success') { self.loadStatus(); PosnicPro.alert('success', response.message); }
else PosnicPro.alert('error', response.message || 'Could not save Ask Posnic settings.');
});
}); }
if (self.activeSettingsTab === 'usage') PosnicPro.settings.ai.save(savePreferences);
else savePreferences();
});
$('#ask_posnic_schedules').on('click', '.ask-schedule-delete', function () {
PosnicPro.request({ url: 'ask-posnic/schedules/' + encodeURIComponent($(this).data('id')), method: 'DELETE' }, function (response) { if (response && response.type === 'success') self.loadSchedules(); });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,10 +303,15 @@
status(xhr && xhr.responseJSON && xhr.responseJSON.message || t('Could not save designs. Your changes are still here.'), true);
});
}
function saveBehaviour() {
async function saveBehaviour() {
var button = $('#save-print-behaviour'), note = $('#print-behaviour-status');
if (button.prop('disabled')) return;
var values = printOptions(), payload = { printall: values.printall, bill_print_copies: values.bill_print_copies };
button.prop('disabled', true);
if (PosnicPro.printSettings && await PosnicPro.printSettings.save() === false) {
button.prop('disabled', false);
return;
}
PosnicPro.put({ url: 'setting/updateCommonSettings', data: JSON.stringify(payload) }, function (res) {
button.prop('disabled', false);
if (res.type !== 'success') { note.text(res.message || PosnicPro.i18n.t('lang_print_save_failed', 'Could not save print settings.')); return; }
Expand Down
Loading
Loading