1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-11-28 09:24:24 +01:00

(quality) rename proof-of-identity to supporting-document

This commit is contained in:
Sylvain 2023-02-13 17:31:57 +01:00
parent 979042078d
commit 892ffbe138
114 changed files with 677 additions and 585 deletions

View File

@ -32,7 +32,7 @@ imports
accounting
# Proof of identity files
proof_of_identity_files
supporting_document_files
# Development files
Vagrantfile

2
.gitignore vendored
View File

@ -47,7 +47,7 @@
/accounting/*
# Proof of identity files
/proof_of_identity_files/*
/supporting_document_files/*
.DS_Store

View File

@ -6,6 +6,7 @@
- Improved public calendar loading time
- Fix a bug: schedules jobs are not launched at the right time
- [TODO DEPLOY] `rails fablab:fix_availabilities` THEN `rails fablab:setup:build_places_cache`
- [TODO DEPLOY] `\curl -sSL https://raw.githubusercontent.com/sleede/fab-manager/master/scripts/rename-supporting-document.sh | bash`
- Use Time instead of DateTime objects
- Fix a bug: missing statististics subtypes

View File

@ -87,7 +87,7 @@ VOLUME /usr/src/app/invoices \
/usr/src/app/public/uploads \
/usr/src/app/public/packs \
/usr/src/app/accounting \
/usr/src/app/proof_of_identity_files \
/usr/src/app/supporting_document_files \
/var/log/supervisor
# Expose port 3000 to the Docker host, so we can access it from the outside

View File

@ -14,7 +14,7 @@ class API::ProfileCustomFieldsController < API::ApiController
def show; end
def create
authorize ProofOfIdentityType
authorize ProfileCustomField
@profile_custom_field = ProfileCustomField.new(profile_custom_field_params)
if @profile_custom_field.save
render status: :created

View File

@ -1,54 +0,0 @@
# frozen_string_literal: true
# API Controller for resources of type ProofOfIdentityFile
# ProofOfIdentityFiles are used in settings
class API::ProofOfIdentityFilesController < API::ApiController
before_action :authenticate_user!
before_action :set_proof_of_identity_file, only: %i[show update download]
def index
@proof_of_identity_files = ProofOfIdentityFileService.list(current_user, params)
end
# PUT /api/proof_of_identity_files/1/
def update
authorize @proof_of_identity_file
if ProofOfIdentityFileService.update(@proof_of_identity_file, proof_of_identity_file_params)
render :show, status: :ok, location: @proof_of_identity_file
else
render json: @proof_of_identity_file.errors, status: :unprocessable_entity
end
end
# POST /api/proof_of_identity_files/
def create
@proof_of_identity_file = ProofOfIdentityFile.new(proof_of_identity_file_params)
authorize @proof_of_identity_file
if ProofOfIdentityFileService.create(@proof_of_identity_file)
render :show, status: :created, location: @proof_of_identity_file
else
render json: @proof_of_identity_file.errors, status: :unprocessable_entity
end
end
# GET /api/proof_of_identity_files/1/download
def download
authorize @proof_of_identity_file
send_file @proof_of_identity_file.attachment.url, type: @proof_of_identity_file.attachment.content_type, disposition: 'attachment'
end
# GET /api/proof_of_identity_files/1/
def show; end
private
def set_proof_of_identity_file
@proof_of_identity_file = ProofOfIdentityFile.find(params[:id])
end
# Never trust parameters from the scary internet, only allow the white list through.
def proof_of_identity_file_params
params.required(:proof_of_identity_file).permit(:proof_of_identity_type_id, :attachment, :user_id)
end
end

View File

@ -1,32 +0,0 @@
# frozen_string_literal: true
# API Controller for resources of type ProofOfIdentityRefusal
# ProofOfIdentityRefusal are used by admin refuse user's proof of identity file
class API::ProofOfIdentityRefusalsController < API::ApiController
before_action :authenticate_user!
def index
authorize ProofOfIdentityRefusal
@proof_of_identity_files = ProofOfIdentityRefusalService.list(params)
end
def show; end
# POST /api/proof_of_identity_refusals/
def create
authorize ProofOfIdentityRefusal
@proof_of_identity_refusal = ProofOfIdentityRefusal.new(proof_of_identity_refusal_params)
if ProofOfIdentityRefusalService.create(@proof_of_identity_refusal)
render :show, status: :created, location: @proof_of_identity_refusal
else
render json: @proof_of_identity_refusal.errors, status: :unprocessable_entity
end
end
private
# Never trust parameters from the scary internet, only allow the white list through.
def proof_of_identity_refusal_params
params.required(:proof_of_identity_refusal).permit(:message, :operator_id, :user_id, proof_of_identity_type_ids: [])
end
end

View File

@ -1,50 +0,0 @@
# frozen_string_literal: true
# API Controller for resources of type ProofOfIdentityType
# ProofOfIdentityTypes are used to provide admin config proof of identity type by group
class API::ProofOfIdentityTypesController < API::ApiController
before_action :authenticate_user!, except: :index
before_action :set_proof_of_identity_type, only: %i[show update destroy]
def index
@proof_of_identity_types = ProofOfIdentityTypeService.list(params)
end
def show; end
def create
authorize ProofOfIdentityType
@proof_of_identity_type = ProofOfIdentityType.new(proof_of_identity_type_params)
if @proof_of_identity_type.save
render status: :created
else
render json: @proof_of_identity_type.errors.full_messages, status: :unprocessable_entity
end
end
def update
authorize @proof_of_identity_type
if @proof_of_identity_type.update(proof_of_identity_type_params)
render status: :ok
else
render json: @proof_of_identity_type.errors.full_messages, status: :unprocessable_entity
end
end
def destroy
authorize @proof_of_identity_type
@proof_of_identity_type.destroy
head :no_content
end
private
def set_proof_of_identity_type
@proof_of_identity_type = ProofOfIdentityType.find(params[:id])
end
def proof_of_identity_type_params
params.require(:proof_of_identity_type).permit(:name, group_ids: [])
end
end

View File

@ -0,0 +1,53 @@
# frozen_string_literal: true
# API Controller for resources of type SupportingDocumentFile
# SupportingDocumentFiles are used in settings
class API::SupportingDocumentFilesController < API::ApiController
before_action :authenticate_user!
before_action :set_supporting_document_file, only: %i[show update download]
def index
@supporting_document_files = SupportingDocumentFileService.list(current_user, params)
end
# PUT /api/supporting_document_files/1/
def update
authorize @supporting_document_file
if SupportingDocumentFileService.update(@supporting_document_file, supporting_document_file_params)
render :show, status: :ok, location: @supporting_document_file
else
render json: @supporting_document_file.errors, status: :unprocessable_entity
end
end
# POST /api/supporting_document_files/
def create
@supporting_document_file = SupportingDocumentFile.new(supporting_document_file_params)
authorize @supporting_document_file
if SupportingDocumentFileService.create(@supporting_document_file)
render :show, status: :created, location: @supporting_document_file
else
render json: @supporting_document_file.errors, status: :unprocessable_entity
end
end
# GET /api/supporting_document_files/1/download
def download
authorize @supporting_document_file
send_file @supporting_document_file.attachment.url, type: @supporting_document_file.attachment.content_type, disposition: 'attachment'
end
# GET /api/supporting_document_files/1/
def show; end
private
def set_supporting_document_file
@supporting_document_file = SupportingDocumentFile.find(params[:id])
end
# Never trust parameters from the scary internet, only allow the white list through.
def supporting_document_file_params
params.required(:supporting_document_file).permit(:supporting_document_type_id, :attachment, :user_id)
end
end

View File

@ -0,0 +1,32 @@
# frozen_string_literal: true
# API Controller for resources of type SupportingDocumentRefusal
# SupportingDocumentRefusal are used by admin refuse user's proof of identity file
class API::SupportingDocumentRefusalsController < API::ApiController
before_action :authenticate_user!
def index
authorize SupportingDocumentRefusal
@supporting_document_refusals = SupportingDocumentRefusalService.list(params)
end
def show; end
# POST /api/supporting_document_refusals/
def create
authorize SupportingDocumentRefusal
@supporting_document_refusal = SupportingDocumentRefusal.new(supporting_document_refusal_params)
if SupportingDocumentRefusalService.create(@supporting_document_refusal)
render :show, status: :created, location: @supporting_document_refusal
else
render json: @supporting_document_refusal.errors, status: :unprocessable_entity
end
end
private
# Never trust parameters from the scary internet, only allow the white list through.
def supporting_document_refusal_params
params.required(:supporting_document_refusal).permit(:message, :operator_id, :user_id, supporting_document_type_ids: [])
end
end

View File

@ -0,0 +1,50 @@
# frozen_string_literal: true
# API Controller for resources of type SupportingDocumentType
# ProofOfIdentityTypes are used to provide admin config proof of identity type by group
class API::SupportingDocumentTypesController < API::ApiController
before_action :authenticate_user!, except: :index
before_action :set_supporting_document_type, only: %i[show update destroy]
def index
@supporting_document_types = SupportingDocumentTypeService.list(params)
end
def show; end
def create
authorize SupportingDocumentType
@supporting_document_type = SupportingDocumentType.new(supporting_document_type_params)
if @supporting_document_type.save
render status: :created
else
render json: @supporting_document_type.errors.full_messages, status: :unprocessable_entity
end
end
def update
authorize @supporting_document_type
if @supporting_document_type.update(supporting_document_type_params)
render status: :ok
else
render json: @supporting_document_type.errors.full_messages, status: :unprocessable_entity
end
end
def destroy
authorize @supporting_document_type
@supporting_document_type.destroy
head :no_content
end
private
def set_supporting_document_type
@supporting_document_type = SupportingDocumentType.find(params[:id])
end
def supporting_document_type_params
params.require(:supporting_document_type).permit(:name, group_ids: [])
end
end

View File

@ -1,31 +0,0 @@
import apiClient from './clients/api-client';
import { AxiosResponse } from 'axios';
import { ProofOfIdentityFile, ProofOfIdentityFileIndexFilter } from '../models/proof-of-identity-file';
import ApiLib from '../lib/api';
export default class ProofOfIdentityFileAPI {
static async index (filters?: ProofOfIdentityFileIndexFilter): Promise<Array<ProofOfIdentityFile>> {
const res: AxiosResponse<Array<ProofOfIdentityFile>> = await apiClient.get(`/api/proof_of_identity_files${ApiLib.filtersToQuery(filters)}`);
return res?.data;
}
static async get (id: number): Promise<ProofOfIdentityFile> {
const res: AxiosResponse<ProofOfIdentityFile> = await apiClient.get(`/api/proof_of_identity_files/${id}`);
return res?.data;
}
static async create (proofOfIdentityFile: FormData): Promise<ProofOfIdentityFile> {
const res: AxiosResponse<ProofOfIdentityFile> = await apiClient.post('/api/proof_of_identity_files', proofOfIdentityFile);
return res?.data;
}
static async update (id: number, proofOfIdentityFile: FormData): Promise<ProofOfIdentityFile> {
const res: AxiosResponse<ProofOfIdentityFile> = await apiClient.patch(`/api/proof_of_identity_files/${id}`, proofOfIdentityFile);
return res?.data;
}
static async destroy (proofOfIdentityFileId: number): Promise<void> {
const res: AxiosResponse<void> = await apiClient.delete(`/api/proof_of_identity_files/${proofOfIdentityFileId}`);
return res?.data;
}
}

View File

@ -1,16 +0,0 @@
import apiClient from './clients/api-client';
import { AxiosResponse } from 'axios';
import { ProofOfIdentityRefusal, ProofOfIdentityRefusalIndexFilter } from '../models/proof-of-identity-refusal';
import ApiLib from '../lib/api';
export default class ProofOfIdentityRefusalAPI {
static async index (filters?: ProofOfIdentityRefusalIndexFilter): Promise<Array<ProofOfIdentityRefusal>> {
const res: AxiosResponse<Array<ProofOfIdentityRefusal>> = await apiClient.get(`/api/proof_of_identity_refusals${ApiLib.filtersToQuery(filters)}`);
return res?.data;
}
static async create (proofOfIdentityRefusal: ProofOfIdentityRefusal): Promise<ProofOfIdentityRefusal> {
const res: AxiosResponse<ProofOfIdentityRefusal> = await apiClient.post('/api/proof_of_identity_refusals', { proof_of_identity_refusal: proofOfIdentityRefusal });
return res?.data;
}
}

View File

@ -1,31 +0,0 @@
import apiClient from './clients/api-client';
import { AxiosResponse } from 'axios';
import { ProofOfIdentityType, ProofOfIdentityTypeIndexfilter } from '../models/proof-of-identity-type';
import ApiLib from '../lib/api';
export default class ProofOfIdentityTypeAPI {
static async index (filters?: ProofOfIdentityTypeIndexfilter): Promise<Array<ProofOfIdentityType>> {
const res: AxiosResponse<Array<ProofOfIdentityType>> = await apiClient.get(`/api/proof_of_identity_types${ApiLib.filtersToQuery(filters)}`);
return res?.data;
}
static async get (id: number): Promise<ProofOfIdentityType> {
const res: AxiosResponse<ProofOfIdentityType> = await apiClient.get(`/api/proof_of_identity_types/${id}`);
return res?.data;
}
static async create (proofOfIdentityType: ProofOfIdentityType): Promise<ProofOfIdentityType> {
const res: AxiosResponse<ProofOfIdentityType> = await apiClient.post('/api/proof_of_identity_types', { proof_of_identity_type: proofOfIdentityType });
return res?.data;
}
static async update (proofOfIdentityType: ProofOfIdentityType): Promise<ProofOfIdentityType> {
const res: AxiosResponse<ProofOfIdentityType> = await apiClient.patch(`/api/proof_of_identity_types/${proofOfIdentityType.id}`, { proof_of_identity_type: proofOfIdentityType });
return res?.data;
}
static async destroy (proofOfIdentityTypeId: number): Promise<void> {
const res: AxiosResponse<void> = await apiClient.delete(`/api/proof_of_identity_types/${proofOfIdentityTypeId}`);
return res?.data;
}
}

View File

@ -0,0 +1,31 @@
import apiClient from './clients/api-client';
import { AxiosResponse } from 'axios';
import { SupportingDocumentFile, SupportingDocumentFileIndexFilter } from '../models/supporting-document-file';
import ApiLib from '../lib/api';
export default class SupportingDocumentFileAPI {
static async index (filters?: SupportingDocumentFileIndexFilter): Promise<Array<SupportingDocumentFile>> {
const res: AxiosResponse<Array<SupportingDocumentFile>> = await apiClient.get(`/api/supporting_document_files${ApiLib.filtersToQuery(filters)}`);
return res?.data;
}
static async get (id: number): Promise<SupportingDocumentFile> {
const res: AxiosResponse<SupportingDocumentFile> = await apiClient.get(`/api/supporting_document_files/${id}`);
return res?.data;
}
static async create (proofOfIdentityFile: FormData): Promise<SupportingDocumentFile> {
const res: AxiosResponse<SupportingDocumentFile> = await apiClient.post('/api/supporting_document_files', proofOfIdentityFile);
return res?.data;
}
static async update (id: number, proofOfIdentityFile: FormData): Promise<SupportingDocumentFile> {
const res: AxiosResponse<SupportingDocumentFile> = await apiClient.patch(`/api/supporting_document_files/${id}`, proofOfIdentityFile);
return res?.data;
}
static async destroy (proofOfIdentityFileId: number): Promise<void> {
const res: AxiosResponse<void> = await apiClient.delete(`/api/supporting_document_files/${proofOfIdentityFileId}`);
return res?.data;
}
}

View File

@ -0,0 +1,16 @@
import apiClient from './clients/api-client';
import { AxiosResponse } from 'axios';
import { SupportingDocumentRefusal, SupportingDocumentRefusalIndexFilter } from '../models/supporting-document-refusal';
import ApiLib from '../lib/api';
export default class SupportingDocumentRefusalAPI {
static async index (filters?: SupportingDocumentRefusalIndexFilter): Promise<Array<SupportingDocumentRefusal>> {
const res: AxiosResponse<Array<SupportingDocumentRefusal>> = await apiClient.get(`/api/supporting_document_refusals${ApiLib.filtersToQuery(filters)}`);
return res?.data;
}
static async create (supportingDocumentRefusal: SupportingDocumentRefusal): Promise<SupportingDocumentRefusal> {
const res: AxiosResponse<SupportingDocumentRefusal> = await apiClient.post('/api/supporting_document_refusals', { supporting_document_refusal: supportingDocumentRefusal });
return res?.data;
}
}

View File

@ -0,0 +1,31 @@
import apiClient from './clients/api-client';
import { AxiosResponse } from 'axios';
import { SupportingDocumentType, SupportingDocumentTypeIndexfilter } from '../models/supporting-document-type';
import ApiLib from '../lib/api';
export default class SupportingDocumentTypeAPI {
static async index (filters?: SupportingDocumentTypeIndexfilter): Promise<Array<SupportingDocumentType>> {
const res: AxiosResponse<Array<SupportingDocumentType>> = await apiClient.get(`/api/supporting_document_types${ApiLib.filtersToQuery(filters)}`);
return res?.data;
}
static async get (id: number): Promise<SupportingDocumentType> {
const res: AxiosResponse<SupportingDocumentType> = await apiClient.get(`/api/supporting_document_types/${id}`);
return res?.data;
}
static async create (proofOfIdentityType: SupportingDocumentType): Promise<SupportingDocumentType> {
const res: AxiosResponse<SupportingDocumentType> = await apiClient.post('/api/supporting_document_types', { supporting_document_type: proofOfIdentityType });
return res?.data;
}
static async update (proofOfIdentityType: SupportingDocumentType): Promise<SupportingDocumentType> {
const res: AxiosResponse<SupportingDocumentType> = await apiClient.patch(`/api/supporting_document_types/${proofOfIdentityType.id}`, { supporting_document_type: proofOfIdentityType });
return res?.data;
}
static async destroy (proofOfIdentityTypeId: number): Promise<void> {
const res: AxiosResponse<void> = await apiClient.delete(`/api/supporting_document_types/${proofOfIdentityTypeId}`);
return res?.data;
}
}

View File

@ -1,7 +1,7 @@
import * as React from 'react';
import { useTranslation } from 'react-i18next';
import { FabModal } from '../base/fab-modal';
import ProofOfIdentityTypeAPI from '../../api/proof-of-identity-type';
import SupportingDocumentTypeAPI from '../../api/supporting-document-type';
interface DeleteSupportingDocumentsTypeModalProps {
isOpen: boolean,
@ -22,7 +22,7 @@ export const DeleteSupportingDocumentsTypeModal: React.FC<DeleteSupportingDocume
*/
const handleDeleteProofOfIdentityType = async (): Promise<void> => {
try {
await ProofOfIdentityTypeAPI.destroy(proofOfIdentityTypeId);
await SupportingDocumentTypeAPI.destroy(proofOfIdentityTypeId);
onSuccess(t('app.admin.settings.account.delete_supporting_documents_type_modal.deleted'));
} catch (e) {
onError(t('app.admin.settings.account.delete_supporting_documents_type_modal.unable_to_delete') + e);

View File

@ -7,10 +7,10 @@ import { HtmlTranslate } from '../base/html-translate';
import { Loader } from '../base/loader';
import { User } from '../../models/user';
import { IApplication } from '../../models/application';
import { ProofOfIdentityType } from '../../models/proof-of-identity-type';
import { ProofOfIdentityFile } from '../../models/proof-of-identity-file';
import ProofOfIdentityTypeAPI from '../../api/proof-of-identity-type';
import ProofOfIdentityFileAPI from '../../api/proof-of-identity-file';
import { SupportingDocumentType } from '../../models/supporting-document-type';
import { SupportingDocumentFile } from '../../models/supporting-document-file';
import SupportingDocumentTypeAPI from '../../api/supporting-document-type';
import SupportingDocumentFileAPI from '../../api/supporting-document-file';
import { IFablab } from '../../models/fablab';
import { FabAlert } from '../base/fab-alert';
import { FabPanel } from '../base/fab-panel';
@ -36,20 +36,20 @@ interface FilesType {
export const SupportingDocumentsFiles: React.FC<SupportingDocumentsFilesProps> = ({ currentUser, onSuccess, onError }) => {
const { t } = useTranslation('logged');
const maxProofOfIdentityFileSizeMb = (Fablab.maxProofOfIdentityFileSize / 1024 / 1024).toFixed();
const maxProofOfIdentityFileSizeMb = (Fablab.maxSupportingDocumentFileSize / 1024 / 1024).toFixed();
// list of supporting documents type
const [supportingDocumentsTypes, setSupportingDocumentsTypes] = useState<Array<ProofOfIdentityType>>([]);
const [supportingDocumentsFiles, setSupportingDocumentsFiles] = useState<Array<ProofOfIdentityFile>>([]);
const [supportingDocumentsTypes, setSupportingDocumentsTypes] = useState<Array<SupportingDocumentType>>([]);
const [supportingDocumentsFiles, setSupportingDocumentsFiles] = useState<Array<SupportingDocumentFile>>([]);
const [files, setFiles] = useState<FilesType>({});
const [errors, setErrors] = useState<Array<number>>([]);
// get supporting documents type and files
useEffect(() => {
ProofOfIdentityTypeAPI.index({ group_id: currentUser.group_id }).then(tData => {
SupportingDocumentTypeAPI.index({ group_id: currentUser.group_id }).then(tData => {
setSupportingDocumentsTypes(tData);
});
ProofOfIdentityFileAPI.index({ user_id: currentUser.id }).then(fData => {
SupportingDocumentFileAPI.index({ user_id: currentUser.id }).then(fData => {
setSupportingDocumentsFiles(fData);
});
}, []);
@ -57,9 +57,9 @@ export const SupportingDocumentsFiles: React.FC<SupportingDocumentsFilesProps> =
/**
* Return the files matching the given type id
*/
const getSupportingDocumentsFileByType = (supportingDocumentsTypeId: number): ProofOfIdentityFile => {
return _.find<ProofOfIdentityFile>(supportingDocumentsFiles, {
proof_of_identity_type_id: supportingDocumentsTypeId
const getSupportingDocumentsFileByType = (supportingDocumentsTypeId: number): SupportingDocumentFile => {
return _.find<SupportingDocumentFile>(supportingDocumentsFiles, {
supporting_document_type_id: supportingDocumentsTypeId
});
};
@ -84,7 +84,7 @@ export const SupportingDocumentsFiles: React.FC<SupportingDocumentsFilesProps> =
return (event) => {
const fileSize = event.target.files[0].size;
let _errors: Array<number>;
if (fileSize > Fablab.maxProofOfIdentityFileSize) {
if (fileSize > Fablab.maxSupportingDocumentFileSize) {
_errors = errors.concat(documentId);
setErrors(_errors);
} else {
@ -106,18 +106,18 @@ export const SupportingDocumentsFiles: React.FC<SupportingDocumentsFilesProps> =
for (const proofOfIdentityTypeId of Object.keys(files)) {
const formData = new FormData();
formData.append('proof_of_identity_file[user_id]', currentUser.id.toString());
formData.append('proof_of_identity_file[proof_of_identity_type_id]', proofOfIdentityTypeId);
formData.append('proof_of_identity_file[attachment]', files[proofOfIdentityTypeId]);
formData.append('supporting_document_file[user_id]', currentUser.id.toString());
formData.append('supporting_document_file[supporting_document_type_id]', proofOfIdentityTypeId);
formData.append('supporting_document_file[attachment]', files[proofOfIdentityTypeId]);
const proofOfIdentityFile = getSupportingDocumentsFileByType(parseInt(proofOfIdentityTypeId, 10));
if (proofOfIdentityFile) {
await ProofOfIdentityFileAPI.update(proofOfIdentityFile.id, formData);
await SupportingDocumentFileAPI.update(proofOfIdentityFile.id, formData);
} else {
await ProofOfIdentityFileAPI.create(formData);
await SupportingDocumentFileAPI.create(formData);
}
}
if (Object.keys(files).length > 0) {
ProofOfIdentityFileAPI.index({ user_id: currentUser.id }).then(fData => {
SupportingDocumentFileAPI.index({ user_id: currentUser.id }).then(fData => {
setSupportingDocumentsFiles(fData);
setFiles({});
onSuccess(t('app.logged.dashboard.supporting_documents_files.file_successfully_uploaded'));
@ -132,7 +132,7 @@ export const SupportingDocumentsFiles: React.FC<SupportingDocumentsFilesProps> =
* Return the download URL of the given file
*/
const getSupportingDocumentsFileUrl = (documentId: number) => {
return `/api/proof_of_identity_files/${documentId}/download`;
return `/api/supporting_document_files/${documentId}/download`;
};
return (
@ -144,7 +144,7 @@ export const SupportingDocumentsFiles: React.FC<SupportingDocumentsFilesProps> =
options={{ SIZE: maxProofOfIdentityFileSizeMb }}/>
</FabAlert>
<div className="files-list">
{supportingDocumentsTypes.map((documentType: ProofOfIdentityType) => {
{supportingDocumentsTypes.map((documentType: SupportingDocumentType) => {
return (
<div className={`file-item ${errors.includes(documentType.id) ? 'has-error' : ''}`} key={documentType.id}>
<label>{documentType.name}</label>

View File

@ -1,10 +1,10 @@
import { BaseSyntheticEvent, useState } from 'react';
import * as React from 'react';
import { useTranslation } from 'react-i18next';
import { ProofOfIdentityType } from '../../models/proof-of-identity-type';
import { SupportingDocumentType } from '../../models/supporting-document-type';
interface SupportingDocumentsRefusalFormProps {
proofOfIdentityTypes: Array<ProofOfIdentityType>,
proofOfIdentityTypes: Array<SupportingDocumentType>,
onChange: (field: string, value: string | Array<number>) => void,
}
@ -38,7 +38,7 @@ export const SupportingDocumentsRefusalForm: React.FC<SupportingDocumentsRefusal
newValues = values.filter(x => x !== value);
}
setValues(newValues);
onChange('proof_of_identity_type_ids', newValues);
onChange('supporting_document_type_ids', newValues);
};
};

View File

@ -2,10 +2,10 @@ import { useState } from 'react';
import * as React from 'react';
import { useTranslation } from 'react-i18next';
import { FabModal } from '../base/fab-modal';
import { ProofOfIdentityType } from '../../models/proof-of-identity-type';
import { ProofOfIdentityRefusal } from '../../models/proof-of-identity-refusal';
import { SupportingDocumentType } from '../../models/supporting-document-type';
import { SupportingDocumentRefusal } from '../../models/supporting-document-refusal';
import { User } from '../../models/user';
import ProofOfIdentityRefusalAPI from '../../api/proof-of-identity-refusal';
import SupportingDocumentRefusalAPI from '../../api/supporting-document-refusal';
import { SupportingDocumentsRefusalForm } from './supporting-documents-refusal-form';
interface SupportingDocumentsRefusalModalProps {
@ -13,7 +13,7 @@ interface SupportingDocumentsRefusalModalProps {
toggleModal: () => void,
onSuccess: (message: string) => void,
onError: (message: string) => void,
proofOfIdentityTypes: Array<ProofOfIdentityType>,
proofOfIdentityTypes: Array<SupportingDocumentType>,
operator: User,
member: User
}
@ -24,11 +24,11 @@ interface SupportingDocumentsRefusalModalProps {
export const SupportingDocumentsRefusalModal: React.FC<SupportingDocumentsRefusalModalProps> = ({ isOpen, toggleModal, onSuccess, proofOfIdentityTypes, operator, member, onError }) => {
const { t } = useTranslation('admin');
const [data, setData] = useState<ProofOfIdentityRefusal>({
const [data, setData] = useState<SupportingDocumentRefusal>({
id: null,
operator_id: operator.id,
user_id: member.id,
proof_of_identity_type_ids: [],
supporting_document_type_ids: [],
message: ''
});
@ -47,7 +47,7 @@ export const SupportingDocumentsRefusalModal: React.FC<SupportingDocumentsRefusa
*/
const handleSaveRefusal = async (): Promise<void> => {
try {
await ProofOfIdentityRefusalAPI.create(data);
await SupportingDocumentRefusalAPI.create(data);
onSuccess(t('app.admin.supporting_documents_refusal_modal.refusal_successfully_sent'));
} catch (e) {
onError(t('app.admin.supporting_documents_refusal_modal.unable_to_send') + e);
@ -58,7 +58,7 @@ export const SupportingDocumentsRefusalModal: React.FC<SupportingDocumentsRefusa
* Check if the refusal can be saved (i.e. is not empty)
*/
const isPreventedSaveRefusal = (): boolean => {
return !data.message || data.proof_of_identity_type_ids.length === 0;
return !data.message || data.supporting_document_type_ids.length === 0;
};
return (

View File

@ -2,20 +2,20 @@ import * as React from 'react';
import { useTranslation } from 'react-i18next';
import Select from 'react-select';
import { FabInput } from '../base/fab-input';
import { ProofOfIdentityType } from '../../models/proof-of-identity-type';
import { SupportingDocumentType } from '../../models/supporting-document-type';
import { Group } from '../../models/group';
import { SelectOption } from '../../models/select';
interface SupportingDocumentsTypeFormProps {
groups: Array<Group>,
proofOfIdentityType?: ProofOfIdentityType,
supportingDocumentType?: SupportingDocumentType,
onChange: (field: string, value: string | Array<number>) => void,
}
/**
* Form to set create/edit supporting documents type
*/
export const SupportingDocumentsTypeForm: React.FC<SupportingDocumentsTypeFormProps> = ({ groups, proofOfIdentityType, onChange }) => {
export const SupportingDocumentsTypeForm: React.FC<SupportingDocumentsTypeFormProps> = ({ groups, supportingDocumentType, onChange }) => {
const { t } = useTranslation('admin');
/**
@ -32,7 +32,7 @@ export const SupportingDocumentsTypeForm: React.FC<SupportingDocumentsTypeFormPr
*/
const groupsValues = (): Array<SelectOption<number>> => {
const res = [];
const groupIds = proofOfIdentityType?.group_ids || [];
const groupIds = supportingDocumentType?.group_ids || [];
if (groupIds.length > 0) {
groups.forEach(t => {
if (groupIds.indexOf(t.id) > -1) {
@ -62,7 +62,7 @@ export const SupportingDocumentsTypeForm: React.FC<SupportingDocumentsTypeFormPr
<div className="info-area">
{t('app.admin.settings.account.supporting_documents_type_form.type_form_info')}
</div>
<form name="proofOfIdentityTypeForm">
<form name="supportingDocumentTypeForm">
<div className="field">
<Select defaultValue={groupsValues()}
placeholder={t('app.admin.settings.account.supporting_documents_type_form.select_group')}
@ -71,9 +71,9 @@ export const SupportingDocumentsTypeForm: React.FC<SupportingDocumentsTypeFormPr
isMulti />
</div>
<div className="field">
<FabInput id="proof_of_identity_type_name"
<FabInput id="supporting_document_type_name"
icon={<i className="fa fa-edit" />}
defaultValue={proofOfIdentityType?.name || ''}
defaultValue={supportingDocumentType?.name || ''}
placeholder={t('app.admin.settings.account.supporting_documents_type_form.name')}
onChange={handleNameChange}
debounce={200}

View File

@ -2,9 +2,9 @@ import { useState, useEffect } from 'react';
import * as React from 'react';
import { useTranslation } from 'react-i18next';
import { FabModal } from '../base/fab-modal';
import { ProofOfIdentityType } from '../../models/proof-of-identity-type';
import { SupportingDocumentType } from '../../models/supporting-document-type';
import { Group } from '../../models/group';
import ProofOfIdentityTypeAPI from '../../api/proof-of-identity-type';
import SupportingDocumentTypeAPI from '../../api/supporting-document-type';
import { SupportingDocumentsTypeForm } from './supporting-documents-type-form';
interface SupportingDocumentsTypeModalProps {
@ -13,7 +13,7 @@ interface SupportingDocumentsTypeModalProps {
onSuccess: (message: string) => void,
onError: (message: string) => void,
groups: Array<Group>,
proofOfIdentityType?: ProofOfIdentityType,
proofOfIdentityType?: SupportingDocumentType,
}
/**
@ -22,7 +22,7 @@ interface SupportingDocumentsTypeModalProps {
export const SupportingDocumentsTypeModal: React.FC<SupportingDocumentsTypeModalProps> = ({ isOpen, toggleModal, onSuccess, onError, proofOfIdentityType, groups }) => {
const { t } = useTranslation('admin');
const [data, setData] = useState<ProofOfIdentityType>({ id: proofOfIdentityType?.id, group_ids: proofOfIdentityType?.group_ids || [], name: proofOfIdentityType?.name || '' });
const [data, setData] = useState<SupportingDocumentType>({ id: proofOfIdentityType?.id, group_ids: proofOfIdentityType?.group_ids || [], name: proofOfIdentityType?.name || '' });
useEffect(() => {
setData({ id: proofOfIdentityType?.id, group_ids: proofOfIdentityType?.group_ids || [], name: proofOfIdentityType?.name || '' });
@ -44,10 +44,10 @@ export const SupportingDocumentsTypeModal: React.FC<SupportingDocumentsTypeModal
const handleSaveType = async (): Promise<void> => {
try {
if (proofOfIdentityType?.id) {
await ProofOfIdentityTypeAPI.update(data);
await SupportingDocumentTypeAPI.update(data);
onSuccess(t('app.admin.settings.account.supporting_documents_type_modal.successfully_updated'));
} else {
await ProofOfIdentityTypeAPI.create(data);
await SupportingDocumentTypeAPI.create(data);
onSuccess(t('app.admin.settings.account.supporting_documents_type_modal.successfully_created'));
}
} catch (e) {
@ -74,7 +74,7 @@ export const SupportingDocumentsTypeModal: React.FC<SupportingDocumentsTypeModal
confirmButton={t(`app.admin.settings.account.supporting_documents_type_modal.${proofOfIdentityType ? 'edit' : 'create'}`)}
onConfirm={handleSaveType}
preventConfirm={isPreventedSaveType()}>
<SupportingDocumentsTypeForm proofOfIdentityType={proofOfIdentityType} groups={groups} onChange={handleTypeChanged}/>
<SupportingDocumentsTypeForm supportingDocumentType={proofOfIdentityType} groups={groups} onChange={handleTypeChanged}/>
</FabModal>
);
};

View File

@ -6,12 +6,12 @@ import _ from 'lodash';
import { HtmlTranslate } from '../base/html-translate';
import { Loader } from '../base/loader';
import { IApplication } from '../../models/application';
import { ProofOfIdentityType } from '../../models/proof-of-identity-type';
import { SupportingDocumentType } from '../../models/supporting-document-type';
import { Group } from '../../models/group';
import { SupportingDocumentsTypeModal } from './supporting-documents-type-modal';
import { DeleteSupportingDocumentsTypeModal } from './delete-supporting-documents-type-modal';
import GroupAPI from '../../api/group';
import ProofOfIdentityTypeAPI from '../../api/proof-of-identity-type';
import SupportingDocumentTypeAPI from '../../api/supporting-document-type';
import { FabPanel } from '../base/fab-panel';
import { FabAlert } from '../base/fab-alert';
import { FabButton } from '../base/fab-button';
@ -30,9 +30,9 @@ const SupportingDocumentsTypesList: React.FC<SupportingDocumentsTypesListProps>
const { t } = useTranslation('admin');
// list of displayed supporting documents type
const [supportingDocumentsTypes, setSupportingDocumentsTypes] = useState<Array<ProofOfIdentityType>>([]);
const [supportingDocumentsTypes, setSupportingDocumentsTypes] = useState<Array<SupportingDocumentType>>([]);
// currently added/edited type
const [supportingDocumentsType, setSupportingDocumentsType] = useState<ProofOfIdentityType>(null);
const [supportingDocumentsType, setSupportingDocumentsType] = useState<SupportingDocumentType>(null);
// list ordering
const [supportingDocumentsTypeOrder, setSupportingDocumentsTypeOrder] = useState<string>(null);
// creation/edition modal
@ -48,7 +48,7 @@ const SupportingDocumentsTypesList: React.FC<SupportingDocumentsTypesListProps>
useEffect(() => {
GroupAPI.index({ disabled: false }).then(data => {
setGroups(data);
ProofOfIdentityTypeAPI.index().then(pData => {
SupportingDocumentTypeAPI.index().then(pData => {
setSupportingDocumentsTypes(pData);
});
});
@ -72,7 +72,7 @@ const SupportingDocumentsTypesList: React.FC<SupportingDocumentsTypesListProps>
/**
* Init the process of editing the given type
*/
const editType = (type: ProofOfIdentityType): () => void => {
const editType = (type: SupportingDocumentType): () => void => {
return (): void => {
setSupportingDocumentsType(type);
setModalIsOpen(true);
@ -91,7 +91,7 @@ const SupportingDocumentsTypesList: React.FC<SupportingDocumentsTypesListProps>
*/
const onSaveTypeSuccess = (message: string): void => {
setModalIsOpen(false);
ProofOfIdentityTypeAPI.index().then(pData => {
SupportingDocumentTypeAPI.index().then(pData => {
setSupportingDocumentsTypes(orderTypes(pData, supportingDocumentsTypeOrder));
onSuccess(message);
}).catch((error) => {
@ -121,7 +121,7 @@ const SupportingDocumentsTypesList: React.FC<SupportingDocumentsTypesListProps>
*/
const onDestroySuccess = (message: string): void => {
setDestroyModalIsOpen(false);
ProofOfIdentityTypeAPI.index().then(pData => {
SupportingDocumentTypeAPI.index().then(pData => {
setSupportingDocumentsTypes(pData);
setSupportingDocumentsTypes(orderTypes(pData, supportingDocumentsTypeOrder));
onSuccess(message);
@ -147,13 +147,13 @@ const SupportingDocumentsTypesList: React.FC<SupportingDocumentsTypesListProps>
/**
* Sort the provided types according to the provided ordering key and return the resulting list
*/
const orderTypes = (types: Array<ProofOfIdentityType>, orderBy?: string): Array<ProofOfIdentityType> => {
const orderTypes = (types: Array<SupportingDocumentType>, orderBy?: string): Array<SupportingDocumentType> => {
if (!orderBy) {
return types;
}
const order = orderBy[0] === '-' ? 'desc' : 'asc';
if (orderBy.search('group_name') !== -1) {
return _.orderBy(types, (type: ProofOfIdentityType) => getGroupsNames(type.group_ids), order);
return _.orderBy(types, (type: SupportingDocumentType) => getGroupsNames(type.group_ids), order);
} else {
return _.orderBy(types, 'name', order);
}

View File

@ -6,10 +6,10 @@ import _ from 'lodash';
import { Loader } from '../base/loader';
import { User } from '../../models/user';
import { IApplication } from '../../models/application';
import { ProofOfIdentityType } from '../../models/proof-of-identity-type';
import { ProofOfIdentityFile } from '../../models/proof-of-identity-file';
import ProofOfIdentityTypeAPI from '../../api/proof-of-identity-type';
import ProofOfIdentityFileAPI from '../../api/proof-of-identity-file';
import { SupportingDocumentType } from '../../models/supporting-document-type';
import { SupportingDocumentFile } from '../../models/supporting-document-file';
import SupportingDocumentTypeAPI from '../../api/supporting-document-type';
import SupportingDocumentFileAPI from '../../api/supporting-document-file';
import { SupportingDocumentsRefusalModal } from './supporting-documents-refusal-modal';
import { FabButton } from '../base/fab-button';
import { FabPanel } from '../base/fab-panel';
@ -30,16 +30,16 @@ const SupportingDocumentsValidation: React.FC<SupportingDocumentsValidationProps
const { t } = useTranslation('admin');
// list of supporting documents type
const [documentsTypes, setDocumentsTypes] = useState<Array<ProofOfIdentityType>>([]);
const [documentsFiles, setDocumentsFiles] = useState<Array<ProofOfIdentityFile>>([]);
const [documentsTypes, setDocumentsTypes] = useState<Array<SupportingDocumentType>>([]);
const [documentsFiles, setDocumentsFiles] = useState<Array<SupportingDocumentFile>>([]);
const [modalIsOpen, setModalIsOpen] = useState<boolean>(false);
// get groups
useEffect(() => {
ProofOfIdentityTypeAPI.index({ group_id: member.group_id }).then(tData => {
SupportingDocumentTypeAPI.index({ group_id: member.group_id }).then(tData => {
setDocumentsTypes(tData);
});
ProofOfIdentityFileAPI.index({ user_id: member.id }).then(fData => {
SupportingDocumentFileAPI.index({ user_id: member.id }).then(fData => {
setDocumentsFiles(fData);
});
}, []);
@ -47,8 +47,8 @@ const SupportingDocumentsValidation: React.FC<SupportingDocumentsValidationProps
/**
* Return the file associated with the provided type
*/
const getFileByType = (typeId: number): ProofOfIdentityFile => {
return _.find<ProofOfIdentityFile>(documentsFiles, { proof_of_identity_type_id: typeId });
const getFileByType = (typeId: number): SupportingDocumentFile => {
return _.find<SupportingDocumentFile>(documentsFiles, { supporting_document_type_id: typeId });
};
/**
@ -62,7 +62,7 @@ const SupportingDocumentsValidation: React.FC<SupportingDocumentsValidationProps
* Return the download URL of the given file
*/
const getProofOfIdentityFileUrl = (documentId: number): string => {
return `/api/proof_of_identity_files/${documentId}/download`;
return `/api/supporting_document_files/${documentId}/download`;
};
/**
@ -85,7 +85,7 @@ const SupportingDocumentsValidation: React.FC<SupportingDocumentsValidationProps
<FabPanel>
<h3>{t('app.admin.supporting_documents_validation.title')}</h3>
<p className="info-area">{t('app.admin.supporting_documents_validation.find_below_documents_files')}</p>
{documentsTypes.map((documentType: ProofOfIdentityType) => {
{documentsTypes.map((documentType: SupportingDocumentType) => {
return (
<div key={documentType.id} className="document-type">
<div className="type-name">{documentType.name}</div>

View File

@ -657,8 +657,8 @@ Application.Controllers.controller('AdminMembersController', ['$scope', '$sce',
/**
* Controller used in the member edition page
*/
Application.Controllers.controller('EditMemberController', ['$scope', '$state', '$transition$', 'Member', 'Training', 'dialogs', 'growl', 'Group', 'Subscription', 'CSRF', 'memberPromise', 'tagsPromise', '$uibModal', 'Plan', '$filter', '_t', 'walletPromise', 'transactionsPromise', 'activeProviderPromise', 'Wallet', 'settingsPromise', 'ProofOfIdentityType',
function ($scope, $state, $transition$, Member, Training, dialogs, growl, Group, Subscription, CSRF, memberPromise, tagsPromise, $uibModal, Plan, $filter, _t, walletPromise, transactionsPromise, activeProviderPromise, Wallet, settingsPromise, ProofOfIdentityType) {
Application.Controllers.controller('EditMemberController', ['$scope', '$state', '$transition$', 'Member', 'Training', 'dialogs', 'growl', 'Group', 'Subscription', 'CSRF', 'memberPromise', 'tagsPromise', '$uibModal', 'Plan', '$filter', '_t', 'walletPromise', 'transactionsPromise', 'activeProviderPromise', 'Wallet', 'settingsPromise', 'SupportingDocumentType',
function ($scope, $state, $transition$, Member, Training, dialogs, growl, Group, Subscription, CSRF, memberPromise, tagsPromise, $uibModal, Plan, $filter, _t, walletPromise, transactionsPromise, activeProviderPromise, Wallet, settingsPromise, SupportingDocumentType) {
/* PUBLIC SCOPE */
// API URL where the form will be posted
@ -982,8 +982,8 @@ Application.Controllers.controller('EditMemberController', ['$scope', '$state',
});
}
ProofOfIdentityType.query({ group_id: $scope.user.group_id }, function (proofOfIdentityTypes) {
$scope.hasProofOfIdentityTypes = proofOfIdentityTypes.length > 0;
SupportingDocumentType.query({ group_id: $scope.user.group_id }, function (supportingDocumentTypes) {
$scope.hasProofOfIdentityTypes = supportingDocumentTypes.length > 0;
});
// Using the MembersController

View File

@ -84,7 +84,7 @@ Application.Controllers.controller('ApplicationController', ['$rootScope', '$sco
return Setting.query({ names: "['phone_required', 'recaptcha_site_key', 'confirmation_required', 'address_required']" }).$promise;
}],
profileCustomFieldsPromise: ['ProfileCustomField', function (ProfileCustomField) { return ProfileCustomField.query({}).$promise; }],
proofOfIdentityTypesPromise: ['ProofOfIdentityType', function (ProofOfIdentityType) { return ProofOfIdentityType.query({}).$promise; }]
proofOfIdentityTypesPromise: ['SupportingDocumentType', function (SupportingDocumentType) { return SupportingDocumentType.query({}).$promise; }]
},
controller: ['$scope', '$uibModalInstance', 'Group', 'CustomAsset', 'settingsPromise', 'growl', '_t', 'profileCustomFieldsPromise', 'proofOfIdentityTypesPromise', function ($scope, $uibModalInstance, Group, CustomAsset, settingsPromise, growl, _t, profileCustomFieldsPromise, proofOfIdentityTypesPromise) {
// default parameters for the date picker in the account creation modal

View File

@ -1,7 +1,7 @@
'use strict';
Application.Controllers.controller('HeaderController', ['$scope', '$transitions', '$state', 'settingsPromise', 'ProofOfIdentityType', 'AuthService',
function ($scope, $transitions, $state, settingsPromise, ProofOfIdentityType, AuthService) {
Application.Controllers.controller('HeaderController', ['$scope', '$transitions', '$state', 'settingsPromise', 'SupportingDocumentType', 'AuthService',
function ($scope, $transitions, $state, settingsPromise, SupportingDocumentType, AuthService) {
$scope.aboutPage = ($state.current.name === 'app.public.about');
$transitions.onStart({}, function (trans) {
@ -17,7 +17,7 @@ Application.Controllers.controller('HeaderController', ['$scope', '$transitions'
$scope.dropdownOnToggled = function (open) {
if (open) {
ProofOfIdentityType.query({ group_id: $scope.currentUser.group_id }, function (proofOfIdentityTypes) {
SupportingDocumentType.query({ group_id: $scope.currentUser.group_id }, function (proofOfIdentityTypes) {
$scope.hasProofOfIdentityTypes = proofOfIdentityTypes.length > 0;
});
}

View File

@ -72,8 +72,8 @@ Application.Controllers.controller('MembersController', ['$scope', 'Member', 'me
/**
* Controller used when editing the current user's profile (in dashboard)
*/
Application.Controllers.controller('EditProfileController', ['$scope', '$rootScope', '$state', '$window', '$sce', '$cookies', '$injector', 'Member', 'Auth', 'Session', 'activeProviderPromise', 'settingsPromise', 'growl', 'dialogs', 'CSRF', 'memberPromise', 'groups', '_t', 'proofOfIdentityTypesPromise', 'ProofOfIdentityType',
function ($scope, $rootScope, $state, $window, $sce, $cookies, $injector, Member, Auth, Session, activeProviderPromise, settingsPromise, growl, dialogs, CSRF, memberPromise, groups, _t, proofOfIdentityTypesPromise, ProofOfIdentityType) {
Application.Controllers.controller('EditProfileController', ['$scope', '$rootScope', '$state', '$window', '$sce', '$cookies', '$injector', 'Member', 'Auth', 'Session', 'activeProviderPromise', 'settingsPromise', 'growl', 'dialogs', 'CSRF', 'memberPromise', 'groups', '_t', 'proofOfIdentityTypesPromise', 'SupportingDocumentType',
function ($scope, $rootScope, $state, $window, $sce, $cookies, $injector, Member, Auth, Session, activeProviderPromise, settingsPromise, growl, dialogs, CSRF, memberPromise, groups, _t, proofOfIdentityTypesPromise, SupportingDocumentType) {
/* PUBLIC SCOPE */
// API URL where the form will be posted
@ -98,7 +98,7 @@ Application.Controllers.controller('EditProfileController', ['$scope', '$rootSco
// active authentication provider parameters
$scope.activeProvider = activeProviderPromise;
// allow the user to change his password except if he connect from an SSO
// allow the user to change his password except if he connects from an SSO
$scope.preventPassword = false;
// get the status of cookies acceptance
@ -152,8 +152,8 @@ Application.Controllers.controller('EditProfileController', ['$scope', '$rootSco
}, 50);
$rootScope.currentUser.group_id = user.group_id;
Auth._currentUser.group_id = user.group_id;
ProofOfIdentityType.query({ group_id: user.group_id }, function (proofOfIdentityTypes) {
$scope.hasProofOfIdentityTypes = proofOfIdentityTypes.length > 0;
SupportingDocumentType.query({ group_id: user.group_id }, function (supportingDocumentTypes) {
$scope.hasProofOfIdentityTypes = supportingDocumentTypes.length > 0;
});
};

View File

@ -20,7 +20,7 @@ export interface IFablab {
weekStartingDay: string,
d3DateFormat: string,
uibDateFormat: string,
maxProofOfIdentityFileSize: number,
maxSupportingDocumentFileSize: number,
sessionTours: Array<string>,
translations: {
app: {

View File

@ -73,7 +73,7 @@ export const notificationTypeNames = [
'notify_admin_user_supporting_document_files_updated',
'notify_user_is_validated',
'notify_user_is_invalidated',
'notify_user_proof_of_identity_refusal',
'notify_user_supporting_document_refusal',
'notify_admin_user_supporting_document_refusal',
'notify_user_order_is_ready',
'notify_user_order_is_canceled',

View File

@ -1,12 +0,0 @@
import { ApiFilter } from './api';
export interface ProofOfIdentityFileIndexFilter extends ApiFilter {
user_id: number,
}
export interface ProofOfIdentityFile {
id?: number,
attachment?: string,
user_id?: number,
proof_of_identity_type_id: number,
}

View File

@ -1,13 +0,0 @@
import { ApiFilter } from './api';
export interface ProofOfIdentityRefusalIndexFilter extends ApiFilter {
user_id: number,
}
export interface ProofOfIdentityRefusal {
id: number,
message: string,
user_id: number,
operator_id: number,
proof_of_identity_type_ids: Array<number>,
}

View File

@ -0,0 +1,12 @@
import { ApiFilter } from './api';
export interface SupportingDocumentFileIndexFilter extends ApiFilter {
user_id: number,
}
export interface SupportingDocumentFile {
id?: number,
attachment?: string,
user_id?: number,
supporting_document_type_id: number,
}

View File

@ -0,0 +1,13 @@
import { ApiFilter } from './api';
export interface SupportingDocumentRefusalIndexFilter extends ApiFilter {
user_id: number,
}
export interface SupportingDocumentRefusal {
id: number,
message: string,
user_id: number,
operator_id: number,
supporting_document_type_ids: Array<number>,
}

View File

@ -1,10 +1,10 @@
import { ApiFilter } from './api';
export interface ProofOfIdentityTypeIndexfilter extends ApiFilter {
export interface SupportingDocumentTypeIndexfilter extends ApiFilter {
group_id?: number,
}
export interface ProofOfIdentityType {
export interface SupportingDocumentType {
id: number,
name: string,
group_ids: Array<number>

View File

@ -139,7 +139,7 @@ angular.module('application.router', ['ui.router'])
resolve: {
memberPromise: ['Member', 'currentUser', function (Member, currentUser) { return Member.get({ id: currentUser.id }).$promise; }],
trainingsPromise: ['Training', function (Training) { return Training.query().$promise; }],
proofOfIdentityTypesPromise: ['ProofOfIdentityType', 'currentUser', function (ProofOfIdentityType, currentUser) { return ProofOfIdentityType.query({ group_id: currentUser.group_id }).$promise; }]
proofOfIdentityTypesPromise: ['SupportingDocumentType', 'currentUser', function (SupportingDocumentType, currentUser) { return SupportingDocumentType.query({ group_id: currentUser.group_id }).$promise; }]
}
})
.state('app.logged.dashboard.profile', {
@ -165,11 +165,11 @@ angular.module('application.router', ['ui.router'])
settingsPromise: ['Setting', function (Setting) { return Setting.query({ names: "['phone_required', 'address_required']" }).$promise; }]
}
})
.state('app.logged.dashboard.proof_of_identity_files', {
url: '/proof_of_identity_files',
.state('app.logged.dashboard.supporting_document_files', {
url: '/supporting_document_files',
views: {
'main@': {
templateUrl: '/dashboard/proof_of_identity_files.html',
templateUrl: '/dashboard/supporting_document_files.html',
controller: 'DashboardController'
}
}

View File

@ -1,11 +0,0 @@
'use strict';
Application.Services.factory('ProofOfIdentityType', ['$resource', function ($resource) {
return $resource('/api/proof_of_identity_types/:id',
{ id: '@id' }, {
update: {
method: 'PUT'
}
}
);
}]);

View File

@ -0,0 +1,11 @@
'use strict';
Application.Services.factory('SupportingDocumentType', ['$resource', function ($resource) {
return $resource('/api/supporting_document_types/:id',
{ id: '@id' }, {
update: {
method: 'PUT'
}
}
);
}]);

View File

@ -12,7 +12,7 @@
<ul class="nav-page nav nav-pills text-u-c text-sm">
<li ui-sref-active="active"><a class="text-black" ui-sref="app.logged.dashboard.profile" translate>{{ 'app.public.common.my_profile' }}</a></li>
<li ui-sref-active="active"><a class="text-black" ui-sref="app.logged.dashboard.settings" translate>{{ 'app.public.common.my_settings' }}</a></li>
<li ng-if="!isAuthorized(['admin', 'manager']) && hasProofOfIdentityTypes" ui-sref-active="active"><a class="text-black" ui-sref="app.logged.dashboard.proof_of_identity_files" translate>{{ 'app.public.common.my_supporting_documents_files' }}</a></li>
<li ng-if="!isAuthorized(['admin', 'manager']) && hasProofOfIdentityTypes" ui-sref-active="active"><a class="text-black" ui-sref="app.logged.dashboard.supporting_document_files" translate>{{ 'app.public.common.my_supporting_documents_files' }}</a></li>
<li ui-sref-active="active"><a class="text-black" ui-sref="app.logged.dashboard.projects" translate>{{ 'app.public.common.my_projects' }}</a></li>
<li ui-sref-active="active"><a class="text-black" ui-sref="app.logged.dashboard.trainings" translate>{{ 'app.public.common.my_trainings' }}</a></li>
<li ui-sref-active="active"><a class="text-black" ui-sref="app.logged.dashboard.reservations_dashboard" translate>{{ 'app.public.common.my_reservations' }}</a></li>

View File

@ -41,7 +41,7 @@
<ul uib-dropdown-menu class="animated fadeInRight">
<li><a ui-sref="app.logged.dashboard.profile" translate>{{ 'app.public.common.my_profile' }}</a></li>
<li><a ui-sref="app.logged.dashboard.settings" translate>{{ 'app.public.common.my_settings' }}</a></li>
<li ng-if="!isAuthorized(['admin', 'manager']) && hasProofOfIdentityTypes"><a ui-sref="app.logged.dashboard.proof_of_identity_files" translate>{{ 'app.public.common.my_supporting_documents_files' }}</a></li>
<li ng-if="!isAuthorized(['admin', 'manager']) && hasProofOfIdentityTypes"><a ui-sref="app.logged.dashboard.supporting_document_files" translate>{{ 'app.public.common.my_supporting_documents_files' }}</a></li>
<li><a ui-sref="app.logged.dashboard.projects" translate>{{ 'app.public.common.my_projects' }}</a></li>
<li><a ui-sref="app.logged.dashboard.trainings" translate>{{ 'app.public.common.my_trainings' }}</a></li>
<li><a ui-sref="app.logged.dashboard.reservations_dashboard" translate>{{ 'app.public.common.my_reservations' }}</a></li>

View File

@ -8,8 +8,8 @@ class Group < ApplicationRecord
has_many :trainings_pricings, dependent: :destroy
has_many :machines_prices, -> { where(priceable_type: 'Machine') }, class_name: 'Price', dependent: :destroy, inverse_of: :group
has_many :spaces_prices, -> { where(priceable_type: 'Space') }, class_name: 'Price', dependent: :destroy, inverse_of: :group
has_many :proof_of_identity_types_groups, dependent: :destroy
has_many :proof_of_identity_types, through: :proof_of_identity_types_groups
has_many :supporting_document_types_groups, dependent: :destroy
has_many :supporting_document_types, through: :supporting_document_types_groups
extend FriendlyId
friendly_id :name, use: :slugged

View File

@ -1,12 +0,0 @@
# frozen_string_literal: true
require 'file_size_validator'
class ProofOfIdentityFile < ApplicationRecord
mount_uploader :attachment, ProofOfIdentityFileUploader
belongs_to :proof_of_identity_type
belongs_to :user
validates :attachment, file_size: { maximum: Rails.application.secrets.max_proof_of_identity_file_size&.to_i || 5.megabytes.to_i }
end

View File

@ -1,7 +0,0 @@
# frozen_string_literal: true
class ProofOfIdentityRefusal < ApplicationRecord
belongs_to :user
belongs_to :operator, class_name: 'User', foreign_key: :operator_id
has_and_belongs_to_many :proof_of_identity_types
end

View File

@ -1,8 +0,0 @@
# frozen_string_literal: true
class ProofOfIdentityType < ApplicationRecord
has_many :proof_of_identity_types_groups, dependent: :destroy
has_many :groups, through: :proof_of_identity_types_groups
has_many :proof_of_identity_files, dependent: :destroy
end

View File

@ -1,6 +0,0 @@
# frozen_string_literal: true
class ProofOfIdentityTypesGroup < ApplicationRecord
belongs_to :proof_of_identity_type
belongs_to :group
end

View File

@ -0,0 +1,12 @@
# frozen_string_literal: true
require 'file_size_validator'
class SupportingDocumentFile < ApplicationRecord
mount_uploader :attachment, SupportingDocumentFileUploader
belongs_to :supporting_document_type
belongs_to :user
validates :attachment, file_size: { maximum: ENV.fetch('MAX_SUPPORTING_DOCUMENT_FILE_SIZE', 5.megabytes.to_i) }
end

View File

@ -0,0 +1,9 @@
# frozen_string_literal: true
# An admin can mark an uploaded document as refused, this will notify the member
class SupportingDocumentRefusal < ApplicationRecord
belongs_to :user
belongs_to :operator, class_name: 'User', inverse_of: :supporting_document_refusals
has_many :supporting_document_refusals_types, dependent: :destroy
has_many :supporting_document_types, through: :supporting_document_refusals_types
end

View File

@ -0,0 +1,8 @@
# frozen_string_literal: true
# Associate SupportingDocumentRefusal with a SupportingDocumentType
# When an admin refuses an uploaded document, he can specify which type of document was refused using this association table
class SupportingDocumentRefusalsType < ApplicationRecord
belongs_to :supporting_document_refusal
belongs_to :supporting_document_type
end

View File

@ -0,0 +1,11 @@
# frozen_string_literal: true
class SupportingDocumentType < ApplicationRecord
has_many :supporting_document_types_groups, dependent: :destroy
has_many :groups, through: :supporting_document_types_groups
has_many :supporting_document_files, dependent: :destroy
has_many :supporting_document_refusals_types, dependent: :destroy
has_many :supporting_document_refusals, through: :supporting_document_refusals_types
end

View File

@ -0,0 +1,6 @@
# frozen_string_literal: true
class SupportingDocumentTypesGroup < ApplicationRecord
belongs_to :supporting_document_type
belongs_to :group
end

View File

@ -47,8 +47,8 @@ class User < ApplicationRecord
has_many :accounting_periods, foreign_key: 'closed_by', dependent: :nullify, inverse_of: :user
has_many :proof_of_identity_files, dependent: :destroy
has_many :proof_of_identity_refusals, dependent: :destroy
has_many :supporting_document_files, dependent: :destroy
has_many :supporting_document_refusals, dependent: :destroy
has_many :notifications, as: :receiver, dependent: :destroy
has_many :notification_preferences, dependent: :destroy

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
# Check the access policies for API::NotificationController
# Check the access policies for API::NotificationPreferencesController
class NotificationPreferencePolicy < ApplicationPolicy
def update?
user.admin?

View File

@ -1,5 +1,7 @@
class ProofOfIdentityFilePolicy < ApplicationPolicy
# frozen_string_literal: true
# Check the access policies for API::SupportingDocumentFilesController
class SupportingDocumentFilePolicy < ApplicationPolicy
def index?
user.privileged?
end

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
# Check the access policies for API::ProofOfIdentityRefusalsController
class ProofOfIdentityRefusalPolicy < ApplicationPolicy
# Check the access policies for API::SupportingDocumentRefusalsController
class SupportingDocumentRefusalPolicy < ApplicationPolicy
def index?
user.privileged?
end

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
# Check the access policies for API::ProofOfIdentityTypesController
class ProofOfIdentityTypePolicy < ApplicationPolicy
# Check the access policies for API::SupportingDocumentTypesController
class SupportingDocumentTypePolicy < ApplicationPolicy
def create?
user.admin?
end

View File

@ -22,9 +22,9 @@ class Members::MembersService
validated_at_changed = false
if group_changed && user_validation_required
# here a group change, user must re-validate by admin
current_proof_of_identity_types = @member.group.proof_of_identity_types
new_proof_of_identity_types = Group.find(params[:group_id].to_i).proof_of_identity_types
if @member.validated_at? && !(new_proof_of_identity_types - current_proof_of_identity_types).empty?
current_types = @member.group.supporting_document_types
new_types = Group.find(params[:group_id].to_i).supporting_document_types
if @member.validated_at? && !(new_types - current_types).empty?
validated_at_changed = true
@member.validated_at = nil
end

View File

@ -1,24 +0,0 @@
# frozen_string_literal: true
# Provides methods for ProofOfIdentityRefusal
class ProofOfIdentityRefusalService
def self.list(filters = {})
refusals = []
refusals = ProofOfIdentityRefusal.where(user_id: filters[:user_id]) if filters[:user_id].present?
refusals
end
def self.create(proof_of_identity_refusal)
saved = proof_of_identity_refusal.save
if saved
NotificationCenter.call type: 'notify_admin_user_supporting_document_refusal',
receiver: User.admins_and_managers,
attached_object: proof_of_identity_refusal
NotificationCenter.call type: 'notify_user_proof_of_identity_refusal',
receiver: proof_of_identity_refusal.user,
attached_object: proof_of_identity_refusal
end
saved
end
end

View File

@ -1,15 +0,0 @@
# frozen_string_literal: true
# Provides methods for ProofOfIdentityType
class ProofOfIdentityTypeService
def self.list(filters = {})
types = []
if filters[:group_id].present?
group = Group.find(filters[:group_id])
types = group.proof_of_identity_types.includes(:groups)
else
types = ProofOfIdentityType.all
end
types
end
end

View File

@ -1,23 +1,23 @@
# frozen_string_literal: true
# Provides methods for ProofOfIdentityFile
class ProofOfIdentityFileService
# Provides methods for SupportingDocumentFile
class SupportingDocumentFileService
def self.list(operator, filters = {})
files = []
if filters[:user_id].present? && (operator.privileged? || filters[:user_id].to_i == operator.id)
files = ProofOfIdentityFile.where(user_id: filters[:user_id])
files = SupportingDocumentFile.where(user_id: filters[:user_id])
end
files
end
def self.create(proof_of_identity_file)
saved = proof_of_identity_file.save
def self.create(supporting_document_file)
saved = supporting_document_file.save
if saved
user = User.find(proof_of_identity_file.user_id)
user = User.find(supporting_document_file.user_id)
all_files_are_upload = true
user.group.proof_of_identity_types.each do |type|
file = type.proof_of_identity_files.find_by(user_id: proof_of_identity_file.user_id)
user.group.supporting_document_types.each do |type|
file = type.supporting_document_files.find_by(user_id: supporting_document_file.user_id)
all_files_are_upload = false unless file
end
if all_files_are_upload
@ -29,19 +29,19 @@ class ProofOfIdentityFileService
saved
end
def self.update(proof_of_identity_file, params)
updated = proof_of_identity_file.update(params)
def self.update(supporting_document_file, params)
updated = supporting_document_file.update(params)
if updated
user = proof_of_identity_file.user
user = supporting_document_file.user
all_files_are_upload = true
user.group.proof_of_identity_types.each do |type|
file = type.proof_of_identity_files.find_by(user_id: proof_of_identity_file.user_id)
user.group.supporting_document_types.each do |type|
file = type.supporting_document_files.find_by(user_id: supporting_document_file.user_id)
all_files_are_upload = false unless file
end
if all_files_are_upload && !user.validated_at?
NotificationCenter.call type: 'notify_admin_user_supporting_document_files_updated',
receiver: User.admins_and_managers,
attached_object: proof_of_identity_file
attached_object: supporting_document_file
end
end
updated

View File

@ -0,0 +1,24 @@
# frozen_string_literal: true
# Provides methods for SupportingDocumentRefusal
class SupportingDocumentRefusalService
def self.list(filters = {})
refusals = []
refusals = SupportingDocumentRefusal.where(user_id: filters[:user_id]) if filters[:user_id].present?
refusals
end
def self.create(supporting_document_refusal)
saved = supporting_document_refusal.save
if saved
NotificationCenter.call type: 'notify_admin_user_supporting_document_refusal',
receiver: User.admins_and_managers,
attached_object: supporting_document_refusal
NotificationCenter.call type: 'notify_user_supporting_document_refusal',
receiver: supporting_document_refusal.user,
attached_object: supporting_document_refusal
end
saved
end
end

View File

@ -0,0 +1,13 @@
# frozen_string_literal: true
# Provides methods for SupportingDocumentType
class SupportingDocumentTypeService
def self.list(filters = {})
if filters[:group_id].present?
group = Group.find(filters[:group_id])
group.supporting_document_types.includes(:groups)
else
SupportingDocumentType.all
end
end
end

View File

@ -1,9 +1,8 @@
# frozen_string_literal: true
# CarrierWave uploader for proof of identity file of user
# CarrierWave uploader for SupportingDocumentFile of user
# This file defines the parameters for these uploads.
class ProofOfIdentityFileUploader < CarrierWave::Uploader::Base
class SupportingDocumentFileUploader < CarrierWave::Uploader::Base
# Include RMagick or MiniMagick support:
# include CarrierWave::RMagick
# include CarrierWave::MiniMagick
@ -23,7 +22,7 @@ class ProofOfIdentityFileUploader < CarrierWave::Uploader::Base
end
def base_store_dir
"../proof_of_identity_files"
'../supporting_document_files'
end
# Provide a default URL as a default if there hasn't been a file uploaded:
@ -59,9 +58,10 @@ class ProofOfIdentityFileUploader < CarrierWave::Uploader::Base
# Override the filename of the uploaded files:
# Avoid using model.id or version_name here, see uploader/store.rb for details.
def filename
return unless original_filename
original_filename.split('.').map do |s|
ActiveSupport::Inflector.transliterate(s).to_s
end.join('.') if original_filename
end.join('.')
end
end

View File

@ -1,2 +1,4 @@
# frozen_string_literal: true
json.title notification.notification_type
json.description t('.refusal')

View File

@ -1,4 +0,0 @@
# frozen_string_literal: true
json.extract! proof_of_identity_file, :id, :user_id, :proof_of_identity_type_id
json.attachment proof_of_identity_file.attachment.file.filename

View File

@ -1,3 +0,0 @@
# frozen_string_literal: true
json.partial! 'api/proof_of_identity_files/proof_of_identity_file', proof_of_identity_file: @proof_of_identity_file

View File

@ -1,5 +0,0 @@
# frozen_string_literal: true
json.array! @proof_of_identity_files do |proof_of_identity_file|
json.partial! 'api/proof_of_identity_files/proof_of_identity_file', proof_of_identity_file: proof_of_identity_file
end

View File

@ -1,3 +0,0 @@
# frozen_string_literal: true
json.partial! 'api/proof_of_identity_files/proof_of_identity_file', proof_of_identity_file: @proof_of_identity_file

View File

@ -1,3 +0,0 @@
# frozen_string_literal: true
json.partial! 'api/proof_of_identity_files/proof_of_identity_file', proof_of_identity_file: @proof_of_identity_file

View File

@ -1,3 +0,0 @@
# frozen_string_literal: true
json.extract! proof_of_identity_refusal, :id, :user_id, :operator_id, :proof_of_identity_type_ids, :message

View File

@ -1,3 +0,0 @@
# frozen_string_literal: true
json.partial! 'api/proof_of_identity_refusals/proof_of_identity_refusal', proof_of_identity_refusal: @proof_of_identity_refusal

View File

@ -1,5 +0,0 @@
# frozen_string_literal: true
json.array! @proof_of_identity_refusals do |proof_of_identity_refusal|
json.partial! 'api/proof_of_identity_refusals/proof_of_identity_refusal', proof_of_identity_refusal: proof_of_identity_refusal
end

View File

@ -1,3 +0,0 @@
# frozen_string_literal: true
json.partial! 'api/proof_of_identity_refusals/proof_of_identity_refusal', proof_of_identity_refusal: @proof_of_identity_refusal

View File

@ -1,3 +0,0 @@
# frozen_string_literal: true
json.extract! proof_of_identity_type, :id, :name, :group_ids

View File

@ -1,3 +0,0 @@
# frozen_string_literal: true
json.partial! 'api/proof_of_identity_types/proof_of_identity_type', proof_of_identity_type: @proof_of_identity_type

View File

@ -1,5 +0,0 @@
# frozen_string_literal: true
json.array! @proof_of_identity_types do |proof_of_identity_type|
json.partial! 'api/proof_of_identity_types/proof_of_identity_type', proof_of_identity_type: proof_of_identity_type
end

View File

@ -1,3 +0,0 @@
# frozen_string_literal: true
json.partial! 'api/proof_of_identity_types/proof_of_identity_type', proof_of_identity_type: @proof_of_identity_type

View File

@ -1,3 +0,0 @@
# frozen_string_literal: true
json.partial! 'api/proof_of_identity_types/proof_of_identity_type', proof_of_identity_type: @proof_of_identity_type

View File

@ -0,0 +1,4 @@
# frozen_string_literal: true
json.extract! supporting_document_file, :id, :user_id, :supporting_document_type_id
json.attachment supporting_document_file.attachment.file.filename

View File

@ -0,0 +1,3 @@
# frozen_string_literal: true
json.partial! 'api/supporting_document_files/supporting_document_file', supporting_document_file: @supporting_document_file

View File

@ -0,0 +1,5 @@
# frozen_string_literal: true
json.array! @supporting_document_files do |supporting_document_file|
json.partial! 'api/supporting_document_files/supporting_document_file', supporting_document_file: supporting_document_file
end

View File

@ -0,0 +1,3 @@
# frozen_string_literal: true
json.partial! 'api/supporting_document_files/supporting_document_file', supporting_document_file: @supporting_document_file

View File

@ -0,0 +1,3 @@
# frozen_string_literal: true
json.partial! 'api/supporting_document_files/supporting_document_file', supporting_document_file: @supporting_document_file

View File

@ -0,0 +1,3 @@
# frozen_string_literal: true
json.extract! supporting_document_refusal, :id, :user_id, :operator_id, :supporting_document_type_ids, :message

View File

@ -0,0 +1,3 @@
# frozen_string_literal: true
json.partial! 'api/supporting_document_refusals/supporting_document_refusal', supporting_document_refusal: @supporting_document_refusal

View File

@ -0,0 +1,5 @@
# frozen_string_literal: true
json.array! @supporting_document_refusals do |supporting_document_refusal|
json.partial! 'api/supporting_document_refusals/supporting_document_refusal', supporting_document_refusal: supporting_document_refusal
end

View File

@ -0,0 +1,3 @@
# frozen_string_literal: true
json.partial! 'api/supporting_document_refusals/supporting_document_refusal', supporting_document_refusal: @supporting_document_refusal

View File

@ -0,0 +1,3 @@
# frozen_string_literal: true
json.extract! supporting_document_type, :id, :name, :group_ids

View File

@ -0,0 +1,3 @@
# frozen_string_literal: true
json.partial! 'api/supporting_document_types/supporting_document_type', supporting_document_type: @supporting_document_type

View File

@ -0,0 +1,5 @@
# frozen_string_literal: true
json.array! @supporting_document_types do |supporting_document_type|
json.partial! 'api/supporting_document_types/supporting_document_type', supporting_document_type: supporting_document_type
end

View File

@ -0,0 +1,3 @@
# frozen_string_literal: true
json.partial! 'api/supporting_document_types/supporting_document_type', supporting_document_type: @supporting_document_type

View File

@ -0,0 +1,3 @@
# frozen_string_literal: true
json.partial! 'api/supporting_document_types/supporting_document_type', supporting_document_type: @supporting_document_type

View File

@ -66,7 +66,7 @@
Fablab.weekStartingDay = <%= Date.parse(Rails.application.secrets.week_starting_day).strftime('%w') %>;
Fablab.d3DateFormat = "<%= Rails.application.secrets.d3_date_format %>";
Fablab.uibDateFormat = "<%= Rails.application.secrets.uib_date_format %>";
Fablab.maxProofOfIdentityFileSize = <%= Rails.application.secrets.max_proof_of_identity_file_size&.to_i || 5.megabytes.to_i %>;
Fablab.maxSupportingDocumentFileSize = <%= ENV.fetch('MAX_SUPPORTING_DOCUMENT_FILE_SIZE' ,5.megabytes.to_i) %>;
// feature tour (used when feature_tour_display = session)
Fablab.sessionTours = [];

View File

@ -6,7 +6,7 @@
</p>
<ul>
<% if @attached_object %>
<% @attached_object.group.proof_of_identity_types.each do |type| %>
<% @attached_object.group.supporting_document_types.each do |type| %>
<li><%= type.name %></li>
<% end %>
<% end %>

View File

@ -5,7 +5,7 @@
NAME: @attached_object&.user&.profile&.full_name || t('api.notifications.deleted_user')) %>
</p>
<ul>
<li><%= @attached_object.proof_of_identity_type.name %></li>
<li><%= @attached_object.supporting_document_type.name %></li>
</ul>
<% if Setting.get('user_validation_required') %>
<p>

View File

@ -6,7 +6,7 @@
OPERATOR: @attached_object&.operator&.profile&.full_name || t('api.notifications.deleted_user')) %>
</p>
<ul>
<% @attached_object.proof_of_identity_types.each do |type| %>
<% @attached_object.supporting_document_types.each do |type| %>
<li><%= type.name %></li>
<% end %>
</ul>

View File

@ -1,10 +1,10 @@
<%= render 'notifications_mailer/shared/hello', recipient: @recipient %>
<p>
<%= t('.body.user_proof_of_identity_files_refusal') %>
<%= t('.body.user_supporting_document_files_refusal') %>
</p>
<ul>
<% @attached_object.proof_of_identity_types.each do |type| %>
<% @attached_object.supporting_document_types.each do |type| %>
<li><%= type.name %></li>
<% end %>
</ul>

View File

@ -440,8 +440,8 @@ en:
account_validated: "Your account is valid."
notify_user_is_invalidated:
account_invalidated: "Your account is invalid."
notify_user_proof_of_identity_refusal:
refusal: "Your proof of identity are not accepted"
notify_user_supporting_document_refusal:
refusal: "Your supporting documents were refused"
notify_admin_user_supporting_document_refusal:
refusal: "Member's supporting document <strong><em>%{NAME}</strong></em> was refused."
notify_user_order_is_ready:

View File

@ -388,10 +388,10 @@ en:
subject: "Account invalidated"
body:
account_invalidated: "Your account was invalidated. You won't be able to book anymore, until your account is validated again."
notify_user_proof_of_identity_refusal:
notify_user_supporting_document_refusal:
subject: "Your supporting documents were refused"
body:
user_proof_of_identity_files_refusal: "Your supporting documents were refused:"
user_supporting_document_files_refusal: "Your supporting documents were refused:"
action: "Please re-upload some new supporting documents."
notify_admin_user_supporting_document_refusal:
subject: "A member's supporting documents were refused"

Some files were not shown because too many files have changed in this diff Show More