Compare commits
428 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4304617181 | |||
| 7d6eb7bc60 | |||
| d4b2a45e7b | |||
| c9f47adab4 | |||
| 2ed939615c | |||
| 362e3b0aff | |||
| c02093ebec | |||
| cdcf627115 | |||
| 231f27292b | |||
| cbd3e42f0a | |||
| fa50214527 | |||
| 5d09b5f998 | |||
| dff6bf2201 | |||
| 305ae11d52 | |||
| 6e9fb8c6d1 | |||
| b6b9fc8005 | |||
| 026318ce1f | |||
| 0bd833ee83 | |||
| 43e62d31df | |||
| e214d44b5c | |||
| e125915bd5 | |||
| 3b4b4881f5 | |||
| c71bd6606b | |||
| 2c187849da | |||
| 02aaaeb1e7 | |||
| 3e5d40cd55 | |||
| c860042443 | |||
| cbcb6e3dba | |||
| 47afa9c546 | |||
| 5554cf5b27 | |||
| f0866f4197 | |||
| d00a8347d4 | |||
| 27eaf83f07 | |||
| 0364f264ba | |||
| e6f3e1715b | |||
| e6ebbfcc81 | |||
| 9b6ea3c983 | |||
| 08e037ac45 | |||
| a2d4ab9434 | |||
| 2004452f30 | |||
| edfb857755 | |||
| df1f541247 | |||
| ca255b10d4 | |||
| eee5b42e8d | |||
| d8aefaef96 | |||
| 7640156f85 | |||
| 69407c87fb | |||
| 5724eefa8e | |||
| cd8040686a | |||
| 07f840beb7 | |||
| 1b9ddd61b3 | |||
| 9cead83478 | |||
| d0407381d2 | |||
| 865c892e26 | |||
| d27d68a6c8 | |||
| 9d02f7208d | |||
| a8652e9df6 | |||
| c734bdce8d | |||
| 921d0b950b | |||
| 3eb429c46f | |||
| 51211b42b2 | |||
| 8d0e73a0bc | |||
| ea06b2732f | |||
| d92ee756cc | |||
| 2bffb77d2b | |||
| f4c7236efc | |||
| ddd9ba9f05 | |||
| fbfc20f282 | |||
| 425b8b84cc | |||
| 183f177a70 | |||
| 8ee0f6bcbc | |||
| 1bd8351de4 | |||
| 153597f44e | |||
| d85a98fe37 | |||
| 94f4697d64 | |||
| 46deed6787 | |||
| 2516d18f02 | |||
| 80587c76cd | |||
| be6bf2286b | |||
| 794ae6df67 | |||
| fda9430a7d | |||
| 0b16942154 | |||
| 2f5c4d822c | |||
| 2ecad55883 | |||
| 1a75678882 | |||
| 72289ed173 | |||
| a759ff89e0 | |||
| 07fbdb3075 | |||
| 4304ffbb52 | |||
| 54860393cb | |||
| 1f9f999240 | |||
| 6a43370a88 | |||
| f848addb54 | |||
| 691bf16289 | |||
| 7c5442ef76 | |||
| 92add869a8 | |||
| 1648ad0349 | |||
| 5f5aa727e4 | |||
| 76b3503429 | |||
| 498c6ee383 | |||
| 3f1e39c64e | |||
| 367cfbe468 | |||
| 4c65cb91fb | |||
| 4a44b3315b | |||
| 1831db5cbb | |||
| 847e502a7f | |||
| 8052250d86 | |||
| f653485cd2 | |||
| 6113a07042 | |||
| bf7d1073fb | |||
| b88a6483e2 | |||
| 1168167837 | |||
| 36d7674304 | |||
| c0e092b2fe | |||
| 3896778ba8 | |||
| 5a53cec01b | |||
| 78b8eac671 | |||
| a318d45cde | |||
| 6a57c5e7bc | |||
| 65931d29f9 | |||
| 291cbac5bc | |||
| 07b953dcd5 | |||
| bfc033108f | |||
| 3a149e679f | |||
| 7fc7aea82e | |||
| 5e94e828ec | |||
| dfee393e27 | |||
| bd7bdf3d72 | |||
| f8fca473f3 | |||
| 1fbc8b314a | |||
| 641eed422c | |||
| 17f27d0c8e | |||
| f4142aafdd | |||
| a4c29f26b1 | |||
| 291338a61e | |||
| 77f0550e83 | |||
| 1a00fe1a13 | |||
| 23275cc614 | |||
| e9de43db2b | |||
| deee79e8f7 | |||
| 833e9e2a93 | |||
| cd81220658 | |||
| e7671572da | |||
| 3d272c4fdb | |||
| 5bdd3bd601 | |||
| 2e593c9fdc | |||
| 49268c614f | |||
| d9b55223a7 | |||
| ef4586df24 | |||
| f8ee0e08e8 | |||
| 68da69ed64 | |||
| 82fea86b57 | |||
| 429c4c0086 | |||
| 00073c0199 | |||
| a067f706f1 | |||
| 625aab6f25 | |||
| 9a6686e210 | |||
| c60bb11e4a | |||
| 9ada45cd61 | |||
| 8b5ff27ef6 | |||
| edfe294cd4 | |||
| 321fe7a349 | |||
| da08bdfaa0 | |||
| 9f6dd2bf7d | |||
| 533db060b9 | |||
| b7172a7d85 | |||
| 0cb8a06741 | |||
| bbd575c032 | |||
| 5002d498cb | |||
| 2a706243a7 | |||
| fa89c11f67 | |||
| 9097b203a0 | |||
| f7f7e8962c | |||
| 20ea9acda0 | |||
| b086972605 | |||
| a4de1bd223 | |||
| 3a6c8836ce | |||
| 6bbbeb389d | |||
| 4682b22a14 | |||
| 5c810d7b78 | |||
| b830d7a54e | |||
| 9cdd57feab | |||
| 070ddf25ba | |||
| 807d74acf8 | |||
| b47981c46f | |||
| 56af3748f6 | |||
| 6ac492164c | |||
| 93d8ec8ceb | |||
| 8ff5749075 | |||
| ac634a27f1 | |||
| ded174dfda | |||
| 3ea72f9371 | |||
| b5694319cd | |||
| 3e0dbd22a4 | |||
| d7757cf0db | |||
| 03db156f99 | |||
| 15be702f29 | |||
| ababa059e9 | |||
| f14f92d73f | |||
| a3e3c14ee7 | |||
| 47247090d8 | |||
| 2c38306ab5 | |||
| 76a91c283d | |||
| 44797c7b51 | |||
| 815952e575 | |||
| 803f75ac9b | |||
| 6a78203b97 | |||
| 7b20cb3b3d | |||
| 1f934d579c | |||
| 1db1024020 | |||
| 4097c701d0 | |||
| f3d7d49e87 | |||
| cdd1a1a29f | |||
| f5eda3686d | |||
| 38401093df | |||
| ff75bc3d68 | |||
| ac5c8b3880 | |||
| b072312a71 | |||
| f6b6174ab3 | |||
| d74b92db7d | |||
| 841c8ddc26 | |||
| 9a248d5219 | |||
| 5d319b750b | |||
| 8b2679b878 | |||
| 404b49bb4d | |||
| 1ab60db8fe | |||
| 541ef293cc | |||
| 1cf9bc3335 | |||
| f853a96179 | |||
| ea223b57b9 | |||
| 7147fd0cb7 | |||
| fa845a823f | |||
| 6bcea21059 | |||
| b910b8439c | |||
| 2b0d24421c | |||
| 328ce7dd48 | |||
| 1f6af30daf | |||
| 5b1e04ae48 | |||
| 30b9c7e662 | |||
| 2867b1a5d9 | |||
| d30d5d1d0a | |||
| cec0ab3fc8 | |||
| abdfd82b0a | |||
| 08c746feb6 | |||
| 53fa89e571 | |||
| db8d92cd96 | |||
| 6bff05f8d4 | |||
| 4842e8d81f | |||
| 4ddb77bcaf | |||
| 578477040f | |||
| 9edcc17479 | |||
| abb64f1565 | |||
| 7a3696bf3c | |||
| 86015d13ae | |||
| 2812bb6aea | |||
| 06d9d00975 | |||
| 897432d994 | |||
| dca3ad5847 | |||
| 95fa52a3ff | |||
| 0e1e95d77a | |||
| b7bd4d72ec | |||
| 230c6a3efc | |||
| b1afa82a91 | |||
| a8ec6f6e0f | |||
| 565c20e396 | |||
| adaa2657be | |||
| 978b1837fe | |||
| bc58630463 | |||
| 94245a0a44 | |||
| b25ddf87b1 | |||
| 3c106a4e5d | |||
| 807920341b | |||
| 3173393e8d | |||
| 6a86c235cc | |||
| 80b058d524 | |||
| bb4a3ce94d | |||
| de1ff13988 | |||
| e1342d08c2 | |||
| da9300cd6b | |||
| f2fcbb2f75 | |||
| 25eb7f1dc3 | |||
| 109a16070f | |||
| 5722ad4167 | |||
| ddcca0583a | |||
| 77476cea54 | |||
| 378a82074d | |||
| 2ab73d94f3 | |||
| 9193237995 | |||
| 27687a85cf | |||
| 045e8e5363 | |||
| 7251a81794 | |||
| 29bebbdd7b | |||
| d01bfa97b1 | |||
| 9089dfea44 | |||
| 5b62ae2b55 | |||
| 0ba78dbd4e | |||
| 2e91431129 | |||
| d805de405b | |||
| 6b6d47d71b | |||
| 77cb1efc2a | |||
| 08656c7404 | |||
| 3e902c72fe | |||
| bc70a085c3 | |||
| 848b6537d2 | |||
| 55473e9081 | |||
| a881ae9079 | |||
| 52a52b3993 | |||
| 6f243eb188 | |||
| 28a7c403d9 | |||
| f4f2b7c857 | |||
| 3d6e818b8d | |||
| ec48ab08b0 | |||
| d5a2406704 | |||
| 2044515ce4 | |||
| 3000a43330 | |||
| 61fafe9236 | |||
| 3879bcc6f3 | |||
| b678109ec0 | |||
| 67a3f582bf | |||
| 0d08c57112 | |||
| a62d1688b1 | |||
| d3ef9ce45f | |||
| 46f3146d85 | |||
| 22c9e1186c | |||
| e60dc2e172 | |||
| 14bcf025e0 | |||
| 0713f3d52d | |||
| 10ce6709dc | |||
| b415cb6b53 | |||
| 1ccfd55a1c | |||
| bcea43806b | |||
| e1de4d2bde | |||
| 5f7ce2ee5c | |||
| 1b1855c8f4 | |||
| 0aafcc6770 | |||
| f947f98e39 | |||
| 3ba140305e | |||
| dcae718f75 | |||
| 921cbed53b | |||
| dc43f4fe18 | |||
| 76f7c0d05c | |||
| 4adda8deaf | |||
| 236858e4dd | |||
| 2367b25c3c | |||
| 840b27e452 | |||
| 09cb7fd30c | |||
| c53452bf98 | |||
| fd99bf78dd | |||
| 9c0aa41620 | |||
| 01647b74b4 | |||
| 573c967670 | |||
| 0c2b819fb3 | |||
| 1e0d2746c6 | |||
| 60ed02f452 | |||
| 0cbea6a055 | |||
| 0302aee0e8 | |||
| ba96677c80 | |||
| fe42629e0e | |||
| e2627ffb8d | |||
| 955ee08a45 | |||
| c0c3bd65e9 | |||
| c5a0d1595b | |||
| d53a89b95e | |||
| 212b6abfef | |||
| ed249951e2 | |||
| 9601eaffcd | |||
| d8db7a8075 | |||
| 7928ff14e2 | |||
| a13bea1813 | |||
| ebd5af2d77 | |||
| 4fd374a4c3 | |||
| a59bb18c0e | |||
| 3e2729f594 | |||
| 4f33831180 | |||
| 23f334d233 | |||
| c21532256d | |||
| 0d4fb29b5b | |||
| 10a1356a6e | |||
| bf27ae8e19 | |||
| 041eae2260 | |||
| c3f011ec75 | |||
| 9d05a9f068 | |||
| 5b459bbd7b | |||
| 05ef3a3a4f | |||
| f1b5c99463 | |||
| 2f7337348e | |||
| 7f88624935 | |||
| dacd3b9bcd | |||
| 596449f259 | |||
| e149445529 | |||
| 178d7a3ef0 | |||
| 53d505006a | |||
| 53e1abd2c0 | |||
| 321b7a3a6f | |||
| 2e54c8b164 | |||
| 8c978f68c2 | |||
| 781c570a3d | |||
| de2a8cb6a5 | |||
| 63e92f0c83 | |||
| 73a28e33b4 | |||
| f4d2265de2 | |||
| b40764c2bc | |||
| 0333154935 | |||
| fc19fb563e | |||
| fd6a0512ba | |||
| 7c4ae1f7dc | |||
| b9c2418532 | |||
| 50a6848f25 | |||
| 6e1b60cc71 | |||
| 23a3985251 | |||
| 274d58ab68 | |||
| 14637860e0 | |||
| fe0545084a | |||
| e37b5050e2 | |||
| fc3a6a70da | |||
| 9837f276d7 | |||
| 865aa0afab | |||
| ef2bd7c5d5 | |||
| 3c92333f0e | |||
| 190b7a10b7 | |||
| 7a89709a29 | |||
| 3777090416 | |||
| 16d13748c9 | |||
| 5a46df0f19 | |||
| d3ff540382 | |||
| 15fcbd57b9 | |||
| 07ac5aa9a5 | |||
| 488ca47e50 |
+93
-19
@@ -11,18 +11,19 @@ variables:
|
||||
dotnet nuget list source
|
||||
$hasSource = dotnet nuget list source | Select-String -Pattern "Steamware Nexus Proxy"
|
||||
if (! [String]::IsNullOrWhiteSpace($hasSource)) {
|
||||
dotnet nuget remove source "`"Steamware Nexus Proxy`""
|
||||
dotnet nuget remove source "Steamware Nexus Proxy"
|
||||
}
|
||||
$hasSource = dotnet nuget list source | Select-String -Pattern "Steamware Nexus"
|
||||
if (! [String]::IsNullOrWhiteSpace($hasSource)) {
|
||||
dotnet nuget remove source "`"Steamware Nexus`""
|
||||
dotnet nuget remove source "Steamware Nexus"
|
||||
}
|
||||
$hasSource = dotnet nuget list source | Select-String -Pattern "nexus-proxy-v3"
|
||||
if (! [String]::IsNullOrWhiteSpace($hasSource)) {
|
||||
dotnet nuget remove source nexus-proxy-v3
|
||||
}
|
||||
dotnet nuget add source https://nexus.steamware.net/repository/nuget-group-3/index.json -n "Steamware Nexus" -u nugetUser -p $NEXUS_PASSWD --store-password-in-clear-text
|
||||
echo "Steamware Nexus Source added"
|
||||
echo "Steamware Nexus Source added, final state:"
|
||||
dotnet nuget list source
|
||||
|
||||
# helper creazione hash files x IIS
|
||||
.hashBuild: &hashBuild
|
||||
@@ -68,6 +69,7 @@ stages:
|
||||
- release
|
||||
|
||||
|
||||
# ---------- BUILD ----------
|
||||
CORE.Api:build:
|
||||
stage: build
|
||||
tags:
|
||||
@@ -81,7 +83,6 @@ CORE.Api:build:
|
||||
script:
|
||||
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
|
||||
|
||||
# ---------- BUILD ----------
|
||||
CORE.WLOG:build:
|
||||
stage: build
|
||||
tags:
|
||||
@@ -100,8 +101,21 @@ CORE.Smart:build:
|
||||
tags:
|
||||
- win
|
||||
variables:
|
||||
APP_NAME: GPW.CORE.Smart
|
||||
SOL_NAME: GPW.CORE.Smart
|
||||
APP_NAME: GPW.CORE.Smart8
|
||||
SOL_NAME: GPW.CORE.SMART8
|
||||
before_script:
|
||||
- *nuget-fix
|
||||
- dotnet restore "$env:SOL_NAME.sln"
|
||||
script:
|
||||
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
|
||||
|
||||
CORE.ADM:build:
|
||||
stage: build
|
||||
tags:
|
||||
- win
|
||||
variables:
|
||||
APP_NAME: GPW.CORE.ADM
|
||||
SOL_NAME: GPW.CORE.ADM
|
||||
before_script:
|
||||
- *nuget-fix
|
||||
- dotnet restore "$env:SOL_NAME.sln"
|
||||
@@ -151,8 +165,8 @@ CORE.Smart:staging:
|
||||
name: staging
|
||||
url: https://iis01.egalware.com/GPW/CORE.Smart
|
||||
variables:
|
||||
APP_NAME: GPW.CORE.Smart
|
||||
SOL_NAME: GPW.CORE.Smart
|
||||
APP_NAME: GPW.CORE.Smart8
|
||||
SOL_NAME: GPW.CORE.SMART8
|
||||
only:
|
||||
- develop
|
||||
needs: ["CORE.Smart:build"]
|
||||
@@ -163,6 +177,27 @@ CORE.Smart:staging:
|
||||
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
|
||||
- dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PWD -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
|
||||
|
||||
CORE.ADM:staging:
|
||||
stage: staging
|
||||
tags:
|
||||
- win
|
||||
environment:
|
||||
name: staging
|
||||
url: https://iis01.egalware.com/GPW/CORE.ADM8
|
||||
variables:
|
||||
APP_NAME: GPW.CORE.ADM
|
||||
SOL_NAME: GPW.CORE.ADM
|
||||
only:
|
||||
- develop
|
||||
needs: ["CORE.ADM:build"]
|
||||
before_script:
|
||||
- *nuget-fix
|
||||
- dotnet restore "$env:SOL_NAME.sln"
|
||||
script:
|
||||
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
|
||||
- dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PWD -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
|
||||
|
||||
|
||||
# ---------- DEPLOY ----------
|
||||
CORE.Api:deploy:
|
||||
stage: deploy
|
||||
@@ -182,8 +217,6 @@ CORE.Api:deploy:
|
||||
- dotnet restore "$env:SOL_NAME.sln"
|
||||
script:
|
||||
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
|
||||
# # IIS 02
|
||||
# - dotnet publish -p:PublishProfile=IIS02.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PWD -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
|
||||
# IIS PROD
|
||||
- dotnet publish -p:PublishProfile=IIS-PROD.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PWD -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
|
||||
|
||||
@@ -202,18 +235,17 @@ CORE.WLOG:deploy:
|
||||
- dotnet restore "$env:SOL_NAME.sln"
|
||||
script:
|
||||
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
|
||||
# # IIS 02
|
||||
# - dotnet publish -p:PublishProfile=IIS02.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PWD -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
|
||||
# IIS PROD
|
||||
- dotnet publish -p:PublishProfile=IIS-PROD.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PWD -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
|
||||
- dotnet publish -p:PublishProfile=IIS-PROD8.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PWD -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
|
||||
|
||||
CORE.Smart:deploy:
|
||||
stage: deploy
|
||||
tags:
|
||||
- win
|
||||
variables:
|
||||
APP_NAME: GPW.CORE.Smart
|
||||
SOL_NAME: GPW.CORE.Smart
|
||||
APP_NAME: GPW.CORE.Smart8
|
||||
SOL_NAME: GPW.CORE.SMART8
|
||||
only:
|
||||
- main
|
||||
needs: ["CORE.Smart:build"]
|
||||
@@ -227,6 +259,26 @@ CORE.Smart:deploy:
|
||||
# IIS INT
|
||||
- dotnet publish -p:PublishProfile=IIS-INT.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PWD -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
|
||||
|
||||
CORE.ADM:deploy:
|
||||
stage: deploy
|
||||
tags:
|
||||
- win
|
||||
variables:
|
||||
APP_NAME: GPW.CORE.ADM
|
||||
SOL_NAME: GPW.CORE.ADM
|
||||
only:
|
||||
- main
|
||||
needs: ["CORE.ADM:build"]
|
||||
before_script:
|
||||
- *nuget-fix
|
||||
- dotnet restore "$env:SOL_NAME.sln"
|
||||
script:
|
||||
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
|
||||
# IIS PROD
|
||||
- dotnet publish -p:PublishProfile=IIS-PROD.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PWD -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
|
||||
|
||||
|
||||
# ---------- RELEASE ----------
|
||||
CORE.Api:release:
|
||||
stage: release
|
||||
tags:
|
||||
@@ -254,7 +306,6 @@ CORE.Api:release:
|
||||
# script:
|
||||
# - dotnet publish -c Release -o ./publish GPW.CORE.Api/GPW.CORE.Api.csproj
|
||||
|
||||
# ---------- RELEASE ----------
|
||||
CORE.WLOG:release:
|
||||
stage: release
|
||||
tags:
|
||||
@@ -279,14 +330,13 @@ CORE.WLOG:release:
|
||||
# script:
|
||||
# - dotnet publish -c Release -o ./publish GPW.CORE.WRKLOG/GPW.CORE.WRKLOG.csproj
|
||||
|
||||
|
||||
CORE.Smart:release:
|
||||
stage: release
|
||||
tags:
|
||||
- win
|
||||
variables:
|
||||
APP_NAME: GPW.CORE.Smart
|
||||
SOL_NAME: GPW.CORE.Smart
|
||||
APP_NAME: GPW.CORE.Smart8
|
||||
SOL_NAME: GPW.CORE.SMART8
|
||||
only:
|
||||
- main
|
||||
except:
|
||||
@@ -302,4 +352,28 @@ CORE.Smart:release:
|
||||
- *hashBuild
|
||||
- *nexusUpload
|
||||
# script:
|
||||
# - dotnet publish -c Release -o ./publish GPW.CORE.WRKLOG/GPW.CORE.WRKLOG.csproj
|
||||
# - dotnet publish -c Release -o ./publish GPW.CORE.WRKLOG/GPW.CORE.WRKLOG.csproj
|
||||
|
||||
# CORE.ADM:release:
|
||||
# stage: release
|
||||
# tags:
|
||||
# - win
|
||||
# variables:
|
||||
# APP_NAME: GPW.CORE.ADM
|
||||
# SOL_NAME: GPW.CORE.ADM
|
||||
# only:
|
||||
# - main
|
||||
# except:
|
||||
# - branches
|
||||
# needs: ["CORE.ADM:build"]
|
||||
# artifacts:
|
||||
# paths:
|
||||
# - publish/
|
||||
# script:
|
||||
# - dotnet build $env:APP_NAME/$env:APP_NAME.csproj
|
||||
# - dotnet publish -p:PublishProfile=IISProfile.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release $env:APP_NAME/$env:APP_NAME.csproj -o:publish -p:verbosity=quiet
|
||||
# # qui il deploy su nexus...
|
||||
# - *hashBuild
|
||||
# - *nexusUpload
|
||||
# # script:
|
||||
# # - dotnet publish -c Release -o ./publish GPW.CORE.WRKLOG/GPW.CORE.WRKLOG.csproj
|
||||
Vendored
+1
-1
@@ -10,7 +10,7 @@
|
||||
"request": "launch",
|
||||
"preLaunchTask": "build",
|
||||
// If you have changed target frameworks, make sure to update the program path.
|
||||
"program": "${workspaceFolder}/GPW.CORE.WRKLOG/bin/Debug/net6.0/GPW.CORE.WRKLOG.dll",
|
||||
"program": "${workspaceFolder}/GPW.CORE.WRKLOG/bin/Debug/net8.0/GPW.CORE.WRKLOG.dll",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}/GPW.CORE.WRKLOG",
|
||||
"stopAtEntry": false,
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
# GPW_NEXT Agent Instructions
|
||||
|
||||
## Architecture Overview
|
||||
- **Multi-Project Structure**: The solution consists of several interconnected projects.
|
||||
- **Smart10 Module**:
|
||||
- `GPW.CORE.Smart10`: The ASP.NET Core Server project. Hosts API Controllers and implements Server-side logic.
|
||||
- `GPW.CORE.Smart10.Client`: The Blazor WebAssembly project. Contains UI components and client-side services that consume APIs.
|
||||
- **Data Layer**:
|
||||
- `GPW.CORE.Data`: Contains EF Core models (`DbModels`), `GPWContext`, and the `GPWController` which acts as a data access layer.
|
||||
- `GPW.CORE.Dto`: Contains Data Transfer Objects used for communication between Client and Server to avoid direct dependency on EF Core models.
|
||||
- **Services Pattern**:
|
||||
- **Client-side**: Services implement interfaces (e.g., `ITimbraturesService`) and use `HttpClient` to call REST endpoints.
|
||||
- **Server-side (Prerendering)**: To support Blazor Web App prerendering, implement the same interfaces in the Server project using a "Server-side" implementation that calls `CoreSmartDataService` directly instead of via HTTP.
|
||||
|
||||
## Development Workflows
|
||||
|
||||
### Implementing New Features (Smart10 Example)
|
||||
1. **DTO**: Define the required data structure in `GPW.CORE.Dto`.
|
||||
2. **Server Data Access**: Ensure `CoreSmartDataService` (in `GPW.CORE.Smart10.Data`) or `GPWController` (in `GPW.CORE.Data`) has the necessary business logic.
|
||||
3. **API Controller**: Add an endpoint in `GPW.CORE.Smart10\Controllers` to expose the data via REST.
|
||||
4. **Client Interface**: Add the method signature to the interface in `GPW.CORE.Smart10.Client\Services`.
|
||||
5. **Client Implementation**: Implement the service in `GPW.CORE.Smart10.Client\Services` using `HttpClient`.
|
||||
6. **Server Implementation (Prerendering Support)**: Create a server-side implementation of the interface in `GPW.CORE.Smart10\Services` that calls `CoreSmartDataService` directly.
|
||||
7. **Dependency Injection**:
|
||||
- **Client**: Register the `HttpClient`-based service in `GPW.CORE.Smart10.Client\Program.cs`.
|
||||
- **Server**: Register the direct-access service in `GPW.CORE.Smart10\Program.cs`.
|
||||
|
||||
### Testing & Verification
|
||||
- **UI Testing**: Use the `Test...razor` pages in the Client project to validate end-to-end flows (Insert, Update, Delete, Search).
|
||||
- **Manual Check**: For UI changes, verify the interaction between `@bind` and event handlers (use `@bind:after` for .NET 7+).
|
||||
|
||||
## Key Constraints & Gotchas
|
||||
- **NLog**: Do not add `NLog.Web.AspNetCore` to the Client project; it is incompatible with the WASM runtime.
|
||||
- **UID Logic**: Many entities use a calculated `UID` (e.g., `IdxDipendente_DataOra_Ora`) for RESTful operations (like `DELETE /api/resource/{uid}`) instead of passing entire objects.
|
||||
- **Prerendering**: Always provide a server-side implementation of client-side services to avoid `InvalidOperationException` during the initial page load.
|
||||
- **Namespace Integrity**: Be careful with namespaces when moving logic between `GPW.CORE.Smart10` (Server) and `GPW.CORE.Smart10.Client` (Client).
|
||||
@@ -0,0 +1,41 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.0.31912.275
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GPW.CORE.Data", "GPW.CORE.Data\GPW.CORE.Data.csproj", "{718B275D-7573-4CE2-87AF-57FCAAD71BD8}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{845EC4A6-7460-4897-8571-494E0EBB617E}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
.editorconfig = .editorconfig
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GPW.CORE.ADM", "GPW.CORE.ADM\GPW.CORE.ADM.csproj", "{4D06AE30-AD81-42FC-B66D-B072A794C599}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GPW.CORE", "GPW.CORE\GPW.CORE.csproj", "{C83EC748-3D5A-27B4-E4E8-B12A09283A8A}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{718B275D-7573-4CE2-87AF-57FCAAD71BD8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{718B275D-7573-4CE2-87AF-57FCAAD71BD8}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{718B275D-7573-4CE2-87AF-57FCAAD71BD8}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{718B275D-7573-4CE2-87AF-57FCAAD71BD8}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{4D06AE30-AD81-42FC-B66D-B072A794C599}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{4D06AE30-AD81-42FC-B66D-B072A794C599}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{4D06AE30-AD81-42FC-B66D-B072A794C599}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{4D06AE30-AD81-42FC-B66D-B072A794C599}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{C83EC748-3D5A-27B4-E4E8-B12A09283A8A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C83EC748-3D5A-27B4-E4E8-B12A09283A8A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C83EC748-3D5A-27B4-E4E8-B12A09283A8A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C83EC748-3D5A-27B4-E4E8-B12A09283A8A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {AE057165-54C4-4678-8617-A03F0E8F6495}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,65 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="description" content="GPW CORE ADMIN" />
|
||||
<meta name="author" content="EgalWare" />
|
||||
<link rel="shortcut icon" type="image/x-icon" href="images/favicon.ico" />
|
||||
@* <base href="/" /> *@
|
||||
<link rel="stylesheet" href="lib/bootstrap/css/bootstrap.min.css" />
|
||||
<link rel="stylesheet" href="lib/font-awesome/css/all.min.css" />
|
||||
<link rel="stylesheet" href="css/site.min.css" />
|
||||
<link rel="stylesheet" href="css/fonts.min.css" />
|
||||
<link rel="stylesheet" href="css/BlazorCal.min.css" />
|
||||
<link rel="stylesheet" href="css/open-iconic/font/css/open-iconic-bootstrap.min.css" />
|
||||
@* <link rel="stylesheet" href="bootstrap/bootstrap.min.css" />
|
||||
<link rel="stylesheet" href="app.css" /> *@
|
||||
<link rel="stylesheet" href="GPW.CORE.ADM.styles.css" />
|
||||
@* <link rel="icon" type="image/png" href="favicon.png" /> *@
|
||||
<link rel="manifest" href="manifest.json" />
|
||||
@* <HeadOutlet /> *@
|
||||
<HeadOutlet @rendermode="@(new InteractiveServerRenderMode(prerender: false))" />
|
||||
<RadzenTheme Theme="material" @rendermode="@(new InteractiveServerRenderMode(prerender: false))" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@* <Routes /> *@
|
||||
@* <Routes @rendermode=RenderMode.InteractiveServer /> *@
|
||||
<Routes @rendermode="@(new InteractiveServerRenderMode(prerender: false))" />
|
||||
|
||||
@* <script src="_framework/blazor.web.js"></script> *@
|
||||
|
||||
@* Gestione Blazor 6 x autoreconnect, da valutare *@
|
||||
<script src="_framework/blazor.server.js" autostart="false"></script>
|
||||
<script>
|
||||
Blazor.start({
|
||||
reconnectionOptions: {
|
||||
maxRetries: 3600,
|
||||
retryIntervalMilliseconds: 2000
|
||||
},
|
||||
}).then(() => {
|
||||
Blazor.defaultReconnectionHandler._reconnectCallback = function (d) {
|
||||
console.log("Client reconnected, waiting 3 sec and reload!");
|
||||
setTimeout(function () {
|
||||
document.location.reload();
|
||||
}, 3000);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript" src="lib/bootstrap/js/bootstrap.min.js"></script>
|
||||
@* <script type="text/javascript" src="lib/font-awesome/js/all.min.js"></script> *@
|
||||
|
||||
<script src="_content/Radzen.Blazor/Radzen.Blazor.js?v=@(typeof(Radzen.Colors).Assembly.GetName().Version)"></script>
|
||||
<script src="lib/Chart.js/chart.js"></script>
|
||||
<script src="lib/luxon/luxon.js"></script>
|
||||
<script src="lib/chartjs-adapter-luxon/chartjs-adapter-luxon.js"></script>
|
||||
<script src="lib/chartBoot.js"></script>
|
||||
<script type="text/javascript" src="lib/qrcode.js"></script>
|
||||
<script type="text/javascript" src="lib/qrHelper.js"></script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,121 @@
|
||||
|
||||
<div class="card shadow">
|
||||
<div class="card-header">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-0">
|
||||
<h3>Approvazione Timbrature</h3>
|
||||
</div>
|
||||
<div class="px-0">
|
||||
<select @bind="@IdxDipSel" class="form-select form-select-sm" @bind:after=ReloadData>
|
||||
<option value="0">--- Selezionare ---</option>
|
||||
@foreach (var item in ListDipendenti)
|
||||
{
|
||||
<option value="@item.IdxDipendente">@($"{item.Cognome} {item.Nome}")</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body p-1 small">
|
||||
|
||||
<table class="table table-striped table-sm text-start">
|
||||
<thead>
|
||||
<tr class="">
|
||||
<th>
|
||||
@if (legacyMode)
|
||||
{
|
||||
<button class="mx-1 btn btn-info btn-sm" @onclick="SelectAll"><i class="fa-solid fa-circle"></i></button>
|
||||
<button class="btn btn-secondary opacity-50 btn-sm" @onclick="() => ForceReload(true)"><i class="fa-solid fa-circle"></i></button>
|
||||
}
|
||||
else
|
||||
{
|
||||
@if (allSel)
|
||||
{
|
||||
<i class="fa-solid fa-toggle-on text-primary fs-5" @onclick="ToggleSelection"></i>
|
||||
}
|
||||
else
|
||||
{
|
||||
<i class="fa-solid fa-toggle-off text-secondary fs-5" @onclick="ToggleSelection"></i>
|
||||
}
|
||||
}
|
||||
@if ((legacyMode && ListUidSel.Count > 0) || (!legacyMode && HasRowSelected))
|
||||
{
|
||||
<button class="mx-1 btn btn-success btn-sm" @onclick="() => DoApproveSel()"><i class="fa-solid fa-thumbs-up"></i> Approva Sel</button>
|
||||
}
|
||||
</th>
|
||||
<th>Dipendente <Sorter ParamName="Dipendente" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th>DataOra <Sorter ParamName="DataOra" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th class="text-center">IN</th>
|
||||
<th class="text-center"></th>
|
||||
<th class="text-center">OUT</th>
|
||||
<th class="text-end"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@if (ListRecords == null || isLoading)
|
||||
{
|
||||
<tr class="align-middle">
|
||||
<td colspan="8">
|
||||
<EgwCoreLib.Razor.LoadingData></EgwCoreLib.Razor.LoadingData>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
else if (totalCount == 0)
|
||||
{
|
||||
<tr class="align-middle">
|
||||
<td colspan="8">
|
||||
<div class="alert alert-info mb-0">Nessun record trovato</div>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
else
|
||||
{
|
||||
@foreach (var item in ListRecords)
|
||||
{
|
||||
<tr class="align-middle">
|
||||
<td>
|
||||
@if (legacyMode)
|
||||
{
|
||||
<button class="mx-1 btn @CssCheckSel(item.UID) btn-sm" @onclick="() => ToggleUid(item.UID)"><i class="fa-solid @IconCheckSel(item.UID)"></i></button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<input class="form-check-input" type="checkbox" @bind="item.Selected"></input>
|
||||
}
|
||||
<button class="btn btn-success btn-sm ms-1" @onclick="() => DoApprove(item)"><i class="fa-solid fa-thumbs-up"></i></button>
|
||||
</td>
|
||||
<td>
|
||||
@item.DipNav.Abbrev
|
||||
</td>
|
||||
<td>
|
||||
@item.DataOra
|
||||
</td>
|
||||
<td class="text-center">
|
||||
@if (item.Entrata ?? false)
|
||||
{
|
||||
<i class="fa-solid fa-xmark"></i>
|
||||
}
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<button class="btn btn-warning btn-sm" @onclick="() => DoExchange(item)"><i class="fa-solid fa-arrow-right-arrow-left"></i></button>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
@if (!item.Entrata ?? false)
|
||||
{
|
||||
<i class="fa-solid fa-xmark"></i>
|
||||
}
|
||||
</td>
|
||||
<td class="text-end">
|
||||
<button class="btn btn-danger btn-sm" @onclick="() => DoDelete(item)"><i class="fa-solid fa-trash"></i></button>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<EgwCoreLib.Razor.DataPager PageSize="@numRecord" currPage="@currPage" numRecordChanged="SetNumRec" numPageChanged="SetPage" totalCount="@totalCount" showLoading="@isLoading"></EgwCoreLib.Razor.DataPager>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,369 @@
|
||||
using EgwCoreLib.Razor;
|
||||
using GPW.CORE.Data;
|
||||
using GPW.CORE.Data.DbModels;
|
||||
using GPW.CORE.Data.DTO;
|
||||
using GPW.CORE.Data.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using NLog;
|
||||
|
||||
namespace GPW.CORE.ADM.Components.Compo
|
||||
{
|
||||
public partial class ApprovTimbMan : IDisposable
|
||||
{
|
||||
#region Public Methods
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
AppMServ.EA_SearchUpdated -= AppMServ_EA_SearchUpdated;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected MessageService AppMServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected GpwDataService GDataServ { get; set; } = null!;
|
||||
|
||||
protected int IdxDipSel { get; set; } = 0;
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected string CssCheckSel(string uid)
|
||||
{
|
||||
return ListUidSel.Contains(uid) ? "btn-info" : "btn-secondary opacity-50";
|
||||
}
|
||||
|
||||
protected async Task DoApprove(TimbratureModel selItem)
|
||||
{
|
||||
isLoading = true;
|
||||
// se non si tratta di una timbratura "last second"...
|
||||
if (selItem.DataOra.Hour != 23 && selItem.DataOra.Minute != 59 && selItem.DataOra.Second != 59)
|
||||
{
|
||||
// arrotondo ingresso/uscita ai 5 minuti secondo sia entrata o uscita...
|
||||
var dtTimb = Utils.DateRounded(selItem.DataOra, 5, !(selItem.Entrata ?? false));
|
||||
selItem.DataOra = dtTimb;
|
||||
}
|
||||
// indico approvato
|
||||
selItem.Approv = true;
|
||||
// salvo!
|
||||
bool fatto = await GDataServ.TimbratureUpdate(selItem);
|
||||
//bool fatto = await GDataServ.TimbratureUpdateRound(selItem);
|
||||
if (fatto)
|
||||
{
|
||||
await ReloadData();
|
||||
}
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
private bool legacyMode = false;
|
||||
|
||||
protected List<TimbratureDTO> ListSelected
|
||||
{
|
||||
get => ListRecords != null ? ListRecords.Where(x => x.Selected).ToList() : new List<TimbratureDTO>();
|
||||
}
|
||||
|
||||
protected async Task DoApproveSel()
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", $"Sicuro di voler approvare i {ListUidSel.Count} record selezionati?"))
|
||||
return;
|
||||
|
||||
isLoading = true;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
int numProc = 0;
|
||||
if (legacyMode)
|
||||
{
|
||||
foreach (var item in ListRecords)
|
||||
{
|
||||
// se selezionato...
|
||||
if (ListUidSel.Contains(item.UID))
|
||||
{
|
||||
// se non si tratta di una timbratura "last second"...
|
||||
if (item.DataOra.Hour != 23 && item.DataOra.Minute != 59 && item.DataOra.Second != 59)
|
||||
{
|
||||
// arrotondo ingresso/uscita ai 5 minuti secondo sia entrata o uscita...
|
||||
var dtTimb = Utils.DateRounded(item.DataOra, 5, !(item.Entrata ?? false));
|
||||
item.DataOra = dtTimb;
|
||||
}
|
||||
// indico approvato
|
||||
item.Approv = true;
|
||||
// salvo!
|
||||
bool fatto = await GDataServ.TimbratureUpdate(item);
|
||||
if (fatto)
|
||||
{
|
||||
numProc++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
foreach (var item in ListSelected)
|
||||
{
|
||||
// se non si tratta di una timbratura "last second"...
|
||||
if (item.DataOra.Hour != 23 && item.DataOra.Minute != 59 && item.DataOra.Second != 59)
|
||||
{
|
||||
// arrotondo ingresso/uscita ai 5 minuti secondo sia entrata o uscita...
|
||||
var dtTimb = Utils.DateRounded(item.DataOra, 5, !(item.Entrata ?? false));
|
||||
item.DataOra = dtTimb;
|
||||
}
|
||||
// indico approvato
|
||||
item.Approv = true;
|
||||
// salvo!
|
||||
bool fatto = await GDataServ.TimbratureUpdate(item, false);
|
||||
if (fatto)
|
||||
{
|
||||
numProc++;
|
||||
}
|
||||
}
|
||||
// svuoto cache
|
||||
allSel = false;
|
||||
}
|
||||
if (numProc > 0)
|
||||
{
|
||||
await GDataServ.FlushRedisCache();
|
||||
await ReloadData();
|
||||
}
|
||||
await Task.Delay(1);
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
protected async void DoDelete(TimbratureModel selItem)
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sicuro di voler eliminare il record?"))
|
||||
return;
|
||||
|
||||
isLoading = true;
|
||||
bool fatto = await GDataServ.TimbratureDelete(selItem);
|
||||
if (fatto)
|
||||
{
|
||||
await ReloadData();
|
||||
}
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
protected async void DoExchange(TimbratureModel selItem)
|
||||
{
|
||||
isLoading = true;
|
||||
selItem.Entrata = !selItem.Entrata;
|
||||
bool fatto = await GDataServ.TimbratureUpdate(selItem);
|
||||
if (fatto)
|
||||
{
|
||||
await ReloadData();
|
||||
}
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
protected async Task ForceReload(bool force)
|
||||
{
|
||||
ListUidSel = new List<string>();
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected string IconCheckSel(string uid)
|
||||
{
|
||||
return ListUidSel.Contains(uid) ? "fa-circle" : "fa-circle";
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
CurrSearch = "";
|
||||
AppMServ.SearchVal = "";
|
||||
AppMServ.EA_SearchUpdated += AppMServ_EA_SearchUpdated;
|
||||
numRecord = await AppMServ.NumRowGridGet(gridKey);
|
||||
var rawList = await GDataServ.DipendentiGetAll();
|
||||
ListDipendenti = rawList.Where(x => (x.Attivo ?? false)).ToList();
|
||||
}
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected void SelectAll()
|
||||
{
|
||||
if (ListRecords != null)
|
||||
{
|
||||
ListUidSel = ListRecords.Select(x => x.UID).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
protected async Task SetNumRec(int newNum)
|
||||
{
|
||||
numRecord = newNum;
|
||||
currPage = 1;
|
||||
await AppMServ.NumRowGridSet(gridKey, newNum);
|
||||
await InvokeAsync(ReloadData);
|
||||
}
|
||||
|
||||
protected async Task SetPage(int newNum)
|
||||
{
|
||||
currPage = newNum;
|
||||
await InvokeAsync(ReloadData);
|
||||
}
|
||||
|
||||
protected async Task SortRequested(Sorter.SortCallBack e)
|
||||
{
|
||||
sortField = e.ParamName;
|
||||
sortAsc = e.IsAscending;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua toggle selezione globale delle righe mostrateGpwDataService gDataServprivate async Task ReloadData
|
||||
/// </summary>
|
||||
protected void ToggleSelection()
|
||||
{
|
||||
allSel = !allSel;
|
||||
foreach (var item in ListRecords)
|
||||
{
|
||||
item.Selected = allSel;
|
||||
}
|
||||
}
|
||||
protected bool HasRowSelected
|
||||
{
|
||||
get => ListRecords != null && ListRecords.Count(x => x.Selected) > 0;
|
||||
//get => ListRecords != null && ListRecords.Where(x => x.Selected).Count() > 0;
|
||||
}
|
||||
|
||||
protected async void ToggleUid(string uid)
|
||||
{
|
||||
if (ListUidSel.Contains(uid))
|
||||
{
|
||||
ListUidSel.Remove(uid);
|
||||
}
|
||||
else
|
||||
{
|
||||
ListUidSel.Add(uid);
|
||||
}
|
||||
await ReloadData();
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
private bool allSel = false;
|
||||
private string gridKey = "ApprovTimbMan";
|
||||
private bool sortAsc = true;
|
||||
private string sortField = "";
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private int currPage { get; set; } = 1;
|
||||
private string CurrSearch { get; set; } = "";
|
||||
private bool filtDip { get; set; } = false;
|
||||
|
||||
private bool isLoading { get; set; } = false;
|
||||
private List<DipendentiModel> ListDipendenti { get; set; } = new List<DipendentiModel>();
|
||||
|
||||
private List<TimbratureDTO>? ListRecords { get; set; } = null;
|
||||
private List<string> ListUidSel { get; set; } = new List<string>();
|
||||
private int numRecord { get; set; } = 10;
|
||||
private List<TimbratureDTO>? SearchRecords { get; set; } = null;
|
||||
private int totalCount { get; set; } = 0;
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private async void AppMServ_EA_SearchUpdated()
|
||||
{
|
||||
CurrSearch = AppMServ.SearchVal;
|
||||
await ReloadData();
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
private async Task ReloadData()
|
||||
{
|
||||
currPage = 1;
|
||||
isLoading = true;
|
||||
ListRecords = null;
|
||||
try
|
||||
{
|
||||
var rawData = await GDataServ.TimbratureRichieste();
|
||||
SearchRecords = rawData
|
||||
.Where(x => (IdxDipSel == 0 || x.IdxDipendente == IdxDipSel))
|
||||
.Select(x => new TimbratureDTO(x))
|
||||
.ToList();
|
||||
#if false
|
||||
// verifico filtro per IdxDip
|
||||
if (IdxDipSel > 0)
|
||||
{
|
||||
SearchRecords = SearchRecords.Where(x => x.IdxDipendente == IdxDipSel).ToList();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error($"Eccezione in recupero dati{Environment.NewLine}{ex}");
|
||||
}
|
||||
totalCount = SearchRecords.Count;
|
||||
SortTable();
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
private void SortTable()
|
||||
{
|
||||
if (SearchRecords != null)
|
||||
{
|
||||
// se ho ordinamento riordino...
|
||||
if (!string.IsNullOrEmpty(sortField))
|
||||
{
|
||||
switch (sortField)
|
||||
{
|
||||
case "Dipendente":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.DipNav.Abbrev).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.DipNav.Abbrev).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "DataOra":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.DataOra).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.DataOra).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// filtro x display
|
||||
ListRecords = SearchRecords
|
||||
.Skip(numRecord * (currPage - 1))
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
ListRecords = new List<TimbratureDTO>();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
@if (isLoading)
|
||||
{
|
||||
<LoadingData></LoadingData>
|
||||
}
|
||||
else
|
||||
{ @if (isSendingData)
|
||||
{
|
||||
<ProgressDisplay Title="Salvataggio ed invio richiesta" CurrVal="@sendDataVal" NextVal="@sendDataNextVal" MaxVal="@sendDataMaxVal" ExpTimeMSec="1000"></ProgressDisplay>
|
||||
}
|
||||
@if (ListRecords == null)
|
||||
{
|
||||
<LoadingData DisplaySize="LoadingData.CtrlSize.Small"></LoadingData>
|
||||
}
|
||||
else
|
||||
{
|
||||
@if (showAdd)
|
||||
{
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-0">
|
||||
<b>Data</b>
|
||||
</div>
|
||||
<div class="px-2">
|
||||
<input type="date" class="form-control text-end" @bind="@currRecord.data">
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-0">
|
||||
<b>Giust</b>
|
||||
</div>
|
||||
<div class="px-2">
|
||||
<div class="input-group input-group-sm">
|
||||
<select @bind="@currRecord.codGiust" class="form-select">
|
||||
<option value="">--- Selezionare Causale ---</option>
|
||||
@if (ListGiust != null)
|
||||
{
|
||||
@foreach (var giust in ListGiust)
|
||||
{
|
||||
<option value="@giust.codGiust">@giust.descrizione</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-0">
|
||||
<b>Descrizione</b>
|
||||
</div>
|
||||
<div class="px-2">
|
||||
<input class="form-control form-control-sm small" @bind="@currRecord.descrizione"></input>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
@* <li class="list-group-item">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-0">
|
||||
<b>Stato</b>
|
||||
<span class="small">(confermato)</span>
|
||||
</div>
|
||||
<div class="px-0">
|
||||
<div class="form-check form-switch">
|
||||
<input class="form-check-input" type="checkbox" role="switch" @bind="@currRecord.Conf">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li> *@
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<button class="btn btn-warning w-100" @onclick="ToggleEdit"><i class="fas fa-window-close"></i> Cancel</button>
|
||||
</div>
|
||||
<div class="col">
|
||||
@if (!string.IsNullOrEmpty(currRecord.codGiust))
|
||||
{
|
||||
<button class="btn btn-success w-100" @onclick="() => DoSave()"><i class="far fa-save"></i> Update</button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="btn btn-secondary w-100" disabled><i class="far fa-save"></i> Update</button>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
}
|
||||
@if (ListRecords.Count == 0)
|
||||
{
|
||||
<div class="alert alert-warning">
|
||||
<h4>Nessu record registrato!</h4>
|
||||
<button class="btn btn-success btn-sm" @onclick="() => ToggleEdit()"><i class="fas fa-plus"></i> Inserisci Malattia</button>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<table class="table table-sm table-striped table-responsive-md border border-dark">
|
||||
<thead>
|
||||
<tr class="bg-dark text-light">
|
||||
<th>
|
||||
<button class="btn btn-success btn-sm" @onclick="() => AddNew()"><i class="fas fa-plus"></i></button>
|
||||
</th>
|
||||
<th>Data</th>
|
||||
<th class="text-center">Tipo</th>
|
||||
<th class="text-end">Descrizione</th>
|
||||
<th class="text-end"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in ListRecords)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
<button class="btn btn-primary btn-sm" @onclick="() => DoEdit(item)"><i class="fas fa-pen"></i></button>
|
||||
</td>
|
||||
<td class="text-nowrap">
|
||||
@($"{item.data:yyyy-MM-dd dddd}")
|
||||
</td>
|
||||
<td>
|
||||
@item.codGiust
|
||||
</td>
|
||||
<td class="text-center">
|
||||
@item.descrizione
|
||||
</td>
|
||||
<td class="text-end">
|
||||
<button class="btn btn-danger btn-sm" @onclick="() => DoDelete(item)"><i class="fas fa-trash-alt"></i></button>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div>
|
||||
<EgwCoreLib.Razor.DataPager PageSize="@numRecord" currPage="@currPage" numRecordChanged="SetNumRec" numPageChanged="SetPage" totalCount="@totalCount" showLoading="@isLoading" NumPages="10" PageSizeList="@PageSizeListSpec"></EgwCoreLib.Razor.DataPager>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,235 @@
|
||||
using GPW.CORE.Data.DbModels;
|
||||
using GPW.CORE.Data.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using NLog;
|
||||
|
||||
namespace GPW.CORE.ADM.Components.Compo
|
||||
{
|
||||
public partial class CalAzMan
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public DateTime DtEnd { get; set; } = new DateTime(DateTime.Today.Year + 1, 1, 1);
|
||||
|
||||
[Parameter]
|
||||
public DateTime DtStart { get; set; } = new DateTime(DateTime.Today.Year, 1, 1);
|
||||
|
||||
[Parameter]
|
||||
public bool isLoading { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<bool> ReportUpdate { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected List<int> PageSizeListSpec = new List<int>() { 5, 10, 15, 20 };
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected MessageService AppMServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected GpwDataService GDataServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
ListGiust = await GDataServ.AnagGiust();
|
||||
// recupero preferenze utente...
|
||||
await InitUserPref();
|
||||
}
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
currPage = 1;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected async Task SetNumRec(int newNum)
|
||||
{
|
||||
numRecord = newNum;
|
||||
currPage = 1;
|
||||
await AppMServ.NumRowGridSet(gridKey, newNum);
|
||||
await InvokeAsync(ReloadData);
|
||||
}
|
||||
|
||||
protected async Task SetPage(int newNum)
|
||||
{
|
||||
currPage = newNum;
|
||||
await InvokeAsync(ReloadData);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
private string gridKey = "CalChiusura";
|
||||
|
||||
private bool isSendingData = false;
|
||||
|
||||
private List<CalFesteFerieModel>? ListRecords = null;
|
||||
private List<CalFesteFerieModel>? SearchRecords = null;
|
||||
|
||||
private int sendDataMaxVal = 100;
|
||||
|
||||
private int sendDataNextVal = 0;
|
||||
|
||||
private int sendDataVal = 0;
|
||||
|
||||
private bool showAdd = false;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private int currPage { get; set; } = 1;
|
||||
|
||||
private CalFesteFerieModel currRecord { get; set; } = new CalFesteFerieModel();
|
||||
|
||||
private string NomeDip
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = "per cortesia";
|
||||
if (AppMServ != null && AppMServ.RigaDip != null)
|
||||
{
|
||||
answ = $"{AppMServ.RigaDip.Nome}";
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
private int numRecord { get; set; } = 10;
|
||||
|
||||
private int totalCount { get; set; } = 0;
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private void DoEdit(CalFesteFerieModel selItem)
|
||||
{
|
||||
currRecord = selItem;
|
||||
showAdd = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registra il record
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private async Task DoSave()
|
||||
{
|
||||
// chiedo verifica
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Confermi modifica record?"))
|
||||
return;
|
||||
isSendingData = true;
|
||||
sendDataVal = 0;
|
||||
sendDataNextVal = 5;
|
||||
await Task.Delay(1);
|
||||
await Task.Delay(1);
|
||||
// effettuo insert...
|
||||
sendDataVal = 5;
|
||||
sendDataNextVal = 90;
|
||||
await Task.Delay(1);
|
||||
await GDataServ.CalFestFerieUpsert(currRecord);
|
||||
// effettuo insert...
|
||||
sendDataVal = 100;
|
||||
sendDataNextVal = 100;
|
||||
// aggiorno display...
|
||||
await Task.Delay(1);
|
||||
showAdd = false;
|
||||
await ReloadData();
|
||||
await ReportUpdate.InvokeAsync(true);
|
||||
isSendingData = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Init preferenze utente
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private async Task InitUserPref()
|
||||
{
|
||||
try
|
||||
{
|
||||
numRecord = await AppMServ.NumRowGridGet(gridKey);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione in InitUserPref{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
|
||||
private async Task ReloadData()
|
||||
{
|
||||
SearchRecords = null;
|
||||
await Task.Delay(1);
|
||||
SearchRecords = GDataServ.CalFestFeriePeriodo(DtStart, DtEnd);
|
||||
// conteggio!
|
||||
totalCount = SearchRecords.Count;
|
||||
// paginazione
|
||||
ListRecords = SearchRecords
|
||||
.OrderByDescending(x => x.data)
|
||||
.Skip(numRecord * (currPage - 1))
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
await Task.Delay(1);
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
private void ToggleEdit()
|
||||
{
|
||||
showAdd = !showAdd;
|
||||
}
|
||||
|
||||
private void AddNew()
|
||||
{
|
||||
showAdd = true;
|
||||
currRecord = new CalFesteFerieModel()
|
||||
{
|
||||
data = DateTime.Today,
|
||||
codGiust = "FER",
|
||||
descrizione = "CHIUSURA UFFICIO"
|
||||
};
|
||||
}
|
||||
|
||||
private List<AnagGiustModel>? ListGiust = null;
|
||||
|
||||
private async Task DoDelete(CalFesteFerieModel selItem)
|
||||
{
|
||||
// chiedo verifica
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sicuro di voler eliminare il record selezionato??"))
|
||||
return;
|
||||
|
||||
await Task.Delay(1);
|
||||
isSendingData = true;
|
||||
sendDataVal = 0;
|
||||
sendDataNextVal = 90;
|
||||
await Task.Delay(1);
|
||||
await InvokeAsync(StateHasChanged);
|
||||
await GDataServ.CalFestFerieDelete(selItem);
|
||||
sendDataVal = 100;
|
||||
sendDataNextVal = 100;
|
||||
await Task.Delay(1);
|
||||
await ReloadData();
|
||||
await ReportUpdate.InvokeAsync(true);
|
||||
isSendingData = false;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
|
||||
<div class="card bg-dark text-light">
|
||||
<div class="card-header ">
|
||||
<div class="row">
|
||||
<div class="col-4 text-start">
|
||||
|
||||
<div class="btn-group" role="group">
|
||||
<button type="button" class="btn btn-sm @btnSel("PER")" @onclick="ToggPer">Permessi</button>
|
||||
<button type="button" class="btn btn-sm @btnSel("FER")" @onclick="ToggFer">Ferie</button>
|
||||
<button type="button" class="btn btn-sm @btnSel("MAL")" @onclick="ToggMal">Malattie</button>
|
||||
<button type="button" class="btn btn-sm @btnSel("FEST")" @onclick="ToggFest">Feste</button>
|
||||
<button type="button" class="btn btn-sm @btnSel("CHIU")" @onclick="ToggChiu">Chiusure</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4 text-center text-uppercase h5">
|
||||
<b>Calendario Aziendale</b>
|
||||
</div>
|
||||
<div class="col-4 text-end">
|
||||
<b>@numEvFilt/@numEvAll</b> (selez/anno)
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body bg-body text-dark p-1">
|
||||
<div style="@schedHeight">
|
||||
<RadzenScheduler @ref=@scheduler style="height: 100%;" Culture=@(new System.Globalization.CultureInfo("it-IT"))
|
||||
TItem="EventDTO" Data="@EvDtoFilt" SelectedIndex="@selectedIndex" Date="@SelDate"
|
||||
StartProperty="DtStart" EndProperty="DtEnd" TextProperty="CodTipo"
|
||||
SlotRender=@OnSlotRender SlotSelect=@OnSlotSelect TodayText="Oggi"
|
||||
AppointmentSelect=@OnAppointmentSelect AppointmentRender=@OnAppointmentRender
|
||||
LoadData=OnLoadData>
|
||||
<Template Context="EvDTO">
|
||||
<div>
|
||||
<strong>@EvDTO.CodTipo</strong> | @EvDTO.Abbrev
|
||||
</div>
|
||||
<small>
|
||||
@if (EvDTO.CodTipo == "PERM" || EvDTO.CodTipo == "104")
|
||||
{
|
||||
@($"{EventDTO.DateForm(EvDTO.CodTipo, EvDTO.DtStart)} --> {EventDTO.DateForm(EvDTO.CodTipo, EvDTO.DtEnd)}")
|
||||
}
|
||||
</small>
|
||||
</Template>
|
||||
<ChildContent>
|
||||
<RadzenDayView />
|
||||
<RadzenWeekView />
|
||||
<RadzenMonthView MaxAppointmentsInSlot="4" />
|
||||
<RadzenYearPlannerView StartMonth="Month.January" MaxAppointmentsInSlot="3" />
|
||||
<RadzenYearView StartMonth="Month.January" />
|
||||
</ChildContent>
|
||||
</RadzenScheduler>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,387 @@
|
||||
using GPW.CORE.Data.DTO;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.Identity.Client;
|
||||
using NLog;
|
||||
using Radzen;
|
||||
using Radzen.Blazor;
|
||||
using Radzen.Blazor.Rendering;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using static EgwCoreLib.Razor.Toggler;
|
||||
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||
|
||||
namespace GPW.CORE.ADM.Components.Compo
|
||||
{
|
||||
public partial class CalendarioAziendale
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<DateTime> DtReq { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public List<EventDTO> EvDtoList { get; set; } = null!;
|
||||
|
||||
[Parameter]
|
||||
public DateTime firstDate { get; set; } = new DateTime(DateTime.Today.Year, 1, 1);
|
||||
|
||||
[Parameter]
|
||||
public DateTime maxDate { get; set; } = new DateTime(DateTime.Today.Year + 1, 1, 1);
|
||||
|
||||
[Parameter]
|
||||
public DateTime minDate { get; set; } = new DateTime(DateTime.Today.Year, 1, 1);
|
||||
|
||||
[Parameter]
|
||||
public int MonthDispl
|
||||
{
|
||||
get => cMonth;
|
||||
set => cMonth = value;
|
||||
}
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<int> MonthReq { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public bool ShowNeedConf { get; set; } = false;
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected RadzenScheduler<EventDTO> scheduler = null!;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Enums
|
||||
|
||||
protected enum Viste
|
||||
{
|
||||
Day,
|
||||
Week,
|
||||
Month,
|
||||
Planner,
|
||||
Year
|
||||
}
|
||||
|
||||
#endregion Protected Enums
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected int currMonth
|
||||
{
|
||||
get => cMonth;
|
||||
set
|
||||
{
|
||||
if (cMonth != value)
|
||||
{
|
||||
cMonth = value;
|
||||
MonthReq.InvokeAsync(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Inject]
|
||||
protected DialogService DialogService { get; set; } = null!;
|
||||
|
||||
protected Month StartMonth { get; set; } = Month.January;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected async Task addMonth(int numMesi)
|
||||
{
|
||||
firstDate = firstDate.AddMonths(numMesi);
|
||||
// verifico limiti...
|
||||
if (numMesi > 0)
|
||||
{
|
||||
firstDate = firstDate > maxDate ? maxDate : firstDate;
|
||||
}
|
||||
else
|
||||
{
|
||||
firstDate = firstDate < minDate ? minDate : firstDate;
|
||||
}
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
protected string btnSel(string bName)
|
||||
{
|
||||
bool answ = false;
|
||||
switch (bName)
|
||||
{
|
||||
case "CHIU":
|
||||
answ = showChiu;
|
||||
break;
|
||||
|
||||
case "FER":
|
||||
answ = showFer;
|
||||
break;
|
||||
|
||||
case "FEST":
|
||||
answ = showFest;
|
||||
break;
|
||||
|
||||
case "MAL":
|
||||
answ = showMal;
|
||||
break;
|
||||
|
||||
case "PER":
|
||||
answ = showPer;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return answ ? "btn-primary" : "btn-secondary";
|
||||
}
|
||||
|
||||
#if false
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await Task.Delay(1);
|
||||
// il mese viene preimpostato sul semestre corrente...
|
||||
StartMonth = (Month)((DateTime.Today.Month / 6) * 6);
|
||||
}
|
||||
#endif
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
numEvAll = 0;
|
||||
numEvFilt = 0;
|
||||
if (EvDtoList != null && EvDtoList.Count > 0)
|
||||
{
|
||||
numEvAll = EvDtoList.Count();
|
||||
FilterData();
|
||||
try
|
||||
{
|
||||
await scheduler.Reload();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"eccezione durante OnParametersSet{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected async Task StartMonthChange()
|
||||
{
|
||||
await scheduler.Reload();
|
||||
}
|
||||
|
||||
protected void ToggChiu()
|
||||
{
|
||||
showChiu = !showChiu;
|
||||
FilterData();
|
||||
}
|
||||
|
||||
protected void ToggFer()
|
||||
{
|
||||
showFer = !showFer;
|
||||
FilterData();
|
||||
}
|
||||
|
||||
protected void ToggFest()
|
||||
{
|
||||
showFest = !showFest;
|
||||
FilterData();
|
||||
}
|
||||
|
||||
protected void ToggMal()
|
||||
{
|
||||
showMal = !showMal;
|
||||
FilterData();
|
||||
}
|
||||
|
||||
protected void ToggPer()
|
||||
{
|
||||
showPer = !showPer;
|
||||
FilterData();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
private int selectedIndex = 2;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private int cMonth { get; set; } = 3;
|
||||
private string currView { get; set; } = "";
|
||||
private List<EventDTO> EvDtoFilt { get; set; } = new List<EventDTO>();
|
||||
private int numEvAll { get; set; } = 0;
|
||||
private int numEvFilt { get; set; } = 0;
|
||||
private string schedHeight { get; set; } = "height: 50rem;";
|
||||
private DateTime SelDate { get; set; } = DateTime.Today;
|
||||
private bool showChiu { get; set; } = true;
|
||||
|
||||
private bool showFer { get; set; } = true;
|
||||
|
||||
private bool showFest { get; set; } = true;
|
||||
|
||||
private bool showMal { get; set; } = true;
|
||||
|
||||
private bool showPer { get; set; } = true;
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private void FilterData()
|
||||
{
|
||||
// in primis copio tutto
|
||||
EvDtoFilt = EvDtoList;
|
||||
if (ShowNeedConf)
|
||||
{
|
||||
EvDtoFilt = EvDtoFilt.Where(x => !x.Conf).ToList();
|
||||
}
|
||||
// controllo ogni toggle...
|
||||
if (!showChiu)
|
||||
{
|
||||
EvDtoFilt = EvDtoFilt
|
||||
.Where(x => !x.IsCompany || (x.IsCompany && !x.CodTipo.Equals("FER", StringComparison.InvariantCultureIgnoreCase)))
|
||||
.ToList();
|
||||
}
|
||||
if (!showFer)
|
||||
{
|
||||
EvDtoFilt = EvDtoFilt
|
||||
.Where(x => !x.CodTipo.Equals("FER", StringComparison.InvariantCultureIgnoreCase) || (x.CodTipo.Equals("FER", StringComparison.InvariantCultureIgnoreCase) && x.IsCompany))
|
||||
.ToList();
|
||||
}
|
||||
if (!showFest)
|
||||
{
|
||||
EvDtoFilt = EvDtoFilt
|
||||
.Where(x => !x.CodTipo.Equals("FEST", StringComparison.InvariantCultureIgnoreCase))
|
||||
.ToList();
|
||||
}
|
||||
if (!showMal)
|
||||
{
|
||||
EvDtoFilt = EvDtoFilt
|
||||
.Where(x => !x.CodTipo.Equals("MAL", StringComparison.InvariantCultureIgnoreCase))
|
||||
.ToList();
|
||||
}
|
||||
if (!showPer)
|
||||
{
|
||||
EvDtoFilt = EvDtoFilt
|
||||
.Where(x => !x.CodTipo.Equals("PERM", StringComparison.InvariantCultureIgnoreCase) && !x.CodTipo.Equals("104", StringComparison.InvariantCultureIgnoreCase))
|
||||
.ToList();
|
||||
}
|
||||
numEvFilt = EvDtoFilt.Count();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sistemazione colore sfonto di ogni evento mostrato
|
||||
/// </summary>
|
||||
/// <param name="args"></param>
|
||||
private void OnAppointmentRender(SchedulerAppointmentRenderEventArgs<EventDTO> args)
|
||||
{
|
||||
// Never call StateHasChanged in AppointmentRender - would lead to infinite loop
|
||||
args.Attributes["style"] = $"background: {args.Data.Color}; color: {args.Data.ForeColor};";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Selezione evento per display
|
||||
/// </summary>
|
||||
/// <param name="selEv"></param>
|
||||
/// <returns></returns>
|
||||
private async Task OnAppointmentSelect(SchedulerAppointmentSelectEventArgs<EventDTO> selEv)
|
||||
{
|
||||
var copy = selEv.Data.Clone();
|
||||
await Task.Delay(1);
|
||||
var data = await DialogService.OpenAsync<TaskDetail>("", new Dictionary<string, object> { { "ThisTask", copy } });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gestione richeista caricamento dati dal controllo x avere nuovo set da mostrare
|
||||
/// </summary>
|
||||
/// <param name="args"></param>
|
||||
/// <returns></returns>
|
||||
private async Task OnLoadData(SchedulerLoadDataEventArgs args)
|
||||
{
|
||||
await Task.Delay(1);
|
||||
currView = scheduler.SelectedView.Text.ToLowerInvariant();
|
||||
DateTime dtMid = args.Start.AddDays(args.End.Subtract(args.Start).TotalDays / 2);
|
||||
// controllo se sia cambiata data anno precedente...
|
||||
if (dtMid.Year != SelDate.Year)
|
||||
{
|
||||
SelDate = dtMid;
|
||||
await DtReq.InvokeAsync(SelDate);
|
||||
}
|
||||
// di almeno 1 anno in questo caso...
|
||||
else if (SelDate != scheduler.Date || Math.Abs(scheduler.Date.Subtract(args.Start).TotalDays) > 365)
|
||||
{
|
||||
SelDate = args.Start.AddDays(4);
|
||||
await DtReq.InvokeAsync(SelDate);
|
||||
}
|
||||
|
||||
//schedHeight = (currView == "year" || currView == "planner") ? "height: 60rem;" : "height: 50rem;";
|
||||
// // Get the appointments for between the Start and End
|
||||
// data = await MyAppointmentService.GetData(selEv.Start, selEv.End);
|
||||
}
|
||||
|
||||
private void OnSlotRender(SchedulerSlotRenderEventArgs args)
|
||||
{
|
||||
// Highlight today in month view
|
||||
if (args.View.Text == "Month" && args.Start.Date == DateTime.Today)
|
||||
{
|
||||
args.Attributes["style"] = "background: var(--rz-scheduler-highlight-background-color, rgba(255,220,40,.2));";
|
||||
}
|
||||
|
||||
// Highlight working hours (9-18)
|
||||
if ((args.View.Text == "Week" || args.View.Text == "Day") && args.Start.Hour > 8 && args.Start.Hour < 19)
|
||||
{
|
||||
args.Attributes["style"] = "background: var(--rz-scheduler-highlight-background-color, rgba(255,220,40,.2));";
|
||||
}
|
||||
}
|
||||
|
||||
private async Task OnSlotSelect(SchedulerSlotSelectEventArgs args)
|
||||
{
|
||||
int prevIdx = selectedIndex;
|
||||
await Task.Delay(1);
|
||||
// verifico indice corretto della vista...
|
||||
switch (args.View.Text)
|
||||
{
|
||||
case "Day":
|
||||
selectedIndex = 0;
|
||||
break;
|
||||
|
||||
case "Week":
|
||||
selectedIndex = 1;
|
||||
break;
|
||||
|
||||
case "Month":
|
||||
selectedIndex = 2;
|
||||
break;
|
||||
|
||||
case "Planner":
|
||||
selectedIndex = 3;
|
||||
break;
|
||||
|
||||
case "Year":
|
||||
selectedIndex = 4;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (prevIdx != selectedIndex)
|
||||
{
|
||||
await scheduler.Reload();
|
||||
}
|
||||
await Task.Delay(1);
|
||||
if (selectedIndex > 0)
|
||||
{
|
||||
selectedIndex--;
|
||||
}
|
||||
// imposto al data selezionata
|
||||
SelDate = args.Start;
|
||||
// riporto data al controller parent...
|
||||
await DtReq.InvokeAsync(SelDate);
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
<div class="row g-1">
|
||||
<div class="col-md-3">
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" @bind="@CurrRecord.RagSociale">
|
||||
<label class="small">Rag.Sociale</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" @bind="@CurrRecord.Indirizzo">
|
||||
<label class="small">Indirizzo</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" @bind="@CurrRecord.Citta">
|
||||
<label class="small">Citta</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
<div class="form-floating">
|
||||
<input type="number" class="form-control" @bind="@CurrRecord.Cap">
|
||||
<label class="small">CAP</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" @bind="@CurrRecord.Prov">
|
||||
<label class="small">Prov</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
<div class="form-floating">
|
||||
<span class="form-control">
|
||||
<span class="form-check form-switch">
|
||||
<input type="checkbox" class="form-check-input" @bind="@CurrRecord.Attivo">
|
||||
</span>
|
||||
</span>
|
||||
<label class="small">Att.</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" @bind="@CurrRecord.Cf">
|
||||
<label class="small">Cod.Fisc</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" @bind="@CurrRecord.PIva">
|
||||
<label class="small">P.Iva</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" @bind="@CurrRecord.Email">
|
||||
<label class="small">Email</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" @bind="@CurrRecord.Tel">
|
||||
<label class="small">Telefono</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row g-1">
|
||||
<div class="col-md-9">
|
||||
<div class="form-floating">
|
||||
<textarea class="form-control" @bind="@CurrRecord.Nota" rows="2" style="height: 5.5rem;"></textarea>
|
||||
<label class="small">Note</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3 pt-2">
|
||||
<button class="btn btn-success w-100" @onclick="() => DoSave()"><i class="fas fa-floppy-disk"></i> Save</button>
|
||||
<button class="btn btn-warning w-100" @onclick="() => DoCancel()"><i class="fas fa-ban"></i> Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,46 @@
|
||||
using GPW.CORE.Data.DbModels;
|
||||
using GPW.CORE.Data.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace GPW.CORE.ADM.Components.Compo
|
||||
{
|
||||
public partial class ClientiEdit
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public AnagClientiModel? CurrRecord { get; set; } = null;
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<bool> EC_update { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected GpwDataService GDataServ { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected async Task DoSave()
|
||||
{
|
||||
bool fatto = false;
|
||||
await Task.Delay(1);
|
||||
if (CurrRecord != null)
|
||||
{
|
||||
fatto = await GDataServ.AnagClientiUpsert(CurrRecord);
|
||||
}
|
||||
await EC_update.InvokeAsync(fatto);
|
||||
}
|
||||
|
||||
protected async Task DoCancel()
|
||||
{
|
||||
await EC_update.InvokeAsync(true);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,160 @@
|
||||
@if (SelItem != null)
|
||||
{
|
||||
<div class="modal fade show" tabindex="-1" style="display:block; background-color: rgba(10,10,10,.6);" aria-modal="true" role="dialog" data-keyboard="true">
|
||||
<div class="modal-dialog modal-xl">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title">Edit Cliente <b>@SelItem.IdxCliente</b></h4>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close" @onclick="() => ForceReload(true)"></button>
|
||||
</div>
|
||||
<div class="modal-body p-1 small">
|
||||
<ClientiEdit CurrRecord=@SelItem EC_update="ForceReload"></ClientiEdit>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
<div class="card shadow">
|
||||
<div class="card-header">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-0">
|
||||
<h3>@Traduci("ManClienti")</h3>
|
||||
</div>
|
||||
<div class="px-0">
|
||||
<div class="d-flex">
|
||||
<div class="px-1">
|
||||
<div class="form-check form-switch">
|
||||
<Toggler SelFilter="@ToggleData" FilterChanged="evToggled"></Toggler>
|
||||
</div>
|
||||
</div>
|
||||
<div class="px-0">
|
||||
<button class="btn btn-sm btn-success" @onclick=CreateNew><i class="fa-solid fa-plus"></i> Add New</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body p-1 small">
|
||||
@if (ListRecords == null || isLoading)
|
||||
{
|
||||
<EgwCoreLib.Razor.LoadingData></EgwCoreLib.Razor.LoadingData>
|
||||
}
|
||||
else if (totalCount == 0)
|
||||
{
|
||||
<div class="alert alert-info">Nessun record trovato</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<table class="table table-striped table-sm text-start">
|
||||
<thead>
|
||||
<tr class="">
|
||||
<th>
|
||||
<button class="btn btn-primary btn-sm" @onclick="() => ForceReload(true)"><i class="fa-solid fa-rotate"></i></button>
|
||||
</th>
|
||||
<th>RagSoc <Sorter ParamName="RagSoc" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th>Indirizzo <Sorter ParamName="Indirizzo" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th>Contatti <Sorter ParamName="Contatti" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th>P.Iva - C.Fisc <Sorter ParamName="PICF" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th class="text-end"><Sorter ParamName="Note" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter> Note</th>
|
||||
<th class="text-end"><Sorter ParamName="Attivo" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter> Attivo</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in ListRecords)
|
||||
{
|
||||
<tr class="align-middle @CheckSel(item)">
|
||||
<td>
|
||||
@if (SelItem == null)
|
||||
{
|
||||
@* <button class="btn btn-info btn-sm" @onclick="() => DoSelect(item)"><i class="fa-solid fa-search"></i></button> *@
|
||||
<button class="btn btn-primary btn-sm" @onclick="() => DoEdit(item)"><i class="fa-solid fa-edit"></i></button>
|
||||
}
|
||||
else
|
||||
{
|
||||
@* <button class="btn btn-secondary btn-sm" disabled><i class="fa-solid fa-search"></i></button> *@
|
||||
<button class="btn btn-secondary btn-sm" disabled><i class="fa-solid fa-edit"></i></button>
|
||||
}
|
||||
</td>
|
||||
<td>
|
||||
<div class="fw-bold fs-5">
|
||||
@item.RagSociale
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
@item.Indirizzo
|
||||
</div>
|
||||
<div class="d-flex">
|
||||
<div class="px-0">@item.Cap, @item.Citta - @item.Prov</div>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="d-flex small">
|
||||
<div class="px-1"><i class="fa-regular fa-envelope"></i></div>
|
||||
<div class="px-0">@item.Email</div>
|
||||
</div>
|
||||
<div class="d-flex small">
|
||||
<div class="px-1"><i class="fa-solid fa-phone"></i></div>
|
||||
<div class="px-0">@item.Tel</div>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="d-flex small">
|
||||
<div class="px-1">P.Iva:</div>
|
||||
<div class="px-0"><b>@item.PIva</b></div>
|
||||
</div>
|
||||
<div class="d-flex small">
|
||||
<div class="px-1">CFis:</div>
|
||||
<div class="px-0"><b>@item.Cf</b></div>
|
||||
</div>
|
||||
</td>
|
||||
<td class="text-end small">
|
||||
@item.Nota
|
||||
</td>
|
||||
<td class="text-end">
|
||||
@if (item.Attivo)
|
||||
{
|
||||
<i class="fa-solid fa-certificate text-success"></i>
|
||||
}
|
||||
else
|
||||
{
|
||||
<i class="fa-solid fa-certificate text-secondary"></i>
|
||||
}
|
||||
</td>
|
||||
<td>
|
||||
@if (item.Attivo)
|
||||
{
|
||||
<button class="btn btn-danger btn-sm" @onclick="() => DoDelete(item)"><i class="fa-solid fa-trash"></i></button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="btn btn-secondary btn-sm" disabled><i class="fa-solid fa-trash"></i></button>
|
||||
}
|
||||
</td>
|
||||
@* <AuthorizeView Roles="SuperAdmin, Admin, SuperUser">
|
||||
<Authorized>
|
||||
<td class="text-end">
|
||||
@if (item.QtyTot == 0)
|
||||
{
|
||||
<button class="btn btn-danger btn-sm" @onclick="() => DeleteRecord(item)"><i class="fa-solid fa-trash"></i></button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="btn btn-secondary btn-sm" disabled><i class="fa-solid fa-trash"></i></button>
|
||||
}
|
||||
</td>
|
||||
</Authorized>
|
||||
</AuthorizeView> *@
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<EgwCoreLib.Razor.DataPager PageSize="@numRecord" currPage="@currPage" numRecordChanged="SetNumRec" numPageChanged="SetPage" totalCount="@totalCount" showLoading="@isLoading"></EgwCoreLib.Razor.DataPager>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,296 @@
|
||||
using EgwCoreLib.Razor;
|
||||
using GPW.CORE.Data.DbModels;
|
||||
using GPW.CORE.Data.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using Microsoft.VisualBasic.FileIO;
|
||||
using NLog;
|
||||
using Radzen;
|
||||
using System;
|
||||
using static EgwCoreLib.Razor.Toggler;
|
||||
|
||||
namespace GPW.CORE.ADM.Components.Compo
|
||||
{
|
||||
public partial class ClientiMan : IDisposable
|
||||
{
|
||||
#region Public Methods
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
AppMServ.EA_SearchUpdated -= AppMServ_EA_SearchUpdated;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected MessageService AppMServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected AppAuthService AuthServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected GpwDataService GDataServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected string CheckSel(AnagClientiModel curItem)
|
||||
{
|
||||
string answ = "";
|
||||
if (SelItem != null)
|
||||
{
|
||||
answ = curItem.IdxCliente == SelItem.IdxCliente ? "table-info" : "";
|
||||
}
|
||||
// verifico stato attivo
|
||||
answ += !curItem.Attivo ? " striked" : "";
|
||||
return answ;
|
||||
}
|
||||
|
||||
protected async Task CreateNew()
|
||||
{
|
||||
SelItem = new AnagClientiModel()
|
||||
{
|
||||
RagSociale = "__Nuovo cliente",
|
||||
PIva = "0000000000000000",
|
||||
Cf = "0000000000000000",
|
||||
Nota = $"Nuovo cliente - {DateTime.Now}",
|
||||
Attivo = true
|
||||
};
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
protected async void DoDelete(AnagClientiModel selItem)
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sicuro di voler eliminare il record?"))
|
||||
return;
|
||||
|
||||
isLoading = true;
|
||||
bool fatto = await GDataServ.AnagClientiDelete(selItem);
|
||||
await ReloadData();
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
protected void DoEdit(AnagClientiModel? selItem)
|
||||
{
|
||||
SelItem = selItem;
|
||||
}
|
||||
|
||||
protected async Task ForceReload(bool force)
|
||||
{
|
||||
SelItem = null;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
CurrSearch = "";
|
||||
AppMServ.SearchVal = "";
|
||||
AppMServ.EA_SearchUpdated += AppMServ_EA_SearchUpdated;
|
||||
numRecord = await AppMServ.NumRowGridGet(gridKey);
|
||||
ToggleData = new SelectGlobalToggle()
|
||||
{
|
||||
leftString = "Tutti",
|
||||
rightString = "Solo Attivi",
|
||||
placardCss = "border-dark"
|
||||
};
|
||||
}
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected async Task SetNumRec(int newNum)
|
||||
{
|
||||
numRecord = newNum;
|
||||
currPage = 1;
|
||||
await AppMServ.NumRowGridSet(gridKey, newNum);
|
||||
await InvokeAsync(ReloadData);
|
||||
}
|
||||
|
||||
protected async Task SetPage(int newNum)
|
||||
{
|
||||
currPage = newNum;
|
||||
await InvokeAsync(ReloadData);
|
||||
}
|
||||
|
||||
protected async Task SortRequested(Sorter.SortCallBack e)
|
||||
{
|
||||
sortField = e.ParamName;
|
||||
sortAsc = e.IsAscending;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected string Traduci(string lemma)
|
||||
{
|
||||
return AuthServ.Traduci(lemma, AppMServ.UserLang);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
private string gridKey = "ClientiMan";
|
||||
private AnagClientiModel? SelItem = null;
|
||||
private bool sortAsc = true;
|
||||
private string sortField = "";
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private int currPage { get; set; } = 1;
|
||||
private string CurrSearch { get; set; } = "";
|
||||
private bool isLoading { get; set; } = false;
|
||||
private List<AnagClientiModel>? ListRecords { get; set; } = null;
|
||||
private int numRecord { get; set; } = 10;
|
||||
private List<AnagClientiModel>? SearchRecords { get; set; } = null;
|
||||
private SelectGlobalToggle ToggleData { get; set; } = new SelectGlobalToggle();
|
||||
private int totalCount { get; set; } = 0;
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private async void AppMServ_EA_SearchUpdated()
|
||||
{
|
||||
CurrSearch = AppMServ.SearchVal;
|
||||
await ReloadData();
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
private async Task evToggled(SelectGlobalToggle newTogData)
|
||||
{
|
||||
ToggleData = newTogData;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
private async Task ReloadData()
|
||||
{
|
||||
isLoading = true;
|
||||
ListRecords = null;
|
||||
try
|
||||
{
|
||||
SearchRecords = await GDataServ.AnagClientiAllAsync();
|
||||
// verifico condizioni filtro
|
||||
if (ToggleData.isActive)
|
||||
{
|
||||
SearchRecords = SearchRecords.Where(x => x.Attivo).ToList();
|
||||
}
|
||||
// verifico filtro per ricerca
|
||||
if (!string.IsNullOrEmpty(CurrSearch))
|
||||
{
|
||||
SearchRecords = SearchRecords.Where(x => x.RagSociale.Contains(CurrSearch, StringComparison.InvariantCultureIgnoreCase)).ToList();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error($"Eccezione in recupero dati{Environment.NewLine}{ex}");
|
||||
}
|
||||
totalCount = SearchRecords.Count;
|
||||
SortTable();
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
private void SortTable()
|
||||
{
|
||||
if (SearchRecords != null)
|
||||
{
|
||||
// se ho ordinamento riordino...
|
||||
if (!string.IsNullOrEmpty(sortField))
|
||||
{
|
||||
switch (sortField)
|
||||
{
|
||||
case "RagSoc":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.RagSociale).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.RagSociale).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "Indirizzo":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.Prov).ThenBy(x => x.Indirizzo).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.Prov).ThenBy(x => x.Indirizzo).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "Contatti":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.Email).ThenBy(x => x.Tel).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.Email).ThenBy(x => x.Tel).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "PICF":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.PIva).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.PIva).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "Note":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.Nota).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.Nota).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "Attivo":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.Attivo).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.Attivo).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// filtro x display
|
||||
ListRecords = SearchRecords
|
||||
.Skip(numRecord * (currPage - 1))
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
ListRecords = new List<AnagClientiModel>();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<div class="d-flex justify-content-between text-light">
|
||||
<div class="text-start">
|
||||
GPW <span class="small">v.@version</span>
|
||||
</div>
|
||||
<div class="text-end">
|
||||
<span class="small px-1">@adesso</span>
|
||||
<a class="text-light" href="https://www.egalware.com/" target="_blank"><img class="img-fluid" width="12" src="images/LogoEgw.png" /> Egalware </a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
namespace GPW.CORE.ADM.Components.Compo
|
||||
{
|
||||
public partial class CmpFooter : IDisposable
|
||||
{
|
||||
#region Public Methods
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (aTimer != null)
|
||||
{
|
||||
aTimer.Elapsed -= ElapsedTimer;
|
||||
aTimer.Stop();
|
||||
aTimer.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected DateTime adesso = DateTime.Now;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected void ElapsedTimer(object? source, System.Timers.ElapsedEventArgs e)
|
||||
{
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
adesso = DateTime.Now;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
});
|
||||
pUpd.Wait();
|
||||
}
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
var rawVers = typeof(Program).Assembly.GetName().Version;
|
||||
version = rawVers != null ? rawVers : new Version("0.0.0.0");
|
||||
StartTimer();
|
||||
}
|
||||
|
||||
protected void StartTimer()
|
||||
{
|
||||
if (aTimer != null)
|
||||
{
|
||||
aTimer.Stop();
|
||||
aTimer.Dispose();
|
||||
}
|
||||
#if DEBUG
|
||||
int tOutPeriod = 1000;
|
||||
#else
|
||||
int tOutPeriod = 10000;
|
||||
#endif
|
||||
aTimer = new System.Timers.Timer(tOutPeriod);
|
||||
aTimer.Elapsed += ElapsedTimer;
|
||||
aTimer.Enabled = true;
|
||||
aTimer.Start();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private System.Timers.Timer aTimer = null!;
|
||||
private Version? version = null!;
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
|
||||
<div class="card shadow">
|
||||
<div class="card-header">
|
||||
<h4>Dipendenti</h4>
|
||||
<div class="row">
|
||||
<div class="col-9">
|
||||
<div class="input-group" runat="server">
|
||||
<span class="input-group-text">Clona</span>
|
||||
<select @bind="@idxDipSel" class="form-select form-select-sm">
|
||||
<option value="0">--- Selezionare ---</option>
|
||||
@foreach (var item in ListDipendenti)
|
||||
{
|
||||
<option value="@item.IdxDipendente">@($"{item.Cognome} {item.Nome}")</option>
|
||||
}
|
||||
</select>
|
||||
@if (idxDipSel > 0)
|
||||
{
|
||||
<button class="btn btn-success" @onclick="AddSelected"><i class="fa fa-plus px-2" title="Aggiungi Assegnazione"></i></button>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<div class="input-group">
|
||||
<span class="input-group-text">Show Inatt.</span>
|
||||
<span class="form-control">
|
||||
<span class="form-check form-switch">
|
||||
<input type="checkbox" class="form-check-input" @bind="@ShowInactive" @bind:after="ReloadData">
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body p-1">
|
||||
@if (ListRecords == null || isLoading)
|
||||
{
|
||||
<EgwCoreLib.Razor.LoadingData></EgwCoreLib.Razor.LoadingData>
|
||||
}
|
||||
else if (totalCount == 0)
|
||||
{
|
||||
<div class="alert alert-info">Nessun record trovato</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<table class="table table-striped table-sm text-start">
|
||||
<thead>
|
||||
<tr class="">
|
||||
<th>Dipendente</th>
|
||||
<th class="text-end"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in ListRecords)
|
||||
{
|
||||
<tr class="align-middle @CheckItem(item)">
|
||||
<td>
|
||||
<b>@item.Cognome</b> @item.Nome
|
||||
</td>
|
||||
<td class="text-end">
|
||||
<button class="btn btn-danger btn-sm" @onclick="() => DoDelete(item)"><i class="fa-solid fa-trash"></i></button>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,183 @@
|
||||
using GPW.CORE.Data.DbModels;
|
||||
using GPW.CORE.Data.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using NLog;
|
||||
|
||||
namespace GPW.CORE.ADM.Components.Compo
|
||||
{
|
||||
public partial class Dip2GrpMan : IDisposable
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public string CodGruppo { get; set; } = "";
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
AppMServ.EA_SearchUpdated -= AppMServ_EA_SearchUpdated;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected MessageService AppMServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected GpwDataService GDataServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected string CheckItem(DipendentiModel currItem)
|
||||
{
|
||||
string answ = !(currItem.Attivo ?? false) ? "striked" : "";
|
||||
return answ;
|
||||
}
|
||||
|
||||
protected async void DoDelete(DipendentiModel selItem)
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sicuro di voler rimuovere il record di associazione dipendente/gruppo?"))
|
||||
return;
|
||||
|
||||
isLoading = true;
|
||||
|
||||
await GDataServ.Dipendenti2GrpDelete(selItem.IdxDipendente, CodGruppo);
|
||||
await ReloadData();
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
CurrSearch = "";
|
||||
AppMServ.SearchVal = "";
|
||||
AppMServ.EA_SearchUpdated += AppMServ_EA_SearchUpdated;
|
||||
numRecord = await AppMServ.NumRowGridGet(gridKey);
|
||||
}
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected async Task SetNumRec(int newNum)
|
||||
{
|
||||
numRecord = newNum;
|
||||
currPage = 1;
|
||||
await AppMServ.NumRowGridSet(gridKey, newNum);
|
||||
await InvokeAsync(ReloadData);
|
||||
}
|
||||
|
||||
protected async Task SetPage(int newNum)
|
||||
{
|
||||
currPage = newNum;
|
||||
await InvokeAsync(ReloadData);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
private string gridKey = "Dip2GrpMan";
|
||||
|
||||
private int idxDipSel = 0;
|
||||
|
||||
private bool showInactive = false;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private int currPage { get; set; } = 1;
|
||||
|
||||
private string CurrSearch { get; set; } = "";
|
||||
|
||||
private bool isLoading { get; set; } = false;
|
||||
|
||||
private List<DipendentiModel> ListDipendenti { get; set; } = new List<DipendentiModel>();
|
||||
|
||||
private List<DipendentiModel>? ListRecords { get; set; } = null;
|
||||
|
||||
private int numRecord { get; set; } = 10;
|
||||
|
||||
private List<DipendentiModel>? SearchRecords { get; set; } = null;
|
||||
|
||||
private bool ShowInactive
|
||||
{
|
||||
get => showInactive;
|
||||
set { showInactive = value; }
|
||||
}
|
||||
|
||||
private int totalCount { get; set; } = 0;
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private async void AppMServ_EA_SearchUpdated()
|
||||
{
|
||||
CurrSearch = AppMServ.SearchVal;
|
||||
await ReloadData();
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
private async Task ReloadData()
|
||||
{
|
||||
isLoading = true;
|
||||
ListRecords = null;
|
||||
ListDipendenti = await GDataServ.DipendentiGetAll();
|
||||
try
|
||||
{
|
||||
SearchRecords = await GDataServ.DipendentiByGrp(CodGruppo);
|
||||
// tolgo da el associabili quelli già associati...
|
||||
ListDipendenti = ListDipendenti.Where(i => !SearchRecords.Contains(i)).ToList();
|
||||
// verifico filtro per ricerca
|
||||
if (!string.IsNullOrEmpty(CurrSearch))
|
||||
{
|
||||
SearchRecords = SearchRecords.Where(x => x.Cognome.Contains(CurrSearch, StringComparison.InvariantCultureIgnoreCase) || x.Nome.Contains(CurrSearch, StringComparison.InvariantCultureIgnoreCase)).ToList();
|
||||
}
|
||||
if (!showInactive)
|
||||
{
|
||||
SearchRecords = SearchRecords.Where(x => x.Attivo ?? false).ToList();
|
||||
ListDipendenti = ListDipendenti.Where(x => x.Attivo ?? false).ToList();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error($"Eccezione in recupero dati{Environment.NewLine}{ex}");
|
||||
}
|
||||
totalCount = SearchRecords.Count;
|
||||
|
||||
// filtro x display
|
||||
ListRecords = SearchRecords
|
||||
.OrderBy(x => x.Cognome)
|
||||
.ThenBy(x => x.Nome)
|
||||
.Skip(numRecord * (currPage - 1))
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
|
||||
// cerco i dip del gruppo...
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
private async Task AddSelected()
|
||||
{
|
||||
await GDataServ.Dipendenti2GrpInsert(idxDipSel, CodGruppo);
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,321 @@
|
||||
@if (CurrMode == EditMode.FullEdit)
|
||||
{
|
||||
<div class="row g-2">
|
||||
<div class="col-md-3">
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" @bind="@CurrRecord.Cognome">
|
||||
<label class="small">Cognome</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" @bind="@CurrRecord.Nome">
|
||||
<label class="small">Nome</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" @bind="@CurrRecord.Matricola">
|
||||
<label class="small">Matricola</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="form-floating">
|
||||
<select @bind="@CurrRecord.CodOrario" class="form-select form-select-sm" title="Profilo Orario">
|
||||
<option value="">--- Selezionare ---</option>
|
||||
@foreach (var item in ListOrari)
|
||||
{
|
||||
<option value="@item.codOrario">@item.descOrario</option>
|
||||
}
|
||||
</select>
|
||||
<label class="small">Profilo Orario</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3 align-content-center">
|
||||
<button class="btn btn-success btn-lg my-1 w-100" @onclick="() => DoSave()"><i class="fas fa-floppy-disk"></i> Save</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row g-2 my-1">
|
||||
<div class="col-md-3">
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" @bind="@CurrRecord.Dominio">
|
||||
<label class="small">Dominio</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" @bind="@CurrRecord.Utente">
|
||||
<label class="small">Utente</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" @bind="@CurrRecord.Email">
|
||||
<label class="small">Email</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3 align-content-center">
|
||||
<button class="btn btn-warning btn-lg my-1 w-100" @onclick="() => DoCancel()"><i class="fas fa-ban"></i> Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row g-2 my-1">
|
||||
<div class="col-md-3">
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" @bind="@CurrRecord.Cf">
|
||||
<label class="small">Codice Fiscale</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="form-floating">
|
||||
<input type="date" class="form-control" @bind="@CurrRecord.DataNascita">
|
||||
<label class="small">Data Nascita</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" @bind="@CurrRecord.LuogoNascita">
|
||||
<label class="small">Luogo Nascita</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" @bind="@CurrRecord.ProvNascita">
|
||||
<label class="small">Prov</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" @bind="@CurrRecord.NazNascita">
|
||||
<label class="small">Naz</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" @bind="@CurrRecord.CodHw">
|
||||
<label class="small">CodHw</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row g-2 my-1">
|
||||
<div class="col-md-2">
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" @bind="@CurrRecord.Gruppo">
|
||||
<label class="small">Gruppo</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
<div class="form-floating">
|
||||
<div class="form-control">
|
||||
<div class="form-check form-switch">
|
||||
<input type="checkbox" class="form-check-input" @bind="@CurrRecord.Attivo">
|
||||
</div>
|
||||
</div>
|
||||
<label class="small">Att.</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="form-floating">
|
||||
<select @bind="@CurrRecord.idxResp" class="form-select form-select-sm" title="Responsabile">
|
||||
<option value="0">--- Selezionare ---</option>
|
||||
@foreach (var item in ListDipendenti)
|
||||
{
|
||||
<option value="@item.IdxDipendente">@item.Cognome @item.Nome</option>
|
||||
}
|
||||
</select>
|
||||
<label class="small">Responsabile</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="form-floating">
|
||||
<input type="date" class="form-control" @bind="@CurrRecord.DataAssunzione">
|
||||
<label class="small">Assunzione</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="form-floating">
|
||||
<input type="date" class="form-control" @bind="@CurrRecord.DataCessazione">
|
||||
<label class="small">Cessazione</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
else if (CurrMode == EditMode.ResetRequest)
|
||||
{
|
||||
<div class="row g-2">
|
||||
<div class="col-8">
|
||||
<div class="row">
|
||||
<div class="col-4 pe-0">
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" @bind="@ReqReset.Richiedente">
|
||||
<label class="small"><i class="fa-solid fa-user"></i> Richiedente</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4 px-0">
|
||||
<div class="form-floating">
|
||||
<input type="email" class="form-control" @bind="@ReqReset.Email">
|
||||
<label class="small"><i class="fa-regular fa-envelope"></i> Email</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4 ps-0">
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" @bind="@ReqReset.Telefono">
|
||||
<label class="small"><i class="fa-solid fa-phone"></i> Telefono</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item d-flex justify-content-between" aria-current="true">
|
||||
<div class="px-1">Anagr:</div>
|
||||
<div class="px-1">@($"{CurrRecord.DataNascita:yyyy-MM-dd}") @CurrRecord.LuogoNascita (@CurrRecord.ProvNascita | @CurrRecord.NazNascita)</div>
|
||||
</li>
|
||||
<li class="list-group-item d-flex justify-content-between" aria-current="true">
|
||||
<div class="px-1">@CurrRecord.Cf</div>
|
||||
<div class="px-1">@CurrRecord.Email</div>
|
||||
</li>
|
||||
<li class="list-group-item d-flex justify-content-between" aria-current="true">
|
||||
<div class="px-1">
|
||||
@if (CurrRecord.DataCessazione <= DateTime.Today)
|
||||
{
|
||||
<span>Periodo:</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span>Assunzione:</span>
|
||||
}
|
||||
</div>
|
||||
<div class="px-1">
|
||||
<span>@($"{CurrRecord.DataAssunzione:yyyy-MM-dd}")</span>
|
||||
@if (CurrRecord.DataCessazione <= DateTime.Today)
|
||||
{
|
||||
<span>
|
||||
→ @($"{CurrRecord.DataCessazione:yyyy-MM-dd}")
|
||||
</span>
|
||||
}
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item d-flex justify-content-between" aria-current="true">
|
||||
<div class="px-1">Lock Licenza</div>
|
||||
<div class="px-1">
|
||||
<span class="text-danger">
|
||||
<i class="fa-solid fa-lock"></i> <b>@($"{UnlockDateLic:dddd dd MMMM yyyy}")</b>
|
||||
</span>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="row">
|
||||
@*
|
||||
<div class="col-12">
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" @bind="@ReqReset.Richiedente">
|
||||
<label class="small"><i class="fa-solid fa-user"></i> Richiedente</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 pe-0">
|
||||
<div class="form-floating">
|
||||
<input type="email" class="form-control" @bind="@ReqReset.Email">
|
||||
<label class="small"><i class="fa-regular fa-envelope"></i> Email</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 ps-0">
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" @bind="@ReqReset.Telefono">
|
||||
<label class="small"><i class="fa-solid fa-phone"></i> Telefono</label>
|
||||
</div>
|
||||
</div>
|
||||
*@
|
||||
<div class="col-12">
|
||||
<div class="form-floating">
|
||||
<textarea class="form-control" @bind="@ReqReset.Causale" style="min-height: 8rem;"></textarea>
|
||||
<label class="small"><i class="fa-regular fa-message"></i> Causale</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 text-center mt-2">
|
||||
<button class="btn btn-primary btn-lg my-1 w-100" @onclick="() => DoActivate()" title="Invio richiesta sblocco licenza">Invio Richiesta <i class="far fa-paper-plane"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
else if (CurrMode == EditMode.KeyRegen)
|
||||
{
|
||||
<div class="row g-2">
|
||||
<div class="col-8">
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item d-flex justify-content-between" aria-current="true">
|
||||
<div class="px-1">Anagr:</div>
|
||||
<div class="px-1">@($"{CurrRecord.DataNascita:yyyy-MM-dd}") @CurrRecord.LuogoNascita (@CurrRecord.ProvNascita | @CurrRecord.NazNascita)</div>
|
||||
</li>
|
||||
@* <li class="list-group-item d-flex justify-content-between" aria-current="true">
|
||||
<div class="px-1"><b>@CurrRecord.Cognome</b> @CurrRecord.Nome</div>
|
||||
<div class="px-1">@CurrRecord.Matricola</div>
|
||||
</li> *@
|
||||
<li class="list-group-item d-flex justify-content-between" aria-current="true">
|
||||
<div class="px-1">@CurrRecord.Cf</div>
|
||||
<div class="px-1">@CurrRecord.Email</div>
|
||||
</li>
|
||||
<li class="list-group-item d-flex justify-content-between" aria-current="true">
|
||||
<div class="px-1">
|
||||
@if (CurrRecord.DataCessazione <= DateTime.Today)
|
||||
{
|
||||
<span>Periodo:</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span>Assunzione:</span>
|
||||
}
|
||||
</div>
|
||||
<div class="px-1">
|
||||
<span>@($"{CurrRecord.DataAssunzione:yyyy-MM-dd}")</span>
|
||||
@if (CurrRecord.DataCessazione <= DateTime.Today)
|
||||
{
|
||||
<span>
|
||||
→ @($"{CurrRecord.DataCessazione:yyyy-MM-dd}")
|
||||
</span>
|
||||
}
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
@if (CurrRecord.Attivo ?? false)
|
||||
{
|
||||
if (CheckActivationUnlocked)
|
||||
{
|
||||
<button class="btn btn-danger btn-lg my-1 w-100" @onclick="() => DoRelease()" title="Cessazione utente + Rilascio Licenza">Cessazione Utente <i class="fas fa-link-slash"></i></button>
|
||||
@if (!CheckActivation && (CurrRecord.Attivo ?? false))
|
||||
{
|
||||
<button class="btn btn-primary btn-lg my-1 w-100" @onclick="() => DoReissue()" title="Assegna Licenza ad utente già Attivo">Assegna Licenza <i class="fas fa-rotate"></i></button>
|
||||
}
|
||||
}
|
||||
<button class="btn btn-primary btn-lg my-1 w-100" @onclick="() => DoResync()" title="Rigenera Token Auth SMART + associa Licenza">Rigen + Sync Auth <i class="fas fa-rotate"></i></button>
|
||||
}
|
||||
else
|
||||
{
|
||||
@if (LicenzeOk && LicenzeDisponibili)
|
||||
{
|
||||
<button class="btn btn-success btn-lg my-1 w-100" @onclick="() => DoActivate()" title="Attiva utente + Assegna Licenza">Attiva Utente <i class="fas fa-link"></i></button>
|
||||
}
|
||||
}
|
||||
<div class="text-center">
|
||||
@if (LockExpired)
|
||||
{
|
||||
<span class="text-success">
|
||||
<i class="fa-solid fa-unlock"></i> <b>@($"{UnlockDateLic:dddd dd MMMM yyyy}")</b>
|
||||
</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span class="text-danger">
|
||||
<i class="fa-solid fa-lock"></i> <b>@($"{UnlockDateLic:dddd dd MMMM yyyy}")</b>
|
||||
</span>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="alert a fs-6">Modo controllo non definito</div>
|
||||
}
|
||||
@@ -0,0 +1,238 @@
|
||||
using GPW.CORE.Data.DbModels;
|
||||
using GPW.CORE.Data.DTO;
|
||||
using GPW.CORE.Data.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.EntityFrameworkCore.SqlServer.Query.Internal;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace GPW.CORE.ADM.Components.Compo
|
||||
{
|
||||
public partial class DipendentiEdit
|
||||
{
|
||||
#region Public Enums
|
||||
|
||||
/// <summary>
|
||||
/// Modalità Edit
|
||||
/// </summary>
|
||||
public enum EditMode
|
||||
{
|
||||
None = 0,
|
||||
KeyRegen,
|
||||
ResetRequest,
|
||||
FullEdit
|
||||
}
|
||||
|
||||
#endregion Public Enums
|
||||
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public EditMode CurrMode { get; set; } = EditMode.None;
|
||||
|
||||
[Parameter]
|
||||
public DipendentiModel? CurrRecord { get; set; } = null;
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<DipendentiModel> EC_Activate { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<DipendentiModel> EC_Reissue { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<DipendentiModel> EC_Release { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<DipendentiModel> EC_Resync { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<DipendentiModel> EC_update { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public List<DipendentiModel> ListDipendenti { get; set; } = null!;
|
||||
|
||||
[Parameter]
|
||||
public List<AnagOrariModel> ListOrari { get; set; } = null!;
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected bool CheckActivation = false;
|
||||
|
||||
protected bool CheckActivationUnlocked = false;
|
||||
|
||||
protected string CodImpiego = "";
|
||||
|
||||
protected int IdxSubLic = 0;
|
||||
|
||||
protected bool LicenzeDisponibili = false;
|
||||
|
||||
protected bool LicenzeOk = false;
|
||||
|
||||
protected bool LockExpired = false;
|
||||
|
||||
protected int NumDipAct = 0;
|
||||
|
||||
protected DateTime UnlockDateLic = DateTime.Today.AddMonths(3);
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected MessageService AppMServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected LicenseService LicServ { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
/// <summary>
|
||||
/// Attiva + Assegna Licenza
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected async Task DoActivate()
|
||||
{
|
||||
await EC_Activate.InvokeAsync(CurrRecord);
|
||||
}
|
||||
|
||||
protected async Task DoCancel()
|
||||
{
|
||||
await EC_update.InvokeAsync(CurrRecord);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Assegna Licenza
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected async Task DoReissue()
|
||||
{
|
||||
await EC_Reissue.InvokeAsync(CurrRecord);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Rilascia Licenza
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected async Task DoRelease()
|
||||
{
|
||||
await EC_Release.InvokeAsync(CurrRecord);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Richiesta Rilascio Licenza
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected async Task DoReqUnlock()
|
||||
{
|
||||
// invio richiesta sblocco licenza prima della scadenza naturale lock
|
||||
|
||||
//await EC_Release.InvokeAsync(CurrRecord);
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Genera una nuova chiave utente + riassegna Licenza
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected async Task DoResync()
|
||||
{
|
||||
await EC_Resync.InvokeAsync(CurrRecord);
|
||||
}
|
||||
|
||||
protected async Task DoSave()
|
||||
{
|
||||
bool fatto = false;
|
||||
if (CurrRecord != null)
|
||||
{
|
||||
DateTime adesso = DateTime.Now;
|
||||
|
||||
// chiama resync dati licenza (cod impiego / codAuth)
|
||||
fatto = LicServ.SendTicketReq(ReqReset.Richiedente.Trim(), ReqReset.Email.Trim(), ReqReset.Telefono.Trim(), ReqReset.Causale.Trim(), CodImpiego, IdxSubLic);
|
||||
// chiudo
|
||||
LicServ.ResetTicketCache();
|
||||
|
||||
// reset richiesta
|
||||
ReqReset = new DatiReqResetDTO();
|
||||
#if false
|
||||
// evento reset
|
||||
raiseReset();
|
||||
#endif
|
||||
await EC_update.InvokeAsync(CurrRecord);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
DoActivCheck();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private DatiReqResetDTO ReqReset = new DatiReqResetDTO();
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// Effettua verifiche attivazioni e dati vari
|
||||
/// </summary>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
private void DoActivCheck()
|
||||
{
|
||||
if (ListDipendenti != null && ListDipendenti.Count > 0)
|
||||
{
|
||||
NumDipAct = ListDipendenti.Where(x => x.Attivo ?? false).Count();
|
||||
if (CurrRecord != null)
|
||||
{
|
||||
// calcolo CodImpiego
|
||||
CodImpiego = LicServ.HashDip(CurrRecord);
|
||||
UnlockDateLic = LockExpiry();
|
||||
LockExpired = UnlockDateLic <= DateTime.Today.AddDays(1);
|
||||
var onlineActInfo = LicServ.GetOnlineActivationInfo(CodImpiego);
|
||||
if (onlineActInfo != null)
|
||||
{
|
||||
// verifico unlock licenza online...
|
||||
#if false
|
||||
CheckActivationUnlocked = LicServ.CheckActivationUnlocked(CodImpiego);
|
||||
#endif
|
||||
CheckActivation = onlineActInfo.CodImpiego == CodImpiego;
|
||||
CheckActivationUnlocked = onlineActInfo.VetoUnlock <= DateTime.Today || string.IsNullOrEmpty(onlineActInfo.CodImpiego);
|
||||
IdxSubLic = onlineActInfo.IdxSubLic;
|
||||
}
|
||||
// verifico licenze
|
||||
LicenzeOk = NumDipAct <= LicServ.ActivList.Count();
|
||||
// verifico licenze disponibili
|
||||
LicenzeDisponibili = LicServ.AppLicense.NumLicenze > NumDipAct;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restitusice la data di unlock del dipendente
|
||||
/// </summary>
|
||||
private DateTime LockExpiry()
|
||||
{
|
||||
DateTime cessato = CurrRecord.DataCessazione ?? DateTime.Today.AddDays(-1);
|
||||
bool isAttivo = CurrRecord.Attivo ?? false;
|
||||
DateTime answ = isAttivo ? DateTime.Today.AddDays(90) : cessato;
|
||||
|
||||
// verifico SE sia disponibile licenza...
|
||||
var activationsList = LicServ.ActivList;
|
||||
var currAct = activationsList.Where(x => x.CodImpiego == CodImpiego).FirstOrDefault();
|
||||
// se trovo record
|
||||
if (currAct != null)
|
||||
{
|
||||
answ = currAct.VetoUnlock;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,226 @@
|
||||
@if (RecordEdit != null)
|
||||
{
|
||||
<div class="modal fade show" tabindex="-1" style="display:block; background-color: rgba(10,10,10,.6);" aria-modal="true" role="dialog" data-keyboard="true">
|
||||
<div class="modal-dialog @modalSize">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header d-flex justify-content-between">
|
||||
<div class="px-1 fs-4 modal-title">
|
||||
<b>@RecordEdit.Cognome</b> @RecordEdit.Nome
|
||||
@if (CtrlMode == DipendentiEdit.EditMode.FullEdit)
|
||||
{
|
||||
<span>| Modifica Record @RecordEdit.IdxDipendente</span>
|
||||
}
|
||||
else if (CtrlMode == DipendentiEdit.EditMode.ResetRequest)
|
||||
{
|
||||
<span>| Sblocco Licenza</span>
|
||||
}
|
||||
</div>
|
||||
<div class="px-1">
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close" @onclick=ForceReload></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-body p-1 small">
|
||||
<DipendentiEdit CurrMode="CtrlMode" CurrRecord="RecordEdit" EC_update="ForceReload" EC_Activate="DoActivate" EC_Release="ReleaseLicense" ListDipendenti="@ListDipendentiAttiviOrd" ListOrari="@ListOrari"></DipendentiEdit>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
|
||||
<div class="card shadow">
|
||||
<div class="card-header">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-0 d-flex">
|
||||
<div class="px-2">
|
||||
<h4>Dipendenti</h4>
|
||||
</div>
|
||||
<div class="px-2">
|
||||
<div class="px-1 py-2">
|
||||
<div class="form-check form-switch">
|
||||
<input class="form-check-input" type="checkbox" @bind=@ShowInatt @bind:after=ForceReload>
|
||||
<label class="form-check-label">Mostra Inattivi</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="px-2">
|
||||
<button class="btn btn-success" @onclick=CreateNew tooltip="Add New"><i class="fa-solid fa-plus"></i> Add New</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="px-0 d-flex">
|
||||
<div class="d-flex">
|
||||
<div class="px-1 align-content-center">
|
||||
<div class="input-group input-group-sm">
|
||||
<span class="input-group-text">
|
||||
Mostra QRCode
|
||||
<span class="form-check form-switch align-content-center ms-2" title="Mostra QRCode">
|
||||
<input class="form-check-input" type="checkbox" @bind=@ShowQrCode>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@if (ShowQrCode)
|
||||
{
|
||||
<div class="ps-1 pe-0 align-content-center">
|
||||
<div class="input-group input-group-sm">
|
||||
<span class="input-group-text">
|
||||
@TextQrLinkInt
|
||||
<span class="form-check form-switch align-content-center ms-2" title="@TextQrLinkInt">
|
||||
<input class="form-check-input" type="checkbox" @bind=@ShowLinkInt>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ps-0 pe-1 align-content-center">
|
||||
<div class="input-group input-group-sm">
|
||||
<span class="input-group-text">
|
||||
@TextQrLinkCore
|
||||
<span class="form-check form-switch align-content-center ms-2" title="@TextQrLinkCore">
|
||||
<input class="form-check-input" type="checkbox" @bind=@ShowLinkCore>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex bg-dark bg-gradient text-light p-1">
|
||||
<div class="px-2 mx-1 border border-2 border-info rounded rounded-3 align-content-center g-1"><i class="fa-solid fa-database"></i> Licenze Locali: disponibili <b>@NumLicDispLocal</b> / utenti attivi <b>@NumLicActLocal</b></div>
|
||||
<div class="px-2 mx-1 border border-2 border-success rounded rounded-3 align-content-center g-1"><i class="fa-solid fa-cloud"></i> Licenze Online: disponibili <b>@NumLicDispOnline</b> / utenti attivi <b>@NumLicActOnline</b></div>
|
||||
<button class="mx-1 btn btn-success" @onclick="DoRefresh"><i class="fa-solid fa-cloud-arrow-down g-1"></i> Refresh Status Online</button>
|
||||
@if (NeedAllocation)
|
||||
{
|
||||
<button class="mx-1 btn btn-primary" @onclick="DoFixMissing"><i class="fa-solid fa-cloud-arrow-up g-1"></i> Allocazione Licenze</button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="mx-1 btn btn-secondary disabled" disabled><i class="fa-solid fa-cloud-arrow-up g-1"></i> Allocazione Licenze</button>
|
||||
}
|
||||
<button class="mx-1 btn btn-outline-secondary"><i class="fa-solid fa-ticket g-1"></i> Ticket Aperti <b>@NumTicket</b></button>
|
||||
<button class="mx-1 btn btn-warning g-1"><i class="fa-solid fa-key"></i> Rigenera AuthKey</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body p-1 small">
|
||||
|
||||
@if (ListRecords == null || isLoading)
|
||||
{
|
||||
<EgwCoreLib.Razor.LoadingData></EgwCoreLib.Razor.LoadingData>
|
||||
}
|
||||
else if (totalCount == 0)
|
||||
{
|
||||
|
||||
<div class="alert alert-info">Nessun record trovato</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="row">
|
||||
@if (ShowQrCode)
|
||||
{
|
||||
@foreach (var item in ListRecords)
|
||||
{
|
||||
<div class="col-12 col-md-6 col-lg-4 col-xl-3 mb-2">
|
||||
<div class="card shadow">
|
||||
<div class="card-header p-0">
|
||||
<UserQrCode LinkInt="ShowLinkInt" RecordDip="item" LinkCore="ShowLinkCore"></UserQrCode>
|
||||
</div>
|
||||
<div class="card-body py-1">
|
||||
<div class="fs-1 fw-bold">@item.Cognome</div>
|
||||
<div class="fs-4">@item.Nome</div>
|
||||
</div>
|
||||
<div class="card-footer d-flex justify-content-between">
|
||||
<div class="px-1"><img src="images/logoegw.png" class="imf-fluid" width="32" /> <span class="fs-6">Egalware</span></div>
|
||||
<div class="px-1 fs-6 align-content-center"><i>SMART a-link</i></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="col-12">
|
||||
<table class="table table-striped table-sm text-start">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<button class="btn btn-primary btn-sm" @onclick="() => ForceReload()"><i class="fa-solid fa-rotate"></i></button>
|
||||
</th>
|
||||
<th>Cognome <Sorter ParamName="Cognome" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th>Nome <Sorter ParamName="Nome" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th>Matricola <Sorter ParamName="Matricola" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th>Profilo <Sorter ParamName="Profilo" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th>Dominio <Sorter ParamName="Dominio" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th>Utente <Sorter ParamName="Utente" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th>Email <Sorter ParamName="Email" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th>CF <Sorter ParamName="CF" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th>CodeHw <Sorter ParamName="CodeHw" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th>Dati anagrafici <Sorter ParamName="DatiAnag" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th>Gruppo <Sorter ParamName="Gruppo" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th>Stato licenza <Sorter ParamName="StatoLic" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th class="text-end">Responsabile <Sorter ParamName="Responsabile" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in ListRecords)
|
||||
{
|
||||
<tr class="@CheckSel(item)">
|
||||
<td class="text-nowrap">
|
||||
<button class="btn btn-info btn-sm" @onclick="() => DoSelect(item)" title="Dettaglio Record"><i class="fa-solid fa-search"></i></button>
|
||||
@if (RecordEdit == null)
|
||||
{
|
||||
if (CheckFreeEdit(item.IdxDipendente))
|
||||
{
|
||||
<button class="btn btn-primary btn-sm mx-1" @onclick="() => DoEdit(item)" title="Modifica record">
|
||||
<i class="fa-solid fa-edit"></i>
|
||||
</button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="btn btn-warning btn-sm mx-1" @onclick="() => RequestReset(item)" title="Richiesta sblocco Licenza">
|
||||
<i class="fa-solid fa-question-circle"></i>
|
||||
</button>
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="btn btn-secondary btn-sm mx-1" disabled><i class="fa-solid fa-edit"></i></button>
|
||||
}
|
||||
</td>
|
||||
|
||||
<td class="text-start">@item.Cognome</td>
|
||||
<td class="text-start">@item.Nome</td>
|
||||
<td class="text-start">@item.Matricola</td>
|
||||
<td class="text-start">@item.CodOrario</td>
|
||||
<td class="text-start">@item.Dominio</td>
|
||||
<td class="text-start">@item.Utente</td>
|
||||
<td class="text-start">@item.Email</td>
|
||||
<td class="text-start">@item.Cf</td>
|
||||
<td class="text-start">@item.CodHw</td>
|
||||
<td class="text-start">@($"{item.LuogoNascita}") - @($"{item.ProvNascita}") - @($"{item.NazNascita}") - @($"{item.DataNascita:dd/MM/yyyy}")</td>
|
||||
<td class="text-start">@item.Gruppo</td>
|
||||
<td class="text-start">@($"{item.DataAssunzione:dd/MM/yyyy}") - @($"{item.DataCessazione:dd/MM/yyyy}")</td>
|
||||
<td class="text-end">
|
||||
<select @bind="@item.idxResp" class="form-select form-select-sm disabled" disabled style="min-width: 12rem;">
|
||||
<option value="0">--- Selezionare ---</option>
|
||||
@foreach (var dip in ListDipendentiOrd)
|
||||
{
|
||||
<option value="@dip.IdxDipendente">@($"{dip.Cognome} {dip.Nome}")</option>
|
||||
}
|
||||
</select>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
}
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<EgwCoreLib.Razor.DataPager PageSize="@numRecord" currPage="@currPage" numRecordChanged="SetNumRec" numPageChanged="SetPage" totalCount="@totalCount" showLoading="@isLoading"></EgwCoreLib.Razor.DataPager>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,568 @@
|
||||
using EgwCoreLib.Razor;
|
||||
using GPW.CORE.Data.DbModels;
|
||||
using GPW.CORE.Data.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using NLog;
|
||||
using System.Buffers;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GPW.CORE.ADM.Components.Compo
|
||||
{
|
||||
public partial class DipendentiMan : IDisposable
|
||||
{
|
||||
#region Public Methods
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
AppMServ.EA_SearchUpdated -= AppMServ_EA_SearchUpdated;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected int NumLicActLocal = 0;
|
||||
|
||||
protected int NumLicActOnline = 0;
|
||||
|
||||
protected int NumLicDispLocal = 0;
|
||||
|
||||
protected int NumLicDispOnline = 0;
|
||||
|
||||
protected int NumTicket = 0;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected MessageService AppMServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected GpwDataService GDataServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected LicenseService LicServ { get; set; } = null!;
|
||||
|
||||
protected List<DipendentiModel> ListDipendentiAttiviOrd
|
||||
{
|
||||
get => ListDipendenti != null ? ListDipendenti.Where(x => x.Attivo ?? false).OrderBy(x => x.Cognome).ThenBy(x => x.Nome).ToList() : new List<DipendentiModel>();
|
||||
}
|
||||
|
||||
protected List<DipendentiModel> ListDipendentiOrd
|
||||
{
|
||||
get => ListDipendenti != null ? ListDipendenti.OrderBy(x => x.Cognome).ThenBy(x => x.Nome).ToList() : new List<DipendentiModel>();
|
||||
}
|
||||
|
||||
protected string modalSize
|
||||
{
|
||||
get => CtrlMode == DipendentiEdit.EditMode.FullEdit ? "modal-xl" : "modal-lg";
|
||||
}
|
||||
|
||||
protected bool NeedAllocation
|
||||
{
|
||||
get => NumLicActOnline == NumLicActLocal && NumLicActOnline != NumLicActLocal;
|
||||
}
|
||||
|
||||
protected string TextQrLinkCore
|
||||
{
|
||||
get => ShowLinkCore ? "GPW Core" : "GPW Legacy";
|
||||
}
|
||||
|
||||
protected string TextQrLinkInt
|
||||
{
|
||||
get => ShowLinkInt ? "Link Interno" : "Link Esterno";
|
||||
}
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected string CheckSel(DipendentiModel curItem)
|
||||
{
|
||||
string answ = curItem.Attivo ?? false ? "" : "text-secondary striked";
|
||||
if (RecordEdit != null)
|
||||
{
|
||||
answ = curItem.Cf == RecordEdit.Cf ? "table-info" : "";
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
protected async Task CreateNew()
|
||||
{
|
||||
}
|
||||
|
||||
protected void DoEdit(DipendentiModel? selItem)
|
||||
{
|
||||
CtrlMode = DipendentiEdit.EditMode.FullEdit;
|
||||
RecordEdit = selItem;
|
||||
}
|
||||
protected void RequestReset(DipendentiModel? selItem)
|
||||
{
|
||||
CtrlMode = DipendentiEdit.EditMode.ResetRequest;
|
||||
RecordEdit = selItem;
|
||||
}
|
||||
|
||||
protected async Task DoFixMissing()
|
||||
{
|
||||
// procedo SOLO SE il numero online/offline è differente in primis...
|
||||
if (NeedAllocation)
|
||||
{
|
||||
// ciclo tutti gli utenti attivi
|
||||
// verifico SE sia disponibile licenza...
|
||||
var activationsList = LicServ.ActivList;
|
||||
Dictionary<string, string> CodList = new Dictionary<string, string>();
|
||||
|
||||
// ciclo x ogni dip attivo...
|
||||
foreach (var item in ListDipendentiAttiviOrd)
|
||||
{
|
||||
// calcolo codImpiego
|
||||
string currCodImp = LicServ.HashDip(item);
|
||||
// cerco se abbia attivazione
|
||||
var currActiv = activationsList.Where(x => x.CodImpiego == currCodImp).FirstOrDefault();
|
||||
if (currActiv == null || currActiv.CodImpiego != currCodImp)
|
||||
{
|
||||
CodList.Add(currCodImp, item.AuthKey);
|
||||
}
|
||||
}
|
||||
// provo attivazione in blocco
|
||||
await LicServ.TryActivationMult(CodList);
|
||||
// cmq faccio refresh
|
||||
await FullRefresh();
|
||||
// ricalcolo licenze
|
||||
await RefreshLicData(true);
|
||||
}
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected async Task DoRefresh()
|
||||
{
|
||||
isLoading = true;
|
||||
await LicServ.resetActivList();
|
||||
await FullRefresh();
|
||||
await ReloadData();
|
||||
// ricalcolo licenze
|
||||
await RefreshLicData(false);
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
protected void DoSelect(DipendentiModel currRec)
|
||||
{
|
||||
CtrlMode = DipendentiEdit.EditMode.KeyRegen;
|
||||
RecordEdit = currRec;
|
||||
}
|
||||
|
||||
protected async Task ForceReload()
|
||||
{
|
||||
currPage = 1;
|
||||
CtrlMode = DipendentiEdit.EditMode.None;
|
||||
RecordEdit = null;
|
||||
await ReloadData();
|
||||
// ricalcolo licenze
|
||||
await RefreshLicData(false);
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await ReloadConfData();
|
||||
await ReloadData();
|
||||
await RefreshLicData(true);
|
||||
AppMServ.EA_SearchUpdated += AppMServ_EA_SearchUpdated;
|
||||
}
|
||||
|
||||
protected async Task SetNumRec(int newNum)
|
||||
{
|
||||
numRecord = newNum;
|
||||
currPage = 1;
|
||||
await AppMServ.NumRowGridSet(gridKey, newNum);
|
||||
await InvokeAsync(ReloadData);
|
||||
}
|
||||
|
||||
protected async Task SetPage(int newNum)
|
||||
{
|
||||
currPage = newNum;
|
||||
await InvokeAsync(ReloadData);
|
||||
}
|
||||
|
||||
protected async Task SortRequested(Sorter.SortCallBack e)
|
||||
{
|
||||
sortField = e.ParamName;
|
||||
sortAsc = e.IsAscending;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
private int currPage = 1;
|
||||
|
||||
private DipendentiEdit.EditMode CtrlMode = DipendentiEdit.EditMode.None;
|
||||
|
||||
private string gridKey = "DipendentiMan";
|
||||
|
||||
private bool isLoading = false;
|
||||
|
||||
private int numRecord = 10;
|
||||
|
||||
private DipendentiModel? RecordEdit = null;
|
||||
|
||||
private string searchVal = "";
|
||||
|
||||
private bool ShowInatt = false;
|
||||
|
||||
private bool ShowLinkCore = true;
|
||||
|
||||
private bool ShowLinkInt = true;
|
||||
|
||||
private bool ShowQrCode = false;
|
||||
|
||||
private bool sortAsc = true;
|
||||
|
||||
private string sortField = "";
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private List<DipendentiModel>? ListDipendenti { get; set; } = null;
|
||||
|
||||
private List<AnagOrariModel> ListOrari { get; set; } = null!;
|
||||
|
||||
private List<DipendentiModel>? ListRecords { get; set; } = null;
|
||||
|
||||
private List<DipendentiModel>? SearchRecords { get; set; } = null;
|
||||
|
||||
private int totalCount { get; set; } = 0;
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private void AppMServ_EA_SearchUpdated()
|
||||
{
|
||||
ReloadData().ConfigureAwait(false);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Verifica licenza (se sia libera x modifica o prima associazione)
|
||||
/// </summary>
|
||||
/// <param name="IdxDip"></param>
|
||||
/// <returns></returns>
|
||||
public bool CheckFreeEdit(int IdxDip)
|
||||
{
|
||||
bool answ = false;
|
||||
if (IdxDip > 0)
|
||||
{
|
||||
// cerco!
|
||||
var currUser = ListDipendentiAttiviOrd.Where(x => x.IdxDipendente == IdxDip).FirstOrDefault();
|
||||
if (currUser != null)
|
||||
{
|
||||
// verifico SE sia disponibile licenza...
|
||||
var activationsList = LicServ.ActivList;
|
||||
var currHash = LicServ.HashDip(currUser);
|
||||
var currAct = activationsList.Where(x => x.CodImpiego == currHash).FirstOrDefault();
|
||||
// se NON c'è licenza è ok (editabile)
|
||||
answ = (currAct == null);
|
||||
// ora verifico: se NON ha licenza OK, altrimenti deve essere scaduta...
|
||||
if (!answ)
|
||||
{
|
||||
answ = currAct.VetoUnlock <= DateTime.Today;
|
||||
}
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// Rilascia licenza e rilegge conf
|
||||
/// </summary>
|
||||
/// <param name="CurrRecord"></param>
|
||||
/// <returns></returns>
|
||||
private async Task ReleaseLicense(DipendentiModel CurrRecord)
|
||||
{
|
||||
// verifica SE ci sono licenze disponibili
|
||||
if (NumLicDispOnline > NumLicActOnline)
|
||||
{
|
||||
// chiamo rimozione licenza
|
||||
var CodImpiego = LicServ.HashDip(CurrRecord);
|
||||
bool fatto = await LicServ.TryRemoveActivation(CodImpiego, CurrRecord.AuthKey);
|
||||
if (fatto)
|
||||
{
|
||||
// disattiva utente
|
||||
GDataServ.DipUpdateActive(CurrRecord.IdxDipendente, false);
|
||||
}
|
||||
LicServ.ResetLicenseData();
|
||||
}
|
||||
// disattivo record mostrato...
|
||||
RecordEdit = null;
|
||||
// ricarico
|
||||
await ReloadData();
|
||||
// ricalcolo licenze
|
||||
await RefreshLicData(true);
|
||||
}
|
||||
|
||||
private async Task DoActivate(DipendentiModel CurrRecord)
|
||||
{
|
||||
// verifica SE ci sono licenze disponibili
|
||||
if (NumLicDispOnline > NumLicActOnline)
|
||||
{
|
||||
// attiva utente
|
||||
GDataServ.DipUpdateActive(CurrRecord.IdxDipendente, true);
|
||||
|
||||
string CodImpiego = LicServ.HashDip(CurrRecord);
|
||||
|
||||
// effettua riassegnazione
|
||||
bool fatto = LicServ.TryActivation(CodImpiego, CurrRecord.AuthKey);
|
||||
}
|
||||
await ReloadData();
|
||||
// ricalcolo licenze
|
||||
await RefreshLicData(true);
|
||||
}
|
||||
|
||||
private async Task FullRefresh()
|
||||
{
|
||||
LicServ.ResetLicenseData();
|
||||
// eseguo call di recupero da online
|
||||
bool refreshApp = await LicServ.RefreshApplic();
|
||||
bool refreshAct = await LicServ.RefreshLicense();
|
||||
bool refreshPay = LicServ.RefreshPayload();
|
||||
// chiama update di TUTTE le authKey verso il server online
|
||||
int numLoc = 0;
|
||||
foreach (var item in ListDipendentiAttiviOrd)
|
||||
{
|
||||
var CodImpiego = LicServ.HashDip(item);
|
||||
bool fatto = await LicServ.TryRefreshActivation(CodImpiego, item.AuthKey);
|
||||
if (fatto)
|
||||
numLoc++;
|
||||
}
|
||||
Log.Trace($"NumLoc: {numLoc}");
|
||||
}
|
||||
|
||||
private async Task RefreshLicData(bool forceReload)
|
||||
{
|
||||
if (!LicServ.HasAppData || forceReload)
|
||||
{
|
||||
await FullRefresh();
|
||||
}
|
||||
NumLicDispLocal = LicServ.NumLicDb;
|
||||
NumLicActLocal = LicServ.ActivList.Count();
|
||||
NumLicDispOnline = LicServ.AppLicense.NumLicenze;
|
||||
NumLicActOnline = LicServ.AppLicense.NumLicenzeAttive;
|
||||
}
|
||||
|
||||
private async Task ReloadConfData()
|
||||
{
|
||||
ListOrari = await GDataServ.AnagOrarioAll();
|
||||
}
|
||||
|
||||
private async Task ReloadData()
|
||||
{
|
||||
isLoading = true;
|
||||
ListRecords = null;
|
||||
ListDipendenti = await GDataServ.DipendentiGetAll();
|
||||
if (ShowInatt)
|
||||
{
|
||||
SearchRecords = ListDipendenti;
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = ListDipendenti.Where(x => (x.Attivo ?? false)).ToList();
|
||||
}
|
||||
|
||||
// eseguo filtro ricerca
|
||||
try
|
||||
{
|
||||
if (!string.IsNullOrEmpty(searchVal))
|
||||
{
|
||||
SearchRecords = SearchRecords
|
||||
.Where(x => x.Cognome.Contains(searchVal) || x.Nome.Contains(searchVal) || x.Cf.Contains(searchVal) || x.Email.Contains(searchVal))
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error($"Eccezione in recupero dati{Environment.NewLine}{ex}");
|
||||
}
|
||||
totalCount = SearchRecords.Count;
|
||||
SortTable();
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sorting e paging tabella
|
||||
/// </summary>
|
||||
private void SortTable()
|
||||
{
|
||||
if (SearchRecords != null)
|
||||
{
|
||||
// se ho ordinamento riordino...
|
||||
if (!string.IsNullOrEmpty(sortField))
|
||||
{
|
||||
switch (sortField)
|
||||
{
|
||||
case "Cognome":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.Cognome).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.Cognome).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "Nome":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.Nome).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.Nome).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "Matricola":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.Matricola).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.Matricola).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "Profilo":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.CodOrario).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.CodOrario).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "Dominio":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.Dominio).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.Dominio).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "Utente":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.Utente).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.Utente).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "Email":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.Email).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.Email).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "CF":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.Cf).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.Cf).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "CodeHw":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.CodHw).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.CodHw).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "DatiAnag":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.LuogoNascita).ThenBy(x => x.ProvNascita).ThenBy(x => x.NazNascita).ThenBy(x => x.DataNascita).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.LuogoNascita).ThenBy(x => x.ProvNascita).ThenBy(x => x.NazNascita).ThenBy(x => x.DataNascita).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "Gruppo":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.Gruppo).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.Gruppo).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "StatoLic":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.DataAssunzione).ThenBy(x => x.DataCessazione).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.DataAssunzione).ThenBy(x => x.DataCessazione).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "Responsabile":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.idxResp).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.idxResp).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// filtro x display
|
||||
ListRecords = SearchRecords
|
||||
.Skip(numRecord * (currPage - 1))
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
ListRecords = new List<DipendentiModel>();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
<div class="row g-1">
|
||||
<div class="col-md-3">
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" @bind="@CurrRecord.NomeFase">
|
||||
<label class="small">Nome</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="form-floating">
|
||||
<div class="form-control">
|
||||
<select @bind="@CurrRecord.CodTagFase" class="form-select form-select-sm" title="Tag">
|
||||
<option value="">--- Selezionare ---</option>
|
||||
@foreach (var item in ListTagFasi)
|
||||
{
|
||||
<option value="@item.CodTagFase">@($"[{item.CodTagFase}] {item.Descrizione}")</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
<label class="small">Tag</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
<div class="form-floating">
|
||||
<div class="form-control">
|
||||
<div class="form-check form-switch">
|
||||
<input type="checkbox" class="form-check-input" @bind="@CurrRecord.EnableTime">
|
||||
</div>
|
||||
</div>
|
||||
<label class="small">Time</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
<div class="form-floating">
|
||||
<div class="form-control">
|
||||
<div class="form-check form-switch">
|
||||
<input type="checkbox" class="form-check-input" @bind="@CurrRecord.EnableMoney">
|
||||
</div>
|
||||
</div>
|
||||
<label class="small">Money</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="form-floating">
|
||||
@if (CurrRecord.IdxFaseAncest == 0)
|
||||
{
|
||||
<input type="number" class="form-control" @bind="@CurrRecord.BudgetTime" disabled>
|
||||
}
|
||||
else
|
||||
{
|
||||
<input type="number" class="form-control" @bind="@CurrRecord.BudgetTime">
|
||||
}
|
||||
<label class="small">Ore Bdgt</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="form-floating">
|
||||
@if (CurrRecord.IdxFaseAncest == 0)
|
||||
{
|
||||
<input type="number" min="0" max="100" step="0.1" class="form-control" @bind="@CurrRecord.PercOpenCent">
|
||||
}
|
||||
else
|
||||
{
|
||||
<input type="number" class="form-control" @bind="@CurrRecord.PercOpenCent" disabled>
|
||||
}
|
||||
<label class="small">% abil</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
<div class="form-floating">
|
||||
<div class="form-control">
|
||||
<div class="form-check form-switch">
|
||||
<input type="checkbox" class="form-check-input" @bind="@CurrRecord.Attivo">
|
||||
</div>
|
||||
</div>
|
||||
<label class="small">Attivo</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row g-1">
|
||||
<div class="col-md-10">
|
||||
<div class="form-floating">
|
||||
<textarea class="form-control" @bind="@CurrRecord.DescrizioneFase" rows="2" style="height: 9rem;"></textarea>
|
||||
<label class="small">Descr</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2 pt-2 d-flex align-items-center">
|
||||
<div class="w-100">
|
||||
<button class="btn btn-success my-1 w-100" @onclick="() => DoSave()"><i class="fas fa-floppy-disk"></i> Save</button>
|
||||
<button class="btn btn-warning my-1 w-100" @onclick="() => DoCancel()"><i class="fas fa-ban"></i> Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
using GPW.CORE.Data.DbModels;
|
||||
using GPW.CORE.Data.DTO;
|
||||
using GPW.CORE.Data.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace GPW.CORE.ADM.Components.Compo
|
||||
{
|
||||
public partial class FasiEdit
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public AnagFasiModel? CurrRecord { get; set; } = null;
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<bool> EC_update { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public List<TagFasiDTO> ListTagFasi { get; set; } = null!;
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected GpwDataService GDataServ { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected async Task DoCancel()
|
||||
{
|
||||
await EC_update.InvokeAsync(true);
|
||||
}
|
||||
|
||||
protected async Task DoSave()
|
||||
{
|
||||
bool fatto = false;
|
||||
await Task.Delay(1);
|
||||
if (CurrRecord != null)
|
||||
{
|
||||
fatto = await GDataServ.AnagFasiUpsert(CurrRecord);
|
||||
// se fatto ricalcolo...
|
||||
if (fatto)
|
||||
{
|
||||
await GDataServ.AnagProjForceUpdate();
|
||||
}
|
||||
}
|
||||
await EC_update.InvokeAsync(fatto);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,227 @@
|
||||
@if (RecordEdit != null)
|
||||
{
|
||||
<div class="modal fade show" tabindex="-1" style="display:block; background-color: rgba(10,10,10,.6);" aria-modal="true" role="dialog" data-keyboard="true">
|
||||
<div class="modal-dialog modal-xl">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title">Modifica Fase <b>@RecordEdit.IdxFase</b></h4>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close" @onclick=ForceReload></button>
|
||||
</div>
|
||||
<div class="modal-body p-1">
|
||||
<FasiEdit CurrRecord=@RecordEdit EC_update=ForceReload ListTagFasi=@ListTagFasi></FasiEdit>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
<div class="card">
|
||||
<div class="card-header @HeadCss">
|
||||
<div class="d-flex justify-content-between">
|
||||
@if (CanSelProj)
|
||||
{
|
||||
@if (!string.IsNullOrEmpty(Title))
|
||||
{
|
||||
<div class="ps-0 pe-2">
|
||||
<h4>@Title</h4>
|
||||
</div>
|
||||
}
|
||||
<div class="px-0">
|
||||
<div class="px-0 d-flex">
|
||||
<div class="px-0">
|
||||
<div class="input-group">
|
||||
<span class="input-group-text" title="Cliente">C</span>
|
||||
<select @bind="@IdxCli" class="form-select form-select-sm" title="Cliente" @bind:after=SaveCli>
|
||||
<option value="0">--- Selezionare ---</option>
|
||||
@foreach (var item in ListClientiFilt)
|
||||
{
|
||||
<option value="@item.IdxCliente">@($"{item.RagSociale}")</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="px-0">
|
||||
|
||||
<div class="input-group">
|
||||
<span class="input-group-text" title="Progetto">P</span>
|
||||
<select @bind="@IdxPrj" class="form-select form-select-sm" title="Progetto" @bind:after=SaveProj>
|
||||
<option value="0">--- Selezionare ---</option>
|
||||
@foreach (var item in ListProgettiFilt)
|
||||
{
|
||||
<option value="@item.IdxProgetto">@($"{item.NomeProj} | {item.DescrProj}")</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="px-0">
|
||||
<h4>Dettaglio Fasi</h4>
|
||||
</div>
|
||||
<div class="px-0">
|
||||
<div class="input-group">
|
||||
<span class="input-group-text">Tag</span>
|
||||
<select @bind="@NewCodTagFase" class="form-select form-select-sm" title="Tag">
|
||||
<option value="">--- Selezionare ---</option>
|
||||
@foreach (var item in ListTagFasi)
|
||||
{
|
||||
<option value="@item.CodTagFase">@($"[{item.CodTagFase}] {item.Descrizione}")</option>
|
||||
}
|
||||
</select>
|
||||
<button class="btn btn-danger text-nowrap" @onclick=DoMassTagUpd>
|
||||
<i class="fa-solid fa-circle-left"></i> Force SET All
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body p-1">
|
||||
@if (ListRecords == null || isLoading)
|
||||
{
|
||||
<EgwCoreLib.Razor.LoadingData></EgwCoreLib.Razor.LoadingData>
|
||||
}
|
||||
else if (totalCount == 0)
|
||||
{
|
||||
<div class="alert alert-info">Nessun record trovato</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<table class="table table-striped table-sm text-start small">
|
||||
<thead>
|
||||
<tr class="">
|
||||
<th>
|
||||
<button class="btn btn-primary btn-sm" @onclick="ForceReload"><i class="fa-solid fa-rotate"></i></button>
|
||||
</th>
|
||||
<th>Nome</th>
|
||||
<th>Etichetta Fase</th>
|
||||
<th>TT</th>
|
||||
<th>MT</th>
|
||||
<th>Ore/Budget</th>
|
||||
<th>% Abil</th>
|
||||
<th>Attivo</th>
|
||||
@if (!CanSelProj)
|
||||
{
|
||||
<th class="text-end">
|
||||
@if (ChkLicOk)
|
||||
{
|
||||
<button class="btn btn-success btn-sm" @onclick="() => AddFase(0)"><i class="fa-solid fa-plus"></i> Nuova Fase</button>
|
||||
}
|
||||
</th>
|
||||
<th class="text-end" style="width: 3rem;"></th>
|
||||
}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in ListRecords)
|
||||
{
|
||||
<tr class="align-middle @CheckSel(item)">
|
||||
<td>
|
||||
@if (ShowSelect)
|
||||
{
|
||||
<button class="btn btn-info btn-sm" @onclick="() => DoSelect(item)"><i class="fa-solid fa-search"></i></button>
|
||||
}
|
||||
@if (RecordSel == null)
|
||||
{
|
||||
@if (!CanSelProj)
|
||||
{
|
||||
<button class="btn btn-primary btn-sm" @onclick="() => DoEdit(item)"><i class="fa-solid fa-edit"></i></button>
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@if (!CanSelProj)
|
||||
{
|
||||
<button class="btn btn-secondary btn-sm" disabled><i class="fa-solid fa-edit"></i></button>
|
||||
}
|
||||
}
|
||||
</td>
|
||||
<td>
|
||||
<div class="d-flex">
|
||||
@if (item.IdxFaseAncest > 0)
|
||||
{
|
||||
<div class="px-2"><i class="fa-solid fa-ellipsis-vertical"></i></div>
|
||||
}
|
||||
<div class="px-2">
|
||||
<b>@item.NomeFase</b>
|
||||
<div class="small">@item.DescrizioneFase</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
@if (item.IdxFaseAncest > 0)
|
||||
{
|
||||
<select @bind="@item.CodTagFase" class="form-select form-select-sm" title="Cliente" disabled style="width: 12rem;">
|
||||
<option value="0">--- Selezionare ---</option>
|
||||
@foreach (var iTag in ListTagFasi)
|
||||
{
|
||||
<option value="@iTag.CodTagFase">@($"[{iTag.CodTagFase}] {iTag.Descrizione}")</option>
|
||||
}
|
||||
</select>
|
||||
}
|
||||
</td>
|
||||
<td class="fs-4">
|
||||
@if (item.EnableTime)
|
||||
{
|
||||
<i class="fa-solid fa-stopwatch text-primary"></i>
|
||||
}
|
||||
else
|
||||
{
|
||||
<i class="fa-solid fa-stopwatch text-secondary opacity-50"></i>
|
||||
}
|
||||
</td>
|
||||
<td>
|
||||
@if (item.EnableMoney)
|
||||
{
|
||||
<i class="fa-solid fa-money-bills text-primary"></i>
|
||||
}
|
||||
else
|
||||
{
|
||||
<i class="fa-solid fa-money-bills text-secondary opacity-50"></i>
|
||||
}
|
||||
</td>
|
||||
<td>
|
||||
@if (item.BudgetTime > 0)
|
||||
{
|
||||
<div class="text-center py-1 @ColorByVal(item.TotOre, item.BudgetTime)">
|
||||
<b>@($"{item.TotOre:N2}")</b> / @($"{item.BudgetTime:N0}")
|
||||
</div>
|
||||
}
|
||||
</td>
|
||||
<td>
|
||||
@if (item.IdxFaseAncest == 0)
|
||||
{
|
||||
@($"{item.PercOpen:P0}")
|
||||
}
|
||||
</td>
|
||||
<td>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" disabled type="checkbox" @bind="@item.Attivo">
|
||||
</div>
|
||||
</td>
|
||||
@if (!CanSelProj)
|
||||
{
|
||||
<td class="text-end">
|
||||
@if (item.IdxFaseAncest == 0 && EnableAddFasi && ChkLicOk)
|
||||
{
|
||||
<button class="btn btn-primary btn-sm" @onclick="() => AddFase(item.IdxFase)"><i class="fa-solid fa-plus"></i> Nuova Sottofase</button>
|
||||
}
|
||||
</td>
|
||||
<td class="text-end">
|
||||
@if (DelEnabled(item.TotOre, item.IdxFase, item.IdxFaseAncest) && ChkLicOk)
|
||||
{
|
||||
<button class="btn btn-danger btn-sm" @onclick="() => DoDelete(item)"><i class="fa-solid fa-trash"></i></button>
|
||||
}
|
||||
</td>
|
||||
}
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -0,0 +1,409 @@
|
||||
using GPW.CORE.Data.DbModels;
|
||||
using GPW.CORE.Data.DTO;
|
||||
using GPW.CORE.Data.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.DataProtection;
|
||||
using Microsoft.JSInterop;
|
||||
using NLog.Targets.Wrappers;
|
||||
|
||||
namespace GPW.CORE.ADM.Components.Compo
|
||||
{
|
||||
public partial class FasiMan
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public bool CanSelProj { get; set; } = false;
|
||||
|
||||
[Parameter]
|
||||
public bool ChkLicOk { get; set; } = true;
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<AnagFasiExplModel> EC_FaseSel { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<int> EC_ProjSel { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<bool> EC_update { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public bool EnableAddFasi { get; set; } = true;
|
||||
|
||||
[Parameter]
|
||||
public string HeadCss { get; set; } = "";
|
||||
|
||||
[Parameter]
|
||||
public List<AnagFasiExplModel>? ListRecords
|
||||
{
|
||||
get => listRecords;
|
||||
set => listRecords = value;
|
||||
}
|
||||
|
||||
[Parameter]
|
||||
public bool ShowOnlyActive { get; set; } = true;
|
||||
|
||||
[Parameter]
|
||||
public bool ShowSelect { get; set; } = true;
|
||||
|
||||
[Parameter]
|
||||
public string Title { get; set; } = "";
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected MessageService AppMServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected GpwDataService GDataServ { get; set; } = null!;
|
||||
|
||||
protected int IdxCli
|
||||
{
|
||||
get => idxCli;
|
||||
set
|
||||
{
|
||||
if (idxCli != value)
|
||||
{
|
||||
idxCli = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected int IdxPrj
|
||||
{
|
||||
get => idxPrj;
|
||||
set
|
||||
{
|
||||
if (idxPrj != value)
|
||||
{
|
||||
idxPrj = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; } = null!;
|
||||
|
||||
protected List<AnagClientiModel> ListClientiFilt
|
||||
{
|
||||
get
|
||||
{
|
||||
List<AnagClientiModel> answ = new List<AnagClientiModel>();
|
||||
if (ShowOnlyActive)
|
||||
{
|
||||
answ = ListClienti.Where(x => x.Attivo).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
answ = ListClienti;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
protected List<AnagProgettiModel> ListProgettiFilt
|
||||
{
|
||||
get
|
||||
{
|
||||
List<AnagProgettiModel> answ = new List<AnagProgettiModel>();
|
||||
if (IdxCli > 0)
|
||||
{
|
||||
ListProgetti = GDataServ.AnagProjByCli(IdxCli);
|
||||
answ = ListProgetti.Where(x => (x.Attivo ?? false) || !ShowOnlyActive).ToList();
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
/// <summary>
|
||||
/// Aggiunta nuova fase/sottofase (se idxFaseAnc > 0)
|
||||
/// </summary>
|
||||
/// <param name="idxFaseAnc"></param>
|
||||
/// <returns></returns>
|
||||
protected async Task AddFase(int idxFaseAnc)
|
||||
{
|
||||
int idxProj = 0;
|
||||
if (ListRecords != null && ListRecords.Count > 0)
|
||||
{
|
||||
idxProj = ListRecords.FirstOrDefault().IdxProgetto ?? 0;
|
||||
}
|
||||
if (idxProj > 0)
|
||||
{
|
||||
// creo nuovo record...
|
||||
var newRec = new AnagFasiModel()
|
||||
{
|
||||
IdxProgetto = idxProj,
|
||||
IdxFaseAncest = idxFaseAnc,
|
||||
NomeFase = "__Nuova Fase",
|
||||
DescrizioneFase = "Descrizione Fase"
|
||||
};
|
||||
// eseguo aggiunta nuovo record...
|
||||
bool fatto = await GDataServ.AnagFasiUpsert(newRec);
|
||||
if (fatto)
|
||||
{
|
||||
await EC_update.InvokeAsync(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected string CheckSel(AnagFasiExplModel curItem)
|
||||
{
|
||||
string answ = "";
|
||||
if (RecordSel != null)
|
||||
{
|
||||
answ = curItem.IdxFase == RecordSel.IdxFase ? "table-info" : "";
|
||||
}
|
||||
// verifico stato attivo
|
||||
answ += !curItem.Attivo ? " striked" : "";
|
||||
return answ;
|
||||
}
|
||||
|
||||
protected async Task DoDelete(AnagFasiExplModel? selItem)
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sicuro di voler forzare il ricalcolo dei record?"))
|
||||
return;
|
||||
|
||||
if (selItem != null)
|
||||
{
|
||||
bool fatto = await GDataServ.AnagFasiDelete(selItem.IdxFase);
|
||||
if (fatto)
|
||||
{
|
||||
await EC_update.InvokeAsync(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected async Task DoEdit(AnagFasiExplModel? selItem)
|
||||
{
|
||||
RecordSel = null;
|
||||
if (selItem != null)
|
||||
{
|
||||
RecordEdit = await GDataServ.AnagFasiByKey(selItem.IdxFase);
|
||||
}
|
||||
else
|
||||
{
|
||||
RecordEdit = null;
|
||||
}
|
||||
}
|
||||
|
||||
protected async Task DoMassTagUpd()
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sicuro di voler forzare il tag per tutte le fasi?"))
|
||||
return;
|
||||
|
||||
int idxProj = 0;
|
||||
if (ListRecords != null && ListRecords.Count > 0)
|
||||
{
|
||||
idxProj = ListRecords.FirstOrDefault().IdxProgetto ?? 0;
|
||||
if (idxProj > 0)
|
||||
{
|
||||
bool fatto = await GDataServ.AnagFasiForceTag(idxProj, NewCodTagFase);
|
||||
if (fatto)
|
||||
{
|
||||
await EC_update.InvokeAsync(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected async Task DoSelect(AnagFasiExplModel? selItem)
|
||||
{
|
||||
RecordSel = selItem;
|
||||
RecordEdit = null;
|
||||
await EC_FaseSel.InvokeAsync(selItem);
|
||||
}
|
||||
|
||||
protected async Task ForceReload()
|
||||
{
|
||||
RecordEdit = null;
|
||||
RecordSel = null;
|
||||
await EC_FaseSel.InvokeAsync(null);
|
||||
await EC_update.InvokeAsync(true);
|
||||
await Task.Delay(1);
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// init valori da config
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected void InitConf()
|
||||
{
|
||||
// leggo conf standard controllo RegAtt
|
||||
var sWarningRatioPerc = GDataServ.ConfigGetKey("WarningRatioPerc");
|
||||
if (sWarningRatioPerc != null)
|
||||
{
|
||||
double.TryParse(sWarningRatioPerc.valore, out warnRatio);
|
||||
}
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
InitConf();
|
||||
await ReloadSel();
|
||||
ReloadAnagBase();
|
||||
}
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tentativo rilettura selezione se possibile..
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected async Task ReloadSel()
|
||||
{
|
||||
// verifico di essere in modalità con selezione permessa x preselezione
|
||||
if (CanSelProj)
|
||||
{
|
||||
IdxCli = await AppMServ.UserPrefGet<int>($"FasiMan_{Title}_idxCli");
|
||||
IdxPrj = await AppMServ.UserPrefGet<int>($"FasiMan_{Title}_idxPrj");
|
||||
await EC_ProjSel.InvokeAsync(IdxPrj);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private int idxCli = 0;
|
||||
|
||||
private int idxPrj = 0;
|
||||
|
||||
private AnagFasiModel? RecordEdit = null;
|
||||
|
||||
private AnagFasiExplModel? RecordSel = null;
|
||||
|
||||
private double warnRatio = 50;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private bool isLoading { get; set; } = false;
|
||||
|
||||
private List<AnagClientiModel> ListClienti { get; set; } = new List<AnagClientiModel>();
|
||||
|
||||
private List<AnagProgettiModel> ListProgetti { get; set; } = new List<AnagProgettiModel>();
|
||||
|
||||
private List<AnagFasiExplModel>? listRecords { get; set; } = new List<AnagFasiExplModel>();
|
||||
|
||||
private List<TagFasiDTO> ListTagFasi { get; set; } = new List<TagFasiDTO>();
|
||||
|
||||
private string NewCodTagFase { get; set; } = "ND";
|
||||
|
||||
private int totalCount { get; set; } = 0;
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// restituisce una classe css a seconda dei valori passati:
|
||||
/// green: bdgt > real
|
||||
/// orange: real > bdgt*warning
|
||||
/// red: real > bdgt
|
||||
/// std: errore...
|
||||
/// </summary>
|
||||
/// <param name="real"></param>
|
||||
/// <param name="bdgt"></param>
|
||||
/// <returns></returns>
|
||||
private string ColorByVal(object real, object bdgt)
|
||||
{
|
||||
string specClass = "default";
|
||||
try
|
||||
{
|
||||
double valoreReal = Convert.ToDouble(real);
|
||||
double valoreBdget = Convert.ToDouble(bdgt);
|
||||
double valoreWarn = Convert.ToDouble(bdgt) * warnRatio / 100;
|
||||
if (valoreReal >= valoreBdget)
|
||||
{
|
||||
specClass = "danger";
|
||||
}
|
||||
else if (valoreReal >= valoreWarn)
|
||||
{
|
||||
specClass = "warning";
|
||||
}
|
||||
else
|
||||
{
|
||||
specClass = "success";
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return $" bg-{specClass} bg-opacity-50 bg-gradient border border-{specClass} rounded";
|
||||
}
|
||||
|
||||
private bool DelEnabled(decimal TotOre, int idxFase, int idxFaseAnc)
|
||||
{
|
||||
// se ha ore NON è eliminabile...
|
||||
bool answ = TotOre == 0;
|
||||
// se zero ore --> deve esere child oppure ancestor senza fasi...
|
||||
if (answ)
|
||||
{
|
||||
// se ancestor
|
||||
if (idxFaseAnc == 0)
|
||||
{
|
||||
// cerco fasi dato ancestor...
|
||||
var listChild = GDataServ.AnagFasiByAncestor(idxFase);
|
||||
// solo se NON ha fasi child
|
||||
answ = listChild == null || listChild.Count == 0;
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
private void ReloadAnagBase()
|
||||
{
|
||||
ListTagFasi = GDataServ.AnagTagFasiAll();
|
||||
ListClienti = GDataServ.AnagClientiAll();
|
||||
}
|
||||
|
||||
private async Task ReloadData()
|
||||
{
|
||||
if (CanSelProj)
|
||||
{
|
||||
listRecords = new List<AnagFasiExplModel>();
|
||||
ListProgetti = new List<AnagProgettiModel>();
|
||||
// se abilitato x rilettura locale --> leggo fasi!
|
||||
if (CanSelProj && IdxCli > 0 && IdxPrj > 0)
|
||||
{
|
||||
listRecords = await GDataServ.AnagFasiExplByProj(IdxPrj);
|
||||
}
|
||||
}
|
||||
totalCount = listRecords.Count;
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
private async Task SaveCli()
|
||||
{
|
||||
IdxPrj = 0;
|
||||
await ReloadData();
|
||||
await EC_ProjSel.InvokeAsync(IdxPrj);
|
||||
await SaveSelection();
|
||||
}
|
||||
|
||||
private async Task SaveProj()
|
||||
{
|
||||
await ReloadData();
|
||||
await EC_ProjSel.InvokeAsync(IdxPrj);
|
||||
await SaveSelection();
|
||||
}
|
||||
|
||||
private async Task SaveSelection()
|
||||
{
|
||||
await AppMServ.UserPrefSet($"FasiMan_{Title}_idxCli", $"{IdxCli}");
|
||||
await AppMServ.UserPrefSet($"FasiMan_{Title}_idxPrj", $"{IdxPrj}");
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
<div class="card shadow">
|
||||
<div class="card-header">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-0">
|
||||
<h5>Giustificativi</h5>
|
||||
</div>
|
||||
<div class="px-0">
|
||||
@if (ListRecord == null || ListRecord.Count == 0)
|
||||
{
|
||||
<button class="btn btn-sm btn-success" @onclick="DoAddNew"><i class="fa-solid fa-plus"></i> Add New</button>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body py-0 px-2">
|
||||
@if (ListRecord == null || ListRecord.Count == 0)
|
||||
{
|
||||
<div class="alert alert-info py-1 px-2 my-1 mx-0">
|
||||
<div class="d-flex justify-content-between">
|
||||
Nessun record trovato
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<table class="table table-sm table-striped table-responsive-md">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th><i class="fa-solid fa-stopwatch"></i></th>
|
||||
<th title="Giust">Cod.Giust.</th>
|
||||
<th>Min:</th>
|
||||
<th class="text-end">
|
||||
<button class="btn btn-sm btn-success" @onclick="DoAddNew"><i class="fa-solid fa-plus"></i> Add New</button>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@if (SelRecord != null)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
<button class="btn btn-success btn-sm" @onclick="DoSave" title="Save"><i class="fa-solid fa-floppy-disk"></i></button>
|
||||
</td>
|
||||
<td class="small">@($"{SelRecord.DataLav:yyyy.MM.dd}")</td>
|
||||
<td class="text-center">
|
||||
<select @bind="@SelRecord.CodGiust" class="form-select">
|
||||
<option value="">--- Selezionare Causale ---</option>
|
||||
@if (ListGiust != null)
|
||||
{
|
||||
@foreach (var giust in ListGiust)
|
||||
{
|
||||
<option value="@giust.codGiust">@giust.descrizione</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</td>
|
||||
<td title="Uscita" class="text-center">
|
||||
<input type="number" class="form-control" @bind="@SelRecord.Minuti" />
|
||||
</td>
|
||||
<td class="text-end">
|
||||
<button class="btn btn-sm btn-warning" @onclick="DoCancel" title="Cancel"><i class="fas fa-ban"></i></button>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
else
|
||||
{
|
||||
@foreach (var item in ListRecord)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
<button class="btn btn-primary btn-sm" @onclick="() => DoEdit(item)"><i class="fa-solid fa-edit"></i></button>
|
||||
</td>
|
||||
<td class="small">@($"{item.DataLav:yyyy.MM.dd}")</td>
|
||||
<td class="text-center">
|
||||
@item.CodGiust
|
||||
</td>
|
||||
<td title="Uscita" class="text-center">
|
||||
@item.Minuti
|
||||
</td>
|
||||
<td class="text-end">
|
||||
@if (EnableDelete)
|
||||
{
|
||||
<button class="btn btn-sm btn-danger" @onclick="() => DoDelete(item)" title="Elimina Timbratura"><i class="fas fa-trash-alt"></i></button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="btn btn-sm btn-secondary" disabled><i class="fas fa-trash-alt"></i></button>
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,139 @@
|
||||
using GPW.CORE.Data.DbModels;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace GPW.CORE.ADM.Components.Compo
|
||||
{
|
||||
public partial class GiustList
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<string> EC_ReqAddNew { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<bool> EC_ReqCancel { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<GiustificativiModel> EC_ReqDelete { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<GiustSet> EC_ReqUpdate { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public bool EnableDelete { get; set; } = false;
|
||||
|
||||
[Parameter]
|
||||
public bool EnableEdit { get; set; } = false;
|
||||
|
||||
[Parameter]
|
||||
public List<AnagGiustModel>? ListGiust { get; set; } = null;
|
||||
|
||||
[Parameter]
|
||||
public List<GiustificativiModel>? ListRecord
|
||||
{
|
||||
get => listTimb;
|
||||
|
||||
set => listTimb = value;
|
||||
}
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Structs
|
||||
|
||||
public struct GiustSet
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public GiustificativiModel NewRec { get; set; }
|
||||
public GiustificativiModel OldRec { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
#endregion Public Structs
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected List<GiustificativiModel>? listTimb
|
||||
{
|
||||
get
|
||||
{
|
||||
return _ListTimb;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value != null)
|
||||
{
|
||||
_ListTimb = value.OrderByDescending(x => x.DataLav).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
_ListTimb = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected async Task DoAddNew()
|
||||
{
|
||||
await EC_ReqAddNew.InvokeAsync("PERM");
|
||||
}
|
||||
|
||||
protected async void DoCancel()
|
||||
{
|
||||
await EC_ReqCancel.InvokeAsync(true);
|
||||
}
|
||||
|
||||
protected async void DoDelete(GiustificativiModel currRecord)
|
||||
{
|
||||
await EC_ReqDelete.InvokeAsync(currRecord);
|
||||
}
|
||||
|
||||
protected void DoEdit(GiustificativiModel SelRec)
|
||||
{
|
||||
SelRecord = SelRec;
|
||||
OldRecord = new GiustificativiModel()
|
||||
{
|
||||
Automatico = SelRec.Automatico,
|
||||
CodGiust = SelRec.CodGiust,
|
||||
DataLav = SelRec.DataLav,
|
||||
IdxDipendente = SelRec.IdxDipendente,
|
||||
Minuti = SelRec.Minuti
|
||||
};
|
||||
}
|
||||
|
||||
protected async void DoSave()
|
||||
{
|
||||
if (OldRecord != null && SelRecord != null)
|
||||
{
|
||||
GiustSet newSet = new GiustSet()
|
||||
{
|
||||
OldRec = OldRecord,
|
||||
NewRec = SelRecord
|
||||
};
|
||||
OldRecord = null;
|
||||
SelRecord = null;
|
||||
await EC_ReqUpdate.InvokeAsync(newSet);
|
||||
}
|
||||
}
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private List<GiustificativiModel>? _ListTimb { get; set; } = new List<GiustificativiModel>();
|
||||
private GiustificativiModel? OldRecord { get; set; } = null;
|
||||
private GiustificativiModel? SelRecord { get; set; } = null;
|
||||
|
||||
#endregion Private Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<div class="row g-1">
|
||||
<div class="col-md-6">
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" @bind="@CurrRecord.Gruppo">
|
||||
<label class="small">Gruppo</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" @bind="@CodExt">
|
||||
<label class="small">Cod Ext. (4 chr)</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
<div class="form-floating">
|
||||
<span class="form-control">
|
||||
<div class="form-check form-switch">
|
||||
<input type="checkbox" class="form-check-input" @bind="@CurrRecord.ExportEnab">
|
||||
</div>
|
||||
</span>
|
||||
<label class="small">Exp. Abil</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<button class="btn btn-success btn-lg mt-2 w-100" @onclick="() => DoSave()"><i class="fas fa-floppy-disk"></i> Save</button>
|
||||
</div>
|
||||
<div class="col-md-9 my-2">
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" @bind="@CurrRecord.DescrGruppo">
|
||||
<label class="small">Descrizione</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<button class="btn btn-warning btn-lg mt-2 w-100" @onclick="() => DoCancel()"><i class="fas fa-ban"></i> Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,55 @@
|
||||
using GPW.CORE.Data.DbModels;
|
||||
using GPW.CORE.Data.DTO;
|
||||
using GPW.CORE.Data.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace GPW.CORE.ADM.Components.Compo
|
||||
{
|
||||
public partial class GruppiEdit
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public AnagGruppiModel? CurrRecord { get; set; } = null;
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<bool> EC_update { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected GpwDataService GDataServ { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected string CodExt
|
||||
{
|
||||
get => CurrRecord.CodExt ?? "";
|
||||
set
|
||||
{
|
||||
CurrRecord.CodExt = value.Length < 5 ? value : value.Substring(0, 4);
|
||||
}
|
||||
}
|
||||
|
||||
protected async Task DoSave()
|
||||
{
|
||||
bool fatto = false;
|
||||
if (CurrRecord != null)
|
||||
{
|
||||
fatto = await GDataServ.AnagGruppiUpsert(CurrRecord);
|
||||
}
|
||||
await EC_update.InvokeAsync(fatto);
|
||||
}
|
||||
|
||||
protected async Task DoCancel()
|
||||
{
|
||||
await EC_update.InvokeAsync(true);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,169 @@
|
||||
@if (SelItem != null && isEdit)
|
||||
{
|
||||
<div class="modal fade show" tabindex="-1" style="display:block; background-color: rgba(10,10,10,.6);" aria-modal="true" role="dialog" data-keyboard="true">
|
||||
<div class="modal-dialog modal-xl">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title">Edit Gruppo <b>@SelItem.Gruppo</b></h4>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close" @onclick="() => ForceReload(true)"></button>
|
||||
</div>
|
||||
<div class="modal-body p-1">
|
||||
<GruppiEdit CurrRecord="@SelItem" EC_update="ForceReload"></GruppiEdit>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
<div class="card shadow">
|
||||
<div class="card-header">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-0 d-flex">
|
||||
<div class="px-2">
|
||||
<h3>Gestione Gruppi/Dipendenti</h3>
|
||||
</div>
|
||||
</div>
|
||||
<div class="px-0">
|
||||
<div class="input-group" runat="server">
|
||||
<span class="input-group-text">Clona</span>
|
||||
<select @bind="@idxDipFrom" class="form-select form-select-sm">
|
||||
<option value="0">--- Selezionare ---</option>
|
||||
@foreach (var item in ListDipendenti)
|
||||
{
|
||||
<option value="@item.IdxDipendente">@($"{item.Cognome} {item.Nome}")</option>
|
||||
}
|
||||
</select>
|
||||
@if (idxDipFrom > 0 && idxDipTo > 0)
|
||||
{
|
||||
<button class="btn btn-success"><i class="fa fa-angle-double-right px-2" title="Clona Assegnazioni" @onclick="ClonaAssegnDip"></i></button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="btn btn-secondary" disabled><i class="fa fa-angle-double-right px-2" title="Clona Assegnazioni"></i></button>
|
||||
}
|
||||
<select @bind="@idxDipTo" class="form-select form-select-sm">
|
||||
<option value="0">--- Selezionare ---</option>
|
||||
@foreach (var item in ListDipendenti.Where(x => (x.Attivo ?? false)).ToList())
|
||||
{
|
||||
<option value="@item.IdxDipendente">@($"{item.Cognome} {item.Nome}")</option>
|
||||
}
|
||||
</select>
|
||||
@if (idxDipFrom > 0 || idxDipTo > 0)
|
||||
{
|
||||
<button class="btn btn-primary" @onclick="DoResetSelClona"><i class="fa-solid fa-rotate px-1" title="Reset"></i></button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="btn btn-secondary" disabled><i class="fa-solid fa-rotate px-1" title="Reset"></i></button>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body p-1">
|
||||
<div class="row">
|
||||
<div class="col-7">
|
||||
<div class="card shadow">
|
||||
<div class="card-header">
|
||||
<div class="px-0 d-flex">
|
||||
<div class="px-2">
|
||||
<h4>Gruppi</h4>
|
||||
</div>
|
||||
<div class="px-2">
|
||||
<button class="btn btn-success" @onclick=CreateNew tooltip="Add New"><i class="fa-solid fa-plus"></i> Add New</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body p-1">
|
||||
@if (ListRecords == null || isLoading)
|
||||
{
|
||||
<EgwCoreLib.Razor.LoadingData></EgwCoreLib.Razor.LoadingData>
|
||||
}
|
||||
else if (totalCount == 0)
|
||||
{
|
||||
<div class="alert alert-info">Nessun record trovato</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<table class="table table-striped table-sm text-start">
|
||||
<thead>
|
||||
<tr class="">
|
||||
<th class="text-nowrap">
|
||||
<button class="btn btn-primary btn-sm" @onclick="() => ForceReload(true)"><i class="fa-solid fa-rotate"></i></button>
|
||||
</th>
|
||||
<th>Gruppo <Sorter ParamName="CodGruppo" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th>Descrizione <Sorter ParamName="Descrizione" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th>CodExt Grp. <Sorter ParamName="CodExt" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th># Dip. <Sorter ParamName="NumDip" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th class="text-end"><Sorter ParamName="Export" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter> Exp. Abil</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in ListRecords)
|
||||
{
|
||||
<tr class="align-middle @CheckSel(item)">
|
||||
<td class="text-nowrap">
|
||||
<button class="btn btn-info btn-sm" @onclick="() => DoSelect(item)"><i class="fa-solid fa-search"></i></button>
|
||||
@if (SelItem == null)
|
||||
{
|
||||
<button class="btn btn-primary btn-sm mx-1" @onclick="() => DoEdit(item)">
|
||||
<i class="fa-solid fa-edit"></i>
|
||||
</button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="btn btn-secondary btn-sm mx-1" disabled><i class="fa-solid fa-edit"></i></button>
|
||||
}
|
||||
</td>
|
||||
<td>
|
||||
@item.Gruppo
|
||||
</td>
|
||||
<td>
|
||||
@item.DescrGruppo
|
||||
</td>
|
||||
<td>
|
||||
@item.NumDip
|
||||
</td>
|
||||
<td>
|
||||
@item.CodExt
|
||||
</td>
|
||||
<td class="text-end">
|
||||
<input class="form-check-input" type="checkbox" disabled role="switch" @bind="@item.ExportEnab">
|
||||
</td>
|
||||
<td>
|
||||
@if (@item.NumDip == 0)
|
||||
{
|
||||
<button class="btn btn-danger btn-sm" @onclick="() => DoDelete(item)"><i class="fa-solid fa-trash"></i></button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="btn btn-secondary btn-sm" disabled><i class="fa-solid fa-trash"></i></button>
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<EgwCoreLib.Razor.DataPager PageSize="@numRecord" currPage="@currPage" numRecordChanged="SetNumRec" numPageChanged="SetPage" totalCount="@totalCount" showLoading="@isLoading"></EgwCoreLib.Razor.DataPager>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-5">
|
||||
@if (SelItem != null)
|
||||
{
|
||||
<Dip2GrpMan CodGruppo="@SelItem.Gruppo"></Dip2GrpMan>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="alert alert-info p-3 my-5">Selezionare gruppo per visualizzare dipendenti associati</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -0,0 +1,268 @@
|
||||
using EgwCoreLib.Razor;
|
||||
using GPW.CORE.Data.DbModels;
|
||||
using GPW.CORE.Data.DTO;
|
||||
using GPW.CORE.Data.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using NLog;
|
||||
|
||||
namespace GPW.CORE.ADM.Components.Compo
|
||||
{
|
||||
public partial class GruppiMan : IDisposable
|
||||
{
|
||||
#region Public Methods
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
AppMServ.EA_SearchUpdated -= AppMServ_EA_SearchUpdated;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected MessageService AppMServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected GpwDataService GDataServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected string CheckSel(AnagGruppiModel curItem)
|
||||
{
|
||||
string answ = "";
|
||||
if (SelItem != null)
|
||||
{
|
||||
answ = curItem.Gruppo == SelItem.Gruppo ? "table-info" : "";
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
protected async Task ClonaAssegnDip()
|
||||
{
|
||||
bool fatto = await GDataServ.Dipendenti2GrpClona(idxDipFrom, idxDipTo);
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected async Task CreateNew()
|
||||
{
|
||||
SelItem = new AnagGruppiModel()
|
||||
{
|
||||
Gruppo = "__Nuovo Gruppo",
|
||||
DescrGruppo = $"Nuovo Gruppo - {DateTime.Now}",
|
||||
CodExt = "",
|
||||
ExportEnab = true
|
||||
};
|
||||
isEdit = true;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
protected async void DoDelete(AnagGruppiModel selItem)
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sicuro di voler eliminare il record?"))
|
||||
return;
|
||||
|
||||
isLoading = true;
|
||||
bool fatto = await GDataServ.AnagGruppiDelete(selItem);
|
||||
await ReloadData();
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
protected void DoEdit(AnagGruppiModel? selItem)
|
||||
{
|
||||
isEdit = true;
|
||||
SelItem = selItem;
|
||||
}
|
||||
|
||||
protected void DoSelect(AnagGruppiModel? selItem)
|
||||
{
|
||||
isEdit = false;
|
||||
SelItem = selItem;
|
||||
}
|
||||
|
||||
protected async Task ForceReload(bool force)
|
||||
{
|
||||
SelItem = null;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
CurrSearch = "";
|
||||
AppMServ.SearchVal = "";
|
||||
AppMServ.EA_SearchUpdated += AppMServ_EA_SearchUpdated;
|
||||
numRecord = await AppMServ.NumRowGridGet(gridKey);
|
||||
}
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected async Task SetNumRec(int newNum)
|
||||
{
|
||||
numRecord = newNum;
|
||||
currPage = 1;
|
||||
await AppMServ.NumRowGridSet(gridKey, newNum);
|
||||
await InvokeAsync(ReloadData);
|
||||
}
|
||||
|
||||
protected async Task SetPage(int newNum)
|
||||
{
|
||||
currPage = newNum;
|
||||
await InvokeAsync(ReloadData);
|
||||
}
|
||||
|
||||
protected async Task SortRequested(Sorter.SortCallBack e)
|
||||
{
|
||||
sortField = e.ParamName;
|
||||
sortAsc = e.IsAscending;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
private string gridKey = "GruppiMan";
|
||||
private int idxDipFrom = 0;
|
||||
private int idxDipTo = 0;
|
||||
|
||||
private bool isEdit = false;
|
||||
private AnagGruppiModel? SelItem = null;
|
||||
private bool sortAsc = true;
|
||||
private string sortField = "";
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private int currPage { get; set; } = 1;
|
||||
private string CurrSearch { get; set; } = "";
|
||||
private bool isLoading { get; set; } = false;
|
||||
private List<DipendentiModel> ListDipendenti { get; set; } = new List<DipendentiModel>();
|
||||
private List<AnagGruppiModel>? ListRecords { get; set; } = null;
|
||||
private int numRecord { get; set; } = 10;
|
||||
private List<AnagGruppiModel>? SearchRecords { get; set; } = null;
|
||||
private int totalCount { get; set; } = 0;
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private async void AppMServ_EA_SearchUpdated()
|
||||
{
|
||||
CurrSearch = AppMServ.SearchVal;
|
||||
await ReloadData();
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
private void DoResetSelClona()
|
||||
{
|
||||
idxDipFrom = 0;
|
||||
idxDipTo = 0;
|
||||
}
|
||||
|
||||
private async Task ReloadData()
|
||||
{
|
||||
isLoading = true;
|
||||
ListRecords = null;
|
||||
ListDipendenti = await GDataServ.DipendentiGetAll();
|
||||
try
|
||||
{
|
||||
SearchRecords = await GDataServ.AnagGruppiAll();
|
||||
// verifico filtro per ricerca
|
||||
if (!string.IsNullOrEmpty(CurrSearch))
|
||||
{
|
||||
SearchRecords = SearchRecords.Where(x => x.Gruppo.Contains(CurrSearch, StringComparison.InvariantCultureIgnoreCase) || x.DescrGruppo.Contains(CurrSearch, StringComparison.InvariantCultureIgnoreCase)).ToList();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error($"Eccezione in recupero dati{Environment.NewLine}{ex}");
|
||||
}
|
||||
totalCount = SearchRecords.Count;
|
||||
SortTable();
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
private void SortTable()
|
||||
{
|
||||
if (SearchRecords != null)
|
||||
{
|
||||
// se ho ordinamento riordino...
|
||||
if (!string.IsNullOrEmpty(sortField))
|
||||
{
|
||||
switch (sortField)
|
||||
{
|
||||
case "Descrizione":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.DescrGruppo).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.DescrGruppo).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "CodGruppo":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.Gruppo).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.Gruppo).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "CodExt":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.CodExt).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.CodExt).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "Export":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.ExportEnab).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.ExportEnab).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// filtro x display
|
||||
ListRecords = SearchRecords
|
||||
.Skip(numRecord * (currPage - 1))
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
ListRecords = new List<AnagGruppiModel>();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
|
||||
<AuthorizeView>
|
||||
<div class="d-flex justify-content-between w-100">
|
||||
<div class="px-1">
|
||||
<div class="d-flex">
|
||||
<div class="px-1"><b>@userName</b></div>
|
||||
<div class="px-1">
|
||||
<button class="btn btn-sm btn-outline-dark" @onclick="() => DoReloadUtente()">
|
||||
<i class="fas fa-user @cssActive" title="Attivazione Utente"></i>
|
||||
</button>
|
||||
</div>
|
||||
<div class="px-1">
|
||||
<button class="btn btn-sm btn-outline-dark" @onclick="() => DoVerifyActiv()">
|
||||
<i class="fas fa-address-card @cssLicOk" title="Licenza assegnata"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="px-1 fs-3">
|
||||
@if (!string.IsNullOrEmpty(PageIcon))
|
||||
{
|
||||
<i class="@PageIcon"></i>
|
||||
}
|
||||
@if (!string.IsNullOrEmpty(PageTitle))
|
||||
{
|
||||
<span class="px-2">@PageTitle</span>
|
||||
}
|
||||
</div>
|
||||
<div class="px-1">
|
||||
<div class="d-flex">
|
||||
@if (showSearch)
|
||||
{
|
||||
<div class="px-1">
|
||||
<div class="input-group" title="ricerca">
|
||||
<span class="input-group-text"><i class="fas fa-search"></i></span>
|
||||
<input type="text" class="form-control" @bind="@searchVal" accesskey="/" placeholder="[Alt-/] to select">
|
||||
<button class="btn btn-outline-secondary" @onclick="resetSearch"><i class="fas fa-ban"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
<div class="px-1">
|
||||
<select @bind="@UserLang" class="form-select" @bind:after="SaveLang">
|
||||
@foreach (var item in ListLingue)
|
||||
{
|
||||
<option value="@item">@item</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</AuthorizeView>
|
||||
|
||||
@@ -0,0 +1,393 @@
|
||||
using GPW.CORE.Data;
|
||||
using GPW.CORE.Data.DbModels;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Authorization;
|
||||
using Microsoft.AspNetCore.Components.Routing;
|
||||
using Newtonsoft.Json;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using GPW.CORE.Data.Services;
|
||||
|
||||
namespace GPW.CORE.ADM.Components.Compo
|
||||
{
|
||||
public partial class LoginDisplay : IDisposable
|
||||
{
|
||||
#region Public Methods
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
GDataServ.mPipeTimb.EA_NewMessage -= MPipeTimb_EA_NewMessage;
|
||||
GDataServ.mPipeRich.EA_NewMessage -= MPipeRich_EA_NewMessage;
|
||||
AppMServ.EA_HideSearch -= AppMServ_EA_HideSearch;
|
||||
AppMServ.EA_HideSearch -= AppMServ_EA_ShowSearch;
|
||||
AppMServ.EA_PageUpdated -= AppMServ_EA_PageUpdated;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected MessageService AppMServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected NavigationManager NavMan { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected AuthenticationStateProvider AuthenticationStateProvider { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected AppAuthService AuthServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected AppAuthService AuthService { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected IConfiguration config { get; set; } = null!;
|
||||
|
||||
protected string cssActive { get => AppMServ.IsActive ? "text-success" : "text-danger"; }
|
||||
|
||||
protected string cssLicOk { get => AppMServ.PayloadOk ? "text-success" : "text-danger"; }
|
||||
|
||||
[Inject]
|
||||
protected GpwDataService GDataServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected LicenseService LicServ { get; set; } = null!;
|
||||
|
||||
protected List<string> ListLingue
|
||||
{
|
||||
get => AuthServ.Lingue;
|
||||
}
|
||||
|
||||
protected string searchVal
|
||||
{
|
||||
get => AppMServ.SearchVal;
|
||||
set => AppMServ.SearchVal = value;
|
||||
}
|
||||
|
||||
protected string UserLang
|
||||
{
|
||||
get => AppMServ.UserLang;
|
||||
set => AppMServ.UserLang = value;
|
||||
}
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
/// <summary>
|
||||
/// Verifica informazioni condivise applicazione
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected async Task<bool> checkActivations()
|
||||
{
|
||||
bool allOk = false;
|
||||
if (LicServ.ValidData)
|
||||
{
|
||||
// se non fosse tutto ok
|
||||
if (!LicServ.HasActivData)
|
||||
{
|
||||
// chiamo refresh licenze da remoto
|
||||
allOk = await LicServ.RefreshLicense();
|
||||
}
|
||||
}
|
||||
|
||||
await Task.Delay(1);
|
||||
return allOk;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifica informazioni condivise applicazione
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected async Task<bool> checkSharedInfo()
|
||||
{
|
||||
bool allOk = false;
|
||||
if (!LicServ.ValidData)
|
||||
{
|
||||
// salvo cod app da Conf...
|
||||
LicServ.Applicazione = GDataServ.CodApp;
|
||||
// effettuo lettura dati preliminari da AKV (eventualmente in cache...)
|
||||
List<AnagKeyValueModel>? rawAkvList = await GDataServ.AKVList();
|
||||
if (rawAkvList != null)
|
||||
{
|
||||
LicServ.AKVList = rawAkvList;
|
||||
allOk = LicServ.InitAkv();
|
||||
}
|
||||
}
|
||||
|
||||
await Task.Delay(1);
|
||||
return allOk;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifica info specifiche utente
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected async Task<bool> checkUserLicense()
|
||||
{
|
||||
bool answ = false;
|
||||
// verifico utente attivo
|
||||
answ = AppMServ.IsActive;
|
||||
if (answ)
|
||||
{
|
||||
var rawActList = LicServ.ActivList;
|
||||
// recupero hash utente
|
||||
string hashImpiego = AppMServ.HashDip;
|
||||
// confronto con elenco attivazioni dello shared service...
|
||||
var foundRec = rawActList.Where(x => x.CodImpiego == hashImpiego);
|
||||
answ = foundRec.Count() > 0;
|
||||
// salvo status payloadOk
|
||||
AppMServ.PayloadOk = answ;
|
||||
}
|
||||
|
||||
await Task.Delay(1);
|
||||
return answ;
|
||||
}
|
||||
|
||||
protected async Task DoReloadUtente()
|
||||
{
|
||||
AppMServ.RigaDip = null;
|
||||
await Task.Delay(1);
|
||||
await LoadUtente();
|
||||
// recupero dati conf lingua...
|
||||
await ReloadLang();
|
||||
// verifico attivazione dipendente...
|
||||
await checkUserLicense();
|
||||
}
|
||||
|
||||
protected async Task DoVerifyActiv()
|
||||
{
|
||||
AppMServ.PayloadOk = false;
|
||||
// svuoto oggetto activList...
|
||||
LicServ.ActivList = new List<LiManObj.AttivazioneDTO>();
|
||||
await LicServ.resetActivList();
|
||||
await Task.Delay(50);
|
||||
await VerifyActiv();
|
||||
}
|
||||
|
||||
protected async Task LoadUtente()
|
||||
{
|
||||
var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
|
||||
var user = authState.User;
|
||||
// verifico se ho utente loggato...
|
||||
if (user.Identity != null && user.Identity.IsAuthenticated)
|
||||
{
|
||||
userName = $"{user.Identity.Name}";
|
||||
// cerco su DB
|
||||
DipendentiModel? rigaDip = ListaDip.Where(x => $"{x.Dominio.Trim()}\\{x.Utente.Trim()}".ToLower() == userName.Trim().ToLower()).FirstOrDefault();
|
||||
if (rigaDip != null)
|
||||
{
|
||||
// salvo riga info dipendente
|
||||
AppMServ.RigaDip = rigaDip;
|
||||
userName = $"{rigaDip.Cognome} {rigaDip.Nome}";
|
||||
idxDipendente = rigaDip.IdxDipendente;
|
||||
// leggo e salvo in MsgService il menù utente...
|
||||
var listMenu = await AuthService.MenuUtente(rigaDip.Utente, UserLang);
|
||||
AppMServ.ListMenu = listMenu;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
userName = "N.A.";
|
||||
}
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
// aggiungo gestione notifica messaggi timbrature...
|
||||
GDataServ.mPipeTimb.EA_NewMessage += MPipeTimb_EA_NewMessage;
|
||||
GDataServ.mPipeRich.EA_NewMessage += MPipeRich_EA_NewMessage;
|
||||
AppMServ.EA_HideSearch += AppMServ_EA_HideSearch;
|
||||
AppMServ.EA_ShowSearch += AppMServ_EA_ShowSearch;
|
||||
AppMServ.EA_PageUpdated += AppMServ_EA_PageUpdated;
|
||||
// leggo lingue...
|
||||
UserLang = await AppMServ.UserLangGet();
|
||||
// leggo lista dip
|
||||
ListaDip = await GDataServ.DipendentiGetAll();
|
||||
numTot = ListaDip.Count(x => x.Attivo == true);
|
||||
|
||||
//effettuo eventuale recupero dati dipendente
|
||||
if (AppMServ.RigaDip == null)
|
||||
{
|
||||
await LoadUtente();
|
||||
}
|
||||
|
||||
// verifica attivazione
|
||||
await VerifyActiv();
|
||||
|
||||
// verifica rpesenza personale
|
||||
await VerifPresenze(false);
|
||||
}
|
||||
|
||||
protected void resetSearch()
|
||||
{
|
||||
searchVal = "";
|
||||
}
|
||||
|
||||
protected async Task VerifyActiv()
|
||||
{
|
||||
// preliminarmente verifica shared info
|
||||
await checkSharedInfo();
|
||||
// refresh attivazioni se necessario
|
||||
await checkActivations();
|
||||
// verifico e salvo dati attivazione dipendente...
|
||||
await checkUserLicense();
|
||||
|
||||
// verifica admin
|
||||
checkAdmin();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private int idxDipendente = 0;
|
||||
|
||||
private bool isAdmin = false;
|
||||
|
||||
private List<DipendentiModel> ListaDip = new List<DipendentiModel>();
|
||||
|
||||
private List<StatsDayPresModel> ListaPres = new List<StatsDayPresModel>();
|
||||
|
||||
private List<string> ListIdxAdmin = new List<string>();
|
||||
|
||||
private int numPres = 0;
|
||||
|
||||
private int numTot = 0;
|
||||
|
||||
private string PageIcon = "";
|
||||
|
||||
private string PageTitle = "";
|
||||
|
||||
private bool showSearch = false;
|
||||
|
||||
private string userName = "";
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private string lblDisplay { get; set; } = "";
|
||||
|
||||
[Inject]
|
||||
private NavigationManager NavManager { get; set; } = null!;
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private void AppMServ_EA_HideSearch()
|
||||
{
|
||||
showSearch = false;
|
||||
}
|
||||
|
||||
private void AppMServ_EA_PageUpdated()
|
||||
{
|
||||
PageTitle = AppMServ.PageName;
|
||||
PageIcon = AppMServ.PageIcon;
|
||||
InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
private void AppMServ_EA_ShowSearch()
|
||||
{
|
||||
showSearch = true;
|
||||
}
|
||||
|
||||
private void checkAdmin()
|
||||
{
|
||||
// leggo elenco admin
|
||||
string rawData = config.GetValue<string>("ServerConf:AdmList") ?? "";
|
||||
if (!string.IsNullOrEmpty(rawData))
|
||||
{
|
||||
ListIdxAdmin = rawData.Split(',').ToList();
|
||||
}
|
||||
isAdmin = ListIdxAdmin.Contains($"{idxDipendente}");
|
||||
}
|
||||
|
||||
private async void MPipeRich_EA_NewMessage(object? sender, EventArgs e)
|
||||
{
|
||||
await processMessage(e);
|
||||
}
|
||||
|
||||
private async void MPipeTimb_EA_NewMessage(object? sender, EventArgs e)
|
||||
{
|
||||
await processMessage(e);
|
||||
}
|
||||
|
||||
private async Task processMessage(EventArgs e)
|
||||
{
|
||||
PubSubEventArgs currArgs = (PubSubEventArgs)e;
|
||||
// conversione on-the-fly List<string> --> allarmi
|
||||
if (!string.IsNullOrEmpty(currArgs.newMessage))
|
||||
{
|
||||
try
|
||||
{
|
||||
TimbratureModel? timbData = JsonConvert.DeserializeObject<TimbratureModel>(currArgs.newMessage);
|
||||
if (timbData != null)
|
||||
{
|
||||
// solo se admin
|
||||
if (isAdmin)
|
||||
{
|
||||
updateDisplay(timbData);
|
||||
await InvokeAsync(StateHasChanged);
|
||||
await ResetMessage(6);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
}
|
||||
|
||||
private async Task ReloadLang()
|
||||
{
|
||||
UserLang = await AppMServ.UserLangGet();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Chiama reset messaggio dopo un periodo di sec richiesto...
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private async Task ResetMessage(int numSec)
|
||||
{
|
||||
// chiudo visualizzazione stato update
|
||||
await Task.Delay(numSec * 1000);
|
||||
lblDisplay = "";
|
||||
await VerifPresenze(true);
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
private async void SaveLang()
|
||||
{
|
||||
await AppMServ.UserLangSet(UserLang);
|
||||
// vado a pagina reload...
|
||||
NavMan.NavigateTo("ForceReset", true);
|
||||
}
|
||||
|
||||
private void updateDisplay(TimbratureModel timbData)
|
||||
{
|
||||
string tipo = timbData.Entrata ?? true ? "IN" : "OUT";
|
||||
string dipData = $"Dip: {timbData.IdxDipendente}";
|
||||
//cerco dip...
|
||||
var currDip = ListaDip.Find(x => x.IdxDipendente == timbData.IdxDipendente);
|
||||
if (currDip != null)
|
||||
{
|
||||
dipData = $"{currDip.Cognome} {currDip.Nome} ({timbData.IdxDipendente})";
|
||||
}
|
||||
lblDisplay = $"{tipo} | {dipData} | {timbData.DataOra:HH:mm:ss}";
|
||||
}
|
||||
|
||||
private async Task VerifPresenze(bool resetCache)
|
||||
{
|
||||
if (resetCache)
|
||||
{
|
||||
await GDataServ.FlushRedisCache();
|
||||
}
|
||||
ListaPres = await GDataServ.PresenzeDay(DateTime.Now);
|
||||
numPres = ListaPres.Sum(x => x.IsPresent);
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
<div class="card shadow">
|
||||
<div class="card-header">
|
||||
Dettaglio Mensile
|
||||
</div>
|
||||
<div class="card-body p-1 small">
|
||||
|
||||
@if (ListRecords == null || isLoading)
|
||||
{
|
||||
<EgwCoreLib.Razor.LoadingData></EgwCoreLib.Razor.LoadingData>
|
||||
}
|
||||
else if (totalCount == 0)
|
||||
{
|
||||
<div class="alert alert-info">Nessun record trovato</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<table class="table table-striped table-sm text-start">
|
||||
<thead>
|
||||
<tr>
|
||||
<th> </th>
|
||||
<th>Data <Sorter ParamName="Data" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th class="text-end">Tag <Sorter ParamName="Tag" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in ListRecords)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@if (item.isActive)
|
||||
{
|
||||
<button class="btn btn-primary btn-sm px-1 py-0" @onclick="() => DoToggle(item)"><i class="fa-solid fa-thumbs-up"></i></button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="btn btn-secondary btn-sm px-1 py-0" @onclick="() => DoToggle(item)"><i class="fa-solid fa-thumbs-down"></i></button>
|
||||
|
||||
}
|
||||
</td>
|
||||
<td>
|
||||
@($"{item.DtRif:yyyy.MM.dd, dddd}")
|
||||
</td>
|
||||
<td class="text-end">@item.CodTag</td>
|
||||
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
<EgwCoreLib.Razor.DataPager PageSize="@numRecord" currPage="@currPage" totalCount="@totalCount" showLoading="@isLoading" numRecordChanged="SetNumRec" numPageChanged="SetPage"></EgwCoreLib.Razor.DataPager>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,213 @@
|
||||
using EgwCoreLib.Razor;
|
||||
using EgwCoreLib.Utils;
|
||||
using GPW.CORE.Data.DbModels;
|
||||
using GPW.CORE.Data.DTO;
|
||||
using GPW.CORE.Data.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using NLog;
|
||||
|
||||
namespace GPW.CORE.ADM.Components.Compo
|
||||
{
|
||||
public partial class MonthTagDetail
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public MonthTagModel RecSel { get; set; } = null!;
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected MessageService AppMServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected AppAuthService AuthServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected GpwDataService GDataServ { get; set; } = null!;
|
||||
|
||||
protected int IdxDipSel { get; set; } = 0;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected string CheckSel(TagFasiDTO curItem)
|
||||
{
|
||||
string answ = "";
|
||||
if (SelItem != null)
|
||||
{
|
||||
answ = curItem.CodTagFase == SelItem.CodTagFase ? "table-info" : "";
|
||||
}
|
||||
// verifico stato attivo
|
||||
answ += !curItem.Enabled ? " striked" : "";
|
||||
return answ;
|
||||
}
|
||||
|
||||
protected void DoSelect(MonthTagModel currRec)
|
||||
{
|
||||
SelRecord = currRec;
|
||||
}
|
||||
|
||||
protected async Task DoToggle(ListTagDDModel selRec)
|
||||
{
|
||||
if (selRec != null)
|
||||
{
|
||||
GDataServ.ListTagDDToggle(selRec.IdxTagDD);
|
||||
}
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
CurrPeriodo.Fine = DateTime.Today.AddDays(1);
|
||||
}
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
CurrPeriodo.Fine = new DateTime(RecSel.Anno, RecSel.Mese, 1).AddMonths(1);
|
||||
CurrPeriodo.Inizio = new DateTime(RecSel.Anno, RecSel.Mese, 1);
|
||||
IdxDipSel = RecSel.IdxDipendente;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected async void Recalc()
|
||||
{
|
||||
await Task.Delay(200);
|
||||
}
|
||||
|
||||
protected async Task SetNumRec(int newNum)
|
||||
{
|
||||
numRecord = newNum;
|
||||
currPage = 1;
|
||||
await AppMServ.NumRowGridSet(gridKey, newNum);
|
||||
await InvokeAsync(ReloadData);
|
||||
}
|
||||
|
||||
protected async Task SetPage(int newNum)
|
||||
{
|
||||
currPage = newNum;
|
||||
await InvokeAsync(ReloadData);
|
||||
}
|
||||
|
||||
protected async Task SortRequested(Sorter.SortCallBack e)
|
||||
{
|
||||
sortField = e.ParamName;
|
||||
sortAsc = e.IsAscending;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected string Traduci(string lemma)
|
||||
{
|
||||
return AuthServ.Traduci(lemma, AppMServ.UserLang);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
private string gridKey = "TagsMan";
|
||||
private TagFasiDTO? SelItem = null;
|
||||
private bool sortAsc = true;
|
||||
private string sortField = "";
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private int currPage { get; set; } = 1;
|
||||
private DtUtils.Periodo CurrPeriodo { get; set; } = new DtUtils.Periodo(DtUtils.PeriodSet.ThisMonth);
|
||||
private bool isLoading { get; set; } = false;
|
||||
|
||||
private List<ListTagDDModel>? ListRecords { get; set; } = null;
|
||||
private int numRecord { get; set; } = 50;
|
||||
private List<ListTagDDModel>? SearchRecords { get; set; } = null;
|
||||
private MonthTagModel? SelRecord { get; set; } = null;
|
||||
|
||||
private bool ShowInatt { get; set; } = false;
|
||||
|
||||
private int totalCount { get; set; } = 0;
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private async Task ReloadData()
|
||||
{
|
||||
isLoading = true;
|
||||
ListRecords = null;
|
||||
try
|
||||
{
|
||||
SearchRecords = await GDataServ.ListTagDD(IdxDipSel, CurrPeriodo.Inizio, CurrPeriodo.Fine);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error($"Eccezione in recupero dati{Environment.NewLine}{ex}");
|
||||
}
|
||||
totalCount = SearchRecords.Count;
|
||||
SortTable();
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
private async Task SavePeriodo(DtUtils.Periodo newPeiodo)
|
||||
{
|
||||
CurrPeriodo = newPeiodo;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
private void SortTable()
|
||||
{
|
||||
if (SearchRecords != null)
|
||||
{
|
||||
// se ho ordinamento riordino...
|
||||
if (!string.IsNullOrEmpty(sortField))
|
||||
{
|
||||
switch (sortField)
|
||||
{
|
||||
#if true
|
||||
case "Data":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.DtRif).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.DtRif).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "IdxTagDD":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.IdxTagDD).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.IdxTagDD).ToList();
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// filtro x display
|
||||
ListRecords = SearchRecords
|
||||
.Skip(numRecord * (currPage - 1))
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
ListRecords = new List<ListTagDDModel>();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
<div class="card shadow">
|
||||
<div class="card-header">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-0 d-flex">
|
||||
<div class="px-0">
|
||||
<h3>@Traduci("tagMensili")</h3>
|
||||
</div>
|
||||
<div class="px-2">
|
||||
<button class="btn btn-success" @onclick=Recalc tooltip="Add New"><i class="fa-solid fa-plus"></i> @Traduci("Ricalcola")</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="px-0">
|
||||
<div class="d-flex align-middle">
|
||||
<div class="px-1 py-2">
|
||||
<div class="form-check form-switch">
|
||||
<input class="form-check-input" type="checkbox" @bind=@ShowInatt @bind:after=ForceReload>
|
||||
<label class="form-check-label">Mostra Inattivi</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="px-1 py-1">
|
||||
<select @bind="@IdxDipSel" class="form-select form-select-sm" @bind:after=ForceReload>
|
||||
<option value="0">--- Selezionare ---</option>
|
||||
@foreach (var item in ListDipendenti)
|
||||
{
|
||||
<option value="@item.IdxDipendente">@($"{item.Cognome} {item.Nome}")</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
<div class="px-0">
|
||||
<PeriodoSel CurrPeriodo="@CurrPeriodo" E_PeriodoSel="@SavePeriodo"></PeriodoSel>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body p-1 small">
|
||||
|
||||
@if (ListRecords == null || isLoading)
|
||||
{
|
||||
<EgwCoreLib.Razor.LoadingData></EgwCoreLib.Razor.LoadingData>
|
||||
}
|
||||
else if (totalCount == 0)
|
||||
{
|
||||
<div class="alert alert-info">Nessun record trovato</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="row">
|
||||
<div class="@mainDivCss">
|
||||
<table class="table table-striped table-sm text-start">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<button class="btn btn-primary btn-sm" @onclick="() => ForceReload()"><i class="fa-solid fa-rotate"></i></button>
|
||||
</th>
|
||||
<th>Anno <Sorter ParamName="Anno" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th>Mese <Sorter ParamName="Mese" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th>Cognome Nome <Sorter ParamName="CognomeNome" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th class="text-end">CodTag <Sorter ParamName="CodTag" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th class="text-end"># Tag <Sorter ParamName="NumTag" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th class="text-end"># Dis <Sorter ParamName="NumDis" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
@*
|
||||
<th>Colonna 4 <Sorter ParamName="" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th>Colonna 5 <Sorter ParamName="" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th> *@
|
||||
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@foreach (var item in ListRecords)
|
||||
{
|
||||
<tr class="@CssCheckSel(item)">
|
||||
<td>
|
||||
@if (SelItem == null)
|
||||
{
|
||||
<button class="btn btn-primary btn-sm" @onclick="() => DoSelect(item)"><i class="fa-solid fa-search"></i></button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="btn btn-secondary btn-sm" disabled><i class="fa-solid fa-edit"></i></button>
|
||||
}
|
||||
</td>
|
||||
<td>@item.Anno</td>
|
||||
<td>@item.Mese</td>
|
||||
<td>@item.CognomeNome</td>
|
||||
<td class="text-end">@item.CodTag</td>
|
||||
<td class="text-end">@item.NumTag</td>
|
||||
<td class="text-end">@item.NumDis</td>
|
||||
|
||||
@*
|
||||
<td>
|
||||
@if (item.Enabled && item.NumFasi == 0)
|
||||
{
|
||||
<button class="btn btn-danger btn-sm" @onclick="() => DoDelete(item)"><i class="fa-solid fa-trash"></i></button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="btn btn-secondary btn-sm" disabled><i class="fa-solid fa-trash"></i></button>
|
||||
}
|
||||
</td> *@
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="7">
|
||||
<EgwCoreLib.Razor.DataPager PageSize="@numRecord" currPage="@currPage" totalCount="@totalCount" showLoading="@isLoading" numRecordChanged="SetNumRec" numPageChanged="SetPage"></EgwCoreLib.Razor.DataPager>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
@if (SelRecord != null)
|
||||
{
|
||||
<div class="@detDivCss">
|
||||
<MonthTagDetail RecSel="@SelRecord"></MonthTagDetail>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,276 @@
|
||||
using EgwCoreLib.Razor;
|
||||
using EgwCoreLib.Utils;
|
||||
using GPW.CORE.Data.DbModels;
|
||||
using GPW.CORE.Data.DTO;
|
||||
using GPW.CORE.Data.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using NLog;
|
||||
|
||||
namespace GPW.CORE.ADM.Components.Compo
|
||||
{
|
||||
public partial class MonthTagMan
|
||||
{
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected MessageService AppMServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected AppAuthService AuthServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected GpwDataService GDataServ { get; set; } = null!;
|
||||
|
||||
protected int IdxDipSel { get; set; } = 0;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected string CheckSel(TagFasiDTO curItem)
|
||||
{
|
||||
string answ = "";
|
||||
if (SelItem != null)
|
||||
{
|
||||
answ = curItem.CodTagFase == SelItem.CodTagFase ? "table-info" : "";
|
||||
}
|
||||
// verifico stato attivo
|
||||
answ += !curItem.Enabled ? " striked" : "";
|
||||
return answ;
|
||||
}
|
||||
|
||||
protected void DoSelect(MonthTagModel currRec)
|
||||
{
|
||||
SelRecord = currRec;
|
||||
}
|
||||
|
||||
private string mainDivCss
|
||||
{
|
||||
get => SelRecord == null ? "col-12" : "col-12 col-lg-9";
|
||||
}
|
||||
private string detDivCss
|
||||
{
|
||||
get => SelRecord == null ? "col-0" : "col-12 col-lg-3";
|
||||
}
|
||||
|
||||
protected string CssCheckSel(MonthTagModel currRec)
|
||||
{
|
||||
bool isSel = SelRecord != null && SelRecord.IdxDipendente == currRec.IdxDipendente && SelRecord.Anno == currRec.Anno && SelRecord.Mese == currRec.Mese;
|
||||
return isSel ? "table-info" : "";
|
||||
}
|
||||
|
||||
protected async Task ForceReload()
|
||||
{
|
||||
currPage = 1;
|
||||
SelRecord = null;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
CurrPeriodo.Fine = DateTime.Today.AddDays(1);
|
||||
}
|
||||
|
||||
protected async Task Recalc()
|
||||
{
|
||||
// eseguo ricalcolo
|
||||
isLoading = true;
|
||||
GDataServ.MonthTagRecalc(IdxDipSel, CurrPeriodo.Inizio, CurrPeriodo.Fine, "BP", 270);
|
||||
// rileggo
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected async Task SortRequested(Sorter.SortCallBack e)
|
||||
{
|
||||
sortField = e.ParamName;
|
||||
sortAsc = e.IsAscending;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected string Traduci(string lemma)
|
||||
{
|
||||
return AuthServ.Traduci(lemma, AppMServ.UserLang);
|
||||
}
|
||||
|
||||
|
||||
protected async Task SetNumRec(int newNum)
|
||||
{
|
||||
numRecord = newNum;
|
||||
currPage = 1;
|
||||
await AppMServ.NumRowGridSet(gridKey, newNum);
|
||||
await InvokeAsync(ReloadData);
|
||||
}
|
||||
|
||||
protected async Task SetPage(int newNum)
|
||||
{
|
||||
currPage = newNum;
|
||||
await InvokeAsync(ReloadData);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
private string gridKey = "TagsMan";
|
||||
private TagFasiDTO? SelItem = null;
|
||||
private bool sortAsc = true;
|
||||
private string sortField = "";
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private int currPage { get; set; } = 1;
|
||||
private DtUtils.Periodo CurrPeriodo { get; set; } = new DtUtils.Periodo(DtUtils.PeriodSet.ThisMonth);
|
||||
private bool isLoading { get; set; } = false;
|
||||
|
||||
private List<DipendentiModel> ListDipendenti { get; set; } = new List<DipendentiModel>();
|
||||
|
||||
private List<MonthTagModel>? ListRecords { get; set; } = null;
|
||||
private int numRecord { get; set; } = 10;
|
||||
private List<MonthTagModel>? SearchRecords { get; set; } = null;
|
||||
private MonthTagModel? SelRecord { get; set; } = null;
|
||||
|
||||
private bool ShowInatt { get; set; } = false;
|
||||
|
||||
private int totalCount { get; set; } = 0;
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private async Task ReloadData()
|
||||
{
|
||||
isLoading = true;
|
||||
ListRecords = null;
|
||||
var rawList = await GDataServ.DipendentiGetAll();
|
||||
if (ShowInatt)
|
||||
{
|
||||
ListDipendenti = rawList;
|
||||
}
|
||||
else
|
||||
{
|
||||
ListDipendenti = rawList.Where(x => (x.Attivo ?? false)).ToList();
|
||||
}
|
||||
try
|
||||
{
|
||||
SearchRecords = await GDataServ.MonthTagList(IdxDipSel, CurrPeriodo.Inizio, CurrPeriodo.Fine);
|
||||
// verifico filtro per IdxDip
|
||||
if (IdxDipSel > 0)
|
||||
{
|
||||
SearchRecords = SearchRecords.Where(x => x.IdxDipendente == IdxDipSel).ToList();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error($"Eccezione in recupero dati{Environment.NewLine}{ex}");
|
||||
}
|
||||
totalCount = SearchRecords.Count;
|
||||
SortTable();
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
private async Task SavePeriodo(DtUtils.Periodo newPeiodo)
|
||||
{
|
||||
CurrPeriodo = newPeiodo;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
private void SortTable()
|
||||
{
|
||||
if (SearchRecords != null)
|
||||
{
|
||||
// se ho ordinamento riordino...
|
||||
if (!string.IsNullOrEmpty(sortField))
|
||||
{
|
||||
switch (sortField)
|
||||
{
|
||||
#if true
|
||||
case "Anno":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.Anno).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.Anno).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "Mese":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.Mese).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.Mese).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "CognomeNome":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.CognomeNome).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.CognomeNome).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "CodTag":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.CodTag).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.CodTag).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "NumTag":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.NumTag).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.NumTag).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "NumDis":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.NumDis).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.NumDis).ToList();
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// filtro x display
|
||||
ListRecords = SearchRecords
|
||||
.Skip(numRecord * (currPage - 1))
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
ListRecords = new List<MonthTagModel>();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
<div class="row g-1">
|
||||
<div class="col-2">
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" @bind="@CurrRecord.codOrario">
|
||||
<label class="small">Codice</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<div class="row mx-1">
|
||||
<div class="col px-0">
|
||||
<div class="form-floating">
|
||||
<input type="number" class="form-control" @bind="@CurrRecord.oreLun">
|
||||
<label class="small">Lun</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col px-0">
|
||||
<div class="form-floating">
|
||||
<input type="number" class="form-control" @bind="@CurrRecord.oreMar">
|
||||
<label class="small">Mar</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col px-0">
|
||||
<div class="form-floating">
|
||||
<input type="number" class="form-control" @bind="@CurrRecord.oreMer">
|
||||
<label class="small">Mer</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col px-0">
|
||||
<div class="form-floating">
|
||||
<input type="number" class="form-control" @bind="@CurrRecord.oreGio">
|
||||
<label class="small">Gio</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col px-0">
|
||||
<div class="form-floating">
|
||||
<input type="number" class="form-control" @bind="@CurrRecord.oreVen">
|
||||
<label class="small">Ven</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col px-0">
|
||||
<div class="form-floating">
|
||||
<input type="number" class="form-control" @bind="@CurrRecord.oreSab">
|
||||
<label class="small">Sab</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col px-0">
|
||||
<div class="form-floating">
|
||||
<input type="number" class="form-control" @bind="@CurrRecord.oreDom">
|
||||
<label class="small">Dom</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="row mx-1">
|
||||
<div class="col px-0">
|
||||
<div class="form-floating">
|
||||
<div type="number" class="form-control" disabled>@CurrRecord.oreOrdSett</div>
|
||||
<label class="small">Tot Ord</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col px-0">
|
||||
<div class="form-floating">
|
||||
<input type="number" class="form-control" @bind="@CurrRecord.oreStraordAss">
|
||||
<label class="small">Straord.Ass.</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col px-0">
|
||||
<div class="form-floating">
|
||||
<div class="form-control">
|
||||
<input class="form-check-input" type="checkbox" @bind="@CurrRecord.autoCompOreOrd">
|
||||
</div>
|
||||
<label class="small">AutoComp.</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row g-1">
|
||||
<div class="col-4">
|
||||
<div class="row mx-1">
|
||||
<div class="col px-0">
|
||||
<div class="form-floating">
|
||||
<input type="datetime" class="form-control" @bind="@CurrRecord.oraInizio1">
|
||||
<label class="small">Ora Inizio 1</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col px-0">
|
||||
<div class="form-floating">
|
||||
<input type="datetime" class="form-control" @bind="@CurrRecord.oraFine1">
|
||||
<label class="small">Ora Fine 1</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="row mx-1">
|
||||
<div class="col px-0">
|
||||
<div class="form-floating">
|
||||
<input type="datetime" class="form-control" @bind="@CurrRecord.oraInizio2">
|
||||
<label class="small">Ora Inizio 2</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col px-0">
|
||||
<div class="form-floating">
|
||||
<input type="datetime" class="form-control" @bind="@CurrRecord.oraFine2">
|
||||
<label class="small">Ora Fine 2</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="row mx-1">
|
||||
<div class="col px-0">
|
||||
<div class="form-floating">
|
||||
<input type="datetime" class="form-control" @bind="@CurrRecord.oraInizio3">
|
||||
<label class="small">Ora Inizio 3</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col px-0">
|
||||
<div class="form-floating">
|
||||
<input type="datetime" class="form-control" @bind="@CurrRecord.oraFine3">
|
||||
<label class="small">Ora Fine 3</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row g-1">
|
||||
<div class="col-md-10">
|
||||
<div class="form-floating">
|
||||
<textarea class="form-control" @bind="@CurrRecord.descOrario" rows="2" style="height: 6rem;"></textarea>
|
||||
<label class="small">Descrizione</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2 pt-2 d-flex align-items-center">
|
||||
<div class="w-100">
|
||||
<button class="btn btn-success my-1 w-100" @onclick="() => DoSave()"><i class="fas fa-floppy-disk"></i> Save</button>
|
||||
<button class="btn btn-warning my-1 w-100" @onclick="() => DoCancel()"><i class="fas fa-ban"></i> Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
using GPW.CORE.Data.DbModels;
|
||||
using GPW.CORE.Data.DTO;
|
||||
using GPW.CORE.Data.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace GPW.CORE.ADM.Components.Compo
|
||||
{
|
||||
public partial class OrarioEdit
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public AnagOrariModel? CurrRecord { get; set; } = null;
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<bool> EC_update { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public List<TagFasiDTO> ListTagFasi { get; set; } = null!;
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected GpwDataService GDataServ { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected async Task DoCancel()
|
||||
{
|
||||
await EC_update.InvokeAsync(true);
|
||||
}
|
||||
|
||||
protected async Task DoSave()
|
||||
{
|
||||
bool fatto = false;
|
||||
await Task.Delay(1);
|
||||
if (CurrRecord != null)
|
||||
{
|
||||
fatto = await GDataServ.AnagOrarioUpsert(CurrRecord, codOrarioOrig);
|
||||
}
|
||||
await EC_update.InvokeAsync(fatto);
|
||||
}
|
||||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
codOrarioOrig = CurrRecord.codOrario;
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private string codOrarioOrig = "";
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
@if (RecordEdit != null)
|
||||
{
|
||||
<div class="modal fade show" tabindex="-1" style="display:block; background-color: rgba(10,10,10,.6);" aria-modal="true" role="dialog" data-keyboard="true">
|
||||
<div class="modal-dialog modal-xl">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title">Modifica Orario <b>@RecordEdit.codOrario</b></h4>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close" @onclick="()=> ForceReload(true)"></button>
|
||||
</div>
|
||||
<div class="modal-body p-1">
|
||||
<OrarioEdit CurrRecord=@RecordEdit EC_update=ForceReload></OrarioEdit>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
<div class="card shadow">
|
||||
<div class="card-header">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-0">
|
||||
<h3>Gestione Orario</h3>
|
||||
</div>
|
||||
<div class="px-0">
|
||||
<button class="btn btn-success" @onclick="AddNew"><i class="fas fa-plus"></i> Add New</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body p-1">
|
||||
@if (ListRecords == null || isLoading)
|
||||
{
|
||||
<EgwCoreLib.Razor.LoadingData></EgwCoreLib.Razor.LoadingData>
|
||||
}
|
||||
else if (totalCount == 0)
|
||||
{
|
||||
<div class="alert alert-info">Nessun record trovato</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<table class="table table-striped table-sm text-start">
|
||||
<thead>
|
||||
<tr class="">
|
||||
<th>
|
||||
<button class="btn btn-primary btn-sm" @onclick="() => ForceReload(true)"><i class="fa-solid fa-rotate"></i></button>
|
||||
</th>
|
||||
<th>Cod <Sorter ParamName="Cod" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th>Descrizione <Sorter ParamName="Descrizione" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th>Lun</th>
|
||||
<th>Mar</th>
|
||||
<th>Mer</th>
|
||||
<th>Gio</th>
|
||||
<th>Ven</th>
|
||||
<th>Sab</th>
|
||||
<th>Dom</th>
|
||||
<th>Ordin <Sorter ParamName="Ordin" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th>Straord <Sorter ParamName="Straord" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th>Comp <Sorter ParamName=">Comp" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th>Inizio 1</th>
|
||||
<th>Fine 1</th>
|
||||
<th>Inizio 2</th>
|
||||
<th>Fine 2</th>
|
||||
<th>Inizio 3</th>
|
||||
<th>Fine 3</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in ListRecords)
|
||||
{
|
||||
<tr class="align-middle @CheckSel(item)">
|
||||
<td>
|
||||
@if (RecordEdit == null)
|
||||
{
|
||||
<button class="btn btn-primary btn-sm" @onclick="() => DoEdit(item)"><i class="fa-solid fa-edit"></i></button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="btn btn-secondary btn-sm" disabled><i class="fa-solid fa-edit"></i></button>
|
||||
}
|
||||
</td>
|
||||
<td>
|
||||
<div class="fw-bold fs-5">
|
||||
@item.codOrario
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
@item.descOrario
|
||||
</td>
|
||||
<td>@item.oreLun</td>
|
||||
<td>@item.oreMar</td>
|
||||
<td>@item.oreMer</td>
|
||||
<td>@item.oreGio</td>
|
||||
<td>@item.oreVen</td>
|
||||
<td>@item.oreSab</td>
|
||||
<td>@item.oreDom</td>
|
||||
<td>@item.oreOrdSett</td>
|
||||
<td>@item.oreStraordAss</td>
|
||||
<td>
|
||||
<input class="form-check-input" type="checkbox" disabled @bind="@item.autoCompOreOrd">
|
||||
</td>
|
||||
<td>@item.oraInizio1</td>
|
||||
<td>@item.oraFine1</td>
|
||||
<td>@item.oraInizio2</td>
|
||||
<td>@item.oraFine2</td>
|
||||
<td>@item.oraInizio3</td>
|
||||
<td>@item.oraFine3</td>
|
||||
<td>
|
||||
@if (item.DipendentiNav == null || item.DipendentiNav.Count == 0)
|
||||
{
|
||||
<button class="btn btn-danger btn-sm" @onclick="() => DoDelete(item)"><i class="fa-solid fa-trash"></i></button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="btn btn-secondary btn-sm" disabled><i class="fa-solid fa-trash"></i></button>
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<EgwCoreLib.Razor.DataPager PageSize="@numRecord" currPage="@currPage" numRecordChanged="SetNumRec" numPageChanged="SetPage" totalCount="@totalCount" showLoading="@isLoading"></EgwCoreLib.Razor.DataPager>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,256 @@
|
||||
using EgwCoreLib.Razor;
|
||||
using GPW.CORE.Data.DbModels;
|
||||
using GPW.CORE.Data.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using NLog;
|
||||
using static EgwCoreLib.Razor.Toggler;
|
||||
|
||||
namespace GPW.CORE.ADM.Components.Compo
|
||||
{
|
||||
public partial class OrarioMan : IDisposable
|
||||
{
|
||||
#region Public Methods
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
AppMServ.EA_SearchUpdated -= AppMServ_EA_SearchUpdated;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected MessageService AppMServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected GpwDataService GDataServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected string CheckSel(AnagOrariModel curItem)
|
||||
{
|
||||
string answ = "";
|
||||
if (RecordEdit != null)
|
||||
{
|
||||
answ = curItem.codOrario == RecordEdit.codOrario ? "table-info" : "";
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
protected async void DoDelete(AnagOrariModel selItem)
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sicuro di voler eliminare il record?"))
|
||||
return;
|
||||
|
||||
isLoading = true;
|
||||
bool fatto = await GDataServ.AnagOrarioDelete(selItem);
|
||||
await ReloadData();
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
private void AddNew()
|
||||
{
|
||||
RecordEdit = new AnagOrariModel()
|
||||
{
|
||||
codOrario = "_000h",
|
||||
descOrario = "Nuovo Orario",
|
||||
oreLun = 8,
|
||||
oreMar = 8,
|
||||
oreMer = 8,
|
||||
oreGio = 8,
|
||||
oreVen = 8,
|
||||
autoCompOreOrd = true
|
||||
};
|
||||
}
|
||||
|
||||
protected void DoEdit(AnagOrariModel? selItem)
|
||||
{
|
||||
RecordEdit = selItem;
|
||||
}
|
||||
|
||||
protected async Task ForceReload(bool force)
|
||||
{
|
||||
RecordEdit = null;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
CurrSearch = "";
|
||||
AppMServ.SearchVal = "";
|
||||
AppMServ.EA_SearchUpdated += AppMServ_EA_SearchUpdated;
|
||||
numRecord = await AppMServ.NumRowGridGet(gridKey);
|
||||
}
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected async Task SetNumRec(int newNum)
|
||||
{
|
||||
numRecord = newNum;
|
||||
currPage = 1;
|
||||
await AppMServ.NumRowGridSet(gridKey, newNum);
|
||||
await InvokeAsync(ReloadData);
|
||||
}
|
||||
|
||||
protected async Task SetPage(int newNum)
|
||||
{
|
||||
currPage = newNum;
|
||||
await InvokeAsync(ReloadData);
|
||||
}
|
||||
|
||||
protected async Task SortRequested(Sorter.SortCallBack e)
|
||||
{
|
||||
sortField = e.ParamName;
|
||||
sortAsc = e.IsAscending;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
private string gridKey = "OrariMan";
|
||||
private AnagOrariModel? RecordEdit = null;
|
||||
private bool sortAsc = true;
|
||||
private string sortField = "";
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private int currPage { get; set; } = 1;
|
||||
private string CurrSearch { get; set; } = "";
|
||||
private bool isLoading { get; set; } = false;
|
||||
private List<AnagOrariModel>? ListRecords { get; set; } = null;
|
||||
private int numRecord { get; set; } = 10;
|
||||
private List<AnagOrariModel>? SearchRecords { get; set; } = null;
|
||||
private int totalCount { get; set; } = 0;
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private async void AppMServ_EA_SearchUpdated()
|
||||
{
|
||||
CurrSearch = AppMServ.SearchVal;
|
||||
await ReloadData();
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
private async Task ReloadData()
|
||||
{
|
||||
isLoading = true;
|
||||
ListRecords = null;
|
||||
try
|
||||
{
|
||||
SearchRecords = await GDataServ.AnagOrarioAll();
|
||||
// verifico filtro per ricerca
|
||||
if (!string.IsNullOrEmpty(CurrSearch))
|
||||
{
|
||||
SearchRecords = SearchRecords.Where(x => x.descOrario.Contains(CurrSearch, StringComparison.InvariantCultureIgnoreCase)).ToList();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error($"Eccezione in recupero dati{Environment.NewLine}{ex}");
|
||||
}
|
||||
totalCount = SearchRecords.Count;
|
||||
SortTable();
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
private void SortTable()
|
||||
{
|
||||
if (SearchRecords != null)
|
||||
{
|
||||
// se ho ordinamento riordino...
|
||||
if (!string.IsNullOrEmpty(sortField))
|
||||
{
|
||||
switch (sortField)
|
||||
{
|
||||
case "Cod":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.codOrario).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.codOrario).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "Descrizione":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.descOrario).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.descOrario).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "Ordin":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.oreOrdSett).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.oreOrdSett).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "Straord":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.oreStraordAss).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.oreStraordAss).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "Comp":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.autoCompOreOrd).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.autoCompOreOrd).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// filtro x display
|
||||
ListRecords = SearchRecords
|
||||
.Skip(numRecord * (currPage - 1))
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
ListRecords = new List<AnagOrariModel>();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
<div class="row g-1">
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-0">
|
||||
Budget
|
||||
<div><b>@($"{CurrRecord.budgetTime:N0}")</b> h</div>
|
||||
</div>
|
||||
<div class="px-0">
|
||||
<label class="small">Attivo</label>
|
||||
<div class="form-check form-switch">
|
||||
<input type="checkbox" class="form-check-input" @bind="@CurrRecord.Attivo" @bind:after=DoUpdate>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-0">
|
||||
Erogate
|
||||
<div><b>@($"{CurrRecord.totOre:N2}")</b> h</div>
|
||||
</div>
|
||||
<div class="px-0">
|
||||
<label class="small">% budget</label>
|
||||
<div><b>@($"{CurrRecord.totOre / CurrRecord.budgetTime:P1}")</b></div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-0">
|
||||
Mese Corr.
|
||||
<div><b>@($"{CurrRecord.totOreLast30:N2}")</b> h</div>
|
||||
</div>
|
||||
<div class="px-0">
|
||||
<label class="small">% budget</label>
|
||||
<div><b>@($"{CurrRecord.totOreLast30 / CurrRecord.budgetTime:P1}")</b></div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-0">
|
||||
Mese Prec.
|
||||
<div><b>@($"{CurrRecord.totOrePrevMont:N2}")</b> h</div>
|
||||
</div>
|
||||
<div class="px-0">
|
||||
<label class="small">% budget</label>
|
||||
<div><b>@($"{CurrRecord.totOrePrevMont / CurrRecord.budgetTime:P1}")</b></div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-0">
|
||||
Starred
|
||||
</div>
|
||||
<div class="px-0">
|
||||
<div class="form-check form-switch">
|
||||
<input type="checkbox" class="form-check-input" @bind="@CurrRecord.Starred" @bind:after=DoUpdate>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item bg-info bg-opacity-25 bg-gradient">
|
||||
<div class="d-flex justify-content-between">
|
||||
<h5>Duplica Progetto Corrente</h5>
|
||||
</div>
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-0">
|
||||
Nome
|
||||
</div>
|
||||
<div class="px-0">
|
||||
<input type="text" class="form-control text-end" @bind="@NewProjName"></input>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-0">
|
||||
Sost. anno in fasi
|
||||
</div>
|
||||
<div class="px-0">
|
||||
<div class="form-check form-switch">
|
||||
<input type="checkbox" class="form-check-input" @bind="@DoYearSubst">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<button class="btn btn-primary w-100" @onclick=DoClone><i class="fa-regular fa-clone"></i> Duplica</button>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -0,0 +1,72 @@
|
||||
using GPW.CORE.Data.DbModels;
|
||||
using GPW.CORE.Data.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
|
||||
namespace GPW.CORE.ADM.Components.Compo
|
||||
{
|
||||
public partial class ProgettiDetail
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public CalcOreProgettiModel? CurrRecord { get; set; } = null;
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<bool> EC_update { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected GpwDataService GDataServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected async Task DoUpdate()
|
||||
{
|
||||
await GDataServ.AnagProjUpdStatus(CurrRecord.IdxProgetto, CurrRecord.Attivo ?? true, CurrRecord.Starred ?? false);
|
||||
}
|
||||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
NewProjName = CurrRecord.NomeProj;
|
||||
DoYearSubst = true;
|
||||
}
|
||||
|
||||
protected async Task DoClone()
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sicuro di voler procedere con la clonazione del progetto(+fasi) selezionato?"))
|
||||
return;
|
||||
|
||||
bool fatto = false;
|
||||
await Task.Delay(1);
|
||||
if (CurrRecord != null)
|
||||
{
|
||||
fatto = await GDataServ.AnagProjDoClone(CurrRecord.IdxProgetto, NewProjName, DoYearSubst);
|
||||
// se fatto ricalcolo...
|
||||
if (fatto)
|
||||
{
|
||||
await GDataServ.AnagProjForceUpdate();
|
||||
}
|
||||
}
|
||||
await EC_update.InvokeAsync(fatto);
|
||||
}
|
||||
|
||||
private string NewProjName = "";
|
||||
private bool DoYearSubst = true;
|
||||
|
||||
protected async Task DoCancel()
|
||||
{
|
||||
await EC_update.InvokeAsync(true);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
<div class="row g-1">
|
||||
<div class="col-md-3">
|
||||
<div class="form-floating">
|
||||
<div class="form-control">
|
||||
<select @bind="@CurrRecord.Gruppo" class="form-select form-select-sm" title="Gruppo">
|
||||
<option value="">--- Selezionare ---</option>
|
||||
@foreach (var item in ListGruppi)
|
||||
{
|
||||
<option value="@item.Gruppo">@item.DescrGruppo</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
<label class="small">Gruppo</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="form-floating">
|
||||
<div class="form-control">
|
||||
<select @bind="@CurrRecord.IdxCliente" class="form-select form-select-sm" title="Cliente">
|
||||
<option value="0">--- Selezionare ---</option>
|
||||
@foreach (var item in ListClienti)
|
||||
{
|
||||
<option value="@item.IdxCliente">@item.RagSociale</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
<label class="small">Rag.Sociale</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" @bind="@CurrRecord.NomeProj">
|
||||
<label class="small">Nome</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
<div class="form-floating">
|
||||
<div class="form-control">
|
||||
<div class="form-check form-switch">
|
||||
<input type="checkbox" class="form-check-input" @bind="@CurrRecord.Attivo">
|
||||
</div>
|
||||
</div>
|
||||
<label class="small">Att.</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
<div class="form-floating">
|
||||
<span class="form-control">
|
||||
<span class="form-check form-switch">
|
||||
<input type="checkbox" class="form-check-input" @bind="@CurrRecord.Starred">
|
||||
</span>
|
||||
</span>
|
||||
<label class="small">Starred</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row g-1">
|
||||
<div class="col-md-10">
|
||||
<div class="form-floating">
|
||||
<textarea class="form-control" @bind="@CurrRecord.DescrProj" rows="2" style="height: 9rem;"></textarea>
|
||||
<label class="small">Descr</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2 pt-2 d-flex align-items-center">
|
||||
<div class="w-100">
|
||||
<button class="btn btn-success my-1 w-100" @onclick="() => DoSave()"><i class="fas fa-floppy-disk"></i> Save</button>
|
||||
<button class="btn btn-warning my-1 w-100" @onclick="() => DoCancel()"><i class="fas fa-ban"></i> Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
using GPW.CORE.Data.DbModels;
|
||||
using GPW.CORE.Data.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace GPW.CORE.ADM.Components.Compo
|
||||
{
|
||||
public partial class ProgettiEdit
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public AnagProgettiModel? CurrRecord { get; set; } = null;
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<bool> EC_update { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public List<AnagClientiModel> ListClienti { get; set; } = null!;
|
||||
|
||||
[Parameter]
|
||||
public List<AnagGruppiModel> ListGruppi { get; set; } = null!;
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected GpwDataService GDataServ { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected async Task DoCancel()
|
||||
{
|
||||
await EC_update.InvokeAsync(true);
|
||||
}
|
||||
|
||||
protected async Task DoSave()
|
||||
{
|
||||
bool fatto = false;
|
||||
await Task.Delay(1);
|
||||
if (CurrRecord != null)
|
||||
{
|
||||
fatto = await GDataServ.AnagProjUpsert(CurrRecord);
|
||||
// se fatto ricalcolo...
|
||||
if (fatto)
|
||||
{
|
||||
await GDataServ.AnagProjForceUpdate();
|
||||
}
|
||||
}
|
||||
await EC_update.InvokeAsync(fatto);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,261 @@
|
||||
@if (!ShowFasi && (RecordEdit != null || RecordSel != null))
|
||||
{
|
||||
<div class="modal fade show" tabindex="-1" style="display:block; background-color: rgba(10,10,10,.6);" aria-modal="true" role="dialog" data-keyboard="true">
|
||||
<div class="modal-dialog @modalSize">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
@if (FullEdit)
|
||||
{
|
||||
<h4 class="modal-title">Modifica Progetto <b>@RecordEdit.IdxProgetto</b></h4>
|
||||
}
|
||||
else
|
||||
{
|
||||
<h4 class="modal-title">Resoconto Progetto <b>@RecordSel.IdxProgetto</b></h4>
|
||||
}
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close" @onclick=ForceReload></button>
|
||||
</div>
|
||||
<div class="modal-body p-1 small">
|
||||
@if (FullEdit)
|
||||
{
|
||||
<ProgettiEdit CurrRecord=@RecordEdit EC_update="ForceReload" ListGruppi=@ListGruppi ListClienti=@ListClienti></ProgettiEdit>
|
||||
}
|
||||
else
|
||||
{
|
||||
<ProgettiDetail CurrRecord=@RecordSel EC_update="ForceReload"></ProgettiDetail>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
<div class="card shadow">
|
||||
<div class="card-header">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-0">
|
||||
<div class="d-flex">
|
||||
<div class="p-0">
|
||||
<h3>@Traduci("ManProg")</h3>
|
||||
</div>
|
||||
<div class="px-2">
|
||||
<button class="btn btn-warning" @onclick=DoRecalc><i class="fa-solid fa-arrows-rotate"></i> Force Recalc</button>
|
||||
</div>
|
||||
<div class="px-0">
|
||||
<button class="btn btn-success" @onclick=CreateNew tooltip="Add New"><i class="fa-solid fa-plus"></i> Add New</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="px-2 bg-secondary bg-opacity-25 bg-gradient rounded d-flex align-items-center">
|
||||
<div class="d-flex align-items-center">
|
||||
<div class="px-1">
|
||||
<div class="form-check form-switch">
|
||||
<input class="form-check-input" type="checkbox" role="switch" @bind=@ShowPrjArc @bind:after=@ForceReload>
|
||||
<label class="form-check-label">Mostra Archiviati</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="px-1">
|
||||
<div class="form-check form-switch">
|
||||
<input class="form-check-input" type="checkbox" role="switch" @bind=@ShowPrjZH @bind:after=@ForceReload>
|
||||
<label class="form-check-label">Mostra Vuoti</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="px-1">
|
||||
<div class="form-check form-switch">
|
||||
<input class="form-check-input" type="checkbox" role="switch" @bind=@ShowPrjStr @bind:after=@ForceReload>
|
||||
<label class="form-check-label">Mostra SOLO Starred</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="px-1">
|
||||
<div class="d-flex border rounded px-2">
|
||||
<div class="form-check py-1">
|
||||
<input class="form-check-input" type="checkbox" @bind="@ShowGruppo" @bind:after=@FixFilt>
|
||||
<label class="form-check-label text-nowrap">@SelGrpText</label>
|
||||
</div>
|
||||
@if (ShowGruppo)
|
||||
{
|
||||
<div class="input-group input-group-sm" title="Gruppo">
|
||||
<span class="input-group-text">
|
||||
<i class="far fa-object-group"></i>
|
||||
</span>
|
||||
<select @bind="@Gruppo" class="form-select form-select-sm" title="Gruppo" style="width:10rem;" @bind:after=@ForceReload>
|
||||
<option value="">--- Selezionare ---</option>
|
||||
@foreach (var item in ListGruppi)
|
||||
{
|
||||
<option value="@item.Gruppo">@item.DescrGruppo</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="px-0">
|
||||
<div class="d-flex border rounded px-2">
|
||||
<div class="form-check py-1">
|
||||
<input class="form-check-input" type="checkbox" @bind="@ShowCli" @bind:after=@FixFilt>
|
||||
<label class="form-check-label text-nowrap">@SelCliText</label>
|
||||
</div>
|
||||
@if (ShowCli)
|
||||
{
|
||||
<div class="input-group input-group-sm" title="Cliente">
|
||||
<span class="input-group-text">
|
||||
<i class="far fa-object-group"></i>
|
||||
</span>
|
||||
<select @bind="@IdxCliente" class="form-select form-select-sm" title="Cliente" style="width:10rem;" @bind:after=@ForceReload>
|
||||
<option value="0">--- Selezionare ---</option>
|
||||
@foreach (var item in ListClienti)
|
||||
{
|
||||
<option value="@item.IdxCliente">@item.RagSociale</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body p-1 small">
|
||||
@if (ListRecords == null || isLoading)
|
||||
{
|
||||
<EgwCoreLib.Razor.LoadingData></EgwCoreLib.Razor.LoadingData>
|
||||
}
|
||||
else if (totalCount == 0)
|
||||
{
|
||||
<div class="alert alert-info">Nessun record trovato</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<table class="table table-striped table-sm text-start small">
|
||||
<thead>
|
||||
<tr class="">
|
||||
<th>
|
||||
<button class="btn btn-primary btn-sm" @onclick="ForceReload"><i class="fa-solid fa-rotate"></i></button>
|
||||
</th>
|
||||
<th>Gruppo <Sorter ParamName="Gruppo" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th>RagSoc <Sorter ParamName="RagSoc" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th>Nome <Sorter ParamName="NomeProj" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th>Real/Bdgt <Sorter ParamName="OreTot" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th>Money <Sorter ParamName="Money" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@if (ShowFasi && RecordSel != null)
|
||||
{
|
||||
<tr class="align-middle @CheckSel(RecordSel)">
|
||||
<td class="text-nowrap">
|
||||
<button class="btn btn-secondary btn-sm" disabled><i class="fa-solid fa-search"></i></button>
|
||||
<button class="btn btn-secondary btn-sm" disabled><i class="fa-solid fa-edit"></i></button>
|
||||
<button class="btn btn-secondary btn-sm" disabled><i class="fa-solid fa-angles-right"></i></button>
|
||||
</td>
|
||||
<td class="text-nowrap">
|
||||
<div class="fw-bold">
|
||||
@RecordSel.Gruppo
|
||||
</div>
|
||||
</td>
|
||||
<td class="text-nowrap">
|
||||
<div class="fw-bold">
|
||||
@RecordSel.RagSociale
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<div>@RecordSel.NomeProj</div>
|
||||
<div class="small">@RecordSel.DescrProj</div>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="text-center py-1 @ColorByVal(RecordSel.totOre, RecordSel.budgetTime)">
|
||||
<b>@($"{RecordSel.totOre:N2}")</b> / @($"{RecordSel.budgetTime:N0}")
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
@if (RecordSel.budgetMoney > 0)
|
||||
{
|
||||
@($"{RecordSel.budgetMoney:C2}")
|
||||
}
|
||||
</td>
|
||||
<td class="text-end">
|
||||
<button class="btn btn-secondary btn-sm" disabled><i class="fa-solid fa-trash"></i></button>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
else
|
||||
{
|
||||
@foreach (var item in ListRecords)
|
||||
{
|
||||
<tr class="align-middle @CheckSel(item)">
|
||||
<td class="text-nowrap">
|
||||
@if (RecordEdit == null)
|
||||
{
|
||||
<button class="btn btn-info btn-sm" @onclick="() => DoSelect(item)"><i class="fa-solid fa-search"></i></button>
|
||||
<button class="btn btn-primary btn-sm" @onclick="() => DoEdit(item)"><i class="fa-solid fa-edit"></i></button>
|
||||
<button class="btn btn-warning btn-sm" @onclick="() => DoShowFasi(item)"><i class="fa-solid fa-angles-right"></i></button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="btn btn-secondary btn-sm" disabled><i class="fa-solid fa-search"></i></button>
|
||||
<button class="btn btn-secondary btn-sm" disabled><i class="fa-solid fa-edit"></i></button>
|
||||
<button class="btn btn-secondary btn-sm" disabled><i class="fa-solid fa-angles-right"></i></button>
|
||||
}
|
||||
</td>
|
||||
<td class="text-nowrap">
|
||||
<div class="fw-bold">
|
||||
@item.Gruppo
|
||||
</div>
|
||||
</td>
|
||||
<td class="text-nowrap">
|
||||
<div class="fw-bold">
|
||||
@item.RagSociale
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<div>@item.NomeProj</div>
|
||||
<div class="small">@item.DescrProj</div>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="text-center py-1 @ColorByVal(item.totOre, item.budgetTime)">
|
||||
<b>@($"{item.totOre:N2}")</b> / @($"{item.budgetTime:N0}")
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
@if (item.budgetMoney > 0)
|
||||
{
|
||||
@($"{item.budgetMoney:C2}")
|
||||
}
|
||||
</td>
|
||||
<td class="text-end">
|
||||
@if (item.totOre == 0)
|
||||
{
|
||||
<button class="btn btn-danger btn-sm" @onclick="() => DoDelete(item)"><i class="fa-solid fa-trash"></i></button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="btn btn-secondary btn-sm" disabled><i class="fa-solid fa-trash"></i></button>
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
@if(ShowFasi)
|
||||
{
|
||||
<FasiMan ListRecords=@ListFasiSel EC_update=ReloadFasi ShowSelect="false"></FasiMan>
|
||||
}
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
@if (!ShowFasi)
|
||||
{
|
||||
<EgwCoreLib.Razor.DataPager PageSize="@numRecord" currPage="@currPage" numRecordChanged="SetNumRec" numPageChanged="SetPage" totalCount="@totalCount" showLoading="@isLoading"></EgwCoreLib.Razor.DataPager>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -0,0 +1,499 @@
|
||||
using EgwCoreLib.Razor;
|
||||
using GPW.CORE.Data.DbModels;
|
||||
using GPW.CORE.Data.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.DataProtection;
|
||||
using Microsoft.JSInterop;
|
||||
using NLog;
|
||||
using static EgwCoreLib.Razor.Toggler;
|
||||
|
||||
namespace GPW.CORE.ADM.Components.Compo
|
||||
{
|
||||
public partial class ProgettiMan : IDisposable
|
||||
{
|
||||
#region Public Methods
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
AppMServ.EA_SearchUpdated -= AppMServ_EA_SearchUpdated;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected MessageService AppMServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected AppAuthService AuthServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected GpwDataService GDataServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; } = null!;
|
||||
|
||||
protected List<AnagClientiModel> ListClienti { get; set; } = new List<AnagClientiModel>();
|
||||
|
||||
protected List<AnagGruppiModel> ListGruppi { get; set; } = new List<AnagGruppiModel>();
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected string CheckSel(CalcOreProgettiModel curItem)
|
||||
{
|
||||
string answ = "";
|
||||
if (RecordEdit != null)
|
||||
{
|
||||
answ = curItem.IdxProgetto == RecordEdit.IdxProgetto ? "table-info" : "";
|
||||
}
|
||||
// verifico stato attivo
|
||||
answ += !(curItem.Attivo ?? false) ? " striked" : "";
|
||||
return answ;
|
||||
}
|
||||
|
||||
protected async Task CreateNew()
|
||||
{
|
||||
FullEdit = true;
|
||||
RecordSel = null;
|
||||
RecordEdit = new AnagProgettiModel()
|
||||
{
|
||||
NomeProj = "__Nuovo Progetto",
|
||||
DescrProj = "Descrizione nuovo progetto",
|
||||
Gruppo = "",
|
||||
IdxCliente = 0,
|
||||
Attivo = true
|
||||
};
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
protected async void DoDelete(CalcOreProgettiModel selItem)
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sicuro di voler eliminare il record?"))
|
||||
return;
|
||||
|
||||
isLoading = true;
|
||||
await Task.Delay(1);
|
||||
await InvokeAsync(StateHasChanged);
|
||||
RecordSel = null;
|
||||
RecordEdit = GDataServ.AnagProjByKey(selItem.IdxProgetto);
|
||||
bool fatto = await GDataServ.AnagProjDelete(RecordEdit);
|
||||
if (fatto)
|
||||
{
|
||||
await Task.Delay(1);
|
||||
await GDataServ.AnagProjForceUpdate();
|
||||
}
|
||||
RecordEdit = null;
|
||||
await ReloadData();
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
protected void DoEdit(CalcOreProgettiModel? selItem)
|
||||
{
|
||||
FullEdit = true;
|
||||
ShowFasi = false;
|
||||
RecordSel = null;
|
||||
RecordEdit = GDataServ.AnagProjByKey(selItem.IdxProgetto);
|
||||
}
|
||||
|
||||
protected async Task DoRecalc()
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sicuro di voler forzare il ricalcolo dei record?"))
|
||||
return;
|
||||
|
||||
isLoading = true;
|
||||
await Task.Delay(1);
|
||||
await InvokeAsync(StateHasChanged);
|
||||
await GDataServ.AnagProjForceUpdate();
|
||||
await Task.Delay(1);
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected void DoSelect(CalcOreProgettiModel? selItem)
|
||||
{
|
||||
FullEdit = false;
|
||||
ShowFasi = false;
|
||||
RecordSel = selItem;
|
||||
RecordEdit = null;
|
||||
}
|
||||
|
||||
protected async Task DoShowFasi(CalcOreProgettiModel? selItem)
|
||||
{
|
||||
FullEdit = false;
|
||||
// carico le fasi e le asso al controllo!
|
||||
ListFasiSel = await GDataServ.AnagFasiExplByProj(selItem.IdxProgetto);
|
||||
ShowFasi = true;
|
||||
RecordSel = selItem;
|
||||
RecordEdit = null;
|
||||
}
|
||||
|
||||
protected async Task ForceReload()
|
||||
{
|
||||
await salvaFiltToggle();
|
||||
await salvaFiltGrpCli();
|
||||
FullEdit = false;
|
||||
ShowFasi = false;
|
||||
RecordEdit = null;
|
||||
RecordSel = null;
|
||||
currPage = 1;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// init valori da config
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected async Task initConf()
|
||||
{
|
||||
// leggo conf standard controllo RegAtt
|
||||
var sWarningRatioPerc = await GDataServ.ConfigGetKeyAsync("WarningRatioPerc");
|
||||
if (sWarningRatioPerc != null)
|
||||
{
|
||||
double.TryParse(sWarningRatioPerc.valore, out warnRatio);
|
||||
}
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await initConf();
|
||||
CurrSearch = "";
|
||||
AppMServ.SearchVal = "";
|
||||
AppMServ.EA_SearchUpdated += AppMServ_EA_SearchUpdated;
|
||||
// recupero preferenze utente...
|
||||
await InitUserPref();
|
||||
}
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected async Task ReloadFasi()
|
||||
{
|
||||
// rileggo fasi associate...
|
||||
ListFasiSel = new List<AnagFasiExplModel>();
|
||||
await Task.Delay(1);
|
||||
//await InvokeAsync(StateHasChanged);
|
||||
// carico le fasi e le asso al controllo!
|
||||
ListFasiSel = await GDataServ.AnagFasiExplByProj(RecordSel.IdxProgetto);
|
||||
await Task.Delay(1);
|
||||
//await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
protected async Task SetNumRec(int newNum)
|
||||
{
|
||||
numRecord = newNum;
|
||||
currPage = 1;
|
||||
await AppMServ.NumRowGridSet(gridKey, newNum);
|
||||
await InvokeAsync(ReloadData);
|
||||
}
|
||||
|
||||
protected async Task SetPage(int newNum)
|
||||
{
|
||||
currPage = newNum;
|
||||
await InvokeAsync(ReloadData);
|
||||
}
|
||||
|
||||
protected async Task SortRequested(Sorter.SortCallBack e)
|
||||
{
|
||||
sortField = e.ParamName;
|
||||
sortAsc = e.IsAscending;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected string UserLang
|
||||
{
|
||||
get => AppMServ.UserLang;
|
||||
}
|
||||
|
||||
protected string Traduci(string lemma)
|
||||
{
|
||||
return AuthServ.Traduci(lemma, UserLang);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
private bool FullEdit = false;
|
||||
|
||||
private string gridKey = "ProgettiMan";
|
||||
|
||||
private AnagProgettiModel? RecordEdit = null;
|
||||
|
||||
private CalcOreProgettiModel? RecordSel = null;
|
||||
|
||||
private bool ShowFasi = false;
|
||||
|
||||
private bool sortAsc = true;
|
||||
|
||||
private string sortField = "";
|
||||
|
||||
private double warnRatio = 50;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private int currPage { get; set; } = 1;
|
||||
|
||||
private string CurrSearch { get; set; } = "";
|
||||
|
||||
private string Gruppo { get; set; } = "";
|
||||
|
||||
private int IdxCliente { get; set; } = 0;
|
||||
|
||||
private bool isLoading { get; set; } = false;
|
||||
|
||||
private List<AnagFasiExplModel>? ListFasiSel { get; set; } = null;
|
||||
|
||||
private List<CalcOreProgettiModel>? ListRecords { get; set; } = null;
|
||||
|
||||
private string modalSize
|
||||
{
|
||||
get => FullEdit ? "modal-xl" : "";
|
||||
}
|
||||
|
||||
private int numRecord { get; set; } = 10;
|
||||
|
||||
private List<CalcOreProgettiModel>? SearchRecords { get; set; } = null;
|
||||
|
||||
private string SelCliText
|
||||
{
|
||||
get => ShowCli ? "Elimina Filt." : "Filt.Clienti";
|
||||
}
|
||||
|
||||
private string SelGrpText
|
||||
{
|
||||
get => ShowGruppo ? "Elimina Filt." : "Filt.Gruppo";
|
||||
}
|
||||
|
||||
private bool ShowCli { get; set; } = false;
|
||||
|
||||
private bool ShowGruppo { get; set; } = false;
|
||||
|
||||
private bool ShowPrjArc { get; set; } = false;
|
||||
|
||||
private bool ShowPrjStr { get; set; } = false;
|
||||
|
||||
private bool ShowPrjZH { get; set; } = true;
|
||||
|
||||
private int totalCount { get; set; } = 0;
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private async void AppMServ_EA_SearchUpdated()
|
||||
{
|
||||
CurrSearch = AppMServ.SearchVal;
|
||||
await ReloadData();
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// restituisce una classe css a seconda dei valori passati:
|
||||
/// green: bdgt > real
|
||||
/// orange: real > bdgt*warning
|
||||
/// red: real > bdgt
|
||||
/// std: errore...
|
||||
/// </summary>
|
||||
/// <param name="real"></param>
|
||||
/// <param name="bdgt"></param>
|
||||
/// <returns></returns>
|
||||
private string ColorByVal(object real, object bdgt)
|
||||
{
|
||||
string specClass = "default";
|
||||
try
|
||||
{
|
||||
double valoreReal = Convert.ToDouble(real);
|
||||
double valoreBdget = Convert.ToDouble(bdgt);
|
||||
double valoreWarn = Convert.ToDouble(bdgt) * warnRatio / 100;
|
||||
if (valoreReal >= valoreBdget)
|
||||
{
|
||||
specClass = "danger";
|
||||
}
|
||||
else if (valoreReal >= valoreWarn)
|
||||
{
|
||||
specClass = "warning";
|
||||
}
|
||||
else
|
||||
{
|
||||
specClass = "success";
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return $" bg-{specClass} bg-opacity-50 bg-gradient border border-{specClass} rounded";
|
||||
}
|
||||
|
||||
private async Task FixFilt()
|
||||
{
|
||||
if (!ShowGruppo)
|
||||
{
|
||||
Gruppo = "";
|
||||
}
|
||||
if (!ShowCli)
|
||||
{
|
||||
IdxCliente = 0;
|
||||
}
|
||||
currPage = 1;
|
||||
await salvaFiltGrpCli();
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Init preferenze utente
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private async Task InitUserPref()
|
||||
{
|
||||
try
|
||||
{
|
||||
numRecord = await AppMServ.NumRowGridGet(gridKey);
|
||||
ShowPrjArc = await AppMServ.UserPrefGet<bool>("ShowPrjArc");
|
||||
ShowPrjStr = await AppMServ.UserPrefGet<bool>("ShowPrjStr");
|
||||
ShowPrjZH = await AppMServ.UserPrefGet<bool>("ShowPrjZH");
|
||||
ShowGruppo = await AppMServ.UserPrefGet<bool>("ShowGruppo");
|
||||
ShowCli = await AppMServ.UserPrefGet<bool>("ShowCli");
|
||||
Gruppo = await AppMServ.UserPrefGet<string>("Gruppo") ?? "";
|
||||
IdxCliente = await AppMServ.UserPrefGet<int>("IdxCliente");
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione in InitUserPref{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
|
||||
private async Task ReloadData()
|
||||
{
|
||||
isLoading = true;
|
||||
ListRecords = null;
|
||||
ListGruppi = await GDataServ.AnagGruppiAll();
|
||||
ListClienti = await GDataServ.AnagClientiAllAsync();
|
||||
try
|
||||
{
|
||||
SearchRecords = await GDataServ.AnagProjCalcFilt(Gruppo, IdxCliente, ShowPrjArc, ShowPrjZH, ShowPrjStr);
|
||||
// verifico filtro per ricerca
|
||||
if (!string.IsNullOrEmpty(CurrSearch))
|
||||
{
|
||||
SearchRecords = SearchRecords
|
||||
.Where(x => x.NomeProj.Contains(CurrSearch, StringComparison.InvariantCultureIgnoreCase)
|
||||
|| x.DescrProj.Contains(CurrSearch, StringComparison.InvariantCultureIgnoreCase))
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error($"Eccezione in recupero dati{Environment.NewLine}{ex}");
|
||||
}
|
||||
totalCount = SearchRecords.Count;
|
||||
SortTable();
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
private async Task salvaFiltGrpCli()
|
||||
{
|
||||
// salvo
|
||||
await AppMServ.UserPrefSet("ShowGruppo", $"{ShowGruppo}");
|
||||
await AppMServ.UserPrefSet("ShowCli", $"{ShowCli}");
|
||||
await AppMServ.UserPrefSet("Gruppo", $"{Gruppo}");
|
||||
await AppMServ.UserPrefSet("IdxCliente", $"{IdxCliente}");
|
||||
}
|
||||
|
||||
private async Task salvaFiltToggle()
|
||||
{
|
||||
// salvo le preferenze...
|
||||
await AppMServ.UserPrefSet("ShowPrjArc", $"{ShowPrjArc}");
|
||||
await AppMServ.UserPrefSet("ShowPrjStr", $"{ShowPrjStr}");
|
||||
await AppMServ.UserPrefSet("ShowPrjZH", $"{ShowPrjZH}");
|
||||
}
|
||||
|
||||
private void SortTable()
|
||||
{
|
||||
if (SearchRecords != null)
|
||||
{
|
||||
// se ho ordinamento riordino...
|
||||
if (!string.IsNullOrEmpty(sortField))
|
||||
{
|
||||
switch (sortField)
|
||||
{
|
||||
case "Gruppo":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.Gruppo).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.Gruppo).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "RagSoc":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.RagSociale).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.RagSociale).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "NomeProj":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.NomeProj).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.NomeProj).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "OreTot":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.totOre).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.totOre).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "Money":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.budgetMoney).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.budgetMoney).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// filtro x display
|
||||
ListRecords = SearchRecords
|
||||
.Skip(numRecord * (currPage - 1))
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
ListRecords = new List<CalcOreProgettiModel>();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<div class="card shadow">
|
||||
<div class="card-header">
|
||||
<h5>Record Commesse</h5>
|
||||
</div>
|
||||
<div class="card-body py-0 px-2">
|
||||
@if (ListRecord == null || ListRecord.Count == 0)
|
||||
{
|
||||
<div class="alert alert-info p-2 my-1">Nessun record trovato</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<table class="table table-sm table-striped table-responsive-md">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Dettaglio</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in ListRecord)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-0"><b>@item.FasiNav.ProgettoNav.ClienteNav.RagSociale</b> | @item.FasiNav.ProgettoNav.NomeProj</div>
|
||||
<div class="badge text-bg-dark">@($"{item.Inizio:HH:mm}") - @($"{item.Fine:HH:mm}")</div>
|
||||
</div>
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-0 text-success">@item.FasiNav.DescrizioneFase</div>
|
||||
<div class="px-0">@($"{item.Durata.TotalHours:N2} h")</div>
|
||||
</div>
|
||||
<div class="d-flex">
|
||||
<div class="px-0 small">@item.Descrizione</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
using GPW.CORE.Data.DbModels;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace GPW.CORE.ADM.Components.Compo
|
||||
{
|
||||
public partial class RAList
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<RegAttivitaModel> EC_ReqDelete { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<RegAttivitaModel> EC_ReqUpdate { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public bool EnableDelete { get; set; } = false;
|
||||
|
||||
[Parameter]
|
||||
public bool EnableEdit { get; set; } = false;
|
||||
|
||||
[Parameter]
|
||||
public List<RegAttivitaModel>? ListRecord
|
||||
{
|
||||
get => listRec;
|
||||
|
||||
set => listRec = value;
|
||||
}
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected List<RegAttivitaModel>? listRec
|
||||
{
|
||||
get
|
||||
{
|
||||
return _ListRec;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value != null)
|
||||
{
|
||||
_ListRec = value.OrderBy(x => x.Inizio).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
_ListRec = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected async void Delete(RegAttivitaModel currRecord)
|
||||
{
|
||||
await EC_ReqDelete.InvokeAsync(currRecord);
|
||||
}
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private List<RegAttivitaModel>? _ListRec { get; set; } = new List<RegAttivitaModel>();
|
||||
|
||||
#endregion Private Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
@if (isLoading)
|
||||
{
|
||||
<LoadingData></LoadingData>
|
||||
}
|
||||
else
|
||||
{ @if (isSendingData)
|
||||
{
|
||||
<ProgressDisplay Title="Salvataggio ed invio richiesta" CurrVal="@sendDataVal" NextVal="@sendDataNextVal" MaxVal="@sendDataMaxVal" ExpTimeMSec="1000"></ProgressDisplay>
|
||||
}
|
||||
@if (ListRecords == null)
|
||||
{
|
||||
<LoadingData DisplaySize="LoadingData.CtrlSize.Small"></LoadingData>
|
||||
}
|
||||
else
|
||||
{
|
||||
@if (showAdd)
|
||||
{
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-0">
|
||||
<b>Inizio Malattia</b>
|
||||
</div>
|
||||
<div class="px-2">
|
||||
@($"{currRecord.DtInizio:yyyy-MM-dd dddd}")
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-0">
|
||||
<b>Giorni Malattia</b>
|
||||
</div>
|
||||
<div class="px-2">
|
||||
@currRecord.NumGG
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-0">
|
||||
<b>Codice Certificato (INPS)</b>
|
||||
</div>
|
||||
<div class="px-2">
|
||||
@currRecord.CodCert
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-0">
|
||||
<b>Stato</b>
|
||||
<span class="small">(confermato)</span>
|
||||
</div>
|
||||
<div class="px-0">
|
||||
<div class="form-check form-switch">
|
||||
<input class="form-check-input" type="checkbox" role="switch" @bind="@currRecord.Conf">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<button class="btn btn-warning w-100" @onclick="() => ToggleEdit()"><i class="fas fa-window-close"></i> Cancel</button>
|
||||
</div>
|
||||
<div class="col">
|
||||
@if (currRecord.CodCert != "")
|
||||
{
|
||||
<button class="btn btn-success w-100" @onclick="() => DoSave()"><i class="far fa-save"></i> Update</button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="btn btn-secondary w-100" disabled><i class="far fa-save"></i> Update</button>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
}
|
||||
@if (ListRecords.Count == 0)
|
||||
{
|
||||
<div class="alert alert-warning">
|
||||
<h4>Nessu record registrato!</h4>
|
||||
<button class="btn btn-success btn-sm" @onclick="() => ToggleEdit()"><i class="fas fa-plus"></i> Inserisci Malattia</button>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<table class="table table-sm table-striped table-responsive-md border border-dark">
|
||||
<thead>
|
||||
<tr class="bg-dark text-light">
|
||||
<th>
|
||||
<button class="btn btn-success btn-sm" @onclick="() => ToggleEdit()"><i class="fas fa-plus"></i></button>
|
||||
</th>
|
||||
<th>Data</th>
|
||||
<th class="text-center">Giorni</th>
|
||||
<th class="text-end">Codice</th>
|
||||
<th class="text-end"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in ListRecords)
|
||||
{
|
||||
<tr>
|
||||
<td class="text-nowrap">
|
||||
@item.DipNav.Abbrev
|
||||
</td>
|
||||
<td>
|
||||
@item.DtInizio.ToString("dd MMM yyyy"), <b>@item.DtInizio.ToString("dddd")</b>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
@item.NumGG
|
||||
</td>
|
||||
<td class="text-end">
|
||||
@item.CodCert
|
||||
</td>
|
||||
<td class="text-end">
|
||||
@if (!item.Conf)
|
||||
{
|
||||
<button class="btn btn-success btn-sm" @onclick="() => DoApprove(item)"><i class="fa-solid fa-thumbs-up"></i></button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="btn btn-primary btn-sm" @onclick="() => DoEdit(item)"><i class="fas fa-pen"></i></button>
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div>
|
||||
<EgwCoreLib.Razor.DataPager PageSize="@numRecord" currPage="@currPage" numRecordChanged="SetNumRec" numPageChanged="SetPage" totalCount="@totalCount" showLoading="@isLoading" NumPages="10" PageSizeList="@PageSizeListSpec"></EgwCoreLib.Razor.DataPager>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,224 @@
|
||||
using GPW.CORE.Data.DbModels;
|
||||
using GPW.CORE.Data.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using NLog;
|
||||
|
||||
namespace GPW.CORE.ADM.Components.Compo
|
||||
{
|
||||
public partial class RegMalattia
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public DateTime DtEnd { get; set; } = new DateTime(DateTime.Today.Year + 1, 1, 1);
|
||||
|
||||
[Parameter]
|
||||
public DateTime DtStart { get; set; } = new DateTime(DateTime.Today.Year, 1, 1);
|
||||
|
||||
[Parameter]
|
||||
public bool isLoading { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<bool> ReportUpdate { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected List<int> PageSizeListSpec = new List<int>() { 5, 10, 15, 20 };
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected MessageService AppMServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected GpwDataService GDataServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
// recupero preferenze utente...
|
||||
await InitUserPref();
|
||||
}
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
currPage = 1;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected async Task SetNumRec(int newNum)
|
||||
{
|
||||
numRecord = newNum;
|
||||
currPage = 1;
|
||||
await AppMServ.NumRowGridSet(gridKey, newNum);
|
||||
await InvokeAsync(ReloadData);
|
||||
}
|
||||
|
||||
protected async Task SetPage(int newNum)
|
||||
{
|
||||
currPage = newNum;
|
||||
await InvokeAsync(ReloadData);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
private string gridKey = "RegMalattie";
|
||||
|
||||
private bool isSendingData = false;
|
||||
|
||||
private List<RegMalattieModel>? ListRecords = null;
|
||||
private List<RegMalattieModel>? SearchRecords = null;
|
||||
|
||||
private int sendDataMaxVal = 100;
|
||||
|
||||
private int sendDataNextVal = 0;
|
||||
|
||||
private int sendDataVal = 0;
|
||||
|
||||
private bool showAdd = false;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private int currPage { get; set; } = 1;
|
||||
|
||||
private RegMalattieModel currRecord { get; set; } = new RegMalattieModel();
|
||||
|
||||
private string NomeDip
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = "per cortesia";
|
||||
if (AppMServ != null && AppMServ.RigaDip != null)
|
||||
{
|
||||
answ = $"{AppMServ.RigaDip.Nome}";
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
private int numRecord { get; set; } = 10;
|
||||
|
||||
private int totalCount { get; set; } = 0;
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private async Task DoApprove(RegMalattieModel selItem)
|
||||
{
|
||||
// chiedo verifica
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Confermi approvazione?"))
|
||||
return;
|
||||
|
||||
await Task.Delay(1);
|
||||
isSendingData = true;
|
||||
sendDataVal = 0;
|
||||
sendDataNextVal = 5;
|
||||
await Task.Delay(1);
|
||||
await InvokeAsync(StateHasChanged);
|
||||
// effettuo insert...
|
||||
sendDataVal = 5;
|
||||
sendDataNextVal = 90;
|
||||
await Task.Delay(1);
|
||||
await GDataServ.RegMalattieApprova(selItem);
|
||||
sendDataVal = 100;
|
||||
sendDataNextVal = 100;
|
||||
await ReloadData();
|
||||
await Task.Delay(1);
|
||||
await ReportUpdate.InvokeAsync(true);
|
||||
isSendingData = false;
|
||||
}
|
||||
|
||||
private void DoEdit(RegMalattieModel selItem)
|
||||
{
|
||||
currRecord = selItem;
|
||||
showAdd = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registra il record
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private async Task DoSave()
|
||||
{
|
||||
// chiedo verifica
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Confermi modifica record?"))
|
||||
return;
|
||||
isSendingData = true;
|
||||
sendDataVal = 0;
|
||||
sendDataNextVal = 5;
|
||||
await Task.Delay(1);
|
||||
// effettuo insert...
|
||||
sendDataVal = 5;
|
||||
sendDataNextVal = 90;
|
||||
await Task.Delay(1);
|
||||
await GDataServ.RegMalattieAppRif(currRecord);
|
||||
// effettuo insert...
|
||||
sendDataVal = 100;
|
||||
sendDataNextVal = 100;
|
||||
// aggiorno display...
|
||||
await Task.Delay(1);
|
||||
showAdd = false;
|
||||
await ReloadData();
|
||||
await ReportUpdate.InvokeAsync(true);
|
||||
isSendingData = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Init preferenze utente
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private async Task InitUserPref()
|
||||
{
|
||||
try
|
||||
{
|
||||
numRecord = await AppMServ.NumRowGridGet(gridKey);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione in InitUserPref{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
|
||||
private async Task ReloadData()
|
||||
{
|
||||
SearchRecords = null;
|
||||
await Task.Delay(1);
|
||||
SearchRecords = GDataServ.RegMalattieGetByPeriod(DtStart, DtEnd);
|
||||
// conteggio!
|
||||
totalCount = SearchRecords.Count;
|
||||
// paginazione
|
||||
ListRecords = SearchRecords
|
||||
.OrderByDescending(x => x.DtInizio)
|
||||
.Skip(numRecord * (currPage - 1))
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
await Task.Delay(1);
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
private void ToggleEdit()
|
||||
{
|
||||
showAdd = !showAdd;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,212 @@
|
||||
@if (isLoading)
|
||||
{
|
||||
<LoadingData></LoadingData>
|
||||
}
|
||||
else
|
||||
{
|
||||
@if (isSendingData)
|
||||
{
|
||||
<ProgressDisplay Title="Salvataggio ed invio richiesta" CurrVal="@sendDataVal" NextVal="@sendDataNextVal" MaxVal="@sendDataMaxVal" ExpTimeMSec="1000"></ProgressDisplay>
|
||||
}
|
||||
@if (ListRecords == null)
|
||||
{
|
||||
<LoadingData DisplaySize="LoadingData.CtrlSize.Small"></LoadingData>
|
||||
}
|
||||
else
|
||||
{
|
||||
@if (showAdd)
|
||||
{
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-0">
|
||||
<b>Causale</b>
|
||||
</div>
|
||||
<div class="px-0">
|
||||
<div class="input-group input-group-sm">
|
||||
<select @bind="@CodGiust" class="form-select">
|
||||
<option value="">--- Selezionare Causale ---</option>
|
||||
@if (ListGiust != null)
|
||||
{
|
||||
@foreach (var giust in ListGiust)
|
||||
{
|
||||
<option value="@giust.codGiust">@giust.descrizione</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-0">
|
||||
<b>Inizio Periodo</b>
|
||||
</div>
|
||||
<div class="px-2">
|
||||
@if (@CodGiust == "PERM" || @CodGiust == "104")
|
||||
{
|
||||
@($"{dtStart:yyyy-MM-dd HH:mm}")
|
||||
}
|
||||
else
|
||||
{
|
||||
@($"{dtStart:yyyy-MM-dd}")
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-0">
|
||||
<b>Fine Periodo</b>
|
||||
</div>
|
||||
<div class="px-2">
|
||||
@if (@CodGiust == "PERM" || @CodGiust == "104")
|
||||
{
|
||||
@($"{dtEnd:yyyy-MM-dd HH:mm}")
|
||||
}
|
||||
else
|
||||
{
|
||||
@($"{dtEnd:yyyy-MM-dd}")
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-0">
|
||||
<b>Note</b>
|
||||
</div>
|
||||
<div class="px-0">
|
||||
<textarea class="form-control" @bind="@currRecord.Note" style="width: 20rem;" />
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-0">
|
||||
<b>Stato</b>
|
||||
<span class="small">(confermato)</span>
|
||||
</div>
|
||||
<div class="px-0">
|
||||
<div class="form-check form-switch">
|
||||
<input class="form-check-input" type="checkbox" role="switch" @bind="@currRecord.Conf">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<button class="btn btn-warning w-100" @onclick="toggleEdit"><i class="fas fa-window-close"></i> Cancel</button>
|
||||
</div>
|
||||
<div class="col">
|
||||
@if (CodGiust != "")
|
||||
{
|
||||
<button class="btn btn-success w-100" @onclick="() => DoSave()"><i class="far fa-save"></i> Save</button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="btn btn-secondary w-100" disabled><i class="far fa-save"></i> Causale!</button>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
}
|
||||
@if (ListRecords.Count == 0)
|
||||
{
|
||||
<div class="alert alert-warning d-flex justify-content-between">
|
||||
<div>
|
||||
Nessu record registrato
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<table class="table table-sm table-striped table-responsive-md border border-dark">
|
||||
<thead>
|
||||
<tr class="bg-dark text-light align-middle">
|
||||
<th></th>
|
||||
<th>Dipendente</th>
|
||||
<th>Periodo</th>
|
||||
<th class="text-end"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in ListRecords)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@if (!item.Conf)
|
||||
{
|
||||
<button class="btn btn-primary btn-sm" @onclick="() => DoEdit(item)">
|
||||
<b>@item.CodGiustTrim</b>
|
||||
</button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="btn btn-sm btn-secondary disabled">
|
||||
<b>@item.CodGiustTrim</b>
|
||||
</div>
|
||||
}
|
||||
</td>
|
||||
<td>
|
||||
<div class="fs-5">@item.DipNav.Abbrev</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
@if (item.CodGiust == "PERM")
|
||||
{
|
||||
<div class="d-flex justify-content-between pe-2">
|
||||
<div>
|
||||
@item.DtStart.ToString("dd MMM yyyy"), <b>@item.DtStart.ToString("HH:mm")</b>
|
||||
<i class="fas fa-caret-right"></i>
|
||||
<b>@item.DtEnd.ToString("HH:mm")</b>
|
||||
</div>
|
||||
<div>
|
||||
<b>@item.Durata</b>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="d-flex justify-content-between pe-2">
|
||||
<div>
|
||||
<b>@item.DtStart.ToString("dd MMM")</b> @item.DtStart.ToString("yyyy")
|
||||
<i class="fas fa-caret-right"></i>
|
||||
<b>@item.DtEnd.ToString("dd MMM")</b> @item.DtEnd.ToString("yyyy")
|
||||
</div>
|
||||
<div>
|
||||
<b>@item.Durata</b>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div class="small">
|
||||
@item.Note
|
||||
</div>
|
||||
</td>
|
||||
<td class="text-end">
|
||||
@if (!item.Conf)
|
||||
{
|
||||
<button class="btn btn-success btn-sm" @onclick="() => DoApprove(item)"><i class="fa-solid fa-thumbs-up"></i></button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="btn btn-primary btn-sm" @onclick="() => DoEdit(item)">
|
||||
<i class="fa-solid fa-pen-to-square"></i>
|
||||
</button>
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
<div>
|
||||
<EgwCoreLib.Razor.DataPager PageSize="@numRecord" currPage="@currPage" numRecordChanged="SetNumRec" numPageChanged="SetPage" totalCount="@totalCount" showLoading="@isLoading" NumPages="10" PageSizeList="@PageSizeListSpec"></EgwCoreLib.Razor.DataPager>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,389 @@
|
||||
using GPW.CORE.Data.DbModels;
|
||||
using GPW.CORE.Data.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using NLog;
|
||||
using static EgwCoreLib.Razor.Toggler;
|
||||
|
||||
namespace GPW.CORE.ADM.Components.Compo
|
||||
{
|
||||
public partial class RegRichieste
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public bool isLoading
|
||||
{
|
||||
get => loading;
|
||||
set => loading = value;
|
||||
}
|
||||
|
||||
[Parameter]
|
||||
public int months { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<bool> ReportUpdate { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public bool ShowNeedConf { get; set; } = false;
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected List<int> PageSizeListSpec = new List<int>() { 5, 10, 15, 20 };
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected MessageService AppMServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected GpwDataService GDataServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; } = null!;
|
||||
|
||||
protected bool loading
|
||||
{
|
||||
get => _loading;
|
||||
set
|
||||
{
|
||||
if (_loading != value)
|
||||
{
|
||||
_loading = value;
|
||||
var pUpd = Task.Run(async () => await ReloadData());
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
ToggleData = new SelectGlobalToggle()
|
||||
{
|
||||
leftString = "Da approvare",
|
||||
rightString = "Tutti",
|
||||
placardCss = "bg-dark border-dark text-light"
|
||||
};
|
||||
dtInizio = new DateTime(DateTime.Today.Year, 1, 1);
|
||||
dtFine = dtInizio.AddYears(2);
|
||||
CodGiust = "";
|
||||
var rawGiust = await GDataServ.AnagGiust();
|
||||
if (rawGiust != null)
|
||||
{
|
||||
ListGiust = rawGiust.Where(x => x.showReq).ToList();
|
||||
}
|
||||
// recupero preferenze utente...
|
||||
await InitUserPref();
|
||||
}
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
currPage = 1;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected async Task SetNumRec(int newNum)
|
||||
{
|
||||
numRecord = newNum;
|
||||
currPage = 1;
|
||||
await AppMServ.NumRowGridSet(gridKey, newNum);
|
||||
await InvokeAsync(ReloadData);
|
||||
}
|
||||
|
||||
protected async Task SetPage(int newNum)
|
||||
{
|
||||
currPage = newNum;
|
||||
await InvokeAsync(ReloadData);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
private string gridKey = "RegRichieste";
|
||||
|
||||
private bool isSendingData = false;
|
||||
|
||||
private List<AnagGiustModel>? ListGiust = null;
|
||||
|
||||
private List<RegRichiesteModel>? ListRecords = null;
|
||||
|
||||
/// <summary>
|
||||
/// Numero giorni minimo per richiesta ferie
|
||||
/// </summary>
|
||||
private int NumDayFerieRichAntic = 14;
|
||||
|
||||
/// <summary>
|
||||
/// NUmero giorni massimo per richiesta permessi
|
||||
/// </summary>
|
||||
private int NumDayPermMax = 21;
|
||||
|
||||
private List<RegRichiesteModel>? SearchRecords = null;
|
||||
|
||||
private int sendDataMaxVal = 100;
|
||||
|
||||
private int sendDataNextVal = 0;
|
||||
|
||||
private int sendDataVal = 0;
|
||||
|
||||
private bool showAdd = false;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private bool _loading { get; set; } = false;
|
||||
|
||||
private string CodGiust
|
||||
{
|
||||
get => currRecord.CodGiust;
|
||||
set
|
||||
{
|
||||
currRecord.CodGiust = value;
|
||||
}
|
||||
}
|
||||
|
||||
private int currPage { get; set; } = 1;
|
||||
|
||||
private RegRichiesteModel currRecord { get; set; } = new RegRichiesteModel();
|
||||
|
||||
private DateTime dtEnd
|
||||
{
|
||||
get => currRecord.DtEnd;
|
||||
set
|
||||
{
|
||||
currRecord.DtEnd = value;
|
||||
// verifico coerenza date...
|
||||
if (dtStart > dtEnd)
|
||||
{
|
||||
dtStart = dtEnd;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private DateTime dtFine { get; set; } = DateTime.Today;
|
||||
|
||||
private DateTime dtInizio { get; set; } = DateTime.Today;
|
||||
|
||||
private DateTime dtStart
|
||||
{
|
||||
get => currRecord.DtStart;
|
||||
set
|
||||
{
|
||||
currRecord.DtStart = value;
|
||||
// verifico coerenza date...
|
||||
if (dtEnd < dtStart)
|
||||
{
|
||||
dtEnd = dtStart;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string NomeDip
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = "per cortesia";
|
||||
if (AppMServ != null && AppMServ.RigaDip != null)
|
||||
{
|
||||
answ = $"{AppMServ.RigaDip.Nome}";
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
private int numRecord { get; set; } = 10;
|
||||
|
||||
private SelectGlobalToggle ToggleData { get; set; } = new SelectGlobalToggle();
|
||||
|
||||
private int totalCount { get; set; } = 0;
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private async Task DoApprove(RegRichiesteModel selItem)
|
||||
{
|
||||
// chiedo verifica
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Confermi approvazione?"))
|
||||
return;
|
||||
|
||||
// imposto approvato...
|
||||
selItem.Conf = true;
|
||||
await Task.Delay(1);
|
||||
isSendingData = true;
|
||||
sendDataVal = 0;
|
||||
sendDataNextVal = 5;
|
||||
await Task.Delay(1);
|
||||
await InvokeAsync(StateHasChanged);
|
||||
// effettuo insert...
|
||||
sendDataVal = 5;
|
||||
sendDataNextVal = 90;
|
||||
await Task.Delay(1);
|
||||
await GDataServ.RegRichiesteAppRif(selItem);
|
||||
sendDataVal = 100;
|
||||
sendDataNextVal = 100;
|
||||
await ReloadData();
|
||||
await Task.Delay(1);
|
||||
await ReportUpdate.InvokeAsync(true);
|
||||
isSendingData = false;
|
||||
}
|
||||
|
||||
private async Task DoEdit(RegRichiesteModel selItem)
|
||||
{
|
||||
// chiedo conferma se è scaduto..
|
||||
if (selItem.DtStart < DateTime.Today)
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sei sicuro di voler modificare un record di una richiesta passata?"))
|
||||
return;
|
||||
}
|
||||
|
||||
currRecord = selItem;
|
||||
showAdd = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Salva il record
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private async Task DoSave()
|
||||
{
|
||||
// chiedo verifica
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Confermi la modifica?"))
|
||||
return;
|
||||
|
||||
isSendingData = true;
|
||||
sendDataVal = 0;
|
||||
sendDataNextVal = 5;
|
||||
await Task.Delay(1);
|
||||
// effettuo insert...
|
||||
sendDataVal = 5;
|
||||
sendDataNextVal = 90;
|
||||
await Task.Delay(1);
|
||||
// uso metodo specifico x modifica
|
||||
await GDataServ.RegRichiesteAppRif(currRecord);
|
||||
sendDataVal = 100;
|
||||
sendDataNextVal = 100;
|
||||
await Task.Delay(1);
|
||||
showAdd = false;
|
||||
await ReloadData();
|
||||
await ReportUpdate.InvokeAsync(true);
|
||||
isSendingData = false;
|
||||
}
|
||||
|
||||
private async Task evToggled(SelectGlobalToggle newTogData)
|
||||
{
|
||||
ToggleData = newTogData;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// init valori da config
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private async Task initConf()
|
||||
{
|
||||
// leggo conf standard giorni permessi/ferie
|
||||
var sNumDayFerieRichAntic = await GDataServ.ConfigGetKeyAsync("NumDayFerieRichAntic");
|
||||
if (sNumDayFerieRichAntic != null)
|
||||
{
|
||||
int.TryParse(sNumDayFerieRichAntic.valore, out NumDayFerieRichAntic);
|
||||
}
|
||||
var sNumDayPermMax = await GDataServ.ConfigGetKeyAsync("NumDayPermMax");
|
||||
if (sNumDayPermMax != null)
|
||||
{
|
||||
int.TryParse(sNumDayPermMax.valore, out NumDayPermMax);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Init preferenze utente
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private async Task InitUserPref()
|
||||
{
|
||||
try
|
||||
{
|
||||
numRecord = await AppMServ.NumRowGridGet(gridKey);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione in InitUserPref{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
|
||||
private DateTime maxDate(string codGiust)
|
||||
{
|
||||
DateTime answ = DateTime.Today.AddDays(NumDayPermMax);
|
||||
switch (codGiust)
|
||||
{
|
||||
case "FER":
|
||||
answ = new DateTime(answ.Year, answ.Month, 1).AddMonths(months);
|
||||
break;
|
||||
|
||||
case "104":
|
||||
case "PERM":
|
||||
default:
|
||||
DateTime.Today.AddDays(NumDayPermMax);
|
||||
break;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
private DateTime minDate(string codGiust)
|
||||
{
|
||||
DateTime answ = DateTime.Today;
|
||||
switch (codGiust)
|
||||
{
|
||||
case "FER":
|
||||
answ = DateTime.Today.AddDays(NumDayFerieRichAntic);
|
||||
break;
|
||||
|
||||
case "104":
|
||||
case "PERM":
|
||||
default:
|
||||
answ = DateTime.Today;
|
||||
break;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
private async Task ReloadData()
|
||||
{
|
||||
ListRecords = null;
|
||||
await initConf();
|
||||
await Task.Delay(1);
|
||||
// carico richieste di TUTTI
|
||||
SearchRecords = GDataServ.RegRichiesteGetByDip(0, dtInizio, dtFine);
|
||||
// filtro x tipo richieste...
|
||||
if (ShowNeedConf)
|
||||
{
|
||||
SearchRecords = SearchRecords.Where(x => !x.Conf).ToList();
|
||||
}
|
||||
// conteggio!
|
||||
totalCount = SearchRecords.Count;
|
||||
// paginazione
|
||||
ListRecords = SearchRecords
|
||||
.Skip(numRecord * (currPage - 1))
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
private void toggleEdit()
|
||||
{
|
||||
showAdd = !showAdd;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
|
||||
<div class="card shadow mb-5 border border-secondary">
|
||||
<div class="card-header">
|
||||
<h3>Elaborazioni disponibili</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
@if (ListRecords == null || isLoading)
|
||||
{
|
||||
<EgwCoreLib.Razor.LoadingData></EgwCoreLib.Razor.LoadingData>
|
||||
}
|
||||
else if (totalCount == 0)
|
||||
{
|
||||
<div class="alert alert-info">Nessun record trovato</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="row">
|
||||
@foreach (var item in ListRecords)
|
||||
{
|
||||
<a target="_blank" href="@(fullUrl(item.ReportUrl))" class="col-12 col-md-6 col-lg-4 col-xl-3 p-2">
|
||||
<div class="border border-2 border-dark rounded rounded-4 shadow shadow-lg @item.CssClass">
|
||||
<div class="areaTesto px-2">
|
||||
<h3>@item.Nome</h3>
|
||||
<p class="small">@item.Descrizione</p>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
using GPW.CORE.Data.DbModels;
|
||||
using GPW.CORE.Data.DTO;
|
||||
using GPW.CORE.Data.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace GPW.CORE.ADM.Components.Compo
|
||||
{
|
||||
public partial class ReportProgettiMan
|
||||
{
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected MessageService AppMServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected AppAuthService AuthServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected IConfiguration config { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected GpwDataService GDataServ { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected string fullUrl(string repUrl)
|
||||
{
|
||||
return $"{reportBaseUrl}{repUrl}";
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
reportBaseUrl = config.GetValue<string>("ServerConf:ReportBaseUrl") ?? "http://W2019-SQL-STEAM/ReportServer?";
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected string Traduci(string lemma)
|
||||
{
|
||||
return AuthServ.Traduci(lemma, AppMServ.UserLang);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private bool isLoading = false;
|
||||
private string reportBaseUrl = "";
|
||||
private int totalCount = 0;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private List<ElencoReportModel>? ListRecords { get; set; } = null;
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private async Task ReloadData()
|
||||
{
|
||||
ListRecords = await GDataServ.ElencoReportFilt("A1");
|
||||
totalCount = ListRecords.Count;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,258 @@
|
||||
@if (isSendingData)
|
||||
{
|
||||
<ProgressDisplay Title="Salvataggio ed invio richiesta" CurrVal="@sendDataVal" NextVal="@sendDataNextVal" MaxVal="@sendDataMaxVal" ExpTimeMSec="8000"></ProgressDisplay>
|
||||
}
|
||||
|
||||
<div class="card shadow">
|
||||
<div class="card-header">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-0">
|
||||
<h4>Elenco Timbrature</h4>
|
||||
</div>
|
||||
<div class="px-0">
|
||||
<div class="d-flex align-middle">
|
||||
<div class="px-1 py-2">
|
||||
<div class="form-check form-switch">
|
||||
<input class="form-check-input" type="checkbox" @bind=@ShowInatt @bind:after=ForceReload>
|
||||
<label class="form-check-label">Mostra Inattivi</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="px-1 py-1">
|
||||
<select @bind="@IdxDipSel" class="form-select form-select-sm" @bind:after=ForceReload>
|
||||
<option value="0">--- Selezionare ---</option>
|
||||
@foreach (var item in ListDipendenti)
|
||||
{
|
||||
<option value="@item.IdxDipendente">@($"{item.Cognome} {item.Nome}")</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="px-0">
|
||||
<div class="d-flex">
|
||||
<div class="px-1">
|
||||
<PeriodoSel CurrPeriodo="@CurrPeriodo" E_PeriodoSel="@SavePeriodo"></PeriodoSel>
|
||||
</div>
|
||||
<div class="px-1 py-2">
|
||||
<div class="form-check form-switch">
|
||||
<input class="form-check-input" type="checkbox" @bind=@ShowWE @bind:after=ForceReload>
|
||||
<label class="form-check-label">Mostra Week-End</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="px-0 d-flex">
|
||||
<div class="px-0">
|
||||
<button class="btn btn-sm btn-success" title="Ricalcola" @onclick="DoFullRecalc">∑ (h)</button>
|
||||
</div>
|
||||
<div class="px-0">
|
||||
<button class="btn btn-sm btn-info mx-1" title="Export Ore" @onclick=SaveExpOre><i class="fa-solid fa-rotate"></i> Exp.Ore</button>
|
||||
</div>
|
||||
<div class="px-0">
|
||||
<button class="btn btn-sm btn-primary" title="Export Commesse" @onclick=SaveExpCom><i class="fa-solid fa-rotate"></i> Exp.Com.</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body p-1 small">
|
||||
@if (ListRecords == null || isLoading)
|
||||
{
|
||||
<EgwCoreLib.Razor.LoadingData></EgwCoreLib.Razor.LoadingData>
|
||||
}
|
||||
else if (totalCount == 0)
|
||||
{
|
||||
<div class="alert alert-info">Nessun record trovato</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-8">
|
||||
<table class="table table-striped table-sm text-start">
|
||||
<thead>
|
||||
<tr class="">
|
||||
<th>
|
||||
<button class="btn btn-info btn-sm" @onclick="ForceReload"><i class="fa-solid fa-rotate"></i></button>
|
||||
|
||||
</th>
|
||||
<th>Dipendente <Sorter ParamName="Dipendente" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th>Data <Sorter ParamName="DataLav" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th class="text-center">IN</th>
|
||||
<th class="text-center">OUT</th>
|
||||
<th class="text-center">IN</th>
|
||||
<th class="text-center">OUT</th>
|
||||
<th class="text-center">IN</th>
|
||||
<th class="text-center">OUT</th>
|
||||
<th class="text-center">IN</th>
|
||||
<th class="text-center">OUT</th>
|
||||
<th class="text-end">H Lav</th>
|
||||
<th class="text-end">H Giu</th>
|
||||
<th class="text-end">T/C19</th>
|
||||
<th class="text-end">Tag</th>
|
||||
<th class="text-end">Chk</th>
|
||||
<th class="text-end">H Com</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in ListRecords)
|
||||
{
|
||||
<tr class="align-middle lh-1 @CheckSel(item)">
|
||||
<td>
|
||||
<button class="btn btn-info btn-sm" @onclick="() => DoSelect(item)"><i class="fa-solid fa-search"></i></button>
|
||||
</td>
|
||||
<td class="fs-5">
|
||||
@item.CognomeNome
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
@($"{item.DataLav:yyyy.MM.dd}")
|
||||
</div>
|
||||
<div>
|
||||
@($"{item.DataLav:dddd}")
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td class="text-center text-success">
|
||||
@if (item.entrata_1 != null)
|
||||
{
|
||||
@($"{item.entrata_1:HH:mm}")
|
||||
}
|
||||
</td>
|
||||
<td class="text-center text-primary">
|
||||
@if (item.uscita_1 != null)
|
||||
{
|
||||
@($"{item.uscita_1:HH:mm}")
|
||||
}
|
||||
</td>
|
||||
<td class="text-center text-success">
|
||||
@if (item.entrata_2 != null)
|
||||
{
|
||||
@($"{item.entrata_2:HH:mm}")
|
||||
}
|
||||
</td>
|
||||
<td class="text-center text-primary">
|
||||
@if (item.uscita_2 != null)
|
||||
{
|
||||
@($"{item.uscita_2:HH:mm}")
|
||||
}
|
||||
</td>
|
||||
<td class="text-center text-success">
|
||||
@if (item.entrata_3 != null)
|
||||
{
|
||||
@($"{item.entrata_3:HH:mm}")
|
||||
}
|
||||
</td>
|
||||
<td class="text-center text-primary">
|
||||
@if (item.uscita_3 != null)
|
||||
{
|
||||
@($"{item.uscita_3:HH:mm}")
|
||||
}
|
||||
</td>
|
||||
<td class="text-center text-success">
|
||||
@if (item.entrata_4 != null)
|
||||
{
|
||||
@($"{item.entrata_4:HH:mm}")
|
||||
}
|
||||
</td>
|
||||
<td class="text-center text-primary">
|
||||
@if (item.uscita_4 != null)
|
||||
{
|
||||
@($"{item.uscita_4:HH:mm}")
|
||||
}
|
||||
</td>
|
||||
<td class="text-end fs-4 fw-bold">
|
||||
@($"{item.h_lav:N2}")
|
||||
</td>
|
||||
<td class="text-end">
|
||||
@if (item.h_giust > 0)
|
||||
{
|
||||
@($"{item.h_giust:N2}")
|
||||
}
|
||||
</td>
|
||||
<td class="text-end">
|
||||
@if (item.TempRil < 34)
|
||||
{
|
||||
<i class="fa-solid fa-temperature-low text-secondary"></i>
|
||||
}
|
||||
else if (item.TempRil < 37)
|
||||
{
|
||||
<i class="fa-solid fa-temperature-low text-success"></i>
|
||||
}
|
||||
else if (item.TempRil < (decimal)37.5)
|
||||
{
|
||||
<i class="fa-solid fa-temperature-low text-warning"></i>
|
||||
}
|
||||
else
|
||||
{
|
||||
<i class="fa-solid fa-temperature-low text-danger"></i>
|
||||
}
|
||||
</td>
|
||||
<td class="text-end">
|
||||
@if (!item.TagIsActive)
|
||||
{
|
||||
<span class="striked text-secondary">@item.CodTag</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
@item.CodTag
|
||||
}
|
||||
</td>
|
||||
<td class="text-end fw-bold">
|
||||
@if (!item.isOkTim)
|
||||
{
|
||||
<span class="text-danger" tooltip="Errore Entrata/Uscita: non corrispondono.">T</span>
|
||||
}
|
||||
@if (!item.isOkApp)
|
||||
{
|
||||
<span class="text-danger" tooltip="Errore: timbrature non approvate.">A</span>
|
||||
}
|
||||
@if (item.isOkLav == 0)
|
||||
{
|
||||
<span class="text-danger" tooltip="Errore: manca copertura ore ordinarie.">O</span>
|
||||
}
|
||||
@if (!string.IsNullOrEmpty(item.chkFunCod))
|
||||
{
|
||||
<span tooltip="@item.chkFunRes">@item.minMpp</span>
|
||||
}
|
||||
@if (item.isOk != 0)
|
||||
{
|
||||
<span class="text-success" tooltip="Tutto OK.">Ok</span>
|
||||
}
|
||||
</td>
|
||||
<td class="text-end fs-4 fw-bold">
|
||||
@if (item.okLAvCom != 0)
|
||||
{
|
||||
<span class="text-dark">@($"{item.h_com:N2}")</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span class="text-warning">@($"{item.h_com:N2}")</span>
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
@if (SelRecord != null)
|
||||
{
|
||||
<div class="py-1">
|
||||
<TimbList ListRecord="@ListTimbDay" EnableDelete="true" EnableEdit="true" EC_ReqUpdate="TimbUpdate" EC_ReqDelete="TimbDelete"></TimbList>
|
||||
</div>
|
||||
<div class="py-3">
|
||||
<GiustList ListRecord="@ListGiustDay" ListGiust="@ListGiust" EnableEdit="true" EnableDelete="true" EC_ReqUpdate="GiustUpdate" EC_ReqDelete="GiustDelete" EC_ReqAddNew="GiustAddNew" EC_ReqCancel="GiustCancel"></GiustList>
|
||||
</div>
|
||||
<div class="py-1">
|
||||
<RAList ListRecord="@ListRA" EnableDelete="false" EnableEdit="false"></RAList>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<EgwCoreLib.Razor.DataPager PageSize="@numRecord" currPage="@currPage" numRecordChanged="SetNumRec" numPageChanged="SetPage" totalCount="@totalCount" showLoading="@isLoading" PageSizeList="@PageSizeListSpec"></EgwCoreLib.Razor.DataPager>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,544 @@
|
||||
using EgwCoreLib.Razor;
|
||||
using GPW.CORE.Data.DbModels;
|
||||
using GPW.CORE.Data.Services;
|
||||
using GPW.CORE.Data;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using NLog;
|
||||
using EgwCoreLib.Utils;
|
||||
using System.Diagnostics;
|
||||
using static GPW.CORE.ADM.Components.Compo.GiustList;
|
||||
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||
|
||||
namespace GPW.CORE.ADM.Components.Compo
|
||||
{
|
||||
public partial class ReviewTimbMan : IDisposable
|
||||
{
|
||||
#region Public Methods
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
AppMServ.EA_SearchUpdated -= AppMServ_EA_SearchUpdated;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected List<int> PageSizeListSpec = new List<int>() { 5, 10, 15, 20, 25, 50 };
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected MessageService AppMServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected IConfiguration config { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected GpwDataService GDataServ { get; set; } = null!;
|
||||
|
||||
protected int IdxDipSel { get; set; } = 0;
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected string CheckSel(TeRaExplModel? SelItem)
|
||||
{
|
||||
string answ = "";
|
||||
if (SelRecord != null)
|
||||
{
|
||||
answ = SelRecord.UID == SelItem.UID ? "table-info" : "";
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
protected async Task DoSelect(TeRaExplModel selItem)
|
||||
{
|
||||
// seleziono record x mostrare update
|
||||
SelRecord = selItem;
|
||||
await ReloadDayDetail();
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
protected async Task ForceReload()
|
||||
{
|
||||
currPage = 1;
|
||||
SelRecord = null;
|
||||
await ReloadData();
|
||||
await ReloadDayDetail();
|
||||
}
|
||||
|
||||
protected async Task GiustAddNew(string CodGiust)
|
||||
{
|
||||
if (SelRecord != null)
|
||||
{
|
||||
await GDataServ.GiustificativiInsByDate(SelRecord.IdxDipendente, SelRecord.DataLav, CodGiust);
|
||||
await ReloadData();
|
||||
await ReloadDayDetail();
|
||||
}
|
||||
}
|
||||
|
||||
protected async Task GiustCancel()
|
||||
{
|
||||
await ReloadData();
|
||||
await ReloadDayDetail();
|
||||
}
|
||||
|
||||
protected async Task GiustDelete(GiustificativiModel selItem)
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sicuro di voler eliminare il record Giustificativo?"))
|
||||
return;
|
||||
|
||||
await GDataServ.GiustificativiDelete(selItem);
|
||||
await ReloadData();
|
||||
await ReloadDayDetail();
|
||||
}
|
||||
|
||||
protected async Task GiustUpdate(GiustSet newSet)
|
||||
{
|
||||
await GDataServ.GiustificativiUpdate(newSet.OldRec, newSet.NewRec);
|
||||
await ReloadData();
|
||||
await ReloadDayDetail();
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
CurrPeriodo.Fine = DateTime.Today.AddDays(1);
|
||||
CurrSearch = "";
|
||||
AppMServ.SearchVal = "";
|
||||
AppMServ.EA_SearchUpdated += AppMServ_EA_SearchUpdated;
|
||||
numRecord = await AppMServ.NumRowGridGet(gridKey);
|
||||
ListGiust = await GDataServ.AnagGiust();
|
||||
// imposto path...
|
||||
exportPath = config.GetValue<string>("ServerConf:BasePathExport") ?? config.GetValue<string>("OptConf:BasePathExport") ?? $"{Directory.GetCurrentDirectory()}\\temp\\";
|
||||
// svuoto temp folder dopo 1 min
|
||||
await clearDir(1);
|
||||
// carico conf specifica...
|
||||
var rCodTimbra = await GDataServ.ConfigGetKeyAsync("ExpOreCodTimbra");
|
||||
if (rCodTimbra != null)
|
||||
{
|
||||
TimbExp = rCodTimbra.valore;
|
||||
}
|
||||
}
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected async Task SetNumRec(int newNum)
|
||||
{
|
||||
numRecord = newNum;
|
||||
currPage = 1;
|
||||
await AppMServ.NumRowGridSet(gridKey, newNum);
|
||||
await InvokeAsync(ReloadData);
|
||||
}
|
||||
|
||||
protected async Task SetPage(int newNum)
|
||||
{
|
||||
currPage = newNum;
|
||||
await InvokeAsync(ReloadData);
|
||||
}
|
||||
|
||||
protected async Task SortRequested(Sorter.SortCallBack e)
|
||||
{
|
||||
sortField = e.ParamName;
|
||||
sortAsc = e.IsAscending;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected async Task TimbDelete(TimbratureModel selItem)
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sicuro di voler eliminare il record Timbratura?"))
|
||||
return;
|
||||
|
||||
await GDataServ.TimbratureDelete(selItem);
|
||||
await ReloadData();
|
||||
await ReloadDayDetail();
|
||||
//SelRecord = null;
|
||||
//await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
protected async Task TimbUpdate(TimbratureModel UpdRec)
|
||||
{
|
||||
await GDataServ.TimbratureUpdate(UpdRec);
|
||||
await ReloadData();
|
||||
await ReloadDayDetail();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
private string gridKey = "RevTimbMan";
|
||||
|
||||
private int sendDataMaxVal = 100;
|
||||
|
||||
private int sendDataNextVal = 0;
|
||||
|
||||
private int sendDataVal = 0;
|
||||
|
||||
private bool sortAsc = true;
|
||||
|
||||
private string sortField = "";
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private int currPage { get; set; } = 1;
|
||||
|
||||
private DtUtils.Periodo CurrPeriodo { get; set; } = new DtUtils.Periodo(DtUtils.PeriodSet.ThisMonth);
|
||||
|
||||
private string CurrSearch { get; set; } = "";
|
||||
|
||||
private string exportPath { get; set; } = "";
|
||||
|
||||
private bool filtDip { get; set; } = false;
|
||||
|
||||
private string fnExpComm
|
||||
{
|
||||
get => $"ExportCommesse_{DateTime.Now:yyyyMMdd}_{DateTime.Now:HHmmss}.csv";
|
||||
}
|
||||
|
||||
private string fnTimb
|
||||
{
|
||||
get => $"Timbrature_{DateTime.Now:yyyyMMdd}_{DateTime.Now:HHmmss}.csv";
|
||||
}
|
||||
|
||||
private bool isLoading { get; set; } = false;
|
||||
|
||||
private bool isSendingData { get; set; } = false;
|
||||
private List<DipendentiModel> ListDipendenti { get; set; } = new List<DipendentiModel>();
|
||||
|
||||
private List<AnagGiustModel>? ListGiust { get; set; } = null;
|
||||
|
||||
private List<GiustificativiModel>? ListGiustDay { get; set; } = null;
|
||||
private List<RegAttivitaModel>? ListRA { get; set; } = null;
|
||||
|
||||
private List<TeRaExplModel>? ListRecords { get; set; } = null;
|
||||
|
||||
private List<TimbratureModel>? ListTimbDay { get; set; } = null;
|
||||
|
||||
private int MaxErrMin { get; set; } = -30;
|
||||
|
||||
private int MaxErrPlus { get; set; } = 30;
|
||||
|
||||
private int numRecord { get; set; } = 10;
|
||||
|
||||
private List<TeRaExplModel>? SearchRecords { get; set; } = null;
|
||||
|
||||
private TeRaExplModel? SelRecord { get; set; } = null;
|
||||
|
||||
private bool ShowInatt { get; set; } = false;
|
||||
|
||||
private bool ShowWE { get; set; } = true;
|
||||
|
||||
private string TimbExp { get; set; } = "000";
|
||||
private int totalCount { get; set; } = 0;
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private async void AppMServ_EA_SearchUpdated()
|
||||
{
|
||||
CurrSearch = AppMServ.SearchVal;
|
||||
await ReloadData();
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
private async Task clearDir(int maxAgeMinutes)
|
||||
{
|
||||
string dirPath = Path.Combine(exportPath);
|
||||
DirectoryInfo dInfo = new DirectoryInfo(dirPath);
|
||||
await Task.Run(() =>
|
||||
{
|
||||
var fileList = dInfo.GetFiles();
|
||||
// elimino file + vecchi de minuti ricevuti...
|
||||
foreach (var file in fileList)
|
||||
{
|
||||
if (file.CreationTime < DateTime.Now.AddMinutes(-maxAgeMinutes))
|
||||
{
|
||||
file.Delete();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private bool ClearFile(string fileName)
|
||||
{
|
||||
bool fatto = false;
|
||||
string filePath = Path.Combine(exportPath, fileName);
|
||||
if (File.Exists(filePath))
|
||||
{
|
||||
File.Delete(exportPath);
|
||||
fatto = true;
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ricalcola giornate periodo visualizzato per i dipendenti selezionati
|
||||
/// </summary>
|
||||
private async Task DoFullRecalc()
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sicuro di voler ricalcolare il periodo selezionato? L'operazione richiederà tempo..."))
|
||||
return;
|
||||
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
Log.Trace($"DoFullRecalc | Starting");
|
||||
isSendingData = true;
|
||||
await Task.Delay(1);
|
||||
sendDataVal = 0;
|
||||
sendDataNextVal = 50;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
// step 1: ricalcola timb esplose x utenti e periodo...
|
||||
var updTask = Task.Run(async () =>
|
||||
await GDataServ.TimbExplRicalcola(IdxDipSel, CurrPeriodo.Inizio, CurrPeriodo.Fine)
|
||||
);
|
||||
await updTask;
|
||||
sw.Stop();
|
||||
Log.Info($"DoFullRecalc | STEP 01 | {sw.ElapsedMilliseconds:N0} ms");
|
||||
sw.Restart();
|
||||
sendDataVal = 50;
|
||||
sendDataNextVal = 90;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
// verifico dip con giust da inserire...
|
||||
var list2fix = await GDataServ.TimbExplGetAnomalie(IdxDipSel, CurrPeriodo.Inizio, CurrPeriodo.Fine, false, false, true);
|
||||
if (list2fix != null && list2fix.Count > 0)
|
||||
{
|
||||
var updTask2 = Task.Run(async () =>
|
||||
{
|
||||
foreach (var item in list2fix)
|
||||
{
|
||||
// escludo date da dtRif in poi...
|
||||
if (item.DataLav < DateTime.Today)
|
||||
{
|
||||
GiustificativiModel rec2del = new GiustificativiModel()
|
||||
{
|
||||
IdxDipendente = item.IdxDipendente,
|
||||
DataLav = item.DataLav,
|
||||
CodGiust = "PERM"
|
||||
};
|
||||
try
|
||||
{
|
||||
// elimino eventuali vecchi permessi
|
||||
await GDataServ.GiustificativiDelete(rec2del);
|
||||
// inserisco permessi...
|
||||
await GDataServ.GiustificativiInsByDate(item.IdxDipendente, item.DataLav, "PERM");
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione in ricalcolo:{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
}
|
||||
sw.Stop();
|
||||
Log.Info($"DoFullRecalc | STEP 02 | {sw.ElapsedMilliseconds:N0} ms");
|
||||
sw.Restart();
|
||||
// ricalcolo!
|
||||
await GDataServ.TimbExplRicalcola(IdxDipSel, CurrPeriodo.Inizio, CurrPeriodo.Fine);
|
||||
sw.Stop();
|
||||
Log.Info($"DoFullRecalc | STEP 03 | {sw.ElapsedMilliseconds:N0} ms");
|
||||
sw.Restart();
|
||||
});
|
||||
sw.Stop();
|
||||
await updTask2;
|
||||
Log.Info($"DoFullRecalc | STEP 04 | {sw.ElapsedMilliseconds:N0} ms");
|
||||
sw.Restart();
|
||||
}
|
||||
sendDataVal = 90;
|
||||
sendDataNextVal = 100;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
// ricalcolo RegAttExpl
|
||||
var updTask3 = Task.Run(async () =>
|
||||
{
|
||||
await GDataServ.RegAttRicalcola(IdxDipSel, CurrPeriodo.Inizio, CurrPeriodo.Fine);
|
||||
});
|
||||
await updTask3;
|
||||
sw.Stop();
|
||||
Log.Info($"DoFullRecalc | STEP 05 | {sw.ElapsedMilliseconds:N0} ms");
|
||||
// aggiorno
|
||||
SelRecord = null;
|
||||
sendDataVal = 100;
|
||||
sendDataNextVal = 100;
|
||||
isLoading = true;
|
||||
await Task.Delay(1);
|
||||
await InvokeAsync(StateHasChanged);
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
private async Task ExportCsv<T>(string fileName, List<T> RecList)
|
||||
{
|
||||
isLoading = true;
|
||||
if (RecList != null)
|
||||
{
|
||||
string filePath = Path.Combine(exportPath, fileName);
|
||||
// salvo davvero!
|
||||
await Utils.SaveToCsv(RecList, filePath, ';');
|
||||
}
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
private async Task ExportTxt(string fileName, List<string> RecList)
|
||||
{
|
||||
isLoading = true;
|
||||
if (RecList != null)
|
||||
{
|
||||
string filePath = Path.Combine(exportPath, fileName);
|
||||
await File.WriteAllLinesAsync(filePath, RecList);
|
||||
}
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
private async Task ReloadData()
|
||||
{
|
||||
isLoading = true;
|
||||
ListRecords = null;
|
||||
var rawList = await GDataServ.DipendentiGetAll();
|
||||
if (ShowInatt)
|
||||
{
|
||||
ListDipendenti = rawList;
|
||||
}
|
||||
else
|
||||
{
|
||||
ListDipendenti = rawList.Where(x => (x.Attivo ?? false)).ToList();
|
||||
}
|
||||
try
|
||||
{
|
||||
SearchRecords = await GDataServ.TeRaExplGetFilt(IdxDipSel, CurrPeriodo.Inizio, CurrPeriodo.Fine, ShowInatt, ShowWE, MaxErrMin, MaxErrPlus);
|
||||
// verifico filtro per IdxDip
|
||||
if (IdxDipSel > 0)
|
||||
{
|
||||
SearchRecords = SearchRecords.Where(x => x.IdxDipendente == IdxDipSel).ToList();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error($"Eccezione in recupero dati{Environment.NewLine}{ex}");
|
||||
}
|
||||
totalCount = SearchRecords.Count;
|
||||
SortTable();
|
||||
isLoading = false;
|
||||
// tolgo eventuale send data...
|
||||
isSendingData = false;
|
||||
}
|
||||
|
||||
private async Task ReloadDayDetail()
|
||||
{
|
||||
if (SelRecord != null)
|
||||
{
|
||||
// salvo dettaglio giornaliero
|
||||
ListTimbDay = await GDataServ.TimbratureDay(SelRecord.DataLav, SelRecord.IdxDipendente);
|
||||
ListGiustDay = await GDataServ.GiustificativiFilt(SelRecord.IdxDipendente, SelRecord.DataLav, SelRecord.DataLav.AddDays(1).AddMinutes(-1));
|
||||
ListRA = await GDataServ.RegAttDipDate(SelRecord.IdxDipendente, SelRecord.DataLav);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task SaveExpCom()
|
||||
{
|
||||
// svuoto
|
||||
ClearFile(fnExpComm);
|
||||
// recupero nuovo elenco dati...
|
||||
var list2save = await GDataServ.ExportCommessa(IdxDipSel, CurrPeriodo.Inizio, CurrPeriodo.Fine);
|
||||
if (list2save != null)
|
||||
{
|
||||
// bonifica descrizione: elimino gli a capo...
|
||||
foreach (var item in list2save)
|
||||
{
|
||||
if (item.Descrizione.Contains(Environment.NewLine) || item.Descrizione.Contains("\n") || item.Descrizione.Contains("\r"))
|
||||
{
|
||||
item.Descrizione = item.Descrizione.Replace(Environment.NewLine, " ").Replace("\n", " ").Replace("\r", " ");
|
||||
}
|
||||
}
|
||||
// export
|
||||
await ExportCsv(fnExpComm, list2save);
|
||||
// chiamo apri pagina x download
|
||||
await JSRuntime.InvokeVoidAsync("open", $"export/{fnExpComm}", "_blank");
|
||||
}
|
||||
}
|
||||
|
||||
private async Task SaveExpOre()
|
||||
{
|
||||
// svuoto
|
||||
ClearFile(fnTimb);
|
||||
// recupero nuovo elenco dati elenco zucchetti
|
||||
var rawData = await GDataServ.ExportZucchetti(IdxDipSel, CurrPeriodo.Inizio, CurrPeriodo.Fine, TimbExp);
|
||||
var list2save = rawData.Select(x => x.CampoExport).ToList();
|
||||
if (list2save != null)
|
||||
{
|
||||
// export
|
||||
await ExportTxt(fnTimb, list2save);
|
||||
// chiamo apri pagina x download
|
||||
await JSRuntime.InvokeVoidAsync("open", $"export/{fnTimb}", "_blank");
|
||||
}
|
||||
}
|
||||
|
||||
private async Task SavePeriodo(DtUtils.Periodo newPeiodo)
|
||||
{
|
||||
CurrPeriodo = newPeiodo;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
private void SortTable()
|
||||
{
|
||||
if (SearchRecords != null)
|
||||
{
|
||||
// se ho ordinamento riordino...
|
||||
if (!string.IsNullOrEmpty(sortField))
|
||||
{
|
||||
switch (sortField)
|
||||
{
|
||||
case "Dipendente":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.CognomeNome).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.CognomeNome).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "DataLav":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.DataLav).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.DataLav).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// filtro x display
|
||||
ListRecords = SearchRecords
|
||||
.Skip(numRecord * (currPage - 1))
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
ListRecords = new List<TeRaExplModel>();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
|
||||
<div class="card shadow">
|
||||
<div class="card-header">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-0">
|
||||
<h3>@Traduci("SpostaFasi")</h3>
|
||||
</div>
|
||||
<div class="px-0 align-content-center">
|
||||
<div class="form-check form-switch">
|
||||
<input class="form-check-input" type="checkbox" role="switch" @bind=@ShowPrjArc>
|
||||
<label class="form-check-label">Mostra Archiviati (Clienti/Progetti)</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body p-1">
|
||||
<div class="row my-1">
|
||||
@if (OkFase)
|
||||
{
|
||||
<div class="col-3">
|
||||
<button class="btn btn-primary w-100" @onclick=SpostaFase>Sposta Fase</button>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<button class="btn btn-success w-100" @onclick=ClonaFase>Clona Fase</button>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="col-3">
|
||||
<button class="btn btn-secondary w-100" disabled>Sposta Fase</button>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<button class="btn btn-secondary w-100" disabled>Clona Fase</button>
|
||||
</div>
|
||||
}
|
||||
@if (OkSubFase)
|
||||
{
|
||||
<div class="col-3">
|
||||
<button class="btn btn-primary w-100" @onclick=SpostaSubFase>Sposta SottoFase</button>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<button class="btn btn-success w-100" @onclick=ClonaSubFase>Clona SottoFase</button>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="col-3">
|
||||
<button class="btn btn-secondary w-100" disabled>Sposta SottoFase</button>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<button class="btn btn-secondary w-100" disabled>Clona SottoFase</button>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div class="row">
|
||||
@if (isLoading)
|
||||
{
|
||||
<div class="col-12">
|
||||
<LoadingData DisplaySize="LoadingData.CtrlSize.Large"></LoadingData>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="col-6">
|
||||
<FasiMan Title="Origine" HeadCss="bg-info bg-opacity-75 bg-gradient" CanSelProj="true" ShowOnlyActive="!ShowPrjArc" EC_FaseSel="SetFaseOrig"></FasiMan>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<FasiMan Title="Destinazione" HeadCss="bg-success bg-opacity-75 bg-gradient" CanSelProj="true" ShowOnlyActive="!ShowPrjArc" EC_FaseSel="SetFaseDest" EC_ProjSel="SetProjDest"></FasiMan>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,116 @@
|
||||
using GPW.CORE.Data.DbModels;
|
||||
using GPW.CORE.Data.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace GPW.CORE.ADM.Components.Compo
|
||||
{
|
||||
public partial class SpostaFasiMan
|
||||
{
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected MessageService AppMServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected AppAuthService AuthServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected GpwDataService GDataServ { get; set; } = null!;
|
||||
|
||||
protected bool OkFase
|
||||
{
|
||||
get => selFaseOrig != null && selFaseOrig.IdxFaseAncest == 0 && selFaseDest == null && selIdxProjDest > 0;
|
||||
}
|
||||
|
||||
protected bool OkSubFase
|
||||
{
|
||||
get => selFaseOrig != null && selFaseOrig.IdxFaseAncest != 0 && selFaseDest != null && selFaseDest.IdxFaseAncest == 0;
|
||||
}
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected async Task ClonaFase()
|
||||
{
|
||||
isLoading = true;
|
||||
if (selFaseOrig != null)
|
||||
{
|
||||
await GDataServ.AnagFasiDupFase(selIdxProjDest, selFaseOrig.IdxFase);
|
||||
}
|
||||
await Task.Delay(100);
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
protected async Task ClonaSubFase()
|
||||
{
|
||||
isLoading = true;
|
||||
if (selFaseOrig != null && selFaseDest != null)
|
||||
{
|
||||
await GDataServ.AnagFasiDupSubFase(selFaseDest.IdxFase, selFaseOrig.IdxFase);
|
||||
}
|
||||
await Task.Delay(100);
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
protected void SetFaseDest(AnagFasiExplModel selFase)
|
||||
{
|
||||
selFaseDest = selFase;
|
||||
}
|
||||
|
||||
protected void SetFaseOrig(AnagFasiExplModel selFase)
|
||||
{
|
||||
selFaseOrig = selFase;
|
||||
}
|
||||
|
||||
protected void SetProjDest(int idxProj)
|
||||
{
|
||||
selIdxProjDest = idxProj;
|
||||
}
|
||||
|
||||
protected async Task SpostaFase()
|
||||
{
|
||||
isLoading = true;
|
||||
if (selFaseOrig != null)
|
||||
{
|
||||
await GDataServ.AnagFasiMovFase(selIdxProjDest, selFaseOrig.IdxFase);
|
||||
}
|
||||
await Task.Delay(100);
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
protected async Task SpostaSubFase()
|
||||
{
|
||||
isLoading = true;
|
||||
if (selFaseOrig != null && selFaseDest != null)
|
||||
{
|
||||
await GDataServ.AnagFasiMovSubFase(selFaseDest.IdxFase, selFaseOrig.IdxFase);
|
||||
}
|
||||
await Task.Delay(100);
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
protected string Traduci(string lemma)
|
||||
{
|
||||
return AuthServ.Traduci(lemma, AppMServ.UserLang);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private bool isLoading = false;
|
||||
private bool ShowPrjArc = false;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private AnagFasiExplModel? selFaseDest { get; set; } = null;
|
||||
private AnagFasiExplModel? selFaseOrig { get; set; } = null;
|
||||
|
||||
private int selIdxProjDest { get; set; } = 0;
|
||||
|
||||
#endregion Private Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,291 @@
|
||||
|
||||
<div class="card shadow mb-5 border border-secondary">
|
||||
<div class="card-header px-0">
|
||||
<div class="d-flex justify-content-between px-2">
|
||||
<div class="px-0 d-flex justify-content-between">
|
||||
<div class="px-2">
|
||||
<h3>Attività</h3>
|
||||
</div>
|
||||
|
||||
@* <div class="px-2">
|
||||
<button class="btn btn-success" @onclick=Recalc tooltip="Add New"><i class="fa-solid fa-plus"></i> @Traduci("Ricalcola")</button>
|
||||
</div> *@
|
||||
</div>
|
||||
<div class="px-0">
|
||||
<div class="px-0">
|
||||
<div class="d-flex">
|
||||
<div class="px-1 align-content-center">
|
||||
<div class="input-group input-group-sm">
|
||||
<span class="input-group-text">
|
||||
Dipendente
|
||||
</span>
|
||||
<select @bind="@IdxDipSel" class="form-select form-select-sm" @bind:after=ForceReload>
|
||||
<option value="0">--- Selezionare ---</option>
|
||||
@foreach (var item in ListDipendentiFilt)
|
||||
{
|
||||
<option value="@item.IdxDipendente">@($"{item.Cognome} {item.Nome}")</option>
|
||||
}
|
||||
</select>
|
||||
<span class="input-group-text px-0">
|
||||
<span class="form-check form-switch align-content-center ms-2" title="Mostra inattivi">
|
||||
<input class="form-check-input" type="checkbox" @bind=@ShowDipInatt>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="px-0">
|
||||
<PeriodoSel CurrPeriodo="@CurrPeriodo" E_PeriodoSel="@SavePeriodo"></PeriodoSel>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex justify-content-end bg-secondary bg-gradient bg-opacity-75 py-1 px-0">
|
||||
<div class="px-1 d-flex">
|
||||
<div class="input-group input-group-sm">
|
||||
<span class="input-group-text">
|
||||
Cliente
|
||||
</span>
|
||||
<select @bind="@IdxCliSelFrom" class="form-select form-select-sm" @bind:after=ForceReload>
|
||||
<option value="0">--- Tutti ---</option>
|
||||
@foreach (var item in ListClientiFiltFrom)
|
||||
{
|
||||
<option value="@item.IdxCliente">@($"{item.RagSociale}")</option>
|
||||
}
|
||||
</select>
|
||||
<span class="input-group-text px-0">
|
||||
<span class="form-check form-switch align-content-center ms-2" title="Mostra inattivi">
|
||||
<input class="form-check-input" type="checkbox" @bind=@ShowCliInattFrom>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="px-1 d-flex">
|
||||
<div class="input-group input-group-sm">
|
||||
<span class="input-group-text">
|
||||
Progetto
|
||||
</span>
|
||||
@if (IdxCliSelFrom == 0)
|
||||
{
|
||||
<select @bind="@IdxProjSelFrom" disabled class="form-select form-select-sm text-trim opacity-75" style="maxFrom-width:20rem;">
|
||||
<option value="0">--- Tutti ---</option>
|
||||
</select>
|
||||
}
|
||||
else
|
||||
{
|
||||
<select @bind="@IdxProjSelFrom" class="form-select form-select-sm text-trim" style="max-width:20rem;" @bind:after=ForceReload>
|
||||
<option value="0">--- Tutti ---</option>
|
||||
@foreach (var item in ListProgettiFiltFrom)
|
||||
{
|
||||
<option value="@item.IdxProgetto" title="@($"{item.DescrProj}")">@($"{item.NomeProj}")</option>
|
||||
}
|
||||
</select>
|
||||
<span class="input-group-text px-0">
|
||||
<span class="form-check form-switch align-content-center ms-2" title="Mostra inattivi">
|
||||
<input class="form-check-input" type="checkbox" @bind=@ShowProjInattFrom>
|
||||
</span>
|
||||
</span>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="px-2 d-flex">
|
||||
<div class="input-group input-group-sm">
|
||||
<span class="input-group-text">Fase</span>
|
||||
@if (IdxProjSelFrom == 0)
|
||||
{
|
||||
<select @bind="@IdxFaseSelFrom" disabled class="form-select form-select-sm text-trim opacity-75" style="max-width:20rem;">
|
||||
<option value="0">--- Tutti ---</option>
|
||||
</select>
|
||||
}
|
||||
else
|
||||
{
|
||||
<select @bind="@IdxFaseSelFrom" class="form-select form-select-sm text-trim" style="max-width:20rem;" @bind:after=ForceReload>
|
||||
<option value="0">--- Tutti ---</option>
|
||||
@foreach (var item in ListFasiFiltFrom)
|
||||
{
|
||||
if (item.BudgetTime > 0)
|
||||
{
|
||||
<option value="@item.IdxFase" title="@($"{item.DescrizioneFase}")">@($"{item.NomeFase}")</option>
|
||||
}
|
||||
else
|
||||
{
|
||||
<option disabled class="bg-secondary bg-opacity-25 fw-bold" value="@item.IdxFase" title="@($"{item.DescrizioneFase}")">@($"{item.NomeFase}")</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
<span class="input-group-text px-0">
|
||||
<span class="form-check form-switch align-content-center ms-2" title="Mostra inattivi">
|
||||
<input class="form-check-input" type="checkbox" @bind=@ShowFaseInattFrom>
|
||||
</span>
|
||||
</span>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body p-1 small">
|
||||
@if (ListRecords == null || isLoading)
|
||||
{
|
||||
<EgwCoreLib.Razor.LoadingData></EgwCoreLib.Razor.LoadingData>
|
||||
}
|
||||
else if (totalCount == 0)
|
||||
{
|
||||
<div class="alert alert-info">Nessun record trovato</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="row">
|
||||
<div class="@mainDivCss">
|
||||
<table class="table table-striped table-sm text-start small">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-center" title="Toggle Seleziona Tutti">
|
||||
@if (allSel)
|
||||
{
|
||||
<i class="fa-solid fa-toggle-on text-primary fs-5" @onclick="ToggleSelection"></i>
|
||||
}
|
||||
else
|
||||
{
|
||||
<i class="fa-solid fa-toggle-off text-secondary fs-5" @onclick="ToggleSelection"></i>
|
||||
}
|
||||
</th>
|
||||
<th class="text-start">Cognome Nome <Sorter ParamName="CognomeNome" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th class="text-start">Ore <Sorter ParamName="OreTot" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th class="text-start">Periodo <Sorter ParamName="Periodo" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th class="text-start">Gruppo <Sorter ParamName="Gruppo" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th class="text-start">Progetto <Sorter ParamName="Progetto" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th class="text-start">Descrizione <Sorter ParamName="Descrizione" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in ListRecords)
|
||||
{
|
||||
<tr class="@CssCheckSel(item)">
|
||||
<td class="text-center">
|
||||
<input class="form-check-input" type="checkbox" @bind="item.Selected"></input>
|
||||
</td>
|
||||
<td class="text-start">@item.CognomeNome</td>
|
||||
<td class="text-start">@($"{item.OreTot:N2}")</td>
|
||||
<td class="text-center">
|
||||
<div class="bg-secondary bg-gradient rounded-2 text-light text-nowrap px-3 py-1">
|
||||
@($"{item.Inizio:dd/MM/yy HH:mm}") - @($"{item.Fine:HH:mm}")
|
||||
</div>
|
||||
</td>
|
||||
<td class="text-start">@($"{item.Gruppo}") - @($"{item.RagSociale}")</td>
|
||||
<td class="text-start">@($"{item.NomeProj}") - @($"{item.NomeFase}")</td>
|
||||
<td class="text-start text-truncate" style="max-width: 20rem;" title="@item.Descrizione">@item.Descrizione</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="7">
|
||||
<EgwCoreLib.Razor.DataPager PageSize="@numRecord" currPage="@currPage" totalCount="@totalCount" showLoading="@isLoading" numRecordChanged="SetNumRec" numPageChanged="SetPage"></EgwCoreLib.Razor.DataPager>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div class="card-footer bg-primary bg-gradient bg-opacity-75 px-0 py-0">
|
||||
<div class="d-flex justify-content-between py-1">
|
||||
<div class="px-1 d-flex">
|
||||
<div class="px-1 align-content-center">
|
||||
@if (IdxFaseSelTo > 0 && HasRowSelected)
|
||||
{
|
||||
<button class="btn btn-success shadow" @onclick="SpostaSel">Sposta Ore <i class="fa-solid fa-angles-right"></i></button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="btn btn-secondary disabled">Sposta Ore <i class="fa-solid fa-angles-right"></i></button>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="px-1 d-flex justify-content-end">
|
||||
<div class="px-1 d-flex align-content-center">
|
||||
</div>
|
||||
<div class="px-1 d-flex">
|
||||
<div class="input-group input-group-sm">
|
||||
<span class="input-group-text">
|
||||
Cliente
|
||||
</span>
|
||||
<select @bind="@IdxCliSelTo" class="form-select form-select-sm">
|
||||
<option value="0">--- Tutti ---</option>
|
||||
@foreach (var item in ListClientiFiltTo)
|
||||
{
|
||||
<option value="@item.IdxCliente">@($"{item.RagSociale}")</option>
|
||||
}
|
||||
</select>
|
||||
<span class="input-group-text px-0">
|
||||
<span class="form-check form-switch align-content-center ms-2" title="Mostra inattivi">
|
||||
<input class="form-check-input" type="checkbox" @bind=@ShowCliInattTo>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="px-1 d-flex">
|
||||
<div class="input-group input-group-sm">
|
||||
<span class="input-group-text">Progetto</span>
|
||||
@if (IdxCliSelTo == 0)
|
||||
{
|
||||
<select @bind="@IdxProjSelTo" disabled class="form-select form-select-sm text-trim opacity-75" style="max-width:20rem;">
|
||||
<option value="0">--- Tutti ---</option>
|
||||
</select>
|
||||
}
|
||||
else
|
||||
{
|
||||
<select @bind="@IdxProjSelTo" class="form-select form-select-sm text-trim" style="max-width:20rem;">
|
||||
<option value="0">--- Tutti ---</option>
|
||||
@foreach (var item in ListProgettiFiltTo)
|
||||
{
|
||||
<option value="@item.IdxProgetto" title="@($"{item.DescrProj}")">@($"{item.NomeProj}")</option>
|
||||
}
|
||||
</select>
|
||||
<span class="input-group-text px-0">
|
||||
<span class="form-check form-switch align-content-center ms-2" title="Mostra inattivi">
|
||||
<input class="form-check-input" type="checkbox" @bind=@ShowProjInattTo>
|
||||
</span>
|
||||
</span>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="px-1 d-flex">
|
||||
<div class="input-group input-group-sm">
|
||||
<span class="input-group-text">Fase</span>
|
||||
@if (IdxProjSelTo == 0)
|
||||
{
|
||||
<select @bind="@IdxFaseSelTo" disabled class="form-select form-select-sm text-trim opacity-75" style="max-width:20rem;">
|
||||
<option value="0">--- Tutti ---</option>
|
||||
</select>
|
||||
}
|
||||
else
|
||||
{
|
||||
<select @bind="@IdxFaseSelTo" class="form-select form-select-sm text-trim" style="max-width:20rem;">
|
||||
<option value="0">--- Tutti ---</option>
|
||||
@foreach (var item in ListFasiFiltTo)
|
||||
{
|
||||
|
||||
if (item.BudgetTime > 0)
|
||||
{
|
||||
<option value="@item.IdxFase" title="@($"{item.DescrizioneFase}")">@($"{item.NomeFase}")</option>
|
||||
}
|
||||
else
|
||||
{
|
||||
<option disabled class="bg-secondary bg-opacity-25 fw-bold" value="@item.IdxFase" title="@($"{item.DescrizioneFase}")">@($"{item.NomeFase}")</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
<span class="input-group-text px-0">
|
||||
<span class="form-check form-switch align-content-center ms-2" title="Mostra inattivi">
|
||||
<input class="form-check-input" type="checkbox" @bind=@ShowFaseInattTo>
|
||||
</span>
|
||||
</span>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,546 @@
|
||||
using EgwCoreLib.Razor;
|
||||
using EgwCoreLib.Utils;
|
||||
using GPW.CORE.Data.DbModels;
|
||||
using GPW.CORE.Data.DTO;
|
||||
using GPW.CORE.Data.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using NLog;
|
||||
|
||||
namespace GPW.CORE.ADM.Components.Compo
|
||||
{
|
||||
public partial class SpostaOreMan : IDisposable
|
||||
{
|
||||
#region Public Methods
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
AppMServ.EA_SearchUpdated -= AppMServ_EA_SearchUpdated;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected MessageService AppMServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected AppAuthService AuthServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected GpwDataService GDataServ { get; set; } = null!;
|
||||
|
||||
protected bool HasRowSelected
|
||||
{
|
||||
get => ListRecords != null && ListRecords.Where(x => x.Selected).Count() > 0;
|
||||
}
|
||||
|
||||
protected int IdxCliSelFrom
|
||||
{
|
||||
get => idxCliFrom;
|
||||
set
|
||||
{
|
||||
if (idxCliFrom != value)
|
||||
{
|
||||
idxCliFrom = value;
|
||||
idxProjFrom = 0;
|
||||
idxFaseFrom = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected int IdxCliSelTo
|
||||
{
|
||||
get => idxCliTo;
|
||||
set
|
||||
{
|
||||
if (idxCliTo != value)
|
||||
{
|
||||
idxCliTo = value;
|
||||
idxProjTo = 0;
|
||||
idxFaseTo = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected int IdxDipSel
|
||||
{
|
||||
get => idxDipendente;
|
||||
set => idxDipendente = value;
|
||||
}
|
||||
|
||||
protected int IdxFaseSelFrom
|
||||
{
|
||||
get => idxFaseFrom;
|
||||
set => idxFaseFrom = value;
|
||||
}
|
||||
|
||||
protected int IdxFaseSelTo
|
||||
{
|
||||
get => idxFaseTo;
|
||||
set => idxFaseTo = value;
|
||||
}
|
||||
|
||||
protected int IdxProjSelFrom
|
||||
{
|
||||
get => idxProjFrom;
|
||||
set
|
||||
{
|
||||
if (idxProjFrom != value)
|
||||
{
|
||||
idxProjFrom = value;
|
||||
idxFaseFrom = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected int IdxProjSelTo
|
||||
{
|
||||
get => idxProjTo;
|
||||
set
|
||||
{
|
||||
if (idxProjTo != value)
|
||||
{
|
||||
idxProjTo = value;
|
||||
idxFaseTo = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; } = null!;
|
||||
|
||||
protected List<AnagClientiModel> ListClientiFiltFrom
|
||||
{
|
||||
get
|
||||
{
|
||||
List<AnagClientiModel> answ = new List<AnagClientiModel>();
|
||||
if (ShowCliInattFrom)
|
||||
{
|
||||
answ = ListClienti;
|
||||
}
|
||||
else
|
||||
{
|
||||
answ = ListClienti.Where(x => x.Attivo).ToList();
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
protected List<AnagClientiModel> ListClientiFiltTo
|
||||
{
|
||||
get
|
||||
{
|
||||
List<AnagClientiModel> answ = new List<AnagClientiModel>();
|
||||
if (ShowCliInattTo)
|
||||
{
|
||||
answ = ListClienti;
|
||||
}
|
||||
else
|
||||
{
|
||||
answ = ListClienti.Where(x => x.Attivo).ToList();
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
protected List<DipendentiModel> ListDipendentiFilt
|
||||
{
|
||||
get
|
||||
{
|
||||
List<DipendentiModel> answ = new List<DipendentiModel>();
|
||||
if (ShowDipInatt)
|
||||
{
|
||||
answ = ListDipendenti;
|
||||
}
|
||||
else
|
||||
{
|
||||
answ = ListDipendenti.Where(x => (x.Attivo ?? false)).ToList();
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
protected List<AnagFasiModel> ListFasiFiltFrom
|
||||
{
|
||||
get
|
||||
{
|
||||
List<AnagFasiModel> answ = new List<AnagFasiModel>();
|
||||
if (idxProjFrom > 0)
|
||||
{
|
||||
answ = ListFasi
|
||||
.Where(x => x.IdxProgetto == IdxProjSelFrom && (x.Attivo || ShowFaseInattFrom))
|
||||
.OrderBy(x => x.CodFase)
|
||||
.ToList();
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
protected List<AnagFasiModel> ListFasiFiltTo
|
||||
{
|
||||
get
|
||||
{
|
||||
List<AnagFasiModel> answ = new List<AnagFasiModel>();
|
||||
if (idxProjTo > 0)
|
||||
{
|
||||
answ = ListFasi
|
||||
.Where(x => x.IdxProgetto == IdxProjSelTo && (x.Attivo || ShowFaseInattTo))
|
||||
.OrderBy(x => x.CodFase)
|
||||
.ToList();
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
protected List<AnagProgettiModel> ListProgettiFiltFrom
|
||||
{
|
||||
get
|
||||
{
|
||||
List<AnagProgettiModel> answ = new List<AnagProgettiModel>();
|
||||
if (idxCliFrom > 0)
|
||||
{
|
||||
answ = ListProgetti.Where(x => x.IdxCliente == IdxCliSelFrom && ((x.Attivo ?? false) || ShowProjInattFrom)).ToList();
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
protected List<AnagProgettiModel> ListProgettiFiltTo
|
||||
{
|
||||
get
|
||||
{
|
||||
List<AnagProgettiModel> answ = new List<AnagProgettiModel>();
|
||||
if (idxCliTo > 0)
|
||||
{
|
||||
answ = ListProgetti.Where(x => x.IdxCliente == IdxCliSelTo && ((x.Attivo ?? false) || ShowProjInattTo)).ToList();
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected string CssCheckSel(RegAttDayExpDTO currRec)
|
||||
{
|
||||
bool isSel = SelRecord != null && SelRecord.IdxDipendente == currRec.IdxDipendente;
|
||||
return isSel ? "table-info" : "";
|
||||
}
|
||||
|
||||
protected async Task ForceReload()
|
||||
{
|
||||
currPage = 1;
|
||||
SelRecord = null;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected async Task ForceReloadList()
|
||||
{
|
||||
await ReloadBaseData();
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
AppMServ.EA_SearchUpdated += AppMServ_EA_SearchUpdated;
|
||||
await ReloadBaseData();
|
||||
}
|
||||
|
||||
protected async void Recalc()
|
||||
{
|
||||
await Task.Delay(200);
|
||||
}
|
||||
|
||||
protected async Task SetNumRec(int newNum)
|
||||
{
|
||||
numRecord = newNum;
|
||||
currPage = 1;
|
||||
await AppMServ.NumRowGridSet(gridKey, newNum);
|
||||
await InvokeAsync(ReloadData);
|
||||
}
|
||||
|
||||
protected async Task SetPage(int newNum)
|
||||
{
|
||||
currPage = newNum;
|
||||
allSel = false;
|
||||
await InvokeAsync(ReloadData);
|
||||
}
|
||||
|
||||
protected async Task SortRequested(Sorter.SortCallBack e)
|
||||
{
|
||||
sortField = e.ParamName;
|
||||
sortAsc = e.IsAscending;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua spostamento degli item selezionati verso la fase di destinazione
|
||||
/// </summary>
|
||||
protected async Task SpostaSel()
|
||||
{
|
||||
var cliente = ListClienti.FirstOrDefault(x => x.IdxCliente == IdxCliSelTo);
|
||||
var progetto = ListProgetti.FirstOrDefault(x => x.IdxProgetto == IdxProjSelTo);
|
||||
var fase = ListFasi.FirstOrDefault(x => x.IdxFase == IdxFaseSelTo);
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", $"Sicuro di voler spostare i record selezionati?{Environment.NewLine}{Environment.NewLine}Cliente: {cliente.RagSociale}{Environment.NewLine}Progetto: {progetto.NomeProj} | {progetto.DescrProj}{Environment.NewLine}Fase: {fase.DescrizioneFase}"))
|
||||
return;
|
||||
|
||||
// solo se ho una fase dest selezionata
|
||||
if (IdxFaseSelTo > 0)
|
||||
{
|
||||
Dictionary<int, int> list2move = new Dictionary<int, int>();
|
||||
foreach (var item in ListRecords)
|
||||
{
|
||||
if (item.Selected)
|
||||
{
|
||||
// inserisco in dizionario la riga da spostare
|
||||
list2move.Add(item.IdxRA, IdxFaseSelTo);
|
||||
}
|
||||
}
|
||||
// sposto righe!
|
||||
await GDataServ.RegAttUpdateFase(list2move);
|
||||
await ReloadData();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua toggle selezione globale delle righe mostrateGpwDataService gDataServprivate async Task ReloadData
|
||||
/// </summary>
|
||||
protected void ToggleSelection()
|
||||
{
|
||||
allSel = !allSel;
|
||||
foreach (var item in ListRecords)
|
||||
{
|
||||
item.Selected = allSel;
|
||||
}
|
||||
}
|
||||
|
||||
protected string Traduci(string lemma)
|
||||
{
|
||||
return AuthServ.Traduci(lemma, AppMServ.UserLang);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
private bool allSel = false;
|
||||
|
||||
private int currPage = 1;
|
||||
|
||||
private string gridKey = "TimbMan";
|
||||
|
||||
private int idxCliFrom = 0;
|
||||
|
||||
private int idxCliTo = 0;
|
||||
|
||||
private int idxDipendente = 0;
|
||||
|
||||
private int idxFaseFrom = 0;
|
||||
|
||||
private int idxFaseTo = 0;
|
||||
|
||||
private int idxProjFrom = 0;
|
||||
|
||||
private int idxProjTo = 0;
|
||||
|
||||
private bool isAncest = false;
|
||||
|
||||
private bool isLoading = false;
|
||||
|
||||
private int numRecord = 10;
|
||||
|
||||
private bool ShowCliInattFrom = false;
|
||||
|
||||
private bool ShowCliInattTo = false;
|
||||
|
||||
private bool ShowDipInatt = false;
|
||||
|
||||
private bool ShowFaseInattFrom = false;
|
||||
|
||||
private bool ShowFaseInattTo = false;
|
||||
|
||||
private bool ShowProjInattFrom = false;
|
||||
|
||||
private bool ShowProjInattTo = false;
|
||||
|
||||
private bool sortAsc = true;
|
||||
|
||||
private string sortField = "";
|
||||
|
||||
private int totalCount = 0;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private DtUtils.Periodo CurrPeriodo { get; set; } = new DtUtils.Periodo(DtUtils.PeriodSet.ThisMonth);
|
||||
|
||||
private List<AnagClientiModel> ListClienti { get; set; } = new List<AnagClientiModel>();
|
||||
|
||||
private List<DipendentiModel> ListDipendenti { get; set; } = new List<DipendentiModel>();
|
||||
|
||||
private List<AnagFasiModel> ListFasi { get; set; } = new List<AnagFasiModel>();
|
||||
|
||||
private List<AnagProgettiModel> ListProgetti { get; set; } = new List<AnagProgettiModel>();
|
||||
|
||||
private List<RegAttDayExpDTO>? ListRecords { get; set; } = null;
|
||||
|
||||
private string mainDivCss
|
||||
{
|
||||
get => SelRecord == null ? "col-12" : "col-12 col-lg-9";
|
||||
}
|
||||
|
||||
private List<RegAttDayExpDTO>? SearchRecords { get; set; } = null;
|
||||
|
||||
private RegAttDayExpDTO? SelRecord { get; set; } = null;
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private async void AppMServ_EA_SearchUpdated()
|
||||
{
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Caricamento dati "statici" dei selettori
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private async Task ReloadBaseData()
|
||||
{
|
||||
ListDipendenti = await GDataServ.DipendentiGetAll();
|
||||
ListClienti = await GDataServ.AnagClientiAllAsync();
|
||||
ListProgetti = await GDataServ.AnagProjAll();
|
||||
ListFasi = await GDataServ.AnagFasiAll();
|
||||
}
|
||||
|
||||
private async Task ReloadData()
|
||||
{
|
||||
isLoading = true;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
// tolgo selezione toggle
|
||||
allSel = false;
|
||||
|
||||
// carico i dati della tabella
|
||||
List<RegAttivitaDayExplModel> rawData = await GDataServ.RegAttDayExplList(idxDipendente, CurrPeriodo.Inizio, CurrPeriodo.Fine, idxCliFrom, idxProjFrom, idxFaseFrom, isAncest);
|
||||
|
||||
// se ho ricerca filtro (descrizione)
|
||||
if (!string.IsNullOrWhiteSpace(AppMServ.SearchVal))
|
||||
{
|
||||
rawData = rawData
|
||||
.Where(x => x.Descrizione.Contains(AppMServ.SearchVal, StringComparison.InvariantCultureIgnoreCase))
|
||||
.ToList();
|
||||
}
|
||||
|
||||
// converto da model a DTO...
|
||||
SearchRecords = rawData
|
||||
.Select(x => new RegAttDayExpDTO(x))
|
||||
.ToList();
|
||||
totalCount = SearchRecords.Count;
|
||||
|
||||
// paginazione e sorting
|
||||
SortTable();
|
||||
|
||||
isLoading = false;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
private async Task SavePeriodo(DtUtils.Periodo newPeiodo)
|
||||
{
|
||||
CurrPeriodo = newPeiodo;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
private void SortTable()
|
||||
{
|
||||
if (SearchRecords != null)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(sortField))
|
||||
{
|
||||
switch (sortField)
|
||||
{
|
||||
case "CognomeNome":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.CognomeNome).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.CognomeNome).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "OreTot":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.OreTot).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.OreTot).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "Periodo":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.Inizio).ThenBy(x => x.Fine).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.Inizio).ThenBy(x => x.Fine).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "Gruppo":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.Gruppo).ThenBy(x => x.RagSociale).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.Gruppo).ThenBy(x => x.RagSociale).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "Progetto":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.NomeProj).ThenBy(x => x.NomeFase).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.NomeProj).ThenBy(x => x.NomeFase).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "Descrizione":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.Descrizione).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.Descrizione).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
ListRecords = SearchRecords
|
||||
.Skip(numRecord * (currPage - 1))
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<div class="row g-1">
|
||||
<div class="col-md-3">
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" @bind="@CurrRecord.CodGruppo">
|
||||
<label class="small">Gruppo</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" @bind="@CurrRecord.Descrizione">
|
||||
<label class="small">Descrizione</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
<div class="form-floating">
|
||||
<span class="form-control">
|
||||
<div class="form-check form-switch">
|
||||
<input type="checkbox" class="form-check-input" @bind="@CurrRecord.Enabled">
|
||||
</div>
|
||||
</span>
|
||||
<label class="small">Att.</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3 pt-2">
|
||||
<button class="btn btn-success w-100" @onclick="() => DoSave()"><i class="fas fa-floppy-disk"></i> Save</button>
|
||||
<button class="btn btn-warning w-100" @onclick="() => DoCancel()"><i class="fas fa-ban"></i> Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
using GPW.CORE.Data.DbModels;
|
||||
using GPW.CORE.Data.DTO;
|
||||
using GPW.CORE.Data.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace GPW.CORE.ADM.Components.Compo
|
||||
{
|
||||
public partial class TagsEdit
|
||||
{
|
||||
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public TagFasiDTO? CurrRecord { get; set; } = null;
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<bool> EC_update { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected GpwDataService GDataServ { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected async Task DoSave()
|
||||
{
|
||||
bool fatto = false;
|
||||
await Task.Delay(1);
|
||||
if (CurrRecord != null)
|
||||
{
|
||||
fatto = await GDataServ.AnagTagFasiUpsert(CurrRecord);
|
||||
}
|
||||
await EC_update.InvokeAsync(fatto);
|
||||
}
|
||||
|
||||
protected async Task DoCancel()
|
||||
{
|
||||
await EC_update.InvokeAsync(true);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
@if (SelItem != null)
|
||||
{
|
||||
<div class="modal fade show" tabindex="-1" style="display:block; background-color: rgba(10,10,10,.6);" aria-modal="true" role="dialog" data-keyboard="true">
|
||||
<div class="modal-dialog modal-xl">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title">Edit Etichetta <b>@SelItem.CodTagFase</b></h4>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close" @onclick="() => ForceReload(true)"></button>
|
||||
</div>
|
||||
<div class="modal-body p-1 small">
|
||||
<TagsEdit CurrRecord=@SelItem EC_update="ForceReload"></TagsEdit>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
<div class="card shadow">
|
||||
<div class="card-header">
|
||||
<div class="d-flex">
|
||||
<div class="px-0">
|
||||
<h3>Gestione Etichette</h3>
|
||||
</div>
|
||||
<div class="px-2">
|
||||
<button class="btn btn-success" @onclick=CreateNew tooltip="Add New"><i class="fa-solid fa-plus"></i> Add New</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body p-1 small">
|
||||
@if (ListRecords == null || isLoading)
|
||||
{
|
||||
<EgwCoreLib.Razor.LoadingData></EgwCoreLib.Razor.LoadingData>
|
||||
}
|
||||
else if (totalCount == 0)
|
||||
{
|
||||
<div class="alert alert-warning text-bg-danger align-content-center text-center fs-4">Nessun record trovato</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<table class="table table-striped table-sm text-start">
|
||||
<thead>
|
||||
<tr class="">
|
||||
<th>
|
||||
<button class="btn btn-primary btn-sm" @onclick="() => ForceReload(true)"><i class="fa-solid fa-rotate"></i></button>
|
||||
</th>
|
||||
<th>Etichetta <Sorter ParamName="CodTagFase" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th>Gruppo <Sorter ParamName="CodGruppo" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th>Descrizione <Sorter ParamName="Descrizione" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th>Att. <Sorter ParamName="PICF" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th class="text-end"><Sorter ParamName="NumFasi" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter> # Fasi</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in ListRecords)
|
||||
{
|
||||
<tr class="align-middle @CheckSel(item)">
|
||||
<td>
|
||||
@if (SelItem == null)
|
||||
{
|
||||
<button class="btn btn-primary btn-sm" @onclick="() => DoEdit(item)"><i class="fa-solid fa-edit"></i></button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="btn btn-secondary btn-sm" disabled><i class="fa-solid fa-edit"></i></button>
|
||||
}
|
||||
</td>
|
||||
<td>
|
||||
@item.CodTagFase
|
||||
</td>
|
||||
<td>
|
||||
@item.CodGruppo
|
||||
</td>
|
||||
<td>
|
||||
@item.Descrizione
|
||||
</td>
|
||||
<td>
|
||||
@if (item.Enabled)
|
||||
{
|
||||
<i class="fa-solid fa-certificate text-success"></i>
|
||||
}
|
||||
else
|
||||
{
|
||||
<i class="fa-solid fa-certificate text-secondary"></i>
|
||||
}
|
||||
</td>
|
||||
<td class="text-end">
|
||||
@item.NumFasi
|
||||
</td>
|
||||
<td>
|
||||
@if (item.Enabled && item.NumFasi == 0)
|
||||
{
|
||||
<button class="btn btn-danger btn-sm" @onclick="() => DoDelete(item)"><i class="fa-solid fa-trash"></i></button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="btn btn-secondary btn-sm" disabled><i class="fa-solid fa-trash"></i></button>
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<EgwCoreLib.Razor.DataPager PageSize="@numRecord" currPage="@currPage" numRecordChanged="SetNumRec" numPageChanged="SetPage" totalCount="@totalCount" showLoading="@isLoading"></EgwCoreLib.Razor.DataPager>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -0,0 +1,246 @@
|
||||
using EgwCoreLib.Razor;
|
||||
using GPW.CORE.Data.DbModels;
|
||||
using GPW.CORE.Data.DTO;
|
||||
using GPW.CORE.Data.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using NLog;
|
||||
using static EgwCoreLib.Razor.Toggler;
|
||||
|
||||
namespace GPW.CORE.ADM.Components.Compo
|
||||
{
|
||||
public partial class TagsMan : IDisposable
|
||||
{
|
||||
#region Public Methods
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
AppMServ.EA_SearchUpdated -= AppMServ_EA_SearchUpdated;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected MessageService AppMServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected GpwDataService GDataServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected string CheckSel(TagFasiDTO curItem)
|
||||
{
|
||||
string answ = "";
|
||||
|
||||
if (SelItem != null)
|
||||
{
|
||||
answ = curItem.CodTagFase == SelItem.CodTagFase ? "table-info" : "";
|
||||
}
|
||||
// verifico stato attivo
|
||||
answ += !curItem.Enabled ? " striked" : "";
|
||||
return answ;
|
||||
}
|
||||
|
||||
protected async Task CreateNew()
|
||||
{
|
||||
SelItem = new TagFasiDTO()
|
||||
{
|
||||
CodTagFase = "_COD0000",
|
||||
Descrizione = $"Nuova Tag Fase - {DateTime.Now}",
|
||||
CodGruppo = "ND",
|
||||
Enabled = true
|
||||
};
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
protected async void DoDelete(TagFasiDTO selItem)
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sicuro di voler eliminare il record?"))
|
||||
return;
|
||||
|
||||
isLoading = true;
|
||||
bool fatto = await GDataServ.AnagTagFasiDelete(selItem);
|
||||
await ReloadData();
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
protected void DoEdit(TagFasiDTO? selItem)
|
||||
{
|
||||
SelItem = selItem;
|
||||
}
|
||||
|
||||
protected async Task ForceReload(bool force)
|
||||
{
|
||||
SelItem = null;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
CurrSearch = "";
|
||||
AppMServ.SearchVal = "";
|
||||
AppMServ.EA_SearchUpdated += AppMServ_EA_SearchUpdated;
|
||||
numRecord = await AppMServ.NumRowGridGet(gridKey);
|
||||
}
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected async Task SetNumRec(int newNum)
|
||||
{
|
||||
numRecord = newNum;
|
||||
currPage = 1;
|
||||
await AppMServ.NumRowGridSet(gridKey, newNum);
|
||||
await InvokeAsync(ReloadData);
|
||||
}
|
||||
|
||||
protected async Task SetPage(int newNum)
|
||||
{
|
||||
currPage = newNum;
|
||||
await InvokeAsync(ReloadData);
|
||||
}
|
||||
|
||||
protected async Task SortRequested(Sorter.SortCallBack e)
|
||||
{
|
||||
sortField = e.ParamName;
|
||||
sortAsc = e.IsAscending;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
private string gridKey = "TagsMan";
|
||||
private TagFasiDTO? SelItem = null;
|
||||
private bool sortAsc = true;
|
||||
private string sortField = "";
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private int currPage { get; set; } = 1;
|
||||
private string CurrSearch { get; set; } = "";
|
||||
private bool isLoading { get; set; } = false;
|
||||
private List<TagFasiDTO>? ListRecords { get; set; } = null;
|
||||
private int numRecord { get; set; } = 10;
|
||||
private List<TagFasiDTO>? SearchRecords { get; set; } = null;
|
||||
private int totalCount { get; set; } = 0;
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private async void AppMServ_EA_SearchUpdated()
|
||||
{
|
||||
CurrSearch = AppMServ.SearchVal;
|
||||
await ReloadData();
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
private async Task ReloadData()
|
||||
{
|
||||
isLoading = true;
|
||||
ListRecords = null;
|
||||
try
|
||||
{
|
||||
SearchRecords = await GDataServ.AnagTagFasiAllAsync();
|
||||
// verifico filtro per ricerca
|
||||
if (!string.IsNullOrEmpty(CurrSearch))
|
||||
{
|
||||
SearchRecords = SearchRecords.Where(x => x.Descrizione.Contains(CurrSearch, StringComparison.InvariantCultureIgnoreCase)).ToList();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error($"Eccezione in recupero dati{Environment.NewLine}{ex}");
|
||||
}
|
||||
totalCount = SearchRecords.Count;
|
||||
SortTable();
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
private void SortTable()
|
||||
{
|
||||
if (SearchRecords != null)
|
||||
{
|
||||
// se ho ordinamento riordino...
|
||||
if (!string.IsNullOrEmpty(sortField))
|
||||
{
|
||||
switch (sortField)
|
||||
{
|
||||
case "Descrizione":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.Descrizione).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.Descrizione).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "CodGruppo":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.CodGruppo).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.CodGruppo).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "CodTagFase":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.CodTagFase).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.CodTagFase).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "NumFasi":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.NumFasi).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.NumFasi).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// filtro x display
|
||||
ListRecords = SearchRecords
|
||||
.Skip(numRecord * (currPage - 1))
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
ListRecords = new List<TagFasiDTO>();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
@inject DialogService DialogService
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header" style="@($"background: {model.Color}; color: {model.ForeColor};")">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-0">Tipologia:</div>
|
||||
<div class="px-0"><b>@model.CodTipo</b></div>
|
||||
</div>
|
||||
</div>
|
||||
<ul class="list-group list-group-flush">
|
||||
<li class="list-group-item">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-0">Nome:</div>
|
||||
@if (@model.IdxDipendente > 0)
|
||||
{
|
||||
<div class="px-0"><b>@model.Abbrev</b></div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="px-0"><b>@model.Descrizione</b></div>
|
||||
}
|
||||
</div>
|
||||
</li>
|
||||
@if (model.DtEnd.Subtract(model.DtStart).TotalDays < 1 && model.CodTipo != "FER")
|
||||
{
|
||||
<li class="list-group-item">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-0">Data:</div>
|
||||
<div class="px-0"><b>@($"{model.DtStart:ddd yyyy-MM-dd}")</b></div>
|
||||
</div>
|
||||
</li>
|
||||
}
|
||||
<li class="list-group-item">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-0">Inizio:</div>
|
||||
<div class="px-0"><b>@(EventDTO.DateForm(model.CodTipo, model.DtStart))</b></div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-0">Fine:</div>
|
||||
<div class="px-0"><b>@(EventDTO.DateForm(model.CodTipo, model.DtEnd))</b></div>
|
||||
</div>
|
||||
</li>
|
||||
@if (model.IdxDipendente == idxDipendente)
|
||||
{
|
||||
<li class="list-group-item">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-0">Note:</div>
|
||||
<div class="px-0"><b>@model.Note</b></div>
|
||||
</div>
|
||||
</li>
|
||||
}
|
||||
@if (!model.Conf)
|
||||
{
|
||||
<li class="list-group-item text-center bg-danger text-warning">
|
||||
<b>NON CONFERMATO</b>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public EventDTO ThisTask { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected MessageService AppMServ { get; set; } = null!;
|
||||
|
||||
EventDTO model = new EventDTO();
|
||||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
model = ThisTask;
|
||||
}
|
||||
protected int idxDipendente
|
||||
{
|
||||
get => AppMServ.IdxDipendente;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
<div class="card shadow">
|
||||
<div class="card-header">
|
||||
<h5>Timbrature</h5>
|
||||
</div>
|
||||
<div class="card-body py-0 px-2">
|
||||
@if (ListRecord == null || ListRecord.Count == 0)
|
||||
{
|
||||
<div class="alert alert-info p-2 my-1">Nessun record trovato</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<table class="table table-sm table-striped table-responsive-md">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><i class="fa-solid fa-stopwatch"></i></th>
|
||||
<th class="text-center" title="Entrata"><i class="fas fa-sign-in-alt"></i></th>
|
||||
<th class="text-center">Scambio</th>
|
||||
<th class="text-center" title="Uscita"><i class="fas fa-sign-out-alt"></i></th>
|
||||
<th class="text-end"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in ListRecord)
|
||||
{
|
||||
<tr>
|
||||
<td class="small">@($"{item.DataOra:dd/MM - HH:mm}")</td>
|
||||
<td title="Entrata" class="text-center">
|
||||
@if (@item.Entrata == true)
|
||||
{
|
||||
<i class="fas fa-times fs-5"></i>
|
||||
}
|
||||
</td>
|
||||
<td class="text-center">
|
||||
@if (EnableEdit)
|
||||
{
|
||||
<button class="btn btn-sm btn-primary" title="Scambio IN/OUT" @onclick="() => ScambioInOut(item)"><i class="fas fa-exchange-alt"></i></button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="btn btn-sm btn-secondary bg-opacity-50" title="Scambio IN/OUT"><i class="fas fa-exchange-alt"></i></button>
|
||||
}
|
||||
</td>
|
||||
<td title="Uscita" class="text-center">
|
||||
@if (@item.Entrata == false)
|
||||
{
|
||||
<i class="fas fa-times fs-5"></i>
|
||||
}
|
||||
</td>
|
||||
<td class="text-end">
|
||||
@if (EnableDelete)
|
||||
{
|
||||
<button class="btn btn-sm btn-danger" @onclick="() => Delete(item)" title="Elimina Timbratura"><i class="fas fa-trash-alt"></i></button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="btn btn-sm btn-secondary" disabled><i class="fas fa-trash-alt"></i></button>
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
using GPW.CORE.Data.DbModels;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace GPW.CORE.ADM.Components.Compo
|
||||
{
|
||||
public partial class TimbList
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<TimbratureModel> EC_ReqDelete { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<TimbratureModel> EC_ReqUpdate { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public bool EnableDelete { get; set; } = false;
|
||||
|
||||
[Parameter]
|
||||
public bool EnableEdit { get; set; } = false;
|
||||
|
||||
[Parameter]
|
||||
public List<TimbratureModel>? ListRecord
|
||||
{
|
||||
get => listRec;
|
||||
set => listRec = value;
|
||||
}
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected List<TimbratureModel>? listRec
|
||||
{
|
||||
get
|
||||
{
|
||||
return _ListRec;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value != null)
|
||||
{
|
||||
_ListRec = value.OrderByDescending(x => x.DataOra).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
_ListRec = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected async void Delete(TimbratureModel currRecord)
|
||||
{
|
||||
await EC_ReqDelete.InvokeAsync(currRecord);
|
||||
}
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
protected async void ScambioInOut(TimbratureModel currRecord)
|
||||
{
|
||||
currRecord.Entrata = !currRecord.Entrata;
|
||||
await EC_ReqUpdate.InvokeAsync(currRecord);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private List<TimbratureModel>? _ListRec { get; set; } = new List<TimbratureModel>();
|
||||
|
||||
#endregion Private Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
<div class="card shadow">
|
||||
<div class="card-header">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-0 d-flex">
|
||||
<div class="px-0">
|
||||
<h3>@Traduci("timbMensili")</h3>
|
||||
</div>
|
||||
<div class="px-2">
|
||||
<button class="btn btn-success" @onclick=Recalc tooltip="Add New"><i class="fa-solid fa-plus"></i> @Traduci("Ricalcola")</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="px-0">
|
||||
<div class="d-flex align-middle">
|
||||
<div class="px-1 py-2">
|
||||
<div class="form-check form-switch">
|
||||
<input class="form-check-input" type="checkbox" @bind=@ShowInatt @bind:after=ForceReload>
|
||||
<label class="form-check-label">Mostra Inattivi</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="px-1 py-1">
|
||||
<select @bind="@IdxDipSel" class="form-select form-select-sm" @bind:after=ForceReload>
|
||||
<option value="0">--- Selezionare ---</option>
|
||||
@foreach (var item in ListDipendenti)
|
||||
{
|
||||
<option value="@item.IdxDipendente">@($"{item.Cognome} {item.Nome}")</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
<div class="px-0">
|
||||
<PeriodoSel CurrPeriodo="@CurrPeriodo" E_PeriodoSel="@SavePeriodo"></PeriodoSel>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body p-1 small">
|
||||
|
||||
@if (ListRecords == null || isLoading)
|
||||
{
|
||||
<EgwCoreLib.Razor.LoadingData></EgwCoreLib.Razor.LoadingData>
|
||||
}
|
||||
else if (totalCount == 0)
|
||||
{
|
||||
<div class="alert alert-info">Nessun record trovato</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="row">
|
||||
<div class="@mainDivCss">
|
||||
<table class="table table-striped table-sm text-start">
|
||||
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-end">Anno <Sorter ParamName="Anno" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th class="text-end">Mese <Sorter ParamName="Mese" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th class="text-end">Dipendente <Sorter ParamName="IdxDipendente" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th class="text-end">Ordinarie <Sorter ParamName="totOreOrd" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th class="text-end">Lavorate <Sorter ParamName="totLav" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th class="text-end">Non Lavorate <Sorter ParamName="totOreNonLav" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th class="text-end">Permessi <Sorter ParamName="totOrePerm" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th class="text-end">Ferie <Sorter ParamName="totOreFer" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th class="text-end">Festive <Sorter ParamName="totOreFest" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th class="text-end">Straordinarie <Sorter ParamName="totOreStra" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@foreach (var item in ListRecords)
|
||||
{
|
||||
<tr class="@CssCheckSel(item)">
|
||||
<td class="text-end">@item.Anno</td>
|
||||
<td class="text-end">@item.Mese</td>
|
||||
<td class="text-end">@item.IdxDipendente</td>
|
||||
<td class="text-end">@item.totOreOrd</td>
|
||||
<td class="text-end">@item.totLav.ToString("N2")</td>
|
||||
<td class="text-end">@item.totOreNonLav.ToString("N2")</td>
|
||||
<td class="text-end">@item.totOrePerm.ToString("N2")</td>
|
||||
<td class="text-end">@item.totOreFer</td>
|
||||
<td class="text-end">@item.totOreFest</td>
|
||||
<td class="text-end">@item.totOreStra.ToString("N2")</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
<div class="card-footer">
|
||||
<EgwCoreLib.Razor.DataPager PageSize="@numRecord" currPage="@currPage" totalCount="@totalCount" showLoading="@isLoading" numRecordChanged="SetNumRec" numPageChanged="SetPage"></EgwCoreLib.Razor.DataPager>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,280 @@
|
||||
using EgwCoreLib.Razor;
|
||||
using EgwCoreLib.Utils;
|
||||
using GPW.CORE.Data.DbModels;
|
||||
using GPW.CORE.Data.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using NLog;
|
||||
|
||||
namespace GPW.CORE.ADM.Components.Compo
|
||||
{
|
||||
public partial class TimbMensMan
|
||||
{
|
||||
|
||||
[Inject]
|
||||
protected AppAuthService AuthServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected MessageService AppMServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected GpwDataService GDataServ { get; set; } = null!;
|
||||
|
||||
protected int IdxDipSel { get; set; } = 0;
|
||||
|
||||
|
||||
protected string Traduci(string lemma)
|
||||
{
|
||||
return AuthServ.Traduci(lemma, AppMServ.UserLang);
|
||||
}
|
||||
|
||||
|
||||
protected async void Recalc()
|
||||
{
|
||||
await Task.Delay(200);
|
||||
}
|
||||
|
||||
protected async Task ForceReload()
|
||||
{
|
||||
currPage = 1;
|
||||
SelRecord = null;
|
||||
await ReloadData();
|
||||
}
|
||||
protected async Task SortRequested(Sorter.SortCallBack e)
|
||||
{
|
||||
sortField = e.ParamName;
|
||||
sortAsc = e.IsAscending;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected string CssCheckSel(TimbMeseExplModel currRec)
|
||||
{
|
||||
bool isSel = SelRecord != null && SelRecord.IdxDipendente == currRec.IdxDipendente && SelRecord.Anno == currRec.Anno && SelRecord.Mese == currRec.Mese;
|
||||
return isSel ? "table-info" : "";
|
||||
}
|
||||
|
||||
|
||||
protected async Task SetNumRec(int newNum)
|
||||
{
|
||||
numRecord = newNum;
|
||||
currPage = 1;
|
||||
await AppMServ.NumRowGridSet(gridKey, newNum);
|
||||
await InvokeAsync(ReloadData);
|
||||
}
|
||||
protected async Task SetPage(int newNum)
|
||||
{
|
||||
currPage = newNum;
|
||||
await InvokeAsync(ReloadData);
|
||||
}
|
||||
|
||||
private bool sortAsc = true;
|
||||
|
||||
private string sortField = "";
|
||||
private bool ShowInatt { get; set; } = false;
|
||||
private int currPage { get; set; } = 1;
|
||||
private TimbMeseExplModel? SelRecord { get; set; } = null;
|
||||
private bool isLoading { get; set; } = false;
|
||||
private List<TimbMeseExplModel>? ListRecords { get; set; } = null;
|
||||
private int numRecord { get; set; } = 10;
|
||||
private int totalCount { get; set; } = 0;
|
||||
private DtUtils.Periodo CurrPeriodo { get; set; } = new DtUtils.Periodo(DtUtils.PeriodSet.ThisMonth);
|
||||
private List<DipendentiModel> ListDipendenti { get; set; } = new List<DipendentiModel>();
|
||||
private List<TimbMeseExplModel>? SearchRecords { get; set; } = null;
|
||||
|
||||
private string gridKey = "TimbMan";
|
||||
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
|
||||
private string mainDivCss
|
||||
{
|
||||
get => SelRecord == null ? "col-12" : "col-12 col-lg-9";
|
||||
}
|
||||
private string detDivCss
|
||||
{
|
||||
get => SelRecord == null ? "col-0" : "col-12 col-lg-3";
|
||||
}
|
||||
|
||||
private async Task ReloadData()
|
||||
{
|
||||
isLoading = true;
|
||||
ListRecords = null;
|
||||
var rawList = await GDataServ.DipendentiGetAll();
|
||||
|
||||
#if true
|
||||
|
||||
if (ShowInatt)
|
||||
{
|
||||
ListDipendenti = rawList;
|
||||
}
|
||||
else
|
||||
{
|
||||
ListDipendenti = rawList.Where(x => (x.Attivo ?? false)).ToList();
|
||||
}
|
||||
try
|
||||
{
|
||||
SearchRecords = await GDataServ.TimbMeseExplList(IdxDipSel, CurrPeriodo.Inizio, CurrPeriodo.Fine);
|
||||
// verifico filtro per IdxDip
|
||||
if (IdxDipSel > 0)
|
||||
{
|
||||
SearchRecords = SearchRecords.Where(x => x.IdxDipendente == IdxDipSel).ToList();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error($"Eccezione in recupero dati{Environment.NewLine}{ex}");
|
||||
}
|
||||
totalCount = SearchRecords.Count;
|
||||
SortTable();
|
||||
#endif
|
||||
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
|
||||
private void SortTable()
|
||||
{
|
||||
if (SearchRecords != null)
|
||||
{
|
||||
// se ho ordinamento riordino...
|
||||
if (!string.IsNullOrEmpty(sortField))
|
||||
{
|
||||
switch (sortField)
|
||||
{
|
||||
case "Anno":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.Anno).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.Anno).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "Mese":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.Mese).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.Mese).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "IdxDipendente":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.IdxDipendente).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.IdxDipendente).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "totOreOrd":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.totOreOrd).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.totOreOrd).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "totLav":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.totLav).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.totLav).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "totOreNonLav":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.totOreNonLav).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.totOreNonLav).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "totOrePerm":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.totOrePerm).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.totOrePerm).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "totOreFer":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.totOreFer).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.totOreFer).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "totOreFest":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.totOreFest).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.totOreFest).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "totOreStra":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.totOreStra).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.totOreStra).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// filtro x display
|
||||
ListRecords = SearchRecords
|
||||
.Skip(numRecord * (currPage - 1))
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
ListRecords = new List<TimbMeseExplModel>();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private async Task SavePeriodo(DtUtils.Periodo newPeiodo)
|
||||
{
|
||||
CurrPeriodo = newPeiodo;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<div class="card-body text-center">
|
||||
<div class="img-fluid" id="qrCodeImg_@idxDipendente"></div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
using GPW.CORE.Data.DbModels;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
|
||||
namespace GPW.CORE.ADM.Components.Compo
|
||||
{
|
||||
public partial class UserQrCode
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public bool LinkInt { get; set; } = true;
|
||||
|
||||
[Parameter]
|
||||
public bool LinkCore { get; set; } = true;
|
||||
|
||||
[Parameter]
|
||||
public DipendentiModel? RecordDip { get; set; } = null;
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected string rawCode = "";
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected int idxDipendente
|
||||
{
|
||||
get => RecordDip != null ? RecordDip.IdxDipendente : 0;
|
||||
}
|
||||
|
||||
|
||||
protected string getUrlCode(string baseUrl, string authKey)
|
||||
{
|
||||
return $"{baseUrl}jumper?idxDipendente={RecordDip.IdxDipendente}&authKey={authKey}";
|
||||
}
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
if (RecordDip != null)
|
||||
{
|
||||
string baseUrl = LinkInt ? UrlLinkInt : UrlLinkExt;
|
||||
// aggiungo parte core/legacy
|
||||
baseUrl += LinkCore ? UrlLinkCore : UrlLinkLega;
|
||||
//calcolo authKey valida x url --> escaped!
|
||||
string authKeyFix = System.Web.HttpUtility.UrlEncode(RecordDip.AuthKey);
|
||||
string newCode = getUrlCode(baseUrl, authKeyFix);
|
||||
if (rawCode != newCode)
|
||||
{
|
||||
rawCode = newCode;
|
||||
await JSRuntime.InvokeVoidAsync("clearContent", $"qrCodeImg_{RecordDip.IdxDipendente}");
|
||||
await JSRuntime.InvokeVoidAsync("displayQr", $"qrCodeImg_{RecordDip.IdxDipendente}", rawCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
initConf();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private string UrlLinkExt = "";
|
||||
|
||||
private string UrlLinkInt = "";
|
||||
|
||||
private string UrlLinkCore = "";
|
||||
|
||||
private string UrlLinkLega = "";
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private int _idxDip { get; set; } = 0;
|
||||
|
||||
[Inject]
|
||||
private IConfiguration Configuration { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
private IJSRuntime JSRuntime { get; set; } = null!;
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// init valori da config
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private void initConf()
|
||||
{
|
||||
UrlLinkInt = Configuration.GetValue<string>("OptPar:UrlLinkInt") ?? "";
|
||||
UrlLinkExt = Configuration.GetValue<string>("OptPar:UrlLinkExt") ?? "";
|
||||
UrlLinkCore = Configuration.GetValue<string>("OptPar:UrlLinkCore") ?? "";
|
||||
UrlLinkLega = Configuration.GetValue<string>("OptPar:UrlLinkLega") ?? "";
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
|
||||
<div class="bg-dark bg-gradient bg-opacity-75 text-light border border-primary d-flex justify-content-around rounded shadow">
|
||||
<div class="w-25 text-center">
|
||||
<h1>Working</h1>
|
||||
<img src="images/wip.png" class="img-fluid"/>
|
||||
<div class="my-2">More to complete...</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
@inherits LayoutComponentBase
|
||||
|
||||
<div class="page">
|
||||
<div class="@sideClass">
|
||||
<NavMenu EC_compressUpdated="@UpdateNavDisplay" />
|
||||
</div>
|
||||
|
||||
<main>
|
||||
<div class="top-row px-4">
|
||||
<AuthorizeView>
|
||||
<LoginDisplay />
|
||||
</AuthorizeView>
|
||||
</div>
|
||||
<article class="content px-4 py-1">
|
||||
<RadzenComponents @rendermode="@(new InteractiveServerRenderMode(prerender: false))" />
|
||||
@Body
|
||||
</article>
|
||||
<div class="fixed-bottom bottom-row px-2 py-1">
|
||||
<CmpFooter></CmpFooter>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
|
||||
<div id="blazor-error-ui">
|
||||
An unhandled error has occurred.
|
||||
<a href="" class="reload">Reload</a>
|
||||
<a class="dismiss">🗙</a>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
namespace GPW.CORE.ADM.Components.Layout
|
||||
{
|
||||
public partial class MainLayout
|
||||
{
|
||||
#region Protected Properties
|
||||
|
||||
protected bool navLarge { get; set; } = true;
|
||||
|
||||
protected string sideClass { get; set; } = "sidebar";
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected void UpdateNavDisplay()
|
||||
{
|
||||
navLarge = !navLarge;
|
||||
sideClass = navLarge ? "sidebar" : "sidebarSmall";
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
.page {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
main {
|
||||
flex: 1;
|
||||
}
|
||||
.sidebar,
|
||||
.sidebarSmall {
|
||||
/*background-image: linear-gradient(180deg, rgb(5, 39, 103) 20%, #3aa6ff 90%);*/
|
||||
background: -webkit-linear-gradient(to bottom, #053787, #A57C00);
|
||||
/* Chrome 10-25, Safari 5.1-6 */
|
||||
background: linear-gradient(to bottom, #053787, #A57C00);
|
||||
/* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
|
||||
}
|
||||
.top-row {
|
||||
background-color: #f7f7f7;
|
||||
border-bottom: 1px solid #d6d5d5;
|
||||
/*justify-content: flex-end;*/
|
||||
height: 3.5rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.top-row ::deep a,
|
||||
.top-row .btn-link {
|
||||
white-space: nowrap;
|
||||
margin-left: 1.5rem;
|
||||
}
|
||||
.top-row a:first-child {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.bottom-row {
|
||||
color: #dedede;
|
||||
background-color: #000000;
|
||||
height: 1.6rem;
|
||||
align-items: center;
|
||||
}
|
||||
@media (max-width: 640.98px) {
|
||||
.top-row:not(.auth) {
|
||||
display: none;
|
||||
}
|
||||
.top-row.auth {
|
||||
justify-content: space-between;
|
||||
}
|
||||
.top-row a,
|
||||
.top-row .btn-link {
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
@media (min-width: 641px) {
|
||||
.page {
|
||||
flex-direction: row;
|
||||
}
|
||||
.sidebar {
|
||||
width: 13.5rem;
|
||||
height: 100vh;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
}
|
||||
.sidebarSmall {
|
||||
width: 4.5rem;
|
||||
height: 100vh;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
}
|
||||
.top-row {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 1;
|
||||
}
|
||||
.top-row,
|
||||
article {
|
||||
padding-left: 0.5rem !important;
|
||||
padding-right: 0.5rem !important;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
.page {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
main {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.sidebar,
|
||||
.sidebarSmall {
|
||||
/*background-image: linear-gradient(180deg, rgb(5, 39, 103) 20%, #3aa6ff 90%);*/
|
||||
background: -webkit-linear-gradient(to bottom, #053787, #A57C00); /* Chrome 10-25, Safari 5.1-6 */
|
||||
background: linear-gradient(to bottom, #053787, #A57C00); /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
|
||||
}
|
||||
|
||||
.top-row {
|
||||
background-color: #f7f7f7;
|
||||
border-bottom: 1px solid #d6d5d5;
|
||||
/*justify-content: flex-end;*/
|
||||
height: 3.5rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.top-row ::deep a, .top-row .btn-link {
|
||||
white-space: nowrap;
|
||||
margin-left: 1.5rem;
|
||||
}
|
||||
|
||||
.top-row a:first-child {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.bottom-row {
|
||||
color: #dedede;
|
||||
background-color: #000000;
|
||||
height: 1.6rem;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
@media (max-width: 640.98px) {
|
||||
.top-row:not(.auth) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.top-row.auth {
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.top-row a, .top-row .btn-link {
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 641px) {
|
||||
.page {
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
width: 13.5rem;
|
||||
height: 100vh;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.sidebarSmall {
|
||||
width: 4.5rem;
|
||||
height: 100vh;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.top-row {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.top-row, article {
|
||||
padding-left: 0.5rem !important;
|
||||
padding-right: 0.5rem !important;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
.page{position:relative;display:flex;flex-direction:column;}main{flex:1;}.sidebar,.sidebarSmall{background:-webkit-linear-gradient(to bottom,#053787,#a57c00);background:linear-gradient(to bottom,#053787,#a57c00);}.top-row{background-color:#f7f7f7;border-bottom:1px solid #d6d5d5;height:3.5rem;display:flex;align-items:center;}.top-row ::deep a,.top-row .btn-link{white-space:nowrap;margin-left:1.5rem;}.top-row a:first-child{overflow:hidden;text-overflow:ellipsis;}.bottom-row{color:#dedede;background-color:#000;height:1.6rem;align-items:center;}@media(max-width:640.98px){.top-row:not(.auth){display:none;}.top-row.auth{justify-content:space-between;}.top-row a,.top-row .btn-link{margin-left:0;}}@media(min-width:641px){.page{flex-direction:row;}.sidebar{width:13.5rem;height:100vh;position:sticky;top:0;}.sidebarSmall{width:4.5rem;height:100vh;position:sticky;top:0;}.top-row{position:sticky;top:0;z-index:1;}.top-row,article{padding-left:.5rem!important;padding-right:.5rem!important;}}
|
||||
@@ -0,0 +1,62 @@
|
||||
<div class="top-row ps-3 navbar navbar-dark">
|
||||
<div class="container-fluid px-0">
|
||||
@if (!showText)
|
||||
{
|
||||
<a class="navbar-brand p-0" @onclick="() => ToggleCompress()">GPW <i class="fas fa-caret-square-right"></i></a>
|
||||
}
|
||||
else
|
||||
{
|
||||
<a class="navbar-brand" @onclick="() => ToggleCompress()">GPW.CORE.ADM <i class="fas fa-caret-square-left"></i></a>
|
||||
}
|
||||
<button title="Navigation menu" class="navbar-toggler" @onclick="ToggleNavMenu">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@* <input type="checkbox" title="Navigation menu" class="navbar-toggler" /> *@
|
||||
|
||||
@* <div class="nav-scrollable @NavMenuCssClass" onclick="document.querySelector('.navbar-toggler').click()"> *@
|
||||
|
||||
<div class="@NavMenuCssClass" @onclick="ToggleNavMenu">
|
||||
<nav class="flex-column">
|
||||
<div class="nav-item px-2">
|
||||
<NavLink class="nav-link" href="Home" Match="NavLinkMatch.All">
|
||||
<span class="fas fa-home px-2 fs-4" aria-hidden="true"></span>
|
||||
@if (showText)
|
||||
{
|
||||
<span class="@hideText">Home</span>
|
||||
}
|
||||
</NavLink>
|
||||
</div>
|
||||
<AuthorizeView>
|
||||
<Authorized>
|
||||
</Authorized>
|
||||
<NotAuthorized>
|
||||
<div class="alert alert-warning">Auth necessaria</div>
|
||||
</NotAuthorized>
|
||||
</AuthorizeView>
|
||||
@if (ListMenu == null || ListMenu.Count == 0)
|
||||
{
|
||||
<LoadingData DisplaySize="LoadingData.CtrlSize.Small"></LoadingData>
|
||||
}
|
||||
else
|
||||
{
|
||||
@foreach (var item in ListMenu)
|
||||
{
|
||||
<div class="nav-item px-2">
|
||||
<NavLink class="nav-link" href="@item.Url">
|
||||
<span class="@item.Descript px-2 fs-4" aria-hidden="true"></span> <span class="@hideText">@item.Title</span>
|
||||
</NavLink>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
|
||||
<div class="nav-item px-2">
|
||||
<NavLink class="nav-link" href="ForceReset">
|
||||
<span class="fas fa-sync-alt px-2 fs-4" aria-hidden="true"></span> <span class="@hideText">Reset Cache</span>
|
||||
</NavLink>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
using GPW.CORE.Data.DTO;
|
||||
using GPW.CORE.Data.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using System.Drawing.Imaging;
|
||||
|
||||
namespace GPW.CORE.ADM.Components.Layout
|
||||
{
|
||||
public partial class NavMenu : IDisposable
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<bool> EC_compressUpdated { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
AppMServ.EA_MenuUpdated -= AppMServ_EA_MenuUpdated;
|
||||
AppMServ.EA_LangSel -= AppMServ_EA_LangSel;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected MessageService AppMServ { get; set; } = null!;
|
||||
|
||||
|
||||
protected string hideText { get => showText ? "" : "invisible"; }
|
||||
|
||||
/// <summary>
|
||||
/// Idx Dipendente corrente
|
||||
/// </summary>
|
||||
protected int IdxDipendente
|
||||
{
|
||||
get
|
||||
{
|
||||
return AppMServ.IdxDipendente;
|
||||
}
|
||||
}
|
||||
|
||||
protected List<MenuItemDTO> ListMenu { get; set; } = new List<MenuItemDTO>();
|
||||
|
||||
protected bool showText { get; set; } = true;
|
||||
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
AppMServ.EA_MenuUpdated += AppMServ_EA_MenuUpdated;
|
||||
AppMServ.EA_LangSel += AppMServ_EA_LangSel;
|
||||
ReloadData();
|
||||
}
|
||||
|
||||
private void AppMServ_EA_LangSel()
|
||||
{
|
||||
ReloadData();
|
||||
InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
protected void ToggleCompress()
|
||||
{
|
||||
showText = !showText;
|
||||
EC_compressUpdated.InvokeAsync(showText);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private bool collapseNavMenu = true;
|
||||
|
||||
private bool onlyIcon = false;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
protected string? NavMenuCssClass => collapseNavMenu ? "collapse" : null;
|
||||
|
||||
protected string? TextCss => onlyIcon ? "d-none" : "";
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private void AppMServ_EA_MenuUpdated()
|
||||
{
|
||||
ReloadData();
|
||||
InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
private void ReloadData()
|
||||
{
|
||||
// rilettura menù se mancasse
|
||||
ListMenu = AppMServ.ListMenu;
|
||||
}
|
||||
|
||||
private void ToggleNavMenu()
|
||||
{
|
||||
collapseNavMenu = !collapseNavMenu;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
.navbar-toggler {
|
||||
background-color: rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
.top-row {
|
||||
height: 3.5rem;
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
.navbar-brand {
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
.oi {
|
||||
width: 2rem;
|
||||
font-size: 1.1rem;
|
||||
vertical-align: text-top;
|
||||
top: -2px;
|
||||
}
|
||||
.nav-item {
|
||||
font-size: 0.9rem;
|
||||
padding-bottom: 0.1rem;
|
||||
}
|
||||
.nav-item:first-of-type {
|
||||
padding-top: 0.5rem;
|
||||
}
|
||||
.nav-item:last-of-type {
|
||||
padding-bottom: 0.5rem;
|
||||
}
|
||||
.nav-item ::deep a {
|
||||
color: #d7d7d7;
|
||||
border-radius: 4px;
|
||||
height: 2.7rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
line-height: 2.7rem;
|
||||
}
|
||||
.nav-item ::deep a.active {
|
||||
background-color: rgba(255, 255, 255, 0.25);
|
||||
color: white;
|
||||
}
|
||||
.nav-item ::deep a:hover {
|
||||
background-color: rgba(255, 255, 255, 0.1);
|
||||
color: white;
|
||||
}
|
||||
@media (min-width: 641px) {
|
||||
.navbar-toggler {
|
||||
display: none;
|
||||
}
|
||||
.collapse {
|
||||
/* Never collapse the sidebar for wide screens */
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
.navbar-toggler {
|
||||
background-color: rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
.top-row {
|
||||
height: 3.5rem;
|
||||
background-color: rgba(0,0,0,0.5);
|
||||
}
|
||||
|
||||
.navbar-brand {
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
|
||||
.oi {
|
||||
width: 2rem;
|
||||
font-size: 1.1rem;
|
||||
vertical-align: text-top;
|
||||
top: -2px;
|
||||
}
|
||||
|
||||
.nav-item {
|
||||
font-size: 0.9rem;
|
||||
padding-bottom: 0.1rem;
|
||||
}
|
||||
|
||||
.nav-item:first-of-type {
|
||||
padding-top: 0.5rem;
|
||||
}
|
||||
|
||||
.nav-item:last-of-type {
|
||||
padding-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.nav-item ::deep a {
|
||||
color: #d7d7d7;
|
||||
border-radius: 4px;
|
||||
height: 2.7rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
line-height: 2.7rem;
|
||||
}
|
||||
|
||||
.nav-item ::deep a.active {
|
||||
background-color: rgba(255,255,255,0.25);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.nav-item ::deep a:hover {
|
||||
background-color: rgba(255,255,255,0.1);
|
||||
color: white;
|
||||
}
|
||||
|
||||
@media (min-width: 641px) {
|
||||
.navbar-toggler {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.collapse {
|
||||
/* Never collapse the sidebar for wide screens */
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
.navbar-toggler{background-color:rgba(255,255,255,.1);}.top-row{height:3.5rem;background-color:rgba(0,0,0,.5);}.navbar-brand{font-size:1.1rem;}.oi{width:2rem;font-size:1.1rem;vertical-align:text-top;top:-2px;}.nav-item{font-size:.9rem;padding-bottom:.1rem;}.nav-item:first-of-type{padding-top:.5rem;}.nav-item:last-of-type{padding-bottom:.5rem;}.nav-item ::deep a{color:#d7d7d7;border-radius:4px;height:2.7rem;display:flex;align-items:center;line-height:2.7rem;}.nav-item ::deep a.active{background-color:rgba(255,255,255,.25);color:#fff;}.nav-item ::deep a:hover{background-color:rgba(255,255,255,.1);color:#fff;}@media(min-width:641px){.navbar-toggler{display:none;}.collapse{display:block;}}
|
||||
@@ -0,0 +1,16 @@
|
||||
@page "/ApprovTimbrature"
|
||||
@inject MessageService AppMServ
|
||||
@inject AppAuthService AuthServ
|
||||
|
||||
<ApprovTimbMan></ApprovTimbMan>
|
||||
|
||||
@code {
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
// imposto pagina e info testata
|
||||
AppMServ.ShowSearch = false;
|
||||
AppMServ.PageName = AuthServ.Traduci("ApprTimb", AppMServ.UserLang);
|
||||
AppMServ.PageIcon = AuthServ.Traduci("ApprTimbExpl");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
@page "/CheckC19"
|
||||
|
||||
<WIP></WIP>
|
||||
|
||||
@code {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
@page "/clienti"
|
||||
@inject MessageService AppMServ
|
||||
@inject AppAuthService AuthServ
|
||||
|
||||
<ClientiMan></ClientiMan>
|
||||
|
||||
@code {
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
// imposto pagina e info testata
|
||||
AppMServ.ShowSearch = true;
|
||||
AppMServ.PageName = AuthServ.Traduci("ManClienti", AppMServ.UserLang);
|
||||
AppMServ.PageIcon = AuthServ.Traduci("ManClientiExpl");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
@page "/Dipendenti"
|
||||
@inject MessageService AppMServ
|
||||
@inject AppAuthService AuthServ
|
||||
|
||||
<DipendentiMan></DipendentiMan>
|
||||
|
||||
@code {
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
AppMServ.ShowSearch = true;
|
||||
AppMServ.PageName = AuthServ.Traduci("ManDipendenti", AppMServ.UserLang);
|
||||
AppMServ.PageIcon = AuthServ.Traduci("ManDipendentiExpl");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
@page "/Error"
|
||||
@using System.Diagnostics
|
||||
|
||||
<PageTitle>Error</PageTitle>
|
||||
|
||||
<h1 class="text-danger">Error.</h1>
|
||||
<h2 class="text-danger">An error occurred while processing your request.</h2>
|
||||
|
||||
@if (ShowRequestId)
|
||||
{
|
||||
<p>
|
||||
<strong>Request ID:</strong> <code>@RequestId</code>
|
||||
</p>
|
||||
}
|
||||
|
||||
<h3>Development Mode</h3>
|
||||
<p>
|
||||
Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred.
|
||||
</p>
|
||||
<p>
|
||||
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
|
||||
It can result in displaying sensitive information from exceptions to end users.
|
||||
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
|
||||
and restarting the app.
|
||||
</p>
|
||||
|
||||
@code{
|
||||
[CascadingParameter]
|
||||
private HttpContext? HttpContext { get; set; }
|
||||
|
||||
private string? RequestId { get; set; }
|
||||
private bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
|
||||
|
||||
protected override void OnInitialized() =>
|
||||
RequestId = Activity.Current?.Id ?? HttpContext?.TraceIdentifier;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
@page "/ForceReset"
|
||||
@attribute [Authorize]
|
||||
|
||||
<div class="card shadow-lg">
|
||||
<div class="card-header">
|
||||
Data Reset
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<h1>@message</h1>
|
||||
<LoadingData Title="Reset Data..." DisplaySize="LoadingData.CtrlSize.Large" DisplayMode="LoadingData.SpinMode.BounceLine"></LoadingData>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
using GPW.CORE.Data.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace GPW.CORE.ADM.Components.Pages
|
||||
{
|
||||
public partial class ForceReset
|
||||
{
|
||||
#region Protected Fields
|
||||
|
||||
protected string message = "Resetting Cache!";
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected MessageService AppMServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected AppAuthService AuthService { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected GpwDataService GDataServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected LicenseService LicServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected NavigationManager NavManager { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await Task.Delay(10);
|
||||
await GDataServ.FlushRedisCache();
|
||||
await Task.Delay(10);
|
||||
await AuthService.FlushRedisCache();
|
||||
await Task.Delay(10);
|
||||
LicServ.ResetLicenseData();
|
||||
await Task.Delay(10);
|
||||
|
||||
AppMServ.clonedRA = null;
|
||||
AppMServ.recordRA = null;
|
||||
message = "Reset done, now redirect!";
|
||||
|
||||
await Task.Delay(100);
|
||||
|
||||
// passo a pagina home
|
||||
NavManager.NavigateTo("Home", true);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
@page "/GestCalendario"
|
||||
|
||||
<div class="card shadow-lg">
|
||||
<div class="card-header table-primary d-flex justify-content-between">
|
||||
<div class="px-0">
|
||||
<h3>Chiusure aziendali</h3>
|
||||
</div>
|
||||
<div class="px-0 d-flex">
|
||||
<div class="px-1">
|
||||
@if (ShowAddFes)
|
||||
{
|
||||
<div class="input-group mb-3">
|
||||
<span class="input-group-text">Anno</span>
|
||||
<input type="number" class="form-control text-end" @bind="@YearReq">
|
||||
<button class="btn btn-success" @onclick=@AddAllHolidays><i class="fa-solid fa-plus"></i> Aggiungi Festività</button>
|
||||
</div>
|
||||
}
|
||||
@if (ShowAddFer)
|
||||
{
|
||||
<div class="input-group mb-3 text-nowrap small">
|
||||
<span class="input-group-text">Periodo</span>
|
||||
<input type="date" class="form-control text-end" style="width: 8rem;" @bind="@DtInizio">
|
||||
<input type="date" class="form-control text-end" style="width: 8rem;" @bind="@DtFine">
|
||||
<span class="input-group-text">Descr</span>
|
||||
<input type="text" class="form-control text-end" style="width: 10rem;" @bind="@DescrFerie">
|
||||
<button class="btn btn-success" @onclick=@AddFerie><i class="fa-solid fa-floppy"></i> Salva</button>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
@if (!ShowAddFer)
|
||||
{
|
||||
<div class="px-1">
|
||||
<button class="btn btn-warning" @onclick=@TglAddFes><i class="fa-solid fa-ellipsis-v"></i> @TxtFes</button>
|
||||
</div>
|
||||
}
|
||||
@if (!ShowAddFes)
|
||||
{
|
||||
<div class="px-1">
|
||||
<button class="btn btn-danger" @onclick=@TglAddFer><i class="fa-solid fa-ellipsis-v"></i> @TxtFer</button>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body p-1">
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
@if (isLoading)
|
||||
{
|
||||
<LoadingData></LoadingData>
|
||||
}
|
||||
else
|
||||
{
|
||||
<CalAzMan ReportUpdate=ForceReloadCal DtStart="@dtMin" DtEnd="@dtMax"></CalAzMan>
|
||||
}
|
||||
</div>
|
||||
<div class="col-8 ps-0">
|
||||
<CalendarioAziendale EvDtoList="@SchedEvList" MonthDispl="@numMesi" firstDate="@dtMin" minDate="@dtMin" maxDate="@dtMax" MonthReq="SetMonth" DtReq="SetDate"></CalendarioAziendale>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,202 @@
|
||||
using EgwCoreLib.Utils;
|
||||
using GPW.CORE.Data.DbModels;
|
||||
using GPW.CORE.Data.DTO;
|
||||
using GPW.CORE.Data.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
|
||||
namespace GPW.CORE.ADM.Components.Pages
|
||||
{
|
||||
public partial class GestCalendario
|
||||
{
|
||||
#region Protected Fields
|
||||
|
||||
protected int anno = DateTime.Today.Year;
|
||||
|
||||
protected DateTime dtMax = DateTime.Today.AddMonths(1);
|
||||
|
||||
protected DateTime dtMin = DateTime.Today;
|
||||
|
||||
protected int numMesi = 6;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected MessageService AppMServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected GpwDataService DataService { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected GpwDataService GDataServ { get; set; } = null!;
|
||||
|
||||
protected int idxDipendente
|
||||
{
|
||||
get => AppMServ.IdxDipendente;
|
||||
}
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected async Task AddAllHolidays()
|
||||
{
|
||||
// chiedo verifica
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", $"Confermi di voler aggiungere tutte le festività dell'anno {YearReq}?"))
|
||||
return;
|
||||
|
||||
isLoading = true;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
var elFest = EgwCoreLib.Utils.GestCalendario.ListHolidaysIta(YearReq);
|
||||
// preparo elenco
|
||||
foreach (var item in elFest)
|
||||
{
|
||||
CalFesteFerieModel currRecord = new CalFesteFerieModel()
|
||||
{
|
||||
data = item.When,
|
||||
codGiust = "FEST",
|
||||
descrizione = item.What
|
||||
};
|
||||
// aggiungo!
|
||||
await GDataServ.CalFestFerieUpsert(currRecord);
|
||||
await Task.Delay(5);
|
||||
}
|
||||
isLoading = false;
|
||||
ReloadData();
|
||||
}
|
||||
|
||||
protected async Task AddFerie()
|
||||
{
|
||||
// chiedo verifica
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", $"Confermi di voler aggiungere Chiusura Aziendale per il periodo {DtInizio:yyyy-MM-dd} - {DtFine:yyyy-MM-dd}?"))
|
||||
return;
|
||||
|
||||
isLoading = true;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
int numDays = (int)DtFine.Subtract(DtInizio).TotalDays + 1;
|
||||
// ciclo x i giorni
|
||||
for (int i = 0; i < numDays; i++)
|
||||
{
|
||||
CalFesteFerieModel currRecord = new CalFesteFerieModel()
|
||||
{
|
||||
data = DtInizio.AddDays(i),
|
||||
codGiust = "FER",
|
||||
descrizione = DescrFerie
|
||||
};
|
||||
// aggiungo!
|
||||
await GDataServ.CalFestFerieUpsert(currRecord);
|
||||
await Task.Delay(5);
|
||||
}
|
||||
isLoading = false;
|
||||
ReloadData();
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
// recupero mesi da gestire
|
||||
var monthConf = await DataService.ConfigGetKeyAsync("NumMesiCalAzienda");
|
||||
if (monthConf != null)
|
||||
{
|
||||
int intVal = 0;
|
||||
int.TryParse(monthConf.valore, out intVal);
|
||||
numMesi = intVal > 0 ? intVal : numMesi;
|
||||
}
|
||||
// fix iniziale date... setup periodo (da rivedere in funzione eventi cambio mese dei controlli?!?)
|
||||
dtRif = DateTime.Today;
|
||||
dtMin = new DateTime(dtRif.Year, 1, 1);
|
||||
dtMax = dtMin.AddYears(1);
|
||||
ReloadData();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private string DescrFerie = "CHIUSURA UFFICIO";
|
||||
private DateTime dtRif = DateTime.Today;
|
||||
private bool isLoading = false;
|
||||
private bool ShowAddFer = false;
|
||||
private bool ShowAddFes = false;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private DateTime DtFine { get; set; } = DateTime.Today;
|
||||
private DateTime DtInizio { get; set; } = DateTime.Today;
|
||||
|
||||
/// <summary>
|
||||
/// Elenco eventi formato originale (EventDTO)
|
||||
/// </summary>
|
||||
private List<EventDTO> SchedEvList { get; set; } = new List<EventDTO>();
|
||||
|
||||
private string TxtFer
|
||||
{
|
||||
get => ShowAddFer ? "Nascondi Add Chiusure" : "Mostra Add Chiusure";
|
||||
}
|
||||
|
||||
private string TxtFes
|
||||
{
|
||||
get => ShowAddFes ? "Nascondi Add Feste" : "Mostra Add Feste";
|
||||
}
|
||||
|
||||
private int YearReq { get; set; } = DateTime.Today.Year;
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private void ForceReloadCal()
|
||||
{
|
||||
ReloadData();
|
||||
}
|
||||
|
||||
private void ReloadData()
|
||||
{
|
||||
isLoading = true;
|
||||
// recupero direttamente da oggetto DB
|
||||
SchedEvList = DataService.EventListPeriodo(idxDipendente, dtMin, dtMax);
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
private void SetDate(DateTime newDate)
|
||||
{
|
||||
// se la data fosse esterna all'intervallo considerato...)
|
||||
if (newDate < dtMin || newDate > dtMax)
|
||||
{
|
||||
dtRif = newDate;
|
||||
dtMin = new DateTime(newDate.Year, 1, 1);
|
||||
dtMax = new DateTime(newDate.Year + 1, 1, 1);
|
||||
ReloadData();
|
||||
}
|
||||
}
|
||||
|
||||
private void SetMonth(int newNum)
|
||||
{
|
||||
if (numMesi != newNum)
|
||||
{
|
||||
numMesi = newNum;
|
||||
}
|
||||
ReloadData();
|
||||
}
|
||||
|
||||
private void TglAddFer()
|
||||
{
|
||||
ShowAddFer = !ShowAddFer;
|
||||
ShowAddFes = false;
|
||||
}
|
||||
|
||||
private void TglAddFes()
|
||||
{
|
||||
ShowAddFer = false;
|
||||
ShowAddFes = !ShowAddFes;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
@page "/GestOrario"
|
||||
@inject MessageService AppMServ
|
||||
@inject AppAuthService AuthServ
|
||||
|
||||
<OrarioMan></OrarioMan>
|
||||
|
||||
@code {
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
// imposto pagina e info testata
|
||||
AppMServ.ShowSearch = false;
|
||||
AppMServ.PageName = AuthServ.Traduci("ManOrarioTipo", AppMServ.UserLang);
|
||||
AppMServ.PageIcon = AuthServ.Traduci("ManOrarioTipoExpl");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
@page "/Gruppi"
|
||||
@inject MessageService AppMServ
|
||||
@inject AppAuthService AuthServ
|
||||
|
||||
<GruppiMan></GruppiMan>
|
||||
|
||||
@code {
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
// imposto pagina e info testata
|
||||
AppMServ.ShowSearch = false;
|
||||
AppMServ.PageName = AuthServ.Traduci("ManGruppi", AppMServ.UserLang);
|
||||
AppMServ.PageIcon = AuthServ.Traduci("ManGruppiExpl");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
@page "/"
|
||||
@page "/Home"
|
||||
@page "/Index"
|
||||
|
||||
<PageTitle>Home</PageTitle>
|
||||
|
||||
<div class="row px-0 mx-0">
|
||||
<div class="col-12 col-lg-10 col-xl-8 offset-lg-1 offset-xl-2">
|
||||
<div class="mt-2 p-4 bg-secondary bg-gradient bg-opacity-25 border border-light rounded shadow">
|
||||
<div class="row">
|
||||
<div class="col-6 col-md-8 pr-0">
|
||||
<h1>GPW</h1>
|
||||
<div>
|
||||
@Traduci("GpwPresentationText");
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-md-4 text-right pl-0">
|
||||
<div class="d-flex flex-row-reverse">
|
||||
<div class="px-2 badge rounded-pill bg-dark my-4">
|
||||
<div class="p-2" style="font-size: 1.5em;">
|
||||
<a class="text-light" href="https://www.egalware.com/" target="_blank">powered by EgalWare <img width="32" class="img-fluid" src="images/LogoEgw.png" /></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row border-dark border-top text-secondary">
|
||||
<div class="col-12">
|
||||
<div class="small text-end">GPW Admin - versione Blazor .NET8</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mt-5">
|
||||
@if (ListMenu == null || ListMenu.Count == 0)
|
||||
{
|
||||
<LoadingData></LoadingData>
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
<div class="shortcuts">
|
||||
@foreach (var item in ListMenu)
|
||||
{
|
||||
<span class="px-1">
|
||||
<NavLink class="shortcut rounded-3 text-dark shadow py-3 px-1" href="@item.Url">
|
||||
<i class="@item.Descript fa-2x"></i>
|
||||
<span class="shortcut-label">@item.Title</span>
|
||||
</NavLink>
|
||||
</span>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,64 @@
|
||||
using GPW.CORE.Data.DTO;
|
||||
using GPW.CORE.Data.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace GPW.CORE.ADM.Components.Pages
|
||||
{
|
||||
public partial class Home : IDisposable
|
||||
{
|
||||
#region Public Methods
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
AppMServ.EA_MenuUpdated -= AppMServ_EA_MenuUpdated;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected MessageService AppMServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected AppAuthService AuthServ { get; set; } = null!;
|
||||
|
||||
protected List<MenuItemDTO> ListMenu { get; set; } = new List<MenuItemDTO>();
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
AppMServ.ShowSearch = false;
|
||||
AppMServ.PageName = "";
|
||||
AppMServ.PageIcon = "";
|
||||
AppMServ.EA_MenuUpdated += AppMServ_EA_MenuUpdated;
|
||||
ReloadData();
|
||||
}
|
||||
|
||||
protected string Traduci(string lemma)
|
||||
{
|
||||
return AuthServ.Traduci(lemma, AppMServ.UserLang);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private void AppMServ_EA_MenuUpdated()
|
||||
{
|
||||
ReloadData();
|
||||
InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
private void ReloadData()
|
||||
{
|
||||
// rilettura menù se mancasse
|
||||
ListMenu = AppMServ.ListMenu;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
@page "/Malattia"
|
||||
|
||||
<div class="card shadow-lg">
|
||||
<div class="card-header table-primary d-flex justify-content-between">
|
||||
<div>
|
||||
<h3>Certificati Malattia</h3>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body p-1">
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
@if (isLoading)
|
||||
{
|
||||
<LoadingData></LoadingData>
|
||||
}
|
||||
else
|
||||
{
|
||||
<RegMalattia ReportUpdate=ForceReloadCal DtStart="@dtMin" DtEnd="@dtMax"></RegMalattia>
|
||||
}
|
||||
</div>
|
||||
<div class="col-8 ps-0">
|
||||
<CalendarioAziendale EvDtoList="@SchedEvList" MonthDispl="@numMesi" firstDate="@dtMin" minDate="@dtMin" maxDate="@dtMax" MonthReq="SetMonth" DtReq="SetDate"></CalendarioAziendale>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user