forked from adempiere/adempiere-vue
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set Values on the System or Session Page (PanJiaChen#2319)
- Loading branch information
1 parent
3e6a1b3
commit 6c0cd48
Showing
8 changed files
with
90 additions
and
55 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import store from '@/store' | ||
// Constants | ||
import { config } from '@/utils/ADempiere/config' | ||
// Utils and Helper Methods | ||
import getPageTitle from '@/utils/get-page-title' | ||
import { getResourcePath } from '@/utils/ADempiere/resource' | ||
import { isEmptyValue } from '@/utils/ADempiere' | ||
|
||
function getPageFavicon({ | ||
logo | ||
}) { | ||
let link = document.querySelector("link[rel~='icon']") | ||
if (!link) { | ||
link = document.createElement('link') | ||
link.rel = 'icon' | ||
} | ||
link.href = logo | ||
document.head.appendChild(link) | ||
return link | ||
} | ||
|
||
// function getFaviconClient() {} | ||
/** | ||
* Get System Information (System Logo and System Name) | ||
*/ | ||
export function setSystemValues({ | ||
routeName | ||
}) { | ||
store.dispatch('user/system') | ||
.then(response => { | ||
const { | ||
name, | ||
logoUrl | ||
} = response | ||
// Set Page Title and Favicon | ||
document.title = getPageTitle({ | ||
key: routeName, | ||
nameSystem: name | ||
}) | ||
const link = getPageFavicon({ logo: logoUrl }) | ||
document.head.appendChild(link) | ||
}) | ||
} | ||
|
||
/** | ||
* Get Session Information (Session Logo, User Logo and Session Name) | ||
*/ | ||
export function setSessionValues({ | ||
routeName | ||
}) { | ||
const { | ||
client | ||
} = store.getters['user/getRole'] | ||
const nameSystem = client ? client.name : '' | ||
// Set Page Title | ||
document.title = getPageTitle({ | ||
key: routeName, | ||
nameSystem | ||
}) | ||
|
||
if (isEmptyValue(client)) return | ||
getResourcePath({ | ||
clientId: client.id, | ||
containerId: '109', | ||
containerType: 'resource', | ||
columnName: 'Logo_ID', | ||
recordId: client.id, | ||
tableName: 'AD_ClientInfo' | ||
}) | ||
.then(response => { | ||
if (isEmptyValue(response)) return | ||
// Set Page Favicon | ||
const link = getPageFavicon({ logo: config.adempiere.resource.url + response }) | ||
document.head.appendChild(link) | ||
}) | ||
} |