Updated via schema editor on 2025-10-17 15:00
This commit is contained in:
parent
27459405b4
commit
60792f071f
File diff suppressed because one or more lines are too long
88
backend/src/db/migrations/1760713191687.js
Normal file
88
backend/src/db/migrations/1760713191687.js
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
module.exports = {
|
||||||
|
/**
|
||||||
|
* @param {QueryInterface} queryInterface
|
||||||
|
* @param {Sequelize} Sequelize
|
||||||
|
* @returns {Promise<void>}
|
||||||
|
*/
|
||||||
|
async up(queryInterface, Sequelize) {
|
||||||
|
/**
|
||||||
|
* @type {Transaction}
|
||||||
|
*/
|
||||||
|
const transaction = await queryInterface.sequelize.transaction();
|
||||||
|
try {
|
||||||
|
await queryInterface.removeColumn('periods', 'period_from', {
|
||||||
|
transaction,
|
||||||
|
});
|
||||||
|
|
||||||
|
await queryInterface.removeColumn('periods', 'period_to', {
|
||||||
|
transaction,
|
||||||
|
});
|
||||||
|
|
||||||
|
await queryInterface.addColumn(
|
||||||
|
'periods',
|
||||||
|
'period_from',
|
||||||
|
{
|
||||||
|
type: Sequelize.DataTypes.DATEONLY,
|
||||||
|
},
|
||||||
|
{ transaction },
|
||||||
|
);
|
||||||
|
|
||||||
|
await queryInterface.addColumn(
|
||||||
|
'periods',
|
||||||
|
'period_to',
|
||||||
|
{
|
||||||
|
type: Sequelize.DataTypes.DATEONLY,
|
||||||
|
},
|
||||||
|
{ transaction },
|
||||||
|
);
|
||||||
|
|
||||||
|
await transaction.commit();
|
||||||
|
} catch (err) {
|
||||||
|
await transaction.rollback();
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* @param {QueryInterface} queryInterface
|
||||||
|
* @param {Sequelize} Sequelize
|
||||||
|
* @returns {Promise<void>}
|
||||||
|
*/
|
||||||
|
async down(queryInterface, Sequelize) {
|
||||||
|
/**
|
||||||
|
* @type {Transaction}
|
||||||
|
*/
|
||||||
|
const transaction = await queryInterface.sequelize.transaction();
|
||||||
|
try {
|
||||||
|
await queryInterface.removeColumn('periods', 'period_to', {
|
||||||
|
transaction,
|
||||||
|
});
|
||||||
|
|
||||||
|
await queryInterface.removeColumn('periods', 'period_from', {
|
||||||
|
transaction,
|
||||||
|
});
|
||||||
|
|
||||||
|
await queryInterface.addColumn(
|
||||||
|
'periods',
|
||||||
|
'period_to',
|
||||||
|
{
|
||||||
|
type: Sequelize.DataTypes.DATE,
|
||||||
|
},
|
||||||
|
{ transaction },
|
||||||
|
);
|
||||||
|
|
||||||
|
await queryInterface.addColumn(
|
||||||
|
'periods',
|
||||||
|
'period_from',
|
||||||
|
{
|
||||||
|
type: Sequelize.DataTypes.DATE,
|
||||||
|
},
|
||||||
|
{ transaction },
|
||||||
|
);
|
||||||
|
|
||||||
|
await transaction.commit();
|
||||||
|
} catch (err) {
|
||||||
|
await transaction.rollback();
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
@ -19,11 +19,23 @@ module.exports = function (sequelize, DataTypes) {
|
|||||||
},
|
},
|
||||||
|
|
||||||
period_from: {
|
period_from: {
|
||||||
type: DataTypes.DATE,
|
type: DataTypes.DATEONLY,
|
||||||
|
|
||||||
|
get: function () {
|
||||||
|
return this.getDataValue('period_from')
|
||||||
|
? moment.utc(this.getDataValue('period_from')).format('YYYY-MM-DD')
|
||||||
|
: null;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
period_to: {
|
period_to: {
|
||||||
type: DataTypes.DATE,
|
type: DataTypes.DATEONLY,
|
||||||
|
|
||||||
|
get: function () {
|
||||||
|
return this.getDataValue('period_to')
|
||||||
|
? moment.utc(this.getDataValue('period_to')).format('YYYY-MM-DD')
|
||||||
|
: null;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
importHash: {
|
importHash: {
|
||||||
|
|||||||
1
frontend/json/runtimeError.json
Normal file
1
frontend/json/runtimeError.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
{}
|
||||||
@ -89,7 +89,7 @@ const CardPeriods = ({
|
|||||||
</dt>
|
</dt>
|
||||||
<dd className='flex items-start gap-x-2'>
|
<dd className='flex items-start gap-x-2'>
|
||||||
<div className='font-medium line-clamp-4'>
|
<div className='font-medium line-clamp-4'>
|
||||||
{dataFormatter.dateTimeFormatter(item.period_from)}
|
{dataFormatter.dateFormatter(item.period_from)}
|
||||||
</div>
|
</div>
|
||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
@ -100,7 +100,7 @@ const CardPeriods = ({
|
|||||||
</dt>
|
</dt>
|
||||||
<dd className='flex items-start gap-x-2'>
|
<dd className='flex items-start gap-x-2'>
|
||||||
<div className='font-medium line-clamp-4'>
|
<div className='font-medium line-clamp-4'>
|
||||||
{dataFormatter.dateTimeFormatter(item.period_to)}
|
{dataFormatter.dateFormatter(item.period_to)}
|
||||||
</div>
|
</div>
|
||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -59,14 +59,14 @@ const ListPeriods = ({
|
|||||||
<div className={'flex-1 px-3'}>
|
<div className={'flex-1 px-3'}>
|
||||||
<p className={'text-xs text-gray-500 '}>Period From</p>
|
<p className={'text-xs text-gray-500 '}>Period From</p>
|
||||||
<p className={'line-clamp-2'}>
|
<p className={'line-clamp-2'}>
|
||||||
{dataFormatter.dateTimeFormatter(item.period_from)}
|
{dataFormatter.dateFormatter(item.period_from)}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className={'flex-1 px-3'}>
|
<div className={'flex-1 px-3'}>
|
||||||
<p className={'text-xs text-gray-500 '}>Period To</p>
|
<p className={'text-xs text-gray-500 '}>Period To</p>
|
||||||
<p className={'line-clamp-2'}>
|
<p className={'line-clamp-2'}>
|
||||||
{dataFormatter.dateTimeFormatter(item.period_to)}
|
{dataFormatter.dateFormatter(item.period_to)}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</Link>
|
</Link>
|
||||||
|
|||||||
@ -61,7 +61,7 @@ export const loadColumns = async (
|
|||||||
|
|
||||||
editable: hasUpdatePermission,
|
editable: hasUpdatePermission,
|
||||||
|
|
||||||
type: 'dateTime',
|
type: 'date',
|
||||||
valueGetter: (params: GridValueGetterParams) =>
|
valueGetter: (params: GridValueGetterParams) =>
|
||||||
new Date(params.row.period_from),
|
new Date(params.row.period_from),
|
||||||
},
|
},
|
||||||
@ -77,7 +77,7 @@ export const loadColumns = async (
|
|||||||
|
|
||||||
editable: hasUpdatePermission,
|
editable: hasUpdatePermission,
|
||||||
|
|
||||||
type: 'dateTime',
|
type: 'date',
|
||||||
valueGetter: (params: GridValueGetterParams) =>
|
valueGetter: (params: GridValueGetterParams) =>
|
||||||
new Date(params.row.period_to),
|
new Date(params.row.period_to),
|
||||||
},
|
},
|
||||||
|
|||||||
@ -99,8 +99,7 @@ const EditPeriods = () => {
|
|||||||
|
|
||||||
<FormField label='Period From'>
|
<FormField label='Period From'>
|
||||||
<DatePicker
|
<DatePicker
|
||||||
dateFormat='yyyy-MM-dd hh:mm'
|
dateFormat='yyyy-MM-dd'
|
||||||
showTimeSelect
|
|
||||||
selected={
|
selected={
|
||||||
initialValues.period_from
|
initialValues.period_from
|
||||||
? new Date(
|
? new Date(
|
||||||
@ -118,8 +117,7 @@ const EditPeriods = () => {
|
|||||||
|
|
||||||
<FormField label='Period To'>
|
<FormField label='Period To'>
|
||||||
<DatePicker
|
<DatePicker
|
||||||
dateFormat='yyyy-MM-dd hh:mm'
|
dateFormat='yyyy-MM-dd'
|
||||||
showTimeSelect
|
|
||||||
selected={
|
selected={
|
||||||
initialValues.period_to
|
initialValues.period_to
|
||||||
? new Date(
|
? new Date(
|
||||||
|
|||||||
@ -97,8 +97,7 @@ const EditPeriodsPage = () => {
|
|||||||
|
|
||||||
<FormField label='Period From'>
|
<FormField label='Period From'>
|
||||||
<DatePicker
|
<DatePicker
|
||||||
dateFormat='yyyy-MM-dd hh:mm'
|
dateFormat='yyyy-MM-dd'
|
||||||
showTimeSelect
|
|
||||||
selected={
|
selected={
|
||||||
initialValues.period_from
|
initialValues.period_from
|
||||||
? new Date(
|
? new Date(
|
||||||
@ -116,8 +115,7 @@ const EditPeriodsPage = () => {
|
|||||||
|
|
||||||
<FormField label='Period To'>
|
<FormField label='Period To'>
|
||||||
<DatePicker
|
<DatePicker
|
||||||
dateFormat='yyyy-MM-dd hh:mm'
|
dateFormat='yyyy-MM-dd'
|
||||||
showTimeSelect
|
|
||||||
selected={
|
selected={
|
||||||
initialValues.period_to
|
initialValues.period_to
|
||||||
? new Date(
|
? new Date(
|
||||||
|
|||||||
@ -28,12 +28,7 @@ const PeriodsTablesPage = () => {
|
|||||||
|
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
|
|
||||||
const [filters] = useState([
|
const [filters] = useState([{ label: 'Name', title: 'name' }]);
|
||||||
{ label: 'Name', title: 'name' },
|
|
||||||
|
|
||||||
{ label: 'Period From', title: 'period_from', date: 'true' },
|
|
||||||
{ label: 'Period To', title: 'period_to', date: 'true' },
|
|
||||||
]);
|
|
||||||
|
|
||||||
const hasCreatePermission =
|
const hasCreatePermission =
|
||||||
currentUser && hasPermission(currentUser, 'CREATE_PERIODS');
|
currentUser && hasPermission(currentUser, 'CREATE_PERIODS');
|
||||||
|
|||||||
@ -36,8 +36,10 @@ const initialValues = {
|
|||||||
name: '',
|
name: '',
|
||||||
|
|
||||||
period_from: '',
|
period_from: '',
|
||||||
|
datePeriod_from: '',
|
||||||
|
|
||||||
period_to: '',
|
period_to: '',
|
||||||
|
datePeriod_to: '',
|
||||||
};
|
};
|
||||||
|
|
||||||
const PeriodsNew = () => {
|
const PeriodsNew = () => {
|
||||||
@ -73,18 +75,14 @@ const PeriodsNew = () => {
|
|||||||
|
|
||||||
<FormField label='Period From'>
|
<FormField label='Period From'>
|
||||||
<Field
|
<Field
|
||||||
type='datetime-local'
|
type='date'
|
||||||
name='period_from'
|
name='period_from'
|
||||||
placeholder='Period From'
|
placeholder='Period From'
|
||||||
/>
|
/>
|
||||||
</FormField>
|
</FormField>
|
||||||
|
|
||||||
<FormField label='Period To'>
|
<FormField label='Period To'>
|
||||||
<Field
|
<Field type='date' name='period_to' placeholder='Period To' />
|
||||||
type='datetime-local'
|
|
||||||
name='period_to'
|
|
||||||
placeholder='Period To'
|
|
||||||
/>
|
|
||||||
</FormField>
|
</FormField>
|
||||||
|
|
||||||
<BaseDivider />
|
<BaseDivider />
|
||||||
|
|||||||
@ -28,12 +28,7 @@ const PeriodsTablesPage = () => {
|
|||||||
|
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
|
|
||||||
const [filters] = useState([
|
const [filters] = useState([{ label: 'Name', title: 'name' }]);
|
||||||
{ label: 'Name', title: 'name' },
|
|
||||||
|
|
||||||
{ label: 'Period From', title: 'period_from', date: 'true' },
|
|
||||||
{ label: 'Period To', title: 'period_to', date: 'true' },
|
|
||||||
]);
|
|
||||||
|
|
||||||
const hasCreatePermission =
|
const hasCreatePermission =
|
||||||
currentUser && hasPermission(currentUser, 'CREATE_PERIODS');
|
currentUser && hasPermission(currentUser, 'CREATE_PERIODS');
|
||||||
|
|||||||
@ -62,7 +62,7 @@ const PeriodsView = () => {
|
|||||||
<FormField label='Period From'>
|
<FormField label='Period From'>
|
||||||
{periods.period_from ? (
|
{periods.period_from ? (
|
||||||
<DatePicker
|
<DatePicker
|
||||||
dateFormat='yyyy-MM-dd hh:mm'
|
dateFormat='yyyy-MM-dd'
|
||||||
showTimeSelect
|
showTimeSelect
|
||||||
selected={
|
selected={
|
||||||
periods.period_from
|
periods.period_from
|
||||||
@ -81,7 +81,7 @@ const PeriodsView = () => {
|
|||||||
<FormField label='Period To'>
|
<FormField label='Period To'>
|
||||||
{periods.period_to ? (
|
{periods.period_to ? (
|
||||||
<DatePicker
|
<DatePicker
|
||||||
dateFormat='yyyy-MM-dd hh:mm'
|
dateFormat='yyyy-MM-dd'
|
||||||
showTimeSelect
|
showTimeSelect
|
||||||
selected={
|
selected={
|
||||||
periods.period_to
|
periods.period_to
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user