mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-25 08:05:00 +00:00
Compare commits
4 Commits
366-pick-u
...
362-bug-ma
Author | SHA1 | Date | |
---|---|---|---|
499aa3adea | |||
b597ff89e0 | |||
3c801a6d0e | |||
4093949c2f |
6
.changes/unreleased/DX-20250131-131801.yaml
Normal file
6
.changes/unreleased/DX-20250131-131801.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
kind: DX
|
||||
body: Create an unique source of trust for translations
|
||||
time: 2025-01-31T13:18:01.239211506+01:00
|
||||
custom:
|
||||
Issue: "333"
|
||||
SchemaChange: No schema change
|
6
.changes/unreleased/Feature-20250130-120207.yaml
Normal file
6
.changes/unreleased/Feature-20250130-120207.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
kind: Feature
|
||||
body: Suggest all referrers within actions of the accompanying period when creating an activity
|
||||
time: 2025-01-30T12:02:07.053587034+01:00
|
||||
custom:
|
||||
Issue: "349"
|
||||
SchemaChange: No schema change
|
6
.changes/unreleased/Feature-20250130-120459.yaml
Normal file
6
.changes/unreleased/Feature-20250130-120459.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
kind: Feature
|
||||
body: Add possibility to export a csv with all social issues and social actions
|
||||
time: 2025-01-30T12:04:59.754998541+01:00
|
||||
custom:
|
||||
Issue: "343"
|
||||
SchemaChange: No schema change
|
6
.changes/unreleased/Feature-20250214-150328.yaml
Normal file
6
.changes/unreleased/Feature-20250214-150328.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
kind: Feature
|
||||
body: Restore document to previous kept version when a workflow is canceled
|
||||
time: 2025-02-14T15:03:28.707250207+01:00
|
||||
custom:
|
||||
Issue: "360"
|
||||
SchemaChange: No schema change
|
6
.changes/unreleased/Feature-20250219-120928.yaml
Normal file
6
.changes/unreleased/Feature-20250219-120928.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
kind: Feature
|
||||
body: Add a list of third parties from within the admin (csv download)
|
||||
time: 2025-02-19T12:09:28.487991703+01:00
|
||||
custom:
|
||||
Issue: "341"
|
||||
SchemaChange: No schema change
|
6
.changes/unreleased/Fixed-20250214-121010.yaml
Normal file
6
.changes/unreleased/Fixed-20250214-121010.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
kind: Fixed
|
||||
body: fix generation of document with accompanying period context, and list of activities and works
|
||||
time: 2025-02-14T12:10:10.920355454+01:00
|
||||
custom:
|
||||
Issue: ""
|
||||
SchemaChange: No schema change
|
@@ -1,6 +0,0 @@
|
||||
## v3.10.0 - 2025-03-17
|
||||
### Feature
|
||||
* ([#363](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/363)) Display social actions grouped per social issue within activity form
|
||||
### Fixed
|
||||
* ([#362](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/362)) Fix Dependency Injection, which prevented to save the CalendarRange
|
||||
* ([#368](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/368)) fix search query for user groups
|
@@ -1,3 +0,0 @@
|
||||
## v3.10.1 - 2025-03-17
|
||||
### DX
|
||||
* Remove yarn dependency to symfony/ux-translator, to ease the build process
|
@@ -1,3 +0,0 @@
|
||||
## v3.10.2 - 2025-03-17
|
||||
### Fixed
|
||||
* Replace a ts-expect-error with a ts-ignore
|
@@ -1,3 +0,0 @@
|
||||
## v3.10.3 - 2025-03-18
|
||||
### DX
|
||||
* Eslint fixes
|
@@ -1,10 +0,0 @@
|
||||
## v3.9.0 - 2025-02-27
|
||||
### Feature
|
||||
* ([#349](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/349)) Suggest all referrers within actions of the accompanying period when creating an activity
|
||||
* ([#343](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/343)) Add possibility to export a csv with all social issues and social actions
|
||||
* ([#360](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/360)) Restore document to previous kept version when a workflow is canceled
|
||||
* ([#341](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/341)) Add a list of third parties from within the admin (csv download)
|
||||
### Fixed
|
||||
* fix generation of document with accompanying period context, and list of activities and works
|
||||
### DX
|
||||
* ([#333](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/333)) Create an unique source of trust for translations
|
@@ -1,3 +0,0 @@
|
||||
## v3.9.1 - 2025-02-27
|
||||
### Fixed
|
||||
* Fix post/patch request with missing 'type' property for gender
|
@@ -1,3 +0,0 @@
|
||||
## v3.9.2 - 2025-02-27
|
||||
### Fixed
|
||||
* Use fetchResults method to fetch all social issues instead of only the first page
|
1
.gitignore
vendored
1
.gitignore
vendored
@@ -13,7 +13,6 @@ docker/rabbitmq/data
|
||||
# in this development bundle, we want to ignore directories related to a real app
|
||||
assets/*
|
||||
!assets/translator.ts
|
||||
!assets/ux-translator
|
||||
migrations/*
|
||||
templates/*
|
||||
translations/*
|
||||
|
38
CHANGELOG.md
38
CHANGELOG.md
@@ -6,44 +6,6 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html),
|
||||
and is generated by [Changie](https://github.com/miniscruff/changie).
|
||||
|
||||
|
||||
## v3.10.3 - 2025-03-18
|
||||
### DX
|
||||
* Eslint fixes
|
||||
|
||||
## v3.10.2 - 2025-03-17
|
||||
### Fixed
|
||||
* Replace a ts-expect-error with a ts-ignore
|
||||
|
||||
## v3.10.1 - 2025-03-17
|
||||
### DX
|
||||
* Remove yarn dependency to symfony/ux-translator, to ease the build process
|
||||
|
||||
## v3.10.0 - 2025-03-17
|
||||
### Feature
|
||||
* ([#363](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/363)) Display social actions grouped per social issue within activity form
|
||||
### Fixed
|
||||
* ([#362](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/362)) Fix Dependency Injection, which prevented to save the CalendarRange
|
||||
* ([#368](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/368)) fix search query for user groups
|
||||
|
||||
## v3.9.2 - 2025-02-27
|
||||
### Fixed
|
||||
* Use fetchResults method to fetch all social issues instead of only the first page
|
||||
|
||||
## v3.9.1 - 2025-02-27
|
||||
### Fixed
|
||||
* Fix post/patch request with missing 'type' property for gender
|
||||
|
||||
## v3.9.0 - 2025-02-27
|
||||
### Feature
|
||||
* ([#349](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/349)) Suggest all referrers within actions of the accompanying period when creating an activity
|
||||
* ([#343](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/343)) Add possibility to export a csv with all social issues and social actions
|
||||
* ([#360](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/360)) Restore document to previous kept version when a workflow is canceled
|
||||
* ([#341](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/341)) Add a list of third parties from within the admin (csv download)
|
||||
### Fixed
|
||||
* fix generation of document with accompanying period context, and list of activities and works
|
||||
### DX
|
||||
* ([#333](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/333)) Create an unique source of trust for translations
|
||||
|
||||
## v3.8.2 - 2025-02-10
|
||||
### Fixed
|
||||
* ([#358](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/358)) Remove "filter" button on list of documents in the workflow's "add attachement" modal
|
||||
|
@@ -1,7 +1,9 @@
|
||||
import { trans, setLocale, setLocaleFallbacks } from "./ux-translator";
|
||||
// @ts-ignore Cannot find module (when used within an app)
|
||||
import { trans, getLocale, setLocale, setLocaleFallbacks } from "@symfony/ux-translator";
|
||||
|
||||
setLocaleFallbacks({"en": "fr", "nl": "fr", "fr": "en"});
|
||||
setLocale('fr');
|
||||
|
||||
export { trans };
|
||||
// @ts-ignore Cannot find module (when used within an app)
|
||||
export * from '../var/translations';
|
||||
|
@@ -1,3 +0,0 @@
|
||||
This directory import the symfony ux-translator files directly into chill-bundles.
|
||||
|
||||
This remove the yarn dependencies from the real package, which breaks our installation.
|
@@ -1 +0,0 @@
|
||||
export declare function format(id: string, parameters: Record<string, string | number>, locale: string): string;
|
@@ -1 +0,0 @@
|
||||
export declare function formatIntl(id: string, parameters: Record<string, string | number>, locale: string): string;
|
27
assets/ux-translator/dist/translator.d.ts
vendored
27
assets/ux-translator/dist/translator.d.ts
vendored
@@ -1,27 +0,0 @@
|
||||
export type DomainType = string;
|
||||
export type LocaleType = string;
|
||||
export type TranslationsType = Record<DomainType, {
|
||||
parameters: ParametersType;
|
||||
}>;
|
||||
export type NoParametersType = Record<string, never>;
|
||||
export type ParametersType = Record<string, string | number | Date> | NoParametersType;
|
||||
export type RemoveIntlIcuSuffix<T> = T extends `${infer U}+intl-icu` ? U : T;
|
||||
export type DomainsOf<M> = M extends Message<infer Translations, LocaleType> ? keyof Translations : never;
|
||||
export type LocaleOf<M> = M extends Message<TranslationsType, infer Locale> ? Locale : never;
|
||||
export type ParametersOf<M, D extends DomainType> = M extends Message<infer Translations, LocaleType> ? Translations[D] extends {
|
||||
parameters: infer Parameters;
|
||||
} ? Parameters : never : never;
|
||||
export interface Message<Translations extends TranslationsType, Locale extends LocaleType> {
|
||||
id: string;
|
||||
translations: {
|
||||
[domain in DomainType]: {
|
||||
[locale in Locale]: string;
|
||||
};
|
||||
};
|
||||
}
|
||||
export declare function setLocale(locale: LocaleType | null): void;
|
||||
export declare function getLocale(): LocaleType;
|
||||
export declare function throwWhenNotFound(enabled: boolean): void;
|
||||
export declare function setLocaleFallbacks(localeFallbacks: Record<LocaleType, LocaleType>): void;
|
||||
export declare function getLocaleFallbacks(): Record<LocaleType, LocaleType>;
|
||||
export declare function trans<M extends Message<TranslationsType, LocaleType>, D extends DomainsOf<M>, P extends ParametersOf<M, D>>(...args: P extends NoParametersType ? [message: M, parameters?: P, domain?: RemoveIntlIcuSuffix<D>, locale?: LocaleOf<M>] : [message: M, parameters: P, domain?: RemoveIntlIcuSuffix<D>, locale?: LocaleOf<M>]): string;
|
@@ -1 +0,0 @@
|
||||
export * from './translator';
|
283
assets/ux-translator/dist/translator_controller.js
vendored
283
assets/ux-translator/dist/translator_controller.js
vendored
@@ -1,283 +0,0 @@
|
||||
import { IntlMessageFormat } from 'intl-messageformat';
|
||||
|
||||
function strtr(string, replacePairs) {
|
||||
const regex = Object.entries(replacePairs).map(([from]) => {
|
||||
return from.replace(/([-[\]{}()*+?.\\^$|#,])/g, '\\$1');
|
||||
});
|
||||
if (regex.length === 0) {
|
||||
return string;
|
||||
}
|
||||
return string.replace(new RegExp(regex.join('|'), 'g'), (matched) => replacePairs[matched].toString());
|
||||
}
|
||||
|
||||
function format(id, parameters, locale) {
|
||||
if (null === id || '' === id) {
|
||||
return '';
|
||||
}
|
||||
if (typeof parameters['%count%'] === 'undefined' || Number.isNaN(parameters['%count%'])) {
|
||||
return strtr(id, parameters);
|
||||
}
|
||||
const number = Number(parameters['%count%']);
|
||||
let parts = [];
|
||||
if (/^\|+$/.test(id)) {
|
||||
parts = id.split('|');
|
||||
}
|
||||
else {
|
||||
parts = id.match(/(?:\|\||[^|])+/g) || [];
|
||||
}
|
||||
const intervalRegex = /^(?<interval>({\s*(-?\d+(\.\d+)?[\s*,\s*\-?\d+(.\d+)?]*)\s*})|(?<left_delimiter>[[\]])\s*(?<left>-Inf|-?\d+(\.\d+)?)\s*,\s*(?<right>\+?Inf|-?\d+(\.\d+)?)\s*(?<right_delimiter>[[\]]))\s*(?<message>.*?)$/s;
|
||||
const standardRules = [];
|
||||
for (let part of parts) {
|
||||
part = part.trim().replace(/\|\|/g, '|');
|
||||
const matches = part.match(intervalRegex);
|
||||
if (matches) {
|
||||
const matchGroups = matches.groups || {};
|
||||
if (matches[2]) {
|
||||
for (const n of matches[3].split(',')) {
|
||||
if (number === Number(n)) {
|
||||
return strtr(matchGroups.message, parameters);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
const leftNumber = '-Inf' === matchGroups.left ? Number.NEGATIVE_INFINITY : Number(matchGroups.left);
|
||||
const rightNumber = ['Inf', '+Inf'].includes(matchGroups.right)
|
||||
? Number.POSITIVE_INFINITY
|
||||
: Number(matchGroups.right);
|
||||
if (('[' === matchGroups.left_delimiter ? number >= leftNumber : number > leftNumber) &&
|
||||
(']' === matchGroups.right_delimiter ? number <= rightNumber : number < rightNumber)) {
|
||||
return strtr(matchGroups.message, parameters);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
const ruleMatch = part.match(/^\w+:\s*(.*?)$/);
|
||||
standardRules.push(ruleMatch ? ruleMatch[1] : part);
|
||||
}
|
||||
}
|
||||
const position = getPluralizationRule(number, locale);
|
||||
if (typeof standardRules[position] === 'undefined') {
|
||||
if (1 === parts.length && typeof standardRules[0] !== 'undefined') {
|
||||
return strtr(standardRules[0], parameters);
|
||||
}
|
||||
throw new Error(`Unable to choose a translation for "${id}" with locale "${locale}" for value "${number}". Double check that this translation has the correct plural options (e.g. "There is one apple|There are %count% apples").`);
|
||||
}
|
||||
return strtr(standardRules[position], parameters);
|
||||
}
|
||||
function getPluralizationRule(number, locale) {
|
||||
number = Math.abs(number);
|
||||
let _locale = locale;
|
||||
if (locale === 'pt_BR' || locale === 'en_US_POSIX') {
|
||||
return 0;
|
||||
}
|
||||
_locale = _locale.length > 3 ? _locale.substring(0, _locale.indexOf('_')) : _locale;
|
||||
switch (_locale) {
|
||||
case 'af':
|
||||
case 'bn':
|
||||
case 'bg':
|
||||
case 'ca':
|
||||
case 'da':
|
||||
case 'de':
|
||||
case 'el':
|
||||
case 'en':
|
||||
case 'en_US_POSIX':
|
||||
case 'eo':
|
||||
case 'es':
|
||||
case 'et':
|
||||
case 'eu':
|
||||
case 'fa':
|
||||
case 'fi':
|
||||
case 'fo':
|
||||
case 'fur':
|
||||
case 'fy':
|
||||
case 'gl':
|
||||
case 'gu':
|
||||
case 'ha':
|
||||
case 'he':
|
||||
case 'hu':
|
||||
case 'is':
|
||||
case 'it':
|
||||
case 'ku':
|
||||
case 'lb':
|
||||
case 'ml':
|
||||
case 'mn':
|
||||
case 'mr':
|
||||
case 'nah':
|
||||
case 'nb':
|
||||
case 'ne':
|
||||
case 'nl':
|
||||
case 'nn':
|
||||
case 'no':
|
||||
case 'oc':
|
||||
case 'om':
|
||||
case 'or':
|
||||
case 'pa':
|
||||
case 'pap':
|
||||
case 'ps':
|
||||
case 'pt':
|
||||
case 'so':
|
||||
case 'sq':
|
||||
case 'sv':
|
||||
case 'sw':
|
||||
case 'ta':
|
||||
case 'te':
|
||||
case 'tk':
|
||||
case 'ur':
|
||||
case 'zu':
|
||||
return 1 === number ? 0 : 1;
|
||||
case 'am':
|
||||
case 'bh':
|
||||
case 'fil':
|
||||
case 'fr':
|
||||
case 'gun':
|
||||
case 'hi':
|
||||
case 'hy':
|
||||
case 'ln':
|
||||
case 'mg':
|
||||
case 'nso':
|
||||
case 'pt_BR':
|
||||
case 'ti':
|
||||
case 'wa':
|
||||
return number < 2 ? 0 : 1;
|
||||
case 'be':
|
||||
case 'bs':
|
||||
case 'hr':
|
||||
case 'ru':
|
||||
case 'sh':
|
||||
case 'sr':
|
||||
case 'uk':
|
||||
return 1 === number % 10 && 11 !== number % 100
|
||||
? 0
|
||||
: number % 10 >= 2 && number % 10 <= 4 && (number % 100 < 10 || number % 100 >= 20)
|
||||
? 1
|
||||
: 2;
|
||||
case 'cs':
|
||||
case 'sk':
|
||||
return 1 === number ? 0 : number >= 2 && number <= 4 ? 1 : 2;
|
||||
case 'ga':
|
||||
return 1 === number ? 0 : 2 === number ? 1 : 2;
|
||||
case 'lt':
|
||||
return 1 === number % 10 && 11 !== number % 100
|
||||
? 0
|
||||
: number % 10 >= 2 && (number % 100 < 10 || number % 100 >= 20)
|
||||
? 1
|
||||
: 2;
|
||||
case 'sl':
|
||||
return 1 === number % 100 ? 0 : 2 === number % 100 ? 1 : 3 === number % 100 || 4 === number % 100 ? 2 : 3;
|
||||
case 'mk':
|
||||
return 1 === number % 10 ? 0 : 1;
|
||||
case 'mt':
|
||||
return 1 === number
|
||||
? 0
|
||||
: 0 === number || (number % 100 > 1 && number % 100 < 11)
|
||||
? 1
|
||||
: number % 100 > 10 && number % 100 < 20
|
||||
? 2
|
||||
: 3;
|
||||
case 'lv':
|
||||
return 0 === number ? 0 : 1 === number % 10 && 11 !== number % 100 ? 1 : 2;
|
||||
case 'pl':
|
||||
return 1 === number
|
||||
? 0
|
||||
: number % 10 >= 2 && number % 10 <= 4 && (number % 100 < 12 || number % 100 > 14)
|
||||
? 1
|
||||
: 2;
|
||||
case 'cy':
|
||||
return 1 === number ? 0 : 2 === number ? 1 : 8 === number || 11 === number ? 2 : 3;
|
||||
case 'ro':
|
||||
return 1 === number ? 0 : 0 === number || (number % 100 > 0 && number % 100 < 20) ? 1 : 2;
|
||||
case 'ar':
|
||||
return 0 === number
|
||||
? 0
|
||||
: 1 === number
|
||||
? 1
|
||||
: 2 === number
|
||||
? 2
|
||||
: number % 100 >= 3 && number % 100 <= 10
|
||||
? 3
|
||||
: number % 100 >= 11 && number % 100 <= 99
|
||||
? 4
|
||||
: 5;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
function formatIntl(id, parameters, locale) {
|
||||
if (id === '') {
|
||||
return '';
|
||||
}
|
||||
const intlMessage = new IntlMessageFormat(id, [locale.replace('_', '-')], undefined, { ignoreTag: true });
|
||||
parameters = { ...parameters };
|
||||
Object.entries(parameters).forEach(([key, value]) => {
|
||||
if (key.includes('%') || key.includes('{')) {
|
||||
delete parameters[key];
|
||||
parameters[key.replace(/[%{} ]/g, '').trim()] = value;
|
||||
}
|
||||
});
|
||||
return intlMessage.format(parameters);
|
||||
}
|
||||
|
||||
let _locale = null;
|
||||
let _localeFallbacks = {};
|
||||
let _throwWhenNotFound = false;
|
||||
function setLocale(locale) {
|
||||
_locale = locale;
|
||||
}
|
||||
function getLocale() {
|
||||
return (_locale ||
|
||||
document.documentElement.getAttribute('data-symfony-ux-translator-locale') ||
|
||||
(document.documentElement.lang ? document.documentElement.lang.replace('-', '_') : null) ||
|
||||
'en');
|
||||
}
|
||||
function throwWhenNotFound(enabled) {
|
||||
_throwWhenNotFound = enabled;
|
||||
}
|
||||
function setLocaleFallbacks(localeFallbacks) {
|
||||
_localeFallbacks = localeFallbacks;
|
||||
}
|
||||
function getLocaleFallbacks() {
|
||||
return _localeFallbacks;
|
||||
}
|
||||
function trans(message, parameters = {}, domain = 'messages', locale = null) {
|
||||
if (typeof domain === 'undefined') {
|
||||
domain = 'messages';
|
||||
}
|
||||
if (typeof locale === 'undefined' || null === locale) {
|
||||
locale = getLocale();
|
||||
}
|
||||
if (typeof message.translations === 'undefined') {
|
||||
return message.id;
|
||||
}
|
||||
const localesFallbacks = getLocaleFallbacks();
|
||||
const translationsIntl = message.translations[`${domain}+intl-icu`];
|
||||
if (typeof translationsIntl !== 'undefined') {
|
||||
while (typeof translationsIntl[locale] === 'undefined') {
|
||||
locale = localesFallbacks[locale];
|
||||
if (!locale) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (locale) {
|
||||
return formatIntl(translationsIntl[locale], parameters, locale);
|
||||
}
|
||||
}
|
||||
const translations = message.translations[domain];
|
||||
if (typeof translations !== 'undefined') {
|
||||
while (typeof translations[locale] === 'undefined') {
|
||||
locale = localesFallbacks[locale];
|
||||
if (!locale) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (locale) {
|
||||
return format(translations[locale], parameters, locale);
|
||||
}
|
||||
}
|
||||
if (_throwWhenNotFound) {
|
||||
throw new Error(`No translation message found with id "${message.id}".`);
|
||||
}
|
||||
return message.id;
|
||||
}
|
||||
|
||||
export { getLocale, getLocaleFallbacks, setLocale, setLocaleFallbacks, throwWhenNotFound, trans };
|
1
assets/ux-translator/dist/utils.d.ts
vendored
1
assets/ux-translator/dist/utils.d.ts
vendored
@@ -1 +0,0 @@
|
||||
export declare function strtr(string: string, replacePairs: Record<string, string | number>): string;
|
@@ -1,34 +0,0 @@
|
||||
{
|
||||
"name": "@symfony/ux-translator",
|
||||
"description": "Symfony Translator for JavaScript",
|
||||
"license": "MIT",
|
||||
"version": "1.0.0",
|
||||
"main": "dist/translator_controller.js",
|
||||
"types": "dist/translator_controller.d.ts",
|
||||
"scripts": {
|
||||
"build": "node ../../../bin/build_package.js .",
|
||||
"watch": "node ../../../bin/build_package.js . --watch",
|
||||
"test": "../../../bin/test_package.sh .",
|
||||
"check": "biome check",
|
||||
"ci": "biome ci"
|
||||
},
|
||||
"symfony": {
|
||||
"importmap": {
|
||||
"intl-messageformat": "^10.5.11",
|
||||
"@symfony/ux-translator": "path:%PACKAGE%/dist/translator_controller.js",
|
||||
"@app/translations": "path:var/translations/index.js",
|
||||
"@app/translations/configuration": "path:var/translations/configuration.js"
|
||||
}
|
||||
},
|
||||
"peerDependencies": {
|
||||
"intl-messageformat": "^10.5.11"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"intl-messageformat": {
|
||||
"optional": false
|
||||
}
|
||||
},
|
||||
"devDependencies": {
|
||||
"intl-messageformat": "^10.5.11"
|
||||
}
|
||||
}
|
@@ -34,7 +34,6 @@ export default ts.config(
|
||||
// override/add rules settings here, such as:
|
||||
"vue/multi-word-component-names": "off",
|
||||
"@typescript-eslint/no-require-imports": "off",
|
||||
"@typescript-eslint/ban-ts-comment": "off"
|
||||
},
|
||||
},
|
||||
);
|
||||
|
@@ -11,6 +11,7 @@
|
||||
"@hotwired/stimulus": "^3.0.0",
|
||||
"@luminateone/eslint-baseline": "^1.0.9",
|
||||
"@symfony/stimulus-bridge": "^3.2.0",
|
||||
"@symfony/ux-translator": "file:vendor/symfony/ux-translator/assets",
|
||||
"@symfony/webpack-encore": "^4.1.0",
|
||||
"@tsconfig/node20": "^20.1.4",
|
||||
"@types/dompurify": "^3.0.5",
|
||||
@@ -58,7 +59,6 @@
|
||||
"bootstrap-icons": "^1.11.3",
|
||||
"dropzone": "^5.7.6",
|
||||
"es6-promise": "^4.2.8",
|
||||
"intl-messageformat": "^10.5.11",
|
||||
"leaflet": "^1.7.1",
|
||||
"marked": "^12.0.2",
|
||||
"masonry-layout": "^4.2.2",
|
||||
|
@@ -68,23 +68,14 @@
|
||||
socialActionsSelected.length)
|
||||
"
|
||||
>
|
||||
<div
|
||||
id="actionsList"
|
||||
v-for="group in socialActionsList"
|
||||
:key="group.issue"
|
||||
<check-social-action
|
||||
v-for="action in socialActionsList"
|
||||
:key="action.id"
|
||||
:action="action"
|
||||
:selection="socialActionsSelected"
|
||||
@updateSelected="updateActionsSelected"
|
||||
>
|
||||
<span class="badge bg-chill-l-gray text-dark">{{
|
||||
group.issue
|
||||
}}</span>
|
||||
<check-social-action
|
||||
v-for="action in group.actions"
|
||||
:key="action.id"
|
||||
:action="action"
|
||||
:selection="socialActionsSelected"
|
||||
@updateSelected="updateActionsSelected"
|
||||
>
|
||||
</check-social-action>
|
||||
</div>
|
||||
</check-social-action>
|
||||
</template>
|
||||
|
||||
<span
|
||||
@@ -158,44 +149,53 @@ export default {
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
/* Load other issues in multiselect */
|
||||
/* Load others issues in multiselect
|
||||
*/
|
||||
this.issueIsLoading = true;
|
||||
this.actionAreLoaded = false;
|
||||
getSocialIssues().then(
|
||||
(response) =>
|
||||
new Promise((resolve) => {
|
||||
this.$store.commit("updateIssuesOther", response.results);
|
||||
|
||||
getSocialIssues().then((response) => {
|
||||
/* Add issues to the store */
|
||||
this.$store.commit("updateIssuesOther", response);
|
||||
/* Add in list the issues already associated (if not yet listed)
|
||||
*/
|
||||
this.socialIssuesSelected.forEach((issue) => {
|
||||
if (
|
||||
this.socialIssuesList.filter(
|
||||
(i) => i.id === issue.id,
|
||||
).length !== 1
|
||||
) {
|
||||
this.$store.commit("addIssueInList", issue);
|
||||
}
|
||||
}, this);
|
||||
|
||||
/* Add in list the issues already associated (if not yet listed) */
|
||||
this.socialIssuesSelected.forEach((issue) => {
|
||||
if (
|
||||
this.socialIssuesList.filter((i) => i.id === issue.id)
|
||||
.length !== 1
|
||||
) {
|
||||
this.$store.commit("addIssueInList", issue);
|
||||
}
|
||||
});
|
||||
/* Remove from multiselect the issues that are not yet in checkbox list
|
||||
*/
|
||||
this.socialIssuesList.forEach((issue) => {
|
||||
this.$store.commit("removeIssueInOther", issue);
|
||||
}, this);
|
||||
|
||||
/* Remove from multiselect the issues that are not yet in the checkbox list */
|
||||
this.socialIssuesList.forEach((issue) => {
|
||||
this.$store.commit("removeIssueInOther", issue);
|
||||
});
|
||||
/* Filter issues
|
||||
*/
|
||||
this.$store.commit("filterList", "issues");
|
||||
|
||||
/* Filter issues */
|
||||
this.$store.commit("filterList", "issues");
|
||||
/* Add in list the actions already associated (if not yet listed)
|
||||
*/
|
||||
this.socialActionsSelected.forEach((action) => {
|
||||
this.$store.commit("addActionInList", action);
|
||||
}, this);
|
||||
|
||||
/* Add in list the actions already associated (if not yet listed) */
|
||||
this.socialActionsSelected.forEach((action) => {
|
||||
this.$store.commit("addActionInList", action);
|
||||
});
|
||||
/* Filter issues
|
||||
*/
|
||||
this.$store.commit("filterList", "actions");
|
||||
|
||||
/* Filter actions */
|
||||
this.$store.commit("filterList", "actions");
|
||||
|
||||
this.issueIsLoading = false;
|
||||
this.actionAreLoaded = true;
|
||||
this.updateActionsList();
|
||||
});
|
||||
this.issueIsLoading = false;
|
||||
this.actionAreLoaded = true;
|
||||
this.updateActionsList();
|
||||
resolve();
|
||||
}),
|
||||
);
|
||||
},
|
||||
methods: {
|
||||
/* When choosing an issue in multiselect, add it in checkboxes (as selected),
|
||||
@@ -258,23 +258,7 @@ export default {
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import "ChillMainAssets/module/bootstrap/shared";
|
||||
@import "ChillPersonAssets/chill/scss/mixins";
|
||||
@import "ChillMainAssets/chill/scss/chill_variables";
|
||||
|
||||
span.multiselect__single {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
#actionsList {
|
||||
border-radius: 0.5rem;
|
||||
padding: 1rem;
|
||||
margin: 0.5rem;
|
||||
background-color: whitesmoke;
|
||||
}
|
||||
|
||||
span.badge {
|
||||
margin-bottom: 0.5rem;
|
||||
@include badge_social($social-issue-color);
|
||||
}
|
||||
</style>
|
||||
|
@@ -10,9 +10,7 @@
|
||||
:value="action"
|
||||
/>
|
||||
<label class="form-check-label" :for="action.id">
|
||||
<span class="badge bg-light text-dark" :title="action.text">{{
|
||||
action.text
|
||||
}}</span>
|
||||
<span class="badge bg-light text-dark">{{ action.text }}</span>
|
||||
</label>
|
||||
</div>
|
||||
</span>
|
||||
@@ -45,9 +43,5 @@ span.badge {
|
||||
font-size: 95%;
|
||||
margin-bottom: 5px;
|
||||
margin-right: 1em;
|
||||
max-width: 100%; /* Adjust as needed */
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
</style>
|
||||
|
@@ -124,19 +124,9 @@ const store = createStore({
|
||||
);
|
||||
},
|
||||
socialActionsListSorted(state) {
|
||||
return [...state.socialActionsList]
|
||||
.sort((a, b) => a.ordering - b.ordering)
|
||||
.reduce((acc, action) => {
|
||||
const issueText = action.issue?.text || "Uncategorized";
|
||||
// Find if the group for the issue already exists
|
||||
let group = acc.find((item) => item.issue === issueText);
|
||||
if (!group) {
|
||||
group = { issue: issueText, actions: [] };
|
||||
acc.push(group);
|
||||
}
|
||||
group.actions.push(action);
|
||||
return acc;
|
||||
}, []);
|
||||
return [...state.socialActionsList].sort(
|
||||
(a, b) => a.ordering - b.ordering,
|
||||
);
|
||||
},
|
||||
},
|
||||
mutations: {
|
||||
|
@@ -15,6 +15,7 @@ use Chill\CalendarBundle\Repository\CalendarRepository;
|
||||
use Chill\MainBundle\CRUD\Controller\ApiController;
|
||||
use Chill\MainBundle\Entity\User;
|
||||
use Chill\MainBundle\Serializer\Model\Collection;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
@@ -23,7 +24,10 @@ use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
class CalendarAPIController extends ApiController
|
||||
{
|
||||
public function __construct(private readonly CalendarRepository $calendarRepository) {}
|
||||
public function __construct(private readonly CalendarRepository $calendarRepository, ManagerRegistry $managerRegistry)
|
||||
{
|
||||
parent::__construct($managerRegistry);
|
||||
}
|
||||
|
||||
#[Route(path: '/api/1.0/calendar/calendar/by-user/{id}.{_format}', name: 'chill_api_single_calendar_list_by-user', requirements: ['_format' => 'json'])]
|
||||
public function listByUser(User $user, Request $request, string $_format): JsonResponse
|
||||
|
@@ -15,6 +15,7 @@ use Chill\CalendarBundle\Repository\CalendarRangeRepository;
|
||||
use Chill\MainBundle\CRUD\Controller\ApiController;
|
||||
use Chill\MainBundle\Entity\User;
|
||||
use Chill\MainBundle\Serializer\Model\Collection;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
@@ -23,7 +24,10 @@ use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
class CalendarRangeAPIController extends ApiController
|
||||
{
|
||||
public function __construct(private readonly CalendarRangeRepository $calendarRangeRepository) {}
|
||||
public function __construct(private readonly CalendarRangeRepository $calendarRangeRepository, ManagerRegistry $managerRegistry)
|
||||
{
|
||||
parent::__construct($managerRegistry);
|
||||
}
|
||||
|
||||
#[Route(path: '/api/1.0/calendar/calendar-range-available/{id}.{_format}', name: 'chill_api_single_calendar_range_available', requirements: ['_format' => 'json'])]
|
||||
public function availableRanges(User $user, Request $request, string $_format): JsonResponse
|
||||
|
@@ -96,13 +96,13 @@
|
||||
</div>
|
||||
</div>
|
||||
<FullCalendar :options="calendarOptions" ref="calendarRef">
|
||||
<template v-slot:eventContent="{ arg }: { arg: { event: EventApi } }">
|
||||
<template v-slot:eventContent="arg: EventApi">
|
||||
<span :class="eventClasses(arg.event)">
|
||||
<b v-if="arg.event.extendedProps.is === 'remote'">{{
|
||||
arg.event.title
|
||||
}}</b>
|
||||
<b v-else-if="arg.event.extendedProps.is === 'range'"
|
||||
>{{ arg.event.startStr }} -
|
||||
>{{ arg.timeText }} -
|
||||
{{ arg.event.extendedProps.locationName }}</b
|
||||
>
|
||||
<b v-else-if="arg.event.extendedProps.is === 'local'">{{
|
||||
|
@@ -14,6 +14,7 @@ namespace Chill\DocStoreBundle\Controller;
|
||||
use Chill\DocStoreBundle\Entity\StoredObject;
|
||||
use Chill\MainBundle\CRUD\Controller\ApiController;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
@@ -27,7 +28,10 @@ class StoredObjectApiController extends ApiController
|
||||
private readonly Security $security,
|
||||
private readonly SerializerInterface $serializer,
|
||||
private readonly EntityManagerInterface $entityManager,
|
||||
) {}
|
||||
ManagerRegistry $managerRegistry,
|
||||
) {
|
||||
parent::__construct($managerRegistry);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new stored object.
|
||||
|
@@ -91,7 +91,10 @@
|
||||
class="col-5 p-0 text-center turnSignature"
|
||||
>
|
||||
<button
|
||||
:disabled="isFirstSignatureZone"
|
||||
:disabled="
|
||||
userSignatureZone === null ||
|
||||
userSignatureZone?.index < 1
|
||||
"
|
||||
class="btn btn-light btn-sm"
|
||||
@click="turnSignature(-1)"
|
||||
>
|
||||
@@ -99,7 +102,9 @@
|
||||
</button>
|
||||
<span>|</span>
|
||||
<button
|
||||
:disabled="isLastSignatureZone"
|
||||
:disabled="
|
||||
userSignatureZone?.index >= signature.zones.length - 1
|
||||
"
|
||||
class="btn btn-light btn-sm"
|
||||
@click="turnSignature(1)"
|
||||
>
|
||||
@@ -195,7 +200,10 @@
|
||||
class="col-4 d-xl-none text-center turnSignature p-0"
|
||||
>
|
||||
<button
|
||||
:disabled="!hasSignatureZoneSelected"
|
||||
:disabled="
|
||||
userSignatureZone === null ||
|
||||
userSignatureZone?.index < 1
|
||||
"
|
||||
class="btn btn-light btn-sm"
|
||||
@click="turnSignature(-1)"
|
||||
>
|
||||
@@ -203,7 +211,9 @@
|
||||
</button>
|
||||
<span>|</span>
|
||||
<button
|
||||
:disabled="isLastSignatureZone"
|
||||
:disabled="
|
||||
userSignatureZone?.index >= signature.zones.length - 1
|
||||
"
|
||||
class="btn btn-light btn-sm"
|
||||
@click="turnSignature(1)"
|
||||
>
|
||||
@@ -215,7 +225,10 @@
|
||||
class="col-4 d-none d-xl-flex p-0 text-center turnSignature"
|
||||
>
|
||||
<button
|
||||
:disabled="isFirstSignatureZone"
|
||||
:disabled="
|
||||
userSignatureZone === null ||
|
||||
userSignatureZone?.index < 1
|
||||
"
|
||||
class="btn btn-light btn-sm"
|
||||
@click="turnSignature(-1)"
|
||||
>
|
||||
@@ -223,7 +236,9 @@
|
||||
</button>
|
||||
<span>|</span>
|
||||
<button
|
||||
:disabled="isLastSignatureZone"
|
||||
:disabled="
|
||||
userSignatureZone?.index >= signature.zones.length - 1
|
||||
"
|
||||
class="btn btn-light btn-sm"
|
||||
@click="turnSignature(1)"
|
||||
>
|
||||
@@ -318,7 +333,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, Ref, computed } from "vue";
|
||||
import { ref, Ref, reactive } from "vue";
|
||||
import { useToast } from "vue-toast-notification";
|
||||
import "vue-toast-notification/dist/theme-sugar.css";
|
||||
import {
|
||||
@@ -336,15 +351,18 @@ import {
|
||||
PDFPageProxy,
|
||||
} from "pdfjs-dist/types/src/display/api";
|
||||
|
||||
// @ts-ignore incredible but the console.log is needed
|
||||
// @ts-ignore
|
||||
import * as PdfWorker from "pdfjs-dist/build/pdf.worker.mjs";
|
||||
console.log(PdfWorker);
|
||||
console.log(PdfWorker); // incredible but this is needed
|
||||
|
||||
// import { PdfWorker } from 'pdfjs-dist/build/pdf.worker.mjs'
|
||||
// pdfjsLib.GlobalWorkerOptions.workerSrc = PdfWorker;
|
||||
|
||||
import Modal from "ChillMainAssets/vuejs/_components/Modal.vue";
|
||||
import { download_doc_as_pdf } from "../StoredObjectButton/helpers";
|
||||
import {
|
||||
download_and_decrypt_doc,
|
||||
download_doc_as_pdf,
|
||||
} from "../StoredObjectButton/helpers";
|
||||
|
||||
pdfjsLib.GlobalWorkerOptions.workerSrc = "pdfjs-dist/build/pdf.worker.mjs";
|
||||
|
||||
@@ -415,20 +433,6 @@ const $toast = useToast();
|
||||
|
||||
const signature = window.signature;
|
||||
|
||||
const isFirstSignatureZone = () =>
|
||||
userSignatureZone.value?.index ? userSignatureZone.value.index < 1 : false;
|
||||
const isLastSignatureZone = () =>
|
||||
userSignatureZone.value?.index
|
||||
? userSignatureZone.value.index >= signature.zones.length - 1
|
||||
: false;
|
||||
|
||||
/**
|
||||
* Return true if the user has selected a user zone (existing on the doc or created by the user)
|
||||
*/
|
||||
const hasSignatureZoneSelected = computed<boolean>(
|
||||
() => userSignatureZone.value !== null,
|
||||
);
|
||||
|
||||
const setZoomLevel = async (zoomLevel: string) => {
|
||||
zoom.value = Number.parseFloat(zoomLevel);
|
||||
await resetPages();
|
||||
@@ -750,7 +754,7 @@ const confirmSign = () => {
|
||||
zone: userSignatureZone.value,
|
||||
};
|
||||
makeFetch("POST", url, body)
|
||||
.then(() => {
|
||||
.then((r) => {
|
||||
checkForReady();
|
||||
})
|
||||
.catch((error) => {
|
||||
@@ -772,7 +776,9 @@ const undoSign = async () => {
|
||||
};
|
||||
|
||||
const toggleAddZone = () => {
|
||||
canvasEvent.value = canvasEvent.value === "select" ? "add" : "select";
|
||||
canvasEvent.value === "select"
|
||||
? (canvasEvent.value = "add")
|
||||
: (canvasEvent.value = "select");
|
||||
};
|
||||
|
||||
const addZoneEvent = async (e: PointerEvent, canvas: HTMLCanvasElement) => {
|
||||
|
@@ -28,10 +28,6 @@ const open = () => {
|
||||
state.opened = true;
|
||||
};
|
||||
|
||||
const onRestoreVersion = (payload: {
|
||||
newVersion: StoredObjectVersionWithPointInTime;
|
||||
}) => emit("restoreVersion", payload);
|
||||
|
||||
defineExpose({ open });
|
||||
</script>
|
||||
<template>
|
||||
@@ -46,7 +42,9 @@ defineExpose({ open });
|
||||
:versions="props.versions"
|
||||
:can-edit="canEdit"
|
||||
:stored-object="storedObject"
|
||||
@restore-version="onRestoreVersion"
|
||||
@restore-version="
|
||||
(payload) => emit('restoreVersion', payload)
|
||||
"
|
||||
></history-button-list>
|
||||
</template>
|
||||
</modal>
|
||||
|
@@ -14,6 +14,7 @@ namespace Chill\DocStoreBundle\Tests\Controller;
|
||||
use Chill\DocStoreBundle\Controller\StoredObjectApiController;
|
||||
use Chill\DocStoreBundle\Entity\StoredObject;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
@@ -45,7 +46,9 @@ class StoredObjectApiControllerTest extends TestCase
|
||||
{"type": "stored-object", "id": 1}
|
||||
JSON);
|
||||
|
||||
$controller = new StoredObjectApiController($security, $serializer, $entityManager);
|
||||
$managerRegistry = $this->createMock(ManagerRegistry::class);
|
||||
|
||||
$controller = new StoredObjectApiController($security, $serializer, $entityManager, $managerRegistry);
|
||||
|
||||
$actual = $controller->createStoredObject();
|
||||
|
||||
|
@@ -39,6 +39,8 @@ abstract class AbstractCRUDController extends AbstractController
|
||||
*/
|
||||
protected array $crudConfig = [];
|
||||
|
||||
public function __construct(protected ManagerRegistry $managerRegistry) {}
|
||||
|
||||
/**
|
||||
* get the role given from the config.
|
||||
*/
|
||||
@@ -63,6 +65,7 @@ abstract class AbstractCRUDController extends AbstractController
|
||||
parent::getSubscribedServices(),
|
||||
[
|
||||
'chill_main.paginator_factory' => PaginatorFactory::class,
|
||||
ManagerRegistry::class => ManagerRegistry::class,
|
||||
'translator' => TranslatorInterface::class,
|
||||
AuthorizationHelper::class => AuthorizationHelper::class,
|
||||
EventDispatcherInterface::class => EventDispatcherInterface::class,
|
||||
@@ -212,7 +215,7 @@ abstract class AbstractCRUDController extends AbstractController
|
||||
|
||||
protected function getManagerRegistry(): ManagerRegistry
|
||||
{
|
||||
return $this->container->get('doctrine');
|
||||
return $this->managerRegistry;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -225,7 +228,7 @@ abstract class AbstractCRUDController extends AbstractController
|
||||
|
||||
protected function getValidator(): ValidatorInterface
|
||||
{
|
||||
return $this->container->get('validator');
|
||||
return $this->get('validator');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -13,6 +13,7 @@ namespace Chill\MainBundle\CRUD\Controller;
|
||||
|
||||
use Chill\MainBundle\Pagination\PaginatorInterface;
|
||||
use Chill\MainBundle\Serializer\Model\Collection;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||
@@ -23,6 +24,11 @@ use Symfony\Component\Validator\ConstraintViolationListInterface;
|
||||
|
||||
class ApiController extends AbstractCRUDController
|
||||
{
|
||||
public function __construct(ManagerRegistry $managerRegistry)
|
||||
{
|
||||
parent::__construct($managerRegistry);
|
||||
}
|
||||
|
||||
/**
|
||||
* Base method for handling api action.
|
||||
*
|
||||
|
@@ -13,6 +13,7 @@ namespace Chill\MainBundle\Controller;
|
||||
|
||||
use Chill\MainBundle\CRUD\Controller\ApiController;
|
||||
use Chill\MainBundle\Entity\Address;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
@@ -20,7 +21,10 @@ use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
|
||||
|
||||
class AddressApiController extends ApiController
|
||||
{
|
||||
public function __construct(private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {}
|
||||
public function __construct(protected ManagerRegistry $managerRegistry)
|
||||
{
|
||||
parent::__construct($managerRegistry);
|
||||
}
|
||||
|
||||
/**
|
||||
* Duplicate an existing address.
|
||||
|
@@ -17,6 +17,7 @@ use Chill\MainBundle\Pagination\PaginatorFactory;
|
||||
use Chill\MainBundle\Pagination\PaginatorInterface;
|
||||
use Chill\MainBundle\Repository\AddressReferenceRepository;
|
||||
use Chill\MainBundle\Serializer\Model\Collection;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
@@ -26,7 +27,10 @@ use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
|
||||
|
||||
final class AddressReferenceAPIController extends ApiController
|
||||
{
|
||||
public function __construct(private readonly AddressReferenceRepository $addressReferenceRepository, private readonly PaginatorFactory $paginatorFactory) {}
|
||||
public function __construct(private readonly AddressReferenceRepository $addressReferenceRepository, private readonly PaginatorFactory $paginatorFactory, ManagerRegistry $managerRegistry)
|
||||
{
|
||||
parent::__construct($managerRegistry);
|
||||
}
|
||||
|
||||
#[Route(path: '/api/1.0/main/address-reference/by-postal-code/{id}/search.json')]
|
||||
public function search(PostalCode $postalCode, Request $request): JsonResponse
|
||||
|
@@ -13,10 +13,16 @@ namespace Chill\MainBundle\Controller;
|
||||
|
||||
use Chill\MainBundle\CRUD\Controller\ApiController;
|
||||
use Chill\MainBundle\Pagination\PaginatorInterface;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
class CivilityApiController extends ApiController
|
||||
{
|
||||
public function __construct(protected ManagerRegistry $managerRegistry)
|
||||
{
|
||||
parent::__construct($managerRegistry);
|
||||
}
|
||||
|
||||
protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator, $_format)
|
||||
{
|
||||
return $query->addOrderBy('e.order', 'ASC');
|
||||
|
@@ -12,5 +12,12 @@ declare(strict_types=1);
|
||||
namespace Chill\MainBundle\Controller;
|
||||
|
||||
use Chill\MainBundle\CRUD\Controller\ApiController;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
class CountryApiController extends ApiController {}
|
||||
class CountryApiController extends ApiController
|
||||
{
|
||||
public function __construct(protected ManagerRegistry $managerRegistry)
|
||||
{
|
||||
parent::__construct($managerRegistry);
|
||||
}
|
||||
}
|
||||
|
@@ -13,10 +13,16 @@ namespace Chill\MainBundle\Controller;
|
||||
|
||||
use Chill\MainBundle\CRUD\Controller\ApiController;
|
||||
use Chill\MainBundle\Pagination\PaginatorInterface;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
class GenderApiController extends ApiController
|
||||
{
|
||||
public function __construct(protected ManagerRegistry $managerRegistry)
|
||||
{
|
||||
parent::__construct($managerRegistry);
|
||||
}
|
||||
|
||||
protected function customizeQuery(string $action, Request $request, $query): void
|
||||
{
|
||||
$query
|
||||
|
@@ -12,5 +12,12 @@ declare(strict_types=1);
|
||||
namespace Chill\MainBundle\Controller;
|
||||
|
||||
use Chill\MainBundle\CRUD\Controller\ApiController;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
class GeographicalUnitApiController extends ApiController {}
|
||||
class GeographicalUnitApiController extends ApiController
|
||||
{
|
||||
public function __construct(protected ManagerRegistry $managerRegistry)
|
||||
{
|
||||
parent::__construct($managerRegistry);
|
||||
}
|
||||
}
|
||||
|
@@ -14,6 +14,7 @@ namespace Chill\MainBundle\Controller;
|
||||
use Chill\MainBundle\CRUD\Controller\ApiController;
|
||||
use Chill\MainBundle\Pagination\PaginatorInterface;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
/**
|
||||
@@ -21,6 +22,11 @@ use Symfony\Component\HttpFoundation\Request;
|
||||
*/
|
||||
class LocationApiController extends ApiController
|
||||
{
|
||||
public function __construct(protected ManagerRegistry $managerRegistry)
|
||||
{
|
||||
parent::__construct($managerRegistry);
|
||||
}
|
||||
|
||||
protected function customizeQuery(string $action, Request $request, $query): void
|
||||
{
|
||||
$query
|
||||
|
@@ -12,6 +12,7 @@ declare(strict_types=1);
|
||||
namespace Chill\MainBundle\Controller;
|
||||
|
||||
use Chill\MainBundle\CRUD\Controller\ApiController;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
/**
|
||||
@@ -19,6 +20,11 @@ use Symfony\Component\HttpFoundation\Request;
|
||||
*/
|
||||
class LocationTypeApiController extends ApiController
|
||||
{
|
||||
public function __construct(protected ManagerRegistry $managerRegistry)
|
||||
{
|
||||
parent::__construct($managerRegistry);
|
||||
}
|
||||
|
||||
public function customizeQuery(string $action, Request $request, $query): void
|
||||
{
|
||||
$query->andWhere(
|
||||
|
@@ -16,6 +16,7 @@ use Chill\MainBundle\Pagination\PaginatorFactory;
|
||||
use Chill\MainBundle\Repository\CountryRepository;
|
||||
use Chill\MainBundle\Repository\PostalCodeRepositoryInterface;
|
||||
use Chill\MainBundle\Serializer\Model\Collection;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
@@ -26,7 +27,10 @@ use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
|
||||
|
||||
final class PostalCodeAPIController extends ApiController
|
||||
{
|
||||
public function __construct(private readonly CountryRepository $countryRepository, private readonly PostalCodeRepositoryInterface $postalCodeRepository, private readonly PaginatorFactory $paginatorFactory) {}
|
||||
public function __construct(private readonly CountryRepository $countryRepository, private readonly PostalCodeRepositoryInterface $postalCodeRepository, private readonly PaginatorFactory $paginatorFactory, ManagerRegistry $managerRegistry)
|
||||
{
|
||||
parent::__construct($managerRegistry);
|
||||
}
|
||||
|
||||
#[Route(path: '/api/1.0/main/postal-code/search.json')]
|
||||
public function search(Request $request): JsonResponse
|
||||
|
@@ -12,10 +12,16 @@ declare(strict_types=1);
|
||||
namespace Chill\MainBundle\Controller;
|
||||
|
||||
use Chill\MainBundle\CRUD\Controller\ApiController;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
class ScopeApiController extends ApiController
|
||||
{
|
||||
public function __construct(protected ManagerRegistry $managerRegistry)
|
||||
{
|
||||
parent::__construct($managerRegistry);
|
||||
}
|
||||
|
||||
protected function customizeQuery(string $action, Request $request, $query): void
|
||||
{
|
||||
if ('_index' === $action) {
|
||||
|
@@ -15,6 +15,7 @@ use Chill\MainBundle\CRUD\Controller\ApiController;
|
||||
use Chill\MainBundle\Pagination\PaginatorInterface;
|
||||
use Chill\MainBundle\Security\ChillSecurity;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
||||
@@ -22,7 +23,10 @@ use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
class UserApiController extends ApiController
|
||||
{
|
||||
public function __construct(private readonly ChillSecurity $security) {}
|
||||
public function __construct(private readonly ChillSecurity $security, ManagerRegistry $managerRegistry)
|
||||
{
|
||||
parent::__construct($managerRegistry);
|
||||
}
|
||||
|
||||
#[Route(path: '/api/1.0/main/user-current-location.{_format}', name: 'chill_main_user_current_location', requirements: ['_format' => 'json'])]
|
||||
public function currentLocation(mixed $_format): JsonResponse
|
||||
|
@@ -12,5 +12,12 @@ declare(strict_types=1);
|
||||
namespace Chill\MainBundle\Controller;
|
||||
|
||||
use Chill\MainBundle\CRUD\Controller\ApiController;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
class UserGroupApiController extends ApiController {}
|
||||
class UserGroupApiController extends ApiController
|
||||
{
|
||||
public function __construct(protected ManagerRegistry $managerRegistry)
|
||||
{
|
||||
parent::__construct($managerRegistry);
|
||||
}
|
||||
}
|
||||
|
@@ -12,10 +12,16 @@ declare(strict_types=1);
|
||||
namespace Chill\MainBundle\Controller;
|
||||
|
||||
use Chill\MainBundle\CRUD\Controller\ApiController;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
class UserJobApiController extends ApiController
|
||||
{
|
||||
public function __construct(protected ManagerRegistry $managerRegistry)
|
||||
{
|
||||
parent::__construct($managerRegistry);
|
||||
}
|
||||
|
||||
protected function customizeQuery(string $action, Request $request, $query): void
|
||||
{
|
||||
if ('_index' === $action) {
|
||||
|
@@ -66,11 +66,8 @@ class EntityToJsonTransformer implements DataTransformerInterface
|
||||
]);
|
||||
}
|
||||
|
||||
private function denormalizeOne(array|string $item)
|
||||
private function denormalizeOne(array $item)
|
||||
{
|
||||
if ('me' === $item) {
|
||||
return $item;
|
||||
}
|
||||
if (!\array_key_exists('type', $item)) {
|
||||
throw new TransformationFailedException('the key "type" is missing on element');
|
||||
}
|
||||
@@ -101,6 +98,5 @@ class EntityToJsonTransformer implements DataTransformerInterface
|
||||
'json',
|
||||
$context,
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -1,82 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\MainBundle\Form\Type;
|
||||
|
||||
use Chill\MainBundle\Entity\User;
|
||||
use Chill\MainBundle\Form\Type\DataTransformer\EntityToJsonTransformer;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\Form\FormView;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
|
||||
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
|
||||
use Symfony\Component\Serializer\SerializerInterface;
|
||||
|
||||
/**
|
||||
* Pick user dymically, using vuejs module "AddPerson".
|
||||
*
|
||||
* Possible options:
|
||||
*
|
||||
* - `multiple`: pick one or more users
|
||||
* - `suggested`: a list of suggested users
|
||||
* - `suggest_myself`: append the current user to the list of suggested
|
||||
* - `as_id`: only the id will be set in the returned data
|
||||
* - `submit_on_adding_new_entity`: the browser will immediately submit the form when new users are checked
|
||||
*/
|
||||
class PickUserOrMeDynamicType extends AbstractType
|
||||
{
|
||||
public function __construct(
|
||||
private readonly DenormalizerInterface $denormalizer,
|
||||
private readonly SerializerInterface $serializer,
|
||||
private readonly NormalizerInterface $normalizer,
|
||||
) {}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$builder->addViewTransformer(new EntityToJsonTransformer($this->denormalizer, $this->serializer, $options['multiple'], 'user'));
|
||||
}
|
||||
|
||||
public function buildView(FormView $view, FormInterface $form, array $options)
|
||||
{
|
||||
$view->vars['multiple'] = $options['multiple'];
|
||||
$view->vars['types'] = ['user'];
|
||||
$view->vars['uniqid'] = uniqid('pick_user_or_me_dyn');
|
||||
$view->vars['suggested'] = [];
|
||||
$view->vars['as_id'] = true === $options['as_id'] ? '1' : '0';
|
||||
$view->vars['submit_on_adding_new_entity'] = true === $options['submit_on_adding_new_entity'] ? '1' : '0';
|
||||
|
||||
foreach ($options['suggested'] as $user) {
|
||||
$view->vars['suggested'][] = $this->normalizer->normalize($user, 'json', ['groups' => 'read']);
|
||||
}
|
||||
// $user = /* should come from context */ $options['context'];
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver
|
||||
->setDefault('multiple', false)
|
||||
->setAllowedTypes('multiple', ['bool'])
|
||||
->setDefault('compound', false)
|
||||
->setDefault('suggested', [])
|
||||
// if set to true, only the id will be set inside the content. The denormalization will not work.
|
||||
->setDefault('as_id', false)
|
||||
->setAllowedTypes('as_id', ['bool'])
|
||||
->setDefault('submit_on_adding_new_entity', false)
|
||||
->setAllowedTypes('submit_on_adding_new_entity', ['bool']);
|
||||
}
|
||||
|
||||
public function getBlockPrefix()
|
||||
{
|
||||
return 'pick_entity_dynamic';
|
||||
}
|
||||
}
|
@@ -75,8 +75,8 @@ final class UserGroupRepository implements UserGroupRepositoryInterface, LocaleA
|
||||
->setWhereClauses('
|
||||
ug.active AND (
|
||||
SIMILARITY(LOWER(UNACCENT(?)), ug.label->>?) > 0.15
|
||||
OR LOWER(UNACCENT(ug.label->>?)) LIKE \'%\' || LOWER(UNACCENT(?)) || \'%\')
|
||||
', [$pattern, $lang, $lang, $pattern]);
|
||||
OR ug.label->>? LIKE \'%\' || LOWER(UNACCENT(?)) || \'%\')
|
||||
', [$pattern, $lang, $pattern, $lang]);
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
@@ -16,7 +16,6 @@ function loadDynamicPicker(element) {
|
||||
let as_id;
|
||||
let submit_on_adding_new_entity;
|
||||
let label;
|
||||
let isCurrentUserPicker;
|
||||
const isMultiple = parseInt(el.dataset.multiple) === 1,
|
||||
uniqId = el.dataset.uniqid,
|
||||
input = element.querySelector(
|
||||
@@ -33,7 +32,6 @@ function loadDynamicPicker(element) {
|
||||
submit_on_adding_new_entity =
|
||||
parseInt(el.dataset.submitOnAddingNewEntity) === 1;
|
||||
label = el.dataset.label;
|
||||
isCurrentUserPicker = uniqId.startsWith("pick_user_or_me_dyn");
|
||||
|
||||
if (!isMultiple) {
|
||||
if (input.value === "[]") {
|
||||
@@ -50,7 +48,6 @@ function loadDynamicPicker(element) {
|
||||
':uniqid="uniqid" ' +
|
||||
':suggested="notPickedSuggested" ' +
|
||||
':label="label" ' +
|
||||
':isCurrentUserPicker="isCurrentUserPicker" ' +
|
||||
'@addNewEntity="addNewEntity" ' +
|
||||
'@removeEntity="removeEntity" ' +
|
||||
'@addNewEntityProcessEnded="addNewEntityProcessEnded"' +
|
||||
@@ -68,7 +65,6 @@ function loadDynamicPicker(element) {
|
||||
as_id,
|
||||
submit_on_adding_new_entity,
|
||||
label,
|
||||
isCurrentUserPicker,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@@ -97,8 +93,7 @@ function loadDynamicPicker(element) {
|
||||
const ids = this.picked.map((el) => el.id);
|
||||
input.value = ids.join(",");
|
||||
}
|
||||
console.log(this.picked);
|
||||
// console.log(entity);
|
||||
console.log(entity);
|
||||
}
|
||||
} else {
|
||||
if (
|
||||
|
@@ -1,25 +1,10 @@
|
||||
<template>
|
||||
<ul :class="listClasses" v-if="picked.length && displayPicked">
|
||||
<li v-for="p in picked" @click="removeEntity(p)" :key="p.type + p.id">
|
||||
<span
|
||||
v-if="'me' === p"
|
||||
class="chill_denomination current-user updatedBy"
|
||||
>{{ trans(USER_CURRENT_USER) }}</span
|
||||
>
|
||||
<span v-else class="chill_denomination">{{ p.text }}</span>
|
||||
<span class="chill_denomination">{{ p.text }}</span>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="record_actions">
|
||||
<li v-if="isCurrentUserPicker" class="btn btn-sm btn-misc">
|
||||
<label class="flex items-center gap-2">
|
||||
<input
|
||||
ref="itsMeCheckbox"
|
||||
:type="multiple ? 'checkbox' : 'radio'"
|
||||
@change="selectItsMe"
|
||||
/>
|
||||
{{ trans(USER_CURRENT_USER) }}
|
||||
</label>
|
||||
</li>
|
||||
<li class="add-persons">
|
||||
<add-persons
|
||||
:options="addPersonsOptions"
|
||||
@@ -39,83 +24,119 @@
|
||||
</ul>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed } from "vue";
|
||||
import AddPersons from "ChillPersonAssets/vuejs/_components/AddPersons.vue"; // eslint-disable-line
|
||||
<script>
|
||||
import AddPersons from "ChillPersonAssets/vuejs/_components/AddPersons.vue";
|
||||
import { appMessages } from "./i18n";
|
||||
import { trans, USER_CURRENT_USER } from "translator";
|
||||
|
||||
const props = defineProps({
|
||||
multiple: Boolean,
|
||||
types: Array,
|
||||
picked: Array,
|
||||
uniqid: String,
|
||||
removableIfSet: { type: Boolean, default: true },
|
||||
displayPicked: { type: Boolean, default: true },
|
||||
suggested: { type: Array, default: () => [] },
|
||||
label: String,
|
||||
isCurrentUserPicker: { type: Boolean, default: false },
|
||||
});
|
||||
export default {
|
||||
name: "PickEntity",
|
||||
props: {
|
||||
multiple: {
|
||||
type: Boolean,
|
||||
required: true,
|
||||
},
|
||||
types: {
|
||||
type: Array,
|
||||
required: true,
|
||||
},
|
||||
picked: {
|
||||
required: true,
|
||||
},
|
||||
uniqid: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
removableIfSet: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
displayPicked: {
|
||||
// display picked entities.
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
suggested: {
|
||||
type: Array,
|
||||
default: [],
|
||||
},
|
||||
label: {
|
||||
type: String,
|
||||
required: false,
|
||||
},
|
||||
},
|
||||
emits: ["addNewEntity", "removeEntity", "addNewEntityProcessEnded"],
|
||||
components: {
|
||||
AddPersons,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
key: "",
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
addPersonsOptions() {
|
||||
return {
|
||||
uniq: !this.multiple,
|
||||
type: this.types,
|
||||
priority: null,
|
||||
button: {
|
||||
size: "btn-sm",
|
||||
class: "btn-submit",
|
||||
},
|
||||
};
|
||||
},
|
||||
translatedListOfTypes() {
|
||||
if (this.label !== "") {
|
||||
return this.label;
|
||||
}
|
||||
|
||||
const emit = defineEmits([
|
||||
"addNewEntity",
|
||||
"removeEntity",
|
||||
"addNewEntityProcessEnded",
|
||||
]);
|
||||
let trans = [];
|
||||
this.types.forEach((t) => {
|
||||
if (this.$props.multiple) {
|
||||
trans.push(appMessages.fr.pick_entity[t].toLowerCase());
|
||||
} else {
|
||||
trans.push(
|
||||
appMessages.fr.pick_entity[t + "_one"].toLowerCase(),
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
const itsMeCheckbox = ref(null);
|
||||
const addPersons = ref(null);
|
||||
|
||||
const addPersonsOptions = computed(() => ({
|
||||
uniq: !props.multiple,
|
||||
type: props.types,
|
||||
priority: null,
|
||||
button: { size: "btn-sm", class: "btn-submit" },
|
||||
}));
|
||||
|
||||
const translatedListOfTypes = computed(() => {
|
||||
if (props.label) return props.label;
|
||||
let trans = props.types.map((t) =>
|
||||
props.multiple
|
||||
? appMessages.fr.pick_entity[t].toLowerCase()
|
||||
: appMessages.fr.pick_entity[t + "_one"].toLowerCase(),
|
||||
);
|
||||
return props.multiple
|
||||
? appMessages.fr.pick_entity.modal_title + trans.join(", ")
|
||||
: appMessages.fr.pick_entity.modal_title_one + trans.join(", ");
|
||||
});
|
||||
|
||||
const listClasses = computed(() => ({
|
||||
"list-suggest": true,
|
||||
"remove-items": props.removableIfSet,
|
||||
}));
|
||||
|
||||
const selectItsMe = (event) =>
|
||||
event.target.checked ? addNewSuggested("me") : removeEntity("me");
|
||||
|
||||
const addNewSuggested = (entity) => {
|
||||
emit("addNewEntity", { entity });
|
||||
};
|
||||
|
||||
const addNewEntity = ({ selected, modal }) => {
|
||||
selected.forEach((item) => emit("addNewEntity", { entity: item.result }));
|
||||
addPersons.value?.resetSearch();
|
||||
modal.showModal = false;
|
||||
emit("addNewEntityProcessEnded");
|
||||
};
|
||||
|
||||
const removeEntity = (entity) => {
|
||||
if (!props.removableIfSet) return;
|
||||
if (entity === "me" && itsMeCheckbox.value) {
|
||||
itsMeCheckbox.value.checked = false;
|
||||
}
|
||||
emit("removeEntity", { entity });
|
||||
if (this.$props.multiple) {
|
||||
return (
|
||||
appMessages.fr.pick_entity.modal_title + trans.join(", ")
|
||||
);
|
||||
} else {
|
||||
return (
|
||||
appMessages.fr.pick_entity.modal_title_one +
|
||||
trans.join(", ")
|
||||
);
|
||||
}
|
||||
},
|
||||
listClasses() {
|
||||
return {
|
||||
"list-suggest": true,
|
||||
"remove-items": this.$props.removableIfSet,
|
||||
};
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
addNewSuggested(entity) {
|
||||
this.$emit("addNewEntity", { entity: entity });
|
||||
},
|
||||
addNewEntity({ selected, modal }) {
|
||||
selected.forEach((item) => {
|
||||
this.$emit("addNewEntity", { entity: item.result });
|
||||
}, this);
|
||||
this.$refs.addPersons.resetSearch(); // to cast child method
|
||||
modal.showModal = false;
|
||||
this.$emit("addNewEntityProcessEnded");
|
||||
},
|
||||
removeEntity(entity) {
|
||||
if (!this.$props.removableIfSet) {
|
||||
return;
|
||||
}
|
||||
this.$emit("removeEntity", { entity: entity });
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.current-user {
|
||||
color: var(--bs-body-color);
|
||||
background-color: var(--bs-chill-l-gray) !important;
|
||||
}
|
||||
</style>
|
||||
|
@@ -45,10 +45,6 @@ const onPickGenericDoc = ({
|
||||
}) => {
|
||||
emit("pickGenericDoc", { genericDoc });
|
||||
};
|
||||
|
||||
const onRemoveAttachment = (payload: { attachment: WorkflowAttachment }) => {
|
||||
emit("removeAttachment", payload);
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -60,7 +56,7 @@ const onRemoveAttachment = (payload: { attachment: WorkflowAttachment }) => {
|
||||
></pick-generic-doc-modal>
|
||||
<attachment-list
|
||||
:attachments="props.attachments"
|
||||
@removeAttachment="onRemoveAttachment"
|
||||
@removeAttachment="(payload) => emit('removeAttachment', payload)"
|
||||
></attachment-list>
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
|
@@ -72,14 +72,6 @@ const placeTrans = (str: string): string => {
|
||||
}
|
||||
};
|
||||
|
||||
const onPickDocument = (payload: {
|
||||
genericDoc: GenericDocForAccompanyingPeriod;
|
||||
}) => emit("pickGenericDoc", payload);
|
||||
|
||||
const onRemoveGenericDoc = (payload: {
|
||||
genericDoc: GenericDocForAccompanyingPeriod;
|
||||
}) => emit("removeGenericDoc", payload);
|
||||
|
||||
const filteredDocuments = computed<GenericDocForAccompanyingPeriod[]>(() => {
|
||||
if (false === loaded.value) {
|
||||
return [];
|
||||
@@ -253,8 +245,10 @@ const filteredDocuments = computed<GenericDocForAccompanyingPeriod[]>(() => {
|
||||
:accompanying-period-id="accompanyingPeriodId"
|
||||
:genericDoc="g"
|
||||
:is-picked="isPicked(g)"
|
||||
@pickGenericDoc="onPickDocument"
|
||||
@removeGenericDoc="onRemoveGenericDoc"
|
||||
@pickGenericDoc="(payload) => emit('pickGenericDoc', payload)"
|
||||
@removeGenericDoc="
|
||||
(payload) => emit('removeGenericDoc', payload)
|
||||
"
|
||||
></pick-generic-doc-item>
|
||||
</div>
|
||||
<div v-else class="text-center chill-no-data-statement">
|
||||
|
@@ -34,7 +34,6 @@ class GenderDocGenNormalizer implements ContextAwareNormalizerInterface, Normali
|
||||
'id' => $gender->getId(),
|
||||
'label' => $this->translatableStringHelper->localize($gender->getLabel()),
|
||||
'genderTranslation' => $gender->getGenderTranslation(),
|
||||
'type' => 'chill_main_gender',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@@ -68,8 +68,8 @@ class AddressReferenceBEFromBestAddress
|
||||
$csv->setDelimiter(',');
|
||||
$csv->setHeaderOffset(0);
|
||||
|
||||
$stmt = new Statement();
|
||||
$stmt = $stmt->process($csv);
|
||||
$stmt = Statement::create()
|
||||
->process($csv);
|
||||
|
||||
foreach ($stmt as $record) {
|
||||
$this->baseImporter->importAddress(
|
||||
|
@@ -55,32 +55,32 @@ class AddressReferenceFromBAN
|
||||
|
||||
$csv = Reader::createFromStream($csvDecompressed);
|
||||
$csv->setDelimiter(';')->setHeaderOffset(0);
|
||||
$stmt = new Statement();
|
||||
$stmt = $stmt->process($csv, [
|
||||
'id',
|
||||
'id_fantoir',
|
||||
'numero',
|
||||
'rep',
|
||||
'nom_voie',
|
||||
'code_postal',
|
||||
'code_insee',
|
||||
'nom_commune',
|
||||
'code_insee_ancienne_commune',
|
||||
'nom_ancienne_commune',
|
||||
'x',
|
||||
'y',
|
||||
'lon',
|
||||
'lat',
|
||||
'type_position',
|
||||
'alias',
|
||||
'nom_ld',
|
||||
'libelle_acheminement',
|
||||
'nom_afnor',
|
||||
'source_position',
|
||||
'source_nom_voie',
|
||||
'certification_commune',
|
||||
'cad_parcelles',
|
||||
]);
|
||||
$stmt = Statement::create()
|
||||
->process($csv, [
|
||||
'id',
|
||||
'id_fantoir',
|
||||
'numero',
|
||||
'rep',
|
||||
'nom_voie',
|
||||
'code_postal',
|
||||
'code_insee',
|
||||
'nom_commune',
|
||||
'code_insee_ancienne_commune',
|
||||
'nom_ancienne_commune',
|
||||
'x',
|
||||
'y',
|
||||
'lon',
|
||||
'lat',
|
||||
'type_position',
|
||||
'alias',
|
||||
'nom_ld',
|
||||
'libelle_acheminement',
|
||||
'nom_afnor',
|
||||
'source_position',
|
||||
'source_nom_voie',
|
||||
'certification_commune',
|
||||
'cad_parcelles',
|
||||
]);
|
||||
|
||||
foreach ($stmt as $record) {
|
||||
$this->baseImporter->importAddress(
|
||||
|
@@ -43,17 +43,17 @@ class AddressReferenceFromBano
|
||||
|
||||
$csv = Reader::createFromStream($file);
|
||||
$csv->setDelimiter(',');
|
||||
$stmt = new Statement();
|
||||
$stmt = $stmt->process($csv, [
|
||||
'refId',
|
||||
'streetNumber',
|
||||
'street',
|
||||
'postcode',
|
||||
'city',
|
||||
'_o',
|
||||
'lat',
|
||||
'lon',
|
||||
]);
|
||||
$stmt = Statement::create()
|
||||
->process($csv, [
|
||||
'refId',
|
||||
'streetNumber',
|
||||
'street',
|
||||
'postcode',
|
||||
'city',
|
||||
'_o',
|
||||
'lat',
|
||||
'lon',
|
||||
]);
|
||||
|
||||
foreach ($stmt as $record) {
|
||||
$this->baseImporter->importAddress(
|
||||
|
@@ -54,8 +54,7 @@ class AddressReferenceLU
|
||||
|
||||
private function process_address(Reader $csv, ?string $sendAddressReportToEmail = null): void
|
||||
{
|
||||
$stmt = new Statement();
|
||||
$stmt = $stmt->process($csv);
|
||||
$stmt = Statement::create()->process($csv);
|
||||
foreach ($stmt as $record) {
|
||||
$this->addressBaseImporter->importAddress(
|
||||
$record['id_geoportail'],
|
||||
@@ -75,8 +74,7 @@ class AddressReferenceLU
|
||||
|
||||
private function process_postal_code(Reader $csv): void
|
||||
{
|
||||
$stmt = new Statement();
|
||||
$stmt = $stmt->process($csv);
|
||||
$stmt = Statement::create()->process($csv);
|
||||
$arr_postal_codes = [];
|
||||
foreach ($stmt as $record) {
|
||||
if (false === \array_key_exists($record['code_postal'], $arr_postal_codes)) {
|
||||
|
@@ -61,7 +61,6 @@ final class GenderDocGenNormalizerTest extends TestCase
|
||||
'id' => 1,
|
||||
'label' => 'homme',
|
||||
'genderTranslation' => GenderEnum::MALE,
|
||||
'type' => 'chill_main_gender',
|
||||
];
|
||||
|
||||
$this->assertEquals($expected, $this->normalizer->normalize($gender));
|
||||
|
@@ -943,16 +943,6 @@ paths:
|
||||
description: "ok"
|
||||
401:
|
||||
description: "Unauthorized"
|
||||
/1.0/main/gender.json:
|
||||
get:
|
||||
tags:
|
||||
- gender
|
||||
summary: Return all gender types
|
||||
responses:
|
||||
200:
|
||||
description: "ok"
|
||||
401:
|
||||
description: "Unauthorized"
|
||||
/1.0/main/user-job.json:
|
||||
get:
|
||||
tags:
|
||||
|
@@ -2,6 +2,7 @@ services:
|
||||
_defaults:
|
||||
autowire: true
|
||||
autoconfigure: true
|
||||
public: false
|
||||
|
||||
Chill\MainBundle\Controller\:
|
||||
resource: '../../Controller'
|
||||
|
@@ -49,7 +49,6 @@ Name: Nom
|
||||
Label: Nom
|
||||
|
||||
user:
|
||||
current_user: Utilisateur courant
|
||||
profile:
|
||||
title: Mon profil
|
||||
Phonenumber successfully updated!: Numéro de téléphone mis à jour!
|
||||
|
@@ -29,6 +29,7 @@ use Chill\PersonBundle\Repository\AccompanyingPeriod\AccompanyingPeriodWorkRepos
|
||||
use Chill\PersonBundle\Repository\AccompanyingPeriodRepository;
|
||||
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter;
|
||||
use Chill\ThirdPartyBundle\Entity\ThirdParty;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
@@ -46,7 +47,10 @@ use Symfony\Component\Workflow\Registry;
|
||||
|
||||
final class AccompanyingCourseApiController extends ApiController
|
||||
{
|
||||
public function __construct(private readonly AccompanyingPeriodRepository $accompanyingPeriodRepository, private readonly EventDispatcherInterface $eventDispatcher, private readonly ReferralsSuggestionInterface $referralAvailable, private readonly Registry $registry, private readonly ValidatorInterface $validator, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry, private readonly AccompanyingPeriodWorkRepository $accompanyingPeriodWorkRepository) {}
|
||||
public function __construct(private readonly AccompanyingPeriodRepository $accompanyingPeriodRepository, private readonly EventDispatcherInterface $eventDispatcher, private readonly ReferralsSuggestionInterface $referralAvailable, private readonly Registry $registry, private readonly ValidatorInterface $validator, protected ManagerRegistry $managerRegistry, private readonly AccompanyingPeriodWorkRepository $accompanyingPeriodWorkRepository)
|
||||
{
|
||||
parent::__construct($managerRegistry);
|
||||
}
|
||||
|
||||
public function commentApi($id, Request $request, string $_format): Response
|
||||
{
|
||||
|
@@ -16,6 +16,7 @@ use Chill\MainBundle\Entity\User;
|
||||
use Chill\MainBundle\Serializer\Model\Collection;
|
||||
use Chill\MainBundle\Serializer\Model\Counter;
|
||||
use Chill\PersonBundle\Repository\AccompanyingPeriod\AccompanyingPeriodWorkRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
||||
@@ -27,7 +28,10 @@ class AccompanyingCourseWorkApiController extends ApiController
|
||||
public function __construct(
|
||||
private readonly AccompanyingPeriodWorkRepository $accompanyingPeriodWorkRepository,
|
||||
private readonly Security $security,
|
||||
) {}
|
||||
ManagerRegistry $managerRegistry,
|
||||
) {
|
||||
parent::__construct($managerRegistry);
|
||||
}
|
||||
|
||||
#[Route(path: '/api/1.0/person/accompanying-period/work/my-near-end')]
|
||||
public function myWorksNearEndDate(Request $request): JsonResponse
|
||||
|
@@ -12,5 +12,12 @@ declare(strict_types=1);
|
||||
namespace Chill\PersonBundle\Controller;
|
||||
|
||||
use Chill\MainBundle\CRUD\Controller\ApiController;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
class AccompanyingPeriodCommentApiController extends ApiController {}
|
||||
class AccompanyingPeriodCommentApiController extends ApiController
|
||||
{
|
||||
public function __construct(protected ManagerRegistry $managerRegistry)
|
||||
{
|
||||
parent::__construct($managerRegistry);
|
||||
}
|
||||
}
|
||||
|
@@ -12,5 +12,12 @@ declare(strict_types=1);
|
||||
namespace Chill\PersonBundle\Controller;
|
||||
|
||||
use Chill\MainBundle\CRUD\Controller\ApiController;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
class AccompanyingPeriodResourceApiController extends ApiController {}
|
||||
class AccompanyingPeriodResourceApiController extends ApiController
|
||||
{
|
||||
public function __construct(protected ManagerRegistry $managerRegistry)
|
||||
{
|
||||
parent::__construct($managerRegistry);
|
||||
}
|
||||
}
|
||||
|
@@ -22,6 +22,7 @@ use Chill\PersonBundle\Event\Person\PersonAddressMoveEvent;
|
||||
use Chill\PersonBundle\Repository\Household\HouseholdACLAwareRepositoryInterface;
|
||||
use Chill\PersonBundle\Repository\Household\HouseholdRepository;
|
||||
use Chill\PersonBundle\Security\Authorization\HouseholdVoter;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
@@ -31,7 +32,10 @@ use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
|
||||
|
||||
class HouseholdApiController extends ApiController
|
||||
{
|
||||
public function __construct(private readonly EventDispatcherInterface $eventDispatcher, private readonly HouseholdRepository $householdRepository, private readonly HouseholdACLAwareRepositoryInterface $householdACLAwareRepository, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {}
|
||||
public function __construct(private readonly EventDispatcherInterface $eventDispatcher, private readonly HouseholdRepository $householdRepository, private readonly HouseholdACLAwareRepositoryInterface $householdACLAwareRepository, protected ManagerRegistry $managerRegistry)
|
||||
{
|
||||
parent::__construct($managerRegistry);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Symfony\Component\HttpFoundation\JsonResponse
|
||||
|
@@ -13,10 +13,16 @@ namespace Chill\PersonBundle\Controller;
|
||||
|
||||
use Chill\MainBundle\CRUD\Controller\ApiController;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
class HouseholdCompositionTypeApiController extends ApiController
|
||||
{
|
||||
public function __construct(protected ManagerRegistry $managerRegistry)
|
||||
{
|
||||
parent::__construct($managerRegistry);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param QueryBuilder $query
|
||||
*/
|
||||
|
@@ -23,6 +23,7 @@ use Chill\PersonBundle\Repository\Household\PositionRepository;
|
||||
use Chill\PersonBundle\Repository\PersonRepository;
|
||||
use Chill\PersonBundle\Security\Authorization\HouseholdVoter;
|
||||
use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
||||
@@ -47,9 +48,10 @@ class HouseholdMemberController extends ApiController
|
||||
private readonly HouseholdRepository $householdRepository,
|
||||
private readonly Security $security,
|
||||
private readonly PositionRepository $positionRepository,
|
||||
private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry,
|
||||
protected ParameterBagInterface $parameterBag,
|
||||
ManagerRegistry $managerRegistry,
|
||||
) {
|
||||
parent::__construct($managerRegistry);
|
||||
$this->household_fields_visibility = $parameterBag->get('chill_person.household_fields');
|
||||
}
|
||||
|
||||
|
@@ -12,10 +12,16 @@ declare(strict_types=1);
|
||||
namespace Chill\PersonBundle\Controller;
|
||||
|
||||
use Chill\MainBundle\CRUD\Controller\ApiController;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
class OpeningApiController extends ApiController
|
||||
{
|
||||
public function __construct(protected ManagerRegistry $managerRegistry)
|
||||
{
|
||||
parent::__construct($managerRegistry);
|
||||
}
|
||||
|
||||
protected function customizeQuery(string $action, Request $request, $qb): void
|
||||
{
|
||||
$qb->where($qb->expr()->gt('e.noActiveAfter', ':now'))
|
||||
|
@@ -18,6 +18,7 @@ use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
||||
use Chill\PersonBundle\Security\AuthorizedCenterOnPersonCreationInterface;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
|
||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
@@ -32,7 +33,9 @@ class PersonApiController extends ApiController
|
||||
private readonly AuthorizedCenterOnPersonCreationInterface $authorizedCenterOnPersonCreation,
|
||||
private readonly ConfigPersonAltNamesHelper $configPersonAltNameHelper,
|
||||
ParameterBagInterface $parameterBag,
|
||||
ManagerRegistry $managerRegistry,
|
||||
) {
|
||||
parent::__construct($managerRegistry);
|
||||
$this->showCenters = $parameterBag->get('chill_main')['acl']['form_show_centers'];
|
||||
}
|
||||
|
||||
|
@@ -12,5 +12,12 @@ declare(strict_types=1);
|
||||
namespace Chill\PersonBundle\Controller;
|
||||
|
||||
use Chill\MainBundle\CRUD\Controller\ApiController;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
class RelationApiController extends ApiController {}
|
||||
class RelationApiController extends ApiController
|
||||
{
|
||||
public function __construct(protected ManagerRegistry $managerRegistry)
|
||||
{
|
||||
parent::__construct($managerRegistry);
|
||||
}
|
||||
}
|
||||
|
@@ -15,12 +15,16 @@ use Chill\MainBundle\CRUD\Controller\ApiController;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\Repository\Relationships\RelationshipRepository;
|
||||
use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class RelationshipApiController extends ApiController
|
||||
{
|
||||
public function __construct(private readonly RelationshipRepository $repository) {}
|
||||
public function __construct(private readonly RelationshipRepository $repository, ManagerRegistry $managerRegistry)
|
||||
{
|
||||
parent::__construct($managerRegistry);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ParamConverter("person", options={"id": "person_id"})
|
||||
|
@@ -13,10 +13,16 @@ namespace Chill\PersonBundle\Controller;
|
||||
|
||||
use Chill\MainBundle\CRUD\Controller\ApiController;
|
||||
use Chill\MainBundle\Pagination\PaginatorInterface;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
class SocialIssueApiController extends ApiController
|
||||
{
|
||||
public function __construct(protected ManagerRegistry $managerRegistry)
|
||||
{
|
||||
parent::__construct($managerRegistry);
|
||||
}
|
||||
|
||||
protected function customizeQuery(string $action, Request $request, $query): void
|
||||
{
|
||||
$query->where(
|
||||
|
@@ -16,12 +16,16 @@ use Chill\MainBundle\Pagination\PaginatorFactory;
|
||||
use Chill\MainBundle\Serializer\Model\Collection;
|
||||
use Chill\PersonBundle\Entity\SocialWork\SocialAction;
|
||||
use Chill\PersonBundle\Repository\SocialWork\GoalRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class SocialWorkGoalApiController extends ApiController
|
||||
{
|
||||
public function __construct(private readonly GoalRepository $goalRepository, private readonly PaginatorFactory $paginator) {}
|
||||
public function __construct(private readonly GoalRepository $goalRepository, private readonly PaginatorFactory $paginator, ManagerRegistry $managerRegistry)
|
||||
{
|
||||
parent::__construct($managerRegistry);
|
||||
}
|
||||
|
||||
public function listBySocialAction(Request $request, SocialAction $action): Response
|
||||
{
|
||||
|
@@ -16,12 +16,16 @@ use Chill\MainBundle\Serializer\Model\Collection;
|
||||
use Chill\PersonBundle\Entity\SocialWork\Goal;
|
||||
use Chill\PersonBundle\Entity\SocialWork\SocialAction;
|
||||
use Chill\PersonBundle\Repository\SocialWork\ResultRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class SocialWorkResultApiController extends ApiController
|
||||
{
|
||||
public function __construct(private readonly ResultRepository $resultRepository) {}
|
||||
public function __construct(private readonly ResultRepository $resultRepository, ManagerRegistry $managerRegistry)
|
||||
{
|
||||
parent::__construct($managerRegistry);
|
||||
}
|
||||
|
||||
public function listByGoal(Request $request, Goal $goal): Response
|
||||
{
|
||||
|
@@ -16,6 +16,7 @@ use Chill\MainBundle\Pagination\PaginatorFactory;
|
||||
use Chill\MainBundle\Serializer\Model\Collection;
|
||||
use Chill\PersonBundle\Entity\SocialWork\SocialAction;
|
||||
use Chill\PersonBundle\Repository\SocialWork\SocialIssueRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Symfony\Component\Clock\ClockInterface;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
@@ -26,7 +27,10 @@ final class SocialWorkSocialActionApiController extends ApiController
|
||||
private readonly SocialIssueRepository $socialIssueRepository,
|
||||
private readonly PaginatorFactory $paginator,
|
||||
private readonly ClockInterface $clock,
|
||||
) {}
|
||||
ManagerRegistry $managerRegistry,
|
||||
) {
|
||||
parent::__construct($managerRegistry);
|
||||
}
|
||||
|
||||
public function listBySocialIssueApi($id, Request $request)
|
||||
{
|
||||
|
@@ -13,7 +13,7 @@ namespace Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters;
|
||||
|
||||
use Chill\MainBundle\Export\FilterInterface;
|
||||
use Chill\MainBundle\Form\Type\PickRollingDateType;
|
||||
use Chill\MainBundle\Form\Type\PickUserOrMeDynamicType;
|
||||
use Chill\MainBundle\Form\Type\PickUserDynamicType;
|
||||
use Chill\MainBundle\Service\RollingDate\RollingDate;
|
||||
use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface;
|
||||
use Chill\PersonBundle\Export\Declarations;
|
||||
@@ -66,7 +66,7 @@ class ReferrerFilter implements FilterInterface
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
{
|
||||
$builder
|
||||
->add('accepted_referrers', PickUserOrMeDynamicType::class, [
|
||||
->add('accepted_referrers', PickUserDynamicType::class, [
|
||||
'multiple' => true,
|
||||
])
|
||||
->add('date_calc', PickRollingDateType::class, [
|
||||
|
@@ -33,7 +33,18 @@ const getUserJobs = () => fetchResults("/api/1.0/main/user-job.json");
|
||||
|
||||
const getSocialIssues = () => {
|
||||
const url = `/api/1.0/person/social-work/social-issue.json`;
|
||||
return fetchResults(url);
|
||||
return fetch(url).then((response) => {
|
||||
if (response.ok) {
|
||||
return response.json();
|
||||
}
|
||||
throw {
|
||||
msg: "Error while retriving Social Issues.",
|
||||
sta: response.status,
|
||||
txt: response.statusText,
|
||||
err: new Error(),
|
||||
body: response.body,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
const whoami = () => {
|
||||
|
@@ -29,7 +29,7 @@
|
||||
|
||||
<script>
|
||||
import VueMultiselect from "vue-multiselect";
|
||||
import { fetchResults } from "ChillMainAssets/lib/api/apiMethods";
|
||||
import { makeFetch } from "ChillMainAssets/lib/api/apiMethods";
|
||||
import { mapGetters, mapState } from "vuex";
|
||||
|
||||
export default {
|
||||
@@ -51,11 +51,16 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
getOptions() {
|
||||
fetchResults(`/api/1.0/person/social-work/social-issue.json`).then(
|
||||
(response) => {
|
||||
this.options = response;
|
||||
},
|
||||
);
|
||||
const url = `/api/1.0/person/social-work/social-issue.json`;
|
||||
makeFetch("GET", url)
|
||||
.then((response) => {
|
||||
this.options = response.results;
|
||||
return response;
|
||||
})
|
||||
.catch((error) => {
|
||||
commit("catchError", error);
|
||||
this.$toast.open({ message: error.txt });
|
||||
});
|
||||
},
|
||||
updateSocialIssues(value) {
|
||||
this.$store
|
||||
|
@@ -6,7 +6,7 @@ import {
|
||||
} from "ChillMainAssets/chill/js/date";
|
||||
import { findSocialActionsBySocialIssue } from "ChillPersonAssets/vuejs/_api/SocialWorkSocialAction.js";
|
||||
// import { create } from 'ChillPersonAssets/vuejs/_api/AccompanyingCourseWork.js';
|
||||
import { fetchResults, makeFetch } from "ChillMainAssets/lib/api/apiMethods";
|
||||
import { makeFetch } from "ChillMainAssets/lib/api/apiMethods";
|
||||
|
||||
const debug = process.env.NODE_ENV !== "production";
|
||||
|
||||
@@ -168,9 +168,9 @@ const store = createStore({
|
||||
},
|
||||
fetchOtherSocialIssues({ commit }) {
|
||||
const url = `/api/1.0/person/social-work/social-issue.json`;
|
||||
return fetchResults(url)
|
||||
return makeFetch("GET", url)
|
||||
.then((response) => {
|
||||
commit("updateIssuesOther", response); // Directly commit the array of issues
|
||||
commit("updateIssuesOther", response.results);
|
||||
})
|
||||
.catch((error) => {
|
||||
throw error;
|
||||
|
@@ -12,5 +12,12 @@ declare(strict_types=1);
|
||||
namespace Chill\ThirdPartyBundle\Controller;
|
||||
|
||||
use Chill\MainBundle\CRUD\Controller\ApiController;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
class ThirdPartyApiController extends ApiController {}
|
||||
class ThirdPartyApiController extends ApiController
|
||||
{
|
||||
public function __construct(protected ManagerRegistry $managerRegistry)
|
||||
{
|
||||
parent::__construct($managerRegistry);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user