Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
12bcbe00bf | ||
|
|
166ee1b5bc | ||
|
|
f6126e3a5d |
5
.gitignore
vendored
5
.gitignore
vendored
@ -1,3 +1,8 @@
|
|||||||
node_modules/
|
node_modules/
|
||||||
*/node_modules/
|
*/node_modules/
|
||||||
*/build/
|
*/build/
|
||||||
|
|
||||||
|
**/node_modules/
|
||||||
|
**/build/
|
||||||
|
.DS_Store
|
||||||
|
.env
|
||||||
File diff suppressed because one or more lines are too long
@ -27,7 +27,7 @@ module.exports = class PrenotazioniDBApi {
|
|||||||
transaction,
|
transaction,
|
||||||
});
|
});
|
||||||
|
|
||||||
await prenotazioni.setTavolo(data.tavolo || null, {
|
await prenotazioni.setGioco(data.gioco || null, {
|
||||||
transaction,
|
transaction,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -86,9 +86,9 @@ module.exports = class PrenotazioniDBApi {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.tavolo !== undefined) {
|
if (data.gioco !== undefined) {
|
||||||
await prenotazioni.setTavolo(
|
await prenotazioni.setGioco(
|
||||||
data.tavolo,
|
data.gioco,
|
||||||
|
|
||||||
{ transaction },
|
{ transaction },
|
||||||
);
|
);
|
||||||
@ -162,7 +162,7 @@ module.exports = class PrenotazioniDBApi {
|
|||||||
transaction,
|
transaction,
|
||||||
});
|
});
|
||||||
|
|
||||||
output.tavolo = await prenotazioni.getTavolo({
|
output.gioco = await prenotazioni.getGioco({
|
||||||
transaction,
|
transaction,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -210,21 +210,21 @@ module.exports = class PrenotazioniDBApi {
|
|||||||
|
|
||||||
{
|
{
|
||||||
model: db.tavoli,
|
model: db.tavoli,
|
||||||
as: 'tavolo',
|
as: 'gioco',
|
||||||
|
|
||||||
where: filter.tavolo
|
where: filter.gioco
|
||||||
? {
|
? {
|
||||||
[Op.or]: [
|
[Op.or]: [
|
||||||
{
|
{
|
||||||
id: {
|
id: {
|
||||||
[Op.in]: filter.tavolo
|
[Op.in]: filter.gioco
|
||||||
.split('|')
|
.split('|')
|
||||||
.map((term) => Utils.uuid(term)),
|
.map((term) => Utils.uuid(term)),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
posti_totali: {
|
posti_totali: {
|
||||||
[Op.or]: filter.tavolo
|
[Op.or]: filter.gioco
|
||||||
.split('|')
|
.split('|')
|
||||||
.map((term) => ({ [Op.iLike]: `%${term}%` })),
|
.map((term) => ({ [Op.iLike]: `%${term}%` })),
|
||||||
},
|
},
|
||||||
|
|||||||
@ -154,7 +154,7 @@ module.exports = class TavoliDBApi {
|
|||||||
|
|
||||||
const output = tavoli.get({ plain: true });
|
const output = tavoli.get({ plain: true });
|
||||||
|
|
||||||
output.prenotazioni_tavolo = await tavoli.getPrenotazioni_tavolo({
|
output.prenotazioni_gioco = await tavoli.getPrenotazioni_gioco({
|
||||||
transaction,
|
transaction,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
44
backend/src/db/migrations/1756854205774.js
Normal file
44
backend/src/db/migrations/1756854205774.js
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
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.renameColumn('prenotazioni', 'tavoloId', 'giocoId', {
|
||||||
|
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.renameColumn('prenotazioni', 'giocoId', 'tavoloId', {
|
||||||
|
transaction,
|
||||||
|
});
|
||||||
|
|
||||||
|
await transaction.commit();
|
||||||
|
} catch (err) {
|
||||||
|
await transaction.rollback();
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
36
backend/src/db/migrations/1756854338007.js
Normal file
36
backend/src/db/migrations/1756854338007.js
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
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 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 transaction.commit();
|
||||||
|
} catch (err) {
|
||||||
|
await transaction.rollback();
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
@ -45,9 +45,9 @@ module.exports = function (sequelize, DataTypes) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
db.prenotazioni.belongsTo(db.tavoli, {
|
db.prenotazioni.belongsTo(db.tavoli, {
|
||||||
as: 'tavolo',
|
as: 'gioco',
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
name: 'tavoloId',
|
name: 'giocoId',
|
||||||
},
|
},
|
||||||
constraints: false,
|
constraints: false,
|
||||||
});
|
});
|
||||||
|
|||||||
@ -39,9 +39,9 @@ module.exports = function (sequelize, DataTypes) {
|
|||||||
/// loop through entities and it's fields, and if ref === current e[name] and create relation has many on parent entity
|
/// loop through entities and it's fields, and if ref === current e[name] and create relation has many on parent entity
|
||||||
|
|
||||||
db.tavoli.hasMany(db.prenotazioni, {
|
db.tavoli.hasMany(db.prenotazioni, {
|
||||||
as: 'prenotazioni_tavolo',
|
as: 'prenotazioni_gioco',
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
name: 'tavoloId',
|
name: 'giocoId',
|
||||||
},
|
},
|
||||||
constraints: false,
|
constraints: false,
|
||||||
});
|
});
|
||||||
|
|||||||
@ -27,12 +27,6 @@ const GiochiData = [
|
|||||||
|
|
||||||
// type code here for "images" field
|
// type code here for "images" field
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
|
||||||
nome: 'Ticket to Ride',
|
|
||||||
|
|
||||||
// type code here for "images" field
|
|
||||||
},
|
|
||||||
];
|
];
|
||||||
|
|
||||||
const PrenotazioniData = [
|
const PrenotazioniData = [
|
||||||
@ -59,14 +53,6 @@ const PrenotazioniData = [
|
|||||||
|
|
||||||
data_prenotazione: new Date('2023-11-12T12:00:00Z'),
|
data_prenotazione: new Date('2023-11-12T12:00:00Z'),
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
|
||||||
// type code here for "relation_one" field
|
|
||||||
|
|
||||||
// type code here for "relation_one" field
|
|
||||||
|
|
||||||
data_prenotazione: new Date('2023-11-13T13:00:00Z'),
|
|
||||||
},
|
|
||||||
];
|
];
|
||||||
|
|
||||||
const SerateData = [
|
const SerateData = [
|
||||||
@ -93,14 +79,6 @@ const SerateData = [
|
|||||||
|
|
||||||
numero_tavoli: 6,
|
numero_tavoli: 6,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
|
||||||
tema: 'Serata giochi da tavolo classici',
|
|
||||||
|
|
||||||
data: new Date('2023-12-06T19:00:00Z'),
|
|
||||||
|
|
||||||
numero_tavoli: 3,
|
|
||||||
},
|
|
||||||
];
|
];
|
||||||
|
|
||||||
const TavoliData = [
|
const TavoliData = [
|
||||||
@ -133,16 +111,6 @@ const TavoliData = [
|
|||||||
|
|
||||||
posti_occupati: 4,
|
posti_occupati: 4,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
|
||||||
// type code here for "relation_one" field
|
|
||||||
|
|
||||||
// type code here for "relation_one" field
|
|
||||||
|
|
||||||
posti_totali: 3,
|
|
||||||
|
|
||||||
posti_occupati: 1,
|
|
||||||
},
|
|
||||||
];
|
];
|
||||||
|
|
||||||
// Similar logic for "relation_many"
|
// Similar logic for "relation_many"
|
||||||
@ -180,62 +148,40 @@ async function associatePrenotazioniWithUtente() {
|
|||||||
if (Prenotazioni2?.setUtente) {
|
if (Prenotazioni2?.setUtente) {
|
||||||
await Prenotazioni2.setUtente(relatedUtente2);
|
await Prenotazioni2.setUtente(relatedUtente2);
|
||||||
}
|
}
|
||||||
|
|
||||||
const relatedUtente3 = await Users.findOne({
|
|
||||||
offset: Math.floor(Math.random() * (await Users.count())),
|
|
||||||
});
|
|
||||||
const Prenotazioni3 = await Prenotazioni.findOne({
|
|
||||||
order: [['id', 'ASC']],
|
|
||||||
offset: 3,
|
|
||||||
});
|
|
||||||
if (Prenotazioni3?.setUtente) {
|
|
||||||
await Prenotazioni3.setUtente(relatedUtente3);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function associatePrenotazioniWithTavolo() {
|
async function associatePrenotazioniWithGioco() {
|
||||||
const relatedTavolo0 = await Tavoli.findOne({
|
const relatedGioco0 = await Tavoli.findOne({
|
||||||
offset: Math.floor(Math.random() * (await Tavoli.count())),
|
offset: Math.floor(Math.random() * (await Tavoli.count())),
|
||||||
});
|
});
|
||||||
const Prenotazioni0 = await Prenotazioni.findOne({
|
const Prenotazioni0 = await Prenotazioni.findOne({
|
||||||
order: [['id', 'ASC']],
|
order: [['id', 'ASC']],
|
||||||
offset: 0,
|
offset: 0,
|
||||||
});
|
});
|
||||||
if (Prenotazioni0?.setTavolo) {
|
if (Prenotazioni0?.setGioco) {
|
||||||
await Prenotazioni0.setTavolo(relatedTavolo0);
|
await Prenotazioni0.setGioco(relatedGioco0);
|
||||||
}
|
}
|
||||||
|
|
||||||
const relatedTavolo1 = await Tavoli.findOne({
|
const relatedGioco1 = await Tavoli.findOne({
|
||||||
offset: Math.floor(Math.random() * (await Tavoli.count())),
|
offset: Math.floor(Math.random() * (await Tavoli.count())),
|
||||||
});
|
});
|
||||||
const Prenotazioni1 = await Prenotazioni.findOne({
|
const Prenotazioni1 = await Prenotazioni.findOne({
|
||||||
order: [['id', 'ASC']],
|
order: [['id', 'ASC']],
|
||||||
offset: 1,
|
offset: 1,
|
||||||
});
|
});
|
||||||
if (Prenotazioni1?.setTavolo) {
|
if (Prenotazioni1?.setGioco) {
|
||||||
await Prenotazioni1.setTavolo(relatedTavolo1);
|
await Prenotazioni1.setGioco(relatedGioco1);
|
||||||
}
|
}
|
||||||
|
|
||||||
const relatedTavolo2 = await Tavoli.findOne({
|
const relatedGioco2 = await Tavoli.findOne({
|
||||||
offset: Math.floor(Math.random() * (await Tavoli.count())),
|
offset: Math.floor(Math.random() * (await Tavoli.count())),
|
||||||
});
|
});
|
||||||
const Prenotazioni2 = await Prenotazioni.findOne({
|
const Prenotazioni2 = await Prenotazioni.findOne({
|
||||||
order: [['id', 'ASC']],
|
order: [['id', 'ASC']],
|
||||||
offset: 2,
|
offset: 2,
|
||||||
});
|
});
|
||||||
if (Prenotazioni2?.setTavolo) {
|
if (Prenotazioni2?.setGioco) {
|
||||||
await Prenotazioni2.setTavolo(relatedTavolo2);
|
await Prenotazioni2.setGioco(relatedGioco2);
|
||||||
}
|
|
||||||
|
|
||||||
const relatedTavolo3 = await Tavoli.findOne({
|
|
||||||
offset: Math.floor(Math.random() * (await Tavoli.count())),
|
|
||||||
});
|
|
||||||
const Prenotazioni3 = await Prenotazioni.findOne({
|
|
||||||
order: [['id', 'ASC']],
|
|
||||||
offset: 3,
|
|
||||||
});
|
|
||||||
if (Prenotazioni3?.setTavolo) {
|
|
||||||
await Prenotazioni3.setTavolo(relatedTavolo3);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -272,17 +218,6 @@ async function associateTavoliWithSeratum() {
|
|||||||
if (Tavoli2?.setSeratum) {
|
if (Tavoli2?.setSeratum) {
|
||||||
await Tavoli2.setSeratum(relatedSeratum2);
|
await Tavoli2.setSeratum(relatedSeratum2);
|
||||||
}
|
}
|
||||||
|
|
||||||
const relatedSeratum3 = await Serate.findOne({
|
|
||||||
offset: Math.floor(Math.random() * (await Serate.count())),
|
|
||||||
});
|
|
||||||
const Tavoli3 = await Tavoli.findOne({
|
|
||||||
order: [['id', 'ASC']],
|
|
||||||
offset: 3,
|
|
||||||
});
|
|
||||||
if (Tavoli3?.setSeratum) {
|
|
||||||
await Tavoli3.setSeratum(relatedSeratum3);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function associateTavoliWithGioco() {
|
async function associateTavoliWithGioco() {
|
||||||
@ -318,17 +253,6 @@ async function associateTavoliWithGioco() {
|
|||||||
if (Tavoli2?.setGioco) {
|
if (Tavoli2?.setGioco) {
|
||||||
await Tavoli2.setGioco(relatedGioco2);
|
await Tavoli2.setGioco(relatedGioco2);
|
||||||
}
|
}
|
||||||
|
|
||||||
const relatedGioco3 = await Giochi.findOne({
|
|
||||||
offset: Math.floor(Math.random() * (await Giochi.count())),
|
|
||||||
});
|
|
||||||
const Tavoli3 = await Tavoli.findOne({
|
|
||||||
order: [['id', 'ASC']],
|
|
||||||
offset: 3,
|
|
||||||
});
|
|
||||||
if (Tavoli3?.setGioco) {
|
|
||||||
await Tavoli3.setGioco(relatedGioco3);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
@ -346,7 +270,7 @@ module.exports = {
|
|||||||
|
|
||||||
await associatePrenotazioniWithUtente(),
|
await associatePrenotazioniWithUtente(),
|
||||||
|
|
||||||
await associatePrenotazioniWithTavolo(),
|
await associatePrenotazioniWithGioco(),
|
||||||
|
|
||||||
await associateTavoliWithSeratum(),
|
await associateTavoliWithSeratum(),
|
||||||
|
|
||||||
|
|||||||
1
frontend/json/runtimeError.json
Normal file
1
frontend/json/runtimeError.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
{}
|
||||||
@ -89,11 +89,11 @@ const CardPrenotazioni = ({
|
|||||||
|
|
||||||
<div className='flex justify-between gap-x-4 py-3'>
|
<div className='flex justify-between gap-x-4 py-3'>
|
||||||
<dt className=' text-gray-500 dark:text-dark-600'>
|
<dt className=' text-gray-500 dark:text-dark-600'>
|
||||||
Tavolo
|
Giochi
|
||||||
</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.tavoliOneListFormatter(item.tavolo)}
|
{dataFormatter.tavoliOneListFormatter(item.gioco)}
|
||||||
</div>
|
</div>
|
||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -61,9 +61,9 @@ const ListPrenotazioni = ({
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className={'flex-1 px-3'}>
|
<div className={'flex-1 px-3'}>
|
||||||
<p className={'text-xs text-gray-500 '}>Tavolo</p>
|
<p className={'text-xs text-gray-500 '}>Giochi</p>
|
||||||
<p className={'line-clamp-2'}>
|
<p className={'line-clamp-2'}>
|
||||||
{dataFormatter.tavoliOneListFormatter(item.tavolo)}
|
{dataFormatter.tavoliOneListFormatter(item.gioco)}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@ -59,8 +59,8 @@ export const loadColumns = async (
|
|||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
field: 'tavolo',
|
field: 'gioco',
|
||||||
headerName: 'Tavolo',
|
headerName: 'Giochi',
|
||||||
flex: 1,
|
flex: 1,
|
||||||
minWidth: 120,
|
minWidth: 120,
|
||||||
filterable: false,
|
filterable: false,
|
||||||
|
|||||||
@ -38,7 +38,7 @@ const EditPrenotazioni = () => {
|
|||||||
const initVals = {
|
const initVals = {
|
||||||
utente: null,
|
utente: null,
|
||||||
|
|
||||||
tavolo: null,
|
gioco: null,
|
||||||
|
|
||||||
data_prenotazione: new Date(),
|
data_prenotazione: new Date(),
|
||||||
};
|
};
|
||||||
@ -106,12 +106,12 @@ const EditPrenotazioni = () => {
|
|||||||
></Field>
|
></Field>
|
||||||
</FormField>
|
</FormField>
|
||||||
|
|
||||||
<FormField label='Tavolo' labelFor='tavolo'>
|
<FormField label='Giochi' labelFor='gioco'>
|
||||||
<Field
|
<Field
|
||||||
name='tavolo'
|
name='gioco'
|
||||||
id='tavolo'
|
id='gioco'
|
||||||
component={SelectField}
|
component={SelectField}
|
||||||
options={initialValues.tavolo}
|
options={initialValues.gioco}
|
||||||
itemRef={'tavoli'}
|
itemRef={'tavoli'}
|
||||||
showField={'posti_totali'}
|
showField={'posti_totali'}
|
||||||
></Field>
|
></Field>
|
||||||
|
|||||||
@ -38,7 +38,7 @@ const EditPrenotazioniPage = () => {
|
|||||||
const initVals = {
|
const initVals = {
|
||||||
utente: null,
|
utente: null,
|
||||||
|
|
||||||
tavolo: null,
|
gioco: null,
|
||||||
|
|
||||||
data_prenotazione: new Date(),
|
data_prenotazione: new Date(),
|
||||||
};
|
};
|
||||||
@ -104,12 +104,12 @@ const EditPrenotazioniPage = () => {
|
|||||||
></Field>
|
></Field>
|
||||||
</FormField>
|
</FormField>
|
||||||
|
|
||||||
<FormField label='Tavolo' labelFor='tavolo'>
|
<FormField label='Giochi' labelFor='gioco'>
|
||||||
<Field
|
<Field
|
||||||
name='tavolo'
|
name='gioco'
|
||||||
id='tavolo'
|
id='gioco'
|
||||||
component={SelectField}
|
component={SelectField}
|
||||||
options={initialValues.tavolo}
|
options={initialValues.gioco}
|
||||||
itemRef={'tavoli'}
|
itemRef={'tavoli'}
|
||||||
showField={'posti_totali'}
|
showField={'posti_totali'}
|
||||||
></Field>
|
></Field>
|
||||||
|
|||||||
@ -36,7 +36,7 @@ const PrenotazioniTablesPage = () => {
|
|||||||
|
|
||||||
{ label: 'Utente', title: 'utente' },
|
{ label: 'Utente', title: 'utente' },
|
||||||
|
|
||||||
{ label: 'Tavolo', title: 'tavolo' },
|
{ label: 'Giochi', title: 'gioco' },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const hasCreatePermission =
|
const hasCreatePermission =
|
||||||
|
|||||||
@ -35,7 +35,7 @@ import moment from 'moment';
|
|||||||
const initialValues = {
|
const initialValues = {
|
||||||
utente: '',
|
utente: '',
|
||||||
|
|
||||||
tavolo: '',
|
gioco: '',
|
||||||
|
|
||||||
data_prenotazione: '',
|
data_prenotazione: '',
|
||||||
};
|
};
|
||||||
@ -77,10 +77,10 @@ const PrenotazioniNew = () => {
|
|||||||
></Field>
|
></Field>
|
||||||
</FormField>
|
</FormField>
|
||||||
|
|
||||||
<FormField label='Tavolo' labelFor='tavolo'>
|
<FormField label='Giochi' labelFor='gioco'>
|
||||||
<Field
|
<Field
|
||||||
name='tavolo'
|
name='gioco'
|
||||||
id='tavolo'
|
id='gioco'
|
||||||
component={SelectField}
|
component={SelectField}
|
||||||
options={[]}
|
options={[]}
|
||||||
itemRef={'tavoli'}
|
itemRef={'tavoli'}
|
||||||
|
|||||||
@ -36,7 +36,7 @@ const PrenotazioniTablesPage = () => {
|
|||||||
|
|
||||||
{ label: 'Utente', title: 'utente' },
|
{ label: 'Utente', title: 'utente' },
|
||||||
|
|
||||||
{ label: 'Tavolo', title: 'tavolo' },
|
{ label: 'Giochi', title: 'gioco' },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const hasCreatePermission =
|
const hasCreatePermission =
|
||||||
|
|||||||
@ -61,9 +61,9 @@ const PrenotazioniView = () => {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className={'mb-4'}>
|
<div className={'mb-4'}>
|
||||||
<p className={'block font-bold mb-2'}>Tavolo</p>
|
<p className={'block font-bold mb-2'}>Giochi</p>
|
||||||
|
|
||||||
<p>{prenotazioni?.tavolo?.posti_totali ?? 'No data'}</p>
|
<p>{prenotazioni?.gioco?.posti_totali ?? 'No data'}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<FormField label='DataPrenotazione'>
|
<FormField label='DataPrenotazione'>
|
||||||
|
|||||||
@ -77,7 +77,7 @@ const TavoliView = () => {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<>
|
<>
|
||||||
<p className={'block font-bold mb-2'}>Prenotazioni Tavolo</p>
|
<p className={'block font-bold mb-2'}>Prenotazioni Giochi</p>
|
||||||
<CardBox
|
<CardBox
|
||||||
className='mb-6 border border-gray-300 rounded overflow-hidden'
|
className='mb-6 border border-gray-300 rounded overflow-hidden'
|
||||||
hasTable
|
hasTable
|
||||||
@ -90,9 +90,9 @@ const TavoliView = () => {
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{tavoli.prenotazioni_tavolo &&
|
{tavoli.prenotazioni_gioco &&
|
||||||
Array.isArray(tavoli.prenotazioni_tavolo) &&
|
Array.isArray(tavoli.prenotazioni_gioco) &&
|
||||||
tavoli.prenotazioni_tavolo.map((item: any) => (
|
tavoli.prenotazioni_gioco.map((item: any) => (
|
||||||
<tr
|
<tr
|
||||||
key={item.id}
|
key={item.id}
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
@ -111,7 +111,7 @@ const TavoliView = () => {
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
{!tavoli?.prenotazioni_tavolo?.length && (
|
{!tavoli?.prenotazioni_gioco?.length && (
|
||||||
<div className={'text-center py-4'}>No data</div>
|
<div className={'text-center py-4'}>No data</div>
|
||||||
)}
|
)}
|
||||||
</CardBox>
|
</CardBox>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user