mirror of
https://github.com/kac5a/k5_documents.git
synced 2026-03-31 06:23:55 -04:00
add new esx import, logo by job, custom css file
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1 +1,2 @@
|
||||
**/node_modules
|
||||
**/node_modules
|
||||
**/releases
|
||||
@@ -19,11 +19,7 @@ end
|
||||
|
||||
if CurrentFramework == "esx" then
|
||||
Citizen.CreateThread(function()
|
||||
while ESX == nil do
|
||||
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
|
||||
Citizen.Wait(0)
|
||||
end
|
||||
|
||||
ESX = exports["es_extended"]:getSharedObject()
|
||||
while ESX.GetPlayerData().job == nil do
|
||||
Citizen.Wait(10)
|
||||
end
|
||||
|
||||
@@ -2,8 +2,8 @@ fx_version "cerulean"
|
||||
|
||||
description "A better document management script"
|
||||
author "K5 Scripts"
|
||||
version '1.1.6'
|
||||
update "Automatic framework detection"
|
||||
version '1.2.0'
|
||||
update "ESX import change, added different logo options for jobs, custom CSS options"
|
||||
repository 'https://github.com/kac5a/k5_documents'
|
||||
|
||||
lua54 'yes'
|
||||
|
||||
@@ -13,8 +13,7 @@ else
|
||||
end
|
||||
|
||||
if CurrentFramework == "esx" then
|
||||
ESX = nil
|
||||
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
|
||||
ESX = exports["es_extended"]:getSharedObject()
|
||||
RegisterCallback = function (name, fn)
|
||||
ESX.RegisterServerCallback(name, fn)
|
||||
end
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"files": {
|
||||
"main.js": "/web/build/static/js/main.8a2981e6.js",
|
||||
"main.js": "/web/build/static/js/main.af11e96d.js",
|
||||
"static/media/city_logo.png": "/web/build/static/media/city_logo.008b591a2d4e6445d96c.png",
|
||||
"index.html": "/web/build/index.html",
|
||||
"main.8a2981e6.js.map": "/web/build/static/js/main.8a2981e6.js.map"
|
||||
"main.af11e96d.js.map": "/web/build/static/js/main.af11e96d.js.map"
|
||||
},
|
||||
"entrypoints": [
|
||||
"static/js/main.8a2981e6.js"
|
||||
"static/js/main.af11e96d.js"
|
||||
]
|
||||
}
|
||||
@@ -3,14 +3,17 @@ const AVAILABLE_JOBS = [
|
||||
{
|
||||
job: 'police',
|
||||
templateGrades: [3, 4],
|
||||
logo: 'https://i.imgur.com/YsTyMCc.png',
|
||||
},
|
||||
{
|
||||
job: 'ambulance',
|
||||
templateGrades: [3],
|
||||
logo: 'https://i.pinimg.com/564x/6b/88/4f/6b884f7ebe28ff56a0e1fd9f5c47890a.jpg',
|
||||
},
|
||||
{
|
||||
job: 'mechanic',
|
||||
templateGrades: [4],
|
||||
logo: '/web/build/mechaniclogo.jpg',
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
1
web/build/customstyle.css
Normal file
1
web/build/customstyle.css
Normal file
@@ -0,0 +1 @@
|
||||
/* Add your custom styles in this file */
|
||||
@@ -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><script defer="defer" src="/web/build/static/js/main.8a2981e6.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.af11e96d.js"></script></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
|
||||
BIN
web/build/mechaniclogo.jpg
Normal file
BIN
web/build/mechaniclogo.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 54 KiB |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
web/build/static/js/main.af11e96d.js.map
Normal file
1
web/build/static/js/main.af11e96d.js.map
Normal file
File diff suppressed because one or more lines are too long
@@ -3,14 +3,17 @@ const AVAILABLE_JOBS = [
|
||||
{
|
||||
job: 'police',
|
||||
templateGrades: [3, 4],
|
||||
logo: 'https://i.imgur.com/YsTyMCc.png',
|
||||
},
|
||||
{
|
||||
job: 'ambulance',
|
||||
templateGrades: [3],
|
||||
logo: 'https://i.pinimg.com/564x/6b/88/4f/6b884f7ebe28ff56a0e1fd9f5c47890a.jpg',
|
||||
},
|
||||
{
|
||||
job: 'mechanic',
|
||||
templateGrades: [4],
|
||||
logo: '/web/build/mechaniclogo.jpg',
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
1
web/public/customstyle.css
Normal file
1
web/public/customstyle.css
Normal file
@@ -0,0 +1 @@
|
||||
/* Add your custom styles in this file */
|
||||
@@ -12,6 +12,7 @@
|
||||
/>
|
||||
<title>K5 Documents</title>
|
||||
<script type="text/javascript" src="%PUBLIC_URL%/config.js"></script>
|
||||
<link rel="stylesheet" href="%PUBLIC_URL%/customstyle.css" />
|
||||
</head>
|
||||
<body>
|
||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||
|
||||
BIN
web/public/mechaniclogo.jpg
Normal file
BIN
web/public/mechaniclogo.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 54 KiB |
@@ -1,6 +1,6 @@
|
||||
declare var TEXTS: { [key: string]: string }
|
||||
declare var COLORS: { [key: string]: string }
|
||||
declare var AVAILABLE_JOBS: {job:string, templateGrades: number[]}[]
|
||||
declare var AVAILABLE_JOBS: {job:string, templateGrades: number[], logo?: string}[]
|
||||
|
||||
export const texts = typeof TEXTS === "undefined" ? {} : TEXTS
|
||||
export const colors = typeof COLORS === "undefined" ? {} : COLORS
|
||||
|
||||
@@ -9,6 +9,7 @@ import ViewDocumentField from "./ViewDocumentField"
|
||||
import SignedArea from "./SignedArea"
|
||||
import { DATE_FORMAT_SHORT } from "../../utils/consts"
|
||||
import { texts } from "../../AppConfig"
|
||||
import { availableJobs } from '../../AppConfig';
|
||||
|
||||
const DocumentView = () => {
|
||||
const {isViewDocOpen, viewDocument: document, setViewDocOpen} = useContext(Context)
|
||||
@@ -28,7 +29,7 @@ const DocumentView = () => {
|
||||
<Grid item container xs={12}>
|
||||
<Grid item xs={6}>
|
||||
<div style={{display: "flex", justifyContent: "center", alignItems: "center"}}>
|
||||
<CityLogo src={city_logo} alt="Los Santos City" />
|
||||
<CityLogo src={ availableJobs.find(j => j.job === document?.job)?.logo ?? city_logo} alt="Los Santos City" />
|
||||
</div>
|
||||
</Grid>
|
||||
<Grid item xs={6}>
|
||||
|
||||
@@ -9,7 +9,7 @@ import { DATE_FORMAT_SHORT } from "../../utils/consts"
|
||||
import { useContext } from "react"
|
||||
import { texts } from "../../AppConfig"
|
||||
import { DocumentCtx } from "../../providers/DocumentProvider"
|
||||
|
||||
import { availableJobs } from '../../AppConfig';
|
||||
|
||||
const DocumentViewFromPlayer = () => {
|
||||
|
||||
@@ -30,7 +30,7 @@ const DocumentViewFromPlayer = () => {
|
||||
<Grid item container xs={12}>
|
||||
<Grid item xs={6}>
|
||||
<div style={{display: "flex", justifyContent: "center", alignItems: "center"}}>
|
||||
<CityLogo src={city_logo} alt="Los Santos City" />
|
||||
<CityLogo src={availableJobs.find(j => j.job === document?.job)?.logo ?? city_logo} alt="Los Santos City" />
|
||||
</div>
|
||||
</Grid>
|
||||
<Grid item xs={6}>
|
||||
|
||||
@@ -9,7 +9,7 @@ import city_logo from "../../../assets/city_logo.png"
|
||||
import { useState } from "react";
|
||||
import SignButton from "./SignButton";
|
||||
import { DATE_FORMAT_SHORT } from "../../../utils/consts";
|
||||
import { texts } from "../../../AppConfig";
|
||||
import { availableJobs, texts } from "../../../AppConfig";
|
||||
|
||||
type Props = {
|
||||
template: DocumentTemplate
|
||||
@@ -48,11 +48,14 @@ const CreateDocument = ({ template, handleCreate, handleClose }: Props) => {
|
||||
rules: { required: texts.requiredError }
|
||||
})
|
||||
|
||||
|
||||
|
||||
const handleCreateDocument: SubmitHandler<K5Document> = (data: K5Document) => {
|
||||
let result = {
|
||||
name: data.name,
|
||||
createdAt: (new Date()).toString(),
|
||||
customName: data.customName,
|
||||
customName: data.customName?.length ? data.customName : undefined,
|
||||
job: job?.name,
|
||||
description: data.description,
|
||||
fields: data.fields,
|
||||
isCopy: false,
|
||||
@@ -84,7 +87,7 @@ const CreateDocument = ({ template, handleCreate, handleClose }: Props) => {
|
||||
<Grid item container xs={12}>
|
||||
<Grid item xs={6}>
|
||||
<div style={{display: "flex", justifyContent: "center", alignItems: "center"}}>
|
||||
<img style={{height: "18.5vh"}} src={city_logo} alt="Los Santos City" />
|
||||
<img style={{height: "18.5vh"}} src={availableJobs.find(j => j.job === job?.name)?.logo ?? city_logo} alt="Los Santos City" />
|
||||
</div>
|
||||
</Grid>
|
||||
<Grid item xs={6}>
|
||||
|
||||
@@ -26,7 +26,7 @@ const SignButton = ({ name, isSigned, setSigned }: Props) => {
|
||||
},[name, setSigned, signing])
|
||||
|
||||
return (
|
||||
<Container issigned={isSigned} onClick={() => !signing && sign(-1)}>
|
||||
<Container issigned={!!isSigned} onClick={() => !signing && sign(-1)}>
|
||||
<SignHere>{texts.signHereText}</SignHere>
|
||||
<div style={{fontFamily: "'Oooh Baby', cursive"}}>{writtenName}</div>
|
||||
</Container>
|
||||
@@ -49,7 +49,7 @@ const Container = styled("div")<ContainerProps>`
|
||||
height: 100%;
|
||||
border: 1px solid #000;
|
||||
margin-bottom: 20px;
|
||||
cursor: ${(props) => props.issigned ? "initial" : "pointer"};
|
||||
cursor: ${(props) => !!props.issigned ? "initial" : "pointer"};
|
||||
`
|
||||
|
||||
const SignHere = styled("div")`
|
||||
|
||||
@@ -50,7 +50,7 @@ const IssuedDocuments = () => {
|
||||
field: 'customName',
|
||||
headerName: texts.customName,
|
||||
flex: 1,
|
||||
renderCell: (params: GridRenderCellParams<string | undefined>) => (params.value === undefined ? <div style={{ fontStyle: "italic" }}>{texts.unnamed}</div> : params.value)
|
||||
renderCell: (params: GridRenderCellParams<string | undefined>) => (params.value === undefined || params.value?.length === 0 ? <div style={{ fontStyle: "italic" }}>{texts.unnamed}</div> : params.value)
|
||||
},
|
||||
{
|
||||
field: 'name',
|
||||
|
||||
1
web/src/components/types.d.ts
vendored
1
web/src/components/types.d.ts
vendored
@@ -28,6 +28,7 @@ declare type K5Document = {
|
||||
id?: string
|
||||
name: string
|
||||
customName?: string
|
||||
job?: string
|
||||
createdAt: string
|
||||
description: string
|
||||
fields: Field[]
|
||||
|
||||
Reference in New Issue
Block a user