diff --git a/app/Controllers/Http/Submitter/DatasetController.ts b/app/Controllers/Http/Submitter/DatasetController.ts index 64272b2..99f9a31 100644 --- a/app/Controllers/Http/Submitter/DatasetController.ts +++ b/app/Controllers/Http/Submitter/DatasetController.ts @@ -133,7 +133,7 @@ export default class DatasetController { referenceIdentifierTypes: Object.entries(ReferenceIdentifierTypes).map(([key, value]) => ({ value: key, label: value })), relationTypes: Object.entries(RelationTypes).map(([key, value]) => ({ value: key, label: value })), contributorTypes: ContributorTypes, - subjectTypes: SubjectTypes + subjectTypes: SubjectTypes, }); } diff --git a/app/Controllers/Http/Submitter/PersonController.ts b/app/Controllers/Http/Submitter/PersonController.ts new file mode 100644 index 0000000..3a67fea --- /dev/null +++ b/app/Controllers/Http/Submitter/PersonController.ts @@ -0,0 +1,70 @@ +import type { HttpContextContract } from '@ioc:Adonis/Core/HttpContext'; +// import User from 'App/Models/User'; +// import Dataset from 'App/Models/Dataset'; +// import License from 'App/Models/License'; +// import Project from 'App/Models/Project'; +// import Title from 'App/Models/Title'; +// import Description from 'App/Models/Description'; +// import Language from 'App/Models/Language'; +// import Coverage from 'App/Models/Coverage'; +// import Collection from 'App/Models/Collection'; +// import { schema, CustomMessages, rules } from '@ioc:Adonis/Core/Validator'; +// import dayjs from 'dayjs'; +import Person from 'App/Models/Person'; + +import type { ModelQueryBuilderContract } from '@ioc:Adonis/Lucid/Orm'; + +export default class PersonController { + public async index({ auth, request, inertia }: HttpContextContract) { + // const user = (await User.find(auth.user?.id)) as User; + const page = request.input('page', 1); + let persons: ModelQueryBuilderContract = Person.query(); + + // if (request.input('search')) { + // // users = users.whereRaw('name like %?%', [request.input('search')]) + // const searchTerm = request.input('search'); + // datasets.where('name', 'ilike', `%${searchTerm}%`); + // } + + if (request.input('sort')) { + type SortOrder = 'asc' | 'desc' | undefined; + let attribute = request.input('sort'); + let sortOrder: SortOrder = 'asc'; + + if (attribute.substr(0, 1) === '-') { + sortOrder = 'desc'; + // attribute = substr(attribute, 1); + attribute = attribute.substr(1); + } + persons.orderBy(attribute, sortOrder); + } else { + // users.orderBy('created_at', 'desc'); + persons.orderBy('id', 'asc'); + } + + // const results = await Database + // .query() + // .select(Database.raw("CONCAT('https://doi.org/', b.value) AS concatenated_value")) + // .from('documents as doc') + // .innerJoin('dataset_identifiers as b', 'doc.id', 'b.dataset_id') + // .groupBy('a.id').toQuery(); + + // const users = await User.query().orderBy('login').paginate(page, limit); + const myPersons = await persons + // .where('account_id', user.id) + // .preload('titles') + // .preload('user', (query) => query.select('id', 'login')) + .paginate(page, 10); + + return inertia.render('Submitter/Person/Index', { + // testing: 'this is a test', + persons: myPersons.serialize(), + filters: request.all(), + can: { + // create: await auth.user?.can(['dataset-submit']), + edit: await auth.user?.can(['dataset-edit']), + delete: await auth.user?.can(['dataset-delete']), + }, + }); + } +} diff --git a/database/migrations/references_1_document_references.ts b/database/migrations/references_1_document_references.ts index 4c8ed2e..54674a5 100644 --- a/database/migrations/references_1_document_references.ts +++ b/database/migrations/references_1_document_references.ts @@ -7,7 +7,7 @@ export default class DocumentReferences extends BaseSchema { public async up() { this.schema.createTable(this.tableName, (table) => { table.increments('id').primary().defaultTo("nextval('document_references_id_seq')"); - table.integer('document_id').unsigned().notNullable(); + table.integer('document_id').unsigned().notNullable(); table .foreign('document_id', 'document_references_document_id_foreign') .references('id') @@ -19,7 +19,7 @@ export default class DocumentReferences extends BaseSchema { // table.string('relation').notNullable(); table.enum('relation', Object.keys(RelationTypes)).notNullable(); table.string('value').notNullable(); - table.string('label').notNullable(); + table.string('label').notNullable(); table.timestamp('created_at', { useTz: false }).nullable(); table.timestamp('updated_at', { useTz: false }).nullable(); }); diff --git a/database/migrations/references_2_document_identifiers.ts b/database/migrations/references_2_document_identifiers.ts index df8b5ef..a9850ad 100644 --- a/database/migrations/references_2_document_identifiers.ts +++ b/database/migrations/references_2_document_identifiers.ts @@ -6,8 +6,8 @@ export default class DocumentIdentifiers extends BaseSchema { public async up() { this.schema.createTable(this.tableName, (table) => { - table.increments('id').primary().defaultTo("nextval('document_identifiers_id_seq')") - table.integer('document_id').unsigned().notNullable(); + table.increments('id').primary().defaultTo("nextval('document_identifiers_id_seq')"); + table.integer('document_id').unsigned().notNullable(); table .foreign('document_id', 'document_identifiers_document_id_foreign') .references('id') @@ -15,8 +15,8 @@ export default class DocumentIdentifiers extends BaseSchema { .onDelete('CASCADE') // delete this identifier when document is deleted .onUpdate('CASCADE'); // table.string('type').notNullable(); - table.enum('type', Object.keys(IdentifierTypes)).notNullable(); - table.string('value').notNullable(); + table.enum('type', Object.keys(IdentifierTypes)).notNullable(); + table.string('value').notNullable(); table.timestamp('created_at', { useTz: false }).nullable(); table.timestamp('updated_at', { useTz: false }).nullable(); }); @@ -42,4 +42,4 @@ export default class DocumentIdentifiers extends BaseSchema { // ON UPDATE CASCADE // ON DELETE CASCADE, // CONSTRAINT document_identifiers_type_check CHECK (type::text = ANY (ARRAY['doi'::character varying::text, 'handle'::character varying::text, 'isbn'::character varying::text, 'issn'::character varying::text, 'url'::character varying::text, 'urn'::character varying::text])) -// ) \ No newline at end of file +// ) diff --git a/public/logo.svg b/public/logo.svg new file mode 100644 index 0000000..1786dcf --- /dev/null +++ b/public/logo.svg @@ -0,0 +1,183 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/resources/css/_table.css b/resources/css/_table.css index 44357d1..f02fb7e 100644 --- a/resources/css/_table.css +++ b/resources/css/_table.css @@ -16,7 +16,7 @@ table { } td:not(:first-child) { - @apply lg:border-l lg:border-t-0 lg:border-r-0 lg:border-b-0 lg:border-gray-100 lg:dark:border-slate-700; + @apply lg:border-0 lg:border-t-0 lg:border-r-0 lg:border-b-0 lg:border-gray-100 lg:dark:border-slate-700; } th { diff --git a/resources/js/Components/SectionFullScreen.vue b/resources/js/Components/SectionFullScreen.vue index 1385d0c..98d99e6 100644 --- a/resources/js/Components/SectionFullScreen.vue +++ b/resources/js/Components/SectionFullScreen.vue @@ -1,39 +1,36 @@ diff --git a/resources/js/Pages/Auth/Login.vue b/resources/js/Pages/Auth/Login.vue index e7154d7..1bb47e9 100644 --- a/resources/js/Pages/Auth/Login.vue +++ b/resources/js/Pages/Auth/Login.vue @@ -32,9 +32,15 @@ import FormControl from '@/Components/FormControl.vue';