2023-11-10 14:05:15 +08:00
|
|
|
import Swal from 'sweetalert2';
|
|
|
|
|
2024-06-29 21:19:21 +08:00
|
|
|
import { WORKSHEET_UPDATE } from '@/graphql/operations/worksheet.mutations';
|
2023-11-10 14:05:15 +08:00
|
|
|
import { useApiUtil } from './';
|
|
|
|
|
|
|
|
export default function useWorkSheetComposable() {
|
|
|
|
const { withClientMutation } = useApiUtil();
|
|
|
|
|
|
|
|
// unAssign Analyses
|
|
|
|
const unAssignSamples = async (uids: string[]) => {
|
|
|
|
try {
|
|
|
|
Swal.fire({
|
|
|
|
title: 'Are you sure?',
|
|
|
|
text: 'You want to Un-Assign these analyses',
|
|
|
|
icon: 'warning',
|
|
|
|
showCancelButton: true,
|
|
|
|
confirmButtonColor: '#3085d6',
|
|
|
|
cancelButtonColor: '#d33',
|
|
|
|
confirmButtonText: 'Yes, Un-Assign now!',
|
|
|
|
cancelButtonText: 'No, cancel UnAssign!',
|
|
|
|
}).then(async result => {
|
|
|
|
if (result.isConfirmed) {
|
|
|
|
await withClientMutation(WORKSHEET_UPDATE, uids, 'updateWorksheet').then(payload => {});
|
|
|
|
|
|
|
|
Swal.fire('Its Happening!', 'Selected analyses have been UnAssigned.', 'success').then(_ => location.reload());
|
|
|
|
}
|
|
|
|
});
|
|
|
|
} catch (error) {}
|
|
|
|
};
|
|
|
|
|
|
|
|
return {
|
|
|
|
unAssignSamples,
|
|
|
|
};
|
|
|
|
}
|