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: {
|
||||
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: {
|
||||
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: {
|
||||
|
||||
1
frontend/json/runtimeError.json
Normal file
1
frontend/json/runtimeError.json
Normal file
@ -0,0 +1 @@
|
||||
{}
|
||||
@ -89,7 +89,7 @@ const CardPeriods = ({
|
||||
</dt>
|
||||
<dd className='flex items-start gap-x-2'>
|
||||
<div className='font-medium line-clamp-4'>
|
||||
{dataFormatter.dateTimeFormatter(item.period_from)}
|
||||
{dataFormatter.dateFormatter(item.period_from)}
|
||||
</div>
|
||||
</dd>
|
||||
</div>
|
||||
@ -100,7 +100,7 @@ const CardPeriods = ({
|
||||
</dt>
|
||||
<dd className='flex items-start gap-x-2'>
|
||||
<div className='font-medium line-clamp-4'>
|
||||
{dataFormatter.dateTimeFormatter(item.period_to)}
|
||||
{dataFormatter.dateFormatter(item.period_to)}
|
||||
</div>
|
||||
</dd>
|
||||
</div>
|
||||
|
||||
@ -59,14 +59,14 @@ const ListPeriods = ({
|
||||
<div className={'flex-1 px-3'}>
|
||||
<p className={'text-xs text-gray-500 '}>Period From</p>
|
||||
<p className={'line-clamp-2'}>
|
||||
{dataFormatter.dateTimeFormatter(item.period_from)}
|
||||
{dataFormatter.dateFormatter(item.period_from)}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className={'flex-1 px-3'}>
|
||||
<p className={'text-xs text-gray-500 '}>Period To</p>
|
||||
<p className={'line-clamp-2'}>
|
||||
{dataFormatter.dateTimeFormatter(item.period_to)}
|
||||
{dataFormatter.dateFormatter(item.period_to)}
|
||||
</p>
|
||||
</div>
|
||||
</Link>
|
||||
|
||||
@ -61,7 +61,7 @@ export const loadColumns = async (
|
||||
|
||||
editable: hasUpdatePermission,
|
||||
|
||||
type: 'dateTime',
|
||||
type: 'date',
|
||||
valueGetter: (params: GridValueGetterParams) =>
|
||||
new Date(params.row.period_from),
|
||||
},
|
||||
@ -77,7 +77,7 @@ export const loadColumns = async (
|
||||
|
||||
editable: hasUpdatePermission,
|
||||
|
||||
type: 'dateTime',
|
||||
type: 'date',
|
||||
valueGetter: (params: GridValueGetterParams) =>
|
||||
new Date(params.row.period_to),
|
||||
},
|
||||
|
||||
@ -99,8 +99,7 @@ const EditPeriods = () => {
|
||||
|
||||
<FormField label='Period From'>
|
||||
<DatePicker
|
||||
dateFormat='yyyy-MM-dd hh:mm'
|
||||
showTimeSelect
|
||||
dateFormat='yyyy-MM-dd'
|
||||
selected={
|
||||
initialValues.period_from
|
||||
? new Date(
|
||||
@ -118,8 +117,7 @@ const EditPeriods = () => {
|
||||
|
||||
<FormField label='Period To'>
|
||||
<DatePicker
|
||||
dateFormat='yyyy-MM-dd hh:mm'
|
||||
showTimeSelect
|
||||
dateFormat='yyyy-MM-dd'
|
||||
selected={
|
||||
initialValues.period_to
|
||||
? new Date(
|
||||
|
||||
@ -97,8 +97,7 @@ const EditPeriodsPage = () => {
|
||||
|
||||
<FormField label='Period From'>
|
||||
<DatePicker
|
||||
dateFormat='yyyy-MM-dd hh:mm'
|
||||
showTimeSelect
|
||||
dateFormat='yyyy-MM-dd'
|
||||
selected={
|
||||
initialValues.period_from
|
||||
? new Date(
|
||||
@ -116,8 +115,7 @@ const EditPeriodsPage = () => {
|
||||
|
||||
<FormField label='Period To'>
|
||||
<DatePicker
|
||||
dateFormat='yyyy-MM-dd hh:mm'
|
||||
showTimeSelect
|
||||
dateFormat='yyyy-MM-dd'
|
||||
selected={
|
||||
initialValues.period_to
|
||||
? new Date(
|
||||
|
||||
@ -28,12 +28,7 @@ const PeriodsTablesPage = () => {
|
||||
|
||||
const dispatch = useAppDispatch();
|
||||
|
||||
const [filters] = useState([
|
||||
{ label: 'Name', title: 'name' },
|
||||
|
||||
{ label: 'Period From', title: 'period_from', date: 'true' },
|
||||
{ label: 'Period To', title: 'period_to', date: 'true' },
|
||||
]);
|
||||
const [filters] = useState([{ label: 'Name', title: 'name' }]);
|
||||
|
||||
const hasCreatePermission =
|
||||
currentUser && hasPermission(currentUser, 'CREATE_PERIODS');
|
||||
|
||||
@ -36,8 +36,10 @@ const initialValues = {
|
||||
name: '',
|
||||
|
||||
period_from: '',
|
||||
datePeriod_from: '',
|
||||
|
||||
period_to: '',
|
||||
datePeriod_to: '',
|
||||
};
|
||||
|
||||
const PeriodsNew = () => {
|
||||
@ -73,18 +75,14 @@ const PeriodsNew = () => {
|
||||
|
||||
<FormField label='Period From'>
|
||||
<Field
|
||||
type='datetime-local'
|
||||
type='date'
|
||||
name='period_from'
|
||||
placeholder='Period From'
|
||||
/>
|
||||
</FormField>
|
||||
|
||||
<FormField label='Period To'>
|
||||
<Field
|
||||
type='datetime-local'
|
||||
name='period_to'
|
||||
placeholder='Period To'
|
||||
/>
|
||||
<Field type='date' name='period_to' placeholder='Period To' />
|
||||
</FormField>
|
||||
|
||||
<BaseDivider />
|
||||
|
||||
@ -28,12 +28,7 @@ const PeriodsTablesPage = () => {
|
||||
|
||||
const dispatch = useAppDispatch();
|
||||
|
||||
const [filters] = useState([
|
||||
{ label: 'Name', title: 'name' },
|
||||
|
||||
{ label: 'Period From', title: 'period_from', date: 'true' },
|
||||
{ label: 'Period To', title: 'period_to', date: 'true' },
|
||||
]);
|
||||
const [filters] = useState([{ label: 'Name', title: 'name' }]);
|
||||
|
||||
const hasCreatePermission =
|
||||
currentUser && hasPermission(currentUser, 'CREATE_PERIODS');
|
||||
|
||||
@ -62,7 +62,7 @@ const PeriodsView = () => {
|
||||
<FormField label='Period From'>
|
||||
{periods.period_from ? (
|
||||
<DatePicker
|
||||
dateFormat='yyyy-MM-dd hh:mm'
|
||||
dateFormat='yyyy-MM-dd'
|
||||
showTimeSelect
|
||||
selected={
|
||||
periods.period_from
|
||||
@ -81,7 +81,7 @@ const PeriodsView = () => {
|
||||
<FormField label='Period To'>
|
||||
{periods.period_to ? (
|
||||
<DatePicker
|
||||
dateFormat='yyyy-MM-dd hh:mm'
|
||||
dateFormat='yyyy-MM-dd'
|
||||
showTimeSelect
|
||||
selected={
|
||||
periods.period_to
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user