Auto commit: 2025-07-19T21:46:44.130Z

This commit is contained in:
Flatlogic Bot 2025-07-19 21:46:44 +00:00
parent b9289338b9
commit 779bd88887
24 changed files with 423 additions and 495 deletions

File diff suppressed because one or more lines are too long

View File

@ -16,6 +16,9 @@ module.exports = class OrganizationsDBApi {
id: data.id || undefined, id: data.id || undefined,
name: data.name || null, name: data.name || null,
logo_url: data.logo_url || null,
primary_color: data.primary_color || null,
secondary_color: data.secondary_color || null,
importHash: data.importHash || null, importHash: data.importHash || null,
createdById: currentUser.id, createdById: currentUser.id,
updatedById: currentUser.id, updatedById: currentUser.id,
@ -35,6 +38,9 @@ module.exports = class OrganizationsDBApi {
id: item.id || undefined, id: item.id || undefined,
name: item.name || null, name: item.name || null,
logo_url: item.logo_url || null,
primary_color: item.primary_color || null,
secondary_color: item.secondary_color || null,
importHash: item.importHash || null, importHash: item.importHash || null,
createdById: currentUser.id, createdById: currentUser.id,
updatedById: currentUser.id, updatedById: currentUser.id,
@ -66,6 +72,14 @@ module.exports = class OrganizationsDBApi {
if (data.name !== undefined) updatePayload.name = data.name; if (data.name !== undefined) updatePayload.name = data.name;
if (data.logo_url !== undefined) updatePayload.logo_url = data.logo_url;
if (data.primary_color !== undefined)
updatePayload.primary_color = data.primary_color;
if (data.secondary_color !== undefined)
updatePayload.secondary_color = data.secondary_color;
updatePayload.updatedById = currentUser.id; updatePayload.updatedById = currentUser.id;
await organizations.update(updatePayload, { transaction }); await organizations.update(updatePayload, { transaction });
@ -204,6 +218,35 @@ module.exports = class OrganizationsDBApi {
}; };
} }
if (filter.logo_url) {
where = {
...where,
[Op.and]: Utils.ilike('organizations', 'logo_url', filter.logo_url),
};
}
if (filter.primary_color) {
where = {
...where,
[Op.and]: Utils.ilike(
'organizations',
'primary_color',
filter.primary_color,
),
};
}
if (filter.secondary_color) {
where = {
...where,
[Op.and]: Utils.ilike(
'organizations',
'secondary_color',
filter.secondary_color,
),
};
}
if (filter.active !== undefined) { if (filter.active !== undefined) {
where = { where = {
...where, ...where,

View File

@ -0,0 +1,49 @@
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.addColumn(
'organizations',
'logo_url',
{
type: Sequelize.DataTypes.TEXT,
},
{ transaction },
);
await transaction.commit();
} catch (err) {
await transaction.rollback();
throw err;
}
},
/**
* @param {QueryInterface} queryInterface
* @param {Sequelize} Sequelize
* @returns {Promise<void>}
*/
async down(queryInterface, Sequelize) {
/**
* @type {Transaction}
*/
const transaction = await queryInterface.sequelize.transaction();
try {
await queryInterface.removeColumn('organizations', 'logo_url', {
transaction,
});
await transaction.commit();
} catch (err) {
await transaction.rollback();
throw err;
}
},
};

View File

@ -0,0 +1,49 @@
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.addColumn(
'organizations',
'primary_color',
{
type: Sequelize.DataTypes.TEXT,
},
{ transaction },
);
await transaction.commit();
} catch (err) {
await transaction.rollback();
throw err;
}
},
/**
* @param {QueryInterface} queryInterface
* @param {Sequelize} Sequelize
* @returns {Promise<void>}
*/
async down(queryInterface, Sequelize) {
/**
* @type {Transaction}
*/
const transaction = await queryInterface.sequelize.transaction();
try {
await queryInterface.removeColumn('organizations', 'primary_color', {
transaction,
});
await transaction.commit();
} catch (err) {
await transaction.rollback();
throw err;
}
},
};

View File

@ -0,0 +1,49 @@
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.addColumn(
'organizations',
'secondary_color',
{
type: Sequelize.DataTypes.TEXT,
},
{ transaction },
);
await transaction.commit();
} catch (err) {
await transaction.rollback();
throw err;
}
},
/**
* @param {QueryInterface} queryInterface
* @param {Sequelize} Sequelize
* @returns {Promise<void>}
*/
async down(queryInterface, Sequelize) {
/**
* @type {Transaction}
*/
const transaction = await queryInterface.sequelize.transaction();
try {
await queryInterface.removeColumn('organizations', 'secondary_color', {
transaction,
});
await transaction.commit();
} catch (err) {
await transaction.rollback();
throw err;
}
},
};

View File

@ -18,6 +18,18 @@ module.exports = function (sequelize, DataTypes) {
type: DataTypes.TEXT, type: DataTypes.TEXT,
}, },
logo_url: {
type: DataTypes.TEXT,
},
primary_color: {
type: DataTypes.TEXT,
},
secondary_color: {
type: DataTypes.TEXT,
},
importHash: { importHash: {
type: DataTypes.STRING(255), type: DataTypes.STRING(255),
allowNull: true, allowNull: true,

View File

@ -47,35 +47,7 @@ const ActionsData = [
due_date: new Date('2023-10-15T00:00:00Z'), due_date: new Date('2023-10-15T00:00:00Z'),
status: 'EnProgreso', status: 'Vencida',
// type code here for "relation_one" field
// type code here for "relation_one" field
// type code here for "relation_one" field
},
{
description: 'Contain and clean chemical spill',
due_date: new Date('2023-10-18T00:00:00Z'),
status: 'Pendiente',
// type code here for "relation_one" field
// type code here for "relation_one" field
// type code here for "relation_one" field
},
{
description: 'Inspect and repair electrical wiring',
due_date: new Date('2023-10-20T00:00:00Z'),
status: 'Completada',
// type code here for "relation_one" field // type code here for "relation_one" field
@ -109,22 +81,6 @@ const BranchesData = [
// type code here for "relation_one" field // type code here for "relation_one" field
}, },
{
name: 'Puerto Williams',
location: 'Chile',
// type code here for "relation_one" field
},
{
name: 'Bodega Central',
location: 'Chile',
// type code here for "relation_one" field
},
]; ];
const ChecklistsData = [ const ChecklistsData = [
@ -158,31 +114,11 @@ const ChecklistsData = [
// type code here for "relation_one" field // type code here for "relation_one" field
}, },
{
title: 'Quarterly Emergency Drill',
description: 'Conduct emergency drills for all staff',
// type code here for "files" field
// type code here for "relation_one" field
},
{
title: 'Annual Safety Audit',
description: 'Comprehensive safety audit of all facilities',
// type code here for "files" field
// type code here for "relation_one" field
},
]; ];
const EventsData = [ const EventsData = [
{ {
event_type: 'Cuasi-incidente', event_type: 'ObservacióndeSeguridad',
description: 'Worker slipped on wet floor', description: 'Worker slipped on wet floor',
@ -190,7 +126,7 @@ const EventsData = [
status: 'Abierto', status: 'Abierto',
risk_level: 'Bajo', risk_level: 'Alto',
// type code here for "images" field // type code here for "images" field
@ -202,7 +138,7 @@ const EventsData = [
}, },
{ {
event_type: 'ObservacióndeSeguridad', event_type: 'Incidente',
description: 'Forklift nearly hit a worker', description: 'Forklift nearly hit a worker',
@ -222,33 +158,13 @@ const EventsData = [
}, },
{ {
event_type: 'Cuasi-incidente', event_type: 'Incidente',
description: 'Safety goggles not worn', description: 'Safety goggles not worn',
event_date: new Date('2023-10-03T09:15:00Z'), event_date: new Date('2023-10-03T09:15:00Z'),
status: 'Cerrado', status: 'EnInvestigación',
risk_level: 'Medio',
// type code here for "images" field
// type code here for "relation_one" field
// type code here for "relation_one" field
// type code here for "relation_one" field
},
{
event_type: 'ObservacióndeSeguridad',
description: 'Chemical spill in storage area',
event_date: new Date('2023-10-04T14:45:00Z'),
status: 'Cerrado',
risk_level: 'Bajo', risk_level: 'Bajo',
@ -260,26 +176,6 @@ const EventsData = [
// type code here for "relation_one" field // type code here for "relation_one" field
}, },
{
event_type: 'Incidente',
description: 'Loose electrical wiring found',
event_date: new Date('2023-10-05T16:20:00Z'),
status: 'Abierto',
risk_level: 'Alto',
// type code here for "images" field
// type code here for "relation_one" field
// type code here for "relation_one" field
// type code here for "relation_one" field
},
]; ];
const InspectionsData = [ const InspectionsData = [
@ -330,59 +226,37 @@ const InspectionsData = [
// type code here for "relation_one" field // type code here for "relation_one" field
}, },
{
// type code here for "relation_one" field
// type code here for "relation_one" field
completion_date: new Date('2023-10-09T14:00:00Z'),
// type code here for "relation_one" field
// type code here for "files" field
score: 100,
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
// type code here for "relation_one" field
completion_date: new Date('2023-10-10T15:00:00Z'),
// type code here for "relation_one" field
// type code here for "files" field
score: 100,
// type code here for "relation_one" field
},
]; ];
const OrganizationsData = [ const OrganizationsData = [
{ {
name: 'Hans Bethe', name: 'William Herschel',
logo_url: 'Paul Ehrlich',
primary_color: 'Comte de Buffon',
secondary_color: 'Antoine Laurent Lavoisier',
}, },
{ {
name: 'Frederick Gowland Hopkins', name: 'Murray Gell-Mann',
logo_url: 'Frederick Sanger',
primary_color: 'Isaac Newton',
secondary_color: 'Francis Crick',
}, },
{ {
name: 'George Gaylord Simpson', name: 'William Bayliss',
},
{ logo_url: 'Isaac Newton',
name: 'Arthur Eddington',
},
{ primary_color: 'Francis Crick',
name: 'John von Neumann',
secondary_color: 'Anton van Leeuwenhoek',
}, },
]; ];
@ -421,28 +295,6 @@ async function associateUserWithOrganization() {
if (User2?.setOrganization) { if (User2?.setOrganization) {
await User2.setOrganization(relatedOrganization2); await User2.setOrganization(relatedOrganization2);
} }
const relatedOrganization3 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const User3 = await Users.findOne({
order: [['id', 'ASC']],
offset: 3,
});
if (User3?.setOrganization) {
await User3.setOrganization(relatedOrganization3);
}
const relatedOrganization4 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const User4 = await Users.findOne({
order: [['id', 'ASC']],
offset: 4,
});
if (User4?.setOrganization) {
await User4.setOrganization(relatedOrganization4);
}
} }
async function associateActionWithEvent() { async function associateActionWithEvent() {
@ -478,28 +330,6 @@ async function associateActionWithEvent() {
if (Action2?.setEvent) { if (Action2?.setEvent) {
await Action2.setEvent(relatedEvent2); await Action2.setEvent(relatedEvent2);
} }
const relatedEvent3 = await Events.findOne({
offset: Math.floor(Math.random() * (await Events.count())),
});
const Action3 = await Actions.findOne({
order: [['id', 'ASC']],
offset: 3,
});
if (Action3?.setEvent) {
await Action3.setEvent(relatedEvent3);
}
const relatedEvent4 = await Events.findOne({
offset: Math.floor(Math.random() * (await Events.count())),
});
const Action4 = await Actions.findOne({
order: [['id', 'ASC']],
offset: 4,
});
if (Action4?.setEvent) {
await Action4.setEvent(relatedEvent4);
}
} }
async function associateActionWithAssigned_to() { async function associateActionWithAssigned_to() {
@ -535,28 +365,6 @@ async function associateActionWithAssigned_to() {
if (Action2?.setAssigned_to) { if (Action2?.setAssigned_to) {
await Action2.setAssigned_to(relatedAssigned_to2); await Action2.setAssigned_to(relatedAssigned_to2);
} }
const relatedAssigned_to3 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const Action3 = await Actions.findOne({
order: [['id', 'ASC']],
offset: 3,
});
if (Action3?.setAssigned_to) {
await Action3.setAssigned_to(relatedAssigned_to3);
}
const relatedAssigned_to4 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const Action4 = await Actions.findOne({
order: [['id', 'ASC']],
offset: 4,
});
if (Action4?.setAssigned_to) {
await Action4.setAssigned_to(relatedAssigned_to4);
}
} }
async function associateActionWithOrganization() { async function associateActionWithOrganization() {
@ -592,28 +400,6 @@ async function associateActionWithOrganization() {
if (Action2?.setOrganization) { if (Action2?.setOrganization) {
await Action2.setOrganization(relatedOrganization2); await Action2.setOrganization(relatedOrganization2);
} }
const relatedOrganization3 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const Action3 = await Actions.findOne({
order: [['id', 'ASC']],
offset: 3,
});
if (Action3?.setOrganization) {
await Action3.setOrganization(relatedOrganization3);
}
const relatedOrganization4 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const Action4 = await Actions.findOne({
order: [['id', 'ASC']],
offset: 4,
});
if (Action4?.setOrganization) {
await Action4.setOrganization(relatedOrganization4);
}
} }
async function associateBranchWithOrganization() { async function associateBranchWithOrganization() {
@ -649,28 +435,6 @@ async function associateBranchWithOrganization() {
if (Branch2?.setOrganization) { if (Branch2?.setOrganization) {
await Branch2.setOrganization(relatedOrganization2); await Branch2.setOrganization(relatedOrganization2);
} }
const relatedOrganization3 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const Branch3 = await Branches.findOne({
order: [['id', 'ASC']],
offset: 3,
});
if (Branch3?.setOrganization) {
await Branch3.setOrganization(relatedOrganization3);
}
const relatedOrganization4 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const Branch4 = await Branches.findOne({
order: [['id', 'ASC']],
offset: 4,
});
if (Branch4?.setOrganization) {
await Branch4.setOrganization(relatedOrganization4);
}
} }
async function associateChecklistWithOrganization() { async function associateChecklistWithOrganization() {
@ -706,28 +470,6 @@ async function associateChecklistWithOrganization() {
if (Checklist2?.setOrganization) { if (Checklist2?.setOrganization) {
await Checklist2.setOrganization(relatedOrganization2); await Checklist2.setOrganization(relatedOrganization2);
} }
const relatedOrganization3 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const Checklist3 = await Checklists.findOne({
order: [['id', 'ASC']],
offset: 3,
});
if (Checklist3?.setOrganization) {
await Checklist3.setOrganization(relatedOrganization3);
}
const relatedOrganization4 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const Checklist4 = await Checklists.findOne({
order: [['id', 'ASC']],
offset: 4,
});
if (Checklist4?.setOrganization) {
await Checklist4.setOrganization(relatedOrganization4);
}
} }
async function associateEventWithReported_by() { async function associateEventWithReported_by() {
@ -763,28 +505,6 @@ async function associateEventWithReported_by() {
if (Event2?.setReported_by) { if (Event2?.setReported_by) {
await Event2.setReported_by(relatedReported_by2); await Event2.setReported_by(relatedReported_by2);
} }
const relatedReported_by3 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const Event3 = await Events.findOne({
order: [['id', 'ASC']],
offset: 3,
});
if (Event3?.setReported_by) {
await Event3.setReported_by(relatedReported_by3);
}
const relatedReported_by4 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const Event4 = await Events.findOne({
order: [['id', 'ASC']],
offset: 4,
});
if (Event4?.setReported_by) {
await Event4.setReported_by(relatedReported_by4);
}
} }
async function associateEventWithBranch() { async function associateEventWithBranch() {
@ -820,28 +540,6 @@ async function associateEventWithBranch() {
if (Event2?.setBranch) { if (Event2?.setBranch) {
await Event2.setBranch(relatedBranch2); await Event2.setBranch(relatedBranch2);
} }
const relatedBranch3 = await Branches.findOne({
offset: Math.floor(Math.random() * (await Branches.count())),
});
const Event3 = await Events.findOne({
order: [['id', 'ASC']],
offset: 3,
});
if (Event3?.setBranch) {
await Event3.setBranch(relatedBranch3);
}
const relatedBranch4 = await Branches.findOne({
offset: Math.floor(Math.random() * (await Branches.count())),
});
const Event4 = await Events.findOne({
order: [['id', 'ASC']],
offset: 4,
});
if (Event4?.setBranch) {
await Event4.setBranch(relatedBranch4);
}
} }
async function associateEventWithOrganization() { async function associateEventWithOrganization() {
@ -877,28 +575,6 @@ async function associateEventWithOrganization() {
if (Event2?.setOrganization) { if (Event2?.setOrganization) {
await Event2.setOrganization(relatedOrganization2); await Event2.setOrganization(relatedOrganization2);
} }
const relatedOrganization3 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const Event3 = await Events.findOne({
order: [['id', 'ASC']],
offset: 3,
});
if (Event3?.setOrganization) {
await Event3.setOrganization(relatedOrganization3);
}
const relatedOrganization4 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const Event4 = await Events.findOne({
order: [['id', 'ASC']],
offset: 4,
});
if (Event4?.setOrganization) {
await Event4.setOrganization(relatedOrganization4);
}
} }
async function associateInspectionWithChecklist() { async function associateInspectionWithChecklist() {
@ -934,28 +610,6 @@ async function associateInspectionWithChecklist() {
if (Inspection2?.setChecklist) { if (Inspection2?.setChecklist) {
await Inspection2.setChecklist(relatedChecklist2); await Inspection2.setChecklist(relatedChecklist2);
} }
const relatedChecklist3 = await Checklists.findOne({
offset: Math.floor(Math.random() * (await Checklists.count())),
});
const Inspection3 = await Inspections.findOne({
order: [['id', 'ASC']],
offset: 3,
});
if (Inspection3?.setChecklist) {
await Inspection3.setChecklist(relatedChecklist3);
}
const relatedChecklist4 = await Checklists.findOne({
offset: Math.floor(Math.random() * (await Checklists.count())),
});
const Inspection4 = await Inspections.findOne({
order: [['id', 'ASC']],
offset: 4,
});
if (Inspection4?.setChecklist) {
await Inspection4.setChecklist(relatedChecklist4);
}
} }
async function associateInspectionWithInspector() { async function associateInspectionWithInspector() {
@ -991,28 +645,6 @@ async function associateInspectionWithInspector() {
if (Inspection2?.setInspector) { if (Inspection2?.setInspector) {
await Inspection2.setInspector(relatedInspector2); await Inspection2.setInspector(relatedInspector2);
} }
const relatedInspector3 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const Inspection3 = await Inspections.findOne({
order: [['id', 'ASC']],
offset: 3,
});
if (Inspection3?.setInspector) {
await Inspection3.setInspector(relatedInspector3);
}
const relatedInspector4 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const Inspection4 = await Inspections.findOne({
order: [['id', 'ASC']],
offset: 4,
});
if (Inspection4?.setInspector) {
await Inspection4.setInspector(relatedInspector4);
}
} }
async function associateInspectionWithBranch() { async function associateInspectionWithBranch() {
@ -1048,28 +680,6 @@ async function associateInspectionWithBranch() {
if (Inspection2?.setBranch) { if (Inspection2?.setBranch) {
await Inspection2.setBranch(relatedBranch2); await Inspection2.setBranch(relatedBranch2);
} }
const relatedBranch3 = await Branches.findOne({
offset: Math.floor(Math.random() * (await Branches.count())),
});
const Inspection3 = await Inspections.findOne({
order: [['id', 'ASC']],
offset: 3,
});
if (Inspection3?.setBranch) {
await Inspection3.setBranch(relatedBranch3);
}
const relatedBranch4 = await Branches.findOne({
offset: Math.floor(Math.random() * (await Branches.count())),
});
const Inspection4 = await Inspections.findOne({
order: [['id', 'ASC']],
offset: 4,
});
if (Inspection4?.setBranch) {
await Inspection4.setBranch(relatedBranch4);
}
} }
async function associateInspectionWithOrganization() { async function associateInspectionWithOrganization() {
@ -1105,28 +715,6 @@ async function associateInspectionWithOrganization() {
if (Inspection2?.setOrganization) { if (Inspection2?.setOrganization) {
await Inspection2.setOrganization(relatedOrganization2); await Inspection2.setOrganization(relatedOrganization2);
} }
const relatedOrganization3 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const Inspection3 = await Inspections.findOne({
order: [['id', 'ASC']],
offset: 3,
});
if (Inspection3?.setOrganization) {
await Inspection3.setOrganization(relatedOrganization3);
}
const relatedOrganization4 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const Inspection4 = await Inspections.findOne({
order: [['id', 'ASC']],
offset: 4,
});
if (Inspection4?.setOrganization) {
await Inspection4.setOrganization(relatedOrganization4);
}
} }
module.exports = { module.exports = {

View File

@ -25,6 +25,15 @@ router.use(checkCrudPermissions('organizations'));
* name: * name:
* type: string * type: string
* default: name * default: name
* logo_url:
* type: string
* default: logo_url
* primary_color:
* type: string
* default: primary_color
* secondary_color:
* type: string
* default: secondary_color
*/ */
@ -314,7 +323,13 @@ router.get(
currentUser, currentUser,
}); });
if (filetype && filetype === 'csv') { if (filetype && filetype === 'csv') {
const fields = ['id', 'name']; const fields = [
'id',
'name',
'logo_url',
'primary_color',
'secondary_color',
];
const opts = { fields }; const opts = { fields };
try { try {
const csv = parse(payload.rows, opts); const csv = parse(payload.rows, opts);

View File

@ -51,7 +51,7 @@ module.exports = class SearchService {
events: ['description'], events: ['description'],
organizations: ['name'], organizations: ['name', 'logo_url', 'primary_color', 'secondary_color'],
}; };
const columnsInt = { const columnsInt = {
inspections: ['score'], inspections: ['score'],

View File

@ -85,6 +85,39 @@ const CardOrganizations = ({
<div className='font-medium line-clamp-4'>{item.name}</div> <div className='font-medium line-clamp-4'>{item.name}</div>
</dd> </dd>
</div> </div>
<div className='flex justify-between gap-x-4 py-3'>
<dt className=' text-gray-500 dark:text-dark-600'>
Logo url
</dt>
<dd className='flex items-start gap-x-2'>
<div className='font-medium line-clamp-4'>
{item.logo_url}
</div>
</dd>
</div>
<div className='flex justify-between gap-x-4 py-3'>
<dt className=' text-gray-500 dark:text-dark-600'>
Primary color
</dt>
<dd className='flex items-start gap-x-2'>
<div className='font-medium line-clamp-4'>
{item.primary_color}
</div>
</dd>
</div>
<div className='flex justify-between gap-x-4 py-3'>
<dt className=' text-gray-500 dark:text-dark-600'>
Secondary color
</dt>
<dd className='flex items-start gap-x-2'>
<div className='font-medium line-clamp-4'>
{item.secondary_color}
</div>
</dd>
</div>
</dl> </dl>
</li> </li>
))} ))}

View File

@ -58,6 +58,25 @@ const ListOrganizations = ({
<p className={'text-xs text-gray-500 '}>Name</p> <p className={'text-xs text-gray-500 '}>Name</p>
<p className={'line-clamp-2'}>{item.name}</p> <p className={'line-clamp-2'}>{item.name}</p>
</div> </div>
<div className={'flex-1 px-3'}>
<p className={'text-xs text-gray-500 '}>Logo url</p>
<p className={'line-clamp-2'}>{item.logo_url}</p>
</div>
<div className={'flex-1 px-3'}>
<p className={'text-xs text-gray-500 '}>
Primary color
</p>
<p className={'line-clamp-2'}>{item.primary_color}</p>
</div>
<div className={'flex-1 px-3'}>
<p className={'text-xs text-gray-500 '}>
Secondary color
</p>
<p className={'line-clamp-2'}>{item.secondary_color}</p>
</div>
</Link> </Link>
<ListActionsPopover <ListActionsPopover
onDelete={onDelete} onDelete={onDelete}

View File

@ -50,6 +50,42 @@ export const loadColumns = async (
editable: hasUpdatePermission, editable: hasUpdatePermission,
}, },
{
field: 'logo_url',
headerName: 'Logo url',
flex: 1,
minWidth: 120,
filterable: false,
headerClassName: 'datagrid--header',
cellClassName: 'datagrid--cell',
editable: hasUpdatePermission,
},
{
field: 'primary_color',
headerName: 'Primary color',
flex: 1,
minWidth: 120,
filterable: false,
headerClassName: 'datagrid--header',
cellClassName: 'datagrid--cell',
editable: hasUpdatePermission,
},
{
field: 'secondary_color',
headerName: 'Secondary color',
flex: 1,
minWidth: 120,
filterable: false,
headerClassName: 'datagrid--header',
cellClassName: 'datagrid--cell',
editable: hasUpdatePermission,
},
{ {
field: 'actions', field: 'actions',
type: 'actions', type: 'actions',

View File

@ -17,7 +17,7 @@ export default function WebSiteFooter({ projectName }: WebSiteFooterProps) {
const borders = useAppSelector((state) => state.style.borders); const borders = useAppSelector((state) => state.style.borders);
const websiteHeder = useAppSelector((state) => state.style.websiteHeder); const websiteHeder = useAppSelector((state) => state.style.websiteHeder);
const style = FooterStyle.WITH_PROJECT_NAME; const style = FooterStyle.WITH_PAGES;
const design = FooterDesigns.DESIGN_DIVERSITY; const design = FooterDesigns.DESIGN_DIVERSITY;

View File

@ -19,7 +19,7 @@ export default function WebSiteHeader({ projectName }: WebSiteHeaderProps) {
const style = HeaderStyle.PAGES_RIGHT; const style = HeaderStyle.PAGES_RIGHT;
const design = HeaderDesigns.DESIGN_DIVERSITY; const design = HeaderDesigns.DEFAULT_DESIGN;
return ( return (
<header id='websiteHeader' className='overflow-hidden'> <header id='websiteHeader' className='overflow-hidden'>
<div <div

View File

@ -93,7 +93,7 @@ const menuAside: MenuAsideItem[] = [
// eslint-disable-next-line @typescript-eslint/ban-ts-comment // eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore // @ts-ignore
icon: icon.mdiTable ?? icon.mdiTable, icon: icon.mdiTable ?? icon.mdiTable,
permissions: 'READ_ORGANIZATIONS', permissions: 'CREATE_ORGANIZATIONS',
}, },
{ {
href: '/profile', href: '/profile',

View File

@ -93,7 +93,7 @@ export default function WebSite() {
<FeaturesSection <FeaturesSection
projectName={'PREVCON'} projectName={'PREVCON'}
image={['Dashboard displaying safety metrics']} image={['Dashboard displaying safety metrics']}
withBg={0} withBg={1}
features={features_points} features={features_points}
mainText={`Discover ${projectName} Key Features`} mainText={`Discover ${projectName} Key Features`}
subTitle={`Explore how ${projectName} enhances safety and efficiency with cutting-edge tools and insights.`} subTitle={`Explore how ${projectName} enhances safety and efficiency with cutting-edge tools and insights.`}

View File

@ -47,9 +47,9 @@ export default function Login() {
notify: notifyState, notify: notifyState,
} = useAppSelector((state) => state.auth); } = useAppSelector((state) => state.auth);
const [initialValues, setInitialValues] = React.useState({ const [initialValues, setInitialValues] = React.useState({
email: 'super_admin@flatlogic.com', email: '',
password: 'd4b3e79a', password: '',
remember: true, remember: false,
}); });
const title = 'PREVCON'; const title = 'PREVCON';
@ -204,51 +204,6 @@ export default function Login() {
</Link> </Link>
<div className='flex flex-row text-gray-500 justify-between'> <div className='flex flex-row text-gray-500 justify-between'>
<div>
<p className='mb-2'>
Use{' '}
<code
className={`cursor-pointer ${textColor} `}
data-password='d4b3e79a'
onClick={(e) => setLogin(e.target)}
>
super_admin@flatlogic.com
</code>
{' / '}
<code className={`${textColor}`}>d4b3e79a</code>
{' / '}
to login as Super Admin
</p>
<p className='mb-2'>
Use{' '}
<code
className={`cursor-pointer ${textColor} `}
data-password='d4b3e79a'
onClick={(e) => setLogin(e.target)}
>
admin@flatlogic.com
</code>
{' / '}
<code className={`${textColor}`}>d4b3e79a</code>
{' / '}
to login as Admin
</p>
<p>
Use{' '}
<code
className={`cursor-pointer ${textColor} `}
data-password='76630ed12cc4'
onClick={(e) => setLogin(e.target)}
>
client@hello.com
</code>
{' / '}
<code className={`${textColor}`}>76630ed12cc4</code>
{' / '}
to login as User
</p>
</div>
<div> <div>
<BaseIcon <BaseIcon
className={`${iconsColor}`} className={`${iconsColor}`}

View File

@ -39,6 +39,12 @@ const EditOrganizations = () => {
const dispatch = useAppDispatch(); const dispatch = useAppDispatch();
const initVals = { const initVals = {
name: '', name: '',
logo_url: '',
primary_color: '',
secondary_color: '',
}; };
const [initialValues, setInitialValues] = useState(initVals); const [initialValues, setInitialValues] = useState(initVals);
@ -99,6 +105,18 @@ const EditOrganizations = () => {
<Field name='name' placeholder='Name' /> <Field name='name' placeholder='Name' />
</FormField> </FormField>
<FormField label='Logo url'>
<Field name='logo_url' placeholder='Logo url' />
</FormField>
<FormField label='Primary color'>
<Field name='primary_color' placeholder='Primary color' />
</FormField>
<FormField label='Secondary color'>
<Field name='secondary_color' placeholder='Secondary color' />
</FormField>
<BaseDivider /> <BaseDivider />
<BaseButtons> <BaseButtons>
<BaseButton type='submit' color='info' label='Submit' /> <BaseButton type='submit' color='info' label='Submit' />

View File

@ -39,6 +39,12 @@ const EditOrganizationsPage = () => {
const dispatch = useAppDispatch(); const dispatch = useAppDispatch();
const initVals = { const initVals = {
name: '', name: '',
logo_url: '',
primary_color: '',
secondary_color: '',
}; };
const [initialValues, setInitialValues] = useState(initVals); const [initialValues, setInitialValues] = useState(initVals);
@ -97,6 +103,18 @@ const EditOrganizationsPage = () => {
<Field name='name' placeholder='Name' /> <Field name='name' placeholder='Name' />
</FormField> </FormField>
<FormField label='Logo url'>
<Field name='logo_url' placeholder='Logo url' />
</FormField>
<FormField label='Primary color'>
<Field name='primary_color' placeholder='Primary color' />
</FormField>
<FormField label='Secondary color'>
<Field name='secondary_color' placeholder='Secondary color' />
</FormField>
<BaseDivider /> <BaseDivider />
<BaseButtons> <BaseButtons>
<BaseButton type='submit' color='info' label='Submit' /> <BaseButton type='submit' color='info' label='Submit' />

View File

@ -31,7 +31,12 @@ const OrganizationsTablesPage = () => {
const dispatch = useAppDispatch(); const dispatch = useAppDispatch();
const [filters] = useState([{ label: 'Name', title: 'name' }]); const [filters] = useState([
{ label: 'Name', title: 'name' },
{ label: 'Logo url', title: 'logo_url' },
{ label: 'Primary color', title: 'primary_color' },
{ label: 'Secondary color', title: 'secondary_color' },
]);
const hasCreatePermission = const hasCreatePermission =
currentUser && hasPermission(currentUser, 'CREATE_ORGANIZATIONS'); currentUser && hasPermission(currentUser, 'CREATE_ORGANIZATIONS');

View File

@ -34,6 +34,12 @@ import moment from 'moment';
const initialValues = { const initialValues = {
name: '', name: '',
logo_url: '',
primary_color: '',
secondary_color: '',
}; };
const OrganizationsNew = () => { const OrganizationsNew = () => {
@ -67,6 +73,18 @@ const OrganizationsNew = () => {
<Field name='name' placeholder='Name' /> <Field name='name' placeholder='Name' />
</FormField> </FormField>
<FormField label='Logo url'>
<Field name='logo_url' placeholder='Logo url' />
</FormField>
<FormField label='Primary color'>
<Field name='primary_color' placeholder='Primary color' />
</FormField>
<FormField label='Secondary color'>
<Field name='secondary_color' placeholder='Secondary color' />
</FormField>
<BaseDivider /> <BaseDivider />
<BaseButtons> <BaseButtons>
<BaseButton type='submit' color='info' label='Submit' /> <BaseButton type='submit' color='info' label='Submit' />

View File

@ -31,7 +31,12 @@ const OrganizationsTablesPage = () => {
const dispatch = useAppDispatch(); const dispatch = useAppDispatch();
const [filters] = useState([{ label: 'Name', title: 'name' }]); const [filters] = useState([
{ label: 'Name', title: 'name' },
{ label: 'Logo url', title: 'logo_url' },
{ label: 'Primary color', title: 'primary_color' },
{ label: 'Secondary color', title: 'secondary_color' },
]);
const hasCreatePermission = const hasCreatePermission =
currentUser && hasPermission(currentUser, 'CREATE_ORGANIZATIONS'); currentUser && hasPermission(currentUser, 'CREATE_ORGANIZATIONS');

View File

@ -63,6 +63,21 @@ const OrganizationsView = () => {
<p>{organizations?.name}</p> <p>{organizations?.name}</p>
</div> </div>
<div className={'mb-4'}>
<p className={'block font-bold mb-2'}>Logo url</p>
<p>{organizations?.logo_url}</p>
</div>
<div className={'mb-4'}>
<p className={'block font-bold mb-2'}>Primary color</p>
<p>{organizations?.primary_color}</p>
</div>
<div className={'mb-4'}>
<p className={'block font-bold mb-2'}>Secondary color</p>
<p>{organizations?.secondary_color}</p>
</div>
<> <>
<p className={'block font-bold mb-2'}>Users Organizations</p> <p className={'block font-bold mb-2'}>Users Organizations</p>
<CardBox <CardBox

View File

@ -77,7 +77,7 @@ export default function WebSite() {
<FeaturesSection <FeaturesSection
projectName={'PREVCON'} projectName={'PREVCON'}
image={['Dashboard displaying safety metrics']} image={['Dashboard displaying safety metrics']}
withBg={1} withBg={0}
features={features_points} features={features_points}
mainText={`Discover ${projectName} Key Features`} mainText={`Discover ${projectName} Key Features`}
subTitle={`Explore how ${projectName} enhances safety and efficiency with cutting-edge tools and insights.`} subTitle={`Explore how ${projectName} enhances safety and efficiency with cutting-edge tools and insights.`}