Merge branch 'front_foundation' of https://gitea.piair.dev/piair/MyINPulse into front_foundation

This commit is contained in:
ALAMI Adnane 2025-05-06 22:38:28 +02:00
commit ae36549de9
3 changed files with 48 additions and 26 deletions

View File

@ -1,13 +1,8 @@
spring.application.name=myinpulse spring.application.name=myinpulse
spring.security.oauth2.resourceserver.jwt.jwk-set-uri=http://localhost:7080/realms/test/protocol/openid-connect/certs spring.security.oauth2.resourceserver.jwt.jwk-set-uri=http://localhost:7080/realms/test/protocol/openid-connect/certs
spring.security.oauth2.resourceserver.jwt.issuer-uri=http://localhost:7080/realms/test spring.security.oauth2.resourceserver.jwt.issuer-uri=http://localhost:7080/realms/test
spring.datasource.url=jdbc:postgresql://${DATABASE_URL}/${BACKEND_DB}
spring.datasource.username=${BACKEND_USER}
spring.datasource.password=${BACKEND_PASSWORD}
spring.jpa.hibernate.ddl-auto=update
logging.pattern.console=%d{yyyy-MMM-dd HH:mm:ss.SSS} [%thread] %highlight(%-5level) %cyan(%logger{15}) - %msg %n logging.pattern.console=%d{yyyy-MMM-dd HH:mm:ss.SSS} [%thread] %highlight(%-5level) %cyan(%logger{15}) - %msg %n
spring.datasource.url=jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
spring.jpa.hibernate.ddl-auto=create

View File

@ -0,0 +1,13 @@
spring.application.name=myinpulse
spring.security.oauth2.resourceserver.jwt.jwk-set-uri=http://localhost:7080/realms/test/protocol/openid-connect/certs
spring.security.oauth2.resourceserver.jwt.issuer-uri=http://localhost:7080/realms/test
logging.pattern.console=%d{yyyy-MMM-dd HH:mm:ss.SSS} [%thread] %highlight(%-5level) %cyan(%logger{15}) - %msg %n
spring.datasource.url=jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
spring.jpa.hibernate.ddl-auto=create

View File

@ -37,6 +37,11 @@
</template> </template>
<script> <script>
import {
createAppointmentReport,
updateAppointmentReport,
} from "@/services/Apis/Admin";
export default { export default {
name: "AdminAppointmentsComponent", name: "AdminAppointmentsComponent",
data() { data() {
@ -63,28 +68,21 @@ export default {
this.appointmentId--; this.appointmentId--;
} }
}, },
async submitReport() { submitReport() {
const reportData = { const reportData = { content: this.reportContent };
reportContent: this.reportContent, const onSuccess = (response) => {
};
const url = `/admin/appointments/report/${this.appointmentId}`;
const method = this.isUpdate ? "PUT" : "POST";
try {
const response = await this.$axios({
method,
url,
data: reportData,
});
if (response.status === 201 || response.status === 200) { if (response.status === 201 || response.status === 200) {
this.responseMessage = this.responseMessage =
"Rapport " + "Rapport " +
(this.isUpdate ? "mis à jour" : "créé") + (this.isUpdate ? "mis à jour" : "créé") +
" avec succès."; " avec succès.";
} }
} catch (error) { };
const onError = (error) => {
console.error(
"Erreur lors de l'envoi du rapport :",
error.response || error.message
);
if (error.response && error.response.status === 400) { if (error.response && error.response.status === 400) {
this.responseMessage = this.responseMessage =
"Requête invalide. Vérifiez les informations."; "Requête invalide. Vérifiez les informations.";
@ -95,6 +93,22 @@ export default {
this.responseMessage = this.responseMessage =
"Une erreur est survenue. Veuillez réessayer."; "Une erreur est survenue. Veuillez réessayer.";
} }
};
if (this.isUpdate) {
updateAppointmentReport(
this.appointmentId,
reportData,
onSuccess,
onError
);
} else {
createAppointmentReport(
this.appointmentId,
reportData,
onSuccess,
onError
);
} }
}, },
}, },