feat(transactions-locking): enable settings schema and add dark mode support

This commit is contained in:
Ahmed Bouhuolia
2025-12-29 23:35:34 +02:00
parent 8152a16fd5
commit 350d229e98
2 changed files with 47 additions and 10 deletions

View File

@@ -1,4 +1,27 @@
// import { getTransactionsLockingSettingsSchema } from '@/api/controllers/TransactionsLocking/utils';
import { chain, mapKeys } from 'lodash';
const getTransactionsLockingSettingsSchema = (modules: string[]) => {
const moduleSchema = {
active: { type: 'boolean' },
lock_to_date: { type: 'date' },
unlock_from_date: { type: 'date' },
unlock_to_date: { type: 'date' },
lock_reason: { type: 'string' },
unlock_reason: { type: 'string' },
};
return chain(modules)
.map((module: string) => {
return mapKeys(moduleSchema, (value, key: string) => `${module}.${key}`);
})
.flattenDeep()
.reduce((result, value) => {
return {
...result,
...value,
};
}, {})
.value();
};
export const SettingsOptions = {
organization: {
@@ -223,12 +246,12 @@ export const SettingsOptions = {
'locking-type': {
type: 'string',
},
// ...getTransactionsLockingSettingsSchema([
// 'all',
// 'sales',
// 'purchases',
// 'financial',
// ]),
...getTransactionsLockingSettingsSchema([
'all',
'sales',
'purchases',
'financial',
]),
},
features: {
'multi-warehouses': {

View File

@@ -364,13 +364,18 @@ const TransLockingItemDesc = styled.p`
`;
const TransLockingIcon = styled.div`
--x-text-color: #93a1ba;
.bp4-dark & {
--x-text-color: rgba(255, 255, 255, 0.6);
}
border: 1px solid var(--color-transaction-locking-item-icon-border);
height: 45px;
width: 45px;
text-align: center;
line-height: 45px;
border-radius: 8px;
color: #93a1ba;
color: var(--x-text-color);
.bp4-icon {
position: relative;
@@ -395,15 +400,24 @@ export const TransLockingContent = styled.div`
export const TransLockingReason = styled.div`
font-size: 13px;
--x-text-color: #777;
.bp4-dark & {
--x-text-color: rgba(255, 255, 255, 0.6);
}
strong {
color: #777;
color: var(--x-text-color);
}
`;
const TransUnlockWrap = styled.div`
-x-border-color: #ddd;
.bp4-dark & {
--x-border-color: rgba(255, 255, 255, 0.1);
}
padding-top: 10px;
border-top: 1px solid #ddd;
border-top: 1px solid var(--x-border-color);
margin-top: 10px;
${TransLockingReason} {