Skip to content

Commit

Permalink
Nisha bug fixes (#11)
Browse files Browse the repository at this point in the history
* Fixed side bar shrink & expand on click issue

* fixed all routes delete issue- toast message & double delete

* Added browers default reload behaviour on each form

* Added soft reload for login form

* Added pagination & sorting on lab record type

* Done code clening

* Added import functionality for assessment template

* Added temp folder for temporary holding assessment template

* Import assessment refinement - location for local storage is added

---------

Co-authored-by: Dattatraya-Londhe <londhedn@gmail.com>
  • Loading branch information
nisha-inflectionzone and Dattatraya-Londhe authored Dec 1, 2023
1 parent 8550713 commit f4f2cc6
Show file tree
Hide file tree
Showing 167 changed files with 882 additions and 313 deletions.
3 changes: 1 addition & 2 deletions src/lib/components/navbar/sidebar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
export let userId = undefined;
export let showSidebar = false;
const navData = [
{
title: 'Dashboard',
Expand Down Expand Up @@ -216,7 +215,7 @@
>
<Accordion
width="w-[280px]"
autocollapse
autocollapse:false
rounded="rounded-none"
>
{#each navData as navParent, idx}
Expand Down
2 changes: 2 additions & 0 deletions src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { browser } from '$app/environment';
import { personRolesStore, genderTypesStore } from '$lib/store/general.store';
import type { PageServerData } from './$types';
import { enhance } from '$app/forms';
export let data: PageServerData;
personRolesStore.set(data.roles);
Expand Down Expand Up @@ -41,6 +42,7 @@
method="post"
action="?/login"
class=" shadow-bottom-right p-8 pb-1 pt-5 rounded-lg mt-5 bg-secondary-50"
use:enhance
>
<!-- <input class="hidden" type="number" name="loginRoleId" value={loginRoleId}> -->
<div class="hidden">
Expand Down
22 changes: 15 additions & 7 deletions src/routes/api/server/api-client/+server.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
import type { RequestEvent } from '@sveltejs/kit';
import { deleteApiClient } from '../../services/api-clients';
import { errorMessage, successMessage } from '$lib/utils/message.utils';
import { redirect } from 'sveltekit-flash-message/server';

//////////////////////////////////////////////////////////////

export const DELETE = async (event: RequestEvent) => {
const request = event.request;
const data = await request.json();
try {
console.log('Inside api client server endpoints');
const response = await deleteApiClient(data.sessionId, data.apiClientId);
return new Response(response.message);
} catch (err) {
console.error(`Error deleting api-client: ${err.message}`);
return new Response(err.message);
console.log('Inside api client server endpoints');
let response;
try{
response = await deleteApiClient(data.sessionId, data.apiClientId);
}catch(error){
throw redirect(
errorMessage('Error deleting api-client.'),
event
);
}
throw redirect(
successMessage(response.Message),
event
);
};
26 changes: 18 additions & 8 deletions src/routes/api/server/assessment-templates/+server.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,28 @@
import type { RequestEvent } from '@sveltejs/kit';
import { deleteAssessmentTemplate } from '../../services/assessment-templates';
import { errorMessage, successMessage } from '$lib/utils/message.utils';
import { redirect } from 'sveltekit-flash-message/server';

//////////////////////////////////////////////////////////////

export const DELETE = async (event: RequestEvent) => {
const request = event.request;
const data = await request.json();

try {
console.log('Inside assessment template server endpoints');
const response = await deleteAssessmentTemplate(data.sessionId, data.assessmentTemplateId);
return new Response(response.message);
} catch (err) {
console.error(`Error deleting assessment template: ${err.message}`);
return new Response(err.message);
console.log('Inside assessment template server endpoints');
let response;
try{
response = await deleteAssessmentTemplate(
data.sessionId,
data.assessmentTemplateId
);
}catch(error){
throw redirect(
errorMessage('Error deleting assessment template.'),
event
);
}
throw redirect(
successMessage(response.Message),
event
);
};
22 changes: 15 additions & 7 deletions src/routes/api/server/careplan/assets/+server.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@

import { errorMessage, successMessage } from "$lib/utils/message.utils";
import { deleteAsset } from "$routes/api/services/careplan/assets/action-plan";
import type { RequestEvent } from "@sveltejs/kit";
import { redirect } from "sveltekit-flash-message/server";

//////////////////////////////////////////////////////////////

Expand All @@ -9,16 +11,22 @@ export const DELETE = async (event: RequestEvent) => {
console.log("request----------",request);
const data = await request.json();
console.log("data----------",data);
try {
console.log('Inside assets server endpoints');
const response = await deleteAsset(
console.log('Inside assets server endpoints');
let response;
try{
response = await deleteAsset(
data.sessionId,
data.selectAsset,
data.assetId,
);
return new Response(response.message);
} catch (err) {
console.error(`Error deleting asset: ${err.message}`);
return new Response(err.message);
}catch(error){
throw redirect(
errorMessage('Error deleting asset.'),
event
);
}
throw redirect(
successMessage(response.Message),
event
);
};
24 changes: 16 additions & 8 deletions src/routes/api/server/careplan/careplans/+server.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { errorMessage, successMessage } from "$lib/utils/message.utils";
import { deleteCareplan } from "$routes/api/services/careplan/careplans";
import type { RequestEvent } from "@sveltejs/kit";
import { redirect } from "sveltekit-flash-message/server";

//////////////////////////////////////////////////////////////

Expand All @@ -8,15 +10,21 @@ export const DELETE = async (event: RequestEvent) => {
console.log("request----------",request);
const data = await request.json();
console.log("data",data );
try {
console.log('Inside careplan server endpoints');
const response = await deleteCareplan(
console.log('Inside careplan server endpoints');
let response;
try{
response = await deleteCareplan(
data.sessionId,
data.careplanId
);
return new Response(response.message);
} catch (err) {
console.error(`Error deleting careplan: ${err.message}`);
return new Response(err.message);
}
}catch(error){
throw redirect(
errorMessage('Error deleting careplan.'),
event
);
}
throw redirect(
successMessage(response.Message),
event
);
};
23 changes: 15 additions & 8 deletions src/routes/api/server/cohorts/+server.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
import { errorMessage, successMessage } from '$lib/utils/message.utils';
import { deleteCohort } from '$routes/api/services/cohorts';
import type { RequestEvent } from '@sveltejs/kit';
import { redirect } from 'sveltekit-flash-message/server';

//////////////////////////////////////////////////////////////

export const DELETE = async (event: RequestEvent) => {
const request = event.request;
const data = await request.json();

try {
console.log('Inside cohort server endpoints');
const response = await deleteCohort(data.sessionId, data.cohortId);
return new Response(response.message);
} catch (err) {
console.error(`Error deleting cohort: ${err.message}`);
return new Response(err.message);
console.log('Inside cohort server endpoints');
let response;
try{
response = await deleteCohort(data.sessionId, data.cohortId);
}catch(error){
throw redirect(
errorMessage('Error deleting cohort.'),
event
);
}
throw redirect(
successMessage(response.Message),
event
);
};
23 changes: 15 additions & 8 deletions src/routes/api/server/courses/+server.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
import type { RequestEvent } from '@sveltejs/kit';
import { deleteCourse } from '../../services/courses';
import { errorMessage, successMessage } from '$lib/utils/message.utils';
import { redirect } from 'sveltekit-flash-message/server';

//////////////////////////////////////////////////////////////

export const DELETE = async (event: RequestEvent) => {
const request = event.request;
const data = await request.json();

try {
console.log('Inside course server endpoints');
const response = await deleteCourse(data.sessionId, data.courseId);
return new Response(response.message);
} catch (err) {
console.error(`Error deleting course: ${err.message}`);
return new Response(err.message);
console.log('Inside course server endpoints');
let response;
try{
response = await deleteCourse(data.sessionId, data.courseId);
}catch(error){
throw redirect(
errorMessage('Error deleting course.'),
event
);
}
throw redirect(
successMessage(response.Message),
event
);
};
23 changes: 15 additions & 8 deletions src/routes/api/server/custom-query/delete/+server.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
import { errorMessage, successMessage } from '$lib/utils/message.utils';
import { deleteQuery } from '$routes/api/services/custom.query';
import type { RequestEvent } from '@sveltejs/kit';
import { redirect } from 'sveltekit-flash-message/server';

//////////////////////////////////////////////////////////////

export const DELETE = async (event: RequestEvent) => {
const request = event.request;
const data = await request.json();

try {
console.log('Inside query server endpoints');
const response = await deleteQuery(data.sessionId, data.queryId);
return new Response(response.message);
} catch (err) {
console.error(`Error deleting query: ${err.message}`);
return new Response(err.message);
console.log('Inside query server endpoints');
let response;
try{
response = await deleteQuery(data.sessionId, data.queryId);
}catch(error){
throw redirect(
errorMessage('Error deleting query.'),
event
);
}
throw redirect(
successMessage(response.Message),
event
);
};
23 changes: 15 additions & 8 deletions src/routes/api/server/drugs/+server.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
import type { RequestEvent } from '@sveltejs/kit';
import { deleteDrug } from '../../services/drugs';
import { errorMessage, successMessage } from '$lib/utils/message.utils';
import { redirect } from 'sveltekit-flash-message/server';

//////////////////////////////////////////////////////////////

export const DELETE = async (event: RequestEvent) => {
const request = event.request;
const data = await request.json();

try {
console.log('Inside drug server endpoints');
const response = await deleteDrug(data.sessionId, data.drugId);
return new Response(response.message);
} catch (err) {
console.error(`Error deleting drug: ${err.message}`);
return new Response(err.message);
console.log('Inside drug server endpoints');
let response;
try{
response = await deleteDrug(data.sessionId, data.drugId);
}catch(error){
throw redirect(
errorMessage('Error deleting drug.'),
event
);
}
throw redirect(
successMessage(response.Message),
event
);
};
22 changes: 15 additions & 7 deletions src/routes/api/server/gamification/badge-categories/+server.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
import { errorMessage, successMessage } from '$lib/utils/message.utils';
import { deleteBadgeCategory } from '$routes/api/services/gamification/badge.category';
import type { RequestEvent } from '@sveltejs/kit';
import { redirect } from 'sveltekit-flash-message/server';

//////////////////////////////////////////////////////////////

export const DELETE = async (event: RequestEvent) => {
const request = event.request;
const data = await request.json();
try {
console.log('Inside badge category server endpoints');
const response = await deleteBadgeCategory(data.sessionId, data.badgeCategoryId);
return new Response(response.message);
} catch (err) {
console.error(`Error deleting badge category: ${err.message}`);
return new Response(err.message);
console.log('Inside badge category server endpoints');
let response;
try{
response = await deleteBadgeCategory(data.sessionId, data.badgeCategoryId);
}catch(error){
throw redirect(
errorMessage('Error deleting badge category.'),
event
);
}
throw redirect(
successMessage(response.Message),
event
);
};
22 changes: 15 additions & 7 deletions src/routes/api/server/gamification/badges/+server.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
import { errorMessage, successMessage } from '$lib/utils/message.utils';
import { deleteBadge } from '$routes/api/services/gamification/badge';
import type { RequestEvent } from '@sveltejs/kit';
import { redirect } from 'sveltekit-flash-message/server';

//////////////////////////////////////////////////////////////

export const DELETE = async (event: RequestEvent) => {
const request = event.request;
const data = await request.json();
try {
console.log('Inside badge server endpoints');
const response = await deleteBadge(data.sessionId, data.badgeId);
return new Response(response.message);
} catch (err) {
console.error(`Error deleting badge: ${err.message}`);
return new Response(err.message);
console.log('Inside badge server endpoints');
let response;
try{
response = await deleteBadge(data.sessionId, data.badgeId);
}catch(error){
throw redirect(
errorMessage('Error deleting badge.'),
event
);
}
throw redirect(
successMessage(response.Message),
event
);
};
Loading

0 comments on commit f4f2cc6

Please sign in to comment.