Compare commits

...

2 Commits

Author SHA1 Message Date
24751a3a17 Add rent request table 2023-09-27 18:17:38 +02:00
9158987469 Add rent request table 2023-09-27 18:17:27 +02:00
28 changed files with 519 additions and 145 deletions

67
Cargo.lock generated
View File

@ -195,7 +195,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e01ed3140b2f8d422c68afa1ed2e85d996ea619c988ac834d255db32138655cb"
dependencies = [
"quote",
"syn 2.0.33",
"syn 2.0.37",
]
[[package]]
@ -233,7 +233,7 @@ dependencies = [
"parse-size",
"proc-macro2",
"quote",
"syn 2.0.33",
"syn 2.0.37",
]
[[package]]
@ -364,7 +364,7 @@ dependencies = [
"actix-router",
"proc-macro2",
"quote",
"syn 2.0.33",
"syn 2.0.37",
]
[[package]]
@ -385,7 +385,7 @@ checksum = "7c7db3d5a9718568e4cf4a537cfd7070e6e6ff7481510d0237fb529ac850f6d3"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.33",
"syn 2.0.37",
]
[[package]]
@ -580,7 +580,7 @@ dependencies = [
"proc-macro2",
"quote",
"serde",
"syn 2.0.33",
"syn 2.0.37",
]
[[package]]
@ -715,7 +715,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.33",
"syn 2.0.37",
]
[[package]]
@ -732,7 +732,7 @@ checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.33",
"syn 2.0.37",
]
[[package]]
@ -1397,7 +1397,7 @@ dependencies = [
"proc-macro2",
"quote",
"strsim",
"syn 2.0.33",
"syn 2.0.37",
]
[[package]]
@ -1408,7 +1408,7 @@ checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5"
dependencies = [
"darling_core",
"quote",
"syn 2.0.33",
"syn 2.0.37",
]
[[package]]
@ -1767,7 +1767,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.33",
"syn 2.0.37",
]
[[package]]
@ -1825,7 +1825,7 @@ dependencies = [
"proc-macro2",
"quote",
"regex",
"syn 2.0.33",
"syn 2.0.37",
]
[[package]]
@ -2157,7 +2157,7 @@ checksum = "ce243b1bfa62ffc028f1cc3b6034ec63d649f3031bc8a4fbbb004e1ac17d1f68"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.33",
"syn 2.0.37",
]
[[package]]
@ -2365,13 +2365,12 @@ checksum = "1a9bad9f94746442c783ca431b22403b519cd7fbeed0533fdd6328b2f2212128"
[[package]]
name = "local-channel"
version = "0.1.3"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f303ec0e94c6c54447f84f3b0ef7af769858a9c4ef56ef2a986d3dcd4c3fc9c"
checksum = "e0a493488de5f18c8ffcba89eebb8532ffc562dc400490eb65b84893fae0b178"
dependencies = [
"futures-core",
"futures-sink",
"futures-util",
"local-waker",
]
@ -2701,7 +2700,7 @@ dependencies = [
"redis",
"redis-async-pool",
"ron 0.8.1",
"sea-orm 0.11.3",
"sea-orm 0.12.2",
"serde",
"serde_json",
"tokio 1.32.0",
@ -2766,7 +2765,7 @@ dependencies = [
"oswilno-contract",
"oswilno-session",
"oswilno-view",
"sea-orm 0.11.3",
"sea-orm 0.12.2",
"serde",
"serde_json",
"tokio 1.32.0",
@ -2794,7 +2793,7 @@ dependencies = [
"redis",
"redis-async-pool",
"ring",
"sea-orm 0.11.3",
"sea-orm 0.12.2",
"serde",
"time",
"tokio 1.32.0",
@ -2859,7 +2858,7 @@ dependencies = [
"proc-macro-error",
"proc-macro2",
"quote",
"syn 2.0.33",
"syn 2.0.37",
]
[[package]]
@ -3009,7 +3008,7 @@ dependencies = [
"pest_meta",
"proc-macro2",
"quote",
"syn 2.0.33",
"syn 2.0.37",
]
[[package]]
@ -3098,7 +3097,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.33",
"syn 2.0.37",
]
[[package]]
@ -3699,7 +3698,7 @@ dependencies = [
"proc-macro-error",
"proc-macro2",
"quote",
"syn 2.0.33",
"syn 2.0.37",
]
[[package]]
@ -3797,7 +3796,7 @@ dependencies = [
"proc-macro2",
"quote",
"sea-bae",
"syn 2.0.33",
"syn 2.0.37",
"unicode-ident",
]
@ -3969,7 +3968,7 @@ checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.33",
"syn 2.0.37",
]
[[package]]
@ -4160,7 +4159,7 @@ checksum = "c87e960f4dca2788eeb86bbdde8dd246be8948790b7618d656e68f9b720a86e8"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.33",
"syn 2.0.37",
]
[[package]]
@ -4562,9 +4561,9 @@ dependencies = [
[[package]]
name = "syn"
version = "2.0.33"
version = "2.0.37"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9caece70c63bfba29ec2fed841a09851b14a235c60010fa4de58089b6c025668"
checksum = "7303ef2c05cd654186cb250d29049a24840ca25d2747c25c0381c8d9e2f582e8"
dependencies = [
"proc-macro2",
"quote",
@ -4635,7 +4634,7 @@ checksum = "49922ecae66cc8a249b77e68d1d0623c1b2c514f0060c27cdc68bd62a1219d35"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.33",
"syn 2.0.37",
]
[[package]]
@ -4746,7 +4745,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.33",
"syn 2.0.37",
]
[[package]]
@ -4863,7 +4862,7 @@ checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.33",
"syn 2.0.37",
]
[[package]]
@ -4926,9 +4925,9 @@ checksum = "6af6ae20167a9ece4bcb41af5b80f8a1f1df981f6391189ce00fd257af04126a"
[[package]]
name = "typenum"
version = "1.16.0"
version = "1.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba"
checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825"
[[package]]
name = "ucd-trie"
@ -5144,7 +5143,7 @@ dependencies = [
"once_cell",
"proc-macro2",
"quote",
"syn 2.0.33",
"syn 2.0.37",
"wasm-bindgen-shared",
]
@ -5178,7 +5177,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.33",
"syn 2.0.37",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]

View File

@ -1,7 +1,7 @@
{
"version": 3,
"sources": ["../crates/web-assets/assets/elements/oswilno-price.js", "../crates/web-assets/assets/css.js", "../crates/web-assets/assets/elements/oswilno-error.js", "../crates/web-assets/assets/elements/oswilno-parking-space.js", "../crates/web-assets/assets/app.js"],
"sourcesContent": ["customElements.define('oswilno-price', class extends HTMLElement {\n\tconstructor() {\n\t\tsuper();\n\t\tthis.attachShadow({ mode: 'open' });\n\t}\n\tconnectedCallback() {\n\t\tlet shadow = this.shadowRoot;\n\t\tlet price = parseInt(this.getAttribute('price'));\n\t\tif (isNaN(price)) price = 0;\n\t\tconst multiplier = parseInt(this.getAttribute('multiplier'));\n\t\tlet major = price;\n\t\tlet minor = 0;\n\t\tif (!isNaN(multiplier)) {\n\t\t\tmajor = Math.floor(price / multiplier);\n\t\t\tminor = price % multiplier;\n\t\t}\n\t\tconst currency = this.getAttribute('currency') || 'PLN';\n\t\tshadow.innerHTML = `<style>:host{display:block;}</style><div>${major}.${minor >= 10 ? minor : minor + '0'} ${ currency }</div>`;\n\t}\n});\n", "export const copyCss = (shadow) => {\n\tlet css = '';\n\tfor (let i = 0; i < document.styleSheets.length; i++) {\n\t\tconst styleSheet = document.styleSheets[i];\n\t\tfor (let j = 0; j < styleSheet.rules.length; j++) {\n\t\t\tcss += styleSheet.rules[j].cssText;\t\n\t\t}\n\t}\n\tconst sheet = new CSSStyleSheet();\n\tsheet.replaceSync(css);\n\tshadow.adoptedStyleSheets = [sheet];\n};\n", "import { copyCss } from \"../css.js\";\n\ncustomElements.define('oswilno-error', class extends HTMLElement {\n\tconstructor() {\n\t\tsuper();\n\t\tconst shadow = this.attachShadow({ mode: 'open' });\n\t\tshadow.innerHTML = `\n\t\t\t<style>:host{display:block;}</style>\n\t\t\t<div class=\"flex bg-red-100 rounded-lg p-4 mb-4 text-sm text-red-700\">\n\t\t\t\t<slot></slot>\n\t\t\t<div>\n\t\t`;\n\t\tcopyCss(shadow);\n\t}\n});\n", "customElements.define('oswilno-parking-space', class extends HTMLElement {\n\tconstructor() {\n\t\tsuper();\n\t\tconst shadow = this.attachShadow({ mode: 'open' });\n\t\tshadow.innerHTML = `\n\t\t\t<style>\n\t\t\t:host { display: block; }\n\t\t\t</style>\n\t\t\t<div>\n\t\t\t<slot></slot>\n\t\t\t</div>\n\t\t`;\n\t}\n});\n", "import './elements/oswilno-price.js';\nimport './elements/oswilno-error.js';\nimport './elements/oswilno-parking-space.js';\nimport(\"https://unpkg.com/htmx.org@1.9.4/dist/htmx.min.js\");\n\nconst READ_AUTH_HEADER = 'Authorization';\nconst AUTH_HEADER = 'ACX-Authorization';\nconst REFRESH_HEADER = 'ACX-Refresh';\nconst body = document.body;\nbody.addEventListener('htmx:beforeOnLoad', function (evt) {\n\tconst detail = evt.detail;\n\tconst xhr = detail.xhr;\n\tconst status = xhr.status;\n\tconst successful = detail.successful;\n\n\tif (status === 200) {\n\t\tconst bearer = xhr.getResponseHeader(READ_AUTH_HEADER);\n\t\tif (bearer) {\n\t\t\tconsole.log(xhr);\n\t\t\tlocalStorage.setItem('jwt', bearer.replace(/^Bearer /i, ''));\n\t\t}\n\t\tconst refresh = xhr.getResponseHeader(REFRESH_HEADER);\n\t\tif (refresh) {\n\t\t\tlocalStorage.setItem('refresh', bearer.replace(/^Bearer /i, ''));\n\t\t}\n\t} else if (status === 401) {\n\t\tlocalStorage.removeItem('jwt');\n\t}\n\tif (status === 422 || status === 400) {\n\t\tdetail.shouldSwap = true;\n\t\tdetail.isError = false;\n\t}\n});\nbody.addEventListener('htmx:configRequest', function (evt) {\n\tif (localStorage.getItem('jwt')) {\n\t\tevt.detail.headers[AUTH_HEADER] = 'Bearer ' + (localStorage.getItem('jwt') || '');\n\t\tevt.detail.headers[READ_AUTH_HEADER] = 'Bearer ' + (localStorage.getItem('jwt') || '');\n\t\tevt.detail.headers[REFRESH_HEADER] = (localStorage.getItem('refresh') || '');\n\t}\n});\n\n"],
"mappings": "0sBAAA,eAAe,OAAO,gBAAiB,cAAc,WAAY,CAChE,aAAc,CACb,MAAM,EACN,KAAK,aAAa,CAAE,KAAM,MAAO,CAAC,CACnC,CACA,mBAAoB,CACnB,IAAIA,EAAS,KAAK,WACdC,EAAQ,SAAS,KAAK,aAAa,OAAO,CAAC,EAC3C,MAAMA,CAAK,IAAGA,EAAQ,GAC1B,IAAMC,EAAa,SAAS,KAAK,aAAa,YAAY,CAAC,EACvDC,EAAQF,EACRG,EAAQ,EACP,MAAMF,CAAU,IACpBC,EAAQ,KAAK,MAAMF,EAAQC,CAAU,EACrCE,EAAQH,EAAQC,GAEjB,IAAMG,EAAW,KAAK,aAAa,UAAU,GAAK,MAClDL,EAAO,UAAY,4CAA4CG,CAAK,IAAIC,GAAS,GAAKA,EAAQA,EAAQ,GAAG,IAAKC,CAAS,QACxH,CACD,CAAC,ECnBM,IAAMC,EAAWC,GAAW,CAClC,IAAIC,EAAM,GACV,QAASC,EAAI,EAAGA,EAAI,SAAS,YAAY,OAAQA,IAAK,CACrD,IAAMC,EAAa,SAAS,YAAYD,CAAC,EACzC,QAASE,EAAI,EAAGA,EAAID,EAAW,MAAM,OAAQC,IAC5CH,GAAOE,EAAW,MAAMC,CAAC,EAAE,OAE7B,CACA,IAAMC,EAAQ,IAAI,cAClBA,EAAM,YAAYJ,CAAG,EACrBD,EAAO,mBAAqB,CAACK,CAAK,CACnC,ECTA,eAAe,OAAO,gBAAiB,cAAc,WAAY,CAChE,aAAc,CACb,MAAM,EACN,IAAMC,EAAS,KAAK,aAAa,CAAE,KAAM,MAAO,CAAC,EACjDA,EAAO,UAAY;AAAA;AAAA;AAAA;AAAA;AAAA,IAMnBC,EAAQD,CAAM,CACf,CACD,CAAC,ECdD,eAAe,OAAO,wBAAyB,cAAc,WAAY,CACxE,aAAc,CACb,MAAM,EACN,IAAME,EAAS,KAAK,aAAa,CAAE,KAAM,MAAO,CAAC,EACjDA,EAAO,UAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAQpB,CACD,CAAC,ECVD,OAAO,mDAAmD,EAE1D,IAAMC,EAAmB,gBACnBC,EAAc,oBACdC,EAAiB,cACjBC,EAAO,SAAS,KACtBA,EAAK,iBAAiB,oBAAqB,SAAUC,EAAK,CACzD,IAAMC,EAASD,EAAI,OACbE,EAAMD,EAAO,IACbE,EAASD,EAAI,OACbE,EAAaH,EAAO,WAE1B,GAAIE,IAAW,IAAK,CACnB,IAAME,EAASH,EAAI,kBAAkBN,CAAgB,EACjDS,IACH,QAAQ,IAAIH,CAAG,EACf,aAAa,QAAQ,MAAOG,EAAO,QAAQ,YAAa,EAAE,CAAC,GAE5CH,EAAI,kBAAkBJ,CAAc,GAEnD,aAAa,QAAQ,UAAWO,EAAO,QAAQ,YAAa,EAAE,CAAC,CAEjE,MAAWF,IAAW,KACrB,aAAa,WAAW,KAAK,GAE1BA,IAAW,KAAOA,IAAW,OAChCF,EAAO,WAAa,GACpBA,EAAO,QAAU,GAEnB,CAAC,EACDF,EAAK,iBAAiB,qBAAsB,SAAUC,EAAK,CACtD,aAAa,QAAQ,KAAK,IAC7BA,EAAI,OAAO,QAAQH,CAAW,EAAI,WAAa,aAAa,QAAQ,KAAK,GAAK,IAC9EG,EAAI,OAAO,QAAQJ,CAAgB,EAAI,WAAa,aAAa,QAAQ,KAAK,GAAK,IACnFI,EAAI,OAAO,QAAQF,CAAc,EAAK,aAAa,QAAQ,SAAS,GAAK,GAE3E,CAAC",
"sourcesContent": ["customElements.define('oswilno-price', class extends HTMLElement {\n\tconstructor() {\n\t\tsuper();\n\t\tthis.attachShadow({ mode: 'open' });\n\t}\n\tconnectedCallback() {\n\t\tlet shadow = this.shadowRoot;\n\t\tlet price = parseInt(this.getAttribute('price'));\n\t\tif (isNaN(price)) price = 0;\n\t\tconst multiplier = parseInt(this.getAttribute('multiplier'));\n\t\tlet major = price;\n\t\tlet minor = 0;\n\t\tif (!isNaN(multiplier)) {\n\t\t\tmajor = Math.floor(price / multiplier);\n\t\t\tminor = price % multiplier;\n\t\t}\n\t\tconst currency = this.getAttribute('currency') || 'PLN';\n\t\tshadow.innerHTML = `<style>:host{display:block;}</style><div>${major}.${minor >= 10 ? minor : minor + '0'} ${ currency }</div>`;\n\t}\n});\n", "export const copyCss = (shadow) => {\n\tlet css = '';\n\tfor (let i = 0; i < document.styleSheets.length; i++) {\n\t\tconst styleSheet = document.styleSheets[i];\n\t\tfor (let j = 0; j < styleSheet.rules.length; j++) {\n\t\t\tcss += styleSheet.rules[j].cssText;\t\n\t\t}\n\t}\n\tconst sheet = new CSSStyleSheet();\n\tsheet.replaceSync(css);\n\tshadow.adoptedStyleSheets = [sheet];\n};\n", "import { copyCss } from \"../css.js\";\n\ncustomElements.define('oswilno-error', class extends HTMLElement {\n\tconstructor() {\n\t\tsuper();\n\t\tconst shadow = this.attachShadow({ mode: 'open' });\n\t\tshadow.innerHTML = `\n\t\t\t<style>:host{display:block;}</style>\n\t\t\t<div class=\"flex bg-red-100 rounded-lg p-4 mb-4 text-sm text-red-700\">\n\t\t\t\t<slot></slot>\n\t\t\t<div>\n\t\t`;\n\t\tcopyCss(shadow);\n\t}\n});\n", "customElements.define('oswilno-parking-space', class extends HTMLElement {\n\tconstructor() {\n\t\tsuper();\n\t\tconst shadow = this.attachShadow({ mode: 'open' });\n\t\tshadow.innerHTML = `\n\t\t\t<style>\n\t\t\t:host { display: block; }\n\t\t\t</style>\n\t\t\t<div>\n\t\t\t<slot></slot>\n\t\t\t</div>\n\t\t`;\n\t}\n});\n", "import './elements/oswilno-price.js';\nimport './elements/oswilno-error.js';\nimport './elements/oswilno-parking-space.js';\nimport(\"https://unpkg.com/htmx.org@1.9.4/dist/htmx.min.js\");\n\nconst READ_AUTH_HEADER = 'Authorization';\nconst AUTH_HEADER = 'ACX-Authorization';\nconst REFRESH_HEADER = 'ACX-Refresh';\nconst body = document.body;\nbody.addEventListener('htmx:beforeOnLoad', function (evt) {\n\tconst detail = evt.detail;\n\tconst xhr = detail.xhr;\n\tconst status = xhr.status;\n\tconst successful = detail.successful;\n\n\tif (status === 200) {\n\t\tconst bearer = xhr.getResponseHeader(READ_AUTH_HEADER);\n\t\tif (bearer) {\n\t\t\tconsole.log(xhr);\n\t\t\tlocalStorage.setItem('jwt', bearer.replace(/^Bearer /i, ''));\n\t\t}\n\t\tconst refresh = xhr.getResponseHeader(REFRESH_HEADER);\n\t\tif (refresh) {\n\t\t\tlocalStorage.setItem('refresh', bearer.replace(/^Bearer /i, ''));\n\t\t}\n\t} else if (status === 401) {\n\t\tlocalStorage.removeItem('jwt');\n\t}\n\tif (status === 422 || status === 400) {\n\t\tdetail.shouldSwap = true;\n\t\tdetail.isError = false;\n\t}\n});\nbody.addEventListener('htmx:configRequest', function (evt) {\n\tif (!localStorage.getItem('jwt')) {\n\t\treturn;\n\t}\n\tevt.detail.headers[AUTH_HEADER] = 'Bearer ' + (localStorage.getItem('jwt') || '');\n\tevt.detail.headers[READ_AUTH_HEADER] = 'Bearer ' + (localStorage.getItem('jwt') || '');\n\tevt.detail.headers[REFRESH_HEADER] = (localStorage.getItem('refresh') || '');\n});\n\n"],
"mappings": "0sBAAA,eAAe,OAAO,gBAAiB,cAAc,WAAY,CAChE,aAAc,CACb,MAAM,EACN,KAAK,aAAa,CAAE,KAAM,MAAO,CAAC,CACnC,CACA,mBAAoB,CACnB,IAAIA,EAAS,KAAK,WACdC,EAAQ,SAAS,KAAK,aAAa,OAAO,CAAC,EAC3C,MAAMA,CAAK,IAAGA,EAAQ,GAC1B,IAAMC,EAAa,SAAS,KAAK,aAAa,YAAY,CAAC,EACvDC,EAAQF,EACRG,EAAQ,EACP,MAAMF,CAAU,IACpBC,EAAQ,KAAK,MAAMF,EAAQC,CAAU,EACrCE,EAAQH,EAAQC,GAEjB,IAAMG,EAAW,KAAK,aAAa,UAAU,GAAK,MAClDL,EAAO,UAAY,4CAA4CG,CAAK,IAAIC,GAAS,GAAKA,EAAQA,EAAQ,GAAG,IAAKC,CAAS,QACxH,CACD,CAAC,ECnBM,IAAMC,EAAWC,GAAW,CAClC,IAAIC,EAAM,GACV,QAASC,EAAI,EAAGA,EAAI,SAAS,YAAY,OAAQA,IAAK,CACrD,IAAMC,EAAa,SAAS,YAAYD,CAAC,EACzC,QAASE,EAAI,EAAGA,EAAID,EAAW,MAAM,OAAQC,IAC5CH,GAAOE,EAAW,MAAMC,CAAC,EAAE,OAE7B,CACA,IAAMC,EAAQ,IAAI,cAClBA,EAAM,YAAYJ,CAAG,EACrBD,EAAO,mBAAqB,CAACK,CAAK,CACnC,ECTA,eAAe,OAAO,gBAAiB,cAAc,WAAY,CAChE,aAAc,CACb,MAAM,EACN,IAAMC,EAAS,KAAK,aAAa,CAAE,KAAM,MAAO,CAAC,EACjDA,EAAO,UAAY;AAAA;AAAA;AAAA;AAAA;AAAA,IAMnBC,EAAQD,CAAM,CACf,CACD,CAAC,ECdD,eAAe,OAAO,wBAAyB,cAAc,WAAY,CACxE,aAAc,CACb,MAAM,EACN,IAAME,EAAS,KAAK,aAAa,CAAE,KAAM,MAAO,CAAC,EACjDA,EAAO,UAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAQpB,CACD,CAAC,ECVD,OAAO,mDAAmD,EAE1D,IAAMC,EAAmB,gBACnBC,EAAc,oBACdC,EAAiB,cACjBC,EAAO,SAAS,KACtBA,EAAK,iBAAiB,oBAAqB,SAAUC,EAAK,CACzD,IAAMC,EAASD,EAAI,OACbE,EAAMD,EAAO,IACbE,EAASD,EAAI,OACbE,EAAaH,EAAO,WAE1B,GAAIE,IAAW,IAAK,CACnB,IAAME,EAASH,EAAI,kBAAkBN,CAAgB,EACjDS,IACH,QAAQ,IAAIH,CAAG,EACf,aAAa,QAAQ,MAAOG,EAAO,QAAQ,YAAa,EAAE,CAAC,GAE5CH,EAAI,kBAAkBJ,CAAc,GAEnD,aAAa,QAAQ,UAAWO,EAAO,QAAQ,YAAa,EAAE,CAAC,CAEjE,MAAWF,IAAW,KACrB,aAAa,WAAW,KAAK,GAE1BA,IAAW,KAAOA,IAAW,OAChCF,EAAO,WAAa,GACpBA,EAAO,QAAU,GAEnB,CAAC,EACDF,EAAK,iBAAiB,qBAAsB,SAAUC,EAAK,CACrD,aAAa,QAAQ,KAAK,IAG/BA,EAAI,OAAO,QAAQH,CAAW,EAAI,WAAa,aAAa,QAAQ,KAAK,GAAK,IAC9EG,EAAI,OAAO,QAAQJ,CAAgB,EAAI,WAAa,aAAa,QAAQ,KAAK,GAAK,IACnFI,EAAI,OAAO,QAAQF,CAAc,EAAK,aAAa,QAAQ,SAAS,GAAK,GAC1E,CAAC",
"names": ["shadow", "price", "multiplier", "major", "minor", "currency", "copyCss", "shadow", "css", "i", "styleSheet", "j", "sheet", "shadow", "copyCss", "shadow", "READ_AUTH_HEADER", "AUTH_HEADER", "REFRESH_HEADER", "body", "evt", "detail", "xhr", "status", "successful", "bearer"]
}

View File

@ -1048,11 +1048,6 @@ select {
background-color: rgb(254 226 226 / var(--tw-bg-opacity));
}
.bg-red-700 {
--tw-bg-opacity: 1;
background-color: rgb(185 28 28 / var(--tw-bg-opacity));
}
.bg-transparent {
background-color: transparent;
}
@ -1075,6 +1070,18 @@ select {
background-position: center;
}
.fill-white {
fill: #fff;
}
.stroke-blue-800 {
stroke: #1e40af;
}
.stroke-red-800 {
stroke: #991b1b;
}
.p-1 {
padding: 0.25rem;
}
@ -1083,6 +1090,10 @@ select {
padding: 0.5rem;
}
.p-2\.5 {
padding: 0.625rem;
}
.p-4 {
padding: 1rem;
}
@ -1101,11 +1112,6 @@ select {
padding-right: 1rem;
}
.px-5 {
padding-left: 1.25rem;
padding-right: 1.25rem;
}
.px-6 {
padding-left: 1.5rem;
padding-right: 1.5rem;
@ -1121,11 +1127,6 @@ select {
padding-bottom: 0.5rem;
}
.py-2\.5 {
padding-top: 0.625rem;
padding-bottom: 0.625rem;
}
.py-3 {
padding-top: 0.75rem;
padding-bottom: 0.75rem;
@ -1143,6 +1144,10 @@ select {
padding-left: 0.75rem;
}
.pl-4 {
padding-left: 1rem;
}
.pr-4 {
padding-right: 1rem;
}
@ -1322,11 +1327,6 @@ select {
background-color: rgb(191 219 254 / var(--tw-bg-opacity));
}
.hover\:bg-blue-800:hover {
--tw-bg-opacity: 1;
background-color: rgb(30 64 175 / var(--tw-bg-opacity));
}
.hover\:bg-gray-100:hover {
--tw-bg-opacity: 1;
background-color: rgb(243 244 246 / var(--tw-bg-opacity));
@ -1337,11 +1337,6 @@ select {
background-color: rgb(254 202 202 / var(--tw-bg-opacity));
}
.hover\:bg-red-800:hover {
--tw-bg-opacity: 1;
background-color: rgb(153 27 27 / var(--tw-bg-opacity));
}
.hover\:bg-yellow-200:hover {
--tw-bg-opacity: 1;
background-color: rgb(254 240 138 / var(--tw-bg-opacity));
@ -1398,11 +1393,6 @@ select {
box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);
}
.focus\:ring-blue-300:focus {
--tw-ring-opacity: 1;
--tw-ring-color: rgb(147 197 253 / var(--tw-ring-opacity));
}
.focus\:ring-blue-500:focus {
--tw-ring-opacity: 1;
--tw-ring-color: rgb(59 130 246 / var(--tw-ring-opacity));
@ -1423,11 +1413,6 @@ select {
--tw-ring-color: rgb(209 213 219 / var(--tw-ring-opacity));
}
.focus\:ring-red-300:focus {
--tw-ring-opacity: 1;
--tw-ring-color: rgb(252 165 165 / var(--tw-ring-opacity));
}
.focus\:ring-offset-2:focus {
--tw-ring-offset-width: 2px;
}
@ -1458,11 +1443,6 @@ select {
border-color: rgb(55 65 81 / var(--tw-border-opacity));
}
.dark\:bg-blue-600 {
--tw-bg-opacity: 1;
background-color: rgb(37 99 235 / var(--tw-bg-opacity));
}
.dark\:bg-blue-900 {
--tw-bg-opacity: 1;
background-color: rgb(30 58 138 / var(--tw-bg-opacity));
@ -1473,11 +1453,6 @@ select {
background-color: rgb(55 65 81 / var(--tw-bg-opacity));
}
.dark\:bg-red-600 {
--tw-bg-opacity: 1;
background-color: rgb(220 38 38 / var(--tw-bg-opacity));
}
.dark\:bg-red-900 {
--tw-bg-opacity: 1;
background-color: rgb(127 29 29 / var(--tw-bg-opacity));
@ -1538,11 +1513,6 @@ select {
color: rgb(156 163 175 / var(--tw-placeholder-opacity));
}
.dark\:hover\:bg-blue-700:hover {
--tw-bg-opacity: 1;
background-color: rgb(29 78 216 / var(--tw-bg-opacity));
}
.dark\:hover\:bg-blue-800:hover {
--tw-bg-opacity: 1;
background-color: rgb(30 64 175 / var(--tw-bg-opacity));
@ -1558,11 +1528,6 @@ select {
background-color: rgb(55 65 81 / var(--tw-bg-opacity));
}
.dark\:hover\:bg-red-700:hover {
--tw-bg-opacity: 1;
background-color: rgb(185 28 28 / var(--tw-bg-opacity));
}
.dark\:hover\:bg-red-800:hover {
--tw-bg-opacity: 1;
background-color: rgb(153 27 27 / var(--tw-bg-opacity));
@ -1613,20 +1578,10 @@ select {
--tw-ring-color: rgb(59 130 246 / var(--tw-ring-opacity));
}
.dark\:focus\:ring-blue-800:focus {
--tw-ring-opacity: 1;
--tw-ring-color: rgb(30 64 175 / var(--tw-ring-opacity));
}
.dark\:focus\:ring-gray-600:focus {
--tw-ring-opacity: 1;
--tw-ring-color: rgb(75 85 99 / var(--tw-ring-opacity));
}
.dark\:focus\:ring-red-800:focus {
--tw-ring-opacity: 1;
--tw-ring-color: rgb(153 27 27 / var(--tw-ring-opacity));
}
}
@media (min-width: 640px) {

View File

@ -8,6 +8,7 @@ mod m20230726_135630_parking_spaces;
mod m20230805_000001_add_email;
mod m20230809_135630_add_spot;
mod m20230810_105100_create_parking_space_locations;
mod m20230919_162830_create_rent_requests;
pub struct Migrator;
@ -21,6 +22,7 @@ impl MigratorTrait for Migrator {
Box::new(m20230805_000001_add_email::Migration),
Box::new(m20230809_135630_add_spot::Migration),
Box::new(m20230810_105100_create_parking_space_locations::Migration),
Box::new(m20230919_162830_create_rent_requests::Migration),
]
}
}

View File

@ -0,0 +1,92 @@
use sea_orm_migration::prelude::*;
use crate::m20220101_000001_create_table::Account;
use crate::m20230726_135630_parking_spaces::ParkingSpace;
use crate::m20230726_135630_parking_spaces::ParkingSpaceRent;
#[derive(DeriveMigrationName)]
pub struct Migration;
#[async_trait::async_trait]
impl MigrationTrait for Migration {
async fn up(&self, m: &SchemaManager) -> Result<(), DbErr> {
m.create_table(
Table::create()
.table(RentRequest::RentRequests)
.if_not_exists()
.col(
ColumnDef::new(RentRequest::Id)
.integer()
.not_null()
.auto_increment()
.primary_key(),
)
.col(ColumnDef::new(RentRequest::ParkingSpaceId).integer())
.col(ColumnDef::new(RentRequest::ParkingSpaceRentId).integer())
.col(ColumnDef::new(RentRequest::AccountId).integer())
.col(
ColumnDef::new(RentRequest::CreatedAt)
.timestamp()
.default(SimpleExpr::Custom("NOW()".to_owned()))
.not_null(),
)
.col(
ColumnDef::new(RentRequest::UpdatedAt)
.timestamp()
.default(SimpleExpr::Custom("NOW()".to_owned()))
.not_null(),
)
.if_not_exists()
.to_owned(),
)
.await?;
m.create_foreign_key(
ForeignKeyCreateStatement::new()
.from_tbl(RentRequest::RentRequests)
.from_col(RentRequest::ParkingSpaceId)
.to_tbl(ParkingSpace::ParkingSpaces)
.to_col(ParkingSpace::Id)
.to_owned(),
)
.await?;
m.create_foreign_key(
ForeignKeyCreateStatement::new()
.from_tbl(RentRequest::RentRequests)
.from_col(RentRequest::ParkingSpaceId)
.to_tbl(ParkingSpaceRent::ParkingSpaceRents)
.to_col(ParkingSpaceRent::Id)
.to_owned(),
)
.await?;
m.create_foreign_key(
ForeignKeyCreateStatement::new()
.from_tbl(RentRequest::RentRequests)
.from_col(RentRequest::AccountId)
.to_tbl(Account::Accounts)
.to_col(Account::Id)
.to_owned(),
)
.await?;
Ok(())
}
async fn down(&self, m: &SchemaManager) -> Result<(), DbErr> {
m.drop_table(Table::drop().table(RentRequest::RentRequests).to_owned())
.await?;
Ok(())
}
}
#[derive(Iden)]
pub enum RentRequest {
RentRequests,
Id,
ParkingSpaceId,
ParkingSpaceRentId,
AccountId,
CreatedAt,
UpdatedAt,
}

View File

@ -71,7 +71,10 @@ pub fn derive_actix_admin_enum(item: TokenStream) -> TokenStream {
}
buffer.push_str(" _ => Err(()),\n");
buffer.push_str(" }\n }\n}");
buffer.push_str(&format!("impl ToString for {} {{\n fn to_string(&self) -> String {{\n match self {{\n", def.name));
buffer.push_str(&format!(
"impl ToString for {} {{\n fn to_string(&self) -> String {{\n match self {{\n",
def.name
));
for v in def.variants {
buffer.push_str(&format!(
" {}::{} => {:?},\n",

View File

@ -1,4 +1,4 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.2
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2
use super::sea_orm_active_enums::Userrole;
use actix_admin::prelude::*;
@ -38,9 +38,9 @@ pub struct Model {
pub banned: bool,
pub confirmed: bool,
pub verified: bool,
#[actix_admin(list_hide_column)]
#[actix_admin(list_hide_column, column_type = "NaiveDateTime")]
pub created_at: DateTime,
#[actix_admin(list_hide_column)]
#[actix_admin(list_hide_column, column_type = "NaiveDateTime")]
pub updated_at: DateTime,
#[actix_admin(html_input_type = "email")]
pub email: String,
@ -76,6 +76,7 @@ impl PrimaryKeyTrait for PrimaryKey {
pub enum Relation {
Images,
ParkingSpaces,
RentRequests,
}
impl ColumnTrait for Column {
@ -101,6 +102,7 @@ impl RelationTrait for Relation {
match self {
Self::Images => Entity::has_many(super::images::Entity).into(),
Self::ParkingSpaces => Entity::has_many(super::parking_spaces::Entity).into(),
Self::RentRequests => Entity::has_many(super::rent_requests::Entity).into(),
}
}
}
@ -117,4 +119,10 @@ impl Related<super::parking_spaces::Entity> for Entity {
}
}
impl Related<super::rent_requests::Entity> for Entity {
fn to() -> RelationDef {
Relation::RentRequests.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -1,4 +1,4 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.2
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2
use super::sea_orm_active_enums::ImageState;
use actix_admin::prelude::*;
@ -35,9 +35,9 @@ pub struct Model {
pub public_path: String,
pub image_state: ImageState,
pub account_id: i32,
#[actix_admin(list_hide_column)]
#[actix_admin(list_hide_column, column_type = "NaiveDateTime")]
pub created_at: DateTime,
#[actix_admin(list_hide_column)]
#[actix_admin(list_hide_column, column_type = "NaiveDateTime")]
pub updated_at: DateTime,
}

View File

@ -1,4 +1,4 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.2
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2
pub mod prelude;
@ -7,4 +7,7 @@ pub mod images;
pub mod parking_space_locations;
pub mod parking_space_rents;
pub mod parking_spaces;
pub mod rent_requests;
pub mod sea_orm_active_enums;
pub use actix_admin;
pub use sea_orm;

View File

@ -1,4 +1,4 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.2
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2
use actix_admin::prelude::*;
use sea_orm::entity::prelude::*;
@ -33,9 +33,9 @@ pub struct Model {
pub name: String,
pub number: i32,
pub stage: String,
#[actix_admin(list_hide_column)]
#[actix_admin(list_hide_column, column_type = "NaiveDateTime")]
pub created_at: DateTime,
#[actix_admin(list_hide_column)]
#[actix_admin(list_hide_column, column_type = "NaiveDateTime")]
pub updated_at: DateTime,
}

View File

@ -1,4 +1,4 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.2
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2
use actix_admin::prelude::*;
use sea_orm::entity::prelude::*;
@ -34,9 +34,9 @@ pub struct Model {
#[actix_admin(select_list=crate::parking_spaces::Entity)]
pub parking_space_id: i32,
pub available: bool,
#[actix_admin(list_hide_column)]
#[actix_admin(list_hide_column, column_type = "NaiveDateTime")]
pub created_at: DateTime,
#[actix_admin(list_hide_column)]
#[actix_admin(list_hide_column, column_type = "NaiveDateTime")]
pub updated_at: DateTime,
}
@ -65,6 +65,7 @@ impl PrimaryKeyTrait for PrimaryKey {
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {
ParkingSpaces,
RentRequests,
}
impl ColumnTrait for Column {
@ -88,6 +89,7 @@ impl RelationTrait for Relation {
.from(Column::ParkingSpaceId)
.to(super::parking_spaces::Column::Id)
.into(),
Self::RentRequests => Entity::has_many(super::rent_requests::Entity).into(),
}
}
}
@ -98,4 +100,10 @@ impl Related<super::parking_spaces::Entity> for Entity {
}
}
impl Related<super::rent_requests::Entity> for Entity {
fn to() -> RelationDef {
Relation::RentRequests.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -1,4 +1,4 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.2
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2
use super::sea_orm_active_enums::ParkingSpaceState;
use actix_admin::prelude::*;
@ -34,9 +34,9 @@ pub struct Model {
#[actix_admin(select_list=crate::parking_spaces::ParkingSpaceState)]
pub state: ParkingSpaceState,
pub account_id: i32,
#[actix_admin(list_hide_column)]
#[actix_admin(list_hide_column, column_type = "NaiveDateTime")]
pub created_at: DateTime,
#[actix_admin(list_hide_column)]
#[actix_admin(list_hide_column, column_type = "NaiveDateTime")]
pub updated_at: DateTime,
pub spot: Option<i32>,
#[actix_admin(select_list=crate::parking_space_locations::Entity)]
@ -71,6 +71,7 @@ pub enum Relation {
Accounts,
ParkingSpaceLocations,
ParkingSpaceRents,
RentRequests,
}
impl ColumnTrait for Column {
@ -102,6 +103,7 @@ impl RelationTrait for Relation {
.into()
}
Self::ParkingSpaceRents => Entity::has_many(super::parking_space_rents::Entity).into(),
Self::RentRequests => Entity::has_many(super::rent_requests::Entity).into(),
}
}
}
@ -124,4 +126,10 @@ impl Related<super::parking_space_rents::Entity> for Entity {
}
}
impl Related<super::rent_requests::Entity> for Entity {
fn to() -> RelationDef {
Relation::RentRequests.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -1,7 +1,8 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.2
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2
pub use super::accounts::Entity as Accounts;
pub use super::images::Entity as Images;
pub use super::parking_space_locations::Entity as ParkingSpaceLocations;
pub use super::parking_space_rents::Entity as ParkingSpaceRents;
pub use super::parking_spaces::Entity as ParkingSpaces;
pub use super::rent_requests::Entity as RentRequests;

View File

@ -0,0 +1,123 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2
use actix_admin::prelude::*;
use sea_orm::entity::prelude::*;
#[allow(unused_imports)]
use sea_orm::Iterable;
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;
impl ActixAdminModelValidationTrait<ActiveModel> for Entity {}
impl ActixAdminModelFilterTrait<Entity> for Entity {}
impl EntityName for Entity {
fn table_name(&self) -> &str {
"rent_requests"
}
}
#[derive(
Clone,
Debug,
PartialEq,
DeriveModel,
DeriveActiveModel,
Eq,
DeriveActixAdmin,
DeriveActixAdminModel,
DeriveActixAdminViewModel,
)]
pub struct Model {
#[actix_admin(primary_key)]
pub id: i32,
#[actix_admin(select_list=crate::parking_spaces::Entity)]
pub parking_space_id: Option<i32>,
pub parking_space_rent_id: Option<i32>,
pub account_id: Option<i32>,
#[actix_admin(list_hide_column, column_type = "NaiveDateTime")]
pub created_at: DateTime,
#[actix_admin(list_hide_column, column_type = "NaiveDateTime")]
pub updated_at: DateTime,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
Id,
ParkingSpaceId,
ParkingSpaceRentId,
AccountId,
CreatedAt,
UpdatedAt,
}
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
Id,
}
impl PrimaryKeyTrait for PrimaryKey {
type ValueType = i32;
fn auto_increment() -> bool {
true
}
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {
Accounts,
ParkingSpaceRents,
ParkingSpaces,
}
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::Id => ColumnType::Integer.def(),
Self::ParkingSpaceId => ColumnType::Integer.def().null(),
Self::ParkingSpaceRentId => ColumnType::Integer.def().null(),
Self::AccountId => ColumnType::Integer.def().null(),
Self::CreatedAt => ColumnType::DateTime.def(),
Self::UpdatedAt => ColumnType::DateTime.def(),
}
}
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
match self {
Self::Accounts => Entity::belongs_to(super::accounts::Entity)
.from(Column::AccountId)
.to(super::accounts::Column::Id)
.into(),
Self::ParkingSpaceRents => Entity::belongs_to(super::parking_space_rents::Entity)
.from(Column::ParkingSpaceId)
.to(super::parking_space_rents::Column::Id)
.into(),
Self::ParkingSpaces => Entity::belongs_to(super::parking_spaces::Entity)
.from(Column::ParkingSpaceId)
.to(super::parking_spaces::Column::Id)
.into(),
}
}
}
impl Related<super::accounts::Entity> for Entity {
fn to() -> RelationDef {
Relation::Accounts.def()
}
}
impl Related<super::parking_space_rents::Entity> for Entity {
fn to() -> RelationDef {
Relation::ParkingSpaceRents.def()
}
}
impl Related<super::parking_spaces::Entity> for Entity {
fn to() -> RelationDef {
Relation::ParkingSpaces.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -1,4 +1,4 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.2
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2
use actix_admin::prelude::*;
use sea_orm::entity::prelude::*;

View File

@ -13,7 +13,7 @@ autometrics = { version = "0.5.0", features = ["tracing", "tracing-subscriber",
oswilno-contract = { path = "../oswilno-contract" }
oswilno-session = { path = "../oswilno-session" }
oswilno-view = { path = "../oswilno-view" }
sea-orm = { version = "0.11.1", features = ["runtime-actix-rustls", "sqlx", "sqlx-postgres", "debug-print"] }
sea-orm = { version = "0.12", features = ["runtime-actix-rustls", "sqlx", "sqlx-postgres", "debug-print"] }
serde = { version = "1.0.176", features = ["derive"] }
serde_json = "1.0.104"
tokio = { version = "1.29.1", features = ["full"] }

View File

@ -1,6 +1,6 @@
use actix_web::http::header::ContentType;
use actix_web::web::{scope, Data, Form, Path, ServiceConfig};
use actix_web::{get, post, HttpRequest, HttpResponse};
use actix_web::{get, post, put, HttpRequest, HttpResponse};
use askama_actix::Template;
use autometrics::autometrics;
use oswilno_contract::parking_space_rents;
@ -14,6 +14,8 @@ use oswilno_view::{
};
use sea_orm::prelude::*;
use sea_orm::ActiveValue::{NotSet, Set};
use sea_orm::QueryOrder;
use serde::Deserialize;
use std::collections::BTreeMap;
use std::rc::Rc;
use std::sync::Arc;
@ -127,6 +129,7 @@ async fn load_parking_spaces(
.is_in(ids)
.or(parking_spaces::Column::AccountId.eq(account_id)),
)
.order_by_asc(parking_spaces::Column::Id)
.all(&*db)
.await
.unwrap()
@ -448,3 +451,27 @@ async fn update(
.append_header(("HX-Redirect", "/parking-spaces/all"))
.finish()
}
#[derive(Debug, Deserialize)]
struct ParkingSpaceForm {
pub id: Option<i32>,
pub price: i32,
pub parking_space_id: i32,
}
#[get("/parking-space-rents/form")]
async fn parking_space_rent_form() -> HttpResponse {
todo!()
}
#[get("/parking-space-rents/edit/{id}")]
async fn parking_space_rent_edit(id: Path<i32>) -> HttpResponse {
todo!()
}
#[post("/parking-space-rents/create")]
async fn parking_space_rent_create(form: Form<ParkingSpaceForm>) -> HttpResponse {
todo!()
}
#[put("/parking-space-rents/update")]
async fn parking_space_rent_update(form: Form<ParkingSpaceForm>) -> HttpResponse {
todo!()
}

View File

@ -0,0 +1,48 @@
<section id="main-view" class="min-h-screen flex items-center justify-center">
<section class="max-w-md w-full p-6 bg-white rounded-lg shadow-lg">
<form
{% if let Some(id) = form.id %}
hx-put='/parking-space-rents/update/{{id}}'
{% else %}
hx-post='/parking-space-rents/create'
{% endif %}
hx-headers="{'Accept':'text/html-partial'}"
>
{% if let Some(id) = form.id %}
<input type="hidden" value="{{id}}" name="id" />
{% endif %}
<input type="hidden" value="{{parking_space.id}}" name="parking_space_id" />
<div class="mb-4">
<label
for="price"
class="block mb-2 text-sm text-gray-600"
>
{{ "Price"|t(lang,t) }}
</label>
<input
id="price"
name="price"
class="w-full px-4 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-cyan-500"
type="number"
required
{% if let Some(v) = form.price %}
value="{{v}}"
{% endif %}
/>
</div>
<div class="mb-6">
<input
type="submit"
{% if let Some(id) = form.id %}
value="{{"Update parking space rent"|t(lang,t)}}"
{% else %}
value="{{"Register parking space rent"|t(lang,t)}}"
{% endif %}
class="w-64 bg-cyan-600 text-white py-2 rounded-lg mx-auto block focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-cyan-500 mb-2"
/>
</div>
</form>
</section>
</section>

View File

@ -77,24 +77,46 @@
</div>
</div>
{% endmatch %}
<div>
<div class="flex">
<a class="text-white focus:ring-4 focus:outline-none font-medium rounded-lg text-sm p-2.5 text-center inline-flex items-center" >
<svg height="48" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 171.439 171.439" xml:space="preserve" fill="#000000A">
<path style="fill:#000002;" d="M21.803,171.439c-0.463,0-0.922-0.129-1.322-0.378c-0.563-0.351-0.963-0.91-1.113-1.557L1.182,91.241 c-0.313-1.345,0.524-2.688,1.869-3.001l6.729-1.563l76.692-64.254l-4.435-4.012c-1.514,0.934-3.295,1.472-5.2,1.472 c-5.482,0-9.941-4.46-9.941-9.941S71.355,0,76.837,0s9.941,4.46,9.941,9.941c0,1.766-0.463,3.426-1.273,4.864l4.837,4.375 l1.117-0.936c0.902-0.757,2.21-0.781,3.141-0.058l48.281,37.561l6.189-1.438c1.347-0.309,2.688,0.525,3.001,1.87l18.187,78.263 c0.313,1.345-0.524,2.688-1.869,3.001L22.369,171.375C22.182,171.418,21.992,171.439,21.803,171.439z M6.618,92.545l17.054,73.394 l141.149-32.8l-17.055-73.393l-4.879,1.134c-0.022,0.006-0.045,0.011-0.068,0.016L11.556,91.397 c-0.041,0.011-0.082,0.021-0.124,0.029L6.618,92.545z M90.216,25.809L20.553,84.174L136.61,57.205L96.188,25.759 c-0.038,0.539-0.25,1.07-0.64,1.502c-0.925,1.024-2.506,1.104-3.531,0.178L90.216,25.809z M76.837,5 c-2.725,0-4.941,2.217-4.941,4.941s2.217,4.941,4.941,4.941c1.361,0,2.596-0.554,3.491-1.447c0.026-0.027,0.052-0.055,0.079-0.081 c0.849-0.888,1.372-2.091,1.372-3.413C81.778,7.217,79.562,5,76.837,5z M40.256,140.785c-1.135,0-2.162-0.778-2.432-1.931 l-6.447-27.504c-0.315-1.344,0.519-2.689,1.864-3.004c0.829-0.194,1.659,0.048,2.247,0.579c1.199-1.163,2.694-1.983,4.362-2.374 c2.429-0.569,4.937-0.16,7.058,1.156c2.121,1.315,3.603,3.378,4.173,5.809c1.176,5.016-1.949,10.055-6.965,11.23 c-0.386,0.091-0.773,0.156-1.158,0.196l12.745,7.904c1.173,0.729,1.534,2.27,0.807,3.442c-0.728,1.174-2.268,1.533-3.442,0.808 l-12.309-7.635l1.934,8.251c0.315,1.344-0.52,2.689-1.864,3.004C40.637,140.763,40.445,140.785,40.256,140.785z M41.992,111.303 c-0.333,0-0.668,0.039-1,0.116c-1.13,0.266-2.089,0.954-2.701,1.94c-0.612,0.986-0.803,2.151-0.538,3.281 c0.546,2.331,2.888,3.778,5.222,3.239c2.332-0.548,3.785-2.89,3.238-5.223c-0.265-1.13-0.954-2.089-1.94-2.7 C43.577,111.525,42.792,111.303,41.992,111.303z M67.849,133.016c-1.135,0-2.162-0.778-2.432-1.931l-2.969-12.666 c-0.003-0.011-0.005-0.021-0.008-0.033c-0.002-0.011-0.005-0.021-0.007-0.033l-3.14-13.396c0-0.002-0.001-0.005-0.002-0.008 c-0.315-1.344,0.52-2.689,1.864-3.004L76,98.466c1.343-0.315,2.689,0.52,3.004,1.863s-0.52,2.689-1.864,3.004l-12.411,2.909 l2.009,8.568l7.462-1.749c1.344-0.316,2.69,0.52,3.005,1.863c0.315,1.344-0.519,2.689-1.863,3.004l-7.463,1.75l1.835,7.831 l12.412-2.908c1.343-0.315,2.689,0.52,3.004,1.863s-0.52,2.689-1.864,3.004l-14.838,3.479c-0.002,0-0.005,0.001-0.007,0.001 C68.23,132.993,68.038,133.016,67.849,133.016z M93.49,127.005c-1.135,0-2.162-0.778-2.432-1.931l-6.126-26.136 c-0.219-0.933,0.116-1.865,0.791-2.455c0.929-1.001,2.494-1.075,3.51-0.155l18.833,17.021l-4.407-18.801 c-0.315-1.344,0.519-2.689,1.863-3.004c1.346-0.315,2.69,0.52,3.005,1.863l6.126,26.136c0.218,0.93-0.115,1.861-0.786,2.45 c-0.927,1.009-2.495,1.083-3.515,0.161L91.52,105.135l4.406,18.799c0.315,1.344-0.519,2.689-1.864,3.004 C93.871,126.982,93.679,127.005,93.49,127.005z M131.954,117.989c-1.135,0-2.162-0.778-2.432-1.931l-5.556-23.702l-6.93,1.624 c-1.344,0.313-2.69-0.52-3.004-1.863c-0.315-1.344,0.519-2.689,1.864-3.004l18.727-4.39c1.344-0.316,2.689,0.52,3.004,1.863 c0.315,1.344-0.519,2.689-1.864,3.004l-6.929,1.625l5.556,23.702c0.315,1.344-0.519,2.689-1.863,3.004 C132.335,117.967,132.143,117.989,131.954,117.989z">
</path>
</svg>
</a>
<a
href="/parking-spaces/edit/{{parking_space.id}}"
hx-target="main"
hx-get="/parking-spaces/edit/{{parking_space.id}}"
hx-headers='{"Accept":"text/html-partial"}'
class="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center inline-flex items-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"
class="text-white focus:ring-4 focus:outline-none font-medium rounded-lg text-sm p-2.5 text-center inline-flex items-center"
>
Edit
<svg height="48" version="1.1" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" class="fill-white">
<path d="M20,16v4a2,2,0,0,1-2,2H4a2,2,0,0,1-2-2V6A2,2,0,0,1,4,4H8" class="stroke-blue-800" stroke-linecap="round" stroke-linejoin="round" stroke-width="2">
</path>
<polygon fill="none" points="12.5 15.8 22 6.2 17.8 2 8.3 11.5 8 16 12.5 15.8" class="stroke-blue-800" stroke-linecap="round" stroke-linejoin="round" stroke-width="2">
</polygon>
</svg>
</a>
<a
href="/parking-spaces/delete/{{parking_space.id}}"
hx-target="main"
hx-delete="/parking-spaces/edit/{{parking_space.id}}"
hx-headers='{"Accept":"text/html-partial"}'
class="text-white bg-red-700 hover:bg-red-800 focus:ring-4 focus:outline-none focus:ring-red-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center inline-flex items-center dark:bg-red-600 dark:hover:bg-red-700 dark:focus:ring-red-800"
class="text-white focus:ring-4 focus:outline-none font-medium rounded-lg text-sm p-2.5 text-center inline-flex items-center"
>
Delete
<svg viewBox="0 0 24 24" height="48" class="stroke-red-800 fill-white" xmlns="http://www.w3.org/2000/svg">
<path d="M10 12V17" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
</path>
<path d="M14 12V17" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
</path>
<path d="M4 7H20" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
</path>
<path d="M6 10V18C6 19.6569 7.34315 21 9 21H15C16.6569 21 18 19.6569 18 18V10" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
</path>
<path d="M9 5C9 3.89543 9.89543 3 11 3H13C14.1046 3 15 3.89543 15 5V7H9V5Z" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
</path>
</svg>
</a>
</div>

View File

@ -17,7 +17,7 @@ oswilno-session = { path = "../oswilno-session" }
oswilno-view = { path = "../oswilno-view" }
redis = { version = "0.17" }
redis-async-pool = "0.2.4"
sea-orm = { version = "0.11", features = ["postgres-array", "runtime-actix-rustls", "sqlx-postgres"] }
sea-orm = { version = "0.12", features = ["postgres-array", "runtime-actix-rustls", "sqlx-postgres"] }
serde = { version = "1.0.175", features = ["derive"] }
serde_json = "1.0.103"
tokio = { version = "1.29.1", features = ["full"] }

View File

@ -21,7 +21,7 @@ rand = "0.8.5"
redis = { version = "0.17" }
redis-async-pool = "0.2.4"
ring = "0.16.20"
sea-orm = { version = "0.11", features = ["postgres-array", "runtime-actix-rustls", "sqlx-postgres", "macros", "sqlx"] }
sea-orm = { version = "0.12", features = ["postgres-array", "runtime-actix-rustls", "sqlx-postgres", "macros", "sqlx"] }
serde = { version = "1.0.180", features = ["derive"] }
time = "0.3.24"
tokio = { version = "1.29.1", features = ["full"] }

View File

@ -10,7 +10,6 @@ use garde::Validate;
use oswilno_view::{Blank, Errors, Lang, Layout, Main, MainOpts, TranslationStorage};
use sea_orm::DatabaseConnection;
use serde::{Deserialize, Serialize};
use sea_orm::prelude::*;
pub use oswilno_view::filters;

View File

@ -9,6 +9,7 @@
<script src="/assets/build.js" type="module"></script>
<link href="https://use.fontawesome.com/releases/v5.0.6/css/all.css" rel="stylesheet" />
<link href="/assets/style.css" rel="stylesheet">
<link rel="icon" href="/assets/favicon.svg">
{% block head %}
{% endblock %}
</head>

View File

@ -1,8 +1,17 @@
<nav class="bg-transparent">
<div class="max-w-screen-xl flex flex-wrap items-center justify-between mx-auto p-4">
<a href="https://flowbite.com/" class="flex items-center">
<img src="https://flowbite.com/docs/images/logo.svg" class="h-8 mr-3" alt="Flowbite Logo" />
<span class="self-center text-2xl font-semibold whitespace-nowrap dark:text-white">Flowbite</span>
<a href="/" class="flex items-center">
<svg height="48" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 502.648 502.648" xml:space="preserve" class="fill-white">
<circle cx="250.399" cy="91.549" r="58.694">
</circle>
<path d="M455.861,253.028l-54.703-11.411c-18.637-3.904-37.037,4.638-46.765,19.824 c-9.448-4.853-19.608-9.038-30.415-12.511v-32.529c0.022-24.612-20.126-44.738-44.651-44.738h-55.933 c-24.655,0-44.716,20.126-44.716,44.738v32.701c-10.699,3.408-20.751,7.593-30.264,12.468 c-9.728-15.251-28.15-23.857-46.809-19.953l-54.747,11.411c-24.03,5.026-39.626,28.862-34.6,52.978l13.741,65.64 c4.983,24.051,28.84,39.647,52.892,34.621l17.321-3.624c8.671,12.813,20.665,24.569,36.023,34.621 c31.989,20.967,74.247,32.529,119.092,32.529c68.617,0,127.721-27.589,154.943-67.215l17.602,3.689 c24.03,5.004,47.887-10.57,52.87-34.621l13.762-65.64C495.508,281.89,479.912,258.054,455.861,253.028z M251.305,447.381 c-40.51,0-78.475-10.203-106.797-28.862c-9.707-6.342-17.753-13.395-24.202-20.945l13.266-2.783 c24.073-5.004,39.669-28.84,34.643-52.913l-12.317-59.018c7.183-3.861,14.733-7.248,22.757-10.138v10.764 c0,24.569,20.104,44.695,44.716,44.695h55.933c24.548,0,44.652-20.147,44.652-44.695v-11.325 c8.175,2.912,15.854,6.256,22.973,10.052L334.439,341.9c-4.983,24.073,10.591,47.909,34.664,52.913l13.395,2.804 C357.52,427.191,308.101,447.381,251.305,447.381z">
</path>
<circle cx="443.954" cy="168.708" r="58.694">
</circle>
<path d="M70.736,226.172c31.752-6.644,52.029-37.77,45.471-69.501 c-6.687-31.709-37.749-52.072-69.523-45.428c-31.709,6.622-52.072,37.727-45.428,69.458 C7.879,212.453,38.984,232.795,70.736,226.172z">
</path>
</svg>
<span class="self-center text-2xl font-semibold whitespace-nowrap dark:text-white pl-4">os. Wilno</span>
</a>
{% include "nav/session-menu.html" %}

View File

@ -32,10 +32,11 @@ body.addEventListener('htmx:beforeOnLoad', function (evt) {
}
});
body.addEventListener('htmx:configRequest', function (evt) {
if (localStorage.getItem('jwt')) {
if (!localStorage.getItem('jwt')) {
return;
}
evt.detail.headers[AUTH_HEADER] = 'Bearer ' + (localStorage.getItem('jwt') || '');
evt.detail.headers[READ_AUTH_HEADER] = 'Bearer ' + (localStorage.getItem('jwt') || '');
evt.detail.headers[REFRESH_HEADER] = (localStorage.getItem('refresh') || '');
}
});

View File

@ -0,0 +1,10 @@
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 502.648 502.648" xml:space="preserve" fill="#000000">
<circle cx="250.399" cy="91.549" r="58.694">
</circle>
<path d="M455.861,253.028l-54.703-11.411c-18.637-3.904-37.037,4.638-46.765,19.824 c-9.448-4.853-19.608-9.038-30.415-12.511v-32.529c0.022-24.612-20.126-44.738-44.651-44.738h-55.933 c-24.655,0-44.716,20.126-44.716,44.738v32.701c-10.699,3.408-20.751,7.593-30.264,12.468 c-9.728-15.251-28.15-23.857-46.809-19.953l-54.747,11.411c-24.03,5.026-39.626,28.862-34.6,52.978l13.741,65.64 c4.983,24.051,28.84,39.647,52.892,34.621l17.321-3.624c8.671,12.813,20.665,24.569,36.023,34.621 c31.989,20.967,74.247,32.529,119.092,32.529c68.617,0,127.721-27.589,154.943-67.215l17.602,3.689 c24.03,5.004,47.887-10.57,52.87-34.621l13.762-65.64C495.508,281.89,479.912,258.054,455.861,253.028z M251.305,447.381 c-40.51,0-78.475-10.203-106.797-28.862c-9.707-6.342-17.753-13.395-24.202-20.945l13.266-2.783 c24.073-5.004,39.669-28.84,34.643-52.913l-12.317-59.018c7.183-3.861,14.733-7.248,22.757-10.138v10.764 c0,24.569,20.104,44.695,44.716,44.695h55.933c24.548,0,44.652-20.147,44.652-44.695v-11.325 c8.175,2.912,15.854,6.256,22.973,10.052L334.439,341.9c-4.983,24.073,10.591,47.909,34.664,52.913l13.395,2.804 C357.52,427.191,308.101,447.381,251.305,447.381z">
</path>
<circle cx="443.954" cy="168.708" r="58.694">
</circle>
<path d="M70.736,226.172c31.752-6.644,52.029-37.77,45.471-69.501 c-6.687-31.709-37.749-52.072-69.523-45.428c-31.709,6.622-52.072,37.727-45.428,69.458 C7.879,212.453,38.984,232.795,70.736,226.172z">
</path>
</svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -4,6 +4,7 @@ use actix_web::{get, web::ServiceConfig, HttpResponse};
pub fn mount(config: &mut ServiceConfig) {
config
.service(serve_favicon_svg)
.service(serve_build_js)
.service(serve_build_js_map)
.service(serve_build_css)
@ -11,19 +12,57 @@ pub fn mount(config: &mut ServiceConfig) {
}
macro_rules! static_resource {
($serve: ident, $name: ident, $path: expr, $once: ident, $content: ident, $ty: expr) => {
($serve: ident, $name: ident, $path: expr, $once: ident, $content: ident, $ty: expr, this_file) => {
static $once: Once = Once::new();
static mut $content: String = String::new();
fn $name() -> Cow<'static, str> {
let this_file = std::path::Path::new(file!())
.parent()
.unwrap()
.parent()
.unwrap()
.to_owned();
let path = this_file.join(concat!(".", $path));
if cfg!(debug_assertions) {
build();
std::fs::read_to_string(concat!(".", $path)).unwrap().into()
std::fs::read_to_string(&path)
.unwrap_or_else(|e| panic!("Failed to read file {path:?}: {e}"))
.into()
} else {
$once.call_once(|| {
build();
unsafe {
$content = std::fs::read_to_string(concat!(".", $path)).unwrap();
$content = std::fs::read_to_string(&path).unwrap();
}
});
unsafe { $content.as_str().into() }
}
}
#[get($path)]
async fn $serve() -> HttpResponse {
HttpResponse::Ok()
.append_header(("Content-Type", $ty.unwrap_or("application/javascript")))
.body($name())
}
};
($serve: ident, $name: ident, $path: expr, $once: ident, $content: ident, $ty: expr, root) => {
static $once: Once = Once::new();
static mut $content: String = String::new();
fn $name() -> Cow<'static, str> {
let path = concat!(".", $path);
if cfg!(debug_assertions) {
build();
std::fs::read_to_string(&path)
.unwrap_or_else(|e| panic!("Failed to read file {path:?}: {e}"))
.into()
} else {
$once.call_once(|| {
build();
unsafe {
$content = std::fs::read_to_string(&path).unwrap();
}
});
unsafe { $content.as_str().into() }
@ -45,7 +84,8 @@ static_resource!(
"/assets/build.js",
BUILD_JS_GUARD,
BUILD_JS,
Some("application/javascript")
Some("application/javascript"),
root
);
static_resource!(
serve_build_js_map,
@ -53,7 +93,8 @@ static_resource!(
"/assets/build.js.map",
BUILD_JS_MAP_GUARD,
BUILD_JS_MAP,
Some("application/javascript")
Some("application/javascript"),
root
);
static_resource!(
@ -62,7 +103,8 @@ static_resource!(
"/assets/style.css",
BUILD_CSS_GUARD,
BUILD_CSS,
Some("text/css")
Some("text/css"),
root
);
static_resource!(
serve_build_css_map,
@ -70,7 +112,18 @@ static_resource!(
"/assets/style.css.map",
BUILD_CSS_MAP_GUARD,
BUILD_CSS_MAP,
Some("text/plain")
Some("text/plain"),
root
);
static_resource!(
serve_favicon_svg,
favicon_svg,
"/assets/favicon.svg",
FAVICON_SVG_GUARD,
FAVICON_SVG,
Some("text/svg+xml"),
this_file
);
fn build() {

View File

@ -2,6 +2,8 @@
sea-orm-cli generate entity -v -l --expanded-format -o ./crates/oswilno-contract/src -u postgres://postgres@localhost/oswilno
echo 'pub use sea_orm;' >> ./crates/oswilno-contract/src/lib.rs
echo 'pub use actix_admin;' >> ./crates/oswilno-contract/src/lib.rs
for f in $( ls ./crates/oswilno-contract/src/*.rs ); do
# bad generated code patch
@ -46,7 +48,7 @@ for f in $(ls crates/oswilno-contract/src/*.rs); do
echo "#[actix_admin(list_hide_column)]" >> /tmp/ajosdfjosdpjfojsdfjpajpfa
;;
*"_at: DateTime," )
echo "#[actix_admin(list_hide_column)]" >> /tmp/ajosdfjosdpjfojsdfjpajpfa
echo "#[actix_admin(list_hide_column, column_type = \"NaiveDateTime\")]" >> /tmp/ajosdfjosdpjfojsdfjpajpfa
;;
*"parking_space_id"* )
echo '#[actix_admin(select_list=crate::parking_spaces::Entity)]' >> /tmp/ajosdfjosdpjfojsdfjpajpfa