generated from deco-sites/storefront
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from deco-sites/feature/bulk-create-associatef…
…-users bulk create of users and make it not necessary cognito data to create…
- Loading branch information
Showing
11 changed files
with
258 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
import Modal from "../../components/ui/Modal.tsx"; | ||
import Icon from "../../components/ui/Icon.tsx"; | ||
import { useState } from "preact/hooks"; | ||
import { useUI } from "../../sdk/useUI.ts"; | ||
import { h } from "preact"; | ||
|
||
export interface Props { | ||
onFinish: () => void; | ||
} | ||
|
||
const PreSignupUsersModal = ({ onFinish }: Props) => { | ||
const [file, setFile] = useState<File>(); | ||
const { displayPreSignupUsersModal } = useUI(); | ||
const [isUploading, setIsUploading] = useState(false); | ||
|
||
const handleStoreDocument = ( | ||
event: h.JSX.TargetedEvent<HTMLInputElement, Event>, | ||
) => { | ||
const fileInput = event.target as HTMLInputElement; | ||
if (fileInput.files) { | ||
setFile(fileInput.files[0]); | ||
} | ||
}; | ||
|
||
const handleCreate = () => { | ||
setIsUploading(true); | ||
|
||
try { | ||
console.log("oi"); | ||
} catch (e) { | ||
console.log({ erroUpload: e }); | ||
setIsUploading(false); | ||
} | ||
}; | ||
|
||
return ( | ||
<Modal | ||
loading="lazy" | ||
open={displayPreSignupUsersModal.value} | ||
onClose={() => displayPreSignupUsersModal.value = false} | ||
> | ||
<div class="flex flex-col p-16 gap-3 bg-[#EDEDED] rounded-xl max-w-[90%] sm:max-w-[500px]"> | ||
<h3 class="text-2xl text-[#8b8b8b] font-semibold text-center"> | ||
Pré Cadastrar Pacientes Associados | ||
</h3> | ||
<span class="text-center text-xs"> | ||
Suba arquivo csv com as colunas <span class="font-bold">email</span> e | ||
{" "} | ||
<span class="font-bold">cids</span>{" "} | ||
dos pacientes que deseja pré-cadastrar na sua associação. | ||
</span> | ||
|
||
<label class="form-control w-full max-w-xs"> | ||
<div class="label"> | ||
<span class="label-text">Selecionar arquivo csv</span> | ||
</div> | ||
<input | ||
type="file" | ||
accept=".csv" | ||
class="file-input file-input-primary w-full max-w-xs" | ||
onChange={(e) => handleStoreDocument(e)} | ||
/> | ||
</label> | ||
|
||
<button class="btn btn-secondary text-white" onClick={handleCreate}> | ||
Fazer Pré Cadastro{" "}{isUploading | ||
? <span class="loading loading-spinner text-white"></span> | ||
: <Icon id="UserData" size={24} />} | ||
</button> | ||
<button | ||
onClick={() => { | ||
displayPreSignupUsersModal.value = false; | ||
}} | ||
class="btn btn-ghost uppercase font-medium" | ||
> | ||
Cancelar | ||
</button> | ||
</div> | ||
</Modal> | ||
); | ||
}; | ||
|
||
export default PreSignupUsersModal; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.