mirror of
https://github.com/beak-insights/felicity-lims.git
synced 2025-02-23 00:12:54 +08:00
35 lines
1.2 KiB
TypeScript
35 lines
1.2 KiB
TypeScript
|
import Swal from 'sweetalert2';
|
||
|
|
||
|
import { WORKSHEET_UPDATE } from '../graphql/operations/worksheet.mutations';
|
||
|
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,
|
||
|
};
|
||
|
}
|