Updated via schema editor on 2025-09-16 21:12
This commit is contained in:
parent
402aa82086
commit
85d404dd4d
File diff suppressed because one or more lines are too long
@ -134,40 +134,40 @@ module.exports = class OrganizationsDBApi {
|
||||
|
||||
const output = organizations.get({ plain: true });
|
||||
|
||||
output.users_organizations = await organizations.getUsers_organizations({
|
||||
transaction,
|
||||
});
|
||||
|
||||
output.categories_organizations =
|
||||
await organizations.getCategories_organizations({
|
||||
transaction,
|
||||
});
|
||||
|
||||
output.customers_organizations =
|
||||
await organizations.getCustomers_organizations({
|
||||
transaction,
|
||||
});
|
||||
|
||||
output.furniture_types_organizations =
|
||||
await organizations.getFurniture_types_organizations({
|
||||
transaction,
|
||||
});
|
||||
|
||||
output.orders_organizations = await organizations.getOrders_organizations({
|
||||
transaction,
|
||||
});
|
||||
|
||||
output.payments_organizations =
|
||||
await organizations.getPayments_organizations({
|
||||
transaction,
|
||||
});
|
||||
|
||||
output.furniture_types_organizations =
|
||||
await organizations.getFurniture_types_organizations({
|
||||
transaction,
|
||||
});
|
||||
|
||||
output.reports_organizations = await organizations.getReports_organizations(
|
||||
{
|
||||
transaction,
|
||||
},
|
||||
);
|
||||
|
||||
output.customers_organizations =
|
||||
await organizations.getCustomers_organizations({
|
||||
transaction,
|
||||
});
|
||||
|
||||
output.orders_organizations = await organizations.getOrders_organizations({
|
||||
transaction,
|
||||
});
|
||||
|
||||
output.users_organizations = await organizations.getUsers_organizations({
|
||||
transaction,
|
||||
});
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
36
backend/src/db/migrations/1758057086747.js
Normal file
36
backend/src/db/migrations/1758057086747.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;
|
||||
}
|
||||
},
|
||||
};
|
||||
@ -34,14 +34,6 @@ module.exports = function (sequelize, DataTypes) {
|
||||
organizations.associate = (db) => {
|
||||
/// loop through entities and it's fields, and if ref === current e[name] and create relation has many on parent entity
|
||||
|
||||
db.organizations.hasMany(db.users, {
|
||||
as: 'users_organizations',
|
||||
foreignKey: {
|
||||
name: 'organizationsId',
|
||||
},
|
||||
constraints: false,
|
||||
});
|
||||
|
||||
db.organizations.hasMany(db.categories, {
|
||||
as: 'categories_organizations',
|
||||
foreignKey: {
|
||||
@ -50,30 +42,6 @@ module.exports = function (sequelize, DataTypes) {
|
||||
constraints: false,
|
||||
});
|
||||
|
||||
db.organizations.hasMany(db.customers, {
|
||||
as: 'customers_organizations',
|
||||
foreignKey: {
|
||||
name: 'organizationsId',
|
||||
},
|
||||
constraints: false,
|
||||
});
|
||||
|
||||
db.organizations.hasMany(db.furniture_types, {
|
||||
as: 'furniture_types_organizations',
|
||||
foreignKey: {
|
||||
name: 'organizationsId',
|
||||
},
|
||||
constraints: false,
|
||||
});
|
||||
|
||||
db.organizations.hasMany(db.orders, {
|
||||
as: 'orders_organizations',
|
||||
foreignKey: {
|
||||
name: 'organizationsId',
|
||||
},
|
||||
constraints: false,
|
||||
});
|
||||
|
||||
db.organizations.hasMany(db.payments, {
|
||||
as: 'payments_organizations',
|
||||
foreignKey: {
|
||||
@ -82,6 +50,14 @@ module.exports = function (sequelize, DataTypes) {
|
||||
constraints: false,
|
||||
});
|
||||
|
||||
db.organizations.hasMany(db.furniture_types, {
|
||||
as: 'furniture_types_organizations',
|
||||
foreignKey: {
|
||||
name: 'organizationsId',
|
||||
},
|
||||
constraints: false,
|
||||
});
|
||||
|
||||
db.organizations.hasMany(db.reports, {
|
||||
as: 'reports_organizations',
|
||||
foreignKey: {
|
||||
@ -90,6 +66,30 @@ module.exports = function (sequelize, DataTypes) {
|
||||
constraints: false,
|
||||
});
|
||||
|
||||
db.organizations.hasMany(db.customers, {
|
||||
as: 'customers_organizations',
|
||||
foreignKey: {
|
||||
name: 'organizationsId',
|
||||
},
|
||||
constraints: false,
|
||||
});
|
||||
|
||||
db.organizations.hasMany(db.orders, {
|
||||
as: 'orders_organizations',
|
||||
foreignKey: {
|
||||
name: 'organizationsId',
|
||||
},
|
||||
constraints: false,
|
||||
});
|
||||
|
||||
db.organizations.hasMany(db.users, {
|
||||
as: 'users_organizations',
|
||||
foreignKey: {
|
||||
name: 'organizationsId',
|
||||
},
|
||||
constraints: false,
|
||||
});
|
||||
|
||||
//end loop
|
||||
|
||||
db.organizations.belongsTo(db.users, {
|
||||
|
||||
@ -101,15 +101,15 @@ module.exports = {
|
||||
}
|
||||
|
||||
const entities = [
|
||||
'users',
|
||||
'categories',
|
||||
'customers',
|
||||
'furniture_types',
|
||||
'orders',
|
||||
'roles',
|
||||
'payments',
|
||||
'furniture_types',
|
||||
'reports',
|
||||
'permissions',
|
||||
'customers',
|
||||
'orders',
|
||||
'users',
|
||||
'roles',
|
||||
'organizations',
|
||||
,
|
||||
];
|
||||
@ -151,34 +151,6 @@ primary key ("roles_permissionsId", "permissionId")
|
||||
);`);
|
||||
|
||||
await queryInterface.bulkInsert('rolesPermissionsPermissions', [
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('OperationsManager'),
|
||||
permissionId: getId('CREATE_USERS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('OperationsManager'),
|
||||
permissionId: getId('READ_USERS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('OperationsManager'),
|
||||
permissionId: getId('UPDATE_USERS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('OperationsManager'),
|
||||
permissionId: getId('DELETE_USERS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
@ -260,70 +232,70 @@ primary key ("roles_permissionsId", "permissionId")
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('OperationsManager'),
|
||||
permissionId: getId('CREATE_CUSTOMERS'),
|
||||
permissionId: getId('CREATE_PAYMENTS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('OperationsManager'),
|
||||
permissionId: getId('READ_CUSTOMERS'),
|
||||
permissionId: getId('READ_PAYMENTS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('OperationsManager'),
|
||||
permissionId: getId('UPDATE_CUSTOMERS'),
|
||||
permissionId: getId('UPDATE_PAYMENTS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('OperationsManager'),
|
||||
permissionId: getId('DELETE_CUSTOMERS'),
|
||||
permissionId: getId('DELETE_PAYMENTS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('SalesLead'),
|
||||
permissionId: getId('READ_CUSTOMERS'),
|
||||
permissionId: getId('READ_PAYMENTS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('SalesLead'),
|
||||
permissionId: getId('UPDATE_CUSTOMERS'),
|
||||
permissionId: getId('UPDATE_PAYMENTS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('CustomerSupport'),
|
||||
permissionId: getId('READ_CUSTOMERS'),
|
||||
permissionId: getId('READ_PAYMENTS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('CustomerSupport'),
|
||||
permissionId: getId('UPDATE_CUSTOMERS'),
|
||||
permissionId: getId('UPDATE_PAYMENTS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('DataAnalyst'),
|
||||
permissionId: getId('READ_CUSTOMERS'),
|
||||
permissionId: getId('READ_PAYMENTS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('DataAnalyst'),
|
||||
permissionId: getId('UPDATE_CUSTOMERS'),
|
||||
permissionId: getId('UPDATE_PAYMENTS'),
|
||||
},
|
||||
|
||||
{
|
||||
@ -403,167 +375,6 @@ primary key ("roles_permissionsId", "permissionId")
|
||||
permissionId: getId('UPDATE_FURNITURE_TYPES'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('OperationsManager'),
|
||||
permissionId: getId('CREATE_ORDERS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('OperationsManager'),
|
||||
permissionId: getId('READ_ORDERS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('OperationsManager'),
|
||||
permissionId: getId('UPDATE_ORDERS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('OperationsManager'),
|
||||
permissionId: getId('DELETE_ORDERS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('SalesLead'),
|
||||
permissionId: getId('CREATE_ORDERS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('SalesLead'),
|
||||
permissionId: getId('READ_ORDERS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('SalesLead'),
|
||||
permissionId: getId('UPDATE_ORDERS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('InventorySpecialist'),
|
||||
permissionId: getId('READ_ORDERS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('InventorySpecialist'),
|
||||
permissionId: getId('UPDATE_ORDERS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('CustomerSupport'),
|
||||
permissionId: getId('READ_ORDERS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('CustomerSupport'),
|
||||
permissionId: getId('UPDATE_ORDERS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('DataAnalyst'),
|
||||
permissionId: getId('READ_ORDERS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('DataAnalyst'),
|
||||
permissionId: getId('UPDATE_ORDERS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('OperationsManager'),
|
||||
permissionId: getId('CREATE_PAYMENTS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('OperationsManager'),
|
||||
permissionId: getId('READ_PAYMENTS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('OperationsManager'),
|
||||
permissionId: getId('UPDATE_PAYMENTS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('OperationsManager'),
|
||||
permissionId: getId('DELETE_PAYMENTS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('SalesLead'),
|
||||
permissionId: getId('READ_PAYMENTS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('SalesLead'),
|
||||
permissionId: getId('UPDATE_PAYMENTS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('CustomerSupport'),
|
||||
permissionId: getId('READ_PAYMENTS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('CustomerSupport'),
|
||||
permissionId: getId('UPDATE_PAYMENTS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('DataAnalyst'),
|
||||
permissionId: getId('READ_PAYMENTS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('DataAnalyst'),
|
||||
permissionId: getId('UPDATE_PAYMENTS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
@ -648,6 +459,195 @@ primary key ("roles_permissionsId", "permissionId")
|
||||
permissionId: getId('UPDATE_REPORTS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('OperationsManager'),
|
||||
permissionId: getId('CREATE_CUSTOMERS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('OperationsManager'),
|
||||
permissionId: getId('READ_CUSTOMERS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('OperationsManager'),
|
||||
permissionId: getId('UPDATE_CUSTOMERS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('OperationsManager'),
|
||||
permissionId: getId('DELETE_CUSTOMERS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('SalesLead'),
|
||||
permissionId: getId('READ_CUSTOMERS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('SalesLead'),
|
||||
permissionId: getId('UPDATE_CUSTOMERS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('CustomerSupport'),
|
||||
permissionId: getId('READ_CUSTOMERS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('CustomerSupport'),
|
||||
permissionId: getId('UPDATE_CUSTOMERS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('DataAnalyst'),
|
||||
permissionId: getId('READ_CUSTOMERS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('DataAnalyst'),
|
||||
permissionId: getId('UPDATE_CUSTOMERS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('OperationsManager'),
|
||||
permissionId: getId('CREATE_ORDERS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('OperationsManager'),
|
||||
permissionId: getId('READ_ORDERS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('OperationsManager'),
|
||||
permissionId: getId('UPDATE_ORDERS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('OperationsManager'),
|
||||
permissionId: getId('DELETE_ORDERS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('SalesLead'),
|
||||
permissionId: getId('CREATE_ORDERS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('SalesLead'),
|
||||
permissionId: getId('READ_ORDERS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('SalesLead'),
|
||||
permissionId: getId('UPDATE_ORDERS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('InventorySpecialist'),
|
||||
permissionId: getId('READ_ORDERS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('InventorySpecialist'),
|
||||
permissionId: getId('UPDATE_ORDERS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('CustomerSupport'),
|
||||
permissionId: getId('READ_ORDERS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('CustomerSupport'),
|
||||
permissionId: getId('UPDATE_ORDERS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('DataAnalyst'),
|
||||
permissionId: getId('READ_ORDERS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('DataAnalyst'),
|
||||
permissionId: getId('UPDATE_ORDERS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('OperationsManager'),
|
||||
permissionId: getId('CREATE_USERS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('OperationsManager'),
|
||||
permissionId: getId('READ_USERS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('OperationsManager'),
|
||||
permissionId: getId('UPDATE_USERS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('OperationsManager'),
|
||||
permissionId: getId('DELETE_USERS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
@ -683,31 +683,6 @@ primary key ("roles_permissionsId", "permissionId")
|
||||
permissionId: getId('CREATE_SEARCH'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('Administrator'),
|
||||
permissionId: getId('CREATE_USERS'),
|
||||
},
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('Administrator'),
|
||||
permissionId: getId('READ_USERS'),
|
||||
},
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('Administrator'),
|
||||
permissionId: getId('UPDATE_USERS'),
|
||||
},
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('Administrator'),
|
||||
permissionId: getId('DELETE_USERS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
@ -737,25 +712,25 @@ primary key ("roles_permissionsId", "permissionId")
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('Administrator'),
|
||||
permissionId: getId('CREATE_CUSTOMERS'),
|
||||
permissionId: getId('CREATE_PAYMENTS'),
|
||||
},
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('Administrator'),
|
||||
permissionId: getId('READ_CUSTOMERS'),
|
||||
permissionId: getId('READ_PAYMENTS'),
|
||||
},
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('Administrator'),
|
||||
permissionId: getId('UPDATE_CUSTOMERS'),
|
||||
permissionId: getId('UPDATE_PAYMENTS'),
|
||||
},
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('Administrator'),
|
||||
permissionId: getId('DELETE_CUSTOMERS'),
|
||||
permissionId: getId('DELETE_PAYMENTS'),
|
||||
},
|
||||
|
||||
{
|
||||
@ -783,56 +758,6 @@ primary key ("roles_permissionsId", "permissionId")
|
||||
permissionId: getId('DELETE_FURNITURE_TYPES'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('Administrator'),
|
||||
permissionId: getId('CREATE_ORDERS'),
|
||||
},
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('Administrator'),
|
||||
permissionId: getId('READ_ORDERS'),
|
||||
},
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('Administrator'),
|
||||
permissionId: getId('UPDATE_ORDERS'),
|
||||
},
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('Administrator'),
|
||||
permissionId: getId('DELETE_ORDERS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('Administrator'),
|
||||
permissionId: getId('CREATE_PAYMENTS'),
|
||||
},
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('Administrator'),
|
||||
permissionId: getId('READ_PAYMENTS'),
|
||||
},
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('Administrator'),
|
||||
permissionId: getId('UPDATE_PAYMENTS'),
|
||||
},
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('Administrator'),
|
||||
permissionId: getId('DELETE_PAYMENTS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
@ -861,25 +786,75 @@ primary key ("roles_permissionsId", "permissionId")
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('SuperAdmin'),
|
||||
roles_permissionsId: getId('Administrator'),
|
||||
permissionId: getId('CREATE_CUSTOMERS'),
|
||||
},
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('Administrator'),
|
||||
permissionId: getId('READ_CUSTOMERS'),
|
||||
},
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('Administrator'),
|
||||
permissionId: getId('UPDATE_CUSTOMERS'),
|
||||
},
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('Administrator'),
|
||||
permissionId: getId('DELETE_CUSTOMERS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('Administrator'),
|
||||
permissionId: getId('CREATE_ORDERS'),
|
||||
},
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('Administrator'),
|
||||
permissionId: getId('READ_ORDERS'),
|
||||
},
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('Administrator'),
|
||||
permissionId: getId('UPDATE_ORDERS'),
|
||||
},
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('Administrator'),
|
||||
permissionId: getId('DELETE_ORDERS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('Administrator'),
|
||||
permissionId: getId('CREATE_USERS'),
|
||||
},
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('SuperAdmin'),
|
||||
roles_permissionsId: getId('Administrator'),
|
||||
permissionId: getId('READ_USERS'),
|
||||
},
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('SuperAdmin'),
|
||||
roles_permissionsId: getId('Administrator'),
|
||||
permissionId: getId('UPDATE_USERS'),
|
||||
},
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('SuperAdmin'),
|
||||
roles_permissionsId: getId('Administrator'),
|
||||
permissionId: getId('DELETE_USERS'),
|
||||
},
|
||||
|
||||
@ -912,25 +887,25 @@ primary key ("roles_permissionsId", "permissionId")
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('SuperAdmin'),
|
||||
permissionId: getId('CREATE_CUSTOMERS'),
|
||||
permissionId: getId('CREATE_PAYMENTS'),
|
||||
},
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('SuperAdmin'),
|
||||
permissionId: getId('READ_CUSTOMERS'),
|
||||
permissionId: getId('READ_PAYMENTS'),
|
||||
},
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('SuperAdmin'),
|
||||
permissionId: getId('UPDATE_CUSTOMERS'),
|
||||
permissionId: getId('UPDATE_PAYMENTS'),
|
||||
},
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('SuperAdmin'),
|
||||
permissionId: getId('DELETE_CUSTOMERS'),
|
||||
permissionId: getId('DELETE_PAYMENTS'),
|
||||
},
|
||||
|
||||
{
|
||||
@ -958,81 +933,6 @@ primary key ("roles_permissionsId", "permissionId")
|
||||
permissionId: getId('DELETE_FURNITURE_TYPES'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('SuperAdmin'),
|
||||
permissionId: getId('CREATE_ORDERS'),
|
||||
},
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('SuperAdmin'),
|
||||
permissionId: getId('READ_ORDERS'),
|
||||
},
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('SuperAdmin'),
|
||||
permissionId: getId('UPDATE_ORDERS'),
|
||||
},
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('SuperAdmin'),
|
||||
permissionId: getId('DELETE_ORDERS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('SuperAdmin'),
|
||||
permissionId: getId('CREATE_ROLES'),
|
||||
},
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('SuperAdmin'),
|
||||
permissionId: getId('READ_ROLES'),
|
||||
},
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('SuperAdmin'),
|
||||
permissionId: getId('UPDATE_ROLES'),
|
||||
},
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('SuperAdmin'),
|
||||
permissionId: getId('DELETE_ROLES'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('SuperAdmin'),
|
||||
permissionId: getId('CREATE_PAYMENTS'),
|
||||
},
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('SuperAdmin'),
|
||||
permissionId: getId('READ_PAYMENTS'),
|
||||
},
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('SuperAdmin'),
|
||||
permissionId: getId('UPDATE_PAYMENTS'),
|
||||
},
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('SuperAdmin'),
|
||||
permissionId: getId('DELETE_PAYMENTS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
@ -1083,6 +983,106 @@ primary key ("roles_permissionsId", "permissionId")
|
||||
permissionId: getId('DELETE_PERMISSIONS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('SuperAdmin'),
|
||||
permissionId: getId('CREATE_CUSTOMERS'),
|
||||
},
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('SuperAdmin'),
|
||||
permissionId: getId('READ_CUSTOMERS'),
|
||||
},
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('SuperAdmin'),
|
||||
permissionId: getId('UPDATE_CUSTOMERS'),
|
||||
},
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('SuperAdmin'),
|
||||
permissionId: getId('DELETE_CUSTOMERS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('SuperAdmin'),
|
||||
permissionId: getId('CREATE_ORDERS'),
|
||||
},
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('SuperAdmin'),
|
||||
permissionId: getId('READ_ORDERS'),
|
||||
},
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('SuperAdmin'),
|
||||
permissionId: getId('UPDATE_ORDERS'),
|
||||
},
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('SuperAdmin'),
|
||||
permissionId: getId('DELETE_ORDERS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('SuperAdmin'),
|
||||
permissionId: getId('CREATE_USERS'),
|
||||
},
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('SuperAdmin'),
|
||||
permissionId: getId('READ_USERS'),
|
||||
},
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('SuperAdmin'),
|
||||
permissionId: getId('UPDATE_USERS'),
|
||||
},
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('SuperAdmin'),
|
||||
permissionId: getId('DELETE_USERS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('SuperAdmin'),
|
||||
permissionId: getId('CREATE_ROLES'),
|
||||
},
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('SuperAdmin'),
|
||||
permissionId: getId('READ_ROLES'),
|
||||
},
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('SuperAdmin'),
|
||||
permissionId: getId('UPDATE_ROLES'),
|
||||
},
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('SuperAdmin'),
|
||||
permissionId: getId('DELETE_ROLES'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
|
||||
@ -3,16 +3,16 @@ const Users = db.users;
|
||||
|
||||
const Categories = db.categories;
|
||||
|
||||
const Customers = db.customers;
|
||||
const Payments = db.payments;
|
||||
|
||||
const FurnitureTypes = db.furniture_types;
|
||||
|
||||
const Orders = db.orders;
|
||||
|
||||
const Payments = db.payments;
|
||||
|
||||
const Reports = db.reports;
|
||||
|
||||
const Customers = db.customers;
|
||||
|
||||
const Orders = db.orders;
|
||||
|
||||
const Organizations = db.organizations;
|
||||
|
||||
const CategoriesData = [
|
||||
@ -33,35 +33,59 @@ const CategoriesData = [
|
||||
|
||||
// type code here for "relation_one" field
|
||||
},
|
||||
|
||||
{
|
||||
name: 'Benches',
|
||||
|
||||
// type code here for "relation_one" field
|
||||
},
|
||||
];
|
||||
|
||||
const CustomersData = [
|
||||
const PaymentsData = [
|
||||
{
|
||||
first_name: 'John',
|
||||
// type code here for "relation_one" field
|
||||
|
||||
last_name: 'Doe',
|
||||
amount: 300,
|
||||
|
||||
email: 'john.doe@example.com',
|
||||
method: 'CreditCard',
|
||||
|
||||
verified: true,
|
||||
|
||||
// type code here for "relation_one" field
|
||||
},
|
||||
|
||||
{
|
||||
first_name: 'Jane',
|
||||
// type code here for "relation_one" field
|
||||
|
||||
last_name: 'Smith',
|
||||
amount: 120,
|
||||
|
||||
email: 'jane.smith@example.com',
|
||||
method: 'CreditCard',
|
||||
|
||||
verified: true,
|
||||
|
||||
// type code here for "relation_one" field
|
||||
},
|
||||
|
||||
{
|
||||
first_name: 'Alice',
|
||||
// type code here for "relation_one" field
|
||||
|
||||
last_name: 'Johnson',
|
||||
amount: 480,
|
||||
|
||||
email: 'alice.johnson@example.com',
|
||||
method: 'CreditCard',
|
||||
|
||||
verified: true,
|
||||
|
||||
// type code here for "relation_one" field
|
||||
},
|
||||
|
||||
{
|
||||
// type code here for "relation_one" field
|
||||
|
||||
amount: 270,
|
||||
|
||||
method: 'CreditCard',
|
||||
|
||||
verified: true,
|
||||
|
||||
// type code here for "relation_one" field
|
||||
},
|
||||
@ -103,80 +127,16 @@ const FurnitureTypesData = [
|
||||
|
||||
// type code here for "relation_one" field
|
||||
},
|
||||
];
|
||||
|
||||
const OrdersData = [
|
||||
{
|
||||
// type code here for "relation_one" field
|
||||
name: 'Rustic Bench',
|
||||
|
||||
price: 180,
|
||||
|
||||
stock_level: 10,
|
||||
|
||||
// type code here for "relation_many" field
|
||||
|
||||
order_date: new Date('2023-10-01T10:00:00Z'),
|
||||
|
||||
status: 'Delivered',
|
||||
|
||||
// type code here for "relation_one" field
|
||||
},
|
||||
|
||||
{
|
||||
// type code here for "relation_one" field
|
||||
|
||||
// type code here for "relation_many" field
|
||||
|
||||
order_date: new Date('2023-10-02T11:30:00Z'),
|
||||
|
||||
status: 'Pending',
|
||||
|
||||
// type code here for "relation_one" field
|
||||
},
|
||||
|
||||
{
|
||||
// type code here for "relation_one" field
|
||||
|
||||
// type code here for "relation_many" field
|
||||
|
||||
order_date: new Date('2023-10-03T14:00:00Z'),
|
||||
|
||||
status: 'Pending',
|
||||
|
||||
// type code here for "relation_one" field
|
||||
},
|
||||
];
|
||||
|
||||
const PaymentsData = [
|
||||
{
|
||||
// type code here for "relation_one" field
|
||||
|
||||
amount: 300,
|
||||
|
||||
method: 'CreditCard',
|
||||
|
||||
verified: true,
|
||||
|
||||
// type code here for "relation_one" field
|
||||
},
|
||||
|
||||
{
|
||||
// type code here for "relation_one" field
|
||||
|
||||
amount: 120,
|
||||
|
||||
method: 'PhonePe',
|
||||
|
||||
verified: true,
|
||||
|
||||
// type code here for "relation_one" field
|
||||
},
|
||||
|
||||
{
|
||||
// type code here for "relation_one" field
|
||||
|
||||
amount: 480,
|
||||
|
||||
method: 'CreditCard',
|
||||
|
||||
verified: true,
|
||||
|
||||
// type code here for "relation_one" field
|
||||
},
|
||||
];
|
||||
@ -205,6 +165,106 @@ const ReportsData = [
|
||||
|
||||
// type code here for "relation_one" field
|
||||
},
|
||||
|
||||
{
|
||||
title: 'Order Fulfillment Efficiency',
|
||||
|
||||
generated_at: new Date('2023-10-04T11:00:00Z'),
|
||||
|
||||
// type code here for "relation_one" field
|
||||
},
|
||||
];
|
||||
|
||||
const CustomersData = [
|
||||
{
|
||||
first_name: 'John',
|
||||
|
||||
last_name: 'Doe',
|
||||
|
||||
email: 'john.doe@example.com',
|
||||
|
||||
// type code here for "relation_one" field
|
||||
},
|
||||
|
||||
{
|
||||
first_name: 'Jane',
|
||||
|
||||
last_name: 'Smith',
|
||||
|
||||
email: 'jane.smith@example.com',
|
||||
|
||||
// type code here for "relation_one" field
|
||||
},
|
||||
|
||||
{
|
||||
first_name: 'Alice',
|
||||
|
||||
last_name: 'Johnson',
|
||||
|
||||
email: 'alice.johnson@example.com',
|
||||
|
||||
// type code here for "relation_one" field
|
||||
},
|
||||
|
||||
{
|
||||
first_name: 'Bob',
|
||||
|
||||
last_name: 'Brown',
|
||||
|
||||
email: 'bob.brown@example.com',
|
||||
|
||||
// type code here for "relation_one" field
|
||||
},
|
||||
];
|
||||
|
||||
const OrdersData = [
|
||||
{
|
||||
// type code here for "relation_one" field
|
||||
|
||||
// type code here for "relation_many" field
|
||||
|
||||
order_date: new Date('2023-10-01T10:00:00Z'),
|
||||
|
||||
status: 'Shipped',
|
||||
|
||||
// type code here for "relation_one" field
|
||||
},
|
||||
|
||||
{
|
||||
// type code here for "relation_one" field
|
||||
|
||||
// type code here for "relation_many" field
|
||||
|
||||
order_date: new Date('2023-10-02T11:30:00Z'),
|
||||
|
||||
status: 'Pending',
|
||||
|
||||
// type code here for "relation_one" field
|
||||
},
|
||||
|
||||
{
|
||||
// type code here for "relation_one" field
|
||||
|
||||
// type code here for "relation_many" field
|
||||
|
||||
order_date: new Date('2023-10-03T14:00:00Z'),
|
||||
|
||||
status: 'Delivered',
|
||||
|
||||
// type code here for "relation_one" field
|
||||
},
|
||||
|
||||
{
|
||||
// type code here for "relation_one" field
|
||||
|
||||
// type code here for "relation_many" field
|
||||
|
||||
order_date: new Date('2023-10-04T09:00:00Z'),
|
||||
|
||||
status: 'Delivered',
|
||||
|
||||
// type code here for "relation_one" field
|
||||
},
|
||||
];
|
||||
|
||||
const OrganizationsData = [
|
||||
@ -219,45 +279,12 @@ const OrganizationsData = [
|
||||
{
|
||||
name: 'HomeStyle Ltd.',
|
||||
},
|
||||
|
||||
{
|
||||
name: 'UrbanDesigns',
|
||||
},
|
||||
];
|
||||
|
||||
// Similar logic for "relation_many"
|
||||
|
||||
async function associateUserWithOrganization() {
|
||||
const relatedOrganization0 = await Organizations.findOne({
|
||||
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||
});
|
||||
const User0 = await Users.findOne({
|
||||
order: [['id', 'ASC']],
|
||||
offset: 0,
|
||||
});
|
||||
if (User0?.setOrganization) {
|
||||
await User0.setOrganization(relatedOrganization0);
|
||||
}
|
||||
|
||||
const relatedOrganization1 = await Organizations.findOne({
|
||||
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||
});
|
||||
const User1 = await Users.findOne({
|
||||
order: [['id', 'ASC']],
|
||||
offset: 1,
|
||||
});
|
||||
if (User1?.setOrganization) {
|
||||
await User1.setOrganization(relatedOrganization1);
|
||||
}
|
||||
|
||||
const relatedOrganization2 = await Organizations.findOne({
|
||||
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||
});
|
||||
const User2 = await Users.findOne({
|
||||
order: [['id', 'ASC']],
|
||||
offset: 2,
|
||||
});
|
||||
if (User2?.setOrganization) {
|
||||
await User2.setOrganization(relatedOrganization2);
|
||||
}
|
||||
}
|
||||
|
||||
async function associateCategoryWithOrganization() {
|
||||
const relatedOrganization0 = await Organizations.findOne({
|
||||
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||
@ -291,40 +318,108 @@ async function associateCategoryWithOrganization() {
|
||||
if (Category2?.setOrganization) {
|
||||
await Category2.setOrganization(relatedOrganization2);
|
||||
}
|
||||
}
|
||||
|
||||
async function associateCustomerWithOrganization() {
|
||||
const relatedOrganization0 = await Organizations.findOne({
|
||||
const relatedOrganization3 = await Organizations.findOne({
|
||||
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||
});
|
||||
const Customer0 = await Customers.findOne({
|
||||
const Category3 = await Categories.findOne({
|
||||
order: [['id', 'ASC']],
|
||||
offset: 3,
|
||||
});
|
||||
if (Category3?.setOrganization) {
|
||||
await Category3.setOrganization(relatedOrganization3);
|
||||
}
|
||||
}
|
||||
|
||||
async function associatePaymentWithOrder() {
|
||||
const relatedOrder0 = await Orders.findOne({
|
||||
offset: Math.floor(Math.random() * (await Orders.count())),
|
||||
});
|
||||
const Payment0 = await Payments.findOne({
|
||||
order: [['id', 'ASC']],
|
||||
offset: 0,
|
||||
});
|
||||
if (Customer0?.setOrganization) {
|
||||
await Customer0.setOrganization(relatedOrganization0);
|
||||
if (Payment0?.setOrder) {
|
||||
await Payment0.setOrder(relatedOrder0);
|
||||
}
|
||||
|
||||
const relatedOrder1 = await Orders.findOne({
|
||||
offset: Math.floor(Math.random() * (await Orders.count())),
|
||||
});
|
||||
const Payment1 = await Payments.findOne({
|
||||
order: [['id', 'ASC']],
|
||||
offset: 1,
|
||||
});
|
||||
if (Payment1?.setOrder) {
|
||||
await Payment1.setOrder(relatedOrder1);
|
||||
}
|
||||
|
||||
const relatedOrder2 = await Orders.findOne({
|
||||
offset: Math.floor(Math.random() * (await Orders.count())),
|
||||
});
|
||||
const Payment2 = await Payments.findOne({
|
||||
order: [['id', 'ASC']],
|
||||
offset: 2,
|
||||
});
|
||||
if (Payment2?.setOrder) {
|
||||
await Payment2.setOrder(relatedOrder2);
|
||||
}
|
||||
|
||||
const relatedOrder3 = await Orders.findOne({
|
||||
offset: Math.floor(Math.random() * (await Orders.count())),
|
||||
});
|
||||
const Payment3 = await Payments.findOne({
|
||||
order: [['id', 'ASC']],
|
||||
offset: 3,
|
||||
});
|
||||
if (Payment3?.setOrder) {
|
||||
await Payment3.setOrder(relatedOrder3);
|
||||
}
|
||||
}
|
||||
|
||||
async function associatePaymentWithOrganization() {
|
||||
const relatedOrganization0 = await Organizations.findOne({
|
||||
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||
});
|
||||
const Payment0 = await Payments.findOne({
|
||||
order: [['id', 'ASC']],
|
||||
offset: 0,
|
||||
});
|
||||
if (Payment0?.setOrganization) {
|
||||
await Payment0.setOrganization(relatedOrganization0);
|
||||
}
|
||||
|
||||
const relatedOrganization1 = await Organizations.findOne({
|
||||
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||
});
|
||||
const Customer1 = await Customers.findOne({
|
||||
const Payment1 = await Payments.findOne({
|
||||
order: [['id', 'ASC']],
|
||||
offset: 1,
|
||||
});
|
||||
if (Customer1?.setOrganization) {
|
||||
await Customer1.setOrganization(relatedOrganization1);
|
||||
if (Payment1?.setOrganization) {
|
||||
await Payment1.setOrganization(relatedOrganization1);
|
||||
}
|
||||
|
||||
const relatedOrganization2 = await Organizations.findOne({
|
||||
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||
});
|
||||
const Customer2 = await Customers.findOne({
|
||||
const Payment2 = await Payments.findOne({
|
||||
order: [['id', 'ASC']],
|
||||
offset: 2,
|
||||
});
|
||||
if (Customer2?.setOrganization) {
|
||||
await Customer2.setOrganization(relatedOrganization2);
|
||||
if (Payment2?.setOrganization) {
|
||||
await Payment2.setOrganization(relatedOrganization2);
|
||||
}
|
||||
|
||||
const relatedOrganization3 = await Organizations.findOne({
|
||||
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||
});
|
||||
const Payment3 = await Payments.findOne({
|
||||
order: [['id', 'ASC']],
|
||||
offset: 3,
|
||||
});
|
||||
if (Payment3?.setOrganization) {
|
||||
await Payment3.setOrganization(relatedOrganization3);
|
||||
}
|
||||
}
|
||||
|
||||
@ -363,6 +458,109 @@ async function associateFurnitureTypeWithOrganization() {
|
||||
if (FurnitureType2?.setOrganization) {
|
||||
await FurnitureType2.setOrganization(relatedOrganization2);
|
||||
}
|
||||
|
||||
const relatedOrganization3 = await Organizations.findOne({
|
||||
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||
});
|
||||
const FurnitureType3 = await FurnitureTypes.findOne({
|
||||
order: [['id', 'ASC']],
|
||||
offset: 3,
|
||||
});
|
||||
if (FurnitureType3?.setOrganization) {
|
||||
await FurnitureType3.setOrganization(relatedOrganization3);
|
||||
}
|
||||
}
|
||||
|
||||
async function associateReportWithOrganization() {
|
||||
const relatedOrganization0 = await Organizations.findOne({
|
||||
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||
});
|
||||
const Report0 = await Reports.findOne({
|
||||
order: [['id', 'ASC']],
|
||||
offset: 0,
|
||||
});
|
||||
if (Report0?.setOrganization) {
|
||||
await Report0.setOrganization(relatedOrganization0);
|
||||
}
|
||||
|
||||
const relatedOrganization1 = await Organizations.findOne({
|
||||
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||
});
|
||||
const Report1 = await Reports.findOne({
|
||||
order: [['id', 'ASC']],
|
||||
offset: 1,
|
||||
});
|
||||
if (Report1?.setOrganization) {
|
||||
await Report1.setOrganization(relatedOrganization1);
|
||||
}
|
||||
|
||||
const relatedOrganization2 = await Organizations.findOne({
|
||||
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||
});
|
||||
const Report2 = await Reports.findOne({
|
||||
order: [['id', 'ASC']],
|
||||
offset: 2,
|
||||
});
|
||||
if (Report2?.setOrganization) {
|
||||
await Report2.setOrganization(relatedOrganization2);
|
||||
}
|
||||
|
||||
const relatedOrganization3 = await Organizations.findOne({
|
||||
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||
});
|
||||
const Report3 = await Reports.findOne({
|
||||
order: [['id', 'ASC']],
|
||||
offset: 3,
|
||||
});
|
||||
if (Report3?.setOrganization) {
|
||||
await Report3.setOrganization(relatedOrganization3);
|
||||
}
|
||||
}
|
||||
|
||||
async function associateCustomerWithOrganization() {
|
||||
const relatedOrganization0 = await Organizations.findOne({
|
||||
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||
});
|
||||
const Customer0 = await Customers.findOne({
|
||||
order: [['id', 'ASC']],
|
||||
offset: 0,
|
||||
});
|
||||
if (Customer0?.setOrganization) {
|
||||
await Customer0.setOrganization(relatedOrganization0);
|
||||
}
|
||||
|
||||
const relatedOrganization1 = await Organizations.findOne({
|
||||
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||
});
|
||||
const Customer1 = await Customers.findOne({
|
||||
order: [['id', 'ASC']],
|
||||
offset: 1,
|
||||
});
|
||||
if (Customer1?.setOrganization) {
|
||||
await Customer1.setOrganization(relatedOrganization1);
|
||||
}
|
||||
|
||||
const relatedOrganization2 = await Organizations.findOne({
|
||||
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||
});
|
||||
const Customer2 = await Customers.findOne({
|
||||
order: [['id', 'ASC']],
|
||||
offset: 2,
|
||||
});
|
||||
if (Customer2?.setOrganization) {
|
||||
await Customer2.setOrganization(relatedOrganization2);
|
||||
}
|
||||
|
||||
const relatedOrganization3 = await Organizations.findOne({
|
||||
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||
});
|
||||
const Customer3 = await Customers.findOne({
|
||||
order: [['id', 'ASC']],
|
||||
offset: 3,
|
||||
});
|
||||
if (Customer3?.setOrganization) {
|
||||
await Customer3.setOrganization(relatedOrganization3);
|
||||
}
|
||||
}
|
||||
|
||||
async function associateOrderWithCustomer() {
|
||||
@ -398,6 +596,17 @@ async function associateOrderWithCustomer() {
|
||||
if (Order2?.setCustomer) {
|
||||
await Order2.setCustomer(relatedCustomer2);
|
||||
}
|
||||
|
||||
const relatedCustomer3 = await Customers.findOne({
|
||||
offset: Math.floor(Math.random() * (await Customers.count())),
|
||||
});
|
||||
const Order3 = await Orders.findOne({
|
||||
order: [['id', 'ASC']],
|
||||
offset: 3,
|
||||
});
|
||||
if (Order3?.setCustomer) {
|
||||
await Order3.setCustomer(relatedCustomer3);
|
||||
}
|
||||
}
|
||||
|
||||
// Similar logic for "relation_many"
|
||||
@ -435,110 +644,64 @@ async function associateOrderWithOrganization() {
|
||||
if (Order2?.setOrganization) {
|
||||
await Order2.setOrganization(relatedOrganization2);
|
||||
}
|
||||
}
|
||||
|
||||
async function associatePaymentWithOrder() {
|
||||
const relatedOrder0 = await Orders.findOne({
|
||||
offset: Math.floor(Math.random() * (await Orders.count())),
|
||||
const relatedOrganization3 = await Organizations.findOne({
|
||||
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||
});
|
||||
const Payment0 = await Payments.findOne({
|
||||
const Order3 = await Orders.findOne({
|
||||
order: [['id', 'ASC']],
|
||||
offset: 0,
|
||||
offset: 3,
|
||||
});
|
||||
if (Payment0?.setOrder) {
|
||||
await Payment0.setOrder(relatedOrder0);
|
||||
}
|
||||
|
||||
const relatedOrder1 = await Orders.findOne({
|
||||
offset: Math.floor(Math.random() * (await Orders.count())),
|
||||
});
|
||||
const Payment1 = await Payments.findOne({
|
||||
order: [['id', 'ASC']],
|
||||
offset: 1,
|
||||
});
|
||||
if (Payment1?.setOrder) {
|
||||
await Payment1.setOrder(relatedOrder1);
|
||||
}
|
||||
|
||||
const relatedOrder2 = await Orders.findOne({
|
||||
offset: Math.floor(Math.random() * (await Orders.count())),
|
||||
});
|
||||
const Payment2 = await Payments.findOne({
|
||||
order: [['id', 'ASC']],
|
||||
offset: 2,
|
||||
});
|
||||
if (Payment2?.setOrder) {
|
||||
await Payment2.setOrder(relatedOrder2);
|
||||
if (Order3?.setOrganization) {
|
||||
await Order3.setOrganization(relatedOrganization3);
|
||||
}
|
||||
}
|
||||
|
||||
async function associatePaymentWithOrganization() {
|
||||
// Similar logic for "relation_many"
|
||||
|
||||
async function associateUserWithOrganization() {
|
||||
const relatedOrganization0 = await Organizations.findOne({
|
||||
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||
});
|
||||
const Payment0 = await Payments.findOne({
|
||||
const User0 = await Users.findOne({
|
||||
order: [['id', 'ASC']],
|
||||
offset: 0,
|
||||
});
|
||||
if (Payment0?.setOrganization) {
|
||||
await Payment0.setOrganization(relatedOrganization0);
|
||||
if (User0?.setOrganization) {
|
||||
await User0.setOrganization(relatedOrganization0);
|
||||
}
|
||||
|
||||
const relatedOrganization1 = await Organizations.findOne({
|
||||
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||
});
|
||||
const Payment1 = await Payments.findOne({
|
||||
const User1 = await Users.findOne({
|
||||
order: [['id', 'ASC']],
|
||||
offset: 1,
|
||||
});
|
||||
if (Payment1?.setOrganization) {
|
||||
await Payment1.setOrganization(relatedOrganization1);
|
||||
if (User1?.setOrganization) {
|
||||
await User1.setOrganization(relatedOrganization1);
|
||||
}
|
||||
|
||||
const relatedOrganization2 = await Organizations.findOne({
|
||||
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||
});
|
||||
const Payment2 = await Payments.findOne({
|
||||
const User2 = await Users.findOne({
|
||||
order: [['id', 'ASC']],
|
||||
offset: 2,
|
||||
});
|
||||
if (Payment2?.setOrganization) {
|
||||
await Payment2.setOrganization(relatedOrganization2);
|
||||
}
|
||||
}
|
||||
|
||||
async function associateReportWithOrganization() {
|
||||
const relatedOrganization0 = await Organizations.findOne({
|
||||
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||
});
|
||||
const Report0 = await Reports.findOne({
|
||||
order: [['id', 'ASC']],
|
||||
offset: 0,
|
||||
});
|
||||
if (Report0?.setOrganization) {
|
||||
await Report0.setOrganization(relatedOrganization0);
|
||||
if (User2?.setOrganization) {
|
||||
await User2.setOrganization(relatedOrganization2);
|
||||
}
|
||||
|
||||
const relatedOrganization1 = await Organizations.findOne({
|
||||
const relatedOrganization3 = await Organizations.findOne({
|
||||
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||
});
|
||||
const Report1 = await Reports.findOne({
|
||||
const User3 = await Users.findOne({
|
||||
order: [['id', 'ASC']],
|
||||
offset: 1,
|
||||
offset: 3,
|
||||
});
|
||||
if (Report1?.setOrganization) {
|
||||
await Report1.setOrganization(relatedOrganization1);
|
||||
}
|
||||
|
||||
const relatedOrganization2 = await Organizations.findOne({
|
||||
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||
});
|
||||
const Report2 = await Reports.findOne({
|
||||
order: [['id', 'ASC']],
|
||||
offset: 2,
|
||||
});
|
||||
if (Report2?.setOrganization) {
|
||||
await Report2.setOrganization(relatedOrganization2);
|
||||
if (User3?.setOrganization) {
|
||||
await User3.setOrganization(relatedOrganization3);
|
||||
}
|
||||
}
|
||||
|
||||
@ -546,58 +709,58 @@ module.exports = {
|
||||
up: async (queryInterface, Sequelize) => {
|
||||
await Categories.bulkCreate(CategoriesData);
|
||||
|
||||
await Customers.bulkCreate(CustomersData);
|
||||
await Payments.bulkCreate(PaymentsData);
|
||||
|
||||
await FurnitureTypes.bulkCreate(FurnitureTypesData);
|
||||
|
||||
await Orders.bulkCreate(OrdersData);
|
||||
|
||||
await Payments.bulkCreate(PaymentsData);
|
||||
|
||||
await Reports.bulkCreate(ReportsData);
|
||||
|
||||
await Customers.bulkCreate(CustomersData);
|
||||
|
||||
await Orders.bulkCreate(OrdersData);
|
||||
|
||||
await Organizations.bulkCreate(OrganizationsData);
|
||||
|
||||
await Promise.all([
|
||||
// Similar logic for "relation_many"
|
||||
|
||||
await associateUserWithOrganization(),
|
||||
|
||||
await associateCategoryWithOrganization(),
|
||||
|
||||
await associateCustomerWithOrganization(),
|
||||
await associatePaymentWithOrder(),
|
||||
|
||||
await associatePaymentWithOrganization(),
|
||||
|
||||
// Similar logic for "relation_many"
|
||||
|
||||
await associateFurnitureTypeWithOrganization(),
|
||||
|
||||
await associateReportWithOrganization(),
|
||||
|
||||
await associateCustomerWithOrganization(),
|
||||
|
||||
await associateOrderWithCustomer(),
|
||||
|
||||
// Similar logic for "relation_many"
|
||||
|
||||
await associateOrderWithOrganization(),
|
||||
|
||||
await associatePaymentWithOrder(),
|
||||
// Similar logic for "relation_many"
|
||||
|
||||
await associatePaymentWithOrganization(),
|
||||
|
||||
await associateReportWithOrganization(),
|
||||
await associateUserWithOrganization(),
|
||||
]);
|
||||
},
|
||||
|
||||
down: async (queryInterface, Sequelize) => {
|
||||
await queryInterface.bulkDelete('categories', null, {});
|
||||
|
||||
await queryInterface.bulkDelete('customers', null, {});
|
||||
await queryInterface.bulkDelete('payments', null, {});
|
||||
|
||||
await queryInterface.bulkDelete('furniture_types', null, {});
|
||||
|
||||
await queryInterface.bulkDelete('orders', null, {});
|
||||
|
||||
await queryInterface.bulkDelete('payments', null, {});
|
||||
|
||||
await queryInterface.bulkDelete('reports', null, {});
|
||||
|
||||
await queryInterface.bulkDelete('customers', null, {});
|
||||
|
||||
await queryInterface.bulkDelete('orders', null, {});
|
||||
|
||||
await queryInterface.bulkDelete('organizations', null, {});
|
||||
},
|
||||
};
|
||||
|
||||
@ -21,24 +21,24 @@ const openaiRoutes = require('./routes/openai');
|
||||
|
||||
const contactFormRoutes = require('./routes/contactForm');
|
||||
|
||||
const usersRoutes = require('./routes/users');
|
||||
|
||||
const categoriesRoutes = require('./routes/categories');
|
||||
|
||||
const customersRoutes = require('./routes/customers');
|
||||
const paymentsRoutes = require('./routes/payments');
|
||||
|
||||
const furniture_typesRoutes = require('./routes/furniture_types');
|
||||
|
||||
const ordersRoutes = require('./routes/orders');
|
||||
|
||||
const rolesRoutes = require('./routes/roles');
|
||||
|
||||
const paymentsRoutes = require('./routes/payments');
|
||||
|
||||
const reportsRoutes = require('./routes/reports');
|
||||
|
||||
const permissionsRoutes = require('./routes/permissions');
|
||||
|
||||
const customersRoutes = require('./routes/customers');
|
||||
|
||||
const ordersRoutes = require('./routes/orders');
|
||||
|
||||
const usersRoutes = require('./routes/users');
|
||||
|
||||
const rolesRoutes = require('./routes/roles');
|
||||
|
||||
const organizationsRoutes = require('./routes/organizations');
|
||||
|
||||
const getBaseUrl = (url) => {
|
||||
@ -106,12 +106,6 @@ app.use('/api/file', fileRoutes);
|
||||
app.use('/api/pexels', pexelsRoutes);
|
||||
app.enable('trust proxy');
|
||||
|
||||
app.use(
|
||||
'/api/users',
|
||||
passport.authenticate('jwt', { session: false }),
|
||||
usersRoutes,
|
||||
);
|
||||
|
||||
app.use(
|
||||
'/api/categories',
|
||||
passport.authenticate('jwt', { session: false }),
|
||||
@ -119,9 +113,9 @@ app.use(
|
||||
);
|
||||
|
||||
app.use(
|
||||
'/api/customers',
|
||||
'/api/payments',
|
||||
passport.authenticate('jwt', { session: false }),
|
||||
customersRoutes,
|
||||
paymentsRoutes,
|
||||
);
|
||||
|
||||
app.use(
|
||||
@ -130,24 +124,6 @@ app.use(
|
||||
furniture_typesRoutes,
|
||||
);
|
||||
|
||||
app.use(
|
||||
'/api/orders',
|
||||
passport.authenticate('jwt', { session: false }),
|
||||
ordersRoutes,
|
||||
);
|
||||
|
||||
app.use(
|
||||
'/api/roles',
|
||||
passport.authenticate('jwt', { session: false }),
|
||||
rolesRoutes,
|
||||
);
|
||||
|
||||
app.use(
|
||||
'/api/payments',
|
||||
passport.authenticate('jwt', { session: false }),
|
||||
paymentsRoutes,
|
||||
);
|
||||
|
||||
app.use(
|
||||
'/api/reports',
|
||||
passport.authenticate('jwt', { session: false }),
|
||||
@ -160,6 +136,30 @@ app.use(
|
||||
permissionsRoutes,
|
||||
);
|
||||
|
||||
app.use(
|
||||
'/api/customers',
|
||||
passport.authenticate('jwt', { session: false }),
|
||||
customersRoutes,
|
||||
);
|
||||
|
||||
app.use(
|
||||
'/api/orders',
|
||||
passport.authenticate('jwt', { session: false }),
|
||||
ordersRoutes,
|
||||
);
|
||||
|
||||
app.use(
|
||||
'/api/users',
|
||||
passport.authenticate('jwt', { session: false }),
|
||||
usersRoutes,
|
||||
);
|
||||
|
||||
app.use(
|
||||
'/api/roles',
|
||||
passport.authenticate('jwt', { session: false }),
|
||||
rolesRoutes,
|
||||
);
|
||||
|
||||
app.use(
|
||||
'/api/organizations',
|
||||
passport.authenticate('jwt', { session: false }),
|
||||
|
||||
@ -41,22 +41,22 @@ module.exports = class SearchService {
|
||||
throw new ValidationError('iam.errors.searchQueryRequired');
|
||||
}
|
||||
const tableColumns = {
|
||||
users: ['firstName', 'lastName', 'phoneNumber', 'email'],
|
||||
|
||||
categories: ['name'],
|
||||
|
||||
customers: ['first_name', 'last_name', 'email'],
|
||||
|
||||
furniture_types: ['name'],
|
||||
|
||||
reports: ['title'],
|
||||
|
||||
customers: ['first_name', 'last_name', 'email'],
|
||||
|
||||
users: ['firstName', 'lastName', 'phoneNumber', 'email'],
|
||||
|
||||
organizations: ['name'],
|
||||
};
|
||||
const columnsInt = {
|
||||
furniture_types: ['price', 'stock_level'],
|
||||
|
||||
payments: ['amount'],
|
||||
|
||||
furniture_types: ['price', 'stock_level'],
|
||||
};
|
||||
|
||||
let allFoundRecords = [];
|
||||
|
||||
@ -19,7 +19,7 @@ export default function WebSiteFooter({ projectName }: WebSiteFooterProps) {
|
||||
|
||||
const style = FooterStyle.WITH_PROJECT_NAME;
|
||||
|
||||
const design = FooterDesigns.DESIGN_DIVERSITY;
|
||||
const design = FooterDesigns.DEFAULT_DESIGN;
|
||||
|
||||
return (
|
||||
<div
|
||||
|
||||
@ -17,9 +17,9 @@ export default function WebSiteHeader({ projectName }: WebSiteHeaderProps) {
|
||||
const websiteHeder = useAppSelector((state) => state.style.websiteHeder);
|
||||
const borders = useAppSelector((state) => state.style.borders);
|
||||
|
||||
const style = HeaderStyle.PAGES_LEFT;
|
||||
const style = HeaderStyle.PAGES_RIGHT;
|
||||
|
||||
const design = HeaderDesigns.DESIGN_DIVERSITY;
|
||||
const design = HeaderDesigns.DEFAULT_DESIGN;
|
||||
return (
|
||||
<header id='websiteHeader' className='overflow-hidden'>
|
||||
<div
|
||||
|
||||
@ -58,25 +58,6 @@ export default {
|
||||
return { label: val.name, id: val.id };
|
||||
},
|
||||
|
||||
customersManyListFormatter(val) {
|
||||
if (!val || !val.length) return [];
|
||||
return val.map((item) => item.first_name);
|
||||
},
|
||||
customersOneListFormatter(val) {
|
||||
if (!val) return '';
|
||||
return val.first_name;
|
||||
},
|
||||
customersManyListFormatterEdit(val) {
|
||||
if (!val || !val.length) return [];
|
||||
return val.map((item) => {
|
||||
return { id: item.id, label: item.first_name };
|
||||
});
|
||||
},
|
||||
customersOneListFormatterEdit(val) {
|
||||
if (!val) return '';
|
||||
return { label: val.first_name, id: val.id };
|
||||
},
|
||||
|
||||
furniture_typesManyListFormatter(val) {
|
||||
if (!val || !val.length) return [];
|
||||
return val.map((item) => item.name);
|
||||
@ -96,6 +77,44 @@ export default {
|
||||
return { label: val.name, id: val.id };
|
||||
},
|
||||
|
||||
permissionsManyListFormatter(val) {
|
||||
if (!val || !val.length) return [];
|
||||
return val.map((item) => item.name);
|
||||
},
|
||||
permissionsOneListFormatter(val) {
|
||||
if (!val) return '';
|
||||
return val.name;
|
||||
},
|
||||
permissionsManyListFormatterEdit(val) {
|
||||
if (!val || !val.length) return [];
|
||||
return val.map((item) => {
|
||||
return { id: item.id, label: item.name };
|
||||
});
|
||||
},
|
||||
permissionsOneListFormatterEdit(val) {
|
||||
if (!val) return '';
|
||||
return { label: val.name, id: val.id };
|
||||
},
|
||||
|
||||
customersManyListFormatter(val) {
|
||||
if (!val || !val.length) return [];
|
||||
return val.map((item) => item.first_name);
|
||||
},
|
||||
customersOneListFormatter(val) {
|
||||
if (!val) return '';
|
||||
return val.first_name;
|
||||
},
|
||||
customersManyListFormatterEdit(val) {
|
||||
if (!val || !val.length) return [];
|
||||
return val.map((item) => {
|
||||
return { id: item.id, label: item.first_name };
|
||||
});
|
||||
},
|
||||
customersOneListFormatterEdit(val) {
|
||||
if (!val) return '';
|
||||
return { label: val.first_name, id: val.id };
|
||||
},
|
||||
|
||||
ordersManyListFormatter(val) {
|
||||
if (!val || !val.length) return [];
|
||||
return val.map((item) => item.order_date);
|
||||
@ -134,25 +153,6 @@ export default {
|
||||
return { label: val.name, id: val.id };
|
||||
},
|
||||
|
||||
permissionsManyListFormatter(val) {
|
||||
if (!val || !val.length) return [];
|
||||
return val.map((item) => item.name);
|
||||
},
|
||||
permissionsOneListFormatter(val) {
|
||||
if (!val) return '';
|
||||
return val.name;
|
||||
},
|
||||
permissionsManyListFormatterEdit(val) {
|
||||
if (!val || !val.length) return [];
|
||||
return val.map((item) => {
|
||||
return { id: item.id, label: item.name };
|
||||
});
|
||||
},
|
||||
permissionsOneListFormatterEdit(val) {
|
||||
if (!val) return '';
|
||||
return { label: val.name, id: val.id };
|
||||
},
|
||||
|
||||
organizationsManyListFormatter(val) {
|
||||
if (!val || !val.length) return [];
|
||||
return val.map((item) => item.name);
|
||||
|
||||
@ -8,14 +8,6 @@ const menuAside: MenuAsideItem[] = [
|
||||
label: 'Dashboard',
|
||||
},
|
||||
|
||||
{
|
||||
href: '/users/users-list',
|
||||
label: 'Users',
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
icon: icon.mdiAccountGroup ?? icon.mdiTable,
|
||||
permissions: 'READ_USERS',
|
||||
},
|
||||
{
|
||||
href: '/categories/categories-list',
|
||||
label: 'Categories',
|
||||
@ -28,15 +20,15 @@ const menuAside: MenuAsideItem[] = [
|
||||
permissions: 'READ_CATEGORIES',
|
||||
},
|
||||
{
|
||||
href: '/customers/customers-list',
|
||||
label: 'Customers',
|
||||
href: '/payments/payments-list',
|
||||
label: 'Payments',
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
icon:
|
||||
'mdiAccount' in icon
|
||||
? icon['mdiAccount' as keyof typeof icon]
|
||||
'mdiCreditCardOutline' in icon
|
||||
? icon['mdiCreditCardOutline' as keyof typeof icon]
|
||||
: icon.mdiTable ?? icon.mdiTable,
|
||||
permissions: 'READ_CUSTOMERS',
|
||||
permissions: 'READ_PAYMENTS',
|
||||
},
|
||||
{
|
||||
href: '/furniture_types/furniture_types-list',
|
||||
@ -49,36 +41,6 @@ const menuAside: MenuAsideItem[] = [
|
||||
: icon.mdiTable ?? icon.mdiTable,
|
||||
permissions: 'READ_FURNITURE_TYPES',
|
||||
},
|
||||
{
|
||||
href: '/orders/orders-list',
|
||||
label: 'Orders',
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
icon:
|
||||
'mdiPackageVariantClosed' in icon
|
||||
? icon['mdiPackageVariantClosed' as keyof typeof icon]
|
||||
: icon.mdiTable ?? icon.mdiTable,
|
||||
permissions: 'READ_ORDERS',
|
||||
},
|
||||
{
|
||||
href: '/roles/roles-list',
|
||||
label: 'Roles',
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
icon: icon.mdiShieldAccountVariantOutline ?? icon.mdiTable,
|
||||
permissions: 'READ_ROLES',
|
||||
},
|
||||
{
|
||||
href: '/payments/payments-list',
|
||||
label: 'Payments',
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
icon:
|
||||
'mdiCreditCardOutline' in icon
|
||||
? icon['mdiCreditCardOutline' as keyof typeof icon]
|
||||
: icon.mdiTable ?? icon.mdiTable,
|
||||
permissions: 'READ_PAYMENTS',
|
||||
},
|
||||
{
|
||||
href: '/reports/reports-list',
|
||||
label: 'Reports',
|
||||
@ -98,6 +60,44 @@ const menuAside: MenuAsideItem[] = [
|
||||
icon: icon.mdiShieldAccountOutline ?? icon.mdiTable,
|
||||
permissions: 'READ_PERMISSIONS',
|
||||
},
|
||||
{
|
||||
href: '/customers/customers-list',
|
||||
label: 'Customers',
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
icon:
|
||||
'mdiAccount' in icon
|
||||
? icon['mdiAccount' as keyof typeof icon]
|
||||
: icon.mdiTable ?? icon.mdiTable,
|
||||
permissions: 'READ_CUSTOMERS',
|
||||
},
|
||||
{
|
||||
href: '/orders/orders-list',
|
||||
label: 'Orders',
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
icon:
|
||||
'mdiPackageVariantClosed' in icon
|
||||
? icon['mdiPackageVariantClosed' as keyof typeof icon]
|
||||
: icon.mdiTable ?? icon.mdiTable,
|
||||
permissions: 'READ_ORDERS',
|
||||
},
|
||||
{
|
||||
href: '/users/users-list',
|
||||
label: 'Users',
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
icon: icon.mdiAccountGroup ?? icon.mdiTable,
|
||||
permissions: 'READ_USERS',
|
||||
},
|
||||
{
|
||||
href: '/roles/roles-list',
|
||||
label: 'Roles',
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
icon: icon.mdiShieldAccountVariantOutline ?? icon.mdiTable,
|
||||
permissions: 'READ_ROLES',
|
||||
},
|
||||
{
|
||||
href: '/organizations/organizations-list',
|
||||
label: 'Organizations',
|
||||
|
||||
@ -28,15 +28,15 @@ const Dashboard = () => {
|
||||
defaultValue: 'Loading...',
|
||||
});
|
||||
|
||||
const [users, setUsers] = React.useState(loadingMessage);
|
||||
const [categories, setCategories] = React.useState(loadingMessage);
|
||||
const [customers, setCustomers] = React.useState(loadingMessage);
|
||||
const [furniture_types, setFurniture_types] = React.useState(loadingMessage);
|
||||
const [orders, setOrders] = React.useState(loadingMessage);
|
||||
const [roles, setRoles] = React.useState(loadingMessage);
|
||||
const [payments, setPayments] = React.useState(loadingMessage);
|
||||
const [furniture_types, setFurniture_types] = React.useState(loadingMessage);
|
||||
const [reports, setReports] = React.useState(loadingMessage);
|
||||
const [permissions, setPermissions] = React.useState(loadingMessage);
|
||||
const [customers, setCustomers] = React.useState(loadingMessage);
|
||||
const [orders, setOrders] = React.useState(loadingMessage);
|
||||
const [users, setUsers] = React.useState(loadingMessage);
|
||||
const [roles, setRoles] = React.useState(loadingMessage);
|
||||
const [organizations, setOrganizations] = React.useState(loadingMessage);
|
||||
|
||||
const [widgetsRole, setWidgetsRole] = React.useState({
|
||||
@ -51,27 +51,27 @@ const Dashboard = () => {
|
||||
|
||||
async function loadData() {
|
||||
const entities = [
|
||||
'users',
|
||||
'categories',
|
||||
'customers',
|
||||
'furniture_types',
|
||||
'orders',
|
||||
'roles',
|
||||
'payments',
|
||||
'furniture_types',
|
||||
'reports',
|
||||
'permissions',
|
||||
'customers',
|
||||
'orders',
|
||||
'users',
|
||||
'roles',
|
||||
'organizations',
|
||||
];
|
||||
const fns = [
|
||||
setUsers,
|
||||
setCategories,
|
||||
setCustomers,
|
||||
setFurniture_types,
|
||||
setOrders,
|
||||
setRoles,
|
||||
setPayments,
|
||||
setFurniture_types,
|
||||
setReports,
|
||||
setPermissions,
|
||||
setCustomers,
|
||||
setOrders,
|
||||
setUsers,
|
||||
setRoles,
|
||||
setOrganizations,
|
||||
];
|
||||
|
||||
@ -185,38 +185,6 @@ const Dashboard = () => {
|
||||
id='dashboard'
|
||||
className='grid grid-cols-1 gap-6 lg:grid-cols-3 mb-6'
|
||||
>
|
||||
{hasPermission(currentUser, 'READ_USERS') && (
|
||||
<Link href={'/users/users-list'}>
|
||||
<div
|
||||
className={`${
|
||||
corners !== 'rounded-full' ? corners : 'rounded-3xl'
|
||||
} dark:bg-dark-900 ${cardsStyle} dark:border-dark-700 p-6`}
|
||||
>
|
||||
<div className='flex justify-between align-center'>
|
||||
<div>
|
||||
<div className='text-lg leading-tight text-gray-500 dark:text-gray-400'>
|
||||
Users
|
||||
</div>
|
||||
<div className='text-3xl leading-tight font-semibold'>
|
||||
{users}
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<BaseIcon
|
||||
className={`${iconsColor}`}
|
||||
w='w-16'
|
||||
h='h-16'
|
||||
size={48}
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
path={icon.mdiAccountGroup || icon.mdiTable}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Link>
|
||||
)}
|
||||
|
||||
{hasPermission(currentUser, 'READ_CATEGORIES') && (
|
||||
<Link href={'/categories/categories-list'}>
|
||||
<div
|
||||
@ -253,8 +221,8 @@ const Dashboard = () => {
|
||||
</Link>
|
||||
)}
|
||||
|
||||
{hasPermission(currentUser, 'READ_CUSTOMERS') && (
|
||||
<Link href={'/customers/customers-list'}>
|
||||
{hasPermission(currentUser, 'READ_PAYMENTS') && (
|
||||
<Link href={'/payments/payments-list'}>
|
||||
<div
|
||||
className={`${
|
||||
corners !== 'rounded-full' ? corners : 'rounded-3xl'
|
||||
@ -263,10 +231,10 @@ const Dashboard = () => {
|
||||
<div className='flex justify-between align-center'>
|
||||
<div>
|
||||
<div className='text-lg leading-tight text-gray-500 dark:text-gray-400'>
|
||||
Customers
|
||||
Payments
|
||||
</div>
|
||||
<div className='text-3xl leading-tight font-semibold'>
|
||||
{customers}
|
||||
{payments}
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
@ -278,8 +246,8 @@ const Dashboard = () => {
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
path={
|
||||
'mdiAccount' in icon
|
||||
? icon['mdiAccount' as keyof typeof icon]
|
||||
'mdiCreditCardOutline' in icon
|
||||
? icon['mdiCreditCardOutline' as keyof typeof icon]
|
||||
: icon.mdiTable || icon.mdiTable
|
||||
}
|
||||
/>
|
||||
@ -325,112 +293,6 @@ const Dashboard = () => {
|
||||
</Link>
|
||||
)}
|
||||
|
||||
{hasPermission(currentUser, 'READ_ORDERS') && (
|
||||
<Link href={'/orders/orders-list'}>
|
||||
<div
|
||||
className={`${
|
||||
corners !== 'rounded-full' ? corners : 'rounded-3xl'
|
||||
} dark:bg-dark-900 ${cardsStyle} dark:border-dark-700 p-6`}
|
||||
>
|
||||
<div className='flex justify-between align-center'>
|
||||
<div>
|
||||
<div className='text-lg leading-tight text-gray-500 dark:text-gray-400'>
|
||||
Orders
|
||||
</div>
|
||||
<div className='text-3xl leading-tight font-semibold'>
|
||||
{orders}
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<BaseIcon
|
||||
className={`${iconsColor}`}
|
||||
w='w-16'
|
||||
h='h-16'
|
||||
size={48}
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
path={
|
||||
'mdiPackageVariantClosed' in icon
|
||||
? icon['mdiPackageVariantClosed' as keyof typeof icon]
|
||||
: icon.mdiTable || icon.mdiTable
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Link>
|
||||
)}
|
||||
|
||||
{hasPermission(currentUser, 'READ_ROLES') && (
|
||||
<Link href={'/roles/roles-list'}>
|
||||
<div
|
||||
className={`${
|
||||
corners !== 'rounded-full' ? corners : 'rounded-3xl'
|
||||
} dark:bg-dark-900 ${cardsStyle} dark:border-dark-700 p-6`}
|
||||
>
|
||||
<div className='flex justify-between align-center'>
|
||||
<div>
|
||||
<div className='text-lg leading-tight text-gray-500 dark:text-gray-400'>
|
||||
Roles
|
||||
</div>
|
||||
<div className='text-3xl leading-tight font-semibold'>
|
||||
{roles}
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<BaseIcon
|
||||
className={`${iconsColor}`}
|
||||
w='w-16'
|
||||
h='h-16'
|
||||
size={48}
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
path={
|
||||
icon.mdiShieldAccountVariantOutline || icon.mdiTable
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Link>
|
||||
)}
|
||||
|
||||
{hasPermission(currentUser, 'READ_PAYMENTS') && (
|
||||
<Link href={'/payments/payments-list'}>
|
||||
<div
|
||||
className={`${
|
||||
corners !== 'rounded-full' ? corners : 'rounded-3xl'
|
||||
} dark:bg-dark-900 ${cardsStyle} dark:border-dark-700 p-6`}
|
||||
>
|
||||
<div className='flex justify-between align-center'>
|
||||
<div>
|
||||
<div className='text-lg leading-tight text-gray-500 dark:text-gray-400'>
|
||||
Payments
|
||||
</div>
|
||||
<div className='text-3xl leading-tight font-semibold'>
|
||||
{payments}
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<BaseIcon
|
||||
className={`${iconsColor}`}
|
||||
w='w-16'
|
||||
h='h-16'
|
||||
size={48}
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
path={
|
||||
'mdiCreditCardOutline' in icon
|
||||
? icon['mdiCreditCardOutline' as keyof typeof icon]
|
||||
: icon.mdiTable || icon.mdiTable
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Link>
|
||||
)}
|
||||
|
||||
{hasPermission(currentUser, 'READ_REPORTS') && (
|
||||
<Link href={'/reports/reports-list'}>
|
||||
<div
|
||||
@ -499,6 +361,144 @@ const Dashboard = () => {
|
||||
</Link>
|
||||
)}
|
||||
|
||||
{hasPermission(currentUser, 'READ_CUSTOMERS') && (
|
||||
<Link href={'/customers/customers-list'}>
|
||||
<div
|
||||
className={`${
|
||||
corners !== 'rounded-full' ? corners : 'rounded-3xl'
|
||||
} dark:bg-dark-900 ${cardsStyle} dark:border-dark-700 p-6`}
|
||||
>
|
||||
<div className='flex justify-between align-center'>
|
||||
<div>
|
||||
<div className='text-lg leading-tight text-gray-500 dark:text-gray-400'>
|
||||
Customers
|
||||
</div>
|
||||
<div className='text-3xl leading-tight font-semibold'>
|
||||
{customers}
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<BaseIcon
|
||||
className={`${iconsColor}`}
|
||||
w='w-16'
|
||||
h='h-16'
|
||||
size={48}
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
path={
|
||||
'mdiAccount' in icon
|
||||
? icon['mdiAccount' as keyof typeof icon]
|
||||
: icon.mdiTable || icon.mdiTable
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Link>
|
||||
)}
|
||||
|
||||
{hasPermission(currentUser, 'READ_ORDERS') && (
|
||||
<Link href={'/orders/orders-list'}>
|
||||
<div
|
||||
className={`${
|
||||
corners !== 'rounded-full' ? corners : 'rounded-3xl'
|
||||
} dark:bg-dark-900 ${cardsStyle} dark:border-dark-700 p-6`}
|
||||
>
|
||||
<div className='flex justify-between align-center'>
|
||||
<div>
|
||||
<div className='text-lg leading-tight text-gray-500 dark:text-gray-400'>
|
||||
Orders
|
||||
</div>
|
||||
<div className='text-3xl leading-tight font-semibold'>
|
||||
{orders}
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<BaseIcon
|
||||
className={`${iconsColor}`}
|
||||
w='w-16'
|
||||
h='h-16'
|
||||
size={48}
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
path={
|
||||
'mdiPackageVariantClosed' in icon
|
||||
? icon['mdiPackageVariantClosed' as keyof typeof icon]
|
||||
: icon.mdiTable || icon.mdiTable
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Link>
|
||||
)}
|
||||
|
||||
{hasPermission(currentUser, 'READ_USERS') && (
|
||||
<Link href={'/users/users-list'}>
|
||||
<div
|
||||
className={`${
|
||||
corners !== 'rounded-full' ? corners : 'rounded-3xl'
|
||||
} dark:bg-dark-900 ${cardsStyle} dark:border-dark-700 p-6`}
|
||||
>
|
||||
<div className='flex justify-between align-center'>
|
||||
<div>
|
||||
<div className='text-lg leading-tight text-gray-500 dark:text-gray-400'>
|
||||
Users
|
||||
</div>
|
||||
<div className='text-3xl leading-tight font-semibold'>
|
||||
{users}
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<BaseIcon
|
||||
className={`${iconsColor}`}
|
||||
w='w-16'
|
||||
h='h-16'
|
||||
size={48}
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
path={icon.mdiAccountGroup || icon.mdiTable}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Link>
|
||||
)}
|
||||
|
||||
{hasPermission(currentUser, 'READ_ROLES') && (
|
||||
<Link href={'/roles/roles-list'}>
|
||||
<div
|
||||
className={`${
|
||||
corners !== 'rounded-full' ? corners : 'rounded-3xl'
|
||||
} dark:bg-dark-900 ${cardsStyle} dark:border-dark-700 p-6`}
|
||||
>
|
||||
<div className='flex justify-between align-center'>
|
||||
<div>
|
||||
<div className='text-lg leading-tight text-gray-500 dark:text-gray-400'>
|
||||
Roles
|
||||
</div>
|
||||
<div className='text-3xl leading-tight font-semibold'>
|
||||
{roles}
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<BaseIcon
|
||||
className={`${iconsColor}`}
|
||||
w='w-16'
|
||||
h='h-16'
|
||||
size={48}
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
path={
|
||||
icon.mdiShieldAccountVariantOutline || icon.mdiTable
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Link>
|
||||
)}
|
||||
|
||||
{hasPermission(currentUser, 'READ_ORGANIZATIONS') && (
|
||||
<Link href={'/organizations/organizations-list'}>
|
||||
<div
|
||||
|
||||
@ -63,59 +63,6 @@ const OrganizationsView = () => {
|
||||
<p>{organizations?.name}</p>
|
||||
</div>
|
||||
|
||||
<>
|
||||
<p className={'block font-bold mb-2'}>Users Organizations</p>
|
||||
<CardBox
|
||||
className='mb-6 border border-gray-300 rounded overflow-hidden'
|
||||
hasTable
|
||||
>
|
||||
<div className='overflow-x-auto'>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>First Name</th>
|
||||
|
||||
<th>Last Name</th>
|
||||
|
||||
<th>Phone Number</th>
|
||||
|
||||
<th>E-Mail</th>
|
||||
|
||||
<th>Disabled</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{organizations.users_organizations &&
|
||||
Array.isArray(organizations.users_organizations) &&
|
||||
organizations.users_organizations.map((item: any) => (
|
||||
<tr
|
||||
key={item.id}
|
||||
onClick={() =>
|
||||
router.push(`/users/users-view/?id=${item.id}`)
|
||||
}
|
||||
>
|
||||
<td data-label='firstName'>{item.firstName}</td>
|
||||
|
||||
<td data-label='lastName'>{item.lastName}</td>
|
||||
|
||||
<td data-label='phoneNumber'>{item.phoneNumber}</td>
|
||||
|
||||
<td data-label='email'>{item.email}</td>
|
||||
|
||||
<td data-label='disabled'>
|
||||
{dataFormatter.booleanFormatter(item.disabled)}
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{!organizations?.users_organizations?.length && (
|
||||
<div className={'text-center py-4'}>No data</div>
|
||||
)}
|
||||
</CardBox>
|
||||
</>
|
||||
|
||||
<>
|
||||
<p className={'block font-bold mb-2'}>Categories organizations</p>
|
||||
<CardBox
|
||||
@ -156,7 +103,7 @@ const OrganizationsView = () => {
|
||||
</>
|
||||
|
||||
<>
|
||||
<p className={'block font-bold mb-2'}>Customers organizations</p>
|
||||
<p className={'block font-bold mb-2'}>Payments organizations</p>
|
||||
<CardBox
|
||||
className='mb-6 border border-gray-300 rounded overflow-hidden'
|
||||
hasTable
|
||||
@ -165,36 +112,38 @@ const OrganizationsView = () => {
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>FirstName</th>
|
||||
<th>Amount</th>
|
||||
|
||||
<th>LastName</th>
|
||||
<th>Method</th>
|
||||
|
||||
<th>Email</th>
|
||||
<th>Verified</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{organizations.customers_organizations &&
|
||||
Array.isArray(organizations.customers_organizations) &&
|
||||
organizations.customers_organizations.map((item: any) => (
|
||||
{organizations.payments_organizations &&
|
||||
Array.isArray(organizations.payments_organizations) &&
|
||||
organizations.payments_organizations.map((item: any) => (
|
||||
<tr
|
||||
key={item.id}
|
||||
onClick={() =>
|
||||
router.push(
|
||||
`/customers/customers-view/?id=${item.id}`,
|
||||
`/payments/payments-view/?id=${item.id}`,
|
||||
)
|
||||
}
|
||||
>
|
||||
<td data-label='first_name'>{item.first_name}</td>
|
||||
<td data-label='amount'>{item.amount}</td>
|
||||
|
||||
<td data-label='last_name'>{item.last_name}</td>
|
||||
<td data-label='method'>{item.method}</td>
|
||||
|
||||
<td data-label='email'>{item.email}</td>
|
||||
<td data-label='verified'>
|
||||
{dataFormatter.booleanFormatter(item.verified)}
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{!organizations?.customers_organizations?.length && (
|
||||
{!organizations?.payments_organizations?.length && (
|
||||
<div className={'text-center py-4'}>No data</div>
|
||||
)}
|
||||
</CardBox>
|
||||
@ -251,6 +200,92 @@ const OrganizationsView = () => {
|
||||
</CardBox>
|
||||
</>
|
||||
|
||||
<>
|
||||
<p className={'block font-bold mb-2'}>Reports organizations</p>
|
||||
<CardBox
|
||||
className='mb-6 border border-gray-300 rounded overflow-hidden'
|
||||
hasTable
|
||||
>
|
||||
<div className='overflow-x-auto'>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Title</th>
|
||||
|
||||
<th>GeneratedAt</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{organizations.reports_organizations &&
|
||||
Array.isArray(organizations.reports_organizations) &&
|
||||
organizations.reports_organizations.map((item: any) => (
|
||||
<tr
|
||||
key={item.id}
|
||||
onClick={() =>
|
||||
router.push(`/reports/reports-view/?id=${item.id}`)
|
||||
}
|
||||
>
|
||||
<td data-label='title'>{item.title}</td>
|
||||
|
||||
<td data-label='generated_at'>
|
||||
{dataFormatter.dateTimeFormatter(item.generated_at)}
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{!organizations?.reports_organizations?.length && (
|
||||
<div className={'text-center py-4'}>No data</div>
|
||||
)}
|
||||
</CardBox>
|
||||
</>
|
||||
|
||||
<>
|
||||
<p className={'block font-bold mb-2'}>Customers organizations</p>
|
||||
<CardBox
|
||||
className='mb-6 border border-gray-300 rounded overflow-hidden'
|
||||
hasTable
|
||||
>
|
||||
<div className='overflow-x-auto'>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>FirstName</th>
|
||||
|
||||
<th>LastName</th>
|
||||
|
||||
<th>Email</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{organizations.customers_organizations &&
|
||||
Array.isArray(organizations.customers_organizations) &&
|
||||
organizations.customers_organizations.map((item: any) => (
|
||||
<tr
|
||||
key={item.id}
|
||||
onClick={() =>
|
||||
router.push(
|
||||
`/customers/customers-view/?id=${item.id}`,
|
||||
)
|
||||
}
|
||||
>
|
||||
<td data-label='first_name'>{item.first_name}</td>
|
||||
|
||||
<td data-label='last_name'>{item.last_name}</td>
|
||||
|
||||
<td data-label='email'>{item.email}</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{!organizations?.customers_organizations?.length && (
|
||||
<div className={'text-center py-4'}>No data</div>
|
||||
)}
|
||||
</CardBox>
|
||||
</>
|
||||
|
||||
<>
|
||||
<p className={'block font-bold mb-2'}>Orders organizations</p>
|
||||
<CardBox
|
||||
@ -293,7 +328,7 @@ const OrganizationsView = () => {
|
||||
</>
|
||||
|
||||
<>
|
||||
<p className={'block font-bold mb-2'}>Payments organizations</p>
|
||||
<p className={'block font-bold mb-2'}>Users Organizations</p>
|
||||
<CardBox
|
||||
className='mb-6 border border-gray-300 rounded overflow-hidden'
|
||||
hasTable
|
||||
@ -302,79 +337,44 @@ const OrganizationsView = () => {
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Amount</th>
|
||||
<th>First Name</th>
|
||||
|
||||
<th>Method</th>
|
||||
<th>Last Name</th>
|
||||
|
||||
<th>Verified</th>
|
||||
<th>Phone Number</th>
|
||||
|
||||
<th>E-Mail</th>
|
||||
|
||||
<th>Disabled</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{organizations.payments_organizations &&
|
||||
Array.isArray(organizations.payments_organizations) &&
|
||||
organizations.payments_organizations.map((item: any) => (
|
||||
{organizations.users_organizations &&
|
||||
Array.isArray(organizations.users_organizations) &&
|
||||
organizations.users_organizations.map((item: any) => (
|
||||
<tr
|
||||
key={item.id}
|
||||
onClick={() =>
|
||||
router.push(
|
||||
`/payments/payments-view/?id=${item.id}`,
|
||||
)
|
||||
router.push(`/users/users-view/?id=${item.id}`)
|
||||
}
|
||||
>
|
||||
<td data-label='amount'>{item.amount}</td>
|
||||
<td data-label='firstName'>{item.firstName}</td>
|
||||
|
||||
<td data-label='method'>{item.method}</td>
|
||||
<td data-label='lastName'>{item.lastName}</td>
|
||||
|
||||
<td data-label='verified'>
|
||||
{dataFormatter.booleanFormatter(item.verified)}
|
||||
<td data-label='phoneNumber'>{item.phoneNumber}</td>
|
||||
|
||||
<td data-label='email'>{item.email}</td>
|
||||
|
||||
<td data-label='disabled'>
|
||||
{dataFormatter.booleanFormatter(item.disabled)}
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{!organizations?.payments_organizations?.length && (
|
||||
<div className={'text-center py-4'}>No data</div>
|
||||
)}
|
||||
</CardBox>
|
||||
</>
|
||||
|
||||
<>
|
||||
<p className={'block font-bold mb-2'}>Reports organizations</p>
|
||||
<CardBox
|
||||
className='mb-6 border border-gray-300 rounded overflow-hidden'
|
||||
hasTable
|
||||
>
|
||||
<div className='overflow-x-auto'>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Title</th>
|
||||
|
||||
<th>GeneratedAt</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{organizations.reports_organizations &&
|
||||
Array.isArray(organizations.reports_organizations) &&
|
||||
organizations.reports_organizations.map((item: any) => (
|
||||
<tr
|
||||
key={item.id}
|
||||
onClick={() =>
|
||||
router.push(`/reports/reports-view/?id=${item.id}`)
|
||||
}
|
||||
>
|
||||
<td data-label='title'>{item.title}</td>
|
||||
|
||||
<td data-label='generated_at'>
|
||||
{dataFormatter.dateTimeFormatter(item.generated_at)}
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{!organizations?.reports_organizations?.length && (
|
||||
{!organizations?.users_organizations?.length && (
|
||||
<div className={'text-center py-4'}>No data</div>
|
||||
)}
|
||||
</CardBox>
|
||||
|
||||
@ -4,15 +4,15 @@ import mainReducer from './mainSlice';
|
||||
import authSlice from './authSlice';
|
||||
import openAiSlice from './openAiSlice';
|
||||
|
||||
import usersSlice from './users/usersSlice';
|
||||
import categoriesSlice from './categories/categoriesSlice';
|
||||
import customersSlice from './customers/customersSlice';
|
||||
import furniture_typesSlice from './furniture_types/furniture_typesSlice';
|
||||
import ordersSlice from './orders/ordersSlice';
|
||||
import rolesSlice from './roles/rolesSlice';
|
||||
import paymentsSlice from './payments/paymentsSlice';
|
||||
import furniture_typesSlice from './furniture_types/furniture_typesSlice';
|
||||
import reportsSlice from './reports/reportsSlice';
|
||||
import permissionsSlice from './permissions/permissionsSlice';
|
||||
import customersSlice from './customers/customersSlice';
|
||||
import ordersSlice from './orders/ordersSlice';
|
||||
import usersSlice from './users/usersSlice';
|
||||
import rolesSlice from './roles/rolesSlice';
|
||||
import organizationsSlice from './organizations/organizationsSlice';
|
||||
|
||||
export const store = configureStore({
|
||||
@ -22,15 +22,15 @@ export const store = configureStore({
|
||||
auth: authSlice,
|
||||
openAi: openAiSlice,
|
||||
|
||||
users: usersSlice,
|
||||
categories: categoriesSlice,
|
||||
customers: customersSlice,
|
||||
furniture_types: furniture_typesSlice,
|
||||
orders: ordersSlice,
|
||||
roles: rolesSlice,
|
||||
payments: paymentsSlice,
|
||||
furniture_types: furniture_typesSlice,
|
||||
reports: reportsSlice,
|
||||
permissions: permissionsSlice,
|
||||
customers: customersSlice,
|
||||
orders: ordersSlice,
|
||||
users: usersSlice,
|
||||
roles: rolesSlice,
|
||||
organizations: organizationsSlice,
|
||||
},
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user