2021-12-28 06:35:38 +08:00
|
|
|
import Swal from 'sweetalert2';
|
|
|
|
|
|
|
|
import { WORKSHEET_UPDATE } from '../graphql/worksheet.mutations';
|
2022-04-04 02:54:31 +08:00
|
|
|
import { useApiUtil} from './'
|
2021-12-28 06:35:38 +08:00
|
|
|
|
|
|
|
export default function useWorkSheetComposable(){
|
2022-04-04 02:54:31 +08:00
|
|
|
const { withClientMutation } = useApiUtil();
|
2021-12-28 06:35:38 +08:00
|
|
|
|
|
|
|
|
|
|
|
// unAssign Analyses
|
|
|
|
const unAssignSamples = async (uids: number[]) => {
|
|
|
|
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!',
|
2022-04-04 02:54:31 +08:00
|
|
|
}).then(async (result) => {
|
2021-12-28 06:35:38 +08:00
|
|
|
if (result.isConfirmed) {
|
|
|
|
|
2022-04-04 02:54:31 +08:00
|
|
|
await withClientMutation(WORKSHEET_UPDATE, uids, "updateWorksheet")
|
|
|
|
.then(payload => console.log(payload))
|
2021-12-28 06:35:38 +08:00
|
|
|
|
|
|
|
Swal.fire(
|
|
|
|
'Its Happening!',
|
|
|
|
'Selected analyses have been UnAssigned.',
|
|
|
|
'success'
|
|
|
|
).then(_ => location.reload())
|
|
|
|
|
|
|
|
}
|
|
|
|
})
|
|
|
|
} catch (error) {
|
|
|
|
console.log(error)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return {
|
|
|
|
unAssignSamples,
|
|
|
|
}
|
|
|
|
}
|