Skip to content

Commit

Permalink
remove job from ciziten document, add custom name to my documents
Browse files Browse the repository at this point in the history
  • Loading branch information
kac5a committed Mar 22, 2023
1 parent 0953dea commit 2f22a57
Show file tree
Hide file tree
Showing 13 changed files with 44 additions and 29 deletions.
4 changes: 2 additions & 2 deletions fxmanifest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ fx_version "cerulean"

description "A better document management script"
author "K5 Scripts"
version '1.3.2'
update "Fixed missing customName header text, and random printed messages"
version '1.3.4'
update "Removed issuer job from citizen documents, added custom name column to received documents"
repository 'https://github.com/kac5a/k5_documents'

lua54 'yes'
Expand Down
6 changes: 3 additions & 3 deletions web/build/asset-manifest.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"files": {
"main.js": "/web/build/static/js/main.44088540.js",
"main.js": "/web/build/static/js/main.a9020f42.js",
"static/media/city_logo.png": "/web/build/static/media/city_logo.008b591a2d4e6445d96c.png",
"index.html": "/web/build/index.html",
"main.44088540.js.map": "/web/build/static/js/main.44088540.js.map"
"main.a9020f42.js.map": "/web/build/static/js/main.a9020f42.js.map"
},
"entrypoints": [
"static/js/main.44088540.js"
"static/js/main.a9020f42.js"
]
}
2 changes: 1 addition & 1 deletion web/build/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><link rel="preconnect" href="https://fonts.googleapis.com"/><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin/><link href="https://fonts.googleapis.com/css2?family=Oooh+Baby&display=swap" rel="stylesheet"/><title>K5 Documents</title><script type="text/javascript" src="/web/build/config.js"></script><link rel="stylesheet" href="/web/build/customstyle.css"/><script defer="defer" src="/web/build/static/js/main.44088540.js"></script></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><link rel="preconnect" href="https://fonts.googleapis.com"/><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin/><link href="https://fonts.googleapis.com/css2?family=Oooh+Baby&display=swap" rel="stylesheet"/><title>K5 Documents</title><script type="text/javascript" src="/web/build/config.js"></script><link rel="stylesheet" href="/web/build/customstyle.css"/><script defer="defer" src="/web/build/static/js/main.a9020f42.js"></script></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
1 change: 0 additions & 1 deletion web/build/static/js/main.44088540.js.map

This file was deleted.

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions web/build/static/js/main.a9020f42.js.map

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion web/build/static/js/main.cd38447b.js.map

This file was deleted.

8 changes: 4 additions & 4 deletions web/src/components/Components/DocumentView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,16 @@ const DocumentView = () => {
<Grid item xs={6}>
<IssuerTitle>{texts.issuerDOB}</IssuerTitle>
</Grid>
<Grid item xs={6}>
{document?.issuer.jobName ? <Grid item xs={6}>
<IssuerTitle>{texts.issuerJob}</IssuerTitle>
</Grid>
</Grid>: <Grid item xs={6}/>}

<Grid item xs={6} >
<IssuerData>{moment(new Date(document?.issuer.birthDate || "")).format(DATE_FORMAT_SHORT)}</IssuerData>
</Grid>
<Grid item xs={6}>
{document?.issuer.jobName ? <Grid item xs={6}>
<IssuerData>{ document?.issuer.jobName }</IssuerData>
</Grid>
</Grid> : <Grid item xs={6}/>}

</Grid>
</CardContent>
Expand Down
8 changes: 4 additions & 4 deletions web/src/components/Components/DocumentViewFromPlayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,16 @@ const DocumentViewFromPlayer = () => {
<Grid item xs={6}>
<IssuerTitle>{texts.issuerDOB}</IssuerTitle>
</Grid>
<Grid item xs={6}>
{document?.issuer.jobName ? <Grid item xs={6}>
<IssuerTitle>{texts.issuerJob}</IssuerTitle>
</Grid>
</Grid> : <Grid item xs={6}/>}

<Grid item xs={6} >
<IssuerData>{moment(new Date(document?.issuer.birthDate || "")).format(DATE_FORMAT_SHORT)}</IssuerData>
</Grid>
<Grid item xs={6}>
{document?.issuer.jobName ? <Grid item xs={6}>
<IssuerData>{ document?.issuer.jobName }</IssuerData>
</Grid>
</Grid> : <Grid item xs={6}/>}

</Grid>
</CardContent>
Expand Down
16 changes: 9 additions & 7 deletions web/src/components/Components/Forms/CreateDocument.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ type Props = {
handleCreate: (data: K5Document) => void
handleClose: () => void
logoSrc: string
isCitizen?: boolean
}

const CreateDocument = ({ template, handleCreate, handleClose, logoSrc }: Props) => {
const CreateDocument = ({ template, handleCreate, handleClose, logoSrc, isCitizen }: Props) => {

const { playerData } = usePlayerData()
const { job } = useJob()
Expand Down Expand Up @@ -55,7 +56,7 @@ const CreateDocument = ({ template, handleCreate, handleClose, logoSrc }: Props)
name: data.name,
createdAt: (new Date()).toString(),
customName: data.customName?.length ? data.customName : undefined,
job: job?.name,
job: !isCitizen ? job?.name : undefined,
description: data.description,
fields: data.fields,
isCopy: false,
Expand All @@ -65,7 +66,7 @@ const CreateDocument = ({ template, handleCreate, handleClose, logoSrc }: Props)
firstname: playerData?.firstname,
lastname: playerData?.lastname,
birthDate: moment(new Date(playerData?.dateofbirth || "")).format(DATE_FORMAT_SHORT),
jobName: job?.label
jobName: !isCitizen ? job?.label : undefined
}
} as K5Document

Expand Down Expand Up @@ -113,16 +114,17 @@ const CreateDocument = ({ template, handleCreate, handleClose, logoSrc }: Props)
<Grid item xs={6}>
<Typography style={{fontWeight: "bold", fontSize: "0.7rem"}}>{texts.issuerDOB}</Typography>
</Grid>
<Grid item xs={6}>
{!isCitizen ? <Grid item xs={6}>
<Typography style={{fontWeight: "bold", fontSize: "0.7rem"}}>{texts.issuerJob}</Typography>
</Grid>
</Grid> :
<Grid item xs={6} />}

<Grid item xs={6} >
<Typography style={{ fontSize: "0.9rem" }}>{moment(new Date(playerData?.dateofbirth || "")).format(DATE_FORMAT_SHORT)}</Typography>
</Grid>
<Grid item xs={6}>
{!isCitizen ? <Grid item xs={6}>
<Typography style={{ fontSize: "0.9rem" }}>{ job?.label }</Typography>
</Grid>
</Grid> : <Grid item xs={6} />}

</Grid>
</CardContent>
Expand Down
13 changes: 11 additions & 2 deletions web/src/components/Pages/IssuedDocuments.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const IssuedDocuments = () => {

const [isDocumentFormOpen, setDocumentFormOpen] = useState(false)
const [isTemplateListOpen, setTemplateListOpen] = useState(false)
const [isCitizenDocument, setCitizenDocument] = useState(false)
const [isCitizenListOpen, setCitizenListOpen] = useState(false)
const [logoSrc, setLogoSrc] = useState(city_logo)
const [documentTemplate, setDocumentTemplate] = useState<DocumentTemplate | undefined>()
Expand Down Expand Up @@ -116,7 +117,15 @@ const IssuedDocuments = () => {

const handleTemplateSelect = (t: DocumentTemplate, citizen: boolean) => {
setTemplateListOpen(false)
citizen ? setLogoSrc(city_logo) : setLogoSrc(availableJobs.find(j => j.job === job?.name)?.logo || city_logo)
setCitizenListOpen(false)
if (citizen) {
setLogoSrc(city_logo)
setCitizenDocument(true)
} else {
setLogoSrc(availableJobs.find(j => j.job === job?.name)?.logo || city_logo)
setCitizenDocument(false)
}

setDocumentTemplate(t)
setDocumentFormOpen(true)
}
Expand Down Expand Up @@ -146,7 +155,7 @@ const IssuedDocuments = () => {
<Dialog maxWidth="md" open={isDocumentFormOpen} onClose={() => {
setDocumentFormOpen(false)
}}>
<CreateDocument handleCreate={handleCreate} logoSrc={logoSrc} template={documentTemplate!} handleClose={() => {
<CreateDocument isCitizen={isCitizenDocument} handleCreate={handleCreate} logoSrc={logoSrc} template={documentTemplate!} handleClose={() => {
setDocumentFormOpen(false)
}} />
</Dialog>
Expand Down
7 changes: 6 additions & 1 deletion web/src/components/Pages/MyDocuments.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,14 @@ const MyDocuments = () => {
}, [documentCopies, handleGetDocumentCopies])

const columns: GridColumns<K5Document> = [
{
field: 'customName',
headerName: texts.customDocumentName,
flex: 1,
},
{
field: 'name',
headerName: texts.documentName,
headerName: texts.documentType,
flex: 1,
},
{
Expand Down

0 comments on commit 2f22a57

Please sign in to comment.