diff --git a/sh_backmate_theme_adv_enterprise/static/src/js/calculator.js b/sh_backmate_theme_adv_enterprise/static/src/js/calculator.js index 170916b13..126606006 100644 --- a/sh_backmate_theme_adv_enterprise/static/src/js/calculator.js +++ b/sh_backmate_theme_adv_enterprise/static/src/js/calculator.js @@ -11,7 +11,7 @@ import { session } from "@web/session"; export class CalculaterSh extends Component { static template = "CalculatorTemplate"; - + static props = ["*"]; setup() { this.orm = useService("orm"); this.search_sh_enable_calculator_mode() @@ -22,9 +22,9 @@ export class CalculaterSh extends Component { } onClickCalculator() { - if($('.calculator').length > 0){ + if ($('.calculator').length > 0) { $(".sh_calc_results").html(""); - }else{ + } else { // render template var qweb_data = ` @@ -69,16 +69,16 @@ export class CalculaterSh extends Component { ` $(".sh_calc_results").html(qweb_data); } - if($('.sh_calc_util').hasClass('active')){ + if ($('.sh_calc_util').hasClass('active')) { $('.sh_calc_util').removeClass('active') - }else{ + } else { $('.sh_calc_util').addClass('active') } // close other popup - $('.sh_user_language_list_cls').css("display","none") - $('.sh_wqm_quick_menu_submenu_list_cls').css("display","none") + $('.sh_user_language_list_cls').css("display", "none") + $('.sh_wqm_quick_menu_submenu_list_cls').css("display", "none") $('.todo_layout').removeClass("sh_theme_model"); - } + } } registry.category("systray").add("sh_entmate_theme.calculater_sh", { Component: CalculaterSh }, { sequence: 25 }); diff --git a/sh_backmate_theme_adv_enterprise/static/src/js/global_search.js b/sh_backmate_theme_adv_enterprise/static/src/js/global_search.js index 1e05a827d..03722906b 100644 --- a/sh_backmate_theme_adv_enterprise/static/src/js/global_search.js +++ b/sh_backmate_theme_adv_enterprise/static/src/js/global_search.js @@ -13,7 +13,7 @@ var show_company = false; export class GlobalSearchSh extends Component { static template = "sh_backmate_theme_adv_enterprise.GlobalSearch"; - + static props = ["*"]; setup() { super.setup() this.orm = useService("orm"); @@ -22,13 +22,13 @@ export class GlobalSearchSh extends Component { this.sh_enable_gloabl_search_mode = session.sh_enable_gloabl_search_mode this.sidebar_collapse_style = "" onMounted(() => { - if ($("input[name='sidebar_collapse_style']:checked").val() == 'collapsed' && $("input[name='search_style']:checked").val() == 'expanded'){ - $(".sh_search").css("left","80px") + if ($("input[name='sidebar_collapse_style']:checked").val() == 'collapsed' && $("input[name='search_style']:checked").val() == 'expanded') { + $(".sh_search").css("left", "80px") } - else{ - $(".sh_search").css("left","275px") + else { + $(".sh_search").css("left", "275px") } - if (isMobileOS()){ + if (isMobileOS()) { $("#topbar_search_icon").css("display", "block"); $(".usermenu_search_input2").css("display", "none"); $("#topbar_full_search_icon").css("display", "none"); @@ -37,28 +37,28 @@ export class GlobalSearchSh extends Component { } async _onclick_search_top_bar(event) { - const data = await this.orm.searchRead( + const data = await this.orm.searchRead( "sh.back.theme.config.settings", [['id', '=', 1]], ["search_style"]); - if (data) { - if (!isMobileOS()) { - if (data[0]['search_style'] == 'collapsed') { - if ($(".usermenu_search_input").css("display") == 'block') { - $(".usermenu_search_input").css("display", "none"); - } else { - $(".usermenu_search_input").css("display", "block"); - } - } - } else { - if ($(".usermenu_search_input").css("display") == "block") { + if (data) { + if (!isMobileOS()) { + if (data[0]['search_style'] == 'collapsed') { + if ($(".usermenu_search_input").css("display") == 'block') { $(".usermenu_search_input").css("display", "none"); } else { $(".usermenu_search_input").css("display", "block"); } } + } else { + if ($(".usermenu_search_input").css("display") == "block") { + $(".usermenu_search_input").css("display", "none"); + } else { + $(".usermenu_search_input").css("display", "block"); + } } } + } _linkInfo(key) { var original = this._searchableMenus[key]; @@ -89,17 +89,17 @@ export class GlobalSearchSh extends Component { [['id', '=', 1]], ["search_style"]); if (data) { - if (!isMobileOS()) { + if (!isMobileOS()) { if (data[0]['search_style'] == 'expanded') { this.$search_input = $(".sh_search_input input.usermenu_search_input2"); } else { this.$search_input = $(".sh_search_input input.usermenu_search_input"); } - } - else { - this.$search_input = $(".sh_search_input input.usermenu_search_input"); - } } + else { + this.$search_input = $(".sh_search_input input.usermenu_search_input"); + } + } var query = this.$search_input.val(); if (query === "") { $(".sh_search_container").removeClass("has-results"); @@ -109,33 +109,33 @@ export class GlobalSearchSh extends Component { var self = this; await jsonrpc("/web/dataset/call_kw/global.search/get_search_result", { - model: 'global.search', - method: 'get_search_result', - args: [[query]], - kwargs: {}, - }).then(function (data) { - if (data) { - self._searchableMenus = data + model: 'global.search', + method: 'get_search_result', + args: [[query]], + kwargs: {}, + }).then(function (data) { + if (data) { + self._searchableMenus = data - var results = Object.keys(self._searchableMenus) - $(".sh_search_results").css("display", "block"); - $(".sh_search_container").toggleClass("has-results", Boolean(results.length)); - if (results.length > 0) { - $(".sh_search_results").css("display", "block"); + var results = Object.keys(self._searchableMenus) + $(".sh_search_results").css("display", "block"); + $(".sh_search_container").toggleClass("has-results", Boolean(results.length)); + if (results.length > 0) { + $(".sh_search_results").css("display", "block"); - const sh_search_results_html = renderToFragment( - 'sh_backmate_theme_adv_enterprise.MenuSearchResults', { - results : results, - widget: self, - }); + const sh_search_results_html = renderToFragment( + 'sh_backmate_theme_adv_enterprise.MenuSearchResults', { + results: results, + widget: self, + }); - $(".sh_search_results").html(sh_search_results_html); + $(".sh_search_results").html(sh_search_results_html); - } else { - $(".sh_entmate_theme_appmenu_div").css("opacity", "1"); - $(".sh_search_results").css("display", "none"); - } - } + } else { + $(".sh_entmate_theme_appmenu_div").css("opacity", "1"); + $(".sh_search_results").css("display", "none"); + } + } }); } diff --git a/sh_backmate_theme_adv_enterprise/static/src/js/language_selector.js b/sh_backmate_theme_adv_enterprise/static/src/js/language_selector.js index 745745e8e..ec20fb166 100644 --- a/sh_backmate_theme_adv_enterprise/static/src/js/language_selector.js +++ b/sh_backmate_theme_adv_enterprise/static/src/js/language_selector.js @@ -13,50 +13,50 @@ import { Dropdown } from "@web/core/dropdown/dropdown"; import { DropdownItem } from "@web/core/dropdown/dropdown_item"; export class LanguageTemplate extends Component { - static components = { Dropdown }; - static template = "LanguageTemplate"; + static components = { Dropdown }; + static template = "LanguageTemplate"; + static props = ["*"]; + setup() { + this.actionService = useService("action"); + this.orm = useService("orm"); + this.search_sh_enable_language_selection() + this.fetch_sh_get_installed_lang() + } - setup() { - this.actionService = useService("action"); - this.orm = useService("orm"); - this.search_sh_enable_language_selection() - this.fetch_sh_get_installed_lang() - } + async search_sh_enable_language_selection() { + this.sh_enable_language_selection = session.sh_enable_language_selection + } - async search_sh_enable_language_selection() { - this.sh_enable_language_selection = session.sh_enable_language_selection - } + async fetch_sh_get_installed_lang() { + var self = this; + jsonrpc("/web/dataset/call_kw/res.lang/sh_get_installed_lang", { + model: 'res.lang', + method: 'sh_get_installed_lang', + args: [], + kwargs: {}, + }).then(function (languages) { + self.languages_list = languages + self.selected_lang = session.user_context.lang + }); + } - async fetch_sh_get_installed_lang() { - var self = this; - jsonrpc("/web/dataset/call_kw/res.lang/sh_get_installed_lang", { - model: 'res.lang', - method: 'sh_get_installed_lang', - args: [], - kwargs: {}, - }).then(function (languages) { - self.languages_list = languages - self.selected_lang = session.user_context.lang - }); - } + onBeforeOpen() { + this.fetch_sh_get_installed_lang(); + } - onBeforeOpen() { - this.fetch_sh_get_installed_lang(); - } + change_sh_user_lang(e) { + var self = this; + var lang = e[0] + var self = this; - change_sh_user_lang(e){ - var self = this; - var lang = e[0] - var self = this; - - this.orm.write("res.users", [parseInt(session.user_context.uid)], { 'lang': lang }).then(function () { - self.actionService.doAction({ - name: 'Reload Context', - type: 'ir.actions.client', - tag: 'reload_context', - }); - }); - } + this.orm.write("res.users", [parseInt(session.user_context.uid)], { 'lang': lang }).then(function () { + self.actionService.doAction({ + name: 'Reload Context', + type: 'ir.actions.client', + tag: 'reload_context', + }); + }); + } } registry.category("systray").add("sh_entmate_theme.language_template", { Component: LanguageTemplate }); diff --git a/sh_backmate_theme_adv_enterprise/static/src/js/quick_create/quick_create.js b/sh_backmate_theme_adv_enterprise/static/src/js/quick_create/quick_create.js index 1ab6b30e5..09b210c8d 100644 --- a/sh_backmate_theme_adv_enterprise/static/src/js/quick_create/quick_create.js +++ b/sh_backmate_theme_adv_enterprise/static/src/js/quick_create/quick_create.js @@ -11,7 +11,7 @@ import { jsonrpc, RPCError } from "@web/core/network/rpc_service"; import { _t } from "@web/core/l10n/translation"; import { Many2XAutocomplete } from "@web/views/fields/relational_utils"; import { session } from "@web/session"; -import { Component,onWillStart,onWillUpdateProps,useState } from "@odoo/owl"; +import { Component, onWillStart, onWillUpdateProps, useState } from "@odoo/owl"; export class ModelSelection extends Component { @@ -28,6 +28,7 @@ ModelSelection.template = "sh_quick_create.ModelSelection"; export class QuickCreateWebsiteSystray extends Component { + static props = ["*"]; setup() { this.user = useService("user"); this.orm = useService("orm"); @@ -43,12 +44,12 @@ export class QuickCreateWebsiteSystray extends Component { this.state = useState({ showForm: false, quick_action_data: false, - modelId:false, - modelname:'Select Model', - IsEditMode:false, - icon:'fa fa-arrow-right', - sequence:1, - CurrentEditId:false, + modelId: false, + modelname: 'Select Model', + IsEditMode: false, + icon: 'fa fa-arrow-right', + sequence: 1, + CurrentEditId: false, }); } @@ -58,7 +59,7 @@ export class QuickCreateWebsiteSystray extends Component { AddNewQuickAction() { - console.log('=======modelname=======.',this.state.modelname) + console.log('=======modelname=======.', this.state.modelname) this.state.IsEditMode = false this.state.modelId = false this.state.modelname = 'Select Model' @@ -73,30 +74,30 @@ export class QuickCreateWebsiteSystray extends Component { async getActionItems(props) { jsonrpc("/get/quick/action/data", {} ).then((result) => { - this.state.quick_action_data=result[0] - this.state.modeldata=result[1] + this.state.quick_action_data = result[0] + this.state.modeldata = result[1] // this.state.quick_action_data=result[0] }); } - RecordEditQuickAction(ev,action_id){ + RecordEditQuickAction(ev, action_id) { ev.stopPropagation(); this.state.showForm = !this.state.showForm - this.state.CurrentEditId=action_id + this.state.CurrentEditId = action_id jsonrpc("/get/edit/quick/action/data", { - action_id:action_id + action_id: action_id }).then((result) => { - this.state.modelId=result[0].model_id - this.state.modelname=result[0].name - this.state.icon=result[0].icon - this.state.sequence=result[0].sequence + this.state.modelId = result[0].model_id + this.state.modelname = result[0].name + this.state.icon = result[0].icon + this.state.sequence = result[0].sequence }); } - async onActionSelectedEdit(ev,action){ + async onActionSelectedEdit(ev, action) { ev.preventDefault(); ev.stopPropagation(); if (action.model_id !== undefined) { @@ -107,38 +108,38 @@ export class QuickCreateWebsiteSystray extends Component { this.state.modelname = action.name this.state.CurrentEditId = action.id // extra - this.state.icon=action.icon - this.state.sequence=action.sequence + this.state.icon = action.icon + this.state.sequence = action.sequence this.state.showForm = !this.state.showForm } - async onActionSelected(ev,action){ + async onActionSelected(ev, action) { this.actionService.doAction({ type: 'ir.actions.act_window', // name: _t('Manage Questions Setting'), target: 'new', res_model: action.model_name, views: [[false, 'form']], - }); + }); } - async DeleteNewAction(){ + async DeleteNewAction() { await jsonrpc("/unlink/quick/action/data", { - action_id:this.state.CurrentEditId + action_id: this.state.CurrentEditId }).then((result) => { - this.state.CurrentEditId=false + this.state.CurrentEditId = false this.state.IsEditMode = false - this.state.showForm =false - this.state.modelId=false - this.state.modelname=false - this.state.icon='fa fa-car' - this.state.sequence=1 + this.state.showForm = false + this.state.modelId = false + this.state.modelname = false + this.state.icon = 'fa fa-car' + this.state.sequence = 1 this.getActionItems() }); } - async SaveAction(){ + async SaveAction() { let isEmpty = false; const formData = {}; const inputs = document.querySelectorAll('.sh_input_data'); @@ -148,56 +149,56 @@ export class QuickCreateWebsiteSystray extends Component { } formData[input.name] = input.value.trim(); }); - - if (isEmpty || this.state.modelname=='Select Model') { + + if (isEmpty || this.state.modelname == 'Select Model') { $('#quick_create_errors_msg').removeClass("d-none"); } // FOR SAVE AFTER EDIT - else if(this.state.IsEditMode){ + else if (this.state.IsEditMode) { formData['model_id'] = this.state.modelId; $('#quick_create_errors_msg').addClass('d-none'); jsonrpc("/update/quick/action", { 'data': formData, 'action_id': this.state.CurrentEditId, - }).then((result) => { + }).then((result) => { this.getActionItems() }); - this.state.showForm=false + this.state.showForm = false } // FOR SAVE WHEN NEW CREATE - else { + else { formData['model_id'] = this.state.modelId; - this.state.modelId=false - this.state.modelname=false + this.state.modelId = false + this.state.modelname = false $('#quick_create_errors_msg').addClass('d-none'); jsonrpc("/create/quick/action", { 'data': formData, - }).then((result) => { + }).then((result) => { this.getActionItems() }); - this.state.showForm=false + this.state.showForm = false } } - onUpdateModel(props){ - if (props){ - this.state.modelId=props[0].id - this.state.modelname=this.state.modeldata[props[0].id] - this.props.modelname=this.state.modeldata[props[0].id] + onUpdateModel(props) { + if (props) { + this.state.modelId = props[0].id + this.state.modelname = this.state.modeldata[props[0].id] + this.props.modelname = this.state.modeldata[props[0].id] } - else{ - this.state.modelId=false - this.state.modelname=false - this.props.modelname='' + else { + this.state.modelId = false + this.state.modelname = false + this.props.modelname = '' } } } QuickCreateWebsiteSystray.template = "sh_quick_create.QuickCreateWebsiteSystray"; -QuickCreateWebsiteSystray.components = { Dropdown, DropdownItem,ModelSelection }; +QuickCreateWebsiteSystray.components = { Dropdown, DropdownItem, ModelSelection }; // UserMenu.props = {}; export const systrayItem = { diff --git a/sh_backmate_theme_adv_enterprise/static/src/js/quick_menu.js b/sh_backmate_theme_adv_enterprise/static/src/js/quick_menu.js index e7544ea80..e3ecd3f66 100644 --- a/sh_backmate_theme_adv_enterprise/static/src/js/quick_menu.js +++ b/sh_backmate_theme_adv_enterprise/static/src/js/quick_menu.js @@ -16,236 +16,237 @@ import { onWillStart } from "@odoo/owl"; export class QuickMenuSh extends Component { static template = "quick.menu"; - - setup() { - super.setup() - this.orm = useService("orm"); - this.actionService = useService("action"); - this.action = this.props.action; - this.model = this.props.model; - this._search_def = $.Deferred(); - this.onWillStart() - this.sh_enable_quick_menu_mode = session.sh_enable_quick_menu_mode + static props = ["*"]; + setup() { + super.setup() + this.orm = useService("orm"); + this.actionService = useService("action"); + this.action = this.props.action; + this.model = this.props.model; + this._search_def = $.Deferred(); + this.onWillStart() + this.sh_enable_quick_menu_mode = session.sh_enable_quick_menu_mode - } + } - async render_quick_menulist_actions(quick_menus_html){ + async render_quick_menulist_actions(quick_menus_html) { - var self = this - var quick_menu_list_html = await renderToFragment( - 'quick.menulist.actions', { - quick_menulist_actions: quick_menus_html, - remove_quick_menu: function (ev){ - self.remove_quick_menu(ev)}, - _onSearchResultsNavigate : function (ev){ - self._onSearchResultsNavigate(ev)}, - }); - $(".sh_wqm_quick_menu_submenu_list_cls").html(quick_menu_list_html) - } + var self = this + var quick_menu_list_html = await renderToFragment( + 'quick.menulist.actions', { + quick_menulist_actions: quick_menus_html, + remove_quick_menu: function (ev) { + self.remove_quick_menu(ev) + }, + _onSearchResultsNavigate: function (ev) { + self._onSearchResultsNavigate(ev) + }, + }); + $(".sh_wqm_quick_menu_submenu_list_cls").html(quick_menu_list_html) + } - async render_quick_menulist(quick_menus_html){ + async render_quick_menulist(quick_menus_html) { - var self = this - var quick_menu_list_html = await renderToFragment( - 'quick.menulist', { - quick_menulist_actions: quick_menus_html, - remove_quick_menu: function (ev){ - self.remove_quick_menu(ev) - }, + var self = this + var quick_menu_list_html = await renderToFragment( + 'quick.menulist', { + quick_menulist_actions: quick_menus_html, + remove_quick_menu: function (ev) { + self.remove_quick_menu(ev) + }, - }); - $(".sh_wqm_quick_menu_submenu_list_cls").html(quick_menu_list_html) - } + }); + $(".sh_wqm_quick_menu_submenu_list_cls").html(quick_menu_list_html) + } - async render_quick_menulist_no_menu(){ - - var final_quick_menu_list_html = renderToFragment( - 'quick.menulist', { - no_menu: 1 - }); - $(".sh_wqm_quick_menu_submenu_list_cls").html(final_quick_menu_list_html) - } + async render_quick_menulist_no_menu() { - async onWillStart() { - var self = this; - var quick_menus_html = await jsonrpc("/web/dataset/call_kw/sh.wqm.quick.menu/get_quick_menu_data", { - model: 'sh.wqm.quick.menu', - method: 'get_quick_menu_data', - args: ['', ['name', 'sh_url']], - kwargs: { - }, - }); + var final_quick_menu_list_html = renderToFragment( + 'quick.menulist', { + no_menu: 1 + }); + $(".sh_wqm_quick_menu_submenu_list_cls").html(final_quick_menu_list_html) + } - if (quick_menus_html.length > 0) { - if(quick_menus_html.length > 13){ - this.render_quick_menulist_actions(quick_menus_html) - }else{ - this.render_quick_menulist(quick_menus_html) - } - } + async onWillStart() { + var self = this; + var quick_menus_html = await jsonrpc("/web/dataset/call_kw/sh.wqm.quick.menu/get_quick_menu_data", { + model: 'sh.wqm.quick.menu', + method: 'get_quick_menu_data', + args: ['', ['name', 'sh_url']], + kwargs: { + }, + }); - else { - this.render_quick_menulist_no_menu() - } - - } - - open_quick_menu(e) { - this.onWillStart() - $('.o_user_bookmark_menu').addClass('bookmark_active') - if ($('.sh_wqm_quick_menu_submenu_list_cls').css('display') == 'none') - { - $('.sh_wqm_quick_menu_submenu_list_cls').css('display','revert') - }else{ - $('.sh_wqm_quick_menu_submenu_list_cls').css('display','none') - $('.o_user_bookmark_menu').removeClass('bookmark_active') + if (quick_menus_html.length > 0) { + if (quick_menus_html.length > 13) { + this.render_quick_menulist_actions(quick_menus_html) + } else { + this.render_quick_menulist(quick_menus_html) } - - // close other popup - $('.sh_user_language_list_cls').css("display","none") - $('.todo_layout').removeClass("sh_theme_model"); - $('.sh_calc_util').removeClass("active") - $(".sh_calc_results").html(""); - } - async _searchData() { - var query = $(".sh_bookmark_search").val(); - var self = this; - var menus = await jsonrpc("/web/dataset/call_kw/sh.wqm.quick.menu/get_search_result", { - model: 'sh.wqm.quick.menu', - method: 'get_search_result', - args: [[query]], - kwargs:{ }, - }); - if (menus.length > 0) { - var self = this - var quick_menu_list_html = await renderToFragment( - 'quick.menulist', { - quick_menulist_actions:menus, - remove_quick_menu: function (ev){ - self.remove_quick_menu(ev) - }, - }); - $(".sh_search_result").html(quick_menu_list_html) - } else { - self.render_quick_menulist_no_menu() - } + else { + this.render_quick_menulist_no_menu() } - _onSearchResultsNavigate(event) { - this._search_def.reject(); - this._search_def = $.Deferred(); - setTimeout(this._search_def.resolve.bind(this._search_def), 50); - this._search_def.done(this._searchData.bind(this)); + } + + open_quick_menu(e) { + this.onWillStart() + $('.o_user_bookmark_menu').addClass('bookmark_active') + if ($('.sh_wqm_quick_menu_submenu_list_cls').css('display') == 'none') { + $('.sh_wqm_quick_menu_submenu_list_cls').css('display', 'revert') + } else { + $('.sh_wqm_quick_menu_submenu_list_cls').css('display', 'none') + $('.o_user_bookmark_menu').removeClass('bookmark_active') } - async remove_quick_menu(e) { - var self = this; - var id = parseInt(e.target.dataset.id); - if (id !== NaN) { - var quick_menus_html = await jsonrpc("/web/dataset/call_kw/sh.wqm.quick.menu/remove_quick_menu_data", { - model: 'sh.wqm.quick.menu', - method: 'remove_quick_menu_data', - args: ['', id], - kwargs:{}, - }).then(function (res) { - if (res.id) { - if (window.location.href == res.sh_url) { - $('.sh_bookmark').removeClass('active') - } - if (res.final_quick_menu_list.length > 0) { - if(res.final_quick_menu_list.length > 13){ - self.render_quick_menulist_actions(res.final_quick_menu_list) - }else{ - self.render_quick_menulist(res.final_quick_menu_list) - } + // close other popup + $('.sh_user_language_list_cls').css("display", "none") + $('.todo_layout').removeClass("sh_theme_model"); + $('.sh_calc_util').removeClass("active") + $(".sh_calc_results").html(""); + + } + + async _searchData() { + var query = $(".sh_bookmark_search").val(); + var self = this; + var menus = await jsonrpc("/web/dataset/call_kw/sh.wqm.quick.menu/get_search_result", { + model: 'sh.wqm.quick.menu', + method: 'get_search_result', + args: [[query]], + kwargs: {}, + }); + if (menus.length > 0) { + var self = this + var quick_menu_list_html = await renderToFragment( + 'quick.menulist', { + quick_menulist_actions: menus, + remove_quick_menu: function (ev) { + self.remove_quick_menu(ev) + }, + }); + $(".sh_search_result").html(quick_menu_list_html) + } else { + self.render_quick_menulist_no_menu() + } + } + + _onSearchResultsNavigate(event) { + this._search_def.reject(); + this._search_def = $.Deferred(); + setTimeout(this._search_def.resolve.bind(this._search_def), 50); + this._search_def.done(this._searchData.bind(this)); + } + + async remove_quick_menu(e) { + var self = this; + var id = parseInt(e.target.dataset.id); + if (id !== NaN) { + var quick_menus_html = await jsonrpc("/web/dataset/call_kw/sh.wqm.quick.menu/remove_quick_menu_data", { + model: 'sh.wqm.quick.menu', + method: 'remove_quick_menu_data', + args: ['', id], + kwargs: {}, + }).then(function (res) { + if (res.id) { + if (window.location.href == res.sh_url) { + $('.sh_bookmark').removeClass('active') + } + if (res.final_quick_menu_list.length > 0) { + if (res.final_quick_menu_list.length > 13) { + self.render_quick_menulist_actions(res.final_quick_menu_list) } else { - self.render_quick_menulist_no_menu() + self.render_quick_menulist(res.final_quick_menu_list) } - } - }); - } - return false; - } - - getUrlVars() { - var vars = [], hash; - var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&'); - for (var i = 0; i < hashes.length; i++) { - hash = hashes[i].split('='); - vars.push(hash[0]); - vars[hash[0]] = hash[1]; - } - return vars; - } - - getUrl() { - return window.location.href; - } - - async getMenuRecord() { - - var action_id = this.actionService.currentController.action.id - - var model = this.actionService.currentController.action.res_model - if(!model){ - model = this.actionService.currentController.action.context.params.id - } - - if (this.actionService.currentController.view.type == 'form') { - var res_id = this.actionService.currentController.props.resId - } - var sh_url = this.getUrl() - - var self = this; - - var search_result = await jsonrpc("/web/dataset/call_kw/sh.wqm.quick.menu/set_quick_url", { - model: 'sh.wqm.quick.menu', - method: 'set_quick_url', - args: ['', sh_url, model, res_id, action_id], - kwargs: { - }, - }); - return search_result - } - - on_click(ev) { - - var self = this; - this.getMenuRecord().then(function (rec) { - - $('.sh_bookmark').addClass('active') - if (rec.is_set_quick_menu) { - if (rec.final_quick_menu_list.length > 0) { - - if(rec.final_quick_menu_list.length > 13){ - self.render_quick_menulist_actions(rec.final_quick_menu_list) - }else{ - self.render_quick_menulist(rec.final_quick_menu_list) - } - } else { - self.render_quick_menulist_no_menu() - } - - - } else { - $('.sh_bookmark').removeClass('active') - if (rec.final_quick_menu_list.length > 0) { - if(rec.final_quick_menu_list.length > 13){ - self.render_quick_menulist_actions(rec.final_quick_menu_list) - }else{ - self.render_quick_menulist(rec.final_quick_menu_list) - - } - } else { self.render_quick_menulist_no_menu() } } }); } + return false; + } + + getUrlVars() { + var vars = [], hash; + var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&'); + for (var i = 0; i < hashes.length; i++) { + hash = hashes[i].split('='); + vars.push(hash[0]); + vars[hash[0]] = hash[1]; + } + return vars; + } + + getUrl() { + return window.location.href; + } + + async getMenuRecord() { + + var action_id = this.actionService.currentController.action.id + + var model = this.actionService.currentController.action.res_model + if (!model) { + model = this.actionService.currentController.action.context.params.id + } + + if (this.actionService.currentController.view.type == 'form') { + var res_id = this.actionService.currentController.props.resId + } + var sh_url = this.getUrl() + + var self = this; + + var search_result = await jsonrpc("/web/dataset/call_kw/sh.wqm.quick.menu/set_quick_url", { + model: 'sh.wqm.quick.menu', + method: 'set_quick_url', + args: ['', sh_url, model, res_id, action_id], + kwargs: { + }, + }); + return search_result + } + + on_click(ev) { + + var self = this; + this.getMenuRecord().then(function (rec) { + + $('.sh_bookmark').addClass('active') + if (rec.is_set_quick_menu) { + if (rec.final_quick_menu_list.length > 0) { + + if (rec.final_quick_menu_list.length > 13) { + self.render_quick_menulist_actions(rec.final_quick_menu_list) + } else { + self.render_quick_menulist(rec.final_quick_menu_list) + } + } else { + self.render_quick_menulist_no_menu() + } + + + } else { + $('.sh_bookmark').removeClass('active') + if (rec.final_quick_menu_list.length > 0) { + if (rec.final_quick_menu_list.length > 13) { + self.render_quick_menulist_actions(rec.final_quick_menu_list) + } else { + self.render_quick_menulist(rec.final_quick_menu_list) + + } + + } else { + self.render_quick_menulist_no_menu() + } + } + }); + } } registry.category("systray").add("sh_entmate_theme.QuickMenuSh", { Component: QuickMenuSh }, { sequence: 25 }); \ No newline at end of file diff --git a/sh_backmate_theme_adv_enterprise/static/src/js/recently_viewed_records/systray_recent_records.js b/sh_backmate_theme_adv_enterprise/static/src/js/recently_viewed_records/systray_recent_records.js index 104cb6d52..8c06966de 100644 --- a/sh_backmate_theme_adv_enterprise/static/src/js/recently_viewed_records/systray_recent_records.js +++ b/sh_backmate_theme_adv_enterprise/static/src/js/recently_viewed_records/systray_recent_records.js @@ -7,7 +7,7 @@ import { session } from "@web/session"; import { Dropdown } from '@web/core/dropdown/dropdown'; export class RecentRecordsSystray extends Component { - + static props = ["*"]; setup() { this.orm = useService("orm"); this.actionService = useService("action"); @@ -27,7 +27,7 @@ export class RecentRecordsSystray extends Component { this.removeRecord = this.removeRecord.bind(this); this.searchRecords = this.searchRecords.bind(this); - onMounted( () => { + onMounted(() => { document.addEventListener('click', this.handleDocumentClick); }); @@ -38,7 +38,7 @@ export class RecentRecordsSystray extends Component { handleDocumentClick() { if ($('.o_recent_records_dropdown').css('display') == 'block') { - $('.o_recent_records_dropdown').css('display', 'none') + $('.o_recent_records_dropdown').css('display', 'none') } } @@ -115,7 +115,7 @@ export class RecentRecordsSystray extends Component { this.render(true) } - async removeRecord(record){ + async removeRecord(record) { debugger; await this.orm.unlink("sh.recent.records", [record.id]); await this.get_records() diff --git a/sh_backmate_theme_adv_enterprise/static/src/js/theme_config_custom.js b/sh_backmate_theme_adv_enterprise/static/src/js/theme_config_custom.js index 03447b22f..2ca8910db 100644 --- a/sh_backmate_theme_adv_enterprise/static/src/js/theme_config_custom.js +++ b/sh_backmate_theme_adv_enterprise/static/src/js/theme_config_custom.js @@ -9,814 +9,824 @@ import { renderToElement } from "@web/core/utils/render"; export class ThemeConfigurationTemplate extends Component { static template = "ThemeConfigurationTemplate"; - + static props = ["*"]; async setup() { super.setup() this.orm = useService("orm"); let userAgent = navigator.userAgent; - let browserName; - var isSafari = /constructor/i.test(window.HTMLElement) || (function (p) { return p.toString() === "[object SafariRemoteNotification]"; })(!window['safari'] || (typeof safari !== 'undefined' && window['safari'].pushNotification)); - var iOS = !window.MSStream && /iPad|iPhone|iPod/.test(navigator.userAgent); - var is_iPad = navigator.userAgent.match(/iPad/i) != null; - var is_safari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); - if(is_safari){ - $('.o_web_client').addClass('backmate_safari') - } - if(iOS && !is_iPad){ - if(userAgent.match(/chrome|chromium|crios/i)){ - $('.o_web_client').addClass("sh_iphone_chrome") - }else{ - $('.o_web_client').addClass("sh_iphone_safari") - } - } + let browserName; + var isSafari = /constructor/i.test(window.HTMLElement) || (function (p) { return p.toString() === "[object SafariRemoteNotification]"; })(!window['safari'] || (typeof safari !== 'undefined' && window['safari'].pushNotification)); + var iOS = !window.MSStream && /iPad|iPhone|iPod/.test(navigator.userAgent); + var is_iPad = navigator.userAgent.match(/iPad/i) != null; + var is_safari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); + if (is_safari) { + $('.o_web_client').addClass('backmate_safari') + } + if (iOS && !is_iPad) { + if (userAgent.match(/chrome|chromium|crios/i)) { + $('.o_web_client').addClass("sh_iphone_chrome") + } else { + $('.o_web_client').addClass("sh_iphone_safari") + } + } this.user = useService("user"); var color_change = false; - if (!$('.backmate_theme_layout').length){ + if (!$('.backmate_theme_layout').length) { var self = this - var theme_configuration_html = renderToElement('ThemeConfiguration',{ - _click_sh_theme_design: function (ev){ - self._click_sh_theme_design(ev) - }, - _click_close_setting: function(ev){ - $('.backmate_theme_layout').removeClass('sh_theme_model'); - }, - _click_pre_theme_color_box(ev){ - var pre_color_id = $(ev.currentTarget).attr('id'); + var theme_configuration_html = renderToElement('ThemeConfiguration', { + _click_sh_theme_design: function (ev) { + self._click_sh_theme_design(ev) + }, + _click_close_setting: function (ev) { + $('.backmate_theme_layout').removeClass('sh_theme_model'); + }, + _click_pre_theme_color_box(ev) { + var pre_color_id = $(ev.currentTarget).attr('id'); - $.each($('.pre_theme_color_box'), function (event) { + $.each($('.pre_theme_color_box'), function (event) { - $(event).removeClass('active'); - $(event).find('input[name="preThemeColor"]').attr('checked', false); - }) - $(ev.currentTarget).addClass('active'); - $(ev.currentTarget).find('input[name="preThemeColor"]').attr('checked', true); - color_change = true; - jsonrpc('/update/theme_style_pre_color',{'pre_color_id': pre_color_id}).then(function (data) { - location.reload(); - }); - }, - /*_click_theme_color_box(ev){ - var color_id = $(ev.currentTarget).attr('id'); + $(event).removeClass('active'); + $(event).find('input[name="preThemeColor"]').attr('checked', false); + }) + $(ev.currentTarget).addClass('active'); + $(ev.currentTarget).find('input[name="preThemeColor"]').attr('checked', true); + color_change = true; + jsonrpc('/update/theme_style_pre_color', { 'pre_color_id': pre_color_id }).then(function (data) { + location.reload(); + }); + }, + /*_click_theme_color_box(ev){ + var color_id = $(ev.currentTarget).attr('id'); - $.each($('.theme_color_box'), function (event) { - // - $(event).removeClass('active'); - $(event).find('input[name="themeColor"]').attr('checked', false); - }) - $(ev.currentTarget).addClass('active'); - $(ev.currentTarget).find('input[name="themeColor"]').attr('checked', true); + $.each($('.theme_color_box'), function (event) { + // + $(event).removeClass('active'); + $(event).find('input[name="themeColor"]').attr('checked', false); + }) + $(ev.currentTarget).addClass('active'); + $(ev.currentTarget).find('input[name="themeColor"]').attr('checked', true); - color_change = true; - jsonrpc('/update/theme_style_color',{'color_id': color_id}).then(function (data) { - location.reload(); - }); - },*/ - _click_theme_style_box(ev){ - $.each($('.theme_style_box'), function (event) { - $(event).removeClass('active'); - $(event).find('input[name="themeStyle"]').attr('checked', false); - }) + color_change = true; + jsonrpc('/update/theme_style_color',{'color_id': color_id}).then(function (data) { + location.reload(); + }); + },*/ + _click_theme_style_box(ev) { + $.each($('.theme_style_box'), function (event) { + $(event).removeClass('active'); + $(event).find('input[name="themeStyle"]').attr('checked', false); + }) - var color_id = $(ev.currentTarget).attr('id'); + var color_id = $(ev.currentTarget).attr('id'); - $(ev.currentTarget).addClass('active'); - $(ev.currentTarget).find('input[name="themeStyle"]').attr('checked', true); - color_change = true; - jsonrpc('/update/theme_style',{'color_id': color_id}).then(function (data) { - location.reload(); - }); + $(ev.currentTarget).addClass('active'); + $(ev.currentTarget).find('input[name="themeStyle"]').attr('checked', true); + color_change = true; + jsonrpc('/update/theme_style', { 'color_id': color_id }).then(function (data) { + location.reload(); + }); - }, - _click_discard_color : function(ev){ - location.reload(); - }, - async _click_button_style_box(ev){ - var button_style = $(ev.currentTarget).attr('id'); - $.each($('.theme_style_box'), function (event) { - $(event).removeClass('active'); - $(event).find('input[name="button_style"]').attr('checked', false); - }) - $(ev.currentTarget).addClass('active'); - $(ev.currentTarget).find('input[name="button_style"]').attr('checked', true); - var result = await self.orm.write("sh.back.theme.config.settings", [1], { - button_style : button_style}); - if (result){ - location.reload(); - } - }, - async _click_separator_style_box(ev){ - var separator_style = $(ev.currentTarget).attr('id'); - $.each($('.theme_style_box'), function (event) { - $(event).removeClass('active'); - $(event).find('input[name="separator_style"]').attr('checked', false); - }) - $(ev.currentTarget).addClass('active'); - $(ev.currentTarget).find('input[name="separator_style"]').attr('checked', true); - var result = await self.orm.write("sh.back.theme.config.settings", [1], { - separator_style : separator_style}); - if (result){ - location.reload(); - } - }, - async _click_kanban_style_box(ev){ - var kanban_style = $(ev.currentTarget).attr('id'); - $.each($('.theme_style_box'), function (event) { - $(event).removeClass('active'); - $(event).find('input[name="kanban_style"]').attr('checked', false); - }) - $(ev.currentTarget).addClass('active'); - $(ev.currentTarget).find('input[name="kanban_style"]').attr('checked', true); - var result = await self.orm.write("sh.back.theme.config.settings", [1], { - kanban_box_style : kanban_style}); - if (result){ - location.reload(); - } - }, - async _click_listview_style_box(ev){ - var listview_style = $(ev.currentTarget).attr('id'); - $("#listview_table_id").find(".theme_style_box").removeClass('active') - $("#listview_table_id").find(".theme_style_box").find('input[name="listview_style"]').attr('checked', false); - $(ev.currentTarget).addClass('active'); - $(ev.currentTarget).find('input[name="listview_style"]').attr('checked', true); - }, - async _click_tab_style_box(ev){ - var tab_style = $(ev.currentTarget).attr('id'); - $.each($('.theme_style_box'), function (event) { - $(event).removeClass('active'); - $(event).find('input[name="tab_style"]').attr('checked', false); - }) - $(ev.currentTarget).addClass('active'); - $(ev.currentTarget).find('input[name="tab_style"]').attr('checked', true); - var result = await self.orm.write("sh.back.theme.config.settings", [1], { - horizontal_tab_style : tab_style}); - if (result){ - location.reload(); - } + }, + _click_discard_color: function (ev) { + location.reload(); + }, + async _click_button_style_box(ev) { + var button_style = $(ev.currentTarget).attr('id'); + $.each($('.theme_style_box'), function (event) { + $(event).removeClass('active'); + $(event).find('input[name="button_style"]').attr('checked', false); + }) + $(ev.currentTarget).addClass('active'); + $(ev.currentTarget).find('input[name="button_style"]').attr('checked', true); + var result = await self.orm.write("sh.back.theme.config.settings", [1], { + button_style: button_style + }); + if (result) { + location.reload(); + } + }, + async _click_separator_style_box(ev) { + var separator_style = $(ev.currentTarget).attr('id'); + $.each($('.theme_style_box'), function (event) { + $(event).removeClass('active'); + $(event).find('input[name="separator_style"]').attr('checked', false); + }) + $(ev.currentTarget).addClass('active'); + $(ev.currentTarget).find('input[name="separator_style"]').attr('checked', true); + var result = await self.orm.write("sh.back.theme.config.settings", [1], { + separator_style: separator_style + }); + if (result) { + location.reload(); + } + }, + async _click_kanban_style_box(ev) { + var kanban_style = $(ev.currentTarget).attr('id'); + $.each($('.theme_style_box'), function (event) { + $(event).removeClass('active'); + $(event).find('input[name="kanban_style"]').attr('checked', false); + }) + $(ev.currentTarget).addClass('active'); + $(ev.currentTarget).find('input[name="kanban_style"]').attr('checked', true); + var result = await self.orm.write("sh.back.theme.config.settings", [1], { + kanban_box_style: kanban_style + }); + if (result) { + location.reload(); + } + }, + async _click_listview_style_box(ev) { + var listview_style = $(ev.currentTarget).attr('id'); + $("#listview_table_id").find(".theme_style_box").removeClass('active') + $("#listview_table_id").find(".theme_style_box").find('input[name="listview_style"]').attr('checked', false); + $(ev.currentTarget).addClass('active'); + $(ev.currentTarget).find('input[name="listview_style"]').attr('checked', true); + }, + async _click_tab_style_box(ev) { + var tab_style = $(ev.currentTarget).attr('id'); + $.each($('.theme_style_box'), function (event) { + $(event).removeClass('active'); + $(event).find('input[name="tab_style"]').attr('checked', false); + }) + $(ev.currentTarget).addClass('active'); + $(ev.currentTarget).find('input[name="tab_style"]').attr('checked', true); + var result = await self.orm.write("sh.back.theme.config.settings", [1], { + horizontal_tab_style: tab_style + }); + if (result) { + location.reload(); + } - }, - async _click_form_element_style_box(ev){ - var form_element_style = $(ev.currentTarget).attr('id'); - $.each($('.theme_style_box'), function (event) { - $(event).removeClass('active'); - $(event).find('input[name="form_element_style"]').attr('checked', false); - }) - $(ev.currentTarget).addClass('active'); - $(ev.currentTarget).find('input[name="form_element_style"]').attr('checked', true); - var result = await self.orm.write("sh.back.theme.config.settings", [1], { - form_element_style : form_element_style}); - if (result){ - location.reload(); - } - }, - async _click_breadcrumbs_style_box(ev){ - var breadcrumbs_style = $(ev.currentTarget).attr('id'); - $.each($('.theme_style_box'), function (event) { - $(event).removeClass('active'); - $(event).find('input[name="breadcrumbs_style"]').attr('checked', false); - }) - $(ev.currentTarget).addClass('active'); - $(ev.currentTarget).find('input[name="breadcrumbs_style"]').attr('checked', true); - var result = await self.orm.write("sh.back.theme.config.settings", [1], { - breadcrumb_style : breadcrumbs_style}); - if (result){ - location.reload(); - } - }, - async _click_radio_button_style_box(ev){ - var radio_button_style = $(ev.currentTarget).attr('id'); - $.each($('.theme_style_box'), function (event) { - $(event).removeClass('active'); - $(event).find('input[name="radio_button_style"]').attr('checked', false); - }) - $(ev.currentTarget).addClass('active'); - $(ev.currentTarget).find('input[name="radio_button_style"]').attr('checked', true); - var result = await self.orm.write("sh.back.theme.config.settings", [1], { - radio_btn_style : radio_button_style}); - if (result){ - location.reload(); - } - }, - async _click_checkbox_style_box(ev){ - var checkbox_style = $(ev.currentTarget).attr('id'); - $.each($('.theme_style_box'), function (event) { - $(event).removeClass('active'); - $(event).find('input[name="checkbox_style"]').attr('checked', false); - }) - $(ev.currentTarget).addClass('active'); - $(ev.currentTarget).find('input[name="checkbox_style"]').attr('checked', true); - var result = await self.orm.write("sh.back.theme.config.settings", [1], { - checkbox_style : checkbox_style}); - if (result){ - location.reload(); - } + }, + async _click_form_element_style_box(ev) { + var form_element_style = $(ev.currentTarget).attr('id'); + $.each($('.theme_style_box'), function (event) { + $(event).removeClass('active'); + $(event).find('input[name="form_element_style"]').attr('checked', false); + }) + $(ev.currentTarget).addClass('active'); + $(ev.currentTarget).find('input[name="form_element_style"]').attr('checked', true); + var result = await self.orm.write("sh.back.theme.config.settings", [1], { + form_element_style: form_element_style + }); + if (result) { + location.reload(); + } + }, + async _click_breadcrumbs_style_box(ev) { + var breadcrumbs_style = $(ev.currentTarget).attr('id'); + $.each($('.theme_style_box'), function (event) { + $(event).removeClass('active'); + $(event).find('input[name="breadcrumbs_style"]').attr('checked', false); + }) + $(ev.currentTarget).addClass('active'); + $(ev.currentTarget).find('input[name="breadcrumbs_style"]').attr('checked', true); + var result = await self.orm.write("sh.back.theme.config.settings", [1], { + breadcrumb_style: breadcrumbs_style + }); + if (result) { + location.reload(); + } + }, + async _click_radio_button_style_box(ev) { + var radio_button_style = $(ev.currentTarget).attr('id'); + $.each($('.theme_style_box'), function (event) { + $(event).removeClass('active'); + $(event).find('input[name="radio_button_style"]').attr('checked', false); + }) + $(ev.currentTarget).addClass('active'); + $(ev.currentTarget).find('input[name="radio_button_style"]').attr('checked', true); + var result = await self.orm.write("sh.back.theme.config.settings", [1], { + radio_btn_style: radio_button_style + }); + if (result) { + location.reload(); + } + }, + async _click_checkbox_style_box(ev) { + var checkbox_style = $(ev.currentTarget).attr('id'); + $.each($('.theme_style_box'), function (event) { + $(event).removeClass('active'); + $(event).find('input[name="checkbox_style"]').attr('checked', false); + }) + $(ev.currentTarget).addClass('active'); + $(ev.currentTarget).find('input[name="checkbox_style"]').attr('checked', true); + var result = await self.orm.write("sh.back.theme.config.settings", [1], { + checkbox_style: checkbox_style + }); + if (result) { + location.reload(); + } - }, - async _click_scrollbar_style_box(ev){ - var scrollbar_style = $(ev.currentTarget).attr('id'); - $.each($('.theme_style_box'), function (event) { - $(event).removeClass('active'); - $(event).find('input[name="scrollbar_style"]').attr('checked', false); - }) - $(ev.currentTarget).addClass('active'); - $(ev.currentTarget).find('input[name="scrollbar_style"]').attr('checked', true); - var result = await self.orm.write("sh.back.theme.config.settings", [1], { - scrollbar_style : scrollbar_style}); - if (result){ - location.reload(); - } - }, - async _click_font_icon_style_box(ev){ - var font_icon_style = $(ev.currentTarget).attr('id'); - $.each($('.theme_style_box'), function (event) { - $(event).removeClass('active'); - $(event).find('input[name="font_icon_style"]').attr('checked', false); - }) - $(ev.currentTarget).addClass('active'); - $(ev.currentTarget).find('input[name="font_icon_style"]').attr('checked', true); - var result = await self.orm.write("sh.back.theme.config.settings", [1], { - backend_all_icon_style : font_icon_style}); - if (result){ + }, + async _click_scrollbar_style_box(ev) { + var scrollbar_style = $(ev.currentTarget).attr('id'); + $.each($('.theme_style_box'), function (event) { + $(event).removeClass('active'); + $(event).find('input[name="scrollbar_style"]').attr('checked', false); + }) + $(ev.currentTarget).addClass('active'); + $(ev.currentTarget).find('input[name="scrollbar_style"]').attr('checked', true); + var result = await self.orm.write("sh.back.theme.config.settings", [1], { + scrollbar_style: scrollbar_style + }); + if (result) { + location.reload(); + } + }, + async _click_font_icon_style_box(ev) { + var font_icon_style = $(ev.currentTarget).attr('id'); + $.each($('.theme_style_box'), function (event) { + $(event).removeClass('active'); + $(event).find('input[name="font_icon_style"]').attr('checked', false); + }) + $(ev.currentTarget).addClass('active'); + $(ev.currentTarget).find('input[name="font_icon_style"]').attr('checked', true); + var result = await self.orm.write("sh.back.theme.config.settings", [1], { + backend_all_icon_style: font_icon_style + }); + if (result) { + location.reload(); + } + }, + _click_save_color: async function (ev) { + if (color_change == false) { + var is_used_google_font = false + var primary_color_id = $('#primary_color_id').val(); + var secondary_color_id = $('#secondary_color_id').val(); + var kanban_box_style = $('#kanban_box_style').val(); + var header_background_color = $("#header_background_color").val(); + var header_font_color = $("#header_font_color").val(); + var body_background_color = $("#body_background_color").val(); + var body_font_family = $("#body_font_family").val(); + var body_google_font_family = $("#body_google_font_family").val(); + if (body_font_family == "custom_google_font") { + is_used_google_font = true + } + else { + body_google_font_family = 'Muli' + } + + var body_background_type = $("input[name='body_background_type']:checked").val(); + var header_background_type = $("input[name='header_background_type']:checked").val(); + + var button_style = $("#button_style").val(); + var separator_style = $("#separator_style").val(); + var separator_color = $("#separator_color").val(); + var icon_style = $("input[name='app_icon_style']:checked").val(); + + var backend_all_icon_style = $("#font_awesome_icon_style").val(); + var dual_tone_icon_color_1 = $("#dual_tone_icon_color_1").val(); + var dual_tone_icon_color_2 = $("#dual_tone_icon_color_2").val(); + var body_background_img = $('#body_background_img').val(); + var sidebar_font_color = $('#sidebar_font_color').val(); + var sidebar_background_color = $('#sidebar_background_color').val(); + var sidebar_background_style = $("input[name='sidebar_background_style']:checked").val(); + var sidebar_background_img = $('#sidebar_background_img').val(); + var sidebar_collapse_style = $("input[name='sidebar_collapse_style']:checked").val(); + var predefined_list_view_boolean = $("#predefined_list_view_boolean").prop("checked"); + var predefined_list_view_style = $("input[name='listview_style']:checked").val(); + var list_view_border = $("#list_view_border").val(); + var list_view_even_row_color = $("#list_view_even_row_color").val(); + var list_view_odd_row_color = $("#list_view_odd_row_color").val(); + var list_view_is_hover_row = $("#list_view_is_hover_row").prop("checked"); + var list_view_hover_bg_color = $("#list_view_hover_bg_color").val(); + var login_page_style = $("input[name='login_style']:checked").val(); + var login_page_style_comp_logo = $("#login_page_style_comp_logo").prop("checked"); + var login_page_background_type = $("input[name='login_page_background_type']:checked").val(); + var login_page_box_color = $("#login_page_box_color").val(); + var login_page_background_color = $("#login_page_background_color").val(); + + var is_sticky_form = $("#is_sticky_form").prop("checked"); + var is_sticky_list = $("#is_sticky_list").prop("checked"); + var is_sticky_list_inside_form = $("#is_sticky_list_inside_form").prop("checked"); + var is_sticky_pivot = $("#is_sticky_pivot").prop("checked"); + + var tab_style_mobile = $("input[name='tab_mobile_style']:checked").val(); + var horizontal_tab_style = $("#horizontal_tab_style").val(); + + var navbar_style = $("input[name='navbar_style']:checked").val(); + var search_style = $("input[name='search_style']:checked").val(); + var progress_style = $("#progress_style").val(); + var progress_height = $("#progress_height").val(); + var progress_color = $("#progress_color").val(); + + var result = await self.orm.write("sh.back.theme.config.settings", [1], { + 'primary_color': primary_color_id, + 'kanban_box_style': kanban_box_style, + 'secondary_color': secondary_color_id, + 'header_background_color': header_background_color, + 'header_font_color': header_font_color, + 'body_background_color': body_background_color, + 'body_font_family': body_font_family, + 'is_used_google_font': is_used_google_font, + 'body_google_font_family': body_google_font_family, + 'body_background_type': body_background_type, + 'header_background_type': header_background_type, + 'button_style': button_style, + 'separator_style': separator_style, + 'separator_color': separator_color, + 'icon_style': icon_style, + 'dual_tone_icon_color_1': dual_tone_icon_color_1, + 'dual_tone_icon_color_2': dual_tone_icon_color_2, + 'sidebar_font_color': sidebar_font_color, + 'sidebar_background_style': sidebar_background_style, + 'sidebar_background_color': sidebar_background_color, + 'sidebar_collapse_style': sidebar_collapse_style, + 'predefined_list_view_boolean': predefined_list_view_boolean, + 'predefined_list_view_style': predefined_list_view_style, + 'list_view_border': list_view_border, + 'list_view_even_row_color': list_view_even_row_color, + 'list_view_odd_row_color': list_view_odd_row_color, + 'list_view_is_hover_row': list_view_is_hover_row, + 'list_view_hover_bg_color': list_view_hover_bg_color, + 'login_page_style': login_page_style, + 'login_page_style_comp_logo': login_page_style_comp_logo, + 'login_page_background_type': login_page_background_type, + 'login_page_box_color': login_page_box_color, + 'login_page_background_color': login_page_background_color, + 'is_sticky_form': is_sticky_form, + 'is_sticky_list': is_sticky_list, + 'is_sticky_list_inside_form': is_sticky_list_inside_form, + 'is_sticky_pivot': is_sticky_pivot, + 'horizontal_tab_style': horizontal_tab_style, + 'search_style': search_style, + 'navbar_style': navbar_style, + 'progress_style': progress_style, + 'progress_height': progress_height, + 'progress_color': progress_color, + 'backend_all_icon_style': backend_all_icon_style, + }); + if (result) { + location.reload(); + } + + var form = $('#body_background_img')[0]; + var data = new FormData(form); + $.ajax({ + type: "POST", + enctype: 'multipart/form-data', + url: "/api/upload/multi", + data: data, + processData: false, + contentType: false, + cache: false, + timeout: 600000, + success: function (data) { + + console.log("SUCCESS : ", data); + if (data) { + setTimeout(function () { location.reload(); - } - }, - _click_save_color : async function(ev){ - if (color_change == false) { - var is_used_google_font = false - var primary_color_id = $('#primary_color_id').val(); - var secondary_color_id = $('#secondary_color_id').val(); - var kanban_box_style = $('#kanban_box_style').val(); - var header_background_color = $("#header_background_color").val(); - var header_font_color = $("#header_font_color").val(); - var body_background_color = $("#body_background_color").val(); - var body_font_family = $("#body_font_family").val(); - var body_google_font_family = $("#body_google_font_family").val(); - if (body_font_family == "custom_google_font" ){ - is_used_google_font = true - } - else{ - body_google_font_family = 'Muli' + + }, 5000); } - var body_background_type = $("input[name='body_background_type']:checked").val(); - var header_background_type = $("input[name='header_background_type']:checked").val(); - - var button_style = $("#button_style").val(); - var separator_style = $("#separator_style").val(); - var separator_color = $("#separator_color").val(); - var icon_style = $("input[name='app_icon_style']:checked").val(); - - var backend_all_icon_style = $("#font_awesome_icon_style").val(); - var dual_tone_icon_color_1 = $("#dual_tone_icon_color_1").val(); - var dual_tone_icon_color_2 = $("#dual_tone_icon_color_2").val(); - var body_background_img = $('#body_background_img').val(); - var sidebar_font_color = $('#sidebar_font_color').val(); - var sidebar_background_color = $('#sidebar_background_color').val(); - var sidebar_background_style = $("input[name='sidebar_background_style']:checked").val(); - var sidebar_background_img = $('#sidebar_background_img').val(); - var sidebar_collapse_style = $("input[name='sidebar_collapse_style']:checked").val(); - var predefined_list_view_boolean = $("#predefined_list_view_boolean").prop("checked"); - var predefined_list_view_style = $("input[name='listview_style']:checked").val(); - var list_view_border = $("#list_view_border").val(); - var list_view_even_row_color = $("#list_view_even_row_color").val(); - var list_view_odd_row_color = $("#list_view_odd_row_color").val(); - var list_view_is_hover_row = $("#list_view_is_hover_row").prop("checked"); - var list_view_hover_bg_color = $("#list_view_hover_bg_color").val(); - var login_page_style = $("input[name='login_style']:checked").val(); - var login_page_style_comp_logo = $("#login_page_style_comp_logo").prop("checked"); - var login_page_background_type = $("input[name='login_page_background_type']:checked").val(); - var login_page_box_color = $("#login_page_box_color").val(); - var login_page_background_color = $("#login_page_background_color").val(); - - var is_sticky_form = $("#is_sticky_form").prop("checked"); - var is_sticky_list = $("#is_sticky_list").prop("checked"); - var is_sticky_list_inside_form = $("#is_sticky_list_inside_form").prop("checked"); - var is_sticky_pivot = $("#is_sticky_pivot").prop("checked"); - - var tab_style_mobile = $("input[name='tab_mobile_style']:checked").val(); - var horizontal_tab_style = $("#horizontal_tab_style").val(); - - var navbar_style = $("input[name='navbar_style']:checked").val(); - var search_style = $("input[name='search_style']:checked").val(); - var progress_style = $("#progress_style").val(); - var progress_height = $("#progress_height").val(); - var progress_color = $("#progress_color").val(); - - var result = await self.orm.write("sh.back.theme.config.settings", [1], { - 'primary_color': primary_color_id, - 'kanban_box_style': kanban_box_style, - 'secondary_color': secondary_color_id, - 'header_background_color': header_background_color, - 'header_font_color': header_font_color, - 'body_background_color': body_background_color, - 'body_font_family': body_font_family, - 'is_used_google_font': is_used_google_font, - 'body_google_font_family': body_google_font_family, - 'body_background_type': body_background_type, - 'header_background_type': header_background_type, - 'button_style': button_style, - 'separator_style': separator_style, - 'separator_color': separator_color, - 'icon_style': icon_style, - 'dual_tone_icon_color_1': dual_tone_icon_color_1, - 'dual_tone_icon_color_2': dual_tone_icon_color_2, - 'sidebar_font_color': sidebar_font_color, - 'sidebar_background_style': sidebar_background_style, - 'sidebar_background_color': sidebar_background_color, - 'sidebar_collapse_style': sidebar_collapse_style, - 'predefined_list_view_boolean': predefined_list_view_boolean, - 'predefined_list_view_style': predefined_list_view_style, - 'list_view_border': list_view_border, - 'list_view_even_row_color': list_view_even_row_color, - 'list_view_odd_row_color': list_view_odd_row_color, - 'list_view_is_hover_row': list_view_is_hover_row, - 'list_view_hover_bg_color': list_view_hover_bg_color, - 'login_page_style': login_page_style, - 'login_page_style_comp_logo': login_page_style_comp_logo, - 'login_page_background_type': login_page_background_type, - 'login_page_box_color': login_page_box_color, - 'login_page_background_color': login_page_background_color, - 'is_sticky_form': is_sticky_form, - 'is_sticky_list': is_sticky_list, - 'is_sticky_list_inside_form': is_sticky_list_inside_form, - 'is_sticky_pivot': is_sticky_pivot, - 'horizontal_tab_style': horizontal_tab_style, - 'search_style': search_style, - 'navbar_style': navbar_style, - 'progress_style': progress_style, - 'progress_height': progress_height, - 'progress_color': progress_color, - 'backend_all_icon_style': backend_all_icon_style, - }); - if (result){ - location.reload(); - } - - var form = $('#body_background_img')[0]; - var data = new FormData(form); - $.ajax({ - type: "POST", - enctype: 'multipart/form-data', - url: "/api/upload/multi", - data: data, - processData: false, - contentType: false, - cache: false, - timeout: 600000, - success: function (data) { - - console.log("SUCCESS : ", data); - if(data){ - setTimeout(function () { - location.reload(); - - }, 5000); - } - - }, - error: function (e) { - - console.log("ERROR : ", e); - - } - }); - - var form = $('#header_background_img')[0]; - var data = new FormData(form); - $.ajax({ - type: "POST", - enctype: 'multipart/form-data', - url: "/api/upload/multi", - data: data, - processData: false, - contentType: false, - cache: false, - timeout: 600000, - success: function (data) { - - console.log("SUCCESS : ", data); - if(data){ - setTimeout(function () { - location.reload(); - - }, 5000); - } - - }, - error: function (e) { - - console.log("ERROR : ", e); - - } - }); - - - - var sidebar_background_img_form = $('#sidebar_background_img')[0]; - var data5 = new FormData(sidebar_background_img_form); - $.ajax({ - type: "POST", - enctype: 'multipart/form-data', - url: "/api/upload/multi", - data: data5, - processData: false, - contentType: false, - cache: false, - timeout: 600000, - success: function (data) { - - console.log("SUCCESS : ", data); - if(data){ - setTimeout(function () { - location.reload(); - - }, 5000); - } - }, - error: function (e) { - - console.log("ERROR : ", e); - - } - }); - - - $.ajax({ - type: "POST", - enctype: 'multipart/form-data', - url: "/api/upload/multi", - data: data5, - processData: false, - contentType: false, - cache: false, - timeout: 600000, - success: function (data) { - - console.log("SUCCESS : ", data); - if(data){ - setTimeout(function () { - location.reload(); - - }, 5000); - } - }, - error: function (e) { - - console.log("ERROR : ", e); - - } - }); - - var login_page_banner_img = $('#login_page_banner_img')[0]; - var data2 = new FormData(login_page_banner_img); - $.ajax({ - type: "POST", - enctype: 'multipart/form-data', - url: "/api/upload/multi", - data: data2, - processData: false, - contentType: false, - cache: false, - timeout: 600000, - success: function (data) { - - console.log("SUCCESS : ", data); - if(data){ - setTimeout(function () { - location.reload(); - - }, 5000); - } - }, - error: function (e) { - - console.log("ERROR : ", e); - - } - }); - - var login_page_icon_img = $('#login_page_icon_img')[0]; - var data2 = new FormData(login_page_icon_img); - $.ajax({ - type: "POST", - enctype: 'multipart/form-data', - url: "/api/upload/multi", - data: data2, - processData: false, - contentType: false, - cache: false, - timeout: 600000, - success: function (data) { - - console.log("SUCCESS : ", data); - if(data){ - setTimeout(function () { - location.reload(); - - }, 5000); - } - }, - error: function (e) { - - console.log("ERROR : ", e); - - } - }); - - var login_page_icon_img_long = $('#login_page_icon_img_long')[0]; - var data2 = new FormData(login_page_icon_img_long); - $.ajax({ - type: "POST", - enctype: 'multipart/form-data', - url: "/api/upload/multi", - data: data2, - processData: false, - contentType: false, - cache: false, - timeout: 600000, - success: function (data) { - - console.log("SUCCESS : ", data); - if(data){ - setTimeout(function () { - location.reload(); - - }, 5000); - } - }, - error: function (e) { - - console.log("ERROR : ", e); - - } - }); - - var login_page_background_img = $('#login_page_background_img')[0]; - var data3 = new FormData(login_page_background_img); - $.ajax({ - type: "POST", - enctype: 'multipart/form-data', - url: "/api/upload/multi", - data: data3, - processData: false, - contentType: false, - cache: false, - timeout: 600000, - success: function (data) { - - console.log("SUCCESS : ", data); - if(data){ - setTimeout(function () { - location.reload(); - - }, 5000); - } - }, - error: function (e) { - - console.log("ERROR : ", e); - - } - }); - - var loading_gif = $('#loading_gif')[0]; - var data4 = new FormData(loading_gif); - $.ajax({ - type: "POST", - enctype: 'multipart/form-data', - url: "/api/upload/multi", - data: data4, - processData: false, - contentType: false, - cache: false, - timeout: 600000, - success: function (data) { - - console.log("SUCCESS : ", data); - if(data){ - setTimeout(function () { - location.reload(); - - }, 5000); - } - }, - error: function (e) { - - console.log("ERROR : ", e); - - } - }); - - } - }, - _click_progress_style : function(ev){ - var progress_style = $("#progress_style").val(); - if (progress_style == 'style_1') { - $("#progress_color_height").css("display", "table-row"); - } else { - $("#progress_color_height").css("display", "none"); - } }, - _click_header_background_type: function(ev){ - - var radioValue = $("input[name='header_background_type']:checked").val(); - if (radioValue == 'header_color') { - $('#header_background_color').css("display", "block"); - $('#header_background_img').css("display", "none"); - } else { - $('#header_background_color').css("display", "none"); - $('#header_background_img').css("display", "block"); - } - }, - _click_body_background_type: function(ev){ - - var radioValue = $("input[name='body_background_type']:checked").val(); - if (radioValue == 'bg_color') { - $('#body_background_color').css("display", "block"); - $('#body_background_img').css("display", "none"); - } else { - $('#body_background_color').css("display", "none"); - $('#body_background_img').css("display", "block"); - } - }, - _click_sidebar_background_style: function(ev){ - var radioValue = $("input[name='sidebar_background_style']:checked").val(); - if (radioValue == 'color') { - $('#sidebar_background_color').css("display", "block"); - $('#sidebar_background_img').css("display", "none"); - } else { - $('#sidebar_background_color').css("display", "none"); - $('#sidebar_background_img').css("display", "block"); - } - }, - _click_predefined_list_view_boolean: function(ev){ - var predefined_list_view_boolean = $("#predefined_list_view_boolean").prop("checked"); - if (predefined_list_view_boolean) { - $('#predefined_list_view_boolean').attr('checked', true); - $(".predefined_list_view_style").css("display", "table-row"); - $(".is_row_color_hover").css("display", "none"); - $("#list_view_is_hover_row").css("display", "none"); - $("#list_view_border").css("display", "none"); - $("#list_view_even_row_color").css("display", "none"); - $("#list_view_odd_row_color").css("display", "none"); - $("#list_view_hover_bg_color").css("display", "none"); - $(".list_view_border_even_row_color").css("display","none"); - $(".row_hover_odd_row_color").css("display","none"); - } else { - $('#predefined_list_view_boolean').attr('checked', false); - $(".predefined_list_view_style").css("display", "none"); - $(".is_row_color_hover").css("display", "table-row"); - $("#list_view_is_hover_row").css("display", "table-row"); - $("#list_view_border").css("display", "table-row"); - $("#list_view_even_row_color").css("display", "table-row"); - $("#list_view_odd_row_color").css("display", "table-row"); - $("#list_view_hover_bg_color").css("display", "table-row"); - $(".list_view_border_even_row_color").css("display","table-row"); - $(".row_hover_odd_row_color").css("display","table-row"); - var list_view_is_hover_row = $("#list_view_is_hover_row").prop("checked"); - if (!list_view_is_hover_row){ - $(".is_row_color_hover").css("display", "none"); - } - } - }, - _click_list_view_is_hover_row: function(ev){ - var list_view_is_hover_row = $("#list_view_is_hover_row").prop("checked"); - if (list_view_is_hover_row) { - $(".is_row_color_hover").css("display", "table-row"); - } else { - $(".is_row_color_hover").css("display", "none"); - } - }, - _on_change_body_font_family: function(ev){ - var body_font_family = $('#body_font_family').val(); - if (body_font_family == 'custom_google_font') { - $("#body_google_font_family").css("display", "block"); - $("#body_google_font_family_label").css("display", "block"); - } else { - $("#body_google_font_family").css("display", "none"); - $("#body_google_font_family_label").css("display", "none"); - } - }, - _on_change_icon_style: function(ev){ - var icon_style = $(ev.currentTarget).attr('id'); - $("#icon_style_id").find(".theme_style_box").removeClass('active') - $("#icon_style_id").find(".theme_style_box").find('input[name="app_icon_style"]').attr('checked', false); - $(ev.currentTarget).addClass('active'); - $(ev.currentTarget).find('input[name="app_icon_style"]').attr('checked', true); - - /*var icon_style = $('#icon_style').val();*/ - if (icon_style != 'dual_tone') { - $(".sh_config_dt_label").css("display", "none"); - $("#dual_tone_icon_color_1").css("display", "none"); - $("#dual_tone_icon_color_2").css("display", "none"); - }else if (icon_style == 'dual_tone') { - $(".sh_config_dt_label").css("display", "block"); - $("#dual_tone_icon_color_1").css("display", "block"); - $("#dual_tone_icon_color_2").css("display", "block"); - } - }, - // _on_change_discuss_chatter_style: function(ev){ - // var discuss_chatter_style = $('#discuss_chatter_style').val(); - // if (discuss_chatter_style == 'style_1' || discuss_chatter_style == 'standard') { - // $(".discuss_chatter_background_image").css("display", "none"); - // $("#discuss_chatter_style_image").css("display", "none"); - // }else if (discuss_chatter_style != 'style_1' || discuss_chatter_style != 'standard') { - // $(".discuss_chatter_background_image").css("display", "block"); - // $("#discuss_chatter_style_image").css("display", "block"); - // } - // }, - _on_change_login_page_style: function(ev){ - var login_page_style = $(ev.currentTarget).attr('id'); - $("#login_style_id").find(".theme_style_box").removeClass('active') - $("#login_style_id").find(".theme_style_box").find('input[name="login_style"]').attr('checked', false); - $(ev.currentTarget).addClass('active'); - $(ev.currentTarget).find('input[name="login_style"]').attr('checked', true); - if (login_page_style == 'style_0') { - $(".login_bg_type").css("display", "none"); - $(".login_box_color").css("display", "none"); - $(".login_bg_img").css("display", "none"); - $(".login_bg_color").css("display", "none"); - $(".login_bg_img_title").css("display", "none"); - $(".login_banner_img").css("display", "none"); - $('.company_icon_image').css("display", "none"); - $('.company_name_image').css("display", "none"); - $('.login_page_style_with_comp_logo_tr').css("display", "none"); - } else if (login_page_style == 'style_1') { - $(".login_bg_type").css("display", "none"); - $(".login_box_color").css("display", "none"); - $(".login_bg_img").css("display", "none"); - $(".login_bg_img_title").css("display", "none"); - $(".login_bg_color").css("display", "none"); - $(".login_banner_img").css("display", "none"); - $('.company_icon_image').css("display", "none"); - $('.company_name_image').css("display", "none"); - $('.login_page_style_with_comp_logo_tr').css("display", "block"); - } - else if (login_page_style == 'style_2') { - - $(".login_bg_type").css("display", "none"); - $(".login_bg_color").css("display", "none"); - $(".login_box_color").css("display", "block"); - $(".login_bg_img_title").css("display", "none"); - $(".login_bg_img").css("display", "none"); - $(".login_box_color").val("#FFFFFF"); - - $(".login_banner_img").css("display", "block"); - $('.company_icon_image').css("display", "none"); - $('.company_name_image').css("display", "none"); - $('.login_page_style_with_comp_logo_tr').css("display", "none"); - - - } else if (login_page_style == 'style_3') { - - $(".login_bg_type").css("display", "block"); - $(".login_box_color").css("display", "none"); - $(".login_bg_img_title").css("display", "block"); - - $(".login_bg_img_title").css("display", "block"); - $("#login_bg_img").attr('checked', true); - $(".login_bg_img").css("display", 'block'); - $(".login_bg_color").css("display", "none"); - - - $(".login_banner_img").css("display", "none"); - $('.company_icon_image').css("display", "block"); - $('.company_name_image').css("display", "block"); - $('.login_page_style_with_comp_logo_tr').css("display", "none"); - - - } else if (login_page_style == 'style_4') { - - $(".login_bg_type").css("display", "block"); - - $(".login_box_color").css("display", "none"); - - $(".login_bg_img_title").css("display", "block"); - $("#login_bg_img").attr('checked', true); - $(".login_bg_img").css("display", 'block'); - $(".login_bg_color").css("display", "none"); - - $(".login_banner_img").css("display", "none"); - $('.company_icon_image').css("display", "block"); - $('.company_name_image').css("display", "none"); - $('.login_page_style_with_comp_logo_tr').css("display", "none"); + error: function (e) { + console.log("ERROR : ", e); } + }); + + var form = $('#header_background_img')[0]; + var data = new FormData(form); + $.ajax({ + type: "POST", + enctype: 'multipart/form-data', + url: "/api/upload/multi", + data: data, + processData: false, + contentType: false, + cache: false, + timeout: 600000, + success: function (data) { + + console.log("SUCCESS : ", data); + if (data) { + setTimeout(function () { + location.reload(); + + }, 5000); + } }, - _click_login_page_background_type: function(ev){ - var radioValue = $("input[name='login_page_background_type']:checked").val(); - if (radioValue == 'bg_color') { - $('#login_page_background_color').css("display", "block"); - $('#login_page_background_img').css("display", "none"); - } else { - $('#login_page_background_color').css("display", "none"); - $('#login_page_background_img').css("display", "block"); + error: function (e) { + + console.log("ERROR : ", e); + + } + }); + + + + var sidebar_background_img_form = $('#sidebar_background_img')[0]; + var data5 = new FormData(sidebar_background_img_form); + $.ajax({ + type: "POST", + enctype: 'multipart/form-data', + url: "/api/upload/multi", + data: data5, + processData: false, + contentType: false, + cache: false, + timeout: 600000, + success: function (data) { + + console.log("SUCCESS : ", data); + if (data) { + setTimeout(function () { + location.reload(); + + }, 5000); } }, + error: function (e) { + + console.log("ERROR : ", e); + + } + }); + + + $.ajax({ + type: "POST", + enctype: 'multipart/form-data', + url: "/api/upload/multi", + data: data5, + processData: false, + contentType: false, + cache: false, + timeout: 600000, + success: function (data) { + + console.log("SUCCESS : ", data); + if (data) { + setTimeout(function () { + location.reload(); + + }, 5000); + } + }, + error: function (e) { + + console.log("ERROR : ", e); + + } + }); + + var login_page_banner_img = $('#login_page_banner_img')[0]; + var data2 = new FormData(login_page_banner_img); + $.ajax({ + type: "POST", + enctype: 'multipart/form-data', + url: "/api/upload/multi", + data: data2, + processData: false, + contentType: false, + cache: false, + timeout: 600000, + success: function (data) { + + console.log("SUCCESS : ", data); + if (data) { + setTimeout(function () { + location.reload(); + + }, 5000); + } + }, + error: function (e) { + + console.log("ERROR : ", e); + + } + }); + + var login_page_icon_img = $('#login_page_icon_img')[0]; + var data2 = new FormData(login_page_icon_img); + $.ajax({ + type: "POST", + enctype: 'multipart/form-data', + url: "/api/upload/multi", + data: data2, + processData: false, + contentType: false, + cache: false, + timeout: 600000, + success: function (data) { + + console.log("SUCCESS : ", data); + if (data) { + setTimeout(function () { + location.reload(); + + }, 5000); + } + }, + error: function (e) { + + console.log("ERROR : ", e); + + } + }); + + var login_page_icon_img_long = $('#login_page_icon_img_long')[0]; + var data2 = new FormData(login_page_icon_img_long); + $.ajax({ + type: "POST", + enctype: 'multipart/form-data', + url: "/api/upload/multi", + data: data2, + processData: false, + contentType: false, + cache: false, + timeout: 600000, + success: function (data) { + + console.log("SUCCESS : ", data); + if (data) { + setTimeout(function () { + location.reload(); + + }, 5000); + } + }, + error: function (e) { + + console.log("ERROR : ", e); + + } + }); + + var login_page_background_img = $('#login_page_background_img')[0]; + var data3 = new FormData(login_page_background_img); + $.ajax({ + type: "POST", + enctype: 'multipart/form-data', + url: "/api/upload/multi", + data: data3, + processData: false, + contentType: false, + cache: false, + timeout: 600000, + success: function (data) { + + console.log("SUCCESS : ", data); + if (data) { + setTimeout(function () { + location.reload(); + + }, 5000); + } + }, + error: function (e) { + + console.log("ERROR : ", e); + + } + }); + + var loading_gif = $('#loading_gif')[0]; + var data4 = new FormData(loading_gif); + $.ajax({ + type: "POST", + enctype: 'multipart/form-data', + url: "/api/upload/multi", + data: data4, + processData: false, + contentType: false, + cache: false, + timeout: 600000, + success: function (data) { + + console.log("SUCCESS : ", data); + if (data) { + setTimeout(function () { + location.reload(); + + }, 5000); + } + }, + error: function (e) { + + console.log("ERROR : ", e); + + } + }); + + } + }, + _click_progress_style: function (ev) { + var progress_style = $("#progress_style").val(); + if (progress_style == 'style_1') { + $("#progress_color_height").css("display", "table-row"); + } else { + $("#progress_color_height").css("display", "none"); + } + }, + _click_header_background_type: function (ev) { + + var radioValue = $("input[name='header_background_type']:checked").val(); + if (radioValue == 'header_color') { + $('#header_background_color').css("display", "block"); + $('#header_background_img').css("display", "none"); + } else { + $('#header_background_color').css("display", "none"); + $('#header_background_img').css("display", "block"); + } + }, + _click_body_background_type: function (ev) { + + var radioValue = $("input[name='body_background_type']:checked").val(); + if (radioValue == 'bg_color') { + $('#body_background_color').css("display", "block"); + $('#body_background_img').css("display", "none"); + } else { + $('#body_background_color').css("display", "none"); + $('#body_background_img').css("display", "block"); + } + }, + _click_sidebar_background_style: function (ev) { + var radioValue = $("input[name='sidebar_background_style']:checked").val(); + if (radioValue == 'color') { + $('#sidebar_background_color').css("display", "block"); + $('#sidebar_background_img').css("display", "none"); + } else { + $('#sidebar_background_color').css("display", "none"); + $('#sidebar_background_img').css("display", "block"); + } + }, + _click_predefined_list_view_boolean: function (ev) { + var predefined_list_view_boolean = $("#predefined_list_view_boolean").prop("checked"); + if (predefined_list_view_boolean) { + $('#predefined_list_view_boolean').attr('checked', true); + $(".predefined_list_view_style").css("display", "table-row"); + $(".is_row_color_hover").css("display", "none"); + $("#list_view_is_hover_row").css("display", "none"); + $("#list_view_border").css("display", "none"); + $("#list_view_even_row_color").css("display", "none"); + $("#list_view_odd_row_color").css("display", "none"); + $("#list_view_hover_bg_color").css("display", "none"); + $(".list_view_border_even_row_color").css("display", "none"); + $(".row_hover_odd_row_color").css("display", "none"); + } else { + $('#predefined_list_view_boolean').attr('checked', false); + $(".predefined_list_view_style").css("display", "none"); + $(".is_row_color_hover").css("display", "table-row"); + $("#list_view_is_hover_row").css("display", "table-row"); + $("#list_view_border").css("display", "table-row"); + $("#list_view_even_row_color").css("display", "table-row"); + $("#list_view_odd_row_color").css("display", "table-row"); + $("#list_view_hover_bg_color").css("display", "table-row"); + $(".list_view_border_even_row_color").css("display", "table-row"); + $(".row_hover_odd_row_color").css("display", "table-row"); + var list_view_is_hover_row = $("#list_view_is_hover_row").prop("checked"); + if (!list_view_is_hover_row) { + $(".is_row_color_hover").css("display", "none"); + } + } + }, + _click_list_view_is_hover_row: function (ev) { + var list_view_is_hover_row = $("#list_view_is_hover_row").prop("checked"); + if (list_view_is_hover_row) { + $(".is_row_color_hover").css("display", "table-row"); + } else { + $(".is_row_color_hover").css("display", "none"); + } + }, + _on_change_body_font_family: function (ev) { + var body_font_family = $('#body_font_family').val(); + if (body_font_family == 'custom_google_font') { + $("#body_google_font_family").css("display", "block"); + $("#body_google_font_family_label").css("display", "block"); + } else { + $("#body_google_font_family").css("display", "none"); + $("#body_google_font_family_label").css("display", "none"); + } + }, + _on_change_icon_style: function (ev) { + var icon_style = $(ev.currentTarget).attr('id'); + $("#icon_style_id").find(".theme_style_box").removeClass('active') + $("#icon_style_id").find(".theme_style_box").find('input[name="app_icon_style"]').attr('checked', false); + $(ev.currentTarget).addClass('active'); + $(ev.currentTarget).find('input[name="app_icon_style"]').attr('checked', true); + + /*var icon_style = $('#icon_style').val();*/ + if (icon_style != 'dual_tone') { + $(".sh_config_dt_label").css("display", "none"); + $("#dual_tone_icon_color_1").css("display", "none"); + $("#dual_tone_icon_color_2").css("display", "none"); + } else if (icon_style == 'dual_tone') { + $(".sh_config_dt_label").css("display", "block"); + $("#dual_tone_icon_color_1").css("display", "block"); + $("#dual_tone_icon_color_2").css("display", "block"); + } + }, + // _on_change_discuss_chatter_style: function(ev){ + // var discuss_chatter_style = $('#discuss_chatter_style').val(); + // if (discuss_chatter_style == 'style_1' || discuss_chatter_style == 'standard') { + // $(".discuss_chatter_background_image").css("display", "none"); + // $("#discuss_chatter_style_image").css("display", "none"); + // }else if (discuss_chatter_style != 'style_1' || discuss_chatter_style != 'standard') { + // $(".discuss_chatter_background_image").css("display", "block"); + // $("#discuss_chatter_style_image").css("display", "block"); + // } + // }, + _on_change_login_page_style: function (ev) { + var login_page_style = $(ev.currentTarget).attr('id'); + $("#login_style_id").find(".theme_style_box").removeClass('active') + $("#login_style_id").find(".theme_style_box").find('input[name="login_style"]').attr('checked', false); + $(ev.currentTarget).addClass('active'); + $(ev.currentTarget).find('input[name="login_style"]').attr('checked', true); + if (login_page_style == 'style_0') { + $(".login_bg_type").css("display", "none"); + $(".login_box_color").css("display", "none"); + $(".login_bg_img").css("display", "none"); + $(".login_bg_color").css("display", "none"); + $(".login_bg_img_title").css("display", "none"); + $(".login_banner_img").css("display", "none"); + $('.company_icon_image').css("display", "none"); + $('.company_name_image').css("display", "none"); + $('.login_page_style_with_comp_logo_tr').css("display", "none"); + } else if (login_page_style == 'style_1') { + $(".login_bg_type").css("display", "none"); + $(".login_box_color").css("display", "none"); + $(".login_bg_img").css("display", "none"); + $(".login_bg_img_title").css("display", "none"); + $(".login_bg_color").css("display", "none"); + $(".login_banner_img").css("display", "none"); + $('.company_icon_image').css("display", "none"); + $('.company_name_image').css("display", "none"); + $('.login_page_style_with_comp_logo_tr').css("display", "block"); + } + else if (login_page_style == 'style_2') { + + $(".login_bg_type").css("display", "none"); + $(".login_bg_color").css("display", "none"); + $(".login_box_color").css("display", "block"); + $(".login_bg_img_title").css("display", "none"); + $(".login_bg_img").css("display", "none"); + $(".login_box_color").val("#FFFFFF"); + + $(".login_banner_img").css("display", "block"); + $('.company_icon_image').css("display", "none"); + $('.company_name_image').css("display", "none"); + $('.login_page_style_with_comp_logo_tr').css("display", "none"); + + + } else if (login_page_style == 'style_3') { + + $(".login_bg_type").css("display", "block"); + $(".login_box_color").css("display", "none"); + $(".login_bg_img_title").css("display", "block"); + + $(".login_bg_img_title").css("display", "block"); + $("#login_bg_img").attr('checked', true); + $(".login_bg_img").css("display", 'block'); + $(".login_bg_color").css("display", "none"); + + + $(".login_banner_img").css("display", "none"); + $('.company_icon_image').css("display", "block"); + $('.company_name_image').css("display", "block"); + $('.login_page_style_with_comp_logo_tr').css("display", "none"); + + + } else if (login_page_style == 'style_4') { + + $(".login_bg_type").css("display", "block"); + + $(".login_box_color").css("display", "none"); + + $(".login_bg_img_title").css("display", "block"); + $("#login_bg_img").attr('checked', true); + $(".login_bg_img").css("display", 'block'); + $(".login_bg_color").css("display", "none"); + + $(".login_banner_img").css("display", "none"); + $('.company_icon_image').css("display", "block"); + $('.company_name_image').css("display", "none"); + $('.login_page_style_with_comp_logo_tr').css("display", "none"); + + + } + + }, + _click_login_page_background_type: function (ev) { + var radioValue = $("input[name='login_page_background_type']:checked").val(); + if (radioValue == 'bg_color') { + $('#login_page_background_color').css("display", "block"); + $('#login_page_background_img').css("display", "none"); + } else { + $('#login_page_background_color').css("display", "none"); + $('#login_page_background_img').css("display", "block"); + } + }, }); $('.o_web_client').append(theme_configuration_html) - jsonrpc('/get_theme_style',{}).then(function (data) { + jsonrpc('/get_theme_style', {}).then(function (data) { var app_icon_style = data['icon_style'] if (app_icon_style) { $('#icon_style_id').find('#' + app_icon_style).find('input[name="app_icon_style"]').attr('checked', true); @@ -825,7 +835,7 @@ export class ThemeConfigurationTemplate extends Component { $(".sh_config_dt_label").css("display", "none"); $("#dual_tone_icon_color_1").css("display", "none"); $("#dual_tone_icon_color_2").css("display", "none"); - }else if (app_icon_style == 'dual_tone') { + } else if (app_icon_style == 'dual_tone') { $(".sh_config_dt_label").css("display", "block"); $("#dual_tone_icon_color_1").css("display", "block"); $("#dual_tone_icon_color_2").css("display", "block"); @@ -840,9 +850,9 @@ export class ThemeConfigurationTemplate extends Component { $('#check_box_style_id').find('#' + checkbox_style).find('input[name="checkbox_style"]').attr('checked', true); } var radio_button_style = data['radio_btn_style'] - if (radio_button_style) { - $('#radio_button_style_id').find('#' + radio_button_style).find('input[name="radio_button_style"]').attr('checked', true); - } + if (radio_button_style) { + $('#radio_button_style_id').find('#' + radio_button_style).find('input[name="radio_button_style"]').attr('checked', true); + } var breadcrumbs_style = data['breadcrumb_style'] if (breadcrumbs_style) { $('#breadcrumbs_style_id').find('#' + breadcrumbs_style).find('input[name="breadcrumbs_style"]').attr('checked', true); @@ -873,7 +883,7 @@ export class ThemeConfigurationTemplate extends Component { if (is_navbar_style == 'collapsed') { $('#navbar_style_collapsed').attr('checked', true); } - else{ + else { $('#navbar_style_expanded').attr('checked', true); } var active_style = data['theme_style'] @@ -884,7 +894,7 @@ export class ThemeConfigurationTemplate extends Component { if (active_color) { $('#' + active_color).find('input[name="themeColor"]').attr('checked', true); } - + var active_pre_color = data['pre_theme_style'] if (active_pre_color) { $('#' + active_pre_color).find('input[name="preThemeColor"]').attr('checked', true); @@ -981,8 +991,8 @@ export class ThemeConfigurationTemplate extends Component { var backend_all_icon_style = data['backend_all_icon_style'] if (backend_all_icon_style) { if (backend_all_icon_style) { - $('#font_icon_style_id').find('#' + backend_all_icon_style).find('input[name="font_icon_style"]').attr('checked', true); - } + $('#font_icon_style_id').find('#' + backend_all_icon_style).find('input[name="font_icon_style"]').attr('checked', true); + } } var dual_tone_icon_color_1 = data['dual_tone_icon_color_1'] if (dual_tone_icon_color_1) { @@ -1041,8 +1051,8 @@ export class ThemeConfigurationTemplate extends Component { $("#list_view_even_row_color").css("display", "none"); $("#list_view_odd_row_color").css("display", "none"); $("#list_view_hover_bg_color").css("display", "none"); - $(".list_view_border_even_row_color").css("display","none"); - $(".row_hover_odd_row_color").css("display","none"); + $(".list_view_border_even_row_color").css("display", "none"); + $(".row_hover_odd_row_color").css("display", "none"); } else { $('#predefined_list_view_boolean').attr('checked', false); $(".predefined_list_view_style").css("display", "none"); @@ -1052,8 +1062,8 @@ export class ThemeConfigurationTemplate extends Component { $("#list_view_even_row_color").css("display", "table-row"); $("#list_view_odd_row_color").css("display", "table-row"); $("#list_view_hover_bg_color").css("display", "table-row"); - $(".list_view_border_even_row_color").css("display","table-row"); - $(".row_hover_odd_row_color").css("display","table-row"); + $(".list_view_border_even_row_color").css("display", "table-row"); + $(".row_hover_odd_row_color").css("display", "table-row"); } var list_view_border = data['list_view_border'] if (list_view_border) { @@ -1289,63 +1299,62 @@ export class ThemeConfigurationTemplate extends Component { }); } onWillStart(this.onWillStart); - - } - async onWillStart() { - + } + + async onWillStart() { + this.is_group_theme_configuration_user = await this.user.hasGroup("sh_backmate_theme_adv_enterprise.group_theme_configuration"); } - _click_sh_theme_design(ev){ - if ($(ev.currentTarget.parentElement.getElementsByClassName('collapse')).css('display') == 'none') - { - $(ev.currentTarget.parentElement.getElementsByClassName('collapse')).slideDown('slow') - }else{ - $(ev.currentTarget.parentElement.getElementsByClassName('collapse')).slideUp(600) - } + _click_sh_theme_design(ev) { + if ($(ev.currentTarget.parentElement.getElementsByClassName('collapse')).css('display') == 'none') { + $(ev.currentTarget.parentElement.getElementsByClassName('collapse')).slideDown('slow') + } else { + $(ev.currentTarget.parentElement.getElementsByClassName('collapse')).slideUp(600) } + } - _click_theme_configuration(){ + _click_theme_configuration() { if ($('.backmate_theme_layout').length) { - if ($('.sh_theme_model').length) { + if ($('.sh_theme_model').length) { - $('.backmate_theme_layout').removeClass('sh_theme_model'); - } else { - $('.backmate_theme_layout').addClass('sh_theme_model'); + $('.backmate_theme_layout').removeClass('sh_theme_model'); + } else { + $('.backmate_theme_layout').addClass('sh_theme_model'); - var radioValue = $("input[name='body_background_type']:checked").val(); - if (radioValue == 'bg_color') { - $('#body_background_color').css("display", "block"); - $('#body_background_img').css("display", "none"); - } else { - $('#body_background_color').css("display", "none"); - $('#body_background_img').css("display", "block"); - } + var radioValue = $("input[name='body_background_type']:checked").val(); + if (radioValue == 'bg_color') { + $('#body_background_color').css("display", "block"); + $('#body_background_img').css("display", "none"); + } else { + $('#body_background_color').css("display", "none"); + $('#body_background_img').css("display", "block"); + } - var radioValue = $("input[name='header_background_type']:checked").val(); - if (radioValue == 'header_color') { - $('#header_background_color').css("display", "block"); - $('#header_background_img').css("display", "none"); - } else { - $('#header_background_color').css("display", "none"); - $('#header_background_img').css("display", "block"); - } + var radioValue = $("input[name='header_background_type']:checked").val(); + if (radioValue == 'header_color') { + $('#header_background_color').css("display", "block"); + $('#header_background_img').css("display", "none"); + } else { + $('#header_background_color').css("display", "none"); + $('#header_background_img').css("display", "block"); + } - var radioValue = $("input[name='sidebar_background_style']:checked").val(); - if (radioValue == 'color') { - $('#sidebar_background_color').css("display", "block"); - $('#sidebar_background_img').css("display", "none"); - } else { - $('#sidebar_background_color').css("display", "none"); - $('#sidebar_background_img').css("display", "block"); - } - } - } + var radioValue = $("input[name='sidebar_background_style']:checked").val(); + if (radioValue == 'color') { + $('#sidebar_background_color').css("display", "block"); + $('#sidebar_background_img').css("display", "none"); + } else { + $('#sidebar_background_color').css("display", "none"); + $('#sidebar_background_img').css("display", "block"); + } + } + } } - } +} registry.category("systray").add("sh_backmate_theme_adv_enterprise.ThemeConfigurationTemplate", { Component: ThemeConfigurationTemplate }); diff --git a/sh_backmate_theme_adv_enterprise/static/src/js/todo.js b/sh_backmate_theme_adv_enterprise/static/src/js/todo.js index 7e4fb2765..bc02a4ebc 100644 --- a/sh_backmate_theme_adv_enterprise/static/src/js/todo.js +++ b/sh_backmate_theme_adv_enterprise/static/src/js/todo.js @@ -7,36 +7,36 @@ import { session } from "@web/session"; import { ToDoWidget } from "./todo_widget"; export class ToDoTemplate extends Component { - static template = "ToDoTemplate"; + static template = "ToDoTemplate"; + static props = ["*"]; + setup() { + this.orm = useService("orm"); + this.sh_enable_todo_mode = session.sh_enable_todo_mode + } - setup() { - this.orm = useService("orm"); - this.sh_enable_todo_mode = session.sh_enable_todo_mode - } + _click_todo() { + /*close pop-ups*/ + $('.sh_wqm_quick_menu_submenu_list_cls').css('display', 'none') + $('.o_user_bookmark_menu').removeClass('bookmark_active') + $('.sh_calc_util').removeClass("active") + $(".sh_calc_results").html(""); - _click_todo() { - /*close pop-ups*/ - $('.sh_wqm_quick_menu_submenu_list_cls').css('display','none') - $('.o_user_bookmark_menu').removeClass('bookmark_active') - $('.sh_calc_util').removeClass("active") - $(".sh_calc_results").html(""); - - if ($('.todo_layout').length) { - if ($('.sh_theme_model').length) { - $('.todo_layout').removeClass('sh_theme_model'); - $('.todo').removeClass('todo_active'); - } else{ - $('.todo_layout').addClass('sh_theme_model'); - $('.todo').addClass('todo_active'); - } - }else{ - this.body_container = new todo_widget(); - this.body_container.appendTo($('.o_web_client')).then(function () { - $('.todo_layout').addClass('sh_theme_model'); - $('.todo').addClass('todo_active'); - }); + if ($('.todo_layout').length) { + if ($('.sh_theme_model').length) { + $('.todo_layout').removeClass('sh_theme_model'); + $('.todo').removeClass('todo_active'); + } else { + $('.todo_layout').addClass('sh_theme_model'); + $('.todo').addClass('todo_active'); } - } + } else { + this.body_container = new todo_widget(); + this.body_container.appendTo($('.o_web_client')).then(function () { + $('.todo_layout').addClass('sh_theme_model'); + $('.todo').addClass('todo_active'); + }); + } + } } registry.category("systray").add("sh_backmate_theme_adv_enterprise.ToDoTemplate", { Component: ToDoTemplate }, { sequence: 25 }); diff --git a/sh_backmate_theme_adv_enterprise/static/src/js/todo_widget.js b/sh_backmate_theme_adv_enterprise/static/src/js/todo_widget.js index 4e7db6739..8769a8fce 100644 --- a/sh_backmate_theme_adv_enterprise/static/src/js/todo_widget.js +++ b/sh_backmate_theme_adv_enterprise/static/src/js/todo_widget.js @@ -5,165 +5,166 @@ import { session } from "@web/session"; import { registry } from "@web/core/registry"; import { useService } from "@web/core/utils/hooks"; import { renderToElement } from "@web/core/utils/render"; -import {useRef, onWillStart, onMounted } from "@odoo/owl"; +import { useRef, onWillStart, onMounted } from "@odoo/owl"; var todo_card_html = '' export class ToDoWidget extends Component { - static template = 'ToDoWidget'; - setup() { - super.setup() - this.orm = useService("orm"); - onMounted(() => { - this.render_template(); + static template = 'ToDoWidget'; + static props = ["*"]; + setup() { + super.setup() + this.orm = useService("orm"); + onMounted(() => { + this.render_template(); - }); - } + }); + } - render_template() { - this.render_todo_card(); - } + render_template() { + this.render_todo_card(); + } - async render_todo_card() { - var accordion_html = '' - var self = this - $("#accordion").html('') - await self.getAllTodo().then(function (each_data) { - $.each(each_data, function (todo_data) { - const accordion_html = renderToElement( - 'sh_backmate_theme_adv_enterprise.todo_card', { - name: each_data[todo_data].name, - rec: each_data[todo_data].id, - is_done: each_data[todo_data].is_done, - _remove_todo: function (ev){ - self._remove_todo(each_data[todo_data].id) - ev.target.parentElement.parentElement.parentElement.remove(); - }, - _click_sh_header_pencil : function (ev){ - self._click_sh_header_pencil(ev) - }, - _focusout_sh_todo_description : function (ev){ - self._focusout_sh_todo_description(ev) - }, - _click_sh_todo_checklist : function(ev){ - self._click_sh_todo_checklist(ev) - }, - }); - $("#accordion").append(accordion_html); - - todo_card_html += accordion_html - }); + async render_todo_card() { + var accordion_html = '' + var self = this + $("#accordion").html('') + await self.getAllTodo().then(function (each_data) { + $.each(each_data, function (todo_data) { + const accordion_html = renderToElement( + 'sh_backmate_theme_adv_enterprise.todo_card', { + name: each_data[todo_data].name, + rec: each_data[todo_data].id, + is_done: each_data[todo_data].is_done, + _remove_todo: function (ev) { + self._remove_todo(each_data[todo_data].id) + ev.target.parentElement.parentElement.parentElement.remove(); + }, + _click_sh_header_pencil: function (ev) { + self._click_sh_header_pencil(ev) + }, + _focusout_sh_todo_description: function (ev) { + self._focusout_sh_todo_description(ev) + }, + _click_sh_todo_checklist: function (ev) { + self._click_sh_todo_checklist(ev) + }, }); - } + $("#accordion").append(accordion_html); - _onKeydown() { - ev.stopPropagation(); - if (ev.which === 13) { - var self = this; - var todo_input = $(".sh_add_todo_input").val() - if(!$(".sh_add_todo_input").val()){ - alert("Please Enter Title !") - }else{ - ev.stopPropagation(); - this.saveTodo(todo_input).then(function (rec) { - $("#accordion").prepend(QWeb.render("ToDoCard", { - name: todo_input, - rec:parseInt(rec), - widget: self, - })); - }); - $(".sh_add_todo_input").val("") - } - } - } + todo_card_html += accordion_html + }); + }); + } - _click_sh_header_pencil(ev) { - ev.target.parentElement.parentElement.parentElement.getElementsByClassName("sh_todo_description")[0].style.display = "block"; - ev.target.parentElement.parentElement.parentElement.getElementsByClassName("sh_todo_label")[0].style.display = "none"; - ev.target.parentElement.parentElement.parentElement.getElementsByClassName("sh_header_pencil")[0].style.display = "none"; - ev.target.parentElement.parentElement.parentElement.getElementsByClassName("sh_header_save")[0].style.display = "block"; - var fieldInput = ev.target.parentElement.parentElement.parentElement.getElementsByClassName("sh_todo_description"); - var fldLength= fieldInput.valueOf().length; - fieldInput[0].focus() - fieldInput[0].setSelectionRange(fldLength, fldLength); - } - - _focusout_sh_todo_description(ev) { - var fieldInput = ev.target.parentElement.parentElement.parentElement.getElementsByClassName("sh_todo_description"); - ev.target.parentElement.parentElement.parentElement.getElementsByClassName("sh_header_pencil")[0].style.display = "block"; - ev.target.parentElement.parentElement.parentElement.getElementsByClassName("sh_header_save")[0].style.display = "none"; - fieldInput[0].style.display = "none"; - ev.target.parentElement.parentElement.parentElement.getElementsByClassName("sh_todo_label")[0].style.display = "block"; - ev.target.parentElement.parentElement.parentElement.getElementsByClassName("sh_todo_label")[0].textContent = fieldInput[0].value - var todo_id = parseInt(ev.target.getAttribute('ID')) - this.orm.write("sh.todo", [todo_id], { name : ev.target.parentElement.parentElement.parentElement.getElementsByClassName("sh_todo_label")[0].textContent }); - } - - _remove_todo(todo_id) { - this.removeTodo(todo_id) - } - - removeTodo(todo_id) { - return this.orm.unlink("sh.todo", [todo_id]); - } - - _close_todo() { - $('.todo_layout').removeClass('sh_theme_model'); - $('.todo').removeClass('todo_active'); - } - - async saveTodo(todo_input) { - var data = await this.orm.create("sh.todo", [{ - 'name': todo_input, - }]); - $(".sh_add_todo_input").val("") - } - - async _click_add_todo() { + _onKeydown() { + ev.stopPropagation(); + if (ev.which === 13) { var self = this; var todo_input = $(".sh_add_todo_input").val() - if(!$(".sh_add_todo_input").val()){ + if (!$(".sh_add_todo_input").val()) { alert("Please Enter Title !") - }else{ + } else { + ev.stopPropagation(); + this.saveTodo(todo_input).then(function (rec) { + $("#accordion").prepend(QWeb.render("ToDoCard", { + name: todo_input, + rec: parseInt(rec), + widget: self, + })); + }); + $(".sh_add_todo_input").val("") + } + } + } + + _click_sh_header_pencil(ev) { + ev.target.parentElement.parentElement.parentElement.getElementsByClassName("sh_todo_description")[0].style.display = "block"; + ev.target.parentElement.parentElement.parentElement.getElementsByClassName("sh_todo_label")[0].style.display = "none"; + ev.target.parentElement.parentElement.parentElement.getElementsByClassName("sh_header_pencil")[0].style.display = "none"; + ev.target.parentElement.parentElement.parentElement.getElementsByClassName("sh_header_save")[0].style.display = "block"; + var fieldInput = ev.target.parentElement.parentElement.parentElement.getElementsByClassName("sh_todo_description"); + var fldLength = fieldInput.valueOf().length; + fieldInput[0].focus() + fieldInput[0].setSelectionRange(fldLength, fldLength); + } + + _focusout_sh_todo_description(ev) { + var fieldInput = ev.target.parentElement.parentElement.parentElement.getElementsByClassName("sh_todo_description"); + ev.target.parentElement.parentElement.parentElement.getElementsByClassName("sh_header_pencil")[0].style.display = "block"; + ev.target.parentElement.parentElement.parentElement.getElementsByClassName("sh_header_save")[0].style.display = "none"; + fieldInput[0].style.display = "none"; + ev.target.parentElement.parentElement.parentElement.getElementsByClassName("sh_todo_label")[0].style.display = "block"; + ev.target.parentElement.parentElement.parentElement.getElementsByClassName("sh_todo_label")[0].textContent = fieldInput[0].value + var todo_id = parseInt(ev.target.getAttribute('ID')) + this.orm.write("sh.todo", [todo_id], { name: ev.target.parentElement.parentElement.parentElement.getElementsByClassName("sh_todo_label")[0].textContent }); + } + + _remove_todo(todo_id) { + this.removeTodo(todo_id) + } + + removeTodo(todo_id) { + return this.orm.unlink("sh.todo", [todo_id]); + } + + _close_todo() { + $('.todo_layout').removeClass('sh_theme_model'); + $('.todo').removeClass('todo_active'); + } + + async saveTodo(todo_input) { + var data = await this.orm.create("sh.todo", [{ + 'name': todo_input, + }]); + $(".sh_add_todo_input").val("") + } + + async _click_add_todo() { + var self = this; + var todo_input = $(".sh_add_todo_input").val() + if (!$(".sh_add_todo_input").val()) { + alert("Please Enter Title !") + } else { + await this.saveTodo(todo_input) + this.render_todo_card() + } + } + + async add_todo(ev) { + if (ev.which === 13) { + var self = this; + var todo_input = $(".sh_add_todo_input").val() + if (!$(".sh_add_todo_input").val()) { + alert("Please Enter Title !") + } else { await this.saveTodo(todo_input) this.render_todo_card() } - } - async add_todo(ev){ - if (ev.which === 13) { - var self = this; - var todo_input = $(".sh_add_todo_input").val() - if(!$(".sh_add_todo_input").val()){ - alert("Please Enter Title !") - }else{ - await this.saveTodo(todo_input) - this.render_todo_card() - } - - } - - } - - async doneTodo(done_todo ,todo_id) { - await this.orm.write("sh.todo", [todo_id], { is_done : done_todo }); - } - - async getAllTodo() { - const data = await this.orm.searchRead( - "sh.todo", - [['user_id', '=', session.uid]], - ['name','is_done'] - ); - return data - } - - async _click_sh_todo_checklist(ev) { - var done_todo = ev.target.checked - var todo_id = parseInt(ev.target.id) - await this.doneTodo(done_todo, todo_id) - this.render_todo_card() } + + } + + async doneTodo(done_todo, todo_id) { + await this.orm.write("sh.todo", [todo_id], { is_done: done_todo }); + } + + async getAllTodo() { + const data = await this.orm.searchRead( + "sh.todo", + [['user_id', '=', session.uid]], + ['name', 'is_done'] + ); + return data + } + + async _click_sh_todo_checklist(ev) { + var done_todo = ev.target.checked + var todo_id = parseInt(ev.target.id) + await this.doneTodo(done_todo, todo_id) + this.render_todo_card() + } } registry.category("systray").add("sh_backmate_theme_adv_enterprise.ToDoWidget", { Component: ToDoWidget }, { sequence: 25 }); \ No newline at end of file diff --git a/sh_backmate_theme_adv_enterprise/static/src/webclient/navtab/navtab.js b/sh_backmate_theme_adv_enterprise/static/src/webclient/navtab/navtab.js index 5f1e5696c..e4ae48bcd 100644 --- a/sh_backmate_theme_adv_enterprise/static/src/webclient/navtab/navtab.js +++ b/sh_backmate_theme_adv_enterprise/static/src/webclient/navtab/navtab.js @@ -5,12 +5,13 @@ import { useService } from "@web/core/utils/hooks"; import { session } from "@web/session"; export class NavTab extends Component { + static props = ["*"]; setup() { super.setup(); this.actionService = useService("action"); this.sh_enable_multi_tab = session.sh_enable_multi_tab - } - } - NavTab.template = 'sh_backmate_theme_adv_enterprise.NavTab'; +} + +NavTab.template = 'sh_backmate_theme_adv_enterprise.NavTab'; diff --git a/sh_backmate_theme_adv_enterprise/static/src/webclient/zoomwidget/zoomwidget.js b/sh_backmate_theme_adv_enterprise/static/src/webclient/zoomwidget/zoomwidget.js index dcfa82ccd..4a536f61f 100644 --- a/sh_backmate_theme_adv_enterprise/static/src/webclient/zoomwidget/zoomwidget.js +++ b/sh_backmate_theme_adv_enterprise/static/src/webclient/zoomwidget/zoomwidget.js @@ -6,48 +6,48 @@ import { jsonrpc } from "@web/core/network/rpc_service"; import { useService, useBus } from "@web/core/utils/hooks"; export class ZoomWidget extends Component { + static props = ["*"]; setup() { super.setup(); this.orm = useService("orm"); this.show_zoom = session.sh_enable_zoom } - setResetZoom(){ + setResetZoom() { var zoom = $('.sh_full').text().split('%') - if($('.o_content').find('div')[0]){ - $($('.o_content').find('div')[0]).removeClass("sh_zoom_"+zoom[0]) + if ($('.o_content').find('div')[0]) { + $($('.o_content').find('div')[0]).removeClass("sh_zoom_" + zoom[0]) zoom = 100 - $('.sh_full').text(zoom.toString()+'%'); - $($('.o_content').find('div')[0]).addClass("sh_zoom_"+zoom) + $('.sh_full').text(zoom.toString() + '%'); + $($('.o_content').find('div')[0]).addClass("sh_zoom_" + zoom) } } - zoomDropdown(ev){ - if ($('.sh-zoom-panel').css('display') == 'none') - { - $('.sh-zoom-panel').css('display','table') - }else{ - $('.sh-zoom-panel').css('display','none') - } + zoomDropdown(ev) { + if ($('.sh-zoom-panel').css('display') == 'none') { + $('.sh-zoom-panel').css('display', 'table') + } else { + $('.sh-zoom-panel').css('display', 'none') + } } - setDecZoom(){ + setDecZoom() { var zoom = $('.sh_full').text().split('%') - if(parseInt(zoom[0])-10 >= 20 && parseInt(zoom[0])-10 <= 200){ - if($('.o_content').find('div')[0]){ - $($('.o_content').find('div')[0]).removeClass("sh_zoom_"+zoom[0]) - zoom = parseInt(zoom[0])-10 - $('.sh_full').text(zoom.toString()+'%'); - $($('.o_content').find('div')[0]).addClass("sh_zoom_"+zoom) + if (parseInt(zoom[0]) - 10 >= 20 && parseInt(zoom[0]) - 10 <= 200) { + if ($('.o_content').find('div')[0]) { + $($('.o_content').find('div')[0]).removeClass("sh_zoom_" + zoom[0]) + zoom = parseInt(zoom[0]) - 10 + $('.sh_full').text(zoom.toString() + '%'); + $($('.o_content').find('div')[0]).addClass("sh_zoom_" + zoom) } } } - setIncZoom(){ + setIncZoom() { var zoom = $('.sh_full').text().split('%') - if(parseInt(zoom[0])+10 >= 20 && parseInt(zoom[0])+10 <= 200){ - if($('.o_content').find('div')[0]){ - $($('.o_content').find('div')[0]).removeClass("sh_zoom_"+zoom[0]) - zoom = parseInt(zoom[0])+10 - $('.sh_full').text(zoom.toString()+'%'); - $($('.o_content').find('div')[0]).addClass("sh_zoom_"+zoom) + if (parseInt(zoom[0]) + 10 >= 20 && parseInt(zoom[0]) + 10 <= 200) { + if ($('.o_content').find('div')[0]) { + $($('.o_content').find('div')[0]).removeClass("sh_zoom_" + zoom[0]) + zoom = parseInt(zoom[0]) + 10 + $('.sh_full').text(zoom.toString() + '%'); + $($('.o_content').find('div')[0]).addClass("sh_zoom_" + zoom) } } } diff --git a/soong_workflow/templates/soong_workflow_templates.xml b/soong_workflow/templates/soong_workflow_templates.xml index a48440704..6726d476b 100644 --- a/soong_workflow/templates/soong_workflow_templates.xml +++ b/soong_workflow/templates/soong_workflow_templates.xml @@ -2,7 +2,7 @@